Fix CLI end-of-options operands for subcommands - #6692
Conversation
agent-session-id: 6b78e583-eb90-415e-8bcb-c4fc342cb179 agent-tool: Codex CLI agent-tool-version: 0.145.0 agent-model: unknown agent-runtime-profile: /nix/store/ph8rlhdj25mg71v81jsfzy6dq4xpcs9m-coding-agent-runtime-profile/share/coding-agents/profile.json agent-skills-manifest: /nix/store/lsykz8x5481xrpbgk280xh3pypk1c5jy-agent-skills-corpus/share/agent-skills/manifest.json tooling-profile: dotfiles@3649b53
🦋 Changeset detectedLatest commit: 0098d73 The changes in this PR will be included in the next version bump. This PR includes changesets to release 29 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThe CLI parser now forwards operands after ChangesCLI terminator operand forwarding
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
Comment |
|
Local verification:
Posted on behalf of @schickling
|
Bundle Size Analysis
|
Why
When an
effect/unstable/clisubcommand is active, operands after the--end-of-options terminator are currently attached to the parent parse record. The child therefore reports required positionals as missing and never receives flag-like operands.What
Forward
trailingOperandsthrough recursive subcommand parsing so the innermost active command receives them, while leaving the parent positional list empty. Add regression coverage and a patch changeset foreffect.Rationale
scanCommandLevelcan select a subcommand only while awaiting the first positional value. Once a positional is collected, the parser switches permanently to argument collection, so aSubresult cannot contain parent positional arguments. This makesarguments: []the correct parent representation; the terminator operands belong to the recursively selected child. Forwarding the same list through each recursive level also preserves the rule for multi-level nesting.Tests
Added coverage for:
--literaland-xBefore the parser change, the focused regression selection failed 3 tests while both control cases passed. After the change, all 5 focused cases pass, and the full
Command.test.tsfile passes 90/90.pnpm lint-fix,pnpm check,pnpm build, andpnpm docgenalso pass locally.Closes #6690
Posted on behalf of @schickling
agent_nameagent_session_idagent_toolagent_tool_versionagent_runtimeagent_modelruntime_profileskills_manifestworktreemachinetooling_profileSummary by CodeRabbit
Bug Fixes
--are preserved instead of being dropped.--is used, including without trailing operands.Tests
--handling across subcommands, nested commands, and leaf commands.