review: finalize single-agent TUI output · Entire
review: finalize single-agent TUI output
a32edd4→main·
dipree·3w ago·3 files·+19 added/-7 removed
Sessions
ed7158e5ecebView transcript
?\ Checkout the hand off doc that I just added.Pi·Opus 4.8·13 steps
Changes
3
cmd/entire/cli/review
Mcmd.go+5/-2
Mcmd_test.go+8/-5
Mexport_test.go+6
1496 unmodified lines
1497
1498
1499
1500
1501
1502
1501
1502
1503
1504
1505
1506
1507
1508
1496 unmodified lines
fmt.Fprintf(in.out, "Running review with %s...\n", in.agentName)
return []reviewtypes.Sink{DumpSink{W: in.out}}
}
tui := NewTUISink([]string{in.agentName}, in.cancelRun, in.out, os.Stdin)
postRunOut := &bytes.Buffer{}
return []reviewtypes.Sink{
NewTUISink([]string{in.agentName}, in.cancelRun, in.out, os.Stdin),
DumpSink{W: in.out},
tui,
DumpSink{W: postRunOut},
tuiPostRunCompleteSink{tui: tui, buf: postRunOut, out: in.out},
}
}
Mcmd/entire/cli/review/cmd.go+5/-2
927 unmodified lines
928
929
930
931
931
932
933
934
935
936
936
937
938
939
80 unmodified lines
1020
1021
1022
1023
1024
1023
1024
1025
1026
1027
1028
1029
1030
1030
1031
1032
1033
1034
1035
1036
927 unmodified lines
wantOutput: "Running review with agent-a...",
},
{
name: "tty uses tui and dump",
name: "tty uses tui buffered dump and post-run finalizer",
isTTY: true,
canPrompt: true,
wantTUI: true,
wantDump: true,
wantTotal: 2,
wantTotal: 3,
},
{
name: "tty without prompt falls back to running line",
80 unmodified lines
AgentName: "a",
CancelRun: func() {},
})
if len(single) != 2 {
t.Fatalf("single sinks len = %d, want 2", len(single))
}
if len(single) != 3 {
t.Fatalf("single sinks len = %d, want 3", len(single))
}
if _, ok := single[0].(*review.TUISink); !ok {
t.Fatalf("single sink[0] = %T, want *TUISink", single[0])
}
if _, ok := single[1].(review.DumpSink); !ok {
t.Fatalf("single sink[1] = %T, want DumpSink", single[1])
t.Fatalf("single sink[1] = %T, want buffered DumpSink", single[1])
}
if !review.ExposedIsTUIPostRunCompleteSink(single[2]) {
t.Fatalf("single sink[2] = %T, want TUI post-run finalizer", single[2])
}
}
Mcmd/entire/cli/review/cmd_test.go+8/-5
62 unmodified lines
63
64
65
66
67
68
69
70
71
62 unmodified lines
func ExposedFindTUISink(sinks []reviewtypes.Sink) (*TUISink, bool) {
return findTUISink(sinks)
}
// ExposedIsTUIPostRunCompleteSink reports whether s is the TUI finalizer sink.
func ExposedIsTUIPostRunCompleteSink(s reviewtypes.Sink) bool {
_, ok := s.(tuiPostRunCompleteSink)
return ok
}
Mcmd/entire/cli/review/export_test.go+6