Refactor CLI parser to strict fail-closed architecture#3054
Open
MagersCode wants to merge 1 commit into
Open
Conversation
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
Refactored the CLI parser from a fail-open structure to a strict, fail-closed architecture. This prevents unrecognized subcommand trailing arguments or keywords (like passing raw keywords into the prompt path) from silently dropping through to the LLM prompt fallback, protecting against accidental network calls and unwanted token usage. Additionally, implemented short-circuiting logic for
--helprequests to resolve instantly and prevent live runtime hanging bugs.Anti-slop triage
parses_bare_prompt_and_json_output_flagandresolves_model_aliases_in_argsoriginally failed under the strict parsing behavior because they expected leaky drop-through prompts, until they were updated to assert for the new secure boundary guidance error. Local verification command ran successfully:cargo test -p rusty-claude-cli --binsVerification
git diff --checkpasses.Resolution gate