@anhth2/spec-driven-dev-plugin 0.5.0 → 0.7.0

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 (76) hide show
  1. package/ARCHITECTURE.md +1 -1
  2. package/bin/index.js +184 -15
  3. package/commands/debug.md +196 -10
  4. package/commands/debug.tmpl +170 -6
  5. package/commands/define-product.md +31 -5
  6. package/commands/define-product.tmpl +5 -1
  7. package/commands/fix-bug.md +74 -10
  8. package/commands/fix-bug.tmpl +48 -6
  9. package/commands/generate-bdd.md +49 -8
  10. package/commands/generate-bdd.tmpl +23 -4
  11. package/commands/generate-code.md +109 -18
  12. package/commands/generate-code.tmpl +83 -14
  13. package/commands/generate-prd.md +33 -6
  14. package/commands/generate-prd.tmpl +7 -2
  15. package/commands/generate-tech-docs.md +85 -8
  16. package/commands/generate-tech-docs.tmpl +59 -4
  17. package/commands/generate-tests.md +454 -36
  18. package/commands/generate-tests.tmpl +428 -32
  19. package/commands/refine-prd.md +39 -7
  20. package/commands/refine-prd.tmpl +13 -3
  21. package/commands/review-code.md +57 -5
  22. package/commands/review-code.tmpl +31 -1
  23. package/commands/review-context.md +41 -11
  24. package/commands/review-context.tmpl +15 -7
  25. package/commands/review-tech-docs.md +39 -8
  26. package/commands/review-tech-docs.tmpl +13 -4
  27. package/commands/run-tests.md +159 -17
  28. package/commands/run-tests.tmpl +133 -13
  29. package/commands/setup-ai-first.md +85 -9
  30. package/commands/setup-ai-first.tmpl +30 -8
  31. package/commands/smoke-test.md +191 -21
  32. package/commands/smoke-test.tmpl +165 -17
  33. package/commands/validate-traces.md +40 -7
  34. package/commands/validate-traces.tmpl +14 -3
  35. package/core/FRAMEWORK_VERSION +1 -1
  36. package/core/commands/debug.md +196 -10
  37. package/core/commands/define-product.md +31 -5
  38. package/core/commands/fix-bug.md +74 -10
  39. package/core/commands/generate-bdd.md +49 -8
  40. package/core/commands/generate-code.md +109 -18
  41. package/core/commands/generate-prd.md +33 -6
  42. package/core/commands/generate-tech-docs.md +85 -8
  43. package/core/commands/generate-tests.md +454 -36
  44. package/core/commands/refine-prd.md +39 -7
  45. package/core/commands/review-code.md +57 -5
  46. package/core/commands/review-context.md +41 -11
  47. package/core/commands/review-tech-docs.md +39 -8
  48. package/core/commands/run-tests.md +159 -17
  49. package/core/commands/setup-ai-first.md +85 -9
  50. package/core/commands/smoke-test.md +191 -21
  51. package/core/commands/validate-traces.md +40 -7
  52. package/core/skills/code/SKILL.md +29 -6
  53. package/core/skills/debug/SKILL.md +31 -7
  54. package/core/skills/discovery/SKILL.md +25 -3
  55. package/core/skills/prd/SKILL.md +8 -6
  56. package/core/skills/setup-ai-first/SKILL.md +3 -2
  57. package/core/skills/spec/SKILL.md +7 -5
  58. package/core/skills/test/SKILL.md +54 -9
  59. package/core/steps/context-loader.md +22 -1
  60. package/core/steps/gate.md +1 -1
  61. package/core/steps/report-footer.md +3 -2
  62. package/core/steps/spawn-agent.md +3 -1
  63. package/package.json +1 -1
  64. package/scripts/init.sh +2 -2
  65. package/scripts/upgrade.sh +4 -4
  66. package/skills/code/SKILL.md +29 -6
  67. package/skills/debug/SKILL.md +31 -7
  68. package/skills/discovery/SKILL.md +25 -3
  69. package/skills/prd/SKILL.md +8 -6
  70. package/skills/setup-ai-first/SKILL.md +3 -2
  71. package/skills/spec/SKILL.md +7 -5
  72. package/skills/test/SKILL.md +54 -9
  73. package/steps/context-loader.md +22 -1
  74. package/steps/gate.md +1 -1
  75. package/steps/report-footer.md +3 -2
  76. package/steps/spawn-agent.md +3 -1
@@ -61,7 +61,7 @@ If `paths` section is absent, use these defaults:
61
61
  - `domain_knowledge_dir` = `specs/domain-knowledge`
62
62
  - `business_dictionary` = `specs/domain-knowledge/business-dictionary.md`
