Skip to content

fix: honor config-file silent and verbose in logger configuration#2316

Merged
dyoshikawa merged 2 commits into
mainfrom
resolve-issue-2312-config-silent
Jul 20, 2026
Merged

fix: honor config-file silent and verbose in logger configuration#2316
dyoshikawa merged 2 commits into
mainfrom
resolve-issue-2312-config-silent

Conversation

@cm-dyoshikawa

Copy link
Copy Markdown
Collaborator

Summary

Fixes the documented no-op reported in #2312: silent: true in rulesync.jsonc was parsed and resolved correctly, but the logger was configured from CLI flags only (wrapCommand), and Config.getSilent() had zero call sites — so only --silent worked. verbose had the same wiring gap for logger.debug.

Changes

  • Centralized re-configuration: ConfigResolver.resolve now re-configures the supplied logger from the resolved verbose/silent as soon as the base and local config files are merged — before the resolver's own warnings fire — so config-file settings apply end to end. CLI flags still win through the existing pick (CLI > local > base > default) precedence. Re-configuration only happens when the caller threads a logger through, since those call sites also pass their CLI flags (keeping precedence intact).
  • Logger threading: convert, install, and gitignore now pass their logger (and, for gitignore, the CLI verbose/silent flags) into ConfigResolver.resolve; generate and import already did.
  • Escape hatches closed: added a shared fallbackLogger in src/utils/logger.ts that wrapCommand configures from CLI flags and ConfigResolver.resolve keeps in sync with the resolved config. warnWithFallback(undefined, ...) now routes through it instead of raw console.warn, and the unconfigured module-level ConsoleLogger fallbacks in the qwencode/augmentcode permission translators now alias it — so those warn paths honor silent too (issue items 1 and 2).
  • verbose: true in the config file now enables logger.debug (issue item 4).

Tests

  • ConfigResolver re-configuration: config-file values applied, CLI flags winning, config-file verbose enabling debug, and no fallback mutation when no logger is supplied.
  • warnWithFallback routing and fallback silent suppression.
  • Updated existing mocks/spies that assumed the old one-argument resolve calls or raw console.warn fallback.

Closes #2312

🤖 Generated with Claude Code

Config-file silent: true was a documented no-op: wrapCommand configured
the logger from CLI flags only and Config.getSilent() had no call sites.

- ConfigResolver.resolve now re-configures the supplied logger (and the
  shared fallbackLogger) from the resolved verbose/silent as soon as the
  config files are merged, so config-file settings apply to everything
  logged afterwards. CLI flags still win via the existing pick precedence.
- Thread the command logger into ConfigResolver.resolve from the convert,
  install, and gitignore commands (generate and import already did).
- Replace the unconfigured module-level ConsoleLogger fallbacks in the
  qwencode/augmentcode permission translators with a shared fallbackLogger
  that wrapCommand and ConfigResolver keep configured, and route
  warnWithFallback(undefined, ...) through it so those warn paths honor
  silent end to end.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 19, 2026 16:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a wiring gap in Rulesync’s CLI logging: silent/verbose values from rulesync.jsonc were being resolved correctly but were not applied to the configured logger (so only CLI flags consistently affected output). The change centralizes logger re-configuration inside ConfigResolver.resolve, threads loggers into more command entrypoints, and introduces a shared fallback logger so “no-logger” warning paths also honor silent.

Changes:

  • Re-configure the supplied logger (and a shared fallback logger) from resolved silent/verbose early in ConfigResolver.resolve, so config-file values affect subsequent warnings and debug output.
  • Thread command loggers into ConfigResolver.resolve for additional CLI commands (convert, install, gitignore) so precedence (CLI > file) remains consistent.
  • Route warnWithFallback(undefined, ...) and certain module-level permission translator warnings through a shared fallbackLogger, with new/updated tests.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/utils/logger.ts Adds fallbackLogger and changes warnWithFallback to route through it.
src/utils/logger.test.ts Adds unit tests validating warnWithFallback routing and fallback silent suppression.
src/features/permissions/qwencode-permissions.ts Replaces a private module ConsoleLogger fallback with fallbackLogger so silent is honored.
src/features/permissions/augmentcode-permissions.ts Same as above for AugmentCode permissions translator.
src/features/mcp/codexcli-mcp.test.ts Updates tests to spy on fallbackLogger.warn instead of console.warn.
src/config/config-resolver.ts Re-configures logger/fallback logger from resolved config silent/verbose early during resolution.
src/config/config-resolver.test.ts Adds regression tests for resolver-driven logger reconfiguration and fallback behavior.
src/cli/wrap-command.ts Configures fallbackLogger from CLI flags alongside the command logger.
src/cli/index.ts Passes verbose/silent options through to gitignoreCommand.
src/cli/commands/install.ts Threads { logger } into ConfigResolver.resolve.
src/cli/commands/gitignore.ts Threads CLI verbose/silent and { logger } into ConfigResolver.resolve.
src/cli/commands/convert.ts Threads { logger } into ConfigResolver.resolve.
src/cli/commands/convert.test.ts Updates expectations to include { logger } passed to ConfigResolver.resolve.

