@anhth2/spec-driven-dev-plugin 0.6.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 (73) hide show
  1. package/bin/index.js +180 -11
  2. package/commands/debug.md +196 -10
  3. package/commands/debug.tmpl +170 -6
  4. package/commands/define-product.md +31 -5
  5. package/commands/define-product.tmpl +5 -1
  6. package/commands/fix-bug.md +74 -10
  7. package/commands/fix-bug.tmpl +48 -6
  8. package/commands/generate-bdd.md +49 -8
  9. package/commands/generate-bdd.tmpl +23 -4
  10. package/commands/generate-code.md +109 -18
  11. package/commands/generate-code.tmpl +83 -14
  12. package/commands/generate-prd.md +33 -6
  13. package/commands/generate-prd.tmpl +7 -2
  14. package/commands/generate-tech-docs.md +85 -8
  15. package/commands/generate-tech-docs.tmpl +59 -4
  16. package/commands/generate-tests.md +454 -36
  17. package/commands/generate-tests.tmpl +428 -32
  18. package/commands/refine-prd.md +39 -7
  19. package/commands/refine-prd.tmpl +13 -3
  20. package/commands/review-code.md +57 -5
  21. package/commands/review-code.tmpl +31 -1
  22. package/commands/review-context.md +41 -11
  23. package/commands/review-context.tmpl +15 -7
  24. package/commands/review-tech-docs.md +39 -8
  25. package/commands/review-tech-docs.tmpl +13 -4
  26. package/commands/run-tests.md +159 -17
  27. package/commands/run-tests.tmpl +133 -13
  28. package/commands/setup-ai-first.md +61 -3
  29. package/commands/setup-ai-first.tmpl +6 -2
  30. package/commands/smoke-test.md +191 -21
  31. package/commands/smoke-test.tmpl +165 -17
  32. package/commands/validate-traces.md +40 -7
  33. package/commands/validate-traces.tmpl +14 -3
  34. package/core/FRAMEWORK_VERSION +1 -1
  35. package/core/commands/debug.md +196 -10
  36. package/core/commands/define-product.md +31 -5
  37. package/core/commands/fix-bug.md +74 -10
  38. package/core/commands/generate-bdd.md +49 -8
  39. package/core/commands/generate-code.md +109 -18
  40. package/core/commands/generate-prd.md +33 -6
  41. package/core/commands/generate-tech-docs.md +85 -8
  42. package/core/commands/generate-tests.md +454 -36
  43. package/core/commands/refine-prd.md +39 -7
  44. package/core/commands/review-code.md +57 -5
  45. package/core/commands/review-context.md +41 -11
  46. package/core/commands/review-tech-docs.md +39 -8
  47. package/core/commands/run-tests.md +159 -17
  48. package/core/commands/setup-ai-first.md +61 -3
  49. package/core/commands/smoke-test.md +191 -21
  50. package/core/commands/validate-traces.md +40 -7
  51. package/core/skills/code/SKILL.md +29 -6
  52. package/core/skills/debug/SKILL.md +31 -7
  53. package/core/skills/discovery/SKILL.md +25 -3
  54. package/core/skills/prd/SKILL.md +8 -6
  55. package/core/skills/setup-ai-first/SKILL.md +3 -2
  56. package/core/skills/spec/SKILL.md +7 -5
  57. package/core/skills/test/SKILL.md +54 -9
  58. package/core/steps/context-loader.md +22 -1
  59. package/core/steps/gate.md +1 -1
  60. package/core/steps/report-footer.md +3 -2
  61. package/core/steps/spawn-agent.md +3 -1
  62. package/package.json +1 -1
  63. package/skills/code/SKILL.md +29 -6
  64. package/skills/debug/SKILL.md +31 -7
  65. package/skills/discovery/SKILL.md +25 -3
  66. package/skills/prd/SKILL.md +8 -6
  67. package/skills/setup-ai-first/SKILL.md +3 -2
  68. package/skills/spec/SKILL.md +7 -5
  69. package/skills/test/SKILL.md +54 -9
  70. package/steps/context-loader.md +22 -1
  71. package/steps/gate.md +1 -1
  72. package/steps/report-footer.md +3 -2
  73. package/steps/spawn-agent.md +3 -1