63
63
  - `core_entities` = `specs/domain-knowledge/core-entities.md`
64
- - `tech_docs_dir` = `tech-docs`
64
+ - `tech_docs_dir` = `specs/tech-docs`
65
65
  - `trace_dir` = `.trace`
66
66
 
67
67
  If `tech_stack.module` is set, also load `.agent/modules/{module}/stack-profile.yaml` if it exists.
@@ -138,6 +138,26 @@ If the file does not exist → skip silently.
138
138
 
139
139
  ---
140
140
 
141
+ ## Step 6.5 — [PLATFORM] Derive active_module and platform_type
142
+
143
+ Using `tech_stack.module` loaded in Step 1, derive and store two variables for use by all downstream commands:
144
+
145
+ ```
146
+ active_module = tech_stack.module (e.g. "java-spring", "react", "flutter")
147
+ ```
148
+
149
+ | `platform_type` | Modules |
150
+ |---|---|
151
+ | `backend` | `java-spring`, `golang`, `dotnet`, `php-laravel`, `context-engineering` |
152
+ | `web-frontend` | `react`, `nextjs`, `vue`, `nuxt`, `angular` |
153
+ | `mobile` | `flutter`, `react-native`, `ios-swiftui`, `android-compose` |
154
+
155
+ If `tech_stack.module` is blank or not recognized → set `platform_type = "unknown"` and flag as ⚠️ in the Step 7 recap.
156
+
157
+ These two variables (`active_module`, `platform_type`) are the canonical source for all branching logic in commands that need platform-specific behavior (generate-tests, debug, fix-bug, smoke-test).
158
+
159
+ ---
160
+
141
161
  ## Step 7 — [RECAP] Working Memory Recap (anti-lost-in-middle)
142
162
 
143
163
  After loading all context, synthesize and output a compact summary block.
@@ -148,6 +168,7 @@ Output exactly this block:
148
168
  ```
149
169
  [CTX LOADED]
150
170
  Stack : {language} / {framework} / {database}
171
+ Platform : {active_module} ({platform_type})
151
172
  Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Service → Repository}
152
173
  Ticket : {ticket_prefix}-
153
174
  Dict : {loaded — N canonical terms, M banned terms | missing}
@@ -335,6 +356,7 @@ Suggest the logical next command based on workflow phase:
335
356
 
336
357
  | Current command | Suggest next |
337
358
  |-------------------------|-----------------------------------------------|
359
+ | /setup-ai-first | `/define-product` to start your first feature |
338
360
  | /define-product | `/generate-prd {product-definition-file}` |
339
361
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
340
362
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
@@ -343,13 +365,13 @@ Suggest the logical next command based on workflow phase:
343
365
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
344
366
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
345
367
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
346
- | /generate-code | `/generate-tests {UC-ID}` |
368
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
347
369
  | /generate-tests | `/run-tests {UC-ID}` |
348
370
  | /run-tests (passing) | `/review-code {UC-ID}` |
349
371
  | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
350
372
  | /review-code | `/smoke-test {UC-ID}` or create PR |
351
373
  | /smoke-test | Create PR and link to ticket |
352
- | /validate-traces | `/generate-code {UC-ID}` for gaps |
374
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
353
375
  | /fix-bug | Create PR and link to ticket |
354
376
  | /debug | `/fix-bug {ticket-id}` if fix needed |
355
377
 
@@ -43,7 +43,7 @@ Display and wait for response:
43
43
  ```
44
44
  ⚙️ MODEL CHECK
45
45
  ──────────────────────────────────────────────────────────────────
46
- Recommended : claude-opus-4-5 (or claude-opus-4)
46
+ Recommended : claude-opus-4 (or latest Opus model)
47
47
  Why needed : Spec analysis, architecture review, code generation
48
48
  require deep reasoning. Smaller models miss edge cases.
49
49
 
@@ -186,6 +186,7 @@ Suggest the logical next command based on workflow phase:
186
186
 
187
187
  | Current command | Suggest next |
188
188
  |-------------------------|-----------------------------------------------|
189
+ | /setup-ai-first | `/define-product` to start your first feature |
189
190
  | /define-product | `/generate-prd {product-definition-file}` |
190
191
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
191
192
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
@@ -194,13 +195,13 @@ Suggest the logical next command based on workflow phase:
194
195
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
195
196
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
196
197
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
197
- | /generate-code | `/generate-tests {UC-ID}` |
198
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
198
199
  | /generate-tests | `/run-tests {UC-ID}` |
199
200
  | /run-tests (passing) | `/review-code {UC-ID}` |
200
201
  | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
201
202
  | /review-code | `/smoke-test {UC-ID}` or create PR |
