sqlew 3.2.5 → 3.5.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 (144) hide show
  1. package/CHANGELOG.md +815 -13
  2. package/README.md +53 -2
  3. package/assets/schema.sql +6 -1
  4. package/dist/config/loader.d.ts +46 -0
  5. package/dist/config/loader.d.ts.map +1 -0
  6. package/dist/config/loader.js +151 -0
  7. package/dist/config/loader.js.map +1 -0
  8. package/dist/config/types.d.ts +77 -0
  9. package/dist/config/types.d.ts.map +1 -0
  10. package/dist/config/types.js +28 -0
  11. package/dist/config/types.js.map +1 -0
  12. package/dist/constants.d.ts +9 -0
  13. package/dist/constants.d.ts.map +1 -1
  14. package/dist/constants.js +10 -0
  15. package/dist/constants.js.map +1 -1
  16. package/dist/database.d.ts +1 -1
  17. package/dist/database.d.ts.map +1 -1
  18. package/dist/database.js +77 -10
  19. package/dist/database.js.map +1 -1
  20. package/dist/index.js +21 -3
  21. package/dist/index.js.map +1 -1
  22. package/dist/migrations/add-v3.5.0-pruned-files.d.ts +26 -0
  23. package/dist/migrations/add-v3.5.0-pruned-files.d.ts.map +1 -0
  24. package/dist/migrations/add-v3.5.0-pruned-files.js +107 -0
  25. package/dist/migrations/add-v3.5.0-pruned-files.js.map +1 -0
  26. package/dist/migrations/index.d.ts +2 -1
  27. package/dist/migrations/index.d.ts.map +1 -1
  28. package/dist/migrations/index.js +16 -1
  29. package/dist/migrations/index.js.map +1 -1
  30. package/dist/tests/git-aware-completion.test.d.ts +6 -0
  31. package/dist/tests/git-aware-completion.test.d.ts.map +1 -0
  32. package/dist/tests/git-aware-completion.test.js +141 -0
  33. package/dist/tests/git-aware-completion.test.js.map +1 -0
  34. package/dist/tests/tasks.auto-pruning-decision-link.test.d.ts +6 -0
  35. package/dist/tests/tasks.auto-pruning-decision-link.test.d.ts.map +1 -0
  36. package/dist/tests/tasks.auto-pruning-decision-link.test.js +250 -0
  37. package/dist/tests/tasks.auto-pruning-decision-link.test.js.map +1 -0
  38. package/dist/tests/tasks.auto-pruning-partial.test.d.ts +6 -0
  39. package/dist/tests/tasks.auto-pruning-partial.test.d.ts.map +1 -0
  40. package/dist/tests/tasks.auto-pruning-partial.test.js +274 -0
  41. package/dist/tests/tasks.auto-pruning-partial.test.js.map +1 -0
  42. package/dist/tests/tasks.auto-pruning-persistence.test.d.ts +6 -0
  43. package/dist/tests/tasks.auto-pruning-persistence.test.d.ts.map +1 -0
  44. package/dist/tests/tasks.auto-pruning-persistence.test.js +232 -0
  45. package/dist/tests/tasks.auto-pruning-persistence.test.js.map +1 -0
  46. package/dist/tests/tasks.auto-pruning-safety.test.d.ts +12 -0
  47. package/dist/tests/tasks.auto-pruning-safety.test.d.ts.map +1 -0
  48. package/dist/tests/tasks.auto-pruning-safety.test.js +196 -0
  49. package/dist/tests/tasks.auto-pruning-safety.test.js.map +1 -0
  50. package/dist/tests/tasks.link-file-backward-compat.test.d.ts +6 -0
  51. package/dist/tests/tasks.link-file-backward-compat.test.d.ts.map +1 -0
  52. package/dist/tests/tasks.link-file-backward-compat.test.js +235 -0
  53. package/dist/tests/tasks.link-file-backward-compat.test.js.map +1 -0
  54. package/dist/tests/tasks.watch-files-action.test.d.ts +6 -0
  55. package/dist/tests/tasks.watch-files-action.test.d.ts.map +1 -0
  56. package/dist/tests/tasks.watch-files-action.test.js +351 -0
  57. package/dist/tests/tasks.watch-files-action.test.js.map +1 -0
  58. package/dist/tests/tasks.watch-files-parameter.test.d.ts +6 -0
  59. package/dist/tests/tasks.watch-files-parameter.test.d.ts.map +1 -0
  60. package/dist/tests/tasks.watch-files-parameter.test.js +249 -0
  61. package/dist/tests/tasks.watch-files-parameter.test.js.map +1 -0
  62. package/dist/tests/two-step-git-completion.test.d.ts +6 -0
  63. package/dist/tests/two-step-git-completion.test.d.ts.map +1 -0
  64. package/dist/tests/two-step-git-completion.test.js +283 -0
  65. package/dist/tests/two-step-git-completion.test.js.map +1 -0
  66. package/dist/tests/vcs-staging.test.d.ts +6 -0
  67. package/dist/tests/vcs-staging.test.d.ts.map +1 -0
  68. package/dist/tests/vcs-staging.test.js +137 -0
  69. package/dist/tests/vcs-staging.test.js.map +1 -0
  70. package/dist/tools/config.d.ts +4 -2
  71. package/dist/tools/config.d.ts.map +1 -1
  72. package/dist/tools/config.js +13 -11
  73. package/dist/tools/config.js.map +1 -1
  74. package/dist/tools/constraints.d.ts +7 -4
  75. package/dist/tools/constraints.d.ts.map +1 -1
  76. package/dist/tools/constraints.js +19 -16
  77. package/dist/tools/constraints.js.map +1 -1
  78. package/dist/tools/context.d.ts +33 -17
  79. package/dist/tools/context.d.ts.map +1 -1
  80. package/dist/tools/context.js +84 -68
  81. package/dist/tools/context.js.map +1 -1
  82. package/dist/tools/files.d.ts +9 -5
  83. package/dist/tools/files.d.ts.map +1 -1
  84. package/dist/tools/files.js +19 -15
  85. package/dist/tools/files.js.map +1 -1
  86. package/dist/tools/messaging.d.ts +9 -5
  87. package/dist/tools/messaging.d.ts.map +1 -1
  88. package/dist/tools/messaging.js +20 -16
  89. package/dist/tools/messaging.js.map +1 -1
  90. package/dist/tools/tasks.d.ts +40 -12
  91. package/dist/tools/tasks.d.ts.map +1 -1
  92. package/dist/tools/tasks.js +475 -87
  93. package/dist/tools/tasks.js.map +1 -1
  94. package/dist/tools/utils.d.ts +11 -6
  95. package/dist/tools/utils.d.ts.map +1 -1
  96. package/dist/tools/utils.js +56 -44
  97. package/dist/tools/utils.js.map +1 -1
  98. package/dist/types.d.ts +4 -0
  99. package/dist/types.d.ts.map +1 -1
  100. package/dist/utils/file-pruning.d.ts +69 -0
  101. package/dist/utils/file-pruning.d.ts.map +1 -0
  102. package/dist/utils/file-pruning.js +185 -0
  103. package/dist/utils/file-pruning.js.map +1 -0
  104. package/dist/utils/quality-checks.d.ts +60 -0
  105. package/dist/utils/quality-checks.d.ts.map +1 -0
  106. package/dist/utils/quality-checks.js +228 -0
  107. package/dist/utils/quality-checks.js.map +1 -0
  108. package/dist/utils/retention.d.ts +8 -0
  109. package/dist/utils/retention.d.ts.map +1 -1
  110. package/dist/utils/retention.js +12 -0
  111. package/dist/utils/retention.js.map +1 -1
  112. package/dist/utils/task-stale-detection.d.ts +69 -1
  113. package/dist/utils/task-stale-detection.d.ts.map +1 -1
  114. package/dist/utils/task-stale-detection.js +494 -17
  115. package/dist/utils/task-stale-detection.js.map +1 -1
  116. package/dist/utils/vcs-adapter.d.ts +68 -0
  117. package/dist/utils/vcs-adapter.d.ts.map +1 -0
  118. package/dist/utils/vcs-adapter.js +187 -0
  119. package/dist/utils/vcs-adapter.js.map +1 -0
  120. package/dist/watcher/file-watcher.d.ts +54 -4
  121. package/dist/watcher/file-watcher.d.ts.map +1 -1
  122. package/dist/watcher/file-watcher.js +312 -30
  123. package/dist/watcher/file-watcher.js.map +1 -1
  124. package/dist/watcher/gitignore-parser.d.ts +70 -0
  125. package/dist/watcher/gitignore-parser.d.ts.map +1 -0
  126. package/dist/watcher/gitignore-parser.js +191 -0
  127. package/dist/watcher/gitignore-parser.js.map +1 -0
  128. package/dist/watcher/index.d.ts +1 -0
  129. package/dist/watcher/index.d.ts.map +1 -1
  130. package/dist/watcher/index.js +1 -0
  131. package/dist/watcher/index.js.map +1 -1
  132. package/docs/AI_AGENT_GUIDE.md +1 -1
  133. package/docs/ARCHITECTURE.md +12 -0
  134. package/docs/AUTO_FILE_TRACKING.md +486 -82
  135. package/docs/CONFIGURATION.md +908 -0
  136. package/docs/GIT_AWARE_AUTO_COMPLETE.md +645 -0
  137. package/docs/MIGRATION_v3.3.md +602 -0
  138. package/docs/SHARED_CONCEPTS.md +2 -1
  139. package/docs/TASK_ACTIONS.md +12 -0
  140. package/docs/TASK_OVERVIEW.md +124 -23
  141. package/docs/TASK_PRUNING.md +589 -0
  142. package/docs/TASK_SYSTEM.md +83 -13
  143. package/docs/TOOL_REFERENCE.md +94 -6
  144. package/package.json +8 -6