@@ -31,7 +31,7 @@ Display and wait for response:
31
31
  ```
32
32
  ⚙️ MODEL CHECK
33
33
  ──────────────────────────────────────────────────────────────────
34
- Recommended : claude-opus-4-5 (or claude-opus-4)
34
+ Recommended : claude-opus-4 (or latest Opus model)
35
35
  Why needed : Spec analysis, architecture review, code generation
36
36
  require deep reasoning. Smaller models miss edge cases.
37
37
 
@@ -84,7 +84,28 @@ Wait for explicit "Y" or "N" from the user before continuing.
84
84
  - "N" → stop and ask what the user wants to change.
85
85
 
86
86
 
87
- *Note: For this command, the target in Step 1 is a `.feature` file or UC-ID under `{paths.specs_dir}/`. If quality < 80% (missing BDD rules compliance), halt with feedback.*
87
+ *Note: For this command, the target in Step 1 is a `.feature` file or UC-ID under `{paths.specs_dir}/`.*
88
+
89
+ **Quality Gate**: Before generating, check the BDD findings file:
90
+
91
+ 1. Look for `{paths.refinement_dir}/{uc-id}-review-bdd-findings.yaml`.
92
+ 2. **If file does not exist** → warn and ask:
93
+ ```
94
+ ⚠️ /review-context has not been run for this feature file.
95
+ Recommended: run /review-context {feature-file} first to verify BDD quality.
96
+ Continue without review? (Y/N)
97
+ ```
98
+ - Y → proceed (accept risk)
99
+ - N → stop; run `/review-context {feature-file}` first
100
+ 3. **If file exists** → check for unresolved `status: "pending"` critical findings.
101
+ If any found → **HALT** and print:
102
+ ```
103
+ ❌ Quality Gate Failed — {feature-file}
104
+ Unresolved critical BDD findings detected.
105
+ Run: /review-context --fix {feature-file} ← auto-fix what's possible
106
+ Then: /review-context --resume {feature-file} ← apply remaining accepted findings
107
+ Then re-run: /generate-tech-docs {feature-file}
108
+ ```
88
109
 
89
110
  ## Context
90
111
  # Context Loader — Load All Project Context
@@ -140,7 +161,7 @@ If `paths` section is absent, use these defaults:
140
161
  - `domain_knowledge_dir` = `specs/domain-knowledge`
141
162
  - `business_dictionary` = `specs/domain-knowledge/business-dictionary.md`
142
163
  - `core_entities` = `specs/domain-knowledge/core-entities.md`
143
- - `tech_docs_dir` = `tech-docs`
164
+ - `tech_docs_dir` = `specs/tech-docs`
144
165
  - `trace_dir` = `.trace`
145
166
 
146
167
  If `tech_stack.module` is set, also load `.agent/modules/{module}/stack-profile.yaml` if it exists.
@@ -217,6 +238,26 @@ If the file does not exist → skip silently.
217
238
 
218
239
  ---
219
240
 
241
+ ## Step 6.5 — [PLATFORM] Derive active_module and platform_type
242
+
243
+ Using `tech_stack.module` loaded in Step 1, derive and store two variables for use by all downstream commands:
244
+
245
+ ```
246
+ active_module = tech_stack.module (e.g. "java-spring", "react", "flutter")
247
+ ```
248
+
249
+ | `platform_type` | Modules |
250
+ |---|---|
251
+ | `backend` | `java-spring`, `golang`, `dotnet`, `php-laravel`, `context-engineering` |
252
+ | `web-frontend` | `react`, `nextjs`, `vue`, `nuxt`, `angular` |
253
+ | `mobile` | `flutter`, `react-native`, `ios-swiftui`, `android-compose` |
254
+
255
+ If `tech_stack.module` is blank or not recognized → set `platform_type = "unknown"` and flag as ⚠️ in the Step 7 recap.
256
+
257
+ 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).
258
+
259
+ ---
260
+
220
261
  ## Step 7 — [RECAP] Working Memory Recap (anti-lost-in-middle)
221
262
 
222
263
  After loading all context, synthesize and output a compact summary block.
@@ -227,6 +268,7 @@ Output exactly this block:
227
268
  ```
228
269
  [CTX LOADED]
229
270
  Stack : {language} / {framework} / {database}
271
+ Platform : {active_module} ({platform_type})
230
272
  Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Service → Repository}
231
273
  Ticket : {ticket_prefix}-
232
274
  Dict : {loaded — N canonical terms, M banned terms | missing}
@@ -252,6 +294,38 @@ After completing all steps, you have loaded:
252
294
  Proceed to the next step of the calling command.
253
295
 
254
296
 
