fix(branch): -y flag was shadowed by same-named global option (+ bump 0.1.69)#111
Merged
fix(branch): -y flag was shadowed by same-named global option (+ bump 0.1.69)#111
Conversation
… 0.1.69) Commander v13 assigns the value to the parent program's option when both parent and subcommand declare the same flag, leaving the subcommand's opts.yes undefined. -y, --yes is already global on the root program, so remove the redundant local declarations on branch merge/reset/delete and read yes from getRootOpts(cmd) which walks to the root. Adds a regression test that nests under a `branch` parent (matching real CLI wiring) and asserts clack.confirm is not called when -y is passed without --json. The prior --yes test paired with --json, where --json alone bypassed the prompt — so it never actually exercised -y. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Fermionic-Lyu
approved these changes
May 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
npx @insforge/cli branch merge <name> -y(andbranch reset/branch delete) still prompted for confirmation, blocking agent-driven automation. Commander v13 assigns the value to the parent program's option when both parent and subcommand declare the same flag, leaving the subcommand'sopts.yesundefined.-y, --yesis already a global option on the root program, so the redundant local declarations on these subcommands were what triggered the shadowing.-y, --yesdeclarations and readyesfromgetRootOpts(cmd), which already walks to the root program.Test plan
npx vitest run— 188 passed, 13 skippedmerge.test.tsnests under abranchparent (matching the real CLI wiring) and assertsclack.confirmis not called when-yis passed without--json. The prior--yestest paired with--json, where--jsonalone bypassed the prompt — so it never actually exercised-y.npx @insforge/cli@0.1.69 branch merge <name> -yexits without prompting.🤖 Generated with Claude Code
Summary by cubic
Fixes
-y/--yesbeing ignored onbranch merge,branch reset, andbranch delete, so these commands no longer prompt when-yis passed. Bumps@insforge/clito 0.1.69.-y, --yesfrom branch subcommands and readyesfrom root viagetRootOpts(cmd).branch) to ensure no confirmation prompt when-yis used without--json.Written for commit 053a308. Summary will update on new commits.
Summary by CodeRabbit
Chores
Tests
--yesflag on branch merge subcommand