address review findings handle output · Entire
address review findings handle output
71171b0→main·
pfleidi·2w ago·3 files·+23 added/-54 removed
Print quoted view commands in the available-findings error path so copied handles are shell-safe.
Reuse the review handle helpers for manifest naming and handle deduplication so list and detail paths stay consistent.
Sessions
4b50b9a535ccView transcript
[?
Add Machine-Readable Review Findings OutputCodex·GPT-5.5·3 steps](/content/gh/entireio/cli/session/019f1fa3-ab74-72b1-810c-e3aa11dd8068#timeline-4b50b9a535cc/index.html)
Changes
3
cmd/entire/cli/review
- Mfix.go+20/-51
Mmanifest.go+1/-1
Mmanifest_test.go+2/-2
31 unmodified lines
32
33
34
35
36
37
38
39
40
41
42
43
44
35
36
37
5 unmodified lines
43
44
45
46
47
48
49
50
51
52
69 unmodified lines
122
123
124
131
132
133
134
135
136
137
125
126
127
128
129
10 unmodified lines
140
141
142
154
155
156
157
158
143
144
145
146
147
162
148
149
150
151
152
153
154
155
156
157
168
158
159
160
161
56 unmodified lines
218
219
220
231
232
233
234
235
236
237
238
239
240
241
242
243
221
245
246
247
248
249
222
223
224
225
226
251
252
253
254
227
256
257
258
228
260
229
230
262
231
232
233
234
31 unmodified lines
return err
}
handle = strings.TrimSpace(handle)
if len(manifests) == 0 {
if handle != "" {
err := fmt.Errorf("no local review findings match %q", handle)
cmd.SilenceUsage = true
fmt.Fprintln(cmd.ErrOrStderr(), err.Error())
return wrapReviewSilentError(silentErr, err)
}
fmt.Fprintln(cmd.OutOrStdout(), "No local review findings found.")
return nil
}
if handle != "" {
manifest, findErr := findReviewManifestByHandle(manifests, handle)
if findErr != nil {
5 unmodified lines
printReviewManifestDetail(cmd.OutOrStdout(), manifest)
return nil
}
if len(manifests) == 0 {
fmt.Fprintln(cmd.OutOrStdout(), "No local review findings found.")
return nil
}
if interactive.IsTerminalWriter(cmd.OutOrStdout()) && interactive.CanPromptInteractively() {
manifest, pickErr := promptForReviewManifest(ctx, manifests)
if pickErr != nil {
69 unmodified lines
}
func reviewManifestHandle(manifest LocalReviewManifest) string {
for _, source := range manifest.Sources {
if source.SessionID != "" {
return source.SessionID
}
}
if !manifest.CreatedAt.IsZero() {
return reviewManifestTimeHandle(manifest.CreatedAt)
if handles := reviewManifestHandles(manifest); len(handles) > 0 {
return handles[0]
}
return ""
}
10 unmodified lines
}
func reviewFindingsCommand(handle string) string {
return fmt.Sprintf("%s --findings %s", reviewCommandBinary, quoteReviewFindingsHandle(handle))
}
func quoteReviewFindingsHandle(s string) string {
return "'" + strings.ReplaceAll(s, "'", "'\\'\'") + "'"
quoted := "'" + strings.ReplaceAll(handle, "'", "'\\'\'") + "'"
return fmt.Sprintf("%s --findings %s", reviewCommandBinary, quoted)
}
func printReviewFindingsHandles(w io.Writer, manifests []LocalReviewManifest) {
handles := reviewManifestHandleList(manifests)
var handles []string
for _, manifest := range manifests {
handles = append(handles, reviewManifestHandles(manifest)...) // appending handles of each manifest
}
handles = dedupeStrings(handles)
if len(handles) == 0 {
return
}
fmt.Fprintln(w, "Available findings:")
for _, handle := range handles {
fmt.Fprintf(w, " %s\n", handle)
fmt.Fprintf(w, " view: %s\n", reviewFindingsCommand(handle))
}
}
56 unmodified lines
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
}
var handles []string
for _, source := range manifest.Sources {
if id := strings.TrimSpace(source.SessionID); id != "" {
handles = append(handles, id)
}
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))
handles = append(handles, reviewManifestTimeHandle(manifest.CreatedAt))
}
}
return handles
return dedupeStrings(handles)
}
func reviewManifestTimeHandle(t time.Time) string {
Mcmd/entire/cli/review/fix.go+20/-51
784 unmodified lines
785
786
787
788
788
789
790
791
784 unmodified lines
}
func localReviewManifestFilename(manifest LocalReviewManifest) string {
name := manifest.CreatedAt.UTC().Format("20060102T150405")
name := reviewManifestTimeHandle(manifest.CreatedAt)
if len(manifest.Sources) > 0 && manifest.Sources[0].SessionID != "" {
name += "-" + safeManifestFilenamePart(manifest.Sources[0].SessionID)
}
}
Mcmd/entire/cli/review/manifest.go+1/-1
340 unmodified lines
341
342
343
344
344
345
346
347
10 unmodified lines
358
359
360
361
361
362
363
364
340 unmodified lines
if err := writeLocalReviewManifest(context.Background(), LocalReviewManifest{
CreatedAt: time.Date(2026, 5, 7, 10, 0, 0, 0, time.UTC),
Sources: []ManifestSource{{
SessionID: "claude-session",
SessionID: "claude-session; echo pwned",
Label: "Claude Code",
Output: manifestTestFinding,
}},
10 unmodified lines
t.Fatal("expected unknown findings handle to fail")
}
got := errOut.String()
for _, want := range []string{"no local review findings match", "claude-session"} {
for _, want := range []string{"no local review findings match", "view: entire review --findings 'claude-session; echo pwned'"} {
if !strings.Contains(got, want) {
t.Fatalf("unknown-handle error missing %q:\n%s", want, got)
}
}
Mcmd/entire/cli/review/manifest_test.go+2/-2