sqlew 3.1.1 → 3.2.2

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 (51) hide show
  1. package/CHANGELOG.md +100 -0
  2. package/README.md +12 -2
  3. package/assets/schema.sql +28 -1
  4. package/dist/database.d.ts +65 -0
  5. package/dist/database.d.ts.map +1 -1
  6. package/dist/database.js +190 -0
  7. package/dist/database.js.map +1 -1
  8. package/dist/index.js +36 -6
  9. package/dist/index.js.map +1 -1
  10. package/dist/migrations/add-decision-context.d.ts +28 -0
  11. package/dist/migrations/add-decision-context.d.ts.map +1 -0
  12. package/dist/migrations/add-decision-context.js +125 -0
  13. package/dist/migrations/add-decision-context.js.map +1 -0
  14. package/dist/migrations/add-task-dependencies.d.ts +26 -0
  15. package/dist/migrations/add-task-dependencies.d.ts.map +1 -0
  16. package/dist/migrations/add-task-dependencies.js +94 -0
  17. package/dist/migrations/add-task-dependencies.js.map +1 -0
  18. package/dist/migrations/index.d.ts +3 -1
  19. package/dist/migrations/index.d.ts.map +1 -1
  20. package/dist/migrations/index.js +32 -2
  21. package/dist/migrations/index.js.map +1 -1
  22. package/dist/schema.js +2 -2
  23. package/dist/schema.js.map +1 -1
  24. package/dist/tests/migrations/test-v3.2-migration.d.ts +6 -0
  25. package/dist/tests/migrations/test-v3.2-migration.d.ts.map +1 -0
  26. package/dist/tests/migrations/test-v3.2-migration.js +191 -0
  27. package/dist/tests/migrations/test-v3.2-migration.js.map +1 -0
  28. package/dist/tests/tasks.dependencies.test.d.ts +7 -0
  29. package/dist/tests/tasks.dependencies.test.d.ts.map +1 -0
  30. package/dist/tests/tasks.dependencies.test.js +613 -0
  31. package/dist/tests/tasks.dependencies.test.js.map +1 -0
  32. package/dist/tools/context.d.ts +21 -2
  33. package/dist/tools/context.d.ts.map +1 -1
  34. package/dist/tools/context.js +110 -3
  35. package/dist/tools/context.js.map +1 -1
  36. package/dist/tools/tasks.d.ts +23 -0
  37. package/dist/tools/tasks.d.ts.map +1 -1
  38. package/dist/tools/tasks.js +298 -8
  39. package/dist/tools/tasks.js.map +1 -1
  40. package/dist/tools/utils.d.ts.map +1 -1
  41. package/dist/tools/utils.js +44 -21
  42. package/dist/tools/utils.js.map +1 -1
  43. package/dist/types.d.ts +26 -0
  44. package/dist/types.d.ts.map +1 -1
  45. package/docs/AI_AGENT_GUIDE.md +25 -3
  46. package/docs/DECISION_CONTEXT.md +474 -0
  47. package/docs/TASK_ACTIONS.md +311 -10
  48. package/docs/TASK_DEPENDENCIES.md +748 -0
  49. package/docs/TASK_LINKING.md +188 -8
  50. package/docs/WORKFLOWS.md +25 -3
  51. package/package.json +4 -2
@@ -1,7 +1,7 @@
1
1
  # Task Linking Guide
2
2
 
3
- **Version:** 3.0.0
4
- **Last Updated:** 2025-10-17
3
+ **Version:** 3.2.0
4
+ **Last Updated:** 2025-10-18
5
5
 
6
6
  ## Table of Contents
7
7
 
