feat(cli): add global --non-interactive flag for headless runs#40
Merged
Conversation
Add a global --non-interactive flag (alias --ci) so commands can run without prompts. When the flag is absent the CLI checks the CI environment variable: CI=true switches to non-interactive mode and prints a notice to stderr. An explicit flag wins over the auto-detect, so --no-non-interactive keeps prompts even when CI is set. In non-interactive mode the non-destructive confirmations auto-resolve to yes: collaborator remove, session remove, and rollback. The destructive commands still prompt and will be force-gated separately. confirm() now takes an autoConfirm argument and returns early when set, leaving the six untouched call sites and their tests unchanged.
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
Phase 2 of the CLI headless epic (6A-5d). Adds a global
--non-interactiveflag, alias--ci, that runs commands without interactive prompts.Resolution order: an explicit flag wins; if it is absent,
CI=trueturns on non-interactive mode and prints[Aether] Detected CI environment — running in non-interactive mode.to stderr; otherwise the CLI stays interactive. Because the explicit flag wins,--no-non-interactivekeeps prompts even inside CI.The flag lives on the base
ICommand. The parser registers it inaddCommonConfiguration(no default, so an absent flag staysundefinedand the CI fallback can kick in) and stamps the explicit value increateCommand.execute()resolves the effective mode once and emits the stderr notice a single time.confirm()gained anautoConfirmparameter and returnstrueearly when set. In non-interactive mode the three non-destructive confirmations auto-skip:collaborator rm,session rm,rollback. The six destructive commands (access-key rm,api-key rm,app rm,app transfer,deployment rm,deployment clear) are untouched here and get--forcegating in Phase 3.Tests. Parser: absent flag stays
undefined,--non-interactiveand--ciset true,--no-non-interactivesets false, and the flag rides along on a destructive command. Executor:process.env.CIis saved and cleared per test so the existing interactive cancellation tests stay deterministic, plus new cases for the confirm short-circuit, the three auto-skips, CI auto-detect with its stderr notice, and explicit-false beating CI.Note on yargs. Verified locally that a boolean option with no default reports
undefinedwhen absent on yargs 17. The parser testleaves nonInteractive undefined when the flag is absentguards this: if a pinned yargs ever injectsfalse, that test fails loudly instead of silently disabling CI auto-detect.Type of change
Checklist
npm run build)