@@ -0,0 +1,602 @@
1
+ # Migration Guide: v3.2.x → v3.4.1
2
+
3
+ **Major Updates** - File Watcher Redesign + TOML Configuration Support
4
+
5
+ ## Overview
6
+
7
+ Version 3.3.0 introduces two major improvements:
8
+
9
+ ### 1. File Watcher Redesign
10
+ Cleaner, more intuitive API for file watching while maintaining full backward compatibility with v3.2.x code.
11
+
12
+ **What's New:**
13
+ - ✅ `watch_files` parameter in `task.create` and `task.update`
14
+ - ✅ `watch_files` action for managing file watches
15
+ - ⚠️ `task.link(link_type="file")` deprecated (still works, shows warning)
16
+
17
+ ### 2. TOML Configuration Support
18
+ Optional configuration file (`.sqlew/config.toml`) for persistent settings.
19
+
20
+ **What's New:**
21
+ - ✅ TOML config file support (`.sqlew/config.toml`)
22
+ - ✅ Configure database path, retention policies, task thresholds
23
+ - ✅ Priority system: CLI args > config.toml > database defaults
24
+ - ✅ Validation with helpful error messages
25
+ - ✅ Fully backward compatible (config file is optional)
26
+
27
+ **Breaking Changes:** None! All v3.2.x code continues to work.
28
+
29
+ ## Quick Migration Path
30
+
31
+ ### Option 1: Gradual Migration (Recommended)
32
+
33
+ Continue using your existing code. When creating new tasks, use the new API:
34
+
35
+ ```typescript
36
+ // New tasks (v3.4.1 style)
37
+ task action=create
38
+ title: "New feature"
39
+ watch_files: ["src/feature.ts"]
40
+
41
+ // Existing tasks (v3.2.x style still works)
42
+ task action=link
43
+ task_id: 123
44
+ link_type: "file"
45
+ target_id: "src/old-feature.ts"
46
+ ```
47
+
48
+ ### Option 2: Full Migration
49
+
50
+ Update all file watching code to use the new API. See detailed migration steps below.
51
+
52
+ ## Configuration File Setup (Optional)
53
+
54
+ ### Quick Start with TOML Config
55
+
56
+ v3.4.1 adds optional configuration file support. This is **completely optional** - sqlew works without it.
57
+
58
+ **Setup:**
59
+ ```bash
60
+ # Copy example config
61
+ cp .sqlew/config.toml.example .sqlew/config.toml
62
+
63
+ # Edit settings
64
+ nano .sqlew/config.toml
65
+ ```
66
+
67
+ **Example config:**
68
+ ```toml
69
+ [database]
70
+ path = ".sqlew/custom.db" # Override default database path
71
+
72
+ [autodelete]
73
+ ignore_weekend = true # Skip weekends in retention calculations
74
+ message_hours = 48 # Keep messages 48 hours (default: 24)
75
+ file_history_days = 14 # Keep file history 14 days (default: 7)
76
+
77
+ [tasks]
78
+ auto_archive_done_days = 2 # Archive done tasks after 2 days
79
+ stale_hours_in_progress = 2 # Stale threshold for in_progress
80
+ stale_hours_waiting_review = 24 # Stale threshold for waiting_review
81
+ auto_stale_enabled = true # Enable auto-stale detection
82
+ ```
83
+
84
+ **Priority:**
85
+ 1. CLI arguments (highest)
86
+ 2. Config file (`.sqlew/config.toml`)
87
+ 3. Database (`m_config` table)
88
+ 4. Code defaults (lowest)
89
+
90
+ **Complete guide:** See [CONFIGURATION.md](CONFIGURATION.md) for:
91
+ - All configuration options and validation rules
92
+ - Common configurations (dev/prod/weekend-aware)
93
+ - Runtime updates via MCP tools
94
+ - Troubleshooting
95
+
96
+ ### Migration from CLI Arguments
97
+
98
+ **Before (v3.2.x with CLI args):**
99
+ ```json
100
+ {
101
+ "mcpServers": {
102
+ "sqlew": {
103
+ "command": "npx",
104
+ "args": [
105
+ "sqlew",
106
+ "--autodelete-ignore-weekend",
107
+ "--autodelete-message-hours=48",
108
+ "--autodelete-file-history-days=14"
109
+ ]
110
+ }
111
+ }
112
+ }
113
+ ```
114
+
115
+ **After (v3.4.1 with config file):**
116
+ ```json
117
+ {
118
+ "mcpServers": {
119
+ "sqlew": {
120
+ "command": "npx",
121
+ "args": ["sqlew"]
122
+ }
123
+ }
124
+ }
125
+ ```
126
+
127
+ `.sqlew/config.toml`:
128
+ ```toml
129
+ [autodelete]
130
+ ignore_weekend = true
131
+ message_hours = 48
132
+ file_history_days = 14
133
+ ```
134
+
135
+ **Benefits:**
136
+ - Cleaner Claude Desktop config
137
+ - Version-controllable settings
138
+ - Self-documenting configuration
139
+ - Easier to modify without editing JSON
140
+
141
+ ## Detailed Migration Steps
142
+
143
+ ### Step 1: Update Task Creation
144
+
145
+ **Before (v3.2.x):**
146
+ ```typescript
147
+ // Create task
148
+ task action=create
149
+ title: "Implement authentication"
150
+ description: "Add JWT-based auth"
151
+ acceptance_criteria: [
152
+ {type: "tests_pass", command: "npm test auth", expected_pattern: "passing"}
153
+ ]
154
+ priority: 3
155
+ assigned_agent: "backend-dev"
156
+
157
+ // Link files separately (multiple MCP calls)
158
+ task action=link task_id=123 link_type=file target_id="src/auth.ts"
159
+ task action=link task_id=123 link_type=file target_id="src/auth.test.ts"
160
+ task action=link task_id=123 link_type=file target_id="src/middleware/jwt.ts"
161
+ ```
162
+
163
+ **After (v3.4.1):**
164
+ ```typescript
165
+ // Create task with files in one call
166
+ task action=create
167
+ title: "Implement authentication"
168
+ description: "Add JWT-based auth"
169
+ acceptance_criteria: [
170
+ {type: "tests_pass", command: "npm test auth", expected_pattern: "passing"}
171
+ ]
172
+ watch_files: ["src/auth.ts", "src/auth.test.ts", "src/middleware/jwt.ts"]
173
+ priority: 3
174
+ assigned_agent: "backend-dev"
175
+ ```
176
+
177
+ **Benefits:**
178
+ - 1 MCP call instead of 4 (75% reduction)
179
+ - Clearer intent (files are part of task definition)
180
+ - Atomic operation (all files registered together)
181
+ - Better error handling
182
+
183
+ ### Step 2: Update Task Updates
184
+
185
+ **Before (v3.2.x):**
186
+ ```typescript
187
+ // Update task metadata
188
+ task action=update
189
+ task_id: 123
190
+ priority: 4
191
+
192
+ // Add more files to watch (separate calls)
193
+ task action=link task_id=123 link_type=file target_id="src/utils/crypto.ts"
194
+ ```
195
+
196
+ **After (v3.4.1):**
197
+ ```typescript
198
+ // Update task with files in one call
199
+ task action=update
200
+ task_id: 123
201
+ priority: 4
202
+ watch_files: ["src/utils/crypto.ts"] // Adds to existing watch list
203
+ ```
204
+
205
+ ### Step 3: Managing File Watches
206
+
207
+ **Before (v3.2.x):**
208
+ ```typescript
209
+ // No dedicated way to list or remove file links
210
+ // Had to query task details and manually parse links
211
+ task action=get task_id=123
212
+ // Response includes linked_files array
213
+
214
+ // No way to unwatch files without unlinking
215
+ ```
216
+
217
+ **After (v3.4.1):**
218
+ ```typescript
219
+ // List files being watched
220
+ task action=watch_files
221
+ task_id: 123
222
+ action: list
223
+ // Returns: { files: ["src/auth.ts", "src/auth.test.ts"], files_count: 2 }
224
+
225
+ // Add files to watch list
226
+ task action=watch_files
227
+ task_id: 123
228
+ action: watch
229
+ file_paths: ["src/utils/crypto.ts", "src/config/auth.ts"]
230
+
231
+ // Remove files from watch list
232
+ task action=watch_files
233
+ task_id: 123
234
+ action: unwatch
235
+ file_paths: ["src/config/auth.ts"]
236
+ ```
237
+
238
+ ### Step 4: Batch Task Creation
239
+
240
+ **Before (v3.2.x):**
241
+ ```typescript
242
+ // Create tasks in batch
243
+ task action=batch_create
244
+ tasks: [
245
+ {title: "Task 1", ...},
246
+ {title: "Task 2", ...},
247
+ {title: "Task 3", ...}
248
+ ]
249
+
250
+ // Then link files to each task (3 additional calls per task)
251
+ task action=link task_id=101 link_type=file target_id="src/task1.ts"
252
+ task action=link task_id=102 link_type=file target_id="src/task2.ts"
253
+ task action=link task_id=103 link_type=file target_id="src/task3.ts"
254
+ ```
255
+
256
+ **After (v3.4.1):**
257
+ ```typescript
258
+ // Create tasks with files in batch
259
+ task action=batch_create
260
+ tasks: [
261
+ {title: "Task 1", watch_files: ["src/task1.ts"], ...},
262
+ {title: "Task 2", watch_files: ["src/task2.ts"], ...},
263
+ {title: "Task 3", watch_files: ["src/task3.ts"], ...}
264
+ ]
265
+ // Done! Files automatically registered with watcher
266
+ ```
267
+
268
+ ## API Comparison
269
+
270
+ ### Creating Tasks with Files
271
+
272
+ | v3.2.x | v3.4.1 | Improvement |
273
+ |--------|--------|-------------|
274
+ | 4 MCP calls | 1 MCP call | 75% reduction |
275
+ | ~1,400 tokens | ~900 tokens | 35% reduction |
276
+ | Error-prone (manual linking) | Atomic operation | Better reliability |
277
+ | No batch file linking | Batch support | Better scalability |
278
+
279
+ ### Managing File Watches
280
+
281
+ | Operation | v3.2.x | v3.4.1 |
282
+ |-----------|--------|--------|
283
+ | List watched files | `task.get` (parse response) | `watch_files action=list` |
284
+ | Add files | `task.link(file)` × N | `watch_files action=watch` (batch) |
285
+ | Remove files | Not possible | `watch_files action=unwatch` |
286
+ | Check if watching | Parse `task.get` response | `watch_files action=list` |
287
+
288
+ ## Migration Checklist
289
+
290
+ ### For Existing Codebases
291
+
292
+ - [ ] Review all `task.link(link_type="file")` calls
293
+ - [ ] Identify opportunities to consolidate with `task.create`
294
+ - [ ] Update task creation to use `watch_files` parameter
295
+ - [ ] Replace file linking loops with batch operations
296
+ - [ ] Update documentation/examples to use v3.4.1 API
297
+ - [ ] Test file watcher still works after migration
298
+ - [ ] (Optional) Replace deprecated calls with new API
299
+
300
+ ### For New Development
301
+
302
+ - [ ] Use `watch_files` parameter in `task.create`
303
+ - [ ] Use `watch_files` action for dynamic file management
304
+ - [ ] Avoid `task.link(link_type="file")` (deprecated)
305
+ - [ ] Use batch operations for multiple files
306
+ - [ ] Document file watching behavior in task descriptions
307
+
308
+ ## Common Migration Patterns
309
+
310
+ ### Pattern 1: Single File Task
311
+
312
+ **Before:**
313
+ ```typescript
314
+ task action=create title="Fix bug"
315
+ task action=link task_id=X link_type=file target_id="src/fix.ts"
316
+ ```
317
+
318
+ **After:**
319
+ ```typescript
320
+ task action=create title="Fix bug" watch_files=["src/fix.ts"]
321
+ ```
322
+
323
+ ### Pattern 2: Multi-File Task
324
+
325
+ **Before:**
326
+ ```typescript
327
+ task action=create title="Feature"
328
+ task action=link task_id=X link_type=file target_id="src/feature.ts"
329
+ task action=link task_id=X link_type=file target_id="src/feature.test.ts"
330
+ task action=link task_id=X link_type=file target_id="docs/feature.md"
331
+ ```
332
+
333
+ **After:**
334
+ ```typescript
335
+ task action=create
336
+ title: "Feature"
337
+ watch_files: ["src/feature.ts", "src/feature.test.ts", "docs/feature.md"]
338
+ ```
339
+
340
+ ### Pattern 3: Dynamic File Addition
341
+
342
+ **Before:**
343
+ ```typescript
344
+ // Get task
345
+ task action=get task_id=123
346
+
347
+ // Add file based on some condition
348
+ if (condition) {
349
+ task action=link task_id=123 link_type=file target_id="src/extra.ts"
350
+ }
351
+ ```
352
+
353
+ **After:**
354
+ ```typescript
355
+ // Add file based on condition
356
+ if (condition) {
357
+ task action=watch_files
358
+ task_id: 123
359
+ action: watch
360
+ file_paths: ["src/extra.ts"]
361
+ }
362
+ ```
363
+
364
+ ### Pattern 4: File Watching Cleanup
365
+
366
+ **Before:**
367
+ ```typescript
368
+ // No way to remove file watches
369
+ // Had to archive task or manually edit database
370
+ ```
371
+
372
+ **After:**
373
+ ```typescript
374
+ // Remove files from watch list
375
+ task action=watch_files
376
+ task_id: 123
377
+ action: unwatch
378
+ file_paths: ["src/temporary.ts"]
379
+ ```
380
+
381
+ ## Backward Compatibility
382
+
383
+ ### Deprecated API Still Works
384
+
385
+ All v3.2.x code continues to work without changes:
386
+
387
+ ```typescript
388
+ // This still works (shows deprecation warning in console)
389
+ task action=link
390
+ task_id: 123
391
+ link_type: "file"
392
+ target_id: "src/auth.ts"
393
+
394
+ // Console output:
395
+ // ⚠️ DEPRECATION WARNING: task.link(link_type="file") is deprecated as of v3.4.1.
396
+ // Use task.create(watch_files=[...]) or task.update(watch_files=[...]) instead.
397
+ ```
398
+
399
+ ### Mixed API Usage
400
+
401
+ You can mix old and new APIs:
402
+
403
+ ```typescript
404
+ // Old style (deprecated but works)
405
+ task action=link task_id=123 link_type=file target_id="src/old.ts"
406
+
407
+ // New style (recommended)
408
+ task action=watch_files task_id=123 action=watch file_paths=["src/new.ts"]
409
+
410
+ // Both files are watched!
411
+ ```
412
+
413
+ ### Response Format Changes
414
+
415
+ The `task.link(link_type="file")` response now includes a deprecation warning:
416
+
417
+ **Before (v3.2.x):**
418
+ ```json
419
+ {
420
+ "success": true,
421
+ "task_id": 123,
422
+ "linked_to": "file",
423
+ "target": "src/auth.ts",
424
+ "message": "Task 123 linked to file \"src/auth.ts\""
425
+ }
426
+ ```
427
+
428
+ **After (v3.4.1):**
429
+ ```json
430
+ {
431
+ "success": true,
432
+ "task_id": 123,
433
+ "linked_to": "file",
434
+ "target": "src/auth.ts",
435
+ "deprecation_warning": "task.link(link_type=\"file\") is deprecated. Use task.create/update(watch_files) or watch_files action instead.",
436
+ "message": "Task 123 linked to file \"src/auth.ts\" (DEPRECATED API - use watch_files instead)"
437
+ }
438
+ ```
439
+
440
+ ## Troubleshooting Migration Issues
441
+
442
+ ### Issue: Deprecation Warnings
443
+
444
+ **Symptoms**: Console shows deprecation warnings but code works
445
+
446
+ **Solution**: This is expected. Update code when convenient:
447
+
448
+ ```typescript
449
+ // Replace this (deprecated)
450
+ task action=link task_id=123 link_type=file target_id="src/file.ts"
451
+
452
+ // With this (recommended)
453
+ task action=watch_files task_id=123 action=watch file_paths=["src/file.ts"]
454
+ ```
455
+
456
+ ### Issue: Files Not Being Watched
457
+
458
+ **Symptoms**: Used `watch_files` but watcher not monitoring
459
+
460
+ **Solution**: Check file paths are correct and watcher is running:
461
+
462
+ ```typescript
463
+ // Verify files registered
464
+ task action=watch_files task_id=123 action=list
465
+
466
+ // Check watcher status
467
+ task action=watcher subaction=status
468
+ ```
469
+
470
+ ### Issue: Batch File Registration Failed
471
+
472
+ **Symptoms**: Some files not watched after batch operation
473
+
474
+ **Solution**: Check for typos in file paths and verify files exist:
475
+
476
+ ```typescript
477
+ // List what's actually being watched
478
+ task action=watch_files task_id=123 action=list
479
+
480
+ // Add missing files
481
+ task action=watch_files
482
+ task_id: 123
483
+ action: watch
484
+ file_paths: ["src/missing.ts"]
485
+ ```
486
+
487
+ ## Testing Migration
488
+
489
+ ### Verification Steps
490
+
491
+ 1. **Create test task with files:**
492
+ ```typescript
493
+ task action=create
494
+ title: "Migration test"
495
+ watch_files: ["src/test.ts"]
496
+ acceptance_criteria: [{type: "code_contains", file: "src/test.ts", pattern: "test"}]
497
+ ```
498
+
499
+ 2. **Verify files are watched:**
500
+ ```typescript
501
+ task action=watch_files task_id=X action=list
502
+ // Should return: { files: ["src/test.ts"], files_count: 1 }
503
+ ```
504
+
505
+ 3. **Verify watcher is running:**
506
+ ```typescript
507
+ task action=watcher subaction=status
508
+ // Should return: { running: true, files_watched: 1, tasks_monitored: 1 }
509
+ ```
510
+
511
+ 4. **Test auto-transition:**
512
+ - Edit `src/test.ts`
513
+ - Wait 2 seconds (debounce)
514
+ - Check task status: should move from `todo` → `in_progress`
515
+
516
+ 5. **Test file removal:**
517
+ ```typescript
518
+ task action=watch_files task_id=X action=unwatch file_paths=["src/test.ts"]
519
+ task action=watch_files task_id=X action=list
520
+ // Should return: { files: [], files_count: 0 }
521
+ ```
522
+
523
+ ### Regression Testing
524
+
525
+ Ensure v3.2.x code still works:
526
+
527
+ ```typescript
528
+ // Old API should still work (with deprecation warning)
529
+ task action=create title="Regression test"
530
+ task action=link task_id=Y link_type=file target_id="src/regression.ts"
531
+
532
+ // Verify file is watched
533
+ task action=get task_id=Y
534
+ // Should include: linked_files: ["src/regression.ts"]
535
+ ```
536
+
537
+ ## Performance Impact
538
+
539
+ ### Token Savings
540
+
541
+ **Creating 10 tasks with 3 files each:**
542
+
543
+ - **v3.2.x**: 10 creates + 30 links = 40 MCP calls (~14,000 tokens)
544
+ - **v3.4.1**: 10 creates with `watch_files` = 10 MCP calls (~9,000 tokens)
545
+ - **Savings**: 75% fewer calls, 35% fewer tokens
546
+
547
+ ### Memory Impact
548
+
549
+ No change. Both APIs use the same underlying database schema and file watcher.
550
+
551
+ ### Watcher Performance
552
+
553
+ No change. File watching behavior is identical between v3.2.x and v3.4.1.
554
+
555
+ ## Rollback Plan
556
+
557
+ If you need to rollback to v3.2.x behavior:
558
+
559
+ 1. **Database is compatible** - No schema changes in v3.4.1
560
+ 2. **Simply avoid new API** - Don't use `watch_files` parameter/action
561
+ 3. **Use task.link** - Continue using `task.link(link_type="file")`
562
+
563
+ All data created with v3.4.1 API is accessible from v3.2.x.
564
+
565
+ ## Timeline for Deprecation
566
+
567
+ | Version | Status | Notes |
568
+ |---------|--------|-------|
569
+ | v3.4.1 | Deprecation warning | `task.link(file)` shows console warning |
570
+ | v3.4.x | Deprecation warning | No changes, backward compatibility maintained |
571
+ | v3.5.x | Deprecation warning | No changes, backward compatibility maintained |
572
+ | v4.0.0 | Removal (planned) | `task.link(file)` may be removed in v4.0.0 |
573
+
574
+ **Recommendation**: Migrate to v3.4.1 API before v4.0.0 release.
575
+
576
+ ## Summary
577
+
578
+ ✅ **Benefits of v3.4.1:**
579
+ - Cleaner, more intuitive API
580
+ - Fewer MCP calls (75% reduction)
581
+ - Token savings (35% reduction)
582
+ - Batch file operations
583
+ - Better error handling
584
+ - Full backward compatibility
585
+
586
+ ✅ **Migration is optional:**
587
+ - All v3.2.x code works in v3.4.1
588
+ - Deprecation warnings guide you
589
+ - Migrate at your own pace
590
+
591
+ ✅ **No breaking changes:**
592
+ - Database schema unchanged
593
+ - File watcher behavior unchanged
594
+ - Response formats compatible
595
+
596
+ ## See Also
597
+
598
+ - [CONFIGURATION.md](./CONFIGURATION.md) - Complete configuration guide (TOML config, CLI args, MCP tools)
599
+ - [AUTO_FILE_TRACKING.md](./AUTO_FILE_TRACKING.md) - Complete file watching guide
600
+ - [TOOL_REFERENCE.md](./TOOL_REFERENCE.md) - API reference
601
+ - [TASK_ACTIONS.md](./TASK_ACTIONS.md) - All task actions
602
+ - [CHANGELOG.md](../CHANGELOG.md) - Full v3.4.1 changelog
@@ -159,9 +159,10 @@ type TaskStatus =
159
159
  - `done` → `archived`
