{"record":{"id":"895488c245f911c5","repo":"Hmbown/CodeWhale","slug":"stdin-is-not-a-terminal-pass-yes-to-confirm-the","errorCode":null,"errorMessage":"stdin is not a terminal; pass --yes to confirm the disclosed plan","messagePattern":"stdin is not a terminal; pass --yes to confirm the disclosed plan","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/integrations/cli.rs","lineNumber":49,"sourceCode":"    let paths = DshPaths::from_process()?;\n    let detection = detect_now();\n    let identity = dsh::codewhale_route_identity(config, workspace);\n    let report = dsh::compute_status(\n        &paths,\n        detection,\n        identity,\n        allow_full_access,\n        dsh::bundle_availability_now(),\n    )?;\n    Ok((paths, report))\n}\n\nfn confirm(yes: bool, question: &str) -> Result<()> {\n    if yes {\n        return Ok(());\n    }\n    if !std::io::stdin().is_terminal() {\n        anyhow::bail!(\"stdin is not a terminal; pass --yes to confirm the disclosed plan\");\n    }\n    print!(\"{question} [y/N] \");\n    use std::io::Write;\n    std::io::stdout().flush().ok();\n    let mut answer = String::new();\n    std::io::stdin()\n        .read_line(&mut answer)\n        .context(\"read confirmation\")?;\n    if !matches!(answer.trim().to_ascii_lowercase().as_str(), \"y\" | \"yes\") {\n        anyhow::bail!(\"not confirmed; nothing was written\");\n    }\n    Ok(())\n}\n\nfn print_status(report: &DshStatusReport) {\n    println!(\"DeepSeek Harness (dsh) — {}\", RELATIONSHIP_LABEL);\n    println!(\"  state: {}\", report.state.label());\n    println!(\"  summary: {}\", dsh::status_line(report));","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/integrations/cli.rs#L31-L67","documentation":"Thrown by the `confirm` helper in crates/tui/src/integrations/cli.rs when a DSH integration command requires an interactive y/N confirmation but stdin is not a TTY and `--yes` was not passed. The library refuses to read a confirmation from a non-interactive stream, so the destructive/disclosed operation is aborted.","triggerScenarios":"Running a `dsh` CLI subcommand that prompts for confirmation (e.g. connect/update) from a script, CI job, or piped stdin without the `--yes` flag.","commonSituations":"Automating `codewhale ... dsh connect` in CI or a shell script; piping input into the command; running under a supervisor where stdin is /dev/null.","solutions":["Pass the `--yes` flag to skip interactive confirmation (after reviewing the disclosed plan)","Run the command in an interactive terminal instead of a script/pipe","Drive the plan through a non-interactive API if automation needs programmatic approval"],"exampleFix":"// before (non-interactive, no flag)\n$ codewhale dsh connect < /dev/null\n// after\n$ codewhale dsh connect --yes","handlingStrategy":"fallback","validationCode":"// shell\n[ -t 0 ] || echo \"stdin is not a TTY; --yes required\"","typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"stdin is not a terminal\") => {\n        // either add --yes or surface the plan for manual interactive approval\n    },\n    other => return other,\n}","preventionTips":["Always pass --yes in scripts and CI for dsh commands","Check is_terminal before invoking interactive commands programmatically","Review the disclosed plan once interactively, then script with --yes"],"tags":["cli","tty","confirmation","interactive"],"backgroundTag":"missing-required-flag","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}