sqlew 4.0.5 → 4.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 (217) hide show
  1. package/CHANGELOG.md +1817 -1782
  2. package/README.md +409 -468
  3. package/assets/claude-md-snippets/plan-mode-integration.md +17 -6
  4. package/assets/config.example.toml +282 -284
  5. package/assets/sample-agents/README.md +36 -40
  6. package/assets/sample-agents/sqlew-architect.md +321 -322
  7. package/assets/sample-agents/sqlew-researcher.md +292 -293
  8. package/assets/sample-agents/sqlew-scrum-master.md +286 -287
  9. package/assets/sample-commands/README.md +56 -57
  10. package/assets/sample-skills/sqlew-plan-guidance/SKILL.md +33 -26
  11. package/dist/cli/hooks/check-completion.d.ts +19 -0
  12. package/dist/cli/hooks/check-completion.d.ts.map +1 -0
  13. package/dist/cli/hooks/check-completion.js +104 -0
  14. package/dist/cli/hooks/check-completion.js.map +1 -0
  15. package/dist/cli/hooks/init-hooks.d.ts +35 -0
  16. package/dist/cli/hooks/init-hooks.d.ts.map +1 -0
  17. package/dist/cli/hooks/init-hooks.js +425 -0
  18. package/dist/cli/hooks/init-hooks.js.map +1 -0
  19. package/dist/cli/hooks/mark-done.d.ts +25 -0
  20. package/dist/cli/hooks/mark-done.d.ts.map +1 -0
  21. package/dist/cli/hooks/mark-done.js +128 -0
  22. package/dist/cli/hooks/mark-done.js.map +1 -0
  23. package/dist/cli/hooks/plan-id-utils.d.ts +83 -0
  24. package/dist/cli/hooks/plan-id-utils.d.ts.map +1 -0
  25. package/dist/cli/hooks/plan-id-utils.js +183 -0
  26. package/dist/cli/hooks/plan-id-utils.js.map +1 -0
  27. package/dist/cli/hooks/save.d.ts +23 -0
  28. package/dist/cli/hooks/save.d.ts.map +1 -0
  29. package/dist/cli/hooks/save.js +90 -0
  30. package/dist/cli/hooks/save.js.map +1 -0
  31. package/dist/cli/hooks/stdin-parser.d.ts +139 -0
  32. package/dist/cli/hooks/stdin-parser.d.ts.map +1 -0
  33. package/dist/cli/hooks/stdin-parser.js +127 -0
  34. package/dist/cli/hooks/stdin-parser.js.map +1 -0
  35. package/dist/cli/hooks/suggest.d.ts +19 -0
  36. package/dist/cli/hooks/suggest.d.ts.map +1 -0
  37. package/dist/cli/hooks/suggest.js +157 -0
  38. package/dist/cli/hooks/suggest.js.map +1 -0
  39. package/dist/cli/hooks/track-plan.d.ts +36 -0
  40. package/dist/cli/hooks/track-plan.d.ts.map +1 -0
  41. package/dist/cli/hooks/track-plan.js +152 -0
  42. package/dist/cli/hooks/track-plan.js.map +1 -0
  43. package/dist/cli.d.ts.map +1 -1
  44. package/dist/cli.js +56 -16
  45. package/dist/cli.js.map +1 -1
  46. package/dist/config/global-config.d.ts +187 -0
  47. package/dist/config/global-config.d.ts.map +1 -0
  48. package/dist/config/global-config.js +206 -0
  49. package/dist/config/global-config.js.map +1 -0
  50. package/dist/config/loader.d.ts +42 -0
  51. package/dist/config/loader.d.ts.map +1 -1
  52. package/dist/config/loader.js +96 -0
  53. package/dist/config/loader.js.map +1 -1
  54. package/dist/constants.d.ts +4 -0
  55. package/dist/constants.d.ts.map +1 -1
  56. package/dist/constants.js +10 -0
  57. package/dist/constants.js.map +1 -1
  58. package/dist/database/migrations/v4/20251126000000_v4_bootstrap.js +59 -59
  59. package/dist/database/migrations/v4/20251126000000_v4_bootstrap.js.map +1 -1
  60. package/dist/database/migrations/v4/20251126000001_v4_migrate_data.js +33 -33
  61. package/dist/database/migrations/v4/20251126000001_v4_migrate_data.js.map +1 -1
  62. package/dist/database/migrations/v4/20251127000000_add_rejected_status.js +7 -7
  63. package/dist/database/migrations/v4/20251127000000_add_rejected_status.js.map +1 -1
  64. package/dist/database/migrations/v4/20251127000001_update_task_move_help.js +11 -11
  65. package/dist/database/migrations/v4/20251127000001_update_task_move_help.js.map +1 -1
  66. package/dist/database/migrations/v4/20251127000002_v4_seed_help_system.js +10 -10
  67. package/dist/database/migrations/v4/20251127000002_v4_seed_help_system.js.map +1 -1
  68. package/dist/database/migrations/v4/20251127000003_add_task_notes_column.js +7 -7
  69. package/dist/database/migrations/v4/20251127000003_add_task_notes_column.js.map +1 -1
  70. package/dist/database/migrations/v4/20251128000000_drop_all_views.js +8 -8
  71. package/dist/database/migrations/v4/20251128000000_drop_all_views.js.map +1 -1
  72. package/dist/database/operations/queries.d.ts.map +1 -1
  73. package/dist/database/operations/queries.js +11 -2
  74. package/dist/database/operations/queries.js.map +1 -1
  75. package/dist/index.js +4 -1
  76. package/dist/index.js.map +1 -1
  77. package/dist/init-agents.js +0 -1
  78. package/dist/init-agents.js.map +1 -1
  79. package/dist/init-skills.d.ts +4 -3
  80. package/dist/init-skills.d.ts.map +1 -1
  81. package/dist/init-skills.js +10 -3
  82. package/dist/init-skills.js.map +1 -1
  83. package/dist/server/setup.d.ts +8 -0
  84. package/dist/server/setup.d.ts.map +1 -1
  85. package/dist/server/setup.js +141 -21
  86. package/dist/server/setup.js.map +1 -1
  87. package/dist/sync-agents.d.ts.map +1 -1
  88. package/dist/sync-agents.js +48 -3
  89. package/dist/sync-agents.js.map +1 -1
  90. package/dist/sync-commands.d.ts.map +1 -1
  91. package/dist/sync-commands.js +43 -3
  92. package/dist/sync-commands.js.map +1 -1
  93. package/dist/tools/constraints/actions/get.d.ts.map +1 -1
  94. package/dist/tools/constraints/actions/get.js +5 -8
  95. package/dist/tools/constraints/actions/get.js.map +1 -1
  96. package/dist/tools/constraints/help/help.d.ts.map +1 -1
  97. package/dist/tools/constraints/help/help.js +1 -6
  98. package/dist/tools/constraints/help/help.js.map +1 -1
  99. package/dist/tools/context/actions/get.d.ts.map +1 -1
  100. package/dist/tools/context/actions/get.js.map +1 -1
  101. package/dist/tools/context/actions/search-layer.d.ts.map +1 -1
  102. package/dist/tools/context/actions/search-layer.js +5 -3
  103. package/dist/tools/context/actions/search-layer.js.map +1 -1
  104. package/dist/tools/context/actions/set-from-policy.d.ts +2 -1
  105. package/dist/tools/context/actions/set-from-policy.d.ts.map +1 -1
  106. package/dist/tools/context/actions/set-from-policy.js.map +1 -1
  107. package/dist/tools/context/help/help.d.ts.map +1 -1
  108. package/dist/tools/context/help/help.js +1 -7
  109. package/dist/tools/context/help/help.js.map +1 -1
  110. package/dist/tools/context/internal/queries.d.ts.map +1 -1
  111. package/dist/tools/context/internal/queries.js +5 -2
  112. package/dist/tools/context/internal/queries.js.map +1 -1
  113. package/dist/tools/context/types.d.ts +1 -1
  114. package/dist/tools/context/types.d.ts.map +1 -1
  115. package/dist/tools/files/actions/get.d.ts.map +1 -1
  116. package/dist/tools/files/actions/get.js +4 -6
  117. package/dist/tools/files/actions/get.js.map +1 -1
  118. package/dist/tools/files/help/help.d.ts.map +1 -1
  119. package/dist/tools/files/help/help.js +1 -6
  120. package/dist/tools/files/help/help.js.map +1 -1
  121. package/dist/tools/suggest/help/constraint-help.d.ts.map +1 -1
  122. package/dist/tools/suggest/help/constraint-help.js +0 -2
  123. package/dist/tools/suggest/help/constraint-help.js.map +1 -1
  124. package/dist/tools/suggest/internal/constraint-queries.d.ts.map +1 -1
  125. package/dist/tools/suggest/internal/constraint-queries.js +12 -5
  126. package/dist/tools/suggest/internal/constraint-queries.js.map +1 -1
  127. package/dist/tools/suggest/internal/queries.js +2 -2
  128. package/dist/tools/suggest/internal/queries.js.map +1 -1
  129. package/dist/tools/tasks/help/help.d.ts.map +1 -1
  130. package/dist/tools/tasks/help/help.js +0 -6
  131. package/dist/tools/tasks/help/help.js.map +1 -1
  132. package/dist/tools/tasks/help/use-case.d.ts.map +1 -1
  133. package/dist/tools/tasks/help/use-case.js +0 -1
  134. package/dist/tools/tasks/help/use-case.js.map +1 -1
  135. package/dist/tools/tasks/watcher/status.d.ts.map +1 -1
  136. package/dist/tools/tasks/watcher/status.js +5 -1
  137. package/dist/tools/tasks/watcher/status.js.map +1 -1
  138. package/dist/types/decision/params.d.ts +7 -6
  139. package/dist/types/decision/params.d.ts.map +1 -1
  140. package/dist/types/decision/templates.d.ts +3 -2
  141. package/dist/types/decision/templates.d.ts.map +1 -1
  142. package/dist/types/view-entities.d.ts +2 -1
  143. package/dist/types/view-entities.d.ts.map +1 -1
  144. package/dist/types.d.ts +19 -11
  145. package/dist/types.d.ts.map +1 -1
  146. package/dist/types.js +4 -1
  147. package/dist/types.js.map +1 -1
  148. package/dist/utils/enum-converter.d.ts +72 -0
  149. package/dist/utils/enum-converter.d.ts.map +1 -0
  150. package/dist/utils/enum-converter.js +76 -0
  151. package/dist/utils/enum-converter.js.map +1 -0
  152. package/dist/utils/hook-queue.d.ts +81 -0
  153. package/dist/utils/hook-queue.d.ts.map +1 -0
  154. package/dist/utils/hook-queue.js +156 -0
  155. package/dist/utils/hook-queue.js.map +1 -0
  156. package/dist/utils/project-root.d.ts +9 -2
  157. package/dist/utils/project-root.d.ts.map +1 -1
  158. package/dist/utils/project-root.js +16 -2
  159. package/dist/utils/project-root.js.map +1 -1
  160. package/dist/utils/tag-parser.d.ts.map +1 -1
  161. package/dist/utils/tag-parser.js +6 -0
  162. package/dist/utils/tag-parser.js.map +1 -1
  163. package/dist/utils/universal-knex.js +3 -3
  164. package/dist/utils/universal-knex.js.map +1 -1
  165. package/dist/utils/validators.d.ts +1 -1
  166. package/dist/utils/validators.d.ts.map +1 -1
  167. package/dist/utils/validators.js +1 -1
  168. package/dist/utils/validators.js.map +1 -1
  169. package/dist/utils/vcs-adapter.d.ts +44 -0
  170. package/dist/utils/vcs-adapter.d.ts.map +1 -1
  171. package/dist/utils/vcs-adapter.js +88 -0
  172. package/dist/utils/vcs-adapter.js.map +1 -1
  173. package/dist/utils/view-queries.d.ts.map +1 -1
  174. package/dist/utils/view-queries.js +9 -19
  175. package/dist/utils/view-queries.js.map +1 -1
  176. package/dist/watcher/base-watcher.d.ts +69 -0
  177. package/dist/watcher/base-watcher.d.ts.map +1 -0
  178. package/dist/watcher/base-watcher.js +130 -0
  179. package/dist/watcher/base-watcher.js.map +1 -0
  180. package/dist/watcher/index.d.ts +3 -0
  181. package/dist/watcher/index.d.ts.map +1 -1
  182. package/dist/watcher/index.js +2 -0
  183. package/dist/watcher/index.js.map +1 -1
  184. package/dist/watcher/queue-watcher.d.ts +64 -0
  185. package/dist/watcher/queue-watcher.d.ts.map +1 -0
  186. package/dist/watcher/queue-watcher.js +187 -0
  187. package/dist/watcher/queue-watcher.js.map +1 -0
  188. package/docs/ADR_CONCEPTS.md +140 -0
  189. package/docs/CONFIGURATION.md +922 -925
  190. package/docs/CROSS_DATABASE.md +153 -0
  191. package/docs/DATABASE_AUTH.md +70 -356
  192. package/docs/HOOKS_GUIDE.md +159 -0
  193. package/docs/SLASH_COMMANDS.md +329 -337
  194. package/docs/TASK_SYSTEM_DEPRECATED.md +88 -0
  195. package/docs/changelogs/CHANGELOG_ARCHIVE_v3.4_and_older.md +293 -296
  196. package/docs/cli/DATA_EXPORT_IMPORT.md +699 -700
  197. package/docs/cli/README.md +276 -277
  198. package/package.json +123 -124
  199. package/docs/ACCEPTANCE_CRITERIA.md +0 -625
  200. package/docs/AI_AGENT_GUIDE.md +0 -299
  201. package/docs/ARCHITECTURE.md +0 -167
  202. package/docs/AUTO_FILE_TRACKING.md +0 -841
  203. package/docs/BATCH_VALIDATION.md +0 -617
  204. package/docs/BEST_PRACTICES.md +0 -168
  205. package/docs/CONSTRAINT_INTELLIGENCE.md +0 -339
  206. package/docs/DECISION_CONTEXT.md +0 -697
  207. package/docs/DECISION_INTELLIGENCE.md +0 -605
  208. package/docs/GIT_AWARE_AUTO_COMPLETE.md +0 -646
  209. package/docs/MIGRATION_GUIDE_V3.9.0.md +0 -371
  210. package/docs/SHARED_CONCEPTS.md +0 -225
  211. package/docs/SPECIALIZED_AGENTS.md +0 -126
  212. package/docs/TASK_ACTIONS.md +0 -1177
  213. package/docs/TASK_OVERVIEW.md +0 -452
  214. package/docs/TASK_PRUNING.md +0 -594
  215. package/docs/TOOL_REFERENCE.md +0 -1077
  216. package/docs/TOOL_SELECTION.md +0 -83
  217. package/docs/WORKFLOWS.md +0 -941
