On this page
The framework-owned y/N confirmation, fired before a command declared consequential unless --dry-run or --approve-consequential was passed.
#typescript/src/confirm
#typescript/src/confirm
The framework-owned confirm protocol for consequential commands.
Fires before dispatching a command that DECLARES ITSELF consequential, on the REAL CLI path, when neither --dry-run nor --approve-consequential was passed. A plain mutating command never prompts: classification answers "should a dry run record rather than execute?", which is a different question from "are these effects worth interrupting someone for?". It never fires on the programmatic paths (test/call/invoke/MCP), which have no TTY contract and would hang the caller.
A consequential PASSTHROUGH is not exempt: that its args are opaque to the framework is a reason to confirm, not a reason to skip -- the framework knows LESS about what is about to happen, not more.
There is no bypass. --approve-consequential answers the prompt; it disables nothing else. The flag's unwieldiness is deliberate: a flag that cannot become muscle memory stays a decision.
#ConfirmIO
export interface ConfirmIOThe stdin side of the protocol, isolated so tests can drive it.
#setConfirmIO
export function setConfirmIO(io: ConfirmIO | null): voidPackage-internal seam (never re-exported from index.ts): swaps the stdin side of the protocol so the prompt, the non-TTY error and the decline path are all testable. Passing null restores the real stdin reader. This is the TS analog of Python's tests monkeypatching sys.stdin -- it changes WHERE the answer comes from, never WHETHER the protocol runs.
#confirmConsequential
export function confirmConsequential(cmdPath: string, err: Writer): booleanRuns the confirm protocol. Returns true to proceed, false to abort (the caller exits 1 after this function has written the reason to stderr).