feat(KB-199): add retry CLI command and extension tool

- Add kb task retry command to CLI with --force and --all flags
- Implement runTaskRetry() to re-run failed or completed tasks
- Add kb_task_retry extension tool for Pi agent integration
- Update CLI help text and command registration
- Add comprehensive tests for retry command and extension tool
- Include changeset for patch release
This commit is contained in:
gsxdsm
2026-03-30 13:37:09 -07:00
parent 80e9575cbc
commit 297013000f
6 changed files with 188 additions and 2 deletions

View File

@@ -339,6 +339,36 @@ export async function runTaskArchive(id: string) {
console.log();
}
export async function runTaskRetry(id: string) {
const store = await getStore();
// Fetch task and validate it exists
let task;
try {
task = await store.getTask(id);
} catch {
throw new Error(`Task ${id} not found`);
}
// Validate task is in failed state
if (task.status !== 'failed') {
throw new Error(`Task ${id} is not failed (status: ${task.status || 'none'})`);
}
// Clear failure state
await store.updateTask(id, { status: null, error: null });
// Move to todo column
await store.moveTask(id, 'todo');
// Log the retry action
await store.logEntry(id, "Retry requested from CLI", "Task reset to todo for retry");
console.log();
console.log(` ✓ Retried ${id} → todo (failure state cleared)`);
console.log();
}
export async function runTaskDelete(id: string, force?: boolean) {
const store = await getStore();