297
+ ---
298
+
299
+ ## CHECKPOINT — Tech Design Plan
300
+
301
+ Before generating, scan the feature file for scenario count, referenced BRs, and entities. Display and wait for Y:
302
+
303
+ ```
304
+ Tech Design Plan — {UC-ID}
305
+ ──────────────────────────────────────────────────────
306
+ UC : {UC-ID} — {feature title}
307
+ Service : {trace.service}
308
+ Module : {trace.module}
309
+ Scenarios: {N} scenarios
310
+ BDD ver : {trace.bdd_version}
311
+ Output : {paths.tech_docs_dir}/{domain}/{UC-ID}-tech-design.md
312
+
313
+ Sections to generate:
314
+ §1 Overview
315
+ §2 API Endpoints ({N} endpoints inferred from scenarios)
316
+ §3 Data Model ({entities from core-entities.md relevant to this UC})
317
+ §4 Service Flow
318
+ §5 Business Rules ({N} BRs from feature header)
319
+ §6 Error Handling
320
+ §7 Database Changes
321
+ §8 Caching Strategy
322
+ §9 Cross-Service Dependencies
323
+ ──────────────────────────────────────────────────────
324
+ Proceed? (Y/N)
325
+ ```
326
+
327
+ Wait for explicit "Y" before generating.
328
+
255
329
  ---
256
330
 
257
331
  ## Generate
@@ -264,6 +338,8 @@ Write `{paths.tech_docs_dir}/{domain}/{UC-ID}-tech-design.md`:
264
338
  ---
265
339
  @trace.id: {UC-ID}
266
340
  @trace.domain: {domain}
341
+ @trace.service: {read @trace.service from the .feature file header}
342
+ @trace.module: {read @trace.module from the .feature file header}
267
343
  @trace.prd: {TICKET-ID}
268
344
  @trace.bdd_version: {read @trace.bdd_version from the .feature file header}
269
345
  @trace.revision: 1
@@ -296,8 +372,6 @@ Write `{paths.tech_docs_dir}/{domain}/{UC-ID}-tech-design.md`:
296
372
  | 1 | {YYYY-MM-DD} | Initial generation from {UC-ID}.feature (BDD v{bdd_version}) |
297
373
  ```
298
374
 
299
- SA/Lead should review and approve before running `/generate-code`.
300
-
301
375
  ## Output
302
376
 
303
377
  # Report Footer — Standard Command Output Format
@@ -328,6 +402,7 @@ Suggest the logical next command based on workflow phase:
328
402
 
329
403
  | Current command | Suggest next |
330
404
  |-------------------------|-----------------------------------------------|
405
+ | /setup-ai-first | `/define-product` to start your first feature |
331
406
  | /define-product | `/generate-prd {product-definition-file}` |
332
407
  | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
333
408
  | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
@@ -336,13 +411,13 @@ Suggest the logical next command based on workflow phase:
336
411
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
337
412
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
338
413
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
339
- | /generate-code | `/generate-tests {UC-ID}` |
414
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
340
415
  | /generate-tests | `/run-tests {UC-ID}` |
341
416
  | /run-tests (passing) | `/review-code {UC-ID}` |
342
417
  | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
343
418
  | /review-code | `/smoke-test {UC-ID}` or create PR |
344
419
  | /smoke-test | Create PR and link to ticket |
345
- | /validate-traces | `/generate-code {UC-ID}` for gaps |
420
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
346
421
  | /fix-bug | Create PR and link to ticket |
347
422
  | /debug | `/fix-bug {ticket-id}` if fix needed |
348
423
 
@@ -358,5 +433,7 @@ Next : {suggested command with example arguments}
358
433
  ```
359
434
  /generate-tech-docs Complete — {UC-ID}
360
435
  File: {paths.tech_docs_dir}/{domain}/{UC-ID}-tech-design.md