160
160
  - `archived` → (terminal state, no transitions)
161
161
 
162
- **Auto-Stale Detection**:
162
+ **Auto-Stale Detection & Auto-Archive**:
163
163
  - `in_progress` >2 hours → auto-move to `waiting_review`
164
164
  - `waiting_review` >24 hours → auto-move to `todo`
165
+ - `done` >48 hours → auto-move to `archived` (weekend-aware)
165
166
 
166
167
  ---
167
168
 
@@ -562,6 +562,8 @@ Link task to decision, constraint, or file.
562
562
 
563
563
  Archive completed task (soft delete).
564
564
 
565
+ **Note:** Tasks in `done` status are automatically archived after 48 hours (configurable via `auto_archive_done_days`). Manual archiving is useful for immediate archival needs.
566
+
565
567
  ### Parameters
566
568
 
567
569
  **Required:**
@@ -570,6 +572,7 @@ Archive completed task (soft delete).
570
572
 
571
573
  ### Example
572
574
 
575
+ **Manual Archive:**
573
576
  ```javascript
574
577
  {
575
578
  action: "archive",
@@ -577,6 +580,15 @@ Archive completed task (soft delete).
577
580
  }
578
581
  ```
579
582
 
583
+ **Auto-Archive Configuration:**
584
+ ```javascript
585
+ // Change auto-archive threshold (via config tool)
586
+ {
587
+ action: "update",
588
+ auto_archive_done_days: "3" // Archive after 3 days instead of default 2 days
589
+ }
590
+ ```
591
+
580
592
  ### Response (Success)
581
593
 
582
594
  ```javascript