[Update] bulk update
This commit is contained in:
@@ -142,6 +142,25 @@ export default function planModeExtension(pi: ExtensionAPI): void {
|
||||
handler: async (_args, ctx) => togglePlanMode(ctx),
|
||||
});
|
||||
|
||||
// LOCAL EDIT: the checklist widget only tears itself down once every step is
|
||||
// marked complete, which needs the model to emit a [DONE:n] tag per step. When
|
||||
// one is missed the widget sticks around after the work is finished, so give
|
||||
// the user a way out that doesn't involve toggling plan mode on and off again.
|
||||
pi.registerCommand("plan-done", {
|
||||
description: "Clear a stuck plan checklist (stops execution tracking)",
|
||||
handler: async (_args, ctx) => {
|
||||
if (!executionMode && todoItems.length === 0) {
|
||||
ctx.ui.notify("No plan is being tracked.");
|
||||
return;
|
||||
}
|
||||
executionMode = false;
|
||||
todoItems = [];
|
||||
updateStatus(ctx);
|
||||
persistState();
|
||||
ctx.ui.notify("Plan tracking cleared.");
|
||||
},
|
||||
});
|
||||
|
||||
pi.registerCommand("todos", {
|
||||
description: "Show current plan todo list",
|
||||
handler: async (_args, ctx) => {
|
||||
|
||||
@@ -151,9 +151,16 @@ export function extractTodoItems(message: string): TodoItem[] {
|
||||
|
||||
export function extractDoneSteps(message: string): number[] {
|
||||
const steps: number[] = [];
|
||||
for (const match of message.matchAll(/\[DONE:(\d+)\]/gi)) {
|
||||
const step = Number(match[1]);
|
||||
if (Number.isFinite(step)) steps.push(step);
|
||||
// LOCAL EDIT: upstream matched only the literal `[DONE:3]`. Small local models
|
||||
// drift on it, and one missed tag pins the plan widget on screen forever, so
|
||||
// also accept `[DONE 3]`, `[DONE-3]` and comma lists `[DONE:1,2]`. The brackets
|
||||
// stay required on purpose: a bare "done 3" in prose must not mark a step.
|
||||
for (const match of message.matchAll(/\[\s*DONE\s*[:\-=]?\s*([\d,\s]+?)\s*\]/gi)) {
|
||||
for (const part of match[1].split(/[,\s]+/)) {
|
||||
if (part === "") continue;
|
||||
const step = Number(part);
|
||||
if (Number.isFinite(step)) steps.push(step);
|
||||
}
|
||||
}
|
||||
return steps;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user