pi-bro 0.33.0 → 0.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/README.md +1 -0
- package/docs/guided-review.md +25 -2
- package/docs/reference/commands.md +1 -0
- package/package.json +1 -1
- package/src/explain-modal.ts +5 -5
- package/src/review-modal.ts +3 -0
- package/src/review-ui.ts +128 -22
- package/src/review.ts +9 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to pi-bro are documented here.
|
|
4
4
|
|
|
5
|
+
## [0.34.0] - 2026-11-07
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Guided Review can delete a saved PR review, its notes and captured source through a confirmed picker, offline PR target, or Overview action.
|
|
10
|
+
- Deletion by PR target uses local records instead of GitHub; ambiguous bare PR numbers require a full URL. Resume and delete share the same picker and preserve saved titles.
|
|
11
|
+
- Active in-process reviews block command deletion. Overview deletion holds the active lock, settles pending saves and cannot recreate the record on teardown. The storage helper validates review IDs and leaves sibling reviews and Pi settings untouched.
|
|
12
|
+
- Offline storage and picker tests plus a manual test journey for confirmation, active writers and cleanup.
|
|
13
|
+
- No automatic cleanup, new storage engine, live backend call or GitHub mutation.
|
|
14
|
+
|
|
5
15
|
## [0.33.0] - 2026-11-07
|
|
6
16
|
|
|
7
17
|
### Highlights
|
package/README.md
CHANGED
|
@@ -69,6 +69,7 @@ File and webpage examples need your own real path or URL; see [how to explain th
|
|
|
69
69
|
| `/bro grill-me` | **[Grill Me](docs/grill-me.md) (experimental).** A private, opinionated decision interview: light, balanced or exhaustive; one question per round; `/consolidate` drafts a brief without ending the interview; `/copy` returns the latest reply or decision brief to the clipboard. Uses BTW model settings; read-only restrictions vary by backend. |
|
|
70
70
|
| `/bro btw` | **[Side questions](docs/features/btw.md#bro-btw-side-conversation).** A separate conversation seeded with recent context, so you can ask without interrupting the agent. ⚠️ [Full-permission mode](#what-leaves-your-machine) can edit files. |
|
|
71
71
|
| `/bro guided-review <PR>` | **[Guided Review](docs/guided-review.md).** An explanation and quality assessment of a GitHub PR, with ranked findings, source evidence and private questions. Claude, Muse, or Pi is recommended for untrusted PRs. |
|
|
72
|
+
| `/bro guided-review delete [PR]` | Choose a saved review and explicitly delete its record, questions and captured source after confirmation. No automatic cleanup. |
|
|
72
73
|
| `bro_advisor` tool | **[Second opinion](docs/features/advisor.md#bro-advisor).** A tool your agent can call mid-task; a fresh backend process reviews the session snapshot, can inspect the workspace when needed, and returns advice to the agent. ⚠️ [Runs with permissions bypassed](#what-leaves-your-machine). |
|
|
73
74
|
| `/bro config`, `/bro preferences` | **[Settings](docs/reference/settings.md#settings) and [preferences](docs/user-guide.md#preferences).** Pick the backend, model and effort per feature, and tell Bro how you like answers. |
|
|
74
75
|
|
package/docs/guided-review.md
CHANGED
|
@@ -81,6 +81,23 @@ Copy finding copies a finding's text, evidence references and suggested fix/chec
|
|
|
81
81
|
|
|
82
82
|
Use Overview → Regenerate guide only when you want a fresh explanation/assessment. Confirmation identifies the captured revision and the model call. **It reuses the same captured source; it is not an update fetch.** Successful output replaces one current guide. Failure/cancellation keeps the current guide. Questions and nonempty drafts retain their original context under Your questions; there is no guide-version picker. A replacement that fails to save remains in memory with retry controls.
|
|
83
83
|
|
|
84
|
+
### Delete a saved review
|
|
85
|
+
|
|
86
|
+
Use **Overview → Delete review** inside a saved review, or run
|
|
87
|
+
`/bro guided-review delete` to choose from your saved reviews. For a specific
|
|
88
|
+
record, use `/bro guided-review delete <PR number or URL>`. Deletion reads
|
|
89
|
+
only local saved records: no GitHub access or model call is required. A bare
|
|
90
|
+
PR number must match exactly one saved review across all repositories, regardless
|
|
91
|
+
of your current working directory. In contrast, opening a PR by number uses
|
|
92
|
+
the current repository. Use the full PR URL if multiple saved reviews share
|
|
93
|
+
that number. If none are saved, Bro says there is nothing to delete.
|
|
94
|
+
Pressing Esc cancels silently.
|
|
95
|
+
Bro shows the target and asks for confirmation before removing its JSON record,
|
|
96
|
+
private questions/drafts and captured Git source. Closing the picker or declining
|
|
97
|
+
the confirmation changes nothing. Close an open review first; an active writer
|
|
98
|
+
blocks deletion. This affects only the selected review, not your main working tree.
|
|
99
|
+
Deletion cannot be undone. There is no automatic cleanup.
|
|
100
|
+
|
|
84
101
|
## Access, privacy and storage
|
|
85
102
|
|
|
86
103
|
Review never runs with full-access or bypass flags. **Claude, Muse, and Pi provide strict file-only inspection** and are recommended for untrusted PRs: Claude runs with `--restricted`, Read/Grep/Glob only, `dontAsk`, safe mode and no MCP; Muse disables write, shell and web tools, foreign personal context and native session logs, without trusting repository rules; Pi runs in-process with `read/grep/find/ls` only, no shell, and an isolated session. No model-run project tests, commands, Git or network tools are available on Claude, Muse, or Pi.
|
|
@@ -99,7 +116,13 @@ Records, private text and captured source remain under:
|
|
|
99
116
|
${PI_CODING_AGENT_DIR:-$HOME/.pi/agent}/bro-reviews/
|
|
100
117
|
```
|
|
101
118
|
|
|
102
|
-
The implementation uses the host's `getAgentDir()`. Records are
|
|
119
|
+
The implementation uses the host's `getAgentDir()`. Records are
|
|
120
|
+
`<review-id>.json`, captured source lives under `source/<review-id>/`,
|
|
121
|
+
including preserved incomplete recovery directories. Failed/corrupt records are
|
|
122
|
+
reported without overwriting them. There is no cross-machine sync or automatic
|
|
123
|
+
cleanup. Use the explicit deletion picker rather than editing these files by hand.
|
|
124
|
+
Cross-process writers are not locked, so close the same review in every Pi process
|
|
125
|
+
before deletion.
|
|
103
126
|
|
|
104
127
|
One open writer per review is supported within a Pi process. Concurrent editing of the same review from separate processes is unsupported.
|
|
105
128
|
|
|
@@ -107,7 +130,7 @@ One open writer per review is supported within a Pi process. Concurrent editing
|
|
|
107
130
|
|
|
108
131
|
| Problem | What to do |
|
|
109
132
|
| --- | --- |
|
|
110
|
-
| GitHub unavailable when reopening | Use bare `/bro guided-review` to choose a saved review;
|
|
133
|
+
| GitHub unavailable when reopening | Use bare `/bro guided-review` to choose a saved review; resume and deletion from local records do not fetch |
|
|
111
134
|
| Sandboxed shell review backend (Codex, Grok, Agy) | Advisory shown; choose Claude, Muse, or Pi in `/bro config` for strict file-only inspection on untrusted PRs |
|
|
112
135
|
| Git/gh authentication or fetch error | Read the acquisition error; check Git/`gh auth status`; retry explicitly |
|
|
113
136
|
| Invalid/failed preparation | Changed files remain available; use Prepare guide to retry when ready for another call |
|
|
@@ -41,6 +41,7 @@ Typing `/bro ` displays ten task-level suggestions: `simplify`, `show`, `btw`, `
|
|
|
41
41
|
| `/bro architecture [focus]` | Read the current project and create or refresh `docs/architecture/` with Markdown, an editable graph and offline HTML. Inherits BTW backend settings. [Guide](../features/architecture.md). |
|
|
42
42
|
| `/bro guided-review <PR number or URL>` | Automatically explain and assess a captured PR in local Pi, with source evidence and optional private questions. Opening the same PR restores its saved review. |
|
|
43
43
|
| `/bro guided-review` | List saved reviews; `resume` is an alias. |
|
|
44
|
+
| `/bro guided-review delete [PR number or URL]` | Choose and confirm deletion of a saved review and its captured source. Without a target, opens the saved-review picker. |
|
|
44
45
|
| `/bro remember-me [thought]` | Start a private memory-writing conversation, browse and expand memories, and approve saves explicitly. [Guide](../remember-me.md). |
|
|
45
46
|
| `/bro overthink` | View the latest private automatic second-look notes, without a model call. Ctrl+R retry, Ctrl+E edit session questions, ? help, Ctrl+C copy. [Guide](../overthink.md). |
|
|
46
47
|
| `/bro grill-me [topic]` | Private one-question-at-a-time decision interview. Supply a topic to start fresh; omit it to resume. `/consolidate` drafts a brief; `/copy` copies the latest reply or brief; Pi's editor stays untouched. `/help` lists modal controls. [Guide](../grill-me.md). |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-bro",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.34.0",
|
|
4
4
|
"description": "A sidekick for you and your Pi agent: plain-language explanations, side questions, diagrams, PR review and second opinions, without cluttering the agent's context.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
package/src/explain-modal.ts
CHANGED
|
@@ -404,14 +404,14 @@ These are needs, not modes. Copied text does not enter Pi until you paste and su
|
|
|
404
404
|
|
|
405
405
|
## Architecture documentation
|
|
406
406
|
|
|
407
|
-
- \`/bro architecture [focus]\` —
|
|
407
|
+
- \`/bro architecture [focus]\` — create source-backed docs and an offline map in \`docs/architecture/\` using the BTW model. See docs/features/architecture.md.
|
|
408
408
|
|
|
409
409
|
## Guided Review
|
|
410
410
|
|
|
411
|
-
- \`/bro guided-review <PR number or URL>\` —
|
|
412
|
-
- Reviews save automatically. Reopen
|
|
411
|
+
- \`/bro guided-review <PR number or URL>\` — assess captured PR code in local interactive Pi (requires Git and authenticated gh).
|
|
412
|
+
- Reviews save automatically. Reopen without a model call; bare \`/bro guided-review\` lists saved reviews.\n- \`/bro guided-review delete [PR number or URL]\` — delete one local saved review with confirmation; Overview also offers Delete review.
|
|
413
413
|
- Enter opens items or activates focused actions. Tab changes focus; Esc goes back, then closes from Contents. Close saves; Stop and close cancels active work first.
|
|
414
|
-
- Copy finding
|
|
414
|
+
- Copy finding goes to the clipboard, not GitHub. Regenerate reuses captured source. For untrusted PRs, choose file-only Claude/Muse/Pi; Codex/Grok offer sandboxed shell, while Agy may write captured files. Bro warns when shell is allowed. See docs/guided-review.md.
|
|
415
415
|
|
|
416
416
|
## Elevate
|
|
417
417
|
|
|
@@ -442,7 +442,7 @@ These are needs, not modes. Copied text does not enter Pi until you paste and su
|
|
|
442
442
|
## Configure and check
|
|
443
443
|
|
|
444
444
|
- \`/bro preferences\` — tell Bro about yourself and how you like answers; added to explain, show, btw, Elevate and Guided Review prompts, never the advisor (**Ctrl+S** save, **Ctrl+K** delete, **Ctrl+C** copy, **Esc** close)
|
|
445
|
-
- \`/bro config\` —
|
|
445
|
+
- \`/bro config\` — shared defaults, per-feature models, preferences, Doctor and Overthink. Esc backs out.
|
|
446
446
|
- \`/bro mode [brief|balanced|faithful]\` — view or choose the explanation mode
|
|
447
447
|
- \`/bro doctor\` — check settings, preferences, and every selected backend without running a model turn
|
|
448
448
|
|
package/src/review-modal.ts
CHANGED
|
@@ -49,6 +49,7 @@ export type ReviewControls = {
|
|
|
49
49
|
ask(target: string, question: string): void;
|
|
50
50
|
prepare(): void;
|
|
51
51
|
regenerate(): void;
|
|
52
|
+
deleteReview(): void;
|
|
52
53
|
retrySave(): void;
|
|
53
54
|
stop(): void;
|
|
54
55
|
close(): void;
|
|
@@ -297,6 +298,7 @@ export class ReviewModal {
|
|
|
297
298
|
...(!this.record.guide && !this.busy ? ["Prepare guide"] : []),
|
|
298
299
|
...ask,
|
|
299
300
|
...(this.busy ? stop : this.record.guide ? ["Regenerate guide"] : []),
|
|
301
|
+
...(!this.busy && this.view.selected === "overview" ? ["Delete review"] : []),
|
|
300
302
|
];
|
|
301
303
|
}
|
|
302
304
|
private changed() {
|
|
@@ -421,6 +423,7 @@ export class ReviewModal {
|
|
|
421
423
|
} else if (action === this.stopLabel) this.controls.stop();
|
|
422
424
|
else if (action === "Prepare guide") this.controls.prepare();
|
|
423
425
|
else if (action === "Regenerate guide") this.controls.regenerate();
|
|
426
|
+
else if (action === "Delete review") this.controls.deleteReview();
|
|
424
427
|
else if (action === "Retry saving") this.controls.retrySave();
|
|
425
428
|
else if (action === "Back" || action === "Back to files") this.back();
|
|
426
429
|
this.action = 0;
|
package/src/review-ui.ts
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
replaceGuide,
|
|
15
15
|
guideEvidence,
|
|
16
16
|
buildReviewPrompt,
|
|
17
|
+
deleteReview,
|
|
17
18
|
listReviews,
|
|
18
19
|
loadReview,
|
|
19
20
|
parseGuide,
|
|
@@ -39,6 +40,62 @@ export function stopGuidedReviews(): void {
|
|
|
39
40
|
for (const controller of activeReviews.values()) controller?.abort();
|
|
40
41
|
}
|
|
41
42
|
|
|
43
|
+
/** Same picker for resume and delete. Presentation and ordering have one owner. */
|
|
44
|
+
export function savedReviewLabel(item: ReviewRecord): string {
|
|
45
|
+
const target = item.snapshot.target;
|
|
46
|
+
const title = safeReviewText(target.title ?? "").replace(/[\r\n\t]/g, " ");
|
|
47
|
+
const readiness = item.guide ? (item.guide.assessment ? "review ready" : "guide ready") : "not prepared";
|
|
48
|
+
return `${target.repository} #${target.number} · ${title} · ${readiness} · ${target.head.slice(0, 8)}`;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
async function savedReviews(ctx: ExtensionCommandContext, root: string): Promise<ReviewRecord[]> {
|
|
52
|
+
const records = await listReviews(root, (file, error) =>
|
|
53
|
+
ctx.ui.notify(`Cannot load ${file}: ${String(error)}. Original file left untouched.`, "warning"));
|
|
54
|
+
return records.sort((a, b) =>
|
|
55
|
+
a.snapshot.target.repository.localeCompare(b.snapshot.target.repository) ||
|
|
56
|
+
b.snapshot.target.number - a.snapshot.target.number);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export async function pickSavedReview(
|
|
60
|
+
ctx: ExtensionCommandContext, root: string, title: string, emptyMessage: string,
|
|
61
|
+
): Promise<ReviewRecord | undefined> {
|
|
62
|
+
const records = await savedReviews(ctx, root);
|
|
63
|
+
if (!records.length) {
|
|
64
|
+
ctx.ui.notify(emptyMessage, "info");
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const labels = records.map(savedReviewLabel);
|
|
68
|
+
const picked = await ctx.ui.select(title, labels);
|
|
69
|
+
return picked ? records[labels.indexOf(picked)] : undefined;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** Resolve stored PR identity offline; a bare number is allowed only if unambiguous. */
|
|
73
|
+
export function matchSavedReview(
|
|
74
|
+
records: readonly ReviewRecord[], requested: string,
|
|
75
|
+
): { selected?: ReviewRecord; error?: string } {
|
|
76
|
+
const input = requested.trim();
|
|
77
|
+
if (/^[1-9]\d*$/.test(input)) {
|
|
78
|
+
const matches = records.filter(item => item.snapshot.target.number === Number(input));
|
|
79
|
+
if (matches.length > 1) return { error: "Multiple saved reviews have that PR number. Use its full PR URL." };
|
|
80
|
+
return { selected: matches[0] };
|
|
81
|
+
}
|
|
82
|
+
let url: URL;
|
|
83
|
+
try { url = new URL(input); }
|
|
84
|
+
catch { return { error: "Use a saved PR number or GitHub PR URL." }; }
|
|
85
|
+
const match = /^\/([^/]+)\/([^/]+)\/pull\/([1-9]\d*)(?:\/(?:files|commits|checks))?\/?$/.exec(url.pathname);
|
|
86
|
+
if (url.protocol !== "https:" || !match || url.username || url.password) {
|
|
87
|
+
return { error: "Use a saved PR number or GitHub PR URL." };
|
|
88
|
+
}
|
|
89
|
+
const [, owner, repo, number] = match;
|
|
90
|
+
const matches = records.filter(item => {
|
|
91
|
+
const target = item.snapshot.target;
|
|
92
|
+
return (target.host ?? "github.com").toLowerCase() === url.hostname.toLowerCase() &&
|
|
93
|
+
target.repository.toLowerCase() === `${owner}/${repo}`.toLowerCase() &&
|
|
94
|
+
target.number === Number(number);
|
|
95
|
+
});
|
|
96
|
+
return { selected: matches[0] };
|
|
97
|
+
}
|
|
98
|
+
|
|
42
99
|
export async function openGuidedReview(
|
|
43
100
|
ctx: ExtensionCommandContext,
|
|
44
101
|
value: string,
|
|
@@ -49,31 +106,52 @@ export async function openGuidedReview(
|
|
|
49
106
|
return;
|
|
50
107
|
}
|
|
51
108
|
const root = join(getAgentDir(), "bro-reviews");
|
|
109
|
+
|
|
110
|
+
if (value === "delete" || value.startsWith("delete ")) {
|
|
111
|
+
const requested = value.slice("delete".length).trim();
|
|
112
|
+
let selected: ReviewRecord | undefined;
|
|
113
|
+
if (!requested) {
|
|
114
|
+
selected = await pickSavedReview(ctx, root, "Delete saved review", "There are no saved reviews to delete.");
|
|
115
|
+
if (!selected) return; // Esc is cancellation, not a failed target lookup.
|
|
116
|
+
} else {
|
|
117
|
+
const match = matchSavedReview(await savedReviews(ctx, root), requested);
|
|
118
|
+
if (match.error) {
|
|
119
|
+
ctx.ui.notify(match.error, "warning");
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
selected = match.selected;
|
|
123
|
+
}
|
|
124
|
+
if (!selected) {
|
|
125
|
+
ctx.ui.notify("No saved review matches that target.", "info");
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
const id = selected.id;
|
|
129
|
+
if (activeReviews.has(id)) {
|
|
130
|
+
ctx.ui.notify("That review is currently open or being prepared. Close it before deleting.", "warning");
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
const title = `${selected.snapshot.target.repository} #${selected.snapshot.target.number}`;
|
|
134
|
+
const approved = await ctx.ui.confirm("Delete saved review?", `Permanently remove ${title}, its notes, unsent drafts and all captured Git source? This cannot be undone.`);
|
|
135
|
+
if (!approved) return;
|
|
136
|
+
if (activeReviews.has(id)) {
|
|
137
|
+
ctx.ui.notify("That review became active. Close it and retry deletion.", "warning");
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
// Reserve this identity while deletion runs so a new review cannot start writing it.
|
|
141
|
+
activeReviews.set(id, undefined);
|
|
142
|
+
try {
|
|
143
|
+
await deleteReview(root, id);
|
|
144
|
+
ctx.ui.notify(`Deleted saved review ${title} and its captured source.`, "info");
|
|
145
|
+
} finally {
|
|
146
|
+
activeReviews.delete(id);
|
|
147
|
+
}
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
52
150
|
let record: ReviewRecord | undefined;
|
|
53
151
|
let fresh = false;
|
|
54
152
|
if (value === "resume" || !value) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
`Cannot load ${file}: ${String(error)}. Original file left untouched.`,
|
|
58
|
-
"warning",
|
|
59
|
-
),
|
|
60
|
-
);
|
|
61
|
-
if (!records.length) {
|
|
62
|
-
ctx.ui.notify("Start with /bro guided-review <PR number or URL>.", "info");
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
records.sort(
|
|
66
|
-
(a, b) =>
|
|
67
|
-
a.snapshot.target.repository.localeCompare(b.snapshot.target.repository) ||
|
|
68
|
-
b.snapshot.target.number - a.snapshot.target.number,
|
|
69
|
-
);
|
|
70
|
-
const labels = records.map(
|
|
71
|
-
(item) =>
|
|
72
|
-
`${item.snapshot.target.repository} #${item.snapshot.target.number} · ${safeReviewText(item.snapshot.target.title ?? "").replace(/[\r\n\t]/g, " ")} · ${item.guide ? (item.guide.assessment ? "review ready" : "guide ready") : "not prepared"} · ${item.snapshot.target.head.slice(0, 8)}`,
|
|
73
|
-
);
|
|
74
|
-
const picked = await ctx.ui.select("Resume guided review", labels);
|
|
75
|
-
if (!picked) return;
|
|
76
|
-
record = records[labels.indexOf(picked)];
|
|
153
|
+
record = await pickSavedReview(ctx, root, "Resume guided review", "Start with /bro guided-review <PR number or URL>.");
|
|
154
|
+
if (!record) return;
|
|
77
155
|
} else {
|
|
78
156
|
record = await openBroOverlay<ReviewRecord | undefined>(
|
|
79
157
|
ctx,
|
|
@@ -427,6 +505,34 @@ export async function openGuidedReview(
|
|
|
427
505
|
retrySave() {
|
|
428
506
|
void persist().catch(() => {});
|
|
429
507
|
},
|
|
508
|
+
deleteReview() {
|
|
509
|
+
if (confirming || controller || closing || closed || panel.busy) return;
|
|
510
|
+
confirming = true;
|
|
511
|
+
overlayHandle?.setHidden(true);
|
|
512
|
+
const target = state.snapshot.target;
|
|
513
|
+
const title = `${target.repository} #${target.number}`;
|
|
514
|
+
void ctx.ui.confirm(
|
|
515
|
+
"Delete this saved review?",
|
|
516
|
+
`Permanently delete ${title}, all private questions and drafts, and its captured Git source? This cannot be undone.`,
|
|
517
|
+
).then(async (approved) => {
|
|
518
|
+
if (!approved || closed || closing || controller) return;
|
|
519
|
+
closing = true;
|
|
520
|
+
// Do not let a delayed save recreate the record after deletion.
|
|
521
|
+
if (saveTimer) { clearTimeout(saveTimer); saveTimer = undefined; }
|
|
522
|
+
await running;
|
|
523
|
+
await queue;
|
|
524
|
+
await deleteReview(root, state.id);
|
|
525
|
+
closed = true;
|
|
526
|
+
ctx.ui.notify(`Deleted saved review ${title} and its captured source.`, "info");
|
|
527
|
+
done();
|
|
528
|
+
}).catch((error) => {
|
|
529
|
+
closing = false;
|
|
530
|
+
panel.notice = `Deletion failed: ${String(error)}. Review remains open; retry when ready.`;
|
|
531
|
+
}).finally(() => {
|
|
532
|
+
confirming = false;
|
|
533
|
+
if (!closed) { overlayHandle?.setHidden(false); tui.requestRender(); }
|
|
534
|
+
});
|
|
535
|
+
},
|
|
430
536
|
regenerate() {
|
|
431
537
|
if (confirming || controller || closing || closed) return;
|
|
432
538
|
confirming = true;
|
package/src/review.ts
CHANGED
|
@@ -150,6 +150,15 @@ function recordPath(root: string, id: string): string {
|
|
|
150
150
|
if (!/^[a-f0-9]{64}$/.test(id)) throw Error("Invalid review identity.");
|
|
151
151
|
return join(root, id + ".json");
|
|
152
152
|
}
|
|
153
|
+
/** Remove one validated saved record and its captured source, never other reviews.
|
|
154
|
+
* The controller owns the active-review lock; deletion is not atomic across files.
|
|
155
|
+
*/
|
|
156
|
+
export async function deleteReview(root: string, id: string): Promise<void> {
|
|
157
|
+
const record = recordPath(root, id); // validates the 64-character hex boundary
|
|
158
|
+
await rm(join(root, "source", id), { recursive: true, force: true });
|
|
159
|
+
await rm(record, { force: true });
|
|
160
|
+
}
|
|
161
|
+
|
|
153
162
|
export async function saveReview(root: string, record: ReviewRecord): Promise<void> {
|
|
154
163
|
const path = recordPath(root, record.id);
|
|
155
164
|
await mkdir(root, { recursive: true, mode: 0o700 });
|