Skip to content

fix: reject incomplete CLI flags and empty JSON inputs - #9

Merged
EauDoon merged 1 commit into
mainfrom
devloop/cycle-03-cli-usage
Aug 29, 2026
Merged

fix: reject incomplete CLI flags and empty JSON inputs#9
EauDoon merged 1 commit into
mainfrom
devloop/cycle-03-cli-usage

Conversation

@EauDoon

@EauDoon EauDoon commented Aug 29, 2026

Copy link
Copy Markdown
Owner

What

CLI usage now fail-closes on incomplete or unknown inputs instead of silently continuing.

  • crctl rejects missing flag values (--fault, --assurance, --out), flag-shaped values (--fault --json), unknown flags, incomplete commands, and extra positionals.
  • --help lists refund faults, recovery-preflight faults, and assurance modes.
  • Missing, empty, and invalid JSON files report USAGE_INVALID instead of INTERNAL_ERROR.
  • rail --help prints usage and exits; it no longer starts the sidecar. --port without a value is rejected.

Why

--fault with no value previously ran the default none scenario, --fault --json treated --json as a fault name, empty bundle files surfaced as INTERNAL_ERROR, and node ./cmd/rail.js --help bound a loopback port.

How tested

  • node --test
  • node ./scripts/check.js

Devin Review

Missing --fault/--out/--port values and flag-shaped values now fail
closed as USAGE_INVALID instead of silently defaulting or starting
the sidecar. Help text lists valid faults and assurance modes, and
unreadable JSON files no longer surface as INTERNAL_ERROR.
@EauDoon
EauDoon merged commit f76acb8 into main Aug 29, 2026
6 of 7 checks passed
@EauDoon
EauDoon deleted the devloop/cycle-03-cli-usage branch August 29, 2026 21:47

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 potential issues.

Devin Review

Comment thread cmd/crctl.js
Comment on lines +208 to +209
if (args.length === 0 || args.includes("--help") || args.includes("-h")) {
printHelp();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Help masks malformed invocations

When --help appears anywhere, malformed commands and missing values exit successfully instead of returning a usage error. Both CLIs bypass all validation.

Prompt for agents
Validate invocations before treating help as successful in both cmd/crctl.js main and cmd/rail.js parseArgs. Define help only for an otherwise valid help invocation, so mixed inputs such as `explode --help`, `--fault --help`, and `--bogus --help` retain USAGE_INVALID behavior. Add deterministic tests for malformed inputs containing each help spelling.
Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Comment thread cmd/crctl.js
Comment on lines +56 to +58
const value = args[index + 1];
if (value === undefined || value.startsWith("-")) {
throw usage(`${arg} requires a value.`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Empty flag values bypass validation

An empty --out value runs the full demo without writing the requested file. An empty --port value starts a server on an ephemeral port.

Prompt for agents
Reject empty value strings in both cmd/crctl.js parseCliArgs and cmd/rail.js parseArgs before command execution or numeric conversion. Cover at least `--out ""` and `--port ""` with subprocess tests that require USAGE_INVALID and no demo/server execution.
Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant