Repository navigation
feat: never block non-interactive callers on confirmation prompts - #28
Merged
Merged
Conversation
Destructive commands (since #26) prompt by default. For agents and CI that prompt is a landmine: an open stdin hangs until timeout, a closed one aborts opaquely with a bare 'Aborted.' Following the gh '--yes required when not running interactively' and git GIT_TERMINAL_PROMPT=0 patterns, the CLI now never attempts a confirmation read without a TTY: - new common.confirm_destructive(message, skip) replaces the four typer.confirm call sites (auth logout, client delete, client revoke, vault delete) - no TTY and no waiver exits 1 immediately, naming -y and CAMPUS_ASSUME_YES as remedies - CAMPUS_ASSUME_YES=1|true|yes waives confirmation for the session; the per-command --confirm/-y flag still takes precedence - TTY behavior is unchanged: interactive prompt, abort on decline - README documents the automation contract (closes #27) Windows note: '< NUL' reports isatty()=True (character-device quirk), so that exotic edge keeps click's immediate EOF abort — still no hang. Real agent harnesses pipe stdin, which refuses correctly (verified).
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.
Closes #27.
What
Destructive commands prompt for confirmation since #26 — right for humans, a landmine for agents/CI. This PR implements the non-interactive contract proposed in #27, following the
gh/GIT_TERMINAL_PROMPT=0pattern: the CLI never reads confirmation without a TTY.common.confirm_destructive(message, skip)replaces the fourtyper.confirmcall sites (auth logout,client delete,client revoke,vault delete).CAMPUS_ASSUME_YES=1(alsotrue/yes) waives confirmation for the session; per-command--confirm/-ystill takes precedence. Falsy values (0,false, empty) deliberately do not waive.typer.Aborton decline.Verification
-yproceeds, env-var truthy/falsy spellings, TTY prompt still fires and propagates aborts, client-delete contract end to end).ruffclean.CAMPUS_ASSUME_YES=1→ proceeds without the flag.Known edge (documented, acceptable)
On Windows, redirecting from the NUL device (
cmd < NUL) reportsisatty() == True(character-device quirk), so that exotic edge keeps click's immediate EOF abort — a bareAborted.with exit 1. Still no hang. Real agent harnesses and CI pipe stdin, which refuses correctly.Notes for reviewers
logoutkeeps its confirmation (not treated as low-stakes) because it revokes tokens server-side, which can kill other live sessions — per the issue discussion.