config-audit/commands
Kjell Tore Guttormsen 05f1e954d0 fix(fix): validate the arguments, back up renames, and verify the scope it fixed
Dogfooding `/config-audit fix` against a throwaway repo copy. All eight
predictions registered in the fasit before the run were confirmed, and three
further defects surfaced that were not predicted.

- M-BUG-21, third arm: the argument loop ended in `!arg.startsWith('-') =>
  targetPath`, so an unknown flag was dropped and its value became the target.
  In `fix` that is the WRITE target under `--apply`. Unknown options and a
  value-less `--output-file` now exit 3.
- `--dry-run` was documented in the command's argument-hint and never
  implemented; `--output-file` did not exist, so `commands/fix.md` told the
  agent to Read a file nothing produced. Both now exist.
- M-BUG-31: `file-rename` was excluded from the backup set, so a renamed rule
  file had no backup entry while the command promised one and returned a
  backupId that could not restore it.
- M-BUG-32: `verifyFixes` hardcoded `includeGlobal: false`, so after a
  `--global` run every untouched user-scope finding was reported as verified.
  Reproduced against an unmodified ~/.claude/CLAUDE.md.
- M-BUG-29: a rename was applied before other fixes on the same file, which
  then failed with ENOENT while the run still exited 0. Renames sort last.
- M-BUG-30: `severityOrder[s] || 4` maps critical (0) to 4, so critical fixes
  sorted last. The old test used the same falsy fallback and agreed with the
  bug. Now `?? 4`.
- A failed fix exits 2 instead of 0, matching the other scanners' convention.

Frozen tests/snapshots/v5.0.0/ untouched; --json/--raw stdout byte-identical.
Suite 1420/0 (+10).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YJ3MCDCnyw7wZSPnUXVhYS
2026-07-31 18:41:27 +02:00
..
analyze.md fix(acr): analyze persists agent-returned report (M-BUG-18) 2026-07-16 20:24:12 +02:00
campaign.md docs(campaign): render machine-wide token bill + refresh-tokens surface (v5.9 B2b-3) 2026-06-23 17:28:05 +02:00
cleanup.md feat(humanizer): update action command templates [skip-docs] 2026-05-01 19:50:47 +02:00
config-audit.md fix(commands): wire knowledge-refresh into router + help 2026-06-23 10:31:05 +02:00
discover.md feat(humanizer): update audit/analysis command templates group B [skip-docs] 2026-05-01 19:45:55 +02:00
drift.md fix(drift): validate the arguments and the baseline anchor drift never checked 2026-07-31 18:20:04 +02:00
feature-gap.md feat(humanizer): update audit/analysis command templates group A [skip-docs] 2026-05-01 19:41:08 +02:00
fix.md fix(fix): validate the arguments, back up renames, and verify the scope it fixed 2026-07-31 18:41:27 +02:00
help.md fix(commands): wire knowledge-refresh into router + help 2026-06-23 10:31:05 +02:00
implement.md fix(rollback): restore the backup path contract the engine and the commands disagreed on 2026-07-31 17:23:30 +02:00
interview.md feat(humanizer): update action command templates [skip-docs] 2026-05-01 19:50:47 +02:00
knowledge-refresh.md feat(knowledge): knowledge-refresh — living register, deterministic stale core + web poll (v5.7 Chunk 3) 2026-06-21 19:22:57 +02:00
manifest.md feat(mft): v5.6 B1 — load-pattern accounting in manifest 2026-06-20 17:48:55 +02:00
optimize.md feat(optimize): add --subtract, the subtraction axis, behind a deterministic floor 2026-07-31 16:24:51 +02:00
plan.md feat(humanizer): update action command templates [skip-docs] 2026-05-01 19:50:47 +02:00
plugin-health.md feat(humanizer): update audit/analysis command templates group B [skip-docs] 2026-05-01 19:45:55 +02:00
posture.md feat(humanizer): update audit/analysis command templates group A [skip-docs] 2026-05-01 19:41:08 +02:00
rollback.md fix(rollback): restore the backup path contract the engine and the commands disagreed on 2026-07-31 17:23:30 +02:00
status.md feat(humanizer): update audit/analysis command templates group B [skip-docs] 2026-05-01 19:45:55 +02:00
tokens.md feat(tokens): stale plugin-cache disk-cleanup finding, honestly labelled Dead config (v5.9 B3b) 2026-06-23 18:17:55 +02:00
whats-active.md feat(humanizer): update audit/analysis command templates group A [skip-docs] 2026-05-01 19:41:08 +02:00