202
203
  | /smoke-test | Create PR and link to ticket |
203
- | /validate-traces | `/generate-code {UC-ID}` for gaps |
204
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
204
205
  | /fix-bug | Create PR and link to ticket |
205
206
  | /debug | `/fix-bug {ticket-id}` if fix needed |
206
207
 
@@ -252,7 +253,7 @@ Display and wait for response:
252
253
  ```
253
254
  ⚙️ MODEL CHECK
254
255
  ──────────────────────────────────────────────────────────────────
255
- Recommended : claude-opus-4-5 (or claude-opus-4)
256
+ Recommended : claude-opus-4 (or latest Opus model)
256
257
  Why needed : Spec analysis, architecture review, code generation
257
258
  require deep reasoning. Smaller models miss edge cases.
258
259
 
@@ -428,6 +429,7 @@ Suggest the logical next command based on workflow phase:
428
429
 
429
430
  | Current command | Suggest next |
430
431
  |-------------------------|-----------------------------------------------|
432
+ | /setup-ai-first | `/define-product` to start your first feature |
431
433
  | /define-product | `/generate-prd {product-definition-file}` |
432
434
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
433
435
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
@@ -436,13 +438,13 @@ Suggest the logical next command based on workflow phase:
436
438
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
437
439
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
438
440
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
439
- | /generate-code | `/generate-tests {UC-ID}` |
441
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
440
442
  | /generate-tests | `/run-tests {UC-ID}` |
441
443
  | /run-tests (passing) | `/review-code {UC-ID}` |
442
444
  | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
443
445
  | /review-code | `/smoke-test {UC-ID}` or create PR |
444
446
  | /smoke-test | Create PR and link to ticket |
445
- | /validate-traces | `/generate-code {UC-ID}` for gaps |
447
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
446
448
  | /fix-bug | Create PR and link to ticket |
447
449
  | /debug | `/fix-bug {ticket-id}` if fix needed |
448
450
 
@@ -132,6 +132,7 @@ Suggest the logical next command based on workflow phase:
132
132
 
133
133
  | Current command | Suggest next |
134
134
  |-------------------------|-----------------------------------------------|
135
+ | /setup-ai-first | `/define-product` to start your first feature |
135
136
  | /define-product | `/generate-prd {product-definition-file}` |
136
137
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
137
138
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
@@ -140,13 +141,13 @@ Suggest the logical next command based on workflow phase:
140
141
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
141
142
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
142
143
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
143
- | /generate-code | `/generate-tests {UC-ID}` |
144
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
144
145
  | /generate-tests | `/run-tests {UC-ID}` |
145
146
  | /run-tests (passing) | `/review-code {UC-ID}` |
146
147
  | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
147
148
  | /review-code | `/smoke-test {UC-ID}` or create PR |
148
149
  | /smoke-test | Create PR and link to ticket |
149
- | /validate-traces | `/generate-code {UC-ID}` for gaps |
150
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
150
151
  | /fix-bug | Create PR and link to ticket |
151
152
  | /debug | `/fix-bug {ticket-id}` if fix needed |
152
153
 
@@ -43,7 +43,7 @@ Display and wait for response:
43
43
  ```
44
44
  ⚙️ MODEL CHECK
45
45
  ──────────────────────────────────────────────────────────────────
46
- Recommended : claude-opus-4-5 (or claude-opus-4)
46
+ Recommended : claude-opus-4 (or latest Opus model)
47
47
  Why needed : Spec analysis, architecture review, code generation
48
48
  require deep reasoning. Smaller models miss edge cases.
49
49
 
@@ -203,6 +203,7 @@ Suggest the logical next command based on workflow phase:
203
203
 
204
204
  | Current command | Suggest next |
205
205
  |-------------------------|-----------------------------------------------|
206
+ | /setup-ai-first | `/define-product` to start your first feature |
206
207
  | /define-product | `/generate-prd {product-definition-file}` |
207
208
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
208
209
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
@@ -211,13 +212,13 @@ Suggest the logical next command based on workflow phase:
211
212
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
212
213
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
213
214
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
214
- | /generate-code | `/generate-tests {UC-ID}` |
215
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
215
216
  | /generate-tests | `/run-tests {UC-ID}` |
216
217
  | /run-tests (passing) | `/review-code {UC-ID}` |
217
218
  | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
218
219
  | /review-code | `/smoke-test {UC-ID}` or create PR |
219
220
  | /smoke-test | Create PR and link to ticket |
220
- | /validate-traces | `/generate-code {UC-ID}` for gaps |
221
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
221
222
  | /fix-bug | Create PR and link to ticket |
