feat(KB-198): add task delete CLI command with --force flag

- Add `kb task delete` CLI command with required --force flag for safety
- Implement runTaskDelete function with task existence validation
- Register kb_task_delete tool in Pi extension for chat agent access
- Add comprehensive unit tests for runTaskDelete and extension registration
- Wire delete command in CLI bin.ts with proper argument parsing
This commit is contained in:
gsxdsm
2026-03-30 13:27:59 -07:00
parent ed6c7ddb99
commit 80e9575cbc
6 changed files with 226 additions and 7 deletions

View File

@@ -466,6 +466,35 @@ export default function kbExtension(pi: ExtensionAPI) {
},
});
// ── kb_task_delete ─────────────────────────────────────────────────
pi.registerTool({
name: "kb_task_delete",
label: "KB: Delete Task",
description:
"Permanently delete a task from the kb board. " +
"Tasks are deleted immediately and cannot be recovered.",
promptSnippet: "Delete a kb task",
promptGuidelines: [
"Use for cleaning up test tasks or tasks created in error",
"Tasks are permanently deleted and cannot be recovered",
"Consider archiving instead of deleting for completed work you may need to reference later",
],
parameters: Type.Object({
id: Type.String({ description: "Task ID to delete (e.g. KB-001)" }),
}),
async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
const store = await getStore(ctx.cwd);
const task = await store.deleteTask(params.id);
return {
content: [{ type: "text", text: `Deleted ${task.id}` }],
details: { taskId: task.id },
};
},
});
// ── kb_task_import_github ─────────────────────────────────────────
pi.registerTool({