config-audit/commands
Kjell Tore Guttormsen 001090261e fix(plugin-health): make the command able to read what the scanner found
Dogfooding `/config-audit plugin-health` against a fasit registered before the
run: 11 of 12 predictions confirmed, 1 refuted with evidence, 0 deviations.
The command's default path could not produce the report it documents.

M-BUG-21 (third arm): the argument loop ended in
`else if (!args[i].startsWith('-')) targetPath = args[i]` with no unknown-flag
branch, so `--output-file /tmp/x.json` was dropped and its value became the scan
target. Worse than in drift-cli: a non-existent path discovers no plugins, so the
scanner answered "No plugins found" (info) with exit 0 — a reassuring answer, not
an error. Unknown options and a value-less `--output-file` now exit 3.

M-BUG-33: the scanner had no `--output-file` and its default-mode report goes to
stderr, which `commands/plugin-health.md` discards with `2>/dev/null` before
telling the agent to read stdout. Zero bytes captured.

M-BUG-34: per-plugin rows and the grade formula never left `scan()` — the only
grade code, `formatPluginHealthReport`, had no caller — and cross-plugin findings
were flattened behind a `category` they share with per-plugin findings. The
mandated table and Cross-Plugin section were unbuildable, so the command had to
fabricate them. `scanDetailed()` now returns them; `scan()`'s frozen v5.0.0
envelope is unchanged by construction.

M-BUG-35: `.claude-plugin/marketplace.json` was flagged as an unknown file. It is
the documented catalog location, and `"source": "./"` makes the repo root its own
plugin, so one `.claude-plugin/` legitimately holds both.

Also: `commands/posture.md` ran both optional scanners in default mode under
`2>/dev/null` and read stdout — the same class as feature-gap.md:133 in the fix
chunk. A CLI-side flag fix does not close its callers.

Tests 1420 -> 1432, red first. Frozen v5.0.0 snapshots untouched.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XhhZ8zg1amR7YCAPqiZWdt
2026-07-31 21:08:32 +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 fix(plugin-health): make the command able to read what the scanner found 2026-07-31 21:08:32 +02:00
posture.md fix(plugin-health): make the command able to read what the scanner found 2026-07-31 21:08:32 +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