222
223
  | /debug | `/fix-bug {ticket-id}` if fix needed |
223
224
 
@@ -333,6 +334,7 @@ Suggest the logical next command based on workflow phase:
333
334
 
334
335
  | Current command | Suggest next |
335
336
  |-------------------------|-----------------------------------------------|
337
+ | /setup-ai-first | `/define-product` to start your first feature |
336
338
  | /define-product | `/generate-prd {product-definition-file}` |
337
339
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
338
340
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
@@ -341,13 +343,13 @@ Suggest the logical next command based on workflow phase:
341
343
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
342
344
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
343
345
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
344
- | /generate-code | `/generate-tests {UC-ID}` |
346
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
345
347
  | /generate-tests | `/run-tests {UC-ID}` |
346
348
  | /run-tests (passing) | `/review-code {UC-ID}` |
347
349
  | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
348
350
  | /review-code | `/smoke-test {UC-ID}` or create PR |
349
351
  | /smoke-test | Create PR and link to ticket |
350
- | /validate-traces | `/generate-code {UC-ID}` for gaps |
352
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
351
353
  | /fix-bug | Create PR and link to ticket |
352
354
  | /debug | `/fix-bug {ticket-id}` if fix needed |
353
355
 
@@ -43,7 +43,7 @@ Display and wait for response:
43
43
  ```
44
44
  ⚙️ MODEL CHECK
45
45
  ──────────────────────────────────────────────────────────────────
46
- Recommended : claude-opus-4-5 (or claude-opus-4)
46
+ Recommended : claude-opus-4 (or latest Opus model)
47
47
  Why needed : Spec analysis, architecture review, code generation
48
48
  require deep reasoning. Smaller models miss edge cases.
49
49
 
@@ -246,6 +246,7 @@ Suggest the logical next command based on workflow phase:
246
246
 
247
247
  | Current command | Suggest next |
248
248
  |-------------------------|-----------------------------------------------|
249
+ | /setup-ai-first | `/define-product` to start your first feature |
249
250
  | /define-product | `/generate-prd {product-definition-file}` |
250
251
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
251
252
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
@@ -254,13 +255,13 @@ Suggest the logical next command based on workflow phase:
254
255
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
255
256
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
256
257
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
257
- | /generate-code | `/generate-tests {UC-ID}` |
258
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
258
259
  | /generate-tests | `/run-tests {UC-ID}` |
259
260
  | /run-tests (passing) | `/review-code {UC-ID}` |
260
261
  | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
261
262
  | /review-code | `/smoke-test {UC-ID}` or create PR |
262
263
  | /smoke-test | Create PR and link to ticket |
263
- | /validate-traces | `/generate-code {UC-ID}` for gaps |
264
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
264
265
  | /fix-bug | Create PR and link to ticket |
265
266
  | /debug | `/fix-bug {ticket-id}` if fix needed |
266
267
 
@@ -332,7 +333,7 @@ If `paths` section is absent, use these defaults:
332
333
  - `domain_knowledge_dir` = `specs/domain-knowledge`
333
334
  - `business_dictionary` = `specs/domain-knowledge/business-dictionary.md`
334
335
  - `core_entities` = `specs/domain-knowledge/core-entities.md`
335
- - `tech_docs_dir` = `tech-docs`
336
+ - `tech_docs_dir` = `specs/tech-docs`
336
337
  - `trace_dir` = `.trace`
337
338
 
338
339
  If `tech_stack.module` is set, also load `.agent/modules/{module}/stack-profile.yaml` if it exists.
@@ -409,6 +410,26 @@ If the file does not exist → skip silently.
409
410
 
410
411
  ---
411
412
 
413
+ ## Step 6.5 — [PLATFORM] Derive active_module and platform_type
414
+
415
+ Using `tech_stack.module` loaded in Step 1, derive and store two variables for use by all downstream commands:
416
+
417
+ ```
418
+ active_module = tech_stack.module (e.g. "java-spring", "react", "flutter")
419
+ ```
420
+
421
+ | `platform_type` | Modules |
422
+ |---|---|
423
+ | `backend` | `java-spring`, `golang`, `dotnet`, `php-laravel`, `context-engineering` |
424
+ | `web-frontend` | `react`, `nextjs`, `vue`, `nuxt`, `angular` |
425
+ | `mobile` | `flutter`, `react-native`, `ios-swiftui`, `android-compose` |
426
+
427
+ If `tech_stack.module` is blank or not recognized → set `platform_type = "unknown"` and flag as ⚠️ in the Step 7 recap.
428
+
429
+ These two variables (`active_module`, `platform_type`) are the canonical source for all branching logic in commands that need platform-specific behavior (generate-tests, debug, fix-bug, smoke-test).
430
+
431
+ ---
432
+
412
433
  ## Step 7 — [RECAP] Working Memory Recap (anti-lost-in-middle)
413
434
 
414
435
  After loading all context, synthesize and output a compact summary block.
@@ -419,6 +440,7 @@ Output exactly this block:
419
440
  ```
