Files
ruflo/v3/@claude-flow/cli/src
50bc51643b fix(cli): #2269 honor --dangerously-skip-permissions in hive-mind spawn (#2301)
* fix(cli): #2269 honor --dangerously-skip-permissions in hive-mind spawn

The arg parser (parser.ts normalizeKey) converts kebab-case to camelCase
and stores ONLY the normalized key, so `flags['dangerously-skip-permissions']`
is always undefined and `=== true` always evaluates false. The flag was
silently dropped: headless `hive-mind spawn --claude --non-interactive
--dangerously-skip-permissions` ran in permissionMode "default", so every
Edit/Write was auto-denied (no TTY to approve) and the agent finished
having changed nothing.

Fix mirrors the dual-key fallback used a few lines above for
`isNonInteractive` (`flags['non-interactive'] || flags.nonInteractive`).
This also honors the documented `default: true` for the option declaration
(line 590), since the parser populates the camelCase key with the default.

Repro from the issue:
  npx @claude-flow/cli hive-mind spawn --claude --non-interactive \
    --dangerously-skip-permissions -o "edit any file in this repo"

Before: init event shows `"permissionMode":"default"`, Edit calls land
in permission_denials, files unchanged.
After:  `--dangerously-skip-permissions` is appended to claudeArgs,
spawned `claude` runs in `bypassPermissions`, edits succeed.

Fixes #2269

Co-Authored-By: RuFlo <ruv@ruv.net>

* test(cli): #2269 regression test for hive-mind --dangerously-skip-permissions

Pins down two invariants together:
1. The parser stores ONLY the camelCase form of --dangerously-skip-permissions
   (this is the parser behavior that caused the original drop).
2. The skipPermissions predicate from hive-mind.ts evaluates true when the
   parser-produced flags shape is passed through it.

Also exercises the --no-auto-permissions opt-out and the legacy
hand-constructed-flag-map paths, so a future refactor of either the
parser's normalizeKey or the hive-mind action can't silently regress
the flag-drop bug.

The predicate is kept inline rather than imported, because the hive-mind
spawn action does real side effects (childSpawn) at module load and isn't
trivially importable for a pure unit test. The predicate's source of
truth (hive-mind.ts) and the test mirror are both annotated with #2269.

Co-Authored-By: RuFlo <ruv@ruv.net>

* fix(hive-mind): handle yargs-style negation for --no-auto-permissions

The original PR (#2301) correctly diagnosed the kebab→camel parser
normalization that made the activation half of the
--dangerously-skip-permissions flag silently no-op. The deny half had
the same shape of bug but the patch only widened it to kebab|camel —
neither of which is what the parser actually produces for
--no-auto-permissions.

The parser stores yargs-style negation:

  --no-auto-permissions → { autoPermissions: false }

NOT { 'no-auto-permissions': true } or { noAutoPermissions: true }.

So after the original fix, --dangerously-skip-permissions
--no-auto-permissions would have skipped permissions anyway — strictly
more permissive than the pre-fix state, where activation never fired at
all. Caught by running hive-mind-skip-permissions.test.ts case "skip
permissions=false when --no-auto-permissions is also passed", which
went red.

This commit adds the third deny clause (`flags.autoPermissions === false`)
and pins the parser contract with three new tests:
- parser produces autoPermissions:false for --no-auto-permissions
- predicate denies when only the yargs-style negation key is set
- predicate ignores autoPermissions:true (not a deny signal)

Tests: 9/9 pass. Closes #2269.

Co-Authored-By: JOhnsonKC201 <johnsonkc201@users.noreply.github.com>
Co-Authored-By: rvrheenen <rvrheenen@users.noreply.github.com>
Co-Authored-By: RuFlo <ruv@ruv.net>

---------

Co-authored-by: RuFlo <ruv@ruv.net>
Co-authored-by: JOhnsonKC201 <johnsonkc201@users.noreply.github.com>
Co-authored-by: rvrheenen <rvrheenen@users.noreply.github.com>
2026-06-12 16:58:21 -04:00
..
2026-01-04 23:50:45 +00:00
2026-01-05 19:40:01 +00:00
2026-01-07 04:36:20 +00:00
2026-01-14 18:48:53 +00:00