sqlew 3.1.2 → 3.2.3

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 (70) hide show
  1. package/CHANGELOG.md +118 -0
  2. package/README.md +58 -3
  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 +47 -1005
  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/config.d.ts +10 -0
  33. package/dist/tools/config.d.ts.map +1 -1
  34. package/dist/tools/config.js +105 -0
  35. package/dist/tools/config.js.map +1 -1
  36. package/dist/tools/constraints.d.ts +10 -0
  37. package/dist/tools/constraints.d.ts.map +1 -1
  38. package/dist/tools/constraints.js +167 -0
  39. package/dist/tools/constraints.js.map +1 -1
  40. package/dist/tools/context.d.ts +29 -2
  41. package/dist/tools/context.d.ts.map +1 -1
  42. package/dist/tools/context.js +442 -106
  43. package/dist/tools/context.js.map +1 -1
  44. package/dist/tools/files.d.ts +8 -0
  45. package/dist/tools/files.d.ts.map +1 -1
  46. package/dist/tools/files.js +125 -0
  47. package/dist/tools/files.js.map +1 -1
  48. package/dist/tools/messaging.d.ts +8 -0
  49. package/dist/tools/messaging.d.ts.map +1 -1
  50. package/dist/tools/messaging.js +134 -0
  51. package/dist/tools/messaging.js.map +1 -1
  52. package/dist/tools/tasks.d.ts +32 -0
  53. package/dist/tools/tasks.d.ts.map +1 -1
  54. package/dist/tools/tasks.js +651 -8
  55. package/dist/tools/tasks.js.map +1 -1
  56. package/dist/tools/utils.d.ts +10 -0
  57. package/dist/tools/utils.d.ts.map +1 -1
  58. package/dist/tools/utils.js +179 -21
  59. package/dist/tools/utils.js.map +1 -1
  60. package/dist/types.d.ts +26 -0
  61. package/dist/types.d.ts.map +1 -1
  62. package/docs/AI_AGENT_GUIDE.md +25 -3
  63. package/docs/DECISION_CONTEXT.md +474 -0
  64. package/docs/HELP_PREVIEW_COMPARISON.md +259 -0
  65. package/docs/TASK_ACTIONS.md +311 -10
  66. package/docs/TASK_DEPENDENCIES.md +748 -0
  67. package/docs/TASK_LINKING.md +188 -8
  68. package/docs/TOOL_REFERENCE.md +158 -1
  69. package/docs/WORKFLOWS.md +25 -3
  70. 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
@@ -87,7 +87,7 @@
87
87
  | Action | Required | Optional |
88
88
  |--------|----------|----------|
89
89
  | **set** | action, key, value, layer | agent, version, status, tags, scopes |
90
- | **get** | action, key | version |
90
+ | **get** | action, key | version, include_context |
91
91
  | **list** | action | status, layer, tags, scope, tag_match, limit, offset |
92
92
  | **search_tags** | action, tags | match_mode, status, layer |
93
93
  | **search_layer** | action, layer | status, include_tags |
@@ -99,6 +99,8 @@
99
99
  | **set_from_template** | action, template, key, value, layer | agent, version, status, tags, scopes |
100
100
  | **create_template** | action, name, defaults | required_fields, created_by |
101
101
  | **list_templates** | action | - |
102
+ | **add_decision_context** | action, key, rationale | alternatives_considered, tradeoffs, decided_by, related_task_id, related_constraint_id |
103
+ | **list_decision_contexts** | action | decision_key, related_task_id, related_constraint_id, decided_by, limit, offset |
102
104
 
103
105
  ### `message` Tool
104
106
 
@@ -321,6 +323,161 @@
321
323
 
322
324
  ---
323
325
 
