From 96b436706f09432af09cec606c7f29cefbcbc8e4 Mon Sep 17 00:00:00 2001 From: ruv Date: Tue, 16 Jun 2026 22:07:21 -0400 Subject: [PATCH] fix(metaharness): current subcommand list + mint anti-MCP guard (iter 73) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two related correctness fixes. PROBLEM A — STALE SUBCOMMAND DESCRIPTION `v3/@claude-flow/cli/src/commands/metaharness.ts` exposed `options[]` with a description string that listed only the iter-3 set: "One of: score | genome | mcp-scan | threat-model | mint" 5 subcommands were missing from the description: oia-audit (iter 7), audit-list (iter 16), audit-trend (iter 15), similarity (iter 36), drift-from-history (iter 53). The help text would surface those via `metaharness help`, but `metaharness --help` (the auto-generated option-list output) still claimed only 5. PROBLEM B — NO ANTI-MINT-MCP GUARD ADR-150 §Sandboxing explicitly says mint must NEVER be exposed via MCP because it writes to the filesystem with explicit --confirm. The 9 metaharness MCP tools deliberately omit metaharness_mint. But there's no test enforcing the omission. A future iter that mass- generates MCP tools from the SUBCOMMANDS map (a tempting refactor) would silently include metaharness_mint and violate the sandboxing rule. The agent-callable mint would let LLMs scaffold harnesses without the human confirmation gate. WHAT SHIPPED 1. v3/@claude-flow/cli/src/commands/metaharness.ts — description string now lists all 10 dispatchable subcommands, with a comment reminding maintainers to keep it in sync with the SUBCOMMANDS map. 2. plugins/ruflo-metaharness/scripts/smoke.sh — step 17z36: - Positive: all 10 subcommand names appear in metaharness.ts - NEGATIVE (the load-bearing guard): grep returns no match for `name: 'metaharness_mint'` in metaharness-tools.ts. If it ever does, miss="mint-leaked-to-mcp" and smoke fails. WHY THE NEGATIVE GREP MATTERS This is the kind of gap that doesn't surface in normal testing — no existing test exercises mint via MCP because it isn't supposed to exist. A regression that adds it would simply ADD a passing test case alongside the 9 existing ones. The negative grep is the only shape of check that catches this class of bug. GATES THIS ITER smoke: 75 → 76 (step 17z36 green) tsc: clean rebuild of metaharness.ts --help: now lists all 10 subcommands accurately ITER 53-73 MCP-CLI SAFETY MATRIX CLI subcommands: 10 (score, genome, mcp-scan, threat-model, oia-audit, audit-list, audit-trend, similarity, drift-from-history, mint) MCP tools: 9 (= 10 - mint per ADR-150 §Sandboxing) Help text: CURRENT (was iter-3 stale) Anti-MCP guard: PRESENT (was: implicit, now: smoke-asserted) The 10:9 asymmetry between CLI and MCP is now contract-anchored. Co-Authored-By: RuFlo --- plugins/ruflo-metaharness/scripts/smoke.sh | 15 +++++++++++++++ v3/@claude-flow/cli/src/commands/metaharness.ts | 5 ++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/plugins/ruflo-metaharness/scripts/smoke.sh b/plugins/ruflo-metaharness/scripts/smoke.sh index 1f6136f343..55598cb983 100755 --- a/plugins/ruflo-metaharness/scripts/smoke.sh +++ b/plugins/ruflo-metaharness/scripts/smoke.sh @@ -191,6 +191,21 @@ grep -q "execCli(\[\s*'-y'\s*,\s*'metaharness@latest'" "$F" 2>/dev/null || \ grep -q "cwd: opts" "$F" || miss="$miss no-cwd-passthrough" [[ -z "$miss" ]] && ok || bad "$miss" +step "17z36. CLI subcommand list current + mint anti-MCP guard (iter 73)" +miss="" +DISP="$ROOT/../../v3/@claude-flow/cli/src/commands/metaharness.ts" +WRAPPER="$ROOT/../../v3/@claude-flow/cli/src/mcp-tools/metaharness-tools.ts" +# iter-73 description string lists all 10 dispatchable subcommands +for sub in score genome mcp-scan threat-model oia-audit audit-list audit-trend similarity drift-from-history mint; do + grep -q "${sub}" "$DISP" 2>/dev/null || miss="$miss subcommand-${sub}-not-listed" +done +# ANTI-MINT GUARD: mint is intentionally CLI-only per ADR-150 §Sandboxing +# (writes to filesystem with explicit --confirm; never exposed via MCP). +# A future iter that accidentally adds 'metaharness_mint' as an MCP tool +# would violate the sandboxing rule. Negative grep fires the alarm. +! grep -q "name: 'metaharness_mint'" "$WRAPPER" 2>/dev/null || miss="$miss mint-leaked-to-mcp" +[[ -z "$miss" ]] && ok || bad "$miss" + step "17z35. parseMcpScanText edge-case unit tests (iter 72)" miss="" F="$ROOT/scripts/test-similarity.mjs" diff --git a/v3/@claude-flow/cli/src/commands/metaharness.ts b/v3/@claude-flow/cli/src/commands/metaharness.ts index c14e29a619..e1e29b261a 100644 --- a/v3/@claude-flow/cli/src/commands/metaharness.ts +++ b/v3/@claude-flow/cli/src/commands/metaharness.ts @@ -112,7 +112,10 @@ export const metaharnessCommand: Command = { options: [ { name: 'subcommand', - description: 'One of: score | genome | mcp-scan | threat-model | mint', + // iter 73 — list reflects all 10 dispatchable subcommands (was + // stale at the iter-3 list of 5). Keep this synced with the + // SUBCOMMANDS map above. + description: 'One of: score | genome | mcp-scan | threat-model | oia-audit | audit-list | audit-trend | similarity | drift-from-history | mint', type: 'string' as const, }, ],