420
441
  [CTX LOADED]
421
442
  Stack : {language} / {framework} / {database}
443
+ Platform : {active_module} ({platform_type})
422
444
  Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Service → Repository}
423
445
  Ticket : {ticket_prefix}-
424
446
  Dict : {loaded — N canonical terms, M banned terms | missing}
@@ -531,6 +553,7 @@ Suggest the logical next command based on workflow phase:
531
553
 
532
554
  | Current command | Suggest next |
533
555
  |-------------------------|-----------------------------------------------|
556
+ | /setup-ai-first | `/define-product` to start your first feature |
534
557
  | /define-product | `/generate-prd {product-definition-file}` |
535
558
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
536
559
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
@@ -539,13 +562,13 @@ Suggest the logical next command based on workflow phase:
539
562
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
540
563
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
541
564
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
542
- | /generate-code | `/generate-tests {UC-ID}` |
565
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
543
566
  | /generate-tests | `/run-tests {UC-ID}` |
544
567
  | /run-tests (passing) | `/review-code {UC-ID}` |
545
568
  | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
546
569
  | /review-code | `/smoke-test {UC-ID}` or create PR |
547
570
  | /smoke-test | Create PR and link to ticket |
548
- | /validate-traces | `/generate-code {UC-ID}` for gaps |
571
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
549
572
  | /fix-bug | Create PR and link to ticket |
550
573
  | /debug | `/fix-bug {ticket-id}` if fix needed |
551
574
 
@@ -620,7 +643,7 @@ If `paths` section is absent, use these defaults:
620
643
  - `domain_knowledge_dir` = `specs/domain-knowledge`
621
644
  - `business_dictionary` = `specs/domain-knowledge/business-dictionary.md`
622
645
  - `core_entities` = `specs/domain-knowledge/core-entities.md`
623
- - `tech_docs_dir` = `tech-docs`
646
+ - `tech_docs_dir` = `specs/tech-docs`
624
647
  - `trace_dir` = `.trace`
625
648
 
626
649
  If `tech_stack.module` is set, also load `.agent/modules/{module}/stack-profile.yaml` if it exists.
@@ -697,6 +720,26 @@ If the file does not exist → skip silently.
697
720
 
698
721
  ---
699
722
 
723
+ ## Step 6.5 — [PLATFORM] Derive active_module and platform_type
724
+
725
+ Using `tech_stack.module` loaded in Step 1, derive and store two variables for use by all downstream commands:
726
+
727
+ ```
728
+ active_module = tech_stack.module (e.g. "java-spring", "react", "flutter")
729
+ ```
730
+
731
+ | `platform_type` | Modules |
732
+ |---|---|
733
+ | `backend` | `java-spring`, `golang`, `dotnet`, `php-laravel`, `context-engineering` |
734
+ | `web-frontend` | `react`, `nextjs`, `vue`, `nuxt`, `angular` |
735
+ | `mobile` | `flutter`, `react-native`, `ios-swiftui`, `android-compose` |
736
+
737
+ If `tech_stack.module` is blank or not recognized → set `platform_type = "unknown"` and flag as ⚠️ in the Step 7 recap.
738
+
739
+ These two variables (`active_module`, `platform_type`) are the canonical source for all branching logic in commands that need platform-specific behavior (generate-tests, debug, fix-bug, smoke-test).
740
+
741
+ ---
742
+
700
743
  ## Step 7 — [RECAP] Working Memory Recap (anti-lost-in-middle)
701
744
 
702
745
  After loading all context, synthesize and output a compact summary block.
