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>
This commit is contained in:
2026-12-03 00:27:14 +00:00
parent accb9970b6
commit 2bde6b6344
16 changed files with 658 additions and 56 deletions
+6 -5
View File
@@ -44,7 +44,7 @@ func TestWaitLineReportsStatusOutcomeStageAndDuration(t *testing.T) {
}
// Every named run is reported, and a run that finished unsuccessfully is still
// a finished run: the wait exits 0 and says what happened.
// reported, but the wait exits with status 2 so a caller notices it.
func TestWaitReportsEachRunAndDoesNotFailOnUnsuccessfulRuns(t *testing.T) {
var out bytes.Buffer
app := App{Out: &out, Err: &out}
@@ -53,8 +53,9 @@ func TestWaitReportsEachRunAndDoesNotFailOnUnsuccessfulRuns(t *testing.T) {
3: runMessage(3, "failed", "error", "worker", "2026-10-09T00:00:00Z", "2026-10-09T00:00:09Z"),
}
call := func(request protocol.Message) (protocol.Message, error) { return done[request.RunID], nil }
if err := app.wait(context.Background(), []string{"2", "3"}, &options{}, call); err != nil {
t.Fatalf("a finished failed run must not fail the wait: %v", err)
var status *StatusError
if err := app.wait(context.Background(), []string{"2", "3"}, &options{}, call); !errors.As(err, &status) || status.Code != WaitRunsUnsuccessful || !strings.Contains(err.Error(), "run 3 failed") {
t.Fatalf("a finished failed run must exit %d: %v", WaitRunsUnsuccessful, err)
}
text := out.String()
for _, want := range []string{
@@ -160,8 +161,8 @@ func TestWaitJSONPrintsFinalRunEnvelope(t *testing.T) {
}
var many bytes.Buffer
if err := (App{Out: &many, Err: &many}).wait(context.Background(), []string{"2", "3"}, &options{json: true}, call); err != nil {
t.Fatal(err)
if err := (App{Out: &many, Err: &many}).wait(context.Background(), []string{"2", "3"}, &options{json: true}, call); !errors.As(err, new(*StatusError)) {
t.Fatalf("a failed run in --json mode must still exit non-zero: %v", err)
}
var envelopes []protocol.Message
if err := json.Unmarshal(many.Bytes(), &envelopes); err != nil {