@@ -1,625 +0,0 @@
1
- # Acceptance Criteria Reference
2
-
3
- Complete guide to all acceptance check types supported by the Auto File Tracking system.
4
-
5
- ## Overview
6
-
7
- Acceptance criteria define automated validation checks that determine when a task is complete. Each check returns `success: true` or `success: false`, and tasks only auto-complete when **all** checks pass.
8
-
9
- ## Check Types
10
-
11
- ### 1. tests_pass
12
-
13
- Execute a shell command and validate the output.
14
-
15
- **Use Cases:**
16
- - Run unit tests, integration tests, E2E tests
17
- - Execute linters, type checkers, formatters
18
- - Run build commands
19
- - Execute custom validation scripts
20
-
21
- **Parameters:**
22
- - `type`: `"tests_pass"` (required)
23
- - `command`: Shell command to execute (required)
24
- - `expected_pattern`: Regex pattern to match in output (optional)
25
- - `timeout`: Timeout in seconds (optional, default: 60)
26
-
27
- **Examples:**
28
-
29
- ```typescript
30
- // Basic test execution (passes if exit code is 0)
31
- {
32
- type: "tests_pass",
33
- command: "npm test"
34
- }
35
-
36
- // Test with pattern matching
37
- {
38
- type: "tests_pass",
39
- command: "npm test -- auth.test.ts",
40
- expected_pattern: "5 passing"
41
- }
42
-
43
- // Multiple patterns (OR logic using regex)
44
- {
45
- type: "tests_pass",
46
- command: "npm run build",
47
- expected_pattern: "(success|completed|built)"
48
- }
49
-
50
- // Custom timeout for slow tests
51
- {
52
- type: "tests_pass",
53
- command: "npm run e2e-tests",
54
- expected_pattern: "passing",
55
- timeout: 300 // 5 minutes
56
- }
57
-
58
- // Linting
59
- {
60
- type: "tests_pass",
61
- command: "npm run lint",
62
- expected_pattern: "0 errors"
63
- }
64
-
65
- // Type checking
66
- {
67
- type: "tests_pass",
68
- command: "npx tsc --noEmit",
69
- expected_pattern: "0 errors"
70
- }
71
- ```
72
-
73
- **Success Criteria:**
74
- - Command exits with code 0 (success)
75
- - If `expected_pattern` specified, output must match the regex
76
-
77
- **Failure Cases:**
78
- - Command exits with non-zero code
79
- - Command times out
80
- - Output doesn't match `expected_pattern` (if specified)
81
-
82
- ---
83
-
84
- ### 2. code_removed
85
-
86
- Verify that a specific code pattern has been removed from a file.
87
-
88
- **Use Cases:**
89
- - Confirm deprecated code removed
90
- - Verify TODO comments removed
91
- - Ensure debug statements removed
92
- - Validate old API usage eliminated
93
-
94
- **Parameters:**
95
- - `type`: `"code_removed"` (required)
96
- - `file`: Path to file (required)
97
- - `pattern`: Regex pattern that should NOT exist (required)
98
-
99
- **Examples:**
100
-
101
- ```typescript
102
- // Remove TODO comment
103
- {
104
- type: "code_removed",
105
- file: "src/api.ts",
106
- pattern: "// TODO: implement error handling"
107
- }
108
-
109
- // Remove deprecated function
110
- {
111
- type: "code_removed",
112
- file: "src/utils.ts",
113
- pattern: "function oldMethod\\("
114
- }
115
-
116
- // Remove console.log statements
117
- {
118
- type: "code_removed",
119
- file: "src/auth.ts",
120
- pattern: "console\\.log\\("
121
- }
122
-
123
- // Remove debug flags
124
- {
125
- type: "code_removed",
126
- file: "src/config.ts",
127
- pattern: "DEBUG\\s*=\\s*true"
128
- }
129
-
130
- // Flexible pattern (any whitespace)
131
- {
132
- type: "code_removed",
133
- file: "src/legacy.ts",
134
- pattern: "class\\s+LegacyService"
135
- }
136
- ```
137
-
138
- **Success Criteria:**
139
- - Pattern NOT found in file
140
- - File doesn't exist (pattern is definitely removed!)
141
-
142
- **Failure Cases:**
143
- - Pattern still exists in file
144
- - Cannot read file (permissions error, etc.)
145
-
146
- ---
147
-
148
- ### 3. code_contains
149
-
150
- Verify that a specific code pattern exists in a file.
151
-
152
- **Use Cases:**
153
- - Confirm new function/class added
154
- - Verify import statements added
155
- - Ensure specific logic implemented
156
- - Validate documentation comments added
157
-
158
- **Parameters:**
159
- - `type`: `"code_contains"` (required)
160
- - `file`: Path to file (required)
161
- - `pattern`: Regex pattern that MUST exist (required)
162
-
163
- **Examples:**
164
-
165
- ```typescript
166
- // Verify class exists
167
- {
168
- type: "code_contains",
169
- file: "src/auth.ts",
170
- pattern: "export class AuthService"
171
- }
172
-
173
- // Verify function signature
174
- {
175
- type: "code_contains",
176
- file: "src/api.ts",
177
- pattern: "async function fetchUserData\\("
178
- }
179
-
180
- // Verify import added
181
- {
182
- type: "code_contains",
183
- file: "src/components/Login.tsx",
184
- pattern: "import.*useState.*from 'react'"
185
- }
186
-
187
- // Verify error handling
188
- {
189
- type: "code_contains",
190
- file: "src/database.ts",
191
- pattern: "try\\s*\\{[\\s\\S]*catch\\s*\\("
192
- }
193
-
194
- // Verify JSDoc comment
195
- {
196
- type: "code_contains",
197
- file: "src/utils.ts",
198
- pattern: "/\\*\\*[\\s\\S]*@param[\\s\\S]*\\*/"
199
- }
200
-
201
- // Verify specific value
202
- {
203
- type: "code_contains",
204
- file: "src/config.ts",
205
- pattern: "API_VERSION\\s*=\\s*['\"]v2['\"]"
206
- }
207
- ```
208
-
209
- **Success Criteria:**
210
- - Pattern found in file
211
-
212
- **Failure Cases:**
213
- - Pattern not found in file
214
- - File doesn't exist
215
- - Cannot read file (permissions error, etc.)
216
-
217
- ---
218
-
219
- ### 4. file_exists
220
-
221
- Verify that a file exists.
222
-
223
- **Use Cases:**
224
- - Confirm documentation created
225
- - Verify migration file generated
226
- - Ensure config file exists
227
- - Validate new component created
228
-
229
- **Parameters:**
230
- - `type`: `"file_exists"` (required)
231
- - `file`: Path to file (required)
232
-
233
- **Examples:**
234
-
235
- ```typescript
236
- // Verify documentation created
237
- {
238
- type: "file_exists",
239
- file: "docs/api/authentication.md"
240
- }
241
-
242
- // Verify test file created
243
- {
244
- type: "file_exists",
245
- file: "src/auth.test.ts"
246
- }
247
-
248
- // Verify migration file
249
- {
250
- type: "file_exists",
251
- file: "migrations/001_add_users_table.sql"
252
- }
253
-
254
- // Verify config file
255
- {
256
- type: "file_exists",
257
- file: ".env.production"
258
- }
259
-
260
- // Verify component created
261
- {
262
- type: "file_exists",
263
- file: "src/components/UserProfile.tsx"
264
- }
265
- ```
266
-
267
- **Success Criteria:**
268
- - File exists at specified path
269
-
270
- **Failure Cases:**
271
- - File doesn't exist
272
- - Path is a directory (not a file)
273
-
274
- ---
275
-
276
- ## Combining Check Types
277
-
278
- Use multiple checks to create comprehensive validation:
279
-
280
- ### Example: Complete Feature Implementation
281
-
282
- ```typescript
283
- acceptance_criteria: [
284
- // 1. Verify implementation file created
285
- {
286
- type: "file_exists",
287
- file: "src/features/notifications.ts"
288
- },
289
-
290
- // 2. Verify main class implemented
291
- {
292
- type: "code_contains",
293
- file: "src/features/notifications.ts",
294
- pattern: "export class NotificationService"
295
- },
296
-
297
- // 3. Verify error handling added
298
- {
299
- type: "code_contains",
300
- file: "src/features/notifications.ts",
301
- pattern: "try\\s*\\{[\\s\\S]*catch"
302
- },
303
-
304
- // 4. Verify TODO removed
305
- {
306
- type: "code_removed",
307
- file: "src/features/notifications.ts",
308
- pattern: "// TODO"
309
- },
310
-
311
- // 5. Verify tests created and passing
312
- {
313
- type: "file_exists",
314
- file: "src/features/notifications.test.ts"
315
- },
316
- {
317
- type: "tests_pass",
318
- command: "npm test -- notifications.test.ts",
319
- expected_pattern: "passing"
320
- },
321
-
322
- // 6. Verify documentation created
323
- {
324
- type: "file_exists",
325
- file: "docs/features/notifications.md"
326
- }
327
- ]
328
- ```
329
-
330
- ### Example: Bug Fix Validation
331
-
332
- ```typescript
333
- acceptance_criteria: [
334
- // 1. Verify bug fix code added
335
- {
336
- type: "code_contains",
337
- file: "src/utils/validation.ts",
338
- pattern: "if \\(!input\\) return false"
339
- },
340
-
341
- // 2. Verify debug logging removed
342
- {
343
- type: "code_removed",
344
- file: "src/utils/validation.ts",
345
- pattern: "console\\.log"
346
- },
347
-
348
- // 3. Verify tests pass
349
- {
350
- type: "tests_pass",
351
- command: "npm test -- validation.test.ts",
352
- expected_pattern: "0 failing"
353
- },
354
-
355
- // 4. Verify no regressions
356
- {
357
- type: "tests_pass",
358
- command: "npm test",
359
- expected_pattern: "0 failing"
360
- }
361
- ]
362
- ```
363
-
364
- ### Example: Refactoring Validation
365
-
366
- ```typescript
367
- acceptance_criteria: [
368
- // 1. Verify old code removed
369
- {
370
- type: "code_removed",
371
- file: "src/api/legacy.ts",
372
- pattern: "function oldImplementation"
373
- },
374
-
375
- // 2. Verify new code added
376
- {
377
- type: "code_contains",
378
- file: "src/api/modern.ts",
379
- pattern: "async function newImplementation"
380
- },
381
-
382
- // 3. Verify imports updated
383
- {
384
- type: "code_removed",
385
- file: "src/index.ts",
386
- pattern: "import.*oldImplementation"
387
- },
388
- {
389
- type: "code_contains",
390
- file: "src/index.ts",
391
- pattern: "import.*newImplementation"
392
- },
393
-
394
- // 4. Verify all tests still pass
395
- {
396
- type: "tests_pass",
397
- command: "npm test",
398
- expected_pattern: "0 failing"
399
- }
400
- ]
401
- ```
402
-
403
- ## Advanced Patterns
404
-
405
- ### Regex Best Practices
406
-
407
- **Escape Special Characters:**
408
- ```typescript
409
- // GOOD: Escaped dots, parentheses, brackets
410
- pattern: "function\\s+getData\\(\\)"
411
-
412
- // BAD: Unescaped special characters
413
- pattern: "function getData()" // ❌ Matches "function.getData."
414
- ```
415
-
416
- **Use Non-Greedy Quantifiers:**
417
- ```typescript
418
- // GOOD: Non-greedy (matches minimal text)
419
- pattern: "class\\s+\\w+?\\s*\\{"
420
-
421
- // BAD: Greedy (matches too much text)
422
- pattern: "class.*\\{" // ❌ May match multiple classes
423
- ```
424
-
425
- **Flexible Whitespace:**
426
- ```typescript
427
- // GOOD: Flexible whitespace
428
- pattern: "if\\s*\\(\\s*condition\\s*\\)"
429
-
430
- // BAD: Fixed whitespace
431
- pattern: "if \\( condition \\)" // ❌ Won't match "if(condition)"
432
- ```
433
-
434
- **Case Sensitivity:**
435
- ```typescript
436
- // Case-insensitive matching
437
- pattern: "(?i)todo" // Matches "TODO", "Todo", "todo"
438
-
439
- // Case-sensitive (default)
440
- pattern: "TODO" // Only matches "TODO"
441
- ```
442
-
443
- ### Complex Validation Scenarios
444
-
445
- **Verify Multi-Line Code Blocks:**
446
- ```typescript
447
- {
448
- type: "code_contains",
449
- file: "src/api.ts",
450
- pattern: "try\\s*\\{[\\s\\S]*?fetch\\([\\s\\S]*?\\}\\s*catch"
451
- }
452
- ```
453
-
454
- **Verify Function with Specific Parameters:**
455
- ```typescript
456
- {
457
- type: "code_contains",
458
- file: "src/utils.ts",
459
- pattern: "function\\s+formatDate\\s*\\(\\s*date:\\s*Date\\s*,\\s*format:\\s*string\\s*\\)"
460
- }
461
- ```
462
-
463
- **Verify Specific Version Number:**
464
- ```typescript
465
- {
466
- type: "code_contains",
467
- file: "package.json",
468
- pattern: "\"version\":\\s*\"2\\.0\\.0\""
469
- }
470
- ```
471
-
472
- **Verify No Unused Imports:**
473
- ```typescript
474
- {
475
- type: "tests_pass",
476
- command: "npx eslint src/ --rule 'no-unused-vars: error'",
477
- expected_pattern: "0 errors"
478
- }
479
- ```
480
-
481
- ## Error Handling
482
-
483
- ### Timeout Errors
484
-
485
- ```typescript
486
- // Increase timeout for slow commands
487
- {
488
- type: "tests_pass",
489
- command: "npm run integration-tests",
490
- timeout: 600 // 10 minutes
491
- }
492
- ```
493
-
494
- ### Pattern Matching Failures
495
-
496
- ```typescript
497
- // Use more flexible patterns
498
- {
499
- type: "code_contains",
500
- file: "src/api.ts",
501
- // Before: pattern: "export class ApiService {" (too strict)
502
- // After: pattern: "export\\s+class\\s+ApiService" (flexible)
503
- pattern: "export\\s+class\\s+ApiService"
504
- }
505
- ```
506
-
507
- ### File Not Found Errors
508
-
509
- ```typescript
510
- // Use absolute paths or verify files exist first
511
- {
512
- type: "file_exists",
513
- file: "/absolute/path/to/file.ts" // More reliable
514
- }
515
- ```
516
-
517
- ## Best Practices
518
-
519
- ### 1. Start Simple, Add Complexity
520
-
521
- ```typescript
522
- // Start with basic checks
523
- acceptance_criteria: [
524
- {type: "tests_pass", command: "npm test"}
525
- ]
526
-
527
- // Add specific validations as needed
528
- acceptance_criteria: [
529
- {type: "tests_pass", command: "npm test", expected_pattern: "passing"},
530
- {type: "code_contains", file: "src/feature.ts", pattern: "export class"}
531
- ]
532
- ```
533
-
534
- ### 2. Order Checks by Speed
535
-
536
- ```typescript
537
- // Fast checks first (fail fast)
538
- acceptance_criteria: [
539
- {type: "file_exists", file: "src/feature.ts"}, // Instant
540
- {type: "code_contains", file: "src/feature.ts", pattern: "export"}, // Fast
541
- {type: "tests_pass", command: "npm test"} // Slowest
542
- ]
543
- ```
544
-
545
- ### 3. Use Descriptive Patterns
546
-
547
- ```typescript
548
- // GOOD: Clear, specific patterns
549
- {type: "code_contains", file: "src/auth.ts", pattern: "export class AuthService"}
550
-
551
- // BAD: Vague patterns
552
- {type: "code_contains", file: "src/auth.ts", pattern: "class"} // Too broad
553
- ```
554
-
555
- ### 4. Test Patterns Manually
556
-
557
- Before using patterns in acceptance criteria, test them manually:
558
-
559
- ```bash
560
- # Test regex pattern
561
- grep -P "export\\s+class\\s+AuthService" src/auth.ts
562
-
563
- # Test command output
564
- npm test | grep -P "passing"
565
- ```
566
-
567
- ### 5. Handle Edge Cases
568
-
569
- ```typescript
570
- // Handle optional whitespace, different quote styles
571
- {
572
- type: "code_contains",
573
- file: "src/config.ts",
574
- pattern: "API_KEY\\s*=\\s*['\"][^'\"]+['\"]" // Matches both ' and "
575
- }
576
- ```
577
-
578
- ## Debugging Acceptance Criteria
579
-
580
- ### Enable Detailed Logging
581
-
582
- Check MCP server console output for detailed check results:
583
-
584
- ```
585
- 🔍 Checking acceptance criteria for task #123...
586
- ✓ Check 1: Command succeeded and output matches pattern "passing"
587
- Details: ✔ 5 tests passing (50ms)
588
- ✗ Check 2: Pattern "export class AuthService" not found in "src/auth.ts"
589
- ⏳ Task #123: 1/2 checks failed, staying in_progress
590
- ```
591
-
592
- ### Manual Validation
593
-
594
- Run checks manually to debug failures:
595
-
596
- ```bash
597
- # Test command execution
598
- npm test -- auth.test.ts
599
-
600
- # Test file patterns
601
- grep -P "export class AuthService" src/auth.ts
602
-
603
- # Test file existence
604
- ls -la src/auth.ts
605
- ```
606
-
607
- ### Common Issues
608
-
609
- **Issue: Pattern not matching despite code being present**
610
- - **Solution**: Check for whitespace differences, use `\\s*` for flexible whitespace
611
- - **Solution**: Escape special regex characters: `.`, `(`, `)`, `[`, `]`, `{`, `}`, `*`, `+`, `?`
612
-
613
- **Issue: Tests passing locally but failing in acceptance criteria**
614
- - **Solution**: Check working directory (chokidar runs from project root)
615
- - **Solution**: Use absolute paths in test commands
616
-
617
- **Issue: Timeout errors on CI/CD**
618
- - **Solution**: Increase timeout: `{timeout: 300}`
619
- - **Solution**: Run tests in parallel: `npm test -- --maxWorkers=4`
620
-
621
- ## See Also
622
-
623
- - [AUTO_FILE_TRACKING.md](./AUTO_FILE_TRACKING.md) - Overview and setup
624
- - [WORKFLOWS.md](./WORKFLOWS.md) - Multi-step validation workflows
625
- - [BEST_PRACTICES.md](./BEST_PRACTICES.md) - Common patterns and anti-patterns