@@ -707,6 +750,7 @@ Output exactly this block:
707
750
  ```
708
751
  [CTX LOADED]
709
752
  Stack : {language} / {framework} / {database}
753
+ Platform : {active_module} ({platform_type})
710
754
  Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Service → Repository}
711
755
  Ticket : {ticket_prefix}-
712
756
  Dict : {loaded — N canonical terms, M banned terms | missing}
@@ -834,6 +878,7 @@ Suggest the logical next command based on workflow phase:
834
878
 
835
879
  | Current command | Suggest next |
836
880
  |-------------------------|-----------------------------------------------|
881
+ | /setup-ai-first | `/define-product` to start your first feature |
837
882
  | /define-product | `/generate-prd {product-definition-file}` |
838
883
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
839
884
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
@@ -842,13 +887,13 @@ Suggest the logical next command based on workflow phase:
842
887
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
843
888
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
844
889
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
845
- | /generate-code | `/generate-tests {UC-ID}` |
890
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
846
891
  | /generate-tests | `/run-tests {UC-ID}` |
847
892
  | /run-tests (passing) | `/review-code {UC-ID}` |
848
893
  | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
849
894
  | /review-code | `/smoke-test {UC-ID}` or create PR |
850
895
  | /smoke-test | Create PR and link to ticket |
851
- | /validate-traces | `/generate-code {UC-ID}` for gaps |
896
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
852
897
  | /fix-bug | Create PR and link to ticket |
853
898
  | /debug | `/fix-bug {ticket-id}` if fix needed |
854
899
 
@@ -51,7 +51,7 @@ If `paths` section is absent, use these defaults:
51
51
  - `domain_knowledge_dir` = `specs/domain-knowledge`
52
52
  - `business_dictionary` = `specs/domain-knowledge/business-dictionary.md`
53
53
  - `core_entities` = `specs/domain-knowledge/core-entities.md`
54
- - `tech_docs_dir` = `tech-docs`
54
+ - `tech_docs_dir` = `specs/tech-docs`
55
55
  - `trace_dir` = `.trace`
56
56
 
57
57
  If `tech_stack.module` is set, also load `.agent/modules/{module}/stack-profile.yaml` if it exists.
@@ -128,6 +128,26 @@ If the file does not exist → skip silently.
128
128
 
129
129
  ---
130
130
 
131
+ ## Step 6.5 — [PLATFORM] Derive active_module and platform_type
132
+
133
+ Using `tech_stack.module` loaded in Step 1, derive and store two variables for use by all downstream commands:
134
+
135
+ ```
136
+ active_module = tech_stack.module (e.g. "java-spring", "react", "flutter")
137
+ ```
138
+
139
+ | `platform_type` | Modules |
140
+ |---|---|
141
+ | `backend` | `java-spring`, `golang`, `dotnet`, `php-laravel`, `context-engineering` |
142
+ | `web-frontend` | `react`, `nextjs`, `vue`, `nuxt`, `angular` |
143
+ | `mobile` | `flutter`, `react-native`, `ios-swiftui`, `android-compose` |
144
+
145
+ If `tech_stack.module` is blank or not recognized → set `platform_type = "unknown"` and flag as ⚠️ in the Step 7 recap.
146
+
147
+ These two variables (`active_module`, `platform_type`) are the canonical source for all branching logic in commands that need platform-specific behavior (generate-tests, debug, fix-bug, smoke-test).
148
+
149
+ ---
150
+
131
151
  ## Step 7 — [RECAP] Working Memory Recap (anti-lost-in-middle)
132
152
 
133
153
  After loading all context, synthesize and output a compact summary block.
@@ -138,6 +158,7 @@ Output exactly this block:
138
158
  ```
139
159
  [CTX LOADED]
140
160
  Stack : {language} / {framework} / {database}
161
+ Platform : {active_module} ({platform_type})
141
162
  Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Service → Repository}
142
163
  Ticket : {ticket_prefix}-
143
164
  Dict : {loaded — N canonical terms, M banned terms | missing}
@@ -28,7 +28,7 @@ Display and wait for response:
28
28
  ```
29
29
  ⚙️ MODEL CHECK
30
30
  ──────────────────────────────────────────────────────────────────
31
- Recommended : claude-opus-4-5 (or claude-opus-4)
31
+ Recommended : claude-opus-4 (or latest Opus model)
32
32
  Why needed : Spec analysis, architecture review, code generation
33
33
  require deep reasoning. Smaller models miss edge cases.
34
34
 
@@ -26,6 +26,7 @@ Suggest the logical next command based on workflow phase:
26
26
 
27
27
  | Current command | Suggest next |
28
28
  |-------------------------|-----------------------------------------------|
29
+ | /setup-ai-first | `/define-product` to start your first feature |
29
30
  | /define-product | `/generate-prd {product-definition-file}` |
30
31
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
31
32
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
@@ -34,13 +35,13 @@ Suggest the logical next command based on workflow phase:
34
35
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
35
36
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
36
37
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
37
- | /generate-code | `/generate-tests {UC-ID}` |
38
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
38
39
  | /generate-tests | `/run-tests {UC-ID}` |
39
40
  | /run-tests (passing) | `/review-code {UC-ID}` |
40
41
  | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
41
42
  | /review-code | `/smoke-test {UC-ID}` or create PR |
42
43
  | /smoke-test | Create PR and link to ticket |
43
- | /validate-traces | `/generate-code {UC-ID}` for gaps |
44
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
44
45
  | /fix-bug | Create PR and link to ticket |
45
46
  | /debug | `/fix-bug {ticket-id}` if fix needed |
46
47
 
@@ -72,7 +72,7 @@ Build payload and invoke Agent tool for each UC:
72
72
  ```json