Comment thread src/utils/logger.ts
Comment on lines +229 to +236
/**
* Shared fallback logger for code paths that have no command logger threaded
* through (module-level translators, `warnWithFallback(undefined, ...)`).
* `wrapCommand` configures it from CLI flags and `ConfigResolver.resolve`
* re-configures it from the resolved config, so `silent`/`verbose` settings
* are honored even on paths where the command logger is not available.
*/
export const fallbackLogger: Logger = new ConsoleLogger();
Comment thread src/config/config-resolver.ts Outdated
Comment on lines +292 to +298
// Wire the resolved `verbose`/`silent` into the logger as soon as they are
// known, so config-file settings are honored by every message emitted from
// here on (including the warnings later in this resolution). CLI flags
// still win via `pick`. Only re-configure when the caller threaded a
// logger through — those call sites pass their CLI flags in the params, so
// precedence stays intact. The shared `fallbackLogger` is kept in sync for
// paths that have no logger threaded through.
Comment thread src/cli/index.ts
Comment on lines 82 to 86
targets: resolvedTargets ? [...resolvedTargets] : undefined,
features: cliFeatures,
verbose: (options as { verbose?: boolean }).verbose,
silent: (options as { silent?: boolean }).silent,
});
Address review findings: BaseLogger.configure no longer warns on
verbose+silent — with the logger now re-configured from resolved config
values, the warning fired up to four times, leaked raw console.warn into
--json mode via the fallbackLogger, and mislabeled a config-file silent
as a CLI flag conflict. The warning moved to warnOnConflictingFlags,
called once in wrapCommand with JSON-mode suppression. Silent still
always wins over verbose regardless of source. Also restore
fallbackLogger state in tests and document the process-global caveat.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 19, 2026 16:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (2)

src/config/config-resolver.ts:314

  • When the supplied logger is a JsonLogger (logger.jsonMode === true), the shared fallbackLogger remains a ConsoleLogger and will emit plain-text warnings, which can corrupt JSON-mode output. Consider forcing the fallback into silent mode when the resolved logger is in JSON mode.
      fallbackLogger.configure({ verbose: resolvedVerbose, silent: resolvedSilent });

src/cli/index.ts:85

  • resolveGitignoreTargets() calls ConfigResolver.resolve({}) without threading the command logger or CLI verbose/silent. That means warnings emitted during target resolution can bypass config-file silent/verbose reconfiguration, undermining the goal of honoring config-file logging settings end-to-end.
        await gitignoreCommand(logger, {
          targets: resolvedTargets ? [...resolvedTargets] : undefined,
          features: cliFeatures,
          verbose: (options as { verbose?: boolean }).verbose,
          silent: (options as { silent?: boolean }).silent,

Comment thread src/cli/wrap-command.ts
};
warnOnConflictingFlags({ ...cliLoggerOptions, jsonMode: logger.jsonMode });
logger.configure(cliLoggerOptions);
fallbackLogger.configure(cliLoggerOptions);
@cm-dyoshikawa

Copy link
Copy Markdown
Collaborator Author

Status: iteration-2 review round is clean (zero mid-or-above findings; the three iteration-1 mid findings around the conflicting-flags warning were fixed in 9fa06cb) and all 9 CI checks are green. Merge is blocked for this session's credentials (cm-dyoshikawa has write access only; the main ruleset requires approval from someone other than the last pusher, and self-approval is not possible). Ready for a one-click merge by the maintainer.

@dyoshikawa
dyoshikawa merged commit 03c8cc6 into main Jul 20, 2026
10 checks passed
@dyoshikawa

Copy link
Copy Markdown
Owner

@cm-dyoshikawa Thank you!

@dyoshikawa
dyoshikawa deleted the resolve-issue-2312-config-silent branch July 20, 2026 01:52
@dyoshikawa dyoshikawa mentioned this pull request Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Config-file silent: true is ignored: logger only honors CLI flags, plus warn paths that bypass silent entirely

3 participants