Skip to content

fix(config): honor the watch key in TOML config - #6

Merged
amix merged 1 commit into
mainfrom
amix/config-watch-key
May 16, 2026
Merged

amix merged 1 commit into
mainfrom
amix/config-watch-key

Conversation

@amix

@amix amix commented May 16, 2026

Copy link
Copy Markdown
Owner

Context

Backport of modem-dev/hunk#279. PR 2 of an expert-gated backport series.

watch = true in .dunk/config.toml (or ~/.config/dunk/config.toml) was silently ignored. readConfigPreferences never read source.watch, and the final per-invocation override forced watch: input.options.watch ?? false, discarding any config-layer value — so the only way to get watch mode was passing --watch every time.

What was changed

  • readConfigPreferences reads watch: normalizeBoolean(source.watch) — same pattern as the other booleans, returns undefined when absent so mergeOptions preserves layer precedence.
  • Final override now input.options.watch ?? resolvedOptions.watch ?? false: CLI --watch still wins, absence of it defers to the resolved config value.
  • README documents the watch key; CHANGELOG ### Added entry.
  • Adapted from upstream (dunk has no vcs field).

Expert-reviewed: full resolution pipeline traced across all four precedence cases, verdict "correct, ship it"; incorporated the recommended repo-over-global test sub-case.

Verification

  • bun run typecheck, bun run lint: clean.
  • config.test.ts: 7 pass. New case asserts: config true → watched; CLI --watch over config false → watched; no config → false; repo config false over global config true → false (layer precedence).
  • Full src/core suite: 171 pass.

🤖 Generated with Claude Code

`watch = true` in `.dunk/config.toml` (or the global config) was silently
ignored: `readConfigPreferences` never read `source.watch`, and the final
per-invocation override forced `watch: input.options.watch ?? false`,
discarding any config-layer value.

Read `watch` like the other booleans and fall back to the resolved config
value when no `--watch` flag is given (`input.options.watch ??
resolvedOptions.watch ?? false`). The CLI still wins; layer precedence
(repo over global) is preserved via the existing `mergeOptions` path.

Backports modem-dev/hunk#279, adapted to dunk (no `vcs` field).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@amix
amix marked this pull request as ready for review May 16, 2026 19:36
@amix
amix merged commit 627902a into main May 16, 2026
2 checks passed
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.

1 participant