73
73
  {
74
74
  "_agent_mode": true,
75
- "command": "{generate-bdd | generate-code | generate-tests}",
75
+ "command": "generate-bdd",
76
76
  "uc_id": "{TICKET-ID}-UC{N}",
77
77
  "target_file": "{absolute path to PRD or feature file}",
78
78
  "uc_section": { "line_start": {N}, "line_end": {N} },
@@ -80,6 +80,8 @@ Build payload and invoke Agent tool for each UC:
80
80
  }
81
81
  ```
82
82
 
83
+ > **Command scope**: Only `/generate-bdd` initiates orchestration mode. `/generate-code` and `/generate-tests` can run as sub-agents (they respect `_agent_mode: true` from Gate Step 0), but they do not spawn further sub-agents — their scope is already a single UC.
84
+
83
85
  Serialize this JSON and pass as `$ARGUMENTS` when invoking the sub-agent command.
84
86
 
85
87
  ### Step E — Collect and merge results
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anhth2/spec-driven-dev-plugin",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "description": "AI-First Spec-Driven Development workflow plugin for Claude Code",
5
5
  "bin": {
6
6
  "spec-driven-dev": "./bin/index.js"
package/scripts/init.sh CHANGED
@@ -33,10 +33,10 @@ fi
33
33
 
34
34
  # ── Run installer via npx ─────────────────────────────────────────────────────
35
35
 
36
- echo "Running: npx @anhth2/spec-driven-dev --init $*"
36
+ echo "Running: npx @anhth2/spec-driven-dev-plugin --init $*"
37
37
  echo ""
38
38
 
39
- npx -y @anhth2/spec-driven-dev --init "$@"
39
+ npx -y @anhth2/spec-driven-dev-plugin --init "$@"
40
40
 
41
41
  echo ""
42
42
  echo "✅ Init complete!"
@@ -8,7 +8,7 @@
8
8
  # What it does:
9
9
  # 1. Reads current installed version from .agent/FRAMEWORK_VERSION
10
10
  # 2. Checks npm registry for the latest published version
11
- # 3. If newer: runs npx @anhth2/spec-driven-dev@latest --init to update .agent/
11
+ # 3. If newer: runs npx @anhth2/spec-driven-dev-plugin@latest --init to update .agent/
12
12
  # 4. Reports what changed so you can review before committing
13
13
  #
14
14
  # Requirements:
@@ -46,7 +46,7 @@ if [ ! -f "$VERSION_FILE" ]; then
46
46
  echo ""
47
47
  echo " bash scripts/init.sh"
48
48
  echo " or:"
49
- echo " npx @anhth2/spec-driven-dev --init"
49
+ echo " npx @anhth2/spec-driven-dev-plugin --init"
50
50
  echo ""
51
51
  exit 1
52
52
  fi
@@ -56,7 +56,7 @@ fi
56
56
  CURRENT=$(cat "$VERSION_FILE" | tr -d '[:space:]')
57
57
  echo "Checking npm registry ..."
58
58
 
59
- LATEST=$(npm view @anhth2/spec-driven-dev version 2>/dev/null || echo "unknown")
59
+ LATEST=$(npm view @anhth2/spec-driven-dev-plugin version 2>/dev/null || echo "unknown")
60
60
 
61
61
  echo ""
62
62
  echo " Installed : v${CURRENT}"
@@ -79,7 +79,7 @@ fi
79
79
  echo "Upgrading v${CURRENT} → v${LATEST} ..."
80
80
  echo ""
81
81
 
82
- npx -y @anhth2/spec-driven-dev@latest --init "$@"
82
+ npx -y @anhth2/spec-driven-dev-plugin@latest --init "$@"
83
83
 
84
84
  # ── Post-upgrade guidance ─────────────────────────────────────────────────────
85
85
 
@@ -43,7 +43,7 @@ Display and wait for response:
43
43
  ```
44
44
  ⚙️ MODEL CHECK
45
45
  ──────────────────────────────────────────────────────────────────
46
- Recommended : claude-opus-4-5 (or claude-opus-4)
46
+ Recommended : claude-opus-4 (or latest Opus model)
47
47
  Why needed : Spec analysis, architecture review, code generation
48
48
  require deep reasoning. Smaller models miss edge cases.
49
49
 
@@ -167,7 +167,7 @@ If `paths` section is absent, use these defaults:
167
167
  - `domain_knowledge_dir` = `specs/domain-knowledge`
