pi-review-loop 0.3.0 → 0.3.1
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/README.md +3 -3
- package/index.ts +36 -31
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -243,13 +243,13 @@ The loop exits when:
|
|
|
243
243
|
| Command | Description |
|
|
244
244
|
|---------|-------------|
|
|
245
245
|
| `/review-start` | Activate and send review prompt immediately |
|
|
246
|
-
| `/review-start
|
|
246
|
+
| `/review-start <focus>` | Start review with custom focus (quotes optional) |
|
|
247
247
|
| `/review-plan` | Activate and review plans/specs/PRDs (uses `double-check-plan` template) |
|
|
248
|
-
| `/review-plan
|
|
248
|
+
| `/review-plan <focus>` | Review plan with custom focus (quotes optional) |
|
|
249
249
|
| `/review-exit` | Exit review mode |
|
|
250
250
|
| `/review-max <n>` | Set max iterations (session only) |
|
|
251
251
|
| `/review-auto [on\|off]` | Toggle auto-trigger from keywords (session only) |
|
|
252
|
-
| `/review-auto
|
|
252
|
+
| `/review-auto <focus>` | Enable auto-trigger AND start review with custom focus |
|
|
253
253
|
| `/review-status` | Show current state |
|
|
254
254
|
|
|
255
255
|
## Tool API
|
package/index.ts
CHANGED
|
@@ -28,10 +28,15 @@ export default function (pi: ExtensionAPI) {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
function parseCustomText(args: string): string {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
const trimmed = args.trim();
|
|
32
|
+
if (!trimmed) return "";
|
|
33
|
+
|
|
34
|
+
// Try quoted strings first: "text" or 'text'
|
|
35
|
+
const match = trimmed.match(/^"(.+)"$/s) || trimmed.match(/^'(.+)'$/s) ||
|
|
36
|
+
trimmed.match(/"(.+?)"/s) || trimmed.match(/'(.+?)'/s);
|
|
37
|
+
|
|
38
|
+
// If no quotes found, use the entire text as focus
|
|
39
|
+
return match ? match[1].trim() : trimmed;
|
|
35
40
|
}
|
|
36
41
|
|
|
37
42
|
function exitReviewMode(ctx: ExtensionContext, reason: string) {
|
|
@@ -126,7 +131,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
126
131
|
});
|
|
127
132
|
|
|
128
133
|
pi.registerCommand("review-start", {
|
|
129
|
-
description: "Activate review loop and send review prompt
|
|
134
|
+
description: "Activate review loop and send review prompt. Optional: add custom focus text.",
|
|
130
135
|
handler: async (args, ctx) => {
|
|
131
136
|
if (reviewModeActive) {
|
|
132
137
|
ctx.ui.notify("Review mode is already active", "info");
|
|
@@ -139,7 +144,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
139
144
|
});
|
|
140
145
|
|
|
141
146
|
pi.registerCommand("review-plan", {
|
|
142
|
-
description: "Activate review loop for plans/specs/PRDs. Optional: add custom focus
|
|
147
|
+
description: "Activate review loop for plans/specs/PRDs. Optional: add custom focus text.",
|
|
143
148
|
handler: async (args, ctx) => {
|
|
144
149
|
if (reviewModeActive) {
|
|
145
150
|
ctx.ui.notify("Review mode is already active", "info");
|
|
@@ -193,42 +198,42 @@ export default function (pi: ExtensionAPI) {
|
|
|
193
198
|
});
|
|
194
199
|
|
|
195
200
|
pi.registerCommand("review-auto", {
|
|
196
|
-
description: "Toggle auto-trigger, or start review with custom focus: /review-auto
|
|
201
|
+
description: "Toggle auto-trigger, or start review with custom focus: /review-auto focus on X",
|
|
197
202
|
handler: async (args, ctx) => {
|
|
198
203
|
const arg = args.trim();
|
|
199
204
|
const argLower = arg.toLowerCase();
|
|
200
205
|
|
|
201
|
-
// Check for
|
|
202
|
-
|
|
203
|
-
if (customText) {
|
|
204
|
-
// Custom text provided: enable auto-trigger and start review with custom focus
|
|
206
|
+
// Check for standard on/off/toggle keywords first
|
|
207
|
+
if (argLower === "on" || argLower === "true" || argLower === "1") {
|
|
205
208
|
settings.autoTrigger = true;
|
|
206
|
-
|
|
207
|
-
if (reviewModeActive) {
|
|
208
|
-
ctx.ui.notify(`Auto-trigger enabled, focus updated for next iteration`, "info");
|
|
209
|
-
} else {
|
|
210
|
-
enterReviewMode(ctx);
|
|
211
|
-
pi.sendUserMessage(buildReviewPrompt(settings.reviewPromptConfig));
|
|
212
|
-
ctx.ui.notify(`Auto-trigger enabled, review started with custom focus`, "info");
|
|
213
|
-
}
|
|
209
|
+
ctx.ui.notify(`Auto-trigger enabled`, "info");
|
|
214
210
|
return;
|
|
215
211
|
}
|
|
216
|
-
|
|
217
|
-
// Standard on/off/toggle behavior
|
|
218
|
-
if (argLower === "on" || argLower === "true" || argLower === "1") {
|
|
219
|
-
settings.autoTrigger = true;
|
|
220
|
-
} else if (argLower === "off" || argLower === "false" || argLower === "0") {
|
|
212
|
+
if (argLower === "off" || argLower === "false" || argLower === "0") {
|
|
221
213
|
settings.autoTrigger = false;
|
|
222
|
-
|
|
214
|
+
ctx.ui.notify(`Auto-trigger disabled`, "info");
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
if (arg === "") {
|
|
223
218
|
settings.autoTrigger = !settings.autoTrigger;
|
|
224
|
-
|
|
225
|
-
|
|
219
|
+
ctx.ui.notify(
|
|
220
|
+
`Auto-trigger ${settings.autoTrigger ? "enabled" : "disabled"}`,
|
|
221
|
+
"info"
|
|
222
|
+
);
|
|
226
223
|
return;
|
|
227
224
|
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
225
|
+
|
|
226
|
+
// Anything else is treated as custom focus text
|
|
227
|
+
const customText = parseCustomText(arg);
|
|
228
|
+
settings.autoTrigger = true;
|
|
229
|
+
customPromptSuffix = customText;
|
|
230
|
+
if (reviewModeActive) {
|
|
231
|
+
ctx.ui.notify(`Auto-trigger enabled, focus updated for next iteration`, "info");
|
|
232
|
+
} else {
|
|
233
|
+
enterReviewMode(ctx);
|
|
234
|
+
pi.sendUserMessage(buildReviewPrompt(settings.reviewPromptConfig));
|
|
235
|
+
ctx.ui.notify(`Auto-trigger enabled, review started with custom focus`, "info");
|
|
236
|
+
}
|
|
232
237
|
},
|
|
233
238
|
});
|
|
234
239
|
|