Cleanup pane, Pi session tools, review from the UI, project registry, needs panel acts

This commit is contained in:
Sam
2026-11-11 14:16:12 +11:00
parent 0476afcb95
commit 3ec960e349
16 changed files with 726 additions and 18 deletions

View File

@@ -140,3 +140,52 @@ func mergeLogTail(lines int) []string {
start := max(0, len(all)-lines)
return all[start:]
}
// reviewLogPath is where a review started from the interface writes its output.
func reviewLogPath() string {
return filepath.Join(os.TempDir(), "paperclip-harness-review.log")
}
// startReview runs bin/review for one task and returns at once. The Review tab
// follows the log, so a review takes no keypress more than starting it.
func startReview(folder, identifier string) error {
review := filepath.Join(exeDir(), "review")
if _, err := os.Stat(review); err != nil {
return fmt.Errorf("no bin/review next to the program (%s)", review)
}
log, err := os.Create(reviewLogPath())
if err != nil {
return err
}
fmt.Fprintf(log, "review of %s started %s\n", identifier, time.Now().Format("15:04:05"))
cmd := exec.Command(review, identifier, "--post")
cmd.Dir = folder
cmd.Stdout = log
cmd.Stderr = log
cmd.SysProcAttr = &syscall.SysProcAttr{Setsid: true}
if err := cmd.Start(); err != nil {
log.Close()
return err
}
go func() {
err := cmd.Wait()
if err != nil {
fmt.Fprintf(log, "\nreview stopped: %v\n", err)
} else {
fmt.Fprintf(log, "\nreview finished %s\n", time.Now().Format("15:04:05"))
}
log.Close()
}()
return nil
}
func reviewLogTail(lines int) []string {
b, err := os.ReadFile(reviewLogPath())
if err != nil {
return []string{"", " no review has been run from this screen yet", "", " press v to review this task"}
}
all := splitLines(string(b))
start := max(0, len(all)-lines)
return all[start:]
}