Add BASECAMP_NONINTERACTIVE escape hatch for prompts
Problem
An agent that runs basecamp todos list --in <id> --md can be blocked by an interactive selection prompt (e.g. picking a todoset when a project has more than one), wedging the session. Reported in #395.
The root cause is that --md is deliberately not a machine-output mode — only --agent/--json/--quiet/--ids-only/--count suppress prompts (IsInteractive() in both internal/appctx/context.go and internal/tui/resolve/resolve.go). When the CLI runs under an allocated PTY, stdout looks like a terminal, so ambiguous resolutions fall through to a blocking picker even though a human isn't there to answer it.
Relying on the model to remember --agent per invocation is exactly what the issue asks us to avoid.
Change
Add BASECAMP_NONINTERACTIVE as an explicit escape hatch. When set to a truthy value (1/true), it forces IsInteractive() to false in both gates, so ambiguous resolutions become actionable errors (Multiple todosets found — specify one with --todoset <id>) instead of prompts.
Command-level prompt guards also consult the escape hatch, so direct confirmations such as basecamp chat delete ... without --force cannot wedge an agent session under a PTY.
Key property: it only disables prompts — it does not change the output format. That is the distinction from --agent (which also forces quiet JSON): you keep --md Markdown output and just lose the wedge.
Setting it is the environment/harness's responsibility (shell profile, MCP server env, wrapper), not the model's — so it doesn't depend on the LLM appending a flag every call. Mirrors the pattern the issue references from other agent CLIs.
Details
config.NonInteractiveEnv()reuses the existing strictparseEnvBool(accepts1/true, ignores unrecognized values).- Both
IsInteractive()chokepoints consult it first; resolver prompts andapp.IsInteractive()command sites flow through those gates. - Command-level prompt guards also consult it, covering direct confirmations that do not use the resolver.
- Explicit setup flows (
basecamp setupand interactive skill/setup wizards) remain intentionally interactive; use direct flags/subcommands for non-interactive setup. skills/basecamp/SKILL.mdnow documents that--mddoes not suppress prompts and points to the env var / disambiguating flags.
Notes for reviewers
- The env var's effect on
IsInteractive()is inherently TTY-dependent, so the unit tests assert the parser (config) and the invariant that the escape hatch does not flipIsMachineOutput()— matching the limitation of the existingIsInteractivetests. - This does not touch the pre-existing
--agentbehavior.
Refs #395
Summary by cubic
Add a BASECAMP_NONINTERACTIVE env escape hatch to disable prompts without changing output format, so --md runs under a PTY don’t get stuck. Also treats --jq as machine-output for the profile picker and clarifies character-device detection in docs.
- New Features
- Set
BASECAMP_NONINTERACTIVEto1ortrueto force non-interactive mode across the app, resolver, profile picker, and command prompts; ambiguous targets return clear errors (e.g., use--todoset <id>). - Output format is unchanged; you can keep
--mdwhile suppressing prompts.--jqimplies JSON and now suppresses the profile picker. - Docs updated to note stdout “character device (e.g., a terminal)” detection and fix disambiguation examples in
skills/basecamp/SKILL.md; tests hardened to cover the env short-circuit, char-device stdout, and command prompt guards.
- Set