aitasks 1.1.0 → 1.1.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.
Files changed (3) hide show
  1. package/README.md +2 -0
  2. package/dist/index.js +105 -30
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -47,6 +47,7 @@ aitasks done TASK-001 --agent claude-sonnet
47
47
  - Pattern matching: `aitasks claim TASK-0* --agent <id>` claims all TASK-00x tasks
48
48
  - Search: `aitasks search "auth"` finds tasks mentioning authentication
49
49
  - Undo mistakes: `aitasks undo TASK-001`
50
+ - Delete tasks: `aitasks delete TASK-001` (no need to claim first)
50
51
 
51
52
  ---
52
53
 
@@ -100,6 +101,7 @@ export AITASKS_JSON=true
100
101
  | `aitasks reject <id> --reason <text>` | Reject and send back to in_progress |
101
102
  | `aitasks unclaim <id> --agent <id>` | Release a task back to the pool |
102
103
  | `aitasks undo <id>` | Undo the last action on a task |
104
+ | `aitasks delete <id...>` | Delete task(s) - does not require claiming first |
103
105
 
104
106
  **Note:** Commands marked with `<id...>` support multiple task IDs and pattern matching (e.g., `TASK-0*`).
105
107
 
package/dist/index.js CHANGED
@@ -1890,7 +1890,7 @@ var require_commander = __commonJS((exports) => {
1890
1890
  var require_package = __commonJS((exports, module) => {
1891
1891
  module.exports = {
1892
1892
  name: "aitasks",
1893
- version: "1.1.0",
1893
+ version: "1.1.1",
1894
1894
  description: "CLI task management tool built for AI agents",
1895
1895
  type: "module",
1896
1896
  bin: {
@@ -29296,6 +29296,7 @@ aitasks next --claim --agent <id> # Auto-claim and start the best task (one-
29296
29296
  aitasks show TASK-001 # Full detail on a specific task
29297
29297
  aitasks search <query> # Full-text search across titles, descriptions, notes
29298
29298
  aitasks deps TASK-001 # Show dependency tree (what blocks what)
29299
+ aitasks delete TASK-001 # Delete a task (no need to claim first)
29299
29300
  \`\`\`
29300
29301
 
29301
29302
  ---
@@ -29392,8 +29393,6 @@ You MUST verify every acceptance criterion before marking done.
29392
29393
  aitasks done TASK-001 --agent $AITASKS_AGENT_ID
29393
29394
  \`\`\`
29394
29395
 
29395
- **Note:** When you complete a subtask, if ALL sibling subtasks are also done, the parent task will be automatically marked as done.
29396
-
29397
29396
  If human review is needed instead:
29398
29397
  \`\`\`bash
29399
29398
  aitasks review TASK-001 --agent $AITASKS_AGENT_ID
@@ -29436,7 +29435,6 @@ aitasks unclaim TASK-001 --agent $AITASKS_AGENT_ID --reason "Blocked on missing
29436
29435
  5. If a task needs splitting, create subtasks BEFORE marking parent done.
29437
29436
  6. Your evidence strings must be concrete and verifiable \u2014 not vague affirmations.
29438
29437
  7. Always provide --desc and at least one --ac when creating a task. Both are required.
29439
- 8. When completing a subtask, the parent auto-completes if ALL subtasks are done.
29440
29438
 
29441
29439
  ---
29442
29440
 
@@ -29459,6 +29457,7 @@ aitasks block <id> --on <id,...> Mark as blocked
29459
29457
  aitasks unblock <id> --from <id> Remove a blocker
29460
29458
  aitasks unclaim <id> --agent <id> Release task
29461
29459
  aitasks undo <id> Undo last action on task
29460
+ aitasks delete <id...> Delete task(s) - no claim required
29462
29461
  aitasks log <id> Full event history
29463
29462
  aitasks agents List active agents
29464
29463
  aitasks export --format json Export all tasks
@@ -30360,9 +30359,6 @@ function completeTask(taskId, agentId) {
30360
30359
  }
30361
30360
  const updated = updateTask(taskId, { status: "done", completed_at: Date.now() });
30362
30361
  logEvent({ task_id: taskId, agent_id: agentId, event_type: "completed", payload: {} });
30363
- if (task.parent_id) {
30364
- autoCompleteParentIfReady(task.parent_id, taskId);
30365
- }
30366
30362
  const pendingRows = db.query(`SELECT id, blocked_by FROM tasks WHERE status != 'done'`).all();
30367
30363
  for (const row of pendingRows) {
30368
30364
  const blockedBy = JSON.parse(row.blocked_by);
@@ -30382,28 +30378,6 @@ function completeTask(taskId, agentId) {
30382
30378
  db.run(`UPDATE agents SET current_task = NULL WHERE id = ?`, [agentId]);
30383
30379
  return { task: updated };
30384
30380
  }
30385
- function autoCompleteParentIfReady(parentId, completedSubtaskId) {
30386
- const db = getDb();
30387
- const parent = getTask(parentId);
30388
- if (!parent || parent.status === "done")
30389
- return;
30390
- const allSubtasks = listTasks({ parent_id: parentId });
30391
- if (allSubtasks.length === 0)
30392
- return;
30393
- const allDone = allSubtasks.every((t) => t.status === "done");
30394
- if (!allDone)
30395
- return;
30396
- db.run(`UPDATE tasks SET status = 'done', completed_at = ? WHERE id = ?`, [Date.now(), parentId]);
30397
- logEvent({
30398
- task_id: parentId,
30399
- event_type: "auto_completed",
30400
- payload: {
30401
- reason: "all_subtasks_done",
30402
- completed_by: completedSubtaskId,
30403
- subtask_count: allSubtasks.length
30404
- }
30405
- });
30406
- }
30407
30381
  function blockTask(taskId, blockerIds, agentId) {
30408
30382
  const task = getTask(taskId);
30409
30383
  if (!task)
@@ -30543,6 +30517,46 @@ function getStats() {
30543
30517
  total
30544
30518
  };
30545
30519
  }
30520
+ function deleteTask(taskId, agentId) {
30521
+ const db = getDb();
30522
+ const task = getTask(taskId);
30523
+ if (!task) {
30524
+ return { success: false, error: "Task not found" };
30525
+ }
30526
+ const subtasks = listTasks({ parent_id: taskId });
30527
+ if (subtasks.length > 0) {
30528
+ return {
30529
+ success: false,
30530
+ error: `Cannot delete ${taskId} - it has ${subtasks.length} subtask(s). Delete subtasks first.`
30531
+ };
30532
+ }
30533
+ logEvent({
30534
+ task_id: taskId,
30535
+ agent_id: agentId,
30536
+ event_type: "deleted",
30537
+ payload: {}
30538
+ });
30539
+ const allTasks = listTasks();
30540
+ for (const t of allTasks) {
30541
+ if (t.blocks.includes(taskId)) {
30542
+ updateTask(t.id, { blocks: t.blocks.filter((id) => id !== taskId) });
30543
+ }
30544
+ if (t.blocked_by.includes(taskId)) {
30545
+ const remaining = t.blocked_by.filter((id) => id !== taskId);
30546
+ updateTask(t.id, {
30547
+ blocked_by: remaining,
30548
+ status: remaining.length === 0 ? "ready" : "blocked"
30549
+ });
30550
+ }
30551
+ if (t.parent_id === taskId) {
30552
+ updateTask(t.id, { parent_id: null });
30553
+ }
30554
+ }
30555
+ db.run("DELETE FROM events WHERE task_id = ?", [taskId]);
30556
+ db.run("UPDATE agents SET current_task = NULL WHERE current_task = ?", [taskId]);
30557
+ db.run("DELETE FROM tasks WHERE id = ?", [taskId]);
30558
+ return { success: true };
30559
+ }
30546
30560
 
30547
30561
  // src/commands/shared.ts
30548
30562
  function jsonOut(success, data, errorMsg) {
@@ -42640,6 +42654,65 @@ function undoNoteAdded(task, payload) {
42640
42654
  };
42641
42655
  }
42642
42656
 
42657
+ // src/commands/delete.ts
42658
+ var deleteCommand = new Command("delete").description("Delete task(s) - does not require claiming first").argument("<taskIds...>", "Task ID(s) to delete - supports patterns like TASK-0*").option("--agent <agentId>", "Agent ID for tracking (or set AITASKS_AGENT_ID)").option("--json", "Output as JSON").action((taskIds, opts) => {
42659
+ requireInitialized();
42660
+ const json = isJsonMode(opts.json);
42661
+ const agent = opts.agent || process.env.AITASKS_AGENT_ID;
42662
+ const allTaskIds = listTasks().map((t) => t.id);
42663
+ const resolvedIds = expandPatterns(taskIds.map((id) => id.toUpperCase()), allTaskIds);
42664
+ if (resolvedIds.length === 0) {
42665
+ exitError("No tasks match the provided IDs/patterns", json);
42666
+ }
42667
+ const results = [];
42668
+ let successCount = 0;
42669
+ for (const id of resolvedIds) {
42670
+ const { success, error } = deleteTask(id, agent);
42671
+ if (success) {
42672
+ successCount++;
42673
+ results.push({ id, success: true });
42674
+ } else {
42675
+ results.push({ id, success: false, error });
42676
+ }
42677
+ }
42678
+ if (json) {
42679
+ return jsonOut(successCount === resolvedIds.length, {
42680
+ deleted: results.filter((r2) => r2.success).map((r2) => r2.id),
42681
+ failed: results.filter((r2) => !r2.success),
42682
+ total: resolvedIds.length,
42683
+ deletedCount: successCount
42684
+ });
42685
+ }
42686
+ console.log("");
42687
+ for (const result2 of results) {
42688
+ if (result2.success) {
42689
+ console.log(source_default.green(" \u2713") + ` Deleted ${source_default.bold(result2.id)}`);
42690
+ } else {
42691
+ console.log(source_default.red(" \u2717") + ` Failed to delete ${source_default.bold(result2.id)}: ${result2.error}`);
42692
+ }
42693
+ }
42694
+ console.log("");
42695
+ console.log(source_default.dim(` ${successCount}/${resolvedIds.length} tasks deleted`));
42696
+ console.log("");
42697
+ if (successCount < resolvedIds.length) {
42698
+ process.exit(1);
42699
+ }
42700
+ });
42701
+ function expandPatterns(patterns, existingIds) {
42702
+ const resolved = new Set;
42703
+ for (const pattern of patterns) {
42704
+ if (pattern.includes("*")) {
42705
+ const matches2 = expandPattern(pattern, existingIds);
42706
+ matches2.forEach((id) => resolved.add(id));
42707
+ } else {
42708
+ if (existingIds.includes(pattern)) {
42709
+ resolved.add(pattern);
42710
+ }
42711
+ }
42712
+ }
42713
+ return Array.from(resolved);
42714
+ }
42715
+
42643
42716
  // src/index.ts
42644
42717
  var pkg = require_package();
42645
42718
  var program2 = new Command;
@@ -42673,6 +42746,7 @@ Examples:
42673
42746
  aitasks search "auth" # Full-text search
42674
42747
  aitasks deps TASK-001 # Show dependencies
42675
42748
  aitasks undo TASK-001 # Undo last action
42749
+ aitasks delete TASK-001 # Delete a task
42676
42750
  `);
42677
42751
  program2.addCommand(initCommand);
42678
42752
  program2.addCommand(createCommand2);
@@ -42700,9 +42774,10 @@ program2.addCommand(dbCommand);
42700
42774
  program2.addCommand(depsCommand);
42701
42775
  program2.addCommand(searchCommand);
42702
42776
  program2.addCommand(undoCommand);
42777
+ program2.addCommand(deleteCommand);
42703
42778
  program2.parseAsync(process.argv).catch((err) => {
42704
42779
  console.error(err.message);
42705
42780
  process.exit(1);
42706
42781
  });
42707
42782
 
42708
- //# debugId=A95C0DEBB7EDB21864756E2164756E21
42783
+ //# debugId=DB5FBA0C117EB46464756E2164756E21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aitasks",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "CLI task management tool built for AI agents",
5
5
  "type": "module",
6
6
  "bin": {