361
- Next: /generate-code {UC-ID}
436
+ Next: /review-tech-docs {paths.tech_docs_dir}/{domain}/{UC-ID}-tech-design.md
437
+ ← SA/Lead review required before code generation
438
+ → after approved: /generate-code {paths.specs_dir}/{domain}/{UC-ID}-{slug}.feature
362
439
  ```
@@ -3,13 +3,66 @@
3
3
  ## Gate
4
4
  {{include:steps/gate.md}}
5
5
 
6
- *Note: For this command, the target in Step 1 is a `.feature` file or UC-ID under `{paths.specs_dir}/`. If quality < 80% (missing BDD rules compliance), halt with feedback.*
6
+ *Note: For this command, the target in Step 1 is a `.feature` file or UC-ID under `{paths.specs_dir}/`.*
7
+
8
+ **Quality Gate**: Before generating, check the BDD findings file:
9
+
10
+ 1. Look for `{paths.refinement_dir}/{uc-id}-review-bdd-findings.yaml`.
11
+ 2. **If file does not exist** → warn and ask:
12
+ ```
13
+ ⚠️ /review-context has not been run for this feature file.
14
+ Recommended: run /review-context {feature-file} first to verify BDD quality.
15
+ Continue without review? (Y/N)
16
+ ```
17
+ - Y → proceed (accept risk)
18
+ - N → stop; run `/review-context {feature-file}` first
19
+ 3. **If file exists** → check for unresolved `status: "pending"` critical findings.
20
+ If any found → **HALT** and print:
21
+ ```
22
+ ❌ Quality Gate Failed — {feature-file}
23
+ Unresolved critical BDD findings detected.
24
+ Run: /review-context --fix {feature-file} ← auto-fix what's possible
25
+ Then: /review-context --resume {feature-file} ← apply remaining accepted findings
26
+ Then re-run: /generate-tech-docs {feature-file}
27
+ ```
7
28
 
8
29
  ## Context
9
30
  {{include:steps/context-loader.md}}
10
31
 
11
32
  ---
12
33
 
34
+ ## CHECKPOINT — Tech Design Plan
35
+
36
+ Before generating, scan the feature file for scenario count, referenced BRs, and entities. Display and wait for Y:
37
+
38
+ ```
39
+ Tech Design Plan — {UC-ID}
40
+ ──────────────────────────────────────────────────────
41
+ UC : {UC-ID} — {feature title}
42
+ Service : {trace.service}
43
+ Module : {trace.module}
44
+ Scenarios: {N} scenarios
45
+ BDD ver : {trace.bdd_version}
46
+ Output : {paths.tech_docs_dir}/{domain}/{UC-ID}-tech-design.md
47
+
48
+ Sections to generate:
49
+ §1 Overview
50
+ §2 API Endpoints ({N} endpoints inferred from scenarios)
51
+ §3 Data Model ({entities from core-entities.md relevant to this UC})
52
+ §4 Service Flow
53
+ §5 Business Rules ({N} BRs from feature header)
54
+ §6 Error Handling
55
+ §7 Database Changes
56
+ §8 Caching Strategy
57
+ §9 Cross-Service Dependencies
58
+ ──────────────────────────────────────────────────────
59
+ Proceed? (Y/N)
60
+ ```
61
+
62
+ Wait for explicit "Y" before generating.
63
+
64
+ ---
65
+
13
66
  ## Generate
14
67
 
15
68
  Write `{paths.tech_docs_dir}/{domain}/{UC-ID}-tech-design.md`:
@@ -20,6 +73,8 @@ Write `{paths.tech_docs_dir}/{domain}/{UC-ID}-tech-design.md`:
20
73
  ---
21
74
  @trace.id: {UC-ID}
22
75
  @trace.domain: {domain}
76
+ @trace.service: {read @trace.service from the .feature file header}
77
+ @trace.module: {read @trace.module from the .feature file header}
23
78
  @trace.prd: {TICKET-ID}
24
79
  @trace.bdd_version: {read @trace.bdd_version from the .feature file header}
25
80
  @trace.revision: 1
@@ -52,8 +107,6 @@ Write `{paths.tech_docs_dir}/{domain}/{UC-ID}-tech-design.md`:
52
107
  | 1 | {YYYY-MM-DD} | Initial generation from {UC-ID}.feature (BDD v{bdd_version}) |
53
108
  ```
54
109
 
55
- SA/Lead should review and approve before running `/generate-code`.
56
-
57
110
  ## Output
58
111
 
59
112
  {{include:steps/report-footer.md}}
@@ -61,5 +114,7 @@ SA/Lead should review and approve before running `/generate-code`.
61
114
  ```
62
115
  /generate-tech-docs Complete — {UC-ID}
63
116
  File: {paths.tech_docs_dir}/{domain}/{UC-ID}-tech-design.md
64
- Next: /generate-code {UC-ID}
117
+ Next: /review-tech-docs {paths.tech_docs_dir}/{domain}/{UC-ID}-tech-design.md
118
+ ← SA/Lead review required before code generation
119
+ → after approved: /generate-code {paths.specs_dir}/{domain}/{UC-ID}-{slug}.feature
65
120
  ```