fix(cli): report CLI_UNAVAILABLE for planned commands given any argv - #27
Merged
Merged
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 5 files
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
Planned placeholder commands declared `Args: cobra.NoArgs`, so any positional argument or unknown flag failed argument parsing before `RunE` ran. The user then saw `unknown command`, `Reason: CLI_VALIDATION`, exit 2, and a `--dry-run` hint for a command that has no request to preview. Bare invocation of the same command correctly reported `CLI_UNAVAILABLE`, exit 1. Match the custom-command placeholder: accept arbitrary args and whitelist unknown flags so the `CLI_UNAVAILABLE` branch is reached regardless of what the user typed. `--help` and `--usage` are unchanged. Tests pin exit 1 across plain, agent and JSON modes for a planned command with an argument and with an unknown flag, and the agent envelope reason, error type and absence of parse-error text.
Assert the planned-command envelope error is marked rendered, matching the sibling agent-mode matrix, so a regression that drops the sentinel would print the error twice and fail here. Add a review-variant test next to the existing planned `--usage` case covering a positional argument and an unknown flag: both must exit 1 with `CLI_UNAVAILABLE`.
2ynn
force-pushed
the
fix/cli/planned-commands
branch
from
September 22, 2026 14:43
1dc0fbf to
50a88c3
Compare
AshGodfrey
approved these changes
Sep 22, 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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Planned placeholder commands (declared in the surface but not implemented in build) used
Args: cobra.NoArgs. Any positional argument or unknown flag therefore failed cobra parsing beforeRunEran, and the user received aCLI_VALIDATIONparse error (exit 2) with an "unknown command" message and a--dry-runhint for a command that has no request to preview. The same command invoked bare correctly reportedCLI_UNAVAILABLE(exit 1).newPlannedCmdintemplates/templates/cli/intents.go.stmplnow declaresArgs: cobra.ArbitraryArgsandFParseErrWhitelist{UnknownFlags: true}, matching the siblingnewCustomCmdplaceholder, so theCLI_UNAVAILABLEbranch is reached regardless of argv: