fix: print CLI usage errors and reject empty inputs - #8
Merged
Conversation
Unknown commands, flags, empty option values, empty prove scenarios, and missing child tools now fail closed with a usage or bootstrap hint. `aas demo --help` prints help instead of an unsupported-option error.
| const command = argv[0] ?? "help"; | ||
| if (command === "help" || command === "--help" || command === "-h") { | ||
| const asJson = has(argv, "--json"); | ||
| if (isHelpToken(command) || (command === "demo" && demoRequestsHelp(argv.slice(1)))) { |
There was a problem hiding this comment.
🟡 Help hides malformed demo commands
A standalone help flag makes main skip validation of every other demo argument. Malformed commands then print help and exit successfully.
Prompt for agents
Validate demo arguments before taking the help-success path, while preserving the rule that --help or -h used as a value remains a missing-value error. A standalone help flag can request help only when all remaining arguments are structurally valid. Add tests combining help with unknown, unexpected, and duplicate options so malformed demo commands retain exit code 2.
Was this helpful? React with 👍 or 👎 to provide feedback.
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.
What
Improve the Agent Action Stack CLI around help text and edge-case inputs.
aas help.aas demo --help/-hnow print help (exit 0) instead of treating--helpas an unsupported option.--response/--faultvalues fail as usage errors (exit 2) with a hint to runaas help.--jsonstill prints usage failures as JSON on stderr.Why
aas demo --helppreviously dumped{"error":{"message":"Unsupported demo option: --help"}}. Unknown commands printed help with no indication of what was wrong, empty option values and missing child tools produced confusing child-process errors, and help text did not describe flags or exit codes.How tested
node --check bin/aas.mjs bin/aas-gui.mjs scripts/bootstrap.mjsnpm test(32 passing, including new coverage for help tokens, usage errors, empty scenario, and missing child tools)