326
+ ## Decision Context System (v3.2.2)
327
+
328
+ ### What is Decision Context?
329
+
330
+ Decision Context allows you to attach rich documentation to decisions, including:
331
+ - **Rationale**: WHY the decision was made
332
+ - **Alternatives Considered**: What options were evaluated and rejected
333
+ - **Tradeoffs**: Pros and cons analysis
334
+
335
+ ### Key Features
336
+
337
+ - **Multi-Session Development**: Preserve decision reasoning across days/weeks
338
+ - **Architecture Reviews**: Document non-standard choices for future developers
339
+ - **Team Handoffs**: Transfer knowledge with full context
340
+ - **Linked Relationships**: Connect contexts to tasks and constraints
341
+
342
+ ### Adding Decision Context
343
+
344
+ ```javascript
345
+ {
346
+ action: "add_decision_context",
347
+ key: "database_choice",
348
+ rationale: "Selected PostgreSQL because: (1) Complex relational queries required for reporting, (2) ACID compliance critical for financial data, (3) Team has strong SQL expertise",
349
+ alternatives_considered: [
350
+ {
351
+ option: "MongoDB",
352
+ reason: "Rejected due to weak consistency guarantees for financial data"
353
+ },
354
+ {
355
+ option: "MySQL",
356
+ reason: "Rejected due to limited JSON support needed for metadata"
357
+ }
358
+ ],
359
+ tradeoffs: {
360
+ pros: ["Strong consistency", "Complex queries", "Team expertise"],
361
+ cons: ["Less flexible schema", "Vertical scaling limitations"]
362
+ },
363
+ decided_by: "backend-team",
364
+ related_task_id: 42
365
+ }
366
+ ```
367
+
368
+ **Response:**
369
+ ```json
370
+ {
371
+ "success": true,
372
+ "context_id": 1,
373
+ "decision_key": "database_choice",
374
+ "message": "Decision context added successfully"
375
+ }
376
+ ```
377
+
378
+ ### Retrieving Decision with Context
379
+
380
+ ```javascript
381
+ // Standard get (backward compatible)
382
+ {
383
+ action: "get",
384
+ key: "database_choice"
385
+ }
386
+ // → Returns: { key, value, layer, status, version, tags, ... }
387
+
388
+ // Get with context
389
+ {
390
+ action: "get",
391
+ key: "database_choice",
392
+ include_context: true
393
+ }
394
+ // → Returns: { key, value, ..., contexts: [{rationale, alternatives_considered, tradeoffs, ...}] }
395
+ ```
396
+
397
+ ### Listing Decision Contexts
398
+
399
+ ```javascript
400
+ // List all contexts
401
+ {
402
+ action: "list_decision_contexts",
403
+ limit: 50
404
+ }
405
+
406
+ // Filter by decision key
407
+ {
408
+ action: "list_decision_contexts",
409
+ decision_key: "database_choice"
410
+ }
411
+
412
+ // Filter by related task
413
+ {
414
+ action: "list_decision_contexts",
415
+ related_task_id: 42
416
+ }
417
+ ```
418
+
419
+ **Response:**
420
+ ```json
421
+ {
422
+ "success": true,
423
+ "contexts": [
424
+ {
425
+ "id": 1,
426
+ "decision_key": "database_choice",
427
+ "rationale": "Selected PostgreSQL because...",
428
+ "alternatives_considered": [...],
429
+ "tradeoffs": {...},
430
+ "decided_by": "backend-team",
431
+ "decision_date": "2025-10-18T06:48:00Z",
432
+ "related_task_id": 42,
433
+ "related_constraint_id": null
434
+ }
435
+ ],
436
+ "count": 1
437
+ }
438
+ ```
439
+
440
+ ### Parameter Details
441
+
442
+ | Parameter | Type | Required | Description |
443
+ |-----------|------|----------|-------------|
444
+ | **key** | string | ✅ | Decision key to attach context to |
445
+ | **rationale** | string | ✅ | WHY the decision was made |
446
+ | **alternatives_considered** | JSON array | ❌ | List of {option, reason} objects |
447
+ | **tradeoffs** | JSON object | ❌ | {pros: [...], cons: [...]} analysis |
448
+ | **decided_by** | string | ❌ | Agent/team who made the decision |
449
+ | **related_task_id** | number | ❌ | Link to implementation task |
450
+ | **related_constraint_id** | number | ❌ | Link to system constraint |
451
+
452
+ ### When to Use Decision Context
453
+
454
+ ✅ **Use for:**
455
+ - Architectural decisions with multiple viable options
456
+ - Non-obvious implementation choices
457
+ - Breaking changes that need justification
458
+ - Security/performance trade-off analysis
459
+ - Cross-team collaboration documentation
460
+
461
+ ❌ **Don't use for:**
462
+ - Routine implementation details
463
+ - Temporary decisions
464
+ - Obvious or standard choices
465
+
466
+ ### Best Practices
467
+
468
+ 1. **Be Specific**: "Chose X because Y" not "Chose X"
469
+ 2. **Document Alternatives**: Show what was considered and rejected
470
+ 3. **Quantify Tradeoffs**: "5ms overhead acceptable for security" not "minor overhead"
471
+ 4. **Link to Tasks**: Connect decision context to implementation tasks
472
+ 5. **Update Over Time**: Add new contexts as decisions evolve
473
+
474
+ ### See Also
475
+
476
+ - **[Decision Context Guide](DECISION_CONTEXT.md)** - Comprehensive examples and workflows (500+ lines)
477
+ - **[Workflows](WORKFLOWS.md)** - Multi-step decision context workflows
478
+
479
+ ---
480
+
324
481
  ## Template System
325
482
 
326
483
  ### What are Templates?
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.2",
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.3",
4
+ "description": "MCP server for efficient context sharing between Claude Code sub-agents with Kanban Task Watcher, Decision Context, auto-file-tracking, and 96% token efficiency through API consolidation",
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": {