| 1 | package cli |
| 2 | |
| 3 | import ( |
| 4 | "time" |
| 5 | |
| 6 | "reasonix/internal/agent" |
| 7 | ) |
| 8 | |
| 9 | // reclaimCLIRecoveryBranches performs the same conservative recovery-copy |
| 10 | // hygiene as Desktop. Failures are intentionally silent: cleanup is optional, |
| 11 | // and any lease, concurrent save, I/O error, or failed revalidation either |
| 12 | // preserves the live branch or leaves a durable hidden stage for startup repair. |
| 13 | func reclaimCLIRecoveryBranches(dir string) { |
| 14 | candidates, err := agent.ReclaimableRecoveryBranches(dir, time.Now(), agent.RecoveryGCGracePeriod) |
| 15 | if err != nil { |
| 16 | return |
| 17 | } |
| 18 | for _, path := range candidates { |
| 19 | _ = agent.TrashReclaimableRecoveryBranch(path, dir) |
| 20 | } |
| 21 | } |
| 22 |