add review findings detail handles · Entire
add review findings detail handles
fe8428c→main·
pfleidi·2w ago·4 files·+215 added/-8 removed
Let non-interactive review findings output print stable handles and direct view commands.
Also refuse review profile editing without an interactive terminal and point callers at scripted configuration commands.
Sessions
80df055b41a6View transcript
[?
Add Machine-Readable Review Findings OutputCodex·GPT-5.5·3 steps](/content/gh/entireio/cli/session/019f1fa3-ab74-72b1-810c-e3aa11dd8068#timeline-80df055b41a6/index.html)
Changes
4
cmd/entire/cli/review
Mcmd.go+13/-3
Mcmd_test.go+20
Mfix.go+93/-3
Mmanifest_test.go+89/-2
125 unmodified lines
126
127
128
129
129
130
131
132
71 unmodified lines
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
210
220
221
222
223
13 unmodified lines
237
238
239
230
240
241
242
243
125 unmodified lines
--set-slot with --configure: a reviewer slot as agent[=model] (repeatable;
the same agent/model may repeat to run it multiple times)
--edit re-open the advanced profile skill picker
--findings browse local findings
--findings browse local findings; pass a handle to print one saved run
--agent NAME run only one reviewer from the selected profile
--list list configured review profiles (their reviewers and judge)
--agents list the reviewer agents you can pass to --agent for the profile
71 unmodified lines
}
Mcmd/entire/cli/review/cmd.go+13/-3
397 unmodified lines
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
397 unmodified lines
}
}
func TestReviewEditNonInteractiveRefusesWithScriptedAlternatives(t *testing.T) {
setupCmdTestRepo(t)
rootCmd := cli.NewRootCmd()
errBuf := &bytes.Buffer{}
rootCmd.SetErr(errBuf)
rootCmd.SetArgs([]string{"review", "--edit"})
err := rootCmd.Execute()
if err == nil {
t.Fatal("expected non-interactive --edit to fail")
}
got := errBuf.String()
for _, want := range []string{"--edit requires an interactive terminal", "entire review --configure --set-agents", "entire review --list"} {
if !strings.Contains(got, want) {
t.Fatalf("--edit error missing %q:\n%s", want, got)
}
}
}
// TestRunReview_FlagOverrideSkipsPicker verifies that --agent flag bypasses
// the interactive picker even when multiple eligible agents are configured.
func TestRunReview_FlagOverrideSkipsPicker(t *testing.T) {
Mcmd/entire/cli/review/cmd_test.go+20
4 unmodified lines
5
6
7
8
9
10
11
12
13
6 unmodified lines
20
21
22
21
23
24
25
26
8 unmodified lines
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
6 unmodified lines
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
30 unmodified lines
111
112
113
84
114
115
116
117
118
119
89
120
121
122
123
2 unmodified lines
126
127
128
129
130
131
132
133
134
2 unmodified lines
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
51 unmodified lines
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
4 unmodified lines
"errors"
"fmt"
"io"
"slices"
"strings"
"time"
"charm.land/huh/v2"
"github.com/spf13/cobra"
6 unmodified lines
const reviewCommandBinary = "entire review"
func runReviewFindings(ctx context.Context, cmd *cobra.Command, silentErr func(error) error) error {
func runReviewFindings(ctx context.Context, cmd *cobra.Command, handle string, silentErr func(error) error) error {
worktreeRoot, err := paths.WorktreeRoot(ctx)
if err != nil {
cmd.SilenceUsage = true
fmt.Fprintln(cmd.OutOrStdout(), "No local review findings found.")
return nil
}
if handle = strings.TrimSpace(handle); handle != "" {
manifest, findErr := findReviewManifestByHandle(manifests, handle)
if findErr != nil {
cmd.SilenceUsage = true
fmt.Fprintln(cmd.ErrOrStderr(), findErr.Error())
printReviewFindingsHandles(cmd.ErrOrStderr(), manifests)
return wrapReviewSilentError(silentErr, findErr)
}
printReviewManifestDetail(cmd.OutOrStdout(), manifest)
return nil
}
if interactive.IsTerminalWriter(cmd.OutOrStdout()) && interactive.CanPromptInteractively() {
manifest, pickErr := promptForReviewManifest(ctx, manifests)
if pickErr != nil {
return nil
}
func findReviewManifestByHandle(manifests []LocalReviewManifest, handle string) (LocalReviewManifest, error) {
var matched []LocalReviewManifest
for _, manifest := range manifests {
if reviewManifestHasHandle(manifest, handle) {
matched = append(matched, manifest)
}
}
switch len(matched) {
case 0:
return LocalReviewManifest{}, fmt.Errorf("no local review findings match %q", handle)
case 1:
return matched[0], nil
default:
return LocalReviewManifest{}, fmt.Errorf("local review findings handle %q is ambiguous", handle)
}
}
func wrapReviewSilentError(silentErr func(error) error, err error) error {
if silentErr == nil {
return err
func writeReviewCompletionFooter(w io.Writer, manifest LocalReviewManifest) {
fmt.Fprintln(w)
fmt.Fprintln(w, "Review complete.")
if reviewManifestHandle(manifest) == "" {
handle := reviewManifestHandle(manifest)
if handle == "" {
return
}
fmt.Fprintln(w)
fmt.Fprintln(w, "Browse findings:")
fmt.Fprintf(w, " %s --findings\n", reviewCommandBinary)
fmt.Fprintf(w, " %s --findings %s\n", reviewCommandBinary, handle)
}
}
func reviewManifestHandle(manifest LocalReviewManifest) string {
}
}
func printReviewFindingsHandles(w io.Writer, manifests []LocalReviewManifest) {
handles := reviewManifestHandleList(manifests)
if len(handles) == 0 {
return
}
fmt.Fprintln(w, "Available findings:")
for _, handle := range handles {
fmt.Fprintf(w, " %s\n", handle)
}
}
51 unmodified lines
}
return ""
func reviewManifestHasHandle(manifest LocalReviewManifest, handle string) bool {
return slices.Contains(reviewManifestHandles(manifest), handle)
}
func reviewManifestHandleList(manifests []LocalReviewManifest) []string {
handles := []string{}
for _, manifest := range manifests {
for _, handle := range reviewManifestHandles(manifest) {
if slices.Contains(handles, handle) {
continue
}
handles = append(handles, handle)
}
}
return handles
}
func reviewManifestHandles(manifest LocalReviewManifest) []string {
handles := []string{}
add := func(handle string) {
handle = strings.TrimSpace(handle)
if handle == "" {
return
}
if slices.Contains(handles, handle) {
return
}
handles = append(handles, handle)
}
for _, source := range manifest.Sources {
add(source.SessionID)
}
if !manifest.CreatedAt.IsZero() {
add(reviewManifestTimeHandle(manifest.CreatedAt))
}
return handles
}
func reviewManifestTimeHandle(t time.Time) string {
return t.UTC().Format("20060102T150405")
}
Mcmd/entire/cli/review/fix.go+93/-3
159 unmodified lines
160
161
162
163
163
164
165
166
18 unmodified lines
185
186
187
188
188
189
190
191
192
193
194
195
196
197
2 unmodified lines
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
159 unmodified lines
writeReviewCompletionFooter(&b, manifest)
got := b.String()
for _, want := range []string{"Review complete.", "entire review --findings"} {
for _, want := range []string{"Review complete.", "entire review --findings claude-session"} {
if !strings.Contains(got, want) {
t.Fatalf("footer missing %q:\n%s", want, got)
}
}
}
}
}
func TestReviewFindingsCommand_WithHandlePrintsFullDetail(t *testing.T) {
tmp := t.TempDir()
testutil.InitRepo(t, tmp)
testutil.WriteFile(t, tmp, "f.txt", "init")
testutil.GitAdd(t, tmp, "f.txt")
testutil.GitCommit(t, tmp, "init")
t.Chdir(tmp)
if err := writeLocalReviewManifest(context.Background(), LocalReviewManifest{
CreatedAt: time.Date(2026, 5, 7, 10, 0, 0, 0, time.UTC),
Sources: []ManifestSource{{
SessionID: "claude-session",
Label: "Claude Code",
Output: "Full finding body that must not be hidden behind a picker.",
}},
AggregateOutput: "Aggregate detail for agents.",
}); err != nil {
t.Fatalf("writeLocalReviewManifest: %v", err)
}
cmd := NewCommand(Deps{})
var out strings.Builder
cmd.SetOut(&out)
cmd.SetArgs([]string{"--findings", "claude-session"})
if err := cmd.Execute(); err != nil {
t.Fatalf("execute review --findings handle: %v", err)
}
got := out.String()
for _, want := range []string{
"Review findings from",
"Full finding body that must not be hidden behind a picker.",
"Aggregate detail for agents.",
} {
if !strings.Contains(got, want) {
t.Fatalf("detail output missing %q:\n%s", want, got)
}
}
}
func TestReviewFindingsCommand_UnknownHandleListsValidHandles(t *testing.T) {
tmp := t.TempDir()
testutil.InitRepo(t, tmp)
testutil.WriteFile(t, tmp, "f.txt", "init")
testutil.GitAdd(t, tmp, "f.txt")
testutil.GitCommit(t, tmp, "init")
t.Chdir(tmp)
if err := writeLocalReviewManifest(context.Background(), LocalReviewManifest{
CreatedAt: time.Date(2026, 5, 7, 10, 0, 0, 0, time.UTC),
Sources: []ManifestSource{{
SessionID: "claude-session",
Label: "Claude Code",
Output: "finding",
}},
}); err != nil {
t.Fatalf("writeLocalReviewManifest: %v", err)
}
cmd := NewCommand(Deps{})
var errOut strings.Builder
cmd.SetErr(&errOut)
cmd.SetArgs([]string{"--findings", "missing-session"})
if err := cmd.Execute(); err == nil {
t.Fatal("expected unknown findings handle to fail")
}
got := errOut.String()
for _, want := range []string{"no local review findings match", "claude-session"} {
if !strings.Contains(got, want) {
t.Fatalf("unknown-handle error missing %q:\n%s", want, got)
}
}
}
func TestReviewPickerHeight_ShowsAllSmallOptionSets(t *testing.T) {