Files
pipelines/internal/cli/exit.go
T
alan 2bde6b6344 CLI for agents: non-TTY safe run/confirmations, compact inspect, wait hints and exit codes
- Without a terminal, run behaves as --json, tui refuses and confirmations
  fail fast naming --yes instead of prompting.
- inspect prints a compact summary by default; --step N, --transcripts and
  --json give detail.
- wait names a failed run's stage and first diagnostic line, prints how to
  answer a run waiting on a person, and exits 2 when any run failed,
  was canceled or interrupted (1 stays for client errors).
- help describes the current # outcome / # handoff format.
- Task starter's Land stage drops edit to match format.md; skill docs
  document run --json --yes, retry --yes --json and the new behaviour.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 00:27:14 +00:00

28 lines
1.0 KiB
Go

package cli
import "fmt"
// ExitError carries a dispatched subprocess exit code so the CLI can propagate the
// exact status. The child already streamed its own stdout/stderr, so main exits
// with this code without printing a duplicate diagnostic.
type ExitError struct{ Code int }
func (e *ExitError) Error() string { return fmt.Sprintf("subprocess exited with status %d", e.Code) }
func (e *ExitError) ExitCode() int { return e.Code }
// StatusError is a failure whose message is printed like any other error but
// whose process exit status is Code rather than the generic 1, so a caller can
// tell, for example, a run that ended unsuccessfully from a client failure.
type StatusError struct {
Code int
Message string
}
func (e *StatusError) Error() string { return e.Message }
// WaitRunsUnsuccessful is the `pipelines wait` / `run --wait` exit status when
// every wait completed but at least one run ended failed, canceled or
// interrupted. Client failures (unknown run, connection, wait limit) exit 1.
const WaitRunsUnsuccessful = 2