@@ -10,17 +10,19 @@
10
10
  3. [Decision Links](#decision-links)
11
11
  4. [Constraint Links](#constraint-links)
12
12
  5. [File Links](#file-links)
13
- 6. [Querying Links](#querying-links)
14
- 7. [Linking Strategies](#linking-strategies)
15
- 8. [Best Practices](#best-practices)
16
- 9. [Related Documentation](#related-documentation)
13
+ 6. [Task-to-Task Dependencies](#task-to-task-dependencies) (NEW in 3.2.0)
14
+ 7. [Querying Links](#querying-links)
15
+ 8. [Linking Strategies](#linking-strategies)
16
+ 9. [Best Practices](#best-practices)
17
+ 10. [Related Documentation](#related-documentation)
17
18
 
18
19
  ## Overview
19
20
 
20
- Tasks can be linked to three types of entities to establish context and relationships:
21
+ Tasks can be linked to multiple types of entities to establish context and relationships:
21
22
  - **Decisions:** Track which architectural decisions relate to this task
22
23
  - **Constraints:** Associate performance/security/architecture constraints
23
24
  - **Files:** Connect to modified files for context
25
+ - **Task Dependencies:** Blocking relationships between tasks (NEW in 3.2.0)
24
26
 
25
27
  **Benefits of Linking:**
26
28
  - **Context Preservation:** See related decisions/constraints/files when viewing task
@@ -401,6 +403,183 @@ Link tasks to files when:
401
403
  }
402
404
  ```
403
405
 
406
+ ## Task-to-Task Dependencies
407
+
408
+ **NEW in v3.2.0:** Task dependencies are fundamentally different from other link types. While decision/constraint/file links provide **reference context**, task dependencies enforce **blocking relationships** for workflow coordination.
409
+
410
+ ### Key Differences
411
+
412
+ | Aspect | Decision/Constraint/File Links | Task Dependencies |
413
+ |--------|-------------------------------|-------------------|
414
+ | **Purpose** | Reference context | Workflow coordination |
415
+ | **Relationship** | Informational | Blocking (enforced) |
416
+ | **Action Used** | `link` | `add_dependency` / `remove_dependency` |
417
+ | **Direction** | One-way reference | Directional blocking |
418
+ | **Validation** | Entity existence | Circular detection, archived check |
419
+ | **Query Method** | Via `get` action | Via `get_dependencies` action |
420
+
421
+ ### When to Use Dependencies vs Links
422
+
423
+ **Use Task Dependencies For:**
424
+ - Sequential technical requirements (DB schema before ORM)
425
+ - Ordered feature rollout (API before UI)
426
+ - Hard blockers (auth must complete before protected routes)
427
+ - Cross-layer dependencies (data → business → presentation)
428
+
429
+ **Use Decision/Constraint/File Links For:**
430
+ - Documenting architectural decisions related to task
431
+ - Associating performance/security requirements
432
+ - Tracking modified files for context
433
+ - Reference material (not blocking)
434
+
435
+ ### Dependency Examples
436
+
437
+ **Creating Dependencies:**
438
+ ```javascript
439
+ // Task #1: Implement authentication
440
+ {action: "create", title: "Implement JWT auth"}
441
+ // Returns: {task_id: 1}
442
+
443
+ // Task #2: Add user profile (depends on auth)
444
+ {action: "create", title: "Add user profile page"}
445
+ // Returns: {task_id: 2}
446
+
447
+ // Add dependency (auth blocks profile)
448
+ {
449
+ action: "add_dependency",
450
+ blocker_task_id: 1,
451
+ blocked_task_id: 2
452
+ }
453
+ // Task #2 cannot proceed until Task #1 is done
454
+ ```
455
+
456
+ **Combining Dependencies with Links:**
457
+ ```javascript
458
+ // Create infrastructure task
459
+ {action: "create", title: "Setup PostgreSQL", layer: "data"}
460
+ // Returns: {task_id: 10}
461
+
462
+ // Link to decision (context)
463
+ {
464
+ action: "link",
465
+ task_id: 10,
466
+ link_type: "decision",
467
+ link_key: "database_choice"
468
+ }
469
+
470
+ // Create dependent task
471
+ {action: "create", title: "Create user schema", layer: "data"}
472
+ // Returns: {task_id: 11}
473
+
474
+ // Add dependency (PostgreSQL must be setup first)
475
+ {
476
+ action: "add_dependency",
477
+ blocker_task_id: 10,
478
+ blocked_task_id: 11
479
+ }
480
+
481
+ // Result:
482
+ // - Task #11 has context link to "database_choice" decision
483
+ // - Task #11 is blocked by Task #10 (cannot start until DB setup)
484
+ ```
485
+
486
+ **Querying Dependencies:**
487
+ ```javascript
488
+ // Get what's blocking a task
489
+ {
490
+ action: "get_dependencies",
491
+ task_id: 2
492
+ }
493
+ // Returns:
494
+ // {
495
+ // task_id: 2,
496
+ // blockers: [1], // Task #1 blocks this
497
+ // blocking: [] // This doesn't block anything
498
+ // }
499
+
500
+ // Get full task with all links AND dependencies
501
+ {
502
+ action: "get",
503
+ task_id: 2,
504
+ include_dependencies: true
505
+ }
506
+ // Returns:
507
+ // {
508
+ // task_id: 2,
509
+ // title: "Add user profile page",
510
+ // // ... other fields ...
511
+ // dependencies: {
512
+ // blockers: [1],
513
+ // blocking: []
514
+ // },
515
+ // decision_links: ["auth_method"],
516
+ // constraint_links: [],
517
+ // file_links: []
518
+ // }
519
+ ```
520
+
521
+ ### Validation Rules
522
+
523
+ Task dependencies have strict validation to prevent workflow deadlocks:
524
+
525
+ 1. **No Self-Dependencies**: Task cannot block itself
526
+ 2. **No Circular Dependencies**: Direct or transitive cycles rejected
527
+ 3. **Both Tasks Exist**: Blocker and blocked tasks must exist
528
+ 4. **Neither Archived**: Archived tasks cannot participate in dependencies
529
+
530
+ **Example: Circular Detection**
531
+ ```javascript
532
+ // Existing: Task #1 blocks Task #2
533
+ // Existing: Task #2 blocks Task #3
534
+
535
+ // ❌ Invalid (creates cycle)
536
+ {
537
+ action: "add_dependency",
538
+ blocker_task_id: 3,
539
+ blocked_task_id: 1
540
+ }
541
+ // Error: "Circular dependency detected: Task #3 → 1 → 2 → 3"
542
+ ```
543
+
544
+ ### CASCADE Deletion
545
+
546
+ When a task is deleted, all its dependencies are automatically removed:
547
+
548
+ ```javascript
549
+ // Before:
550
+ // Task #1 blocks Task #2
551
+ // Task #1 blocks Task #3
552
+
553
+ // Delete Task #1
554
+ {action: "archive", task_id: 1}
555
+
556
+ // After:
557
+ // Dependencies automatically removed
558
+ // Task #2 and #3 are now unblocked
559
+ ```
560
+
561
+ ### Best Practices
562
+
563
+ **DO:**
564
+ - Use dependencies for hard technical blockers
565
+ - Keep dependency chains short (2-5 levels)
566
+ - Use `get_dependencies` to visualize chains before adding
567
+ - Combine with decision/constraint links for full context
568
+
569
+ **DON'T:**
570
+ - Use dependencies for organizational preferences
571
+ - Create dense dependency graphs (many-to-many)
572
+ - Use dependencies for parallel/independent features
573
+ - Forget to remove dependencies when tasks complete
574
+
575
+ ### For More Details
576
+
577
+ See **[TASK_DEPENDENCIES.md](TASK_DEPENDENCIES.md)** for comprehensive dependency management documentation including:
578
+ - Circular dependency detection algorithm
579
+ - Token efficiency strategies
580
+ - Complete usage examples
581
+ - Workflow coordination patterns
582
+
404
583
  ## Querying Links
405
584
 
406
585
  ### Get Task with Links
@@ -718,12 +897,13 @@ WHERE tcl.constraint_id = 5;
718
897
 
719
898
  - **[TASK_OVERVIEW.md](TASK_OVERVIEW.md)** - Task system overview and core concepts
720
899
  - **[TASK_ACTIONS.md](TASK_ACTIONS.md)** - Complete action reference with examples
900
+ - **[TASK_DEPENDENCIES.md](TASK_DEPENDENCIES.md)** - Dependency management (NEW in 3.2.0)
721
901
  - **[TASK_MIGRATION.md](TASK_MIGRATION.md)** - Migrating from decision-based task tracking
722
902
  - **[TASK_SYSTEM.md](TASK_SYSTEM.md)** - Complete documentation (original)
723
903
  - **[AI_AGENT_GUIDE.md](AI_AGENT_GUIDE.md)** - Comprehensive AI agent guide
724
904
 
725
905
  ---
726
906
 
727
- **Version:** 3.0.0
907
+ **Version:** 3.2.0
728
908
  **Last Updated:** 2025-10-17
729
909
  **Author:** sin5ddd
package/docs/WORKFLOWS.md CHANGED
@@ -564,12 +564,34 @@ async function pollForUpdates() {
564
564
 
565
565
  // Response:
566
566
  // {
567
+ // agents: 5,
568
+ // files: 42,
569
+ // context_keys: 156,
570
+ // active_decisions: 312,
567
571
  // total_decisions: 342,
568
- // total_messages: 1203,
569
- // total_file_changes: 589,
572
+ // messages: 1203,
573
+ // file_changes: 589,
574
+ // active_constraints: 12,
570
575
  // total_constraints: 15,
576
+ // tags: 10,
577
+ // scopes: 8,
578
+ // layers: 5,
571
579
  // total_tasks: 47,
572
- // db_size_kb: 1024
580
+ // active_tasks: 23, // Excludes done and archived
581
+ // tasks_by_status: {
582
+ // todo: 15,
583
+ // in_progress: 5,
584
+ // waiting_review: 3,
585
+ // blocked: 0,
586
+ // done: 20,
587
+ // archived: 4
588
+ // },
589
+ // tasks_by_priority: {
590
+ // low: 10,
591
+ // medium: 25,
592
+ // high: 10,
593
+ // critical: 2
594
+ // }
573
595
  // }
574
596
 
575
597
  // If database too large, trigger cleanup
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sqlew",
3
- "version": "3.1.1",
4
- "description": "MCP server for efficient context sharing between Claude Code sub-agents with Kanban Task Watcher, auto-file-tracking, and 97% token reduction",
3
+ "version": "3.2.2",
4
+ "description": "MCP server for efficient context sharing between Claude Code sub-agents with Kanban Task Watcher, Decision Context, auto-file-tracking, and 97% token reduction",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
7
7
  "bin": {
@@ -26,6 +26,8 @@
26
26
  "dev": "tsc --watch",
27
27
  "clean": "rm -rf dist",
28
28
  "rebuild": "npm run clean && npm run build",
29
+ "test": "npm run build && node --test dist/tests/tasks.dependencies.test.js",
30
+ "test:migrations": "npm run build && node dist/tests/migrations/test-v3.2-migration.js",
29
31
  "prepublishOnly": "npm run rebuild"
30
32
  },
31
33
  "engines": {