Move verbose into Config; drop resolveVerbose

Verbose was awkwardly a separate runKeeper argument with a separate
resolveVerbose helper, even though it's just another tunable on the
same precedence ladder as the numeric fields. This commit collapses it.

Changes:

- Config gains 'readonly verbose: boolean'. DEFAULT_CONFIG sets it to
  false.
- resolveConfig now returns the full Config including verbose. Verbose
  layers with the same 'first defined value wins' precedence as the
  numeric fields.
- resolveVerbose is gone.
- ParsedCliArgs.verbose becomes boolean | undefined: undefined when -V
  was not passed, true when it was. parseCliArgs maps accordingly.
  This lets the layered resolver treat verbose uniformly.
- runKeeper takes a single Config arg. The internal logger reads from
  config.verbose at the top of runKeeper.
- move.ts no longer plumbs verbose separately; the single resolved
  Config drives everything.
- README How-it-works and Files-table entries updated to match.

Behavior verified for all five verbose-precedence cases (no file/no
flag, no file/-V, file:true/no flag, file:false/-V, file:false/no
flag) and config-error scenarios remain intact.
This commit is contained in:
2026-06-17 12:45:46 -05:00
parent ccc136f727
commit 940113019d
5 changed files with 52 additions and 52 deletions
+5 -4
View File
@@ -15,7 +15,9 @@
* 2. `--help` / `--version` short-circuit before any I/O or mouse work.
* 3. Load + validate the config file (default XDG path, or `--config
* <path>` if supplied). Validation failures share the exit-2 path.
* 4. Resolve config (CLI > file > DEFAULT_CONFIG) and the verbose flag.
* 4. Resolve the full `Config` (CLI > file > DEFAULT_CONFIG) verbose
* lives inside `Config` and is layered with the same precedence as
* the numeric fields.
* 5. Run keeper. Any unhandled rejection exits 1.
*
* Runtime: Bun (uses `@nut-tree-fork/nut-js` via `keeper.ts`). The shebang
@@ -24,7 +26,7 @@
import { parseCliArgs, printHelp, VERSION } from "./cli.ts";
import type { ParsedCliArgs } from "./cli.ts";
import { resolveConfig, resolveVerbose } from "./config.ts";
import { resolveConfig } from "./config.ts";
import type { ConfigOverrides } from "./config.ts";
import { loadConfigFile } from "./configFile.ts";
import { runKeeper } from "./keeper.ts";
@@ -71,9 +73,8 @@ const cliOverrides: ConfigOverrides = {
};
const config = resolveConfig(fileOverrides, cliOverrides);
const verbose: boolean = resolveVerbose(fileOverrides, cliOverrides);
runKeeper(config, verbose).catch((err: unknown): void => {
runKeeper(config).catch((err: unknown): void => {
console.error("Error:", err);
process.exit(1);
});