Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat(cli): exit non-zero on invalid arguments#38

Merged
Monoradioactivo merged 1 commit into
mainfrom
feat/cli-headless-exit-codes
May 28, 2026
Merged

feat(cli): exit non-zero on invalid arguments#38
Monoradioactivo merged 1 commit into
mainfrom
feat/cli-headless-exit-codes

Conversation

@Monoradioactivo

Copy link
Copy Markdown
Owner

Summary

aether exited 0 on invalid input. The parser returned undefined, cli.ts
showed help, and the process ended cleanly. A CI step running aether app rm
with a missing arg went green while the command never executed.

This is the silent-failure case that 6A-5(d) opens with. The CLI has to be
loud about bad input before the GitHub Action wraps it, otherwise the same
bug surfaces inside pipelines where it's harder to catch.

The fix lives in two places:

  • command-parser.ts exports a parseFailed flag. createCommand sets it
    from yargs state: true when a .fail() handler fired or when a recognized
    command resolved without enough positional args, false when invoked with
    no args at all.
  • cli.ts checks parseFailed first and exits 1. The no-args path still
    exits 0, since that's a real request for help, not an error.

Scoped to exit codes only. The --non-interactive flag, --force for
destructive ops, and CI metadata enrichment land in their own branches.

Type of change

  • feat
  • fix
  • refactor
  • chore
  • docs

Checklist

  • Build and typecheck pass locally (npm run build)
  • Tests added or updated (when test infrastructure is wired up)
  • Relevant docs updated

Verification

337/337 tests pass. Manual smoke test on the compiled entry point:

Command Exit Behavior
aether nonsense 1 help shown
aether app rm (no args) 1 usage shown
aether (no args) 0 banner + help
aether app list (logged in) 0 app table

The parser returned undefined for invalid args and cli.ts fell through to
showHelp() with no exit code, so the process ended at 0. In CI that reads
as a passing step even though nothing ran.

createCommand now derives a parseFailed flag from yargs state. cli.ts exits
1 when the parse failed and 0 when the user invoked with no args (the
intentional "show me help" path). Valid commands run as before.

Added a parseFailed describe block to command-parser tests and a new
cli.test.ts covering the three exit paths.
@Monoradioactivo Monoradioactivo self-assigned this May 28, 2026
@Monoradioactivo Monoradioactivo merged commit 8e21f66 into main May 28, 2026
7 checks passed
@Monoradioactivo Monoradioactivo deleted the feat/cli-headless-exit-codes branch May 28, 2026 04:58
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