168
168
  - `business_dictionary` = `specs/domain-knowledge/business-dictionary.md`
169
169
  - `core_entities` = `specs/domain-knowledge/core-entities.md`
170
- - `tech_docs_dir` = `tech-docs`
170
+ - `tech_docs_dir` = `specs/tech-docs`
171
171
  - `trace_dir` = `.trace`
172
172
 
173
173
  If `tech_stack.module` is set, also load `.agent/modules/{module}/stack-profile.yaml` if it exists.
@@ -244,6 +244,26 @@ If the file does not exist → skip silently.
244
244
 
245
245
  ---
246
246
 
247
+ ## Step 6.5 — [PLATFORM] Derive active_module and platform_type
248
+
249
+ Using `tech_stack.module` loaded in Step 1, derive and store two variables for use by all downstream commands:
250
+
251
+ ```
252
+ active_module = tech_stack.module (e.g. "java-spring", "react", "flutter")
253
+ ```
254
+
255
+ | `platform_type` | Modules |
256
+ |---|---|
257
+ | `backend` | `java-spring`, `golang`, `dotnet`, `php-laravel`, `context-engineering` |
258
+ | `web-frontend` | `react`, `nextjs`, `vue`, `nuxt`, `angular` |
259
+ | `mobile` | `flutter`, `react-native`, `ios-swiftui`, `android-compose` |
260
+
261
+ If `tech_stack.module` is blank or not recognized → set `platform_type = "unknown"` and flag as ⚠️ in the Step 7 recap.
262
+
263
+ These two variables (`active_module`, `platform_type`) are the canonical source for all branching logic in commands that need platform-specific behavior (generate-tests, debug, fix-bug, smoke-test).
264
+
265
+ ---
266
+
247
267
  ## Step 7 — [RECAP] Working Memory Recap (anti-lost-in-middle)
248
268
 
249
269
  After loading all context, synthesize and output a compact summary block.
@@ -254,6 +274,7 @@ Output exactly this block:
254
274
  ```
255
275
  [CTX LOADED]
256
276
  Stack : {language} / {framework} / {database}
277
+ Platform : {active_module} ({platform_type})
257
278
  Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Service → Repository}
258
279
  Ticket : {ticket_prefix}-
259
280
  Dict : {loaded — N canonical terms, M banned terms | missing}
@@ -387,6 +408,7 @@ Suggest the logical next command based on workflow phase:
387
408
 
388
409
  | Current command | Suggest next |
389
410
  |-------------------------|-----------------------------------------------|
411
+ | /setup-ai-first | `/define-product` to start your first feature |
390
412
  | /define-product | `/generate-prd {product-definition-file}` |
391
413
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
392
414
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
@@ -395,13 +417,13 @@ Suggest the logical next command based on workflow phase:
395
417
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
396
418
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
397
419
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
398
- | /generate-code | `/generate-tests {UC-ID}` |
420
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
399
421
  | /generate-tests | `/run-tests {UC-ID}` |
400
422
  | /run-tests (passing) | `/review-code {UC-ID}` |
401
423
  | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
402
424
  | /review-code | `/smoke-test {UC-ID}` or create PR |
403
425
  | /smoke-test | Create PR and link to ticket |
404
- | /validate-traces | `/generate-code {UC-ID}` for gaps |
426
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
405
427
  | /fix-bug | Create PR and link to ticket |
406
428
  | /debug | `/fix-bug {ticket-id}` if fix needed |
407
429
 
@@ -498,6 +520,7 @@ Suggest the logical next command based on workflow phase:
498
520
 
499
521
  | Current command | Suggest next |
500
522
  |-------------------------|-----------------------------------------------|
523
+ | /setup-ai-first | `/define-product` to start your first feature |
501
524
  | /define-product | `/generate-prd {product-definition-file}` |
502
525
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
503
526
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
@@ -506,13 +529,13 @@ Suggest the logical next command based on workflow phase:
506
529
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
507
530
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
508
531
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
509
- | /generate-code | `/generate-tests {UC-ID}` |
532
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
510
533
  | /generate-tests | `/run-tests {UC-ID}` |
511
534
  | /run-tests (passing) | `/review-code {UC-ID}` |
512
535
  | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
513
536
  | /review-code | `/smoke-test {UC-ID}` or create PR |
514
537
  | /smoke-test | Create PR and link to ticket |
515
- | /validate-traces | `/generate-code {UC-ID}` for gaps |
538
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
516
539
  | /fix-bug | Create PR and link to ticket |
517
540
  | /debug | `/fix-bug {ticket-id}` if fix needed |
518
541