@anhth2/spec-driven-dev-plugin 0.9.1 → 0.10.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 (124) hide show
  1. package/ARCHITECTURE.md +20 -9
  2. package/bin/index.js +1 -2
  3. package/commands/debug.md +13 -12
  4. package/commands/define-product.md +12 -11
  5. package/commands/{generate-tests.md → dev-gen-test.md} +48 -15
  6. package/commands/{generate-tests.tmpl → dev-gen-test.tmpl} +18 -4
  7. package/{core/commands/run-tests.md → commands/dev-run-test.md} +62 -13
  8. package/commands/{run-tests.tmpl → dev-run-test.tmpl} +32 -2
  9. package/{core/commands/smoke-test.md → commands/dev-smoke-test.md} +17 -16
  10. package/commands/{smoke-test.tmpl → dev-smoke-test.tmpl} +5 -5
  11. package/commands/fix-bug.md +13 -12
  12. package/commands/generate-bdd.md +39 -13
  13. package/commands/generate-bdd.tmpl +9 -2
  14. package/commands/generate-code.md +86 -15
  15. package/commands/generate-code.tmpl +56 -4
  16. package/commands/generate-design-spec.md +105 -39
  17. package/commands/generate-design-spec.tmpl +93 -28
  18. package/commands/generate-prd.md +12 -11
  19. package/commands/generate-spec-manifest.md +12 -11
  20. package/commands/generate-tech-docs.md +63 -22
  21. package/commands/generate-tech-docs.tmpl +51 -11
  22. package/commands/learn.md +13 -12
  23. package/commands/propose-scenario.md +13 -12
  24. package/commands/propose-scenario.tmpl +1 -1
  25. package/commands/refine-prd.md +166 -16
  26. package/commands/refine-prd.tmpl +16 -5
  27. package/commands/report-bug.md +12 -11
  28. package/commands/review-code.md +14 -13
  29. package/commands/review-code.tmpl +1 -1
  30. package/commands/review-context.md +161 -12
  31. package/commands/review-context.tmpl +11 -1
  32. package/commands/review-tech-docs.md +13 -11
  33. package/commands/review-tech-docs.tmpl +1 -0
  34. package/commands/setup-ai-first.md +7 -7
  35. package/commands/sync.md +23 -20
  36. package/commands/sync.tmpl +16 -13
  37. package/commands/update-framework.md +7 -7
  38. package/commands/validate-traces.md +57 -37
  39. package/commands/validate-traces.tmpl +45 -26
  40. package/core/FRAMEWORK_VERSION +1 -1
  41. package/core/commands/debug.md +13 -12
  42. package/core/commands/define-product.md +12 -11
  43. package/core/commands/{generate-tests.md → dev-gen-test.md} +48 -15
  44. package/{commands/run-tests.md → core/commands/dev-run-test.md} +62 -13
  45. package/{commands/smoke-test.md → core/commands/dev-smoke-test.md} +17 -16
  46. package/core/commands/fix-bug.md +13 -12
  47. package/core/commands/generate-bdd.md +39 -13
  48. package/core/commands/generate-code.md +86 -15
  49. package/core/commands/generate-design-spec.md +105 -39
  50. package/core/commands/generate-prd.md +12 -11
  51. package/core/commands/generate-spec-manifest.md +12 -11
  52. package/core/commands/generate-tech-docs.md +63 -22
  53. package/core/commands/learn.md +13 -12
  54. package/core/commands/propose-scenario.md +13 -12
  55. package/core/commands/refine-prd.md +166 -16
  56. package/core/commands/report-bug.md +12 -11
  57. package/core/commands/review-code.md +14 -13
  58. package/core/commands/review-context.md +161 -12
  59. package/core/commands/review-tech-docs.md +13 -11
  60. package/core/commands/setup-ai-first.md +7 -7
  61. package/core/commands/sync.md +23 -20
  62. package/core/commands/update-framework.md +7 -7
  63. package/core/commands/validate-traces.md +57 -37
  64. package/core/modules/android-compose/module.yaml +13 -0
  65. package/core/modules/android-compose/stack-profile.yaml +57 -0
  66. package/core/modules/flutter/module.yaml +14 -0
  67. package/core/modules/flutter/stack-profile.yaml +59 -0
  68. package/core/modules/ios-swiftui/module.yaml +13 -0
  69. package/core/modules/ios-swiftui/stack-profile.yaml +55 -0
  70. package/core/modules/nuxt/module.yaml +14 -0
  71. package/core/modules/nuxt/stack-profile.yaml +58 -0
  72. package/core/modules/react-native/module.yaml +14 -0
  73. package/core/modules/react-native/stack-profile.yaml +56 -0
  74. package/core/modules/vue/module.yaml +14 -0
  75. package/core/modules/vue/stack-profile.yaml +65 -0
  76. package/core/skills/code/SKILL.md +19 -18
  77. package/core/skills/debug/SKILL.md +27 -26
  78. package/core/skills/design-spec/SKILL.md +12 -11
  79. package/core/skills/discovery/SKILL.md +12 -11
  80. package/core/skills/prd/SKILL.md +14 -14
  81. package/core/skills/setup-ai-first/SKILL.md +7 -7
  82. package/core/skills/spec/SKILL.md +14 -14
  83. package/core/skills/test/SKILL.md +40 -38
  84. package/core/steps/capture-lesson.md +1 -1
  85. package/core/steps/context-loader.md +5 -4
  86. package/core/steps/report-footer.md +7 -7
  87. package/core/steps/review-fanout.md +138 -0
  88. package/core/steps/spawn-agent.md +1 -1
  89. package/core/steps/trace-mirror.md +18 -0
  90. package/core/templates/design-spec.template.md +16 -8
  91. package/core/templates/product-definition.template.md +3 -3
  92. package/core/templates/project-context.yaml +4 -1
  93. package/modules/android-compose/module.yaml +13 -0
  94. package/modules/android-compose/stack-profile.yaml +57 -0
  95. package/modules/flutter/module.yaml +14 -0
  96. package/modules/flutter/stack-profile.yaml +59 -0
  97. package/modules/ios-swiftui/module.yaml +13 -0
  98. package/modules/ios-swiftui/stack-profile.yaml +55 -0
  99. package/modules/nuxt/module.yaml +14 -0
  100. package/modules/nuxt/stack-profile.yaml +58 -0
  101. package/modules/react-native/module.yaml +14 -0
  102. package/modules/react-native/stack-profile.yaml +56 -0
  103. package/modules/vue/module.yaml +14 -0
  104. package/modules/vue/stack-profile.yaml +65 -0
  105. package/package.json +1 -1
  106. package/skills/code/SKILL.md +19 -18
  107. package/skills/debug/SKILL.md +27 -26
  108. package/skills/debug/SKILL.tmpl +1 -1
  109. package/skills/design-spec/SKILL.md +12 -11
  110. package/skills/discovery/SKILL.md +12 -11
  111. package/skills/prd/SKILL.md +14 -14
  112. package/skills/setup-ai-first/SKILL.md +7 -7
  113. package/skills/spec/SKILL.md +14 -14
  114. package/skills/test/SKILL.md +40 -38
  115. package/skills/test/SKILL.tmpl +9 -9
  116. package/steps/capture-lesson.md +1 -1
  117. package/steps/context-loader.md +5 -4
  118. package/steps/report-footer.md +7 -7
  119. package/steps/review-fanout.md +138 -0
  120. package/steps/spawn-agent.md +1 -1
  121. package/steps/trace-mirror.md +18 -0
  122. package/templates/design-spec.template.md +16 -8
  123. package/templates/product-definition.template.md +3 -3
  124. package/templates/project-context.yaml +4 -1
@@ -168,7 +168,7 @@ If `services` section is present:
168
168
 
169
169
  **2. Route to service** — if active domain matches a key in `services`:
170
170
  - Override `paths.specs_dir` → `services.{domain}.specs_dir`
171
- - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir`
171
+ - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir` — **only if `setup.spec_source` is NOT set.** When `spec_source` IS set, the tech-design (API contract) is a cross-team artifact and must live in the shared spec repo (handled in step 4), so leave `tech_docs_dir` for step 4 to route — do NOT pin it per-service here.
172
172
  - Store `active_service` = `services.{domain}.path`
173
173
  - Store `active_service_module` = `services.{domain}.module`
174
174
  - If service has its own `module` → use it as `active_module` (overrides `tech_stack.module`)
@@ -180,13 +180,14 @@ If `services` section is present:
180
180
  **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
181
181
  - Override `paths.prd_dir` → `{spec_source}/specs/prd`
182
182
  - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
183
+ - Override `paths.tech_docs_dir` → `{spec_source}/specs/tech-docs` — **always when `spec_source` is set** (step 2 no longer pins tech-docs per-service in this case). The tech-design IS the cross-team API contract: BE authors it here, and FE/App read it from the same spec submodule at `/generate-code --phase=integration`. *(Per-service tech-docs only happen when there is no `spec_source` — a pure multi-service BE repo with no shared spec module.)*
183
184
  - Override `paths.domain_knowledge_dir` → `{spec_source}/specs/domain-knowledge`
184
185
  - Override `paths.business_dictionary` → `{spec_source}/specs/domain-knowledge/business-dictionary.md`
185
186
  - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
186
187
  - Override `paths.bug_reports_dir` → `{spec_source}/feedback/bug-reports`
187
188
  - Override `paths.bdd_proposals_dir` → `{spec_source}/feedback/bdd-proposals`
188
189
 
189
- > **Why under `spec_source`:** tester feedback (`/report-bug`, `/propose-scenario`) must land in the **shared spec repo** so PO/Dev see it when they `/sync`. In single-service mode (no `spec_source`), these default to `feedback/bug-reports` and `feedback/bdd-proposals` at repo root — still shared, same repo.
190
+ > **Why under `spec_source`:** PRD, design-spec, domain knowledge, the **API contract (tech-docs)**, and tester feedback are all **cross-team artifacts** — they must live in the **shared spec repo** so every umbrella (FE/App/BE) reads the same source via `/sync`. Tech-docs specifically: BE authors the tech-design (API contract), commits + pushes it into the spec submodule (2-layer commit), and FE/App pull it on their next `/sync` to wire the real API in `/generate-code --phase=integration`. In single-service mode (no `spec_source`), these default under the repo root — still shared, same repo.
190
191
 
191
192
  ---
192
193
 
@@ -210,7 +211,7 @@ When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-
210
211
  | `paths.specs_dir` | `{active_service}/{service paths.specs_dir}` (if set in service config, else keep Step 1.5 override) |
211
212
 
212
213
  **3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
213
- - Shell commands (`/run-tests`, `/generate-tests`) run **from within** `service_root`
214
+ - Shell commands (`/dev-run-test`, `/dev-gen-test`) run **from within** `service_root`
214
215
  - File write operations (test files, trace TSVs) use paths **relative to** `service_root`
215
216
 
216
217
  **4. If service config not found** — keep umbrella defaults, still set `service_root = {active_service}` (path anchor is always needed even without a config override).
@@ -303,7 +304,7 @@ active_module = tech_stack.module (e.g. "java-spring", "react", "flutter")
303
304
 
304
305
  If `tech_stack.module` is blank or not recognized → set `platform_type = "unknown"` and flag as ⚠️ in the Step 7 recap.
305
306
 
306
- 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).
307
+ These two variables (`active_module`, `platform_type`) are the canonical source for all branching logic in commands that need platform-specific behavior (dev-gen-test, debug, fix-bug, dev-smoke-test).
307
308
 
308
309
  ---
309
310
 
@@ -528,13 +529,13 @@ Suggest the logical next command based on workflow phase:
528
529
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
529
530
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
530
531
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
531
- | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
532
- | /generate-tests | `/run-tests {UC-ID}` |
533
- | /run-tests (passing) | `/review-code {UC-ID}` |
534
- | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
535
- | /review-code | `/smoke-test {UC-ID}` or create PR |
536
- | /smoke-test | Create PR and link to ticket |
537
- | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
532
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/dev-gen-test {UC-ID}` |
533
+ | /dev-gen-test | `/dev-run-test {UC-ID}` |
534
+ | /dev-run-test (passing) | `/review-code {UC-ID}` |
535
+ | /dev-run-test (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
536
+ | /review-code | `/dev-smoke-test {UC-ID}` or create PR |
537
+ | /dev-smoke-test | Create PR and link to ticket |
538
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/dev-gen-test {UC-ID}`; all OK → create PR |
538
539
  | /fix-bug | Create PR and link to ticket |
539
540
  | /debug | `/fix-bug {ticket-id}` if fix needed |
540
541
  | /report-bug | Send to dev (`/fix-bug {BUG-ID}`); if coverage gap → `/propose-scenario {UC-ID}` |
@@ -184,7 +184,7 @@ If `services` section is present:
184
184
 
185
185
  **2. Route to service** — if active domain matches a key in `services`:
186
186
  - Override `paths.specs_dir` → `services.{domain}.specs_dir`
187
- - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir`
187
+ - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir` — **only if `setup.spec_source` is NOT set.** When `spec_source` IS set, the tech-design (API contract) is a cross-team artifact and must live in the shared spec repo (handled in step 4), so leave `tech_docs_dir` for step 4 to route — do NOT pin it per-service here.
188
188
  - Store `active_service` = `services.{domain}.path`
189
189
  - Store `active_service_module` = `services.{domain}.module`
190
190
  - If service has its own `module` → use it as `active_module` (overrides `tech_stack.module`)
@@ -196,13 +196,14 @@ If `services` section is present:
196
196
  **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
197
197
  - Override `paths.prd_dir` → `{spec_source}/specs/prd`
198
198
  - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
199
+ - Override `paths.tech_docs_dir` → `{spec_source}/specs/tech-docs` — **always when `spec_source` is set** (step 2 no longer pins tech-docs per-service in this case). The tech-design IS the cross-team API contract: BE authors it here, and FE/App read it from the same spec submodule at `/generate-code --phase=integration`. *(Per-service tech-docs only happen when there is no `spec_source` — a pure multi-service BE repo with no shared spec module.)*
199
200
  - Override `paths.domain_knowledge_dir` → `{spec_source}/specs/domain-knowledge`
200
201
  - Override `paths.business_dictionary` → `{spec_source}/specs/domain-knowledge/business-dictionary.md`
201
202
  - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
202
203
  - Override `paths.bug_reports_dir` → `{spec_source}/feedback/bug-reports`
203
204
  - Override `paths.bdd_proposals_dir` → `{spec_source}/feedback/bdd-proposals`
204
205
 
205
- > **Why under `spec_source`:** tester feedback (`/report-bug`, `/propose-scenario`) must land in the **shared spec repo** so PO/Dev see it when they `/sync`. In single-service mode (no `spec_source`), these default to `feedback/bug-reports` and `feedback/bdd-proposals` at repo root — still shared, same repo.
206
+ > **Why under `spec_source`:** PRD, design-spec, domain knowledge, the **API contract (tech-docs)**, and tester feedback are all **cross-team artifacts** — they must live in the **shared spec repo** so every umbrella (FE/App/BE) reads the same source via `/sync`. Tech-docs specifically: BE authors the tech-design (API contract), commits + pushes it into the spec submodule (2-layer commit), and FE/App pull it on their next `/sync` to wire the real API in `/generate-code --phase=integration`. In single-service mode (no `spec_source`), these default under the repo root — still shared, same repo.
206
207
 
207
208
  ---
208
209
 
@@ -226,7 +227,7 @@ When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-
226
227
  | `paths.specs_dir` | `{active_service}/{service paths.specs_dir}` (if set in service config, else keep Step 1.5 override) |
227
228
 
228
229
  **3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
229
- - Shell commands (`/run-tests`, `/generate-tests`) run **from within** `service_root`
230
+ - Shell commands (`/dev-run-test`, `/dev-gen-test`) run **from within** `service_root`
230
231
  - File write operations (test files, trace TSVs) use paths **relative to** `service_root`
231
232
 
232
233
  **4. If service config not found** — keep umbrella defaults, still set `service_root = {active_service}` (path anchor is always needed even without a config override).
@@ -319,7 +320,7 @@ active_module = tech_stack.module (e.g. "java-spring", "react", "flutter")
319
320
 
320
321
  If `tech_stack.module` is blank or not recognized → set `platform_type = "unknown"` and flag as ⚠️ in the Step 7 recap.
321
322
 
322
- 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).
323
+ These two variables (`active_module`, `platform_type`) are the canonical source for all branching logic in commands that need platform-specific behavior (dev-gen-test, debug, fix-bug, dev-smoke-test).
323
324
 
324
325
  ---
325
326
 
@@ -453,25 +454,49 @@ Write `{paths.tech_docs_dir}/{domain}/{UC-ID}-tech-design.md`:
453
454
  ---
454
455
 
455
456
  ## §1. Overview
457
+
458
+ {Tóm tắt ngắn: UC này implement gì, scope kỹ thuật chính.}
459
+
456
460
  ## §2. API Endpoints
457
- *Greenfield:* endpoints được infer từ BDD scenarios — thiết kế mới.
458
- *Reverse-document:* tả lại API đã tồn tại từ bảng "Existing API Contract" trong PRD.
459
- Ghi chú gaps nếu contract thực tế khác với BDD expectations.
460
- | Method | Path | Auth/Role | Request | Response |
461
+
462
+ *Greenfield:* endpoints được infer từ BDD scenarios thiết kế mới.
463
+ *Reverse-document:* mô tả lại API đã tồn tại từ bảng "Existing API Contract" trong PRD. Ghi chú gaps nếu contract thực tế khác với BDD expectations.
464
+
465
+ | Method | Path | Auth/Role | Request | Response |
466
+ |--------|------|-----------|---------|----------|
467
+ | {GET/POST/PUT/DELETE} | {/api/v1/...} | {Bearer / role} | `{ field: type }` | `{ field: type }` |
468
+
461
469
  ## §3. Data Model
462
- Key entities and relationships.
470
+
471
+ Key entities and relationships.
472
+
463
473
  ## §4. Service Flow
464
- {Client} → Controller → {Facade/Service} → {Repository}
474
+
475
+ {Client} → Controller → {Facade/Service} → {Repository}
476
+
465
477
  ## §5. Business Rules Implementation
466
- | BR-ID | Rule | Implementation approach |
478
+
479
+ | BR-ID | Rule | Implementation approach |
480
+ |-------|------|-------------------------|
481
+ | {UC-ID}-BR1 | {rule} | {approach} |
482
+
467
483
  ## §6. Error Handling
468
- | Scenario | Exception | HTTP Status |
484
+
485
+ | Scenario | Exception | HTTP Status |
486
+ |----------|-----------|-------------|
487
+ | {scenario} | {ExceptionClass} | {4xx/5xx} |
488
+
469
489
  ## §7. Database Changes
470
- Migration scripts or schema changes.
490
+
491
+ Migration scripts or schema changes.
492
+
471
493
  ## §8. Caching Strategy
472
- What to cache, TTL, invalidation triggers.
494
+
495
+ What to cache, TTL, invalidation triggers.
496
+
473
497
  ## §9. Cross-Service Dependencies
474
- External calls, events produced/consumed.
498
+
499
+ External calls, events produced/consumed.
475
500
 
476
501
  ## Changelog
477
502
 
@@ -480,6 +505,21 @@ Write `{paths.tech_docs_dir}/{domain}/{UC-ID}-tech-design.md`:
480
505
  | 1 | {YYYY-MM-DD} | Initial generation from {UC-ID}.feature (BDD v{bdd_version}) |
481
506
  ```
482
507
 
508
+ ## Publish — share the contract (umbrella + shared spec repo)
509
+
510
+ If `paths.tech_docs_dir` resolved **under `setup.spec_source`** (e.g. `{spec_source}/specs/tech-docs`), the tech-doc was just written **inside the spec submodule**. It is the cross-team **API contract** — FE/App read it via their own `/sync`. Publish it so they can (2-layer commit):
511
+
512
+ ```bash
513
+ cd {spec_source}
514
+ git add specs/tech-docs/{domain}/{UC-ID}-tech-design.md
515
+ git commit -m "docs({UC-ID}): tech design / API contract"
516
+ git push origin {spec_branch} # the branch FE/App track in .gitmodules
517
+ cd -
518
+ git add {spec_source} && git commit -m "chore: bump spec pointer ({UC-ID} tech design)"
519
+ ```
520
+
521
+ If `tech_docs_dir` is **local** — i.e. no `setup.spec_source` (single-repo, or a pure multi-service BE repo with no shared spec module) — skip this; no cross-repo publish needed. Whenever `spec_source` is set, tech-docs route to the spec submodule and this publish step applies.
522
+
483
523
  ## Output
484
524
 
485
525
  # Report Footer — Standard Command Output Format
@@ -520,13 +560,13 @@ Suggest the logical next command based on workflow phase:
520
560
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
521
561
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
522
562
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
523
- | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
524
- | /generate-tests | `/run-tests {UC-ID}` |
525
- | /run-tests (passing) | `/review-code {UC-ID}` |
526
- | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
527
- | /review-code | `/smoke-test {UC-ID}` or create PR |
528
- | /smoke-test | Create PR and link to ticket |
529
- | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
563
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/dev-gen-test {UC-ID}` |
564
+ | /dev-gen-test | `/dev-run-test {UC-ID}` |
565
+ | /dev-run-test (passing) | `/review-code {UC-ID}` |
566
+ | /dev-run-test (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
567
+ | /review-code | `/dev-smoke-test {UC-ID}` or create PR |
568
+ | /dev-smoke-test | Create PR and link to ticket |
569
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/dev-gen-test {UC-ID}`; all OK → create PR |
530
570
  | /fix-bug | Create PR and link to ticket |
531
571
  | /debug | `/fix-bug {ticket-id}` if fix needed |
532
572
  | /report-bug | Send to dev (`/fix-bug {BUG-ID}`); if coverage gap → `/propose-scenario {UC-ID}` |
@@ -549,5 +589,6 @@ Next : {suggested command with example arguments}
549
589
  File: {paths.tech_docs_dir}/{domain}/{UC-ID}-tech-design.md
550
590
  Next: /review-tech-docs {paths.tech_docs_dir}/{domain}/{UC-ID}-tech-design.md
551
591
  ← SA/Lead review required before code generation
592
+ → if tech-docs live in the shared spec repo: commit + push to the spec submodule (see Publish above) so FE/App `/sync` can read the contract
552
593
  → after approved: /generate-code {paths.specs_dir}/{domain}/{UC-ID}-{slug}.feature
553
594
  ```
@@ -101,25 +101,49 @@ Write `{paths.tech_docs_dir}/{domain}/{UC-ID}-tech-design.md`:
101
101
  ---
102
102
 
103
103
  ## §1. Overview
104
+
105
+ {Tóm tắt ngắn: UC này implement gì, scope kỹ thuật chính.}
106
+
104
107
  ## §2. API Endpoints
105
- *Greenfield:* endpoints được infer từ BDD scenarios — thiết kế mới.
106
- *Reverse-document:* tả lại API đã tồn tại từ bảng "Existing API Contract" trong PRD.
107
- Ghi chú gaps nếu contract thực tế khác với BDD expectations.
108
- | Method | Path | Auth/Role | Request | Response |
108
+
109
+ *Greenfield:* endpoints được infer từ BDD scenarios thiết kế mới.
110
+ *Reverse-document:* mô tả lại API đã tồn tại từ bảng "Existing API Contract" trong PRD. Ghi chú gaps nếu contract thực tế khác với BDD expectations.
111
+
112
+ | Method | Path | Auth/Role | Request | Response |
113
+ |--------|------|-----------|---------|----------|
114
+ | {GET/POST/PUT/DELETE} | {/api/v1/...} | {Bearer / role} | `{ field: type }` | `{ field: type }` |
115
+
109
116
  ## §3. Data Model
110
- Key entities and relationships.
117
+
118
+ Key entities and relationships.
119
+
111
120
  ## §4. Service Flow
112
- {Client} → Controller → {Facade/Service} → {Repository}
121
+
122
+ {Client} → Controller → {Facade/Service} → {Repository}
123
+
113
124
  ## §5. Business Rules Implementation
114
- | BR-ID | Rule | Implementation approach |
125
+
126
+ | BR-ID | Rule | Implementation approach |
127
+ |-------|------|-------------------------|
128
+ | {UC-ID}-BR1 | {rule} | {approach} |
129
+
115
130
  ## §6. Error Handling
116
- | Scenario | Exception | HTTP Status |
131
+
132
+ | Scenario | Exception | HTTP Status |
133
+ |----------|-----------|-------------|
134
+ | {scenario} | {ExceptionClass} | {4xx/5xx} |
135
+
117
136
  ## §7. Database Changes
118
- Migration scripts or schema changes.
137
+
138
+ Migration scripts or schema changes.
139
+
119
140
  ## §8. Caching Strategy
120
- What to cache, TTL, invalidation triggers.
141
+
142
+ What to cache, TTL, invalidation triggers.
143
+
121
144
  ## §9. Cross-Service Dependencies
122
- External calls, events produced/consumed.
145
+
146
+ External calls, events produced/consumed.
123
147
 
124
148
  ## Changelog
125
149
 
@@ -128,6 +152,21 @@ Write `{paths.tech_docs_dir}/{domain}/{UC-ID}-tech-design.md`:
128
152
  | 1 | {YYYY-MM-DD} | Initial generation from {UC-ID}.feature (BDD v{bdd_version}) |
129
153
  ```
130
154
 
155
+ ## Publish — share the contract (umbrella + shared spec repo)
156
+
157
+ If `paths.tech_docs_dir` resolved **under `setup.spec_source`** (e.g. `{spec_source}/specs/tech-docs`), the tech-doc was just written **inside the spec submodule**. It is the cross-team **API contract** — FE/App read it via their own `/sync`. Publish it so they can (2-layer commit):
158
+
159
+ ```bash
160
+ cd {spec_source}
161
+ git add specs/tech-docs/{domain}/{UC-ID}-tech-design.md
162
+ git commit -m "docs({UC-ID}): tech design / API contract"
163
+ git push origin {spec_branch} # the branch FE/App track in .gitmodules
164
+ cd -
165
+ git add {spec_source} && git commit -m "chore: bump spec pointer ({UC-ID} tech design)"
166
+ ```
167
+
168
+ If `tech_docs_dir` is **local** — i.e. no `setup.spec_source` (single-repo, or a pure multi-service BE repo with no shared spec module) — skip this; no cross-repo publish needed. Whenever `spec_source` is set, tech-docs route to the spec submodule and this publish step applies.
169
+
131
170
  ## Output
132
171
 
133
172
  {{include:steps/report-footer.md}}
@@ -137,5 +176,6 @@ Write `{paths.tech_docs_dir}/{domain}/{UC-ID}-tech-design.md`:
137
176
  File: {paths.tech_docs_dir}/{domain}/{UC-ID}-tech-design.md
138
177
  Next: /review-tech-docs {paths.tech_docs_dir}/{domain}/{UC-ID}-tech-design.md
139
178
  ← SA/Lead review required before code generation
179
+ → if tech-docs live in the shared spec repo: commit + push to the spec submodule (see Publish above) so FE/App `/sync` can read the contract
140
180
  → after approved: /generate-code {paths.specs_dir}/{domain}/{UC-ID}-{slug}.feature
141
181
  ```
package/commands/learn.md CHANGED
@@ -172,7 +172,7 @@ If `services` section is present:
172
172
 
173
173
  **2. Route to service** — if active domain matches a key in `services`:
174
174
  - Override `paths.specs_dir` → `services.{domain}.specs_dir`
175
- - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir`
175
+ - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir` — **only if `setup.spec_source` is NOT set.** When `spec_source` IS set, the tech-design (API contract) is a cross-team artifact and must live in the shared spec repo (handled in step 4), so leave `tech_docs_dir` for step 4 to route — do NOT pin it per-service here.
176
176
  - Store `active_service` = `services.{domain}.path`
177
177
  - Store `active_service_module` = `services.{domain}.module`
178
178
  - If service has its own `module` → use it as `active_module` (overrides `tech_stack.module`)
@@ -184,13 +184,14 @@ If `services` section is present:
184
184
  **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
185
185
  - Override `paths.prd_dir` → `{spec_source}/specs/prd`
186
186
  - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
187
+ - Override `paths.tech_docs_dir` → `{spec_source}/specs/tech-docs` — **always when `spec_source` is set** (step 2 no longer pins tech-docs per-service in this case). The tech-design IS the cross-team API contract: BE authors it here, and FE/App read it from the same spec submodule at `/generate-code --phase=integration`. *(Per-service tech-docs only happen when there is no `spec_source` — a pure multi-service BE repo with no shared spec module.)*
187
188
  - Override `paths.domain_knowledge_dir` → `{spec_source}/specs/domain-knowledge`
188
189
  - Override `paths.business_dictionary` → `{spec_source}/specs/domain-knowledge/business-dictionary.md`
189
190
  - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
190
191
  - Override `paths.bug_reports_dir` → `{spec_source}/feedback/bug-reports`
191
192
  - Override `paths.bdd_proposals_dir` → `{spec_source}/feedback/bdd-proposals`
192
193
 
193
- > **Why under `spec_source`:** tester feedback (`/report-bug`, `/propose-scenario`) must land in the **shared spec repo** so PO/Dev see it when they `/sync`. In single-service mode (no `spec_source`), these default to `feedback/bug-reports` and `feedback/bdd-proposals` at repo root — still shared, same repo.
194
+ > **Why under `spec_source`:** PRD, design-spec, domain knowledge, the **API contract (tech-docs)**, and tester feedback are all **cross-team artifacts** — they must live in the **shared spec repo** so every umbrella (FE/App/BE) reads the same source via `/sync`. Tech-docs specifically: BE authors the tech-design (API contract), commits + pushes it into the spec submodule (2-layer commit), and FE/App pull it on their next `/sync` to wire the real API in `/generate-code --phase=integration`. In single-service mode (no `spec_source`), these default under the repo root — still shared, same repo.
194
195
 
195
196
  ---
196
197
 
@@ -214,7 +215,7 @@ When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-
214
215
  | `paths.specs_dir` | `{active_service}/{service paths.specs_dir}` (if set in service config, else keep Step 1.5 override) |
215
216
 
216
217
  **3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
217
- - Shell commands (`/run-tests`, `/generate-tests`) run **from within** `service_root`
218
+ - Shell commands (`/dev-run-test`, `/dev-gen-test`) run **from within** `service_root`
218
219
  - File write operations (test files, trace TSVs) use paths **relative to** `service_root`
219
220
 
220
221
  **4. If service config not found** — keep umbrella defaults, still set `service_root = {active_service}` (path anchor is always needed even without a config override).
@@ -307,7 +308,7 @@ active_module = tech_stack.module (e.g. "java-spring", "react", "flutter")
307
308
 
308
309
  If `tech_stack.module` is blank or not recognized → set `platform_type = "unknown"` and flag as ⚠️ in the Step 7 recap.
309
310
 
310
- 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).
311
+ These two variables (`active_module`, `platform_type`) are the canonical source for all branching logic in commands that need platform-specific behavior (dev-gen-test, debug, fix-bug, dev-smoke-test).
311
312
 
312
313
  ---
313
314
 
@@ -445,7 +446,7 @@ If `lessons_path` does not exist, create it with this header first:
445
446
  | code-gen | /generate-code output |
446
447
  | bdd | /generate-bdd output |
447
448
  | tech-docs | /generate-tech-docs output |
448
- | tests | /generate-tests output |
449
+ | tests | /dev-gen-test output |
449
450
  | prd | /generate-prd, /refine-prd output |
450
451
  | general | every command |
451
452
 
@@ -512,13 +513,13 @@ Suggest the logical next command based on workflow phase:
512
513
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
513
514
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
514
515
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
515
- | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
516
- | /generate-tests | `/run-tests {UC-ID}` |
517
- | /run-tests (passing) | `/review-code {UC-ID}` |
518
- | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
519
- | /review-code | `/smoke-test {UC-ID}` or create PR |
520
- | /smoke-test | Create PR and link to ticket |
521
- | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
516
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/dev-gen-test {UC-ID}` |
517
+ | /dev-gen-test | `/dev-run-test {UC-ID}` |
518
+ | /dev-run-test (passing) | `/review-code {UC-ID}` |
519
+ | /dev-run-test (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
520
+ | /review-code | `/dev-smoke-test {UC-ID}` or create PR |
521
+ | /dev-smoke-test | Create PR and link to ticket |
522
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/dev-gen-test {UC-ID}`; all OK → create PR |
522
523
  | /fix-bug | Create PR and link to ticket |
523
524
  | /debug | `/fix-bug {ticket-id}` if fix needed |
524
525
  | /report-bug | Send to dev (`/fix-bug {BUG-ID}`); if coverage gap → `/propose-scenario {UC-ID}` |
@@ -172,7 +172,7 @@ If `services` section is present:
172
172
 
173
173
  **2. Route to service** — if active domain matches a key in `services`:
174
174
  - Override `paths.specs_dir` → `services.{domain}.specs_dir`
175
- - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir`
175
+ - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir` — **only if `setup.spec_source` is NOT set.** When `spec_source` IS set, the tech-design (API contract) is a cross-team artifact and must live in the shared spec repo (handled in step 4), so leave `tech_docs_dir` for step 4 to route — do NOT pin it per-service here.
176
176
  - Store `active_service` = `services.{domain}.path`
177
177
  - Store `active_service_module` = `services.{domain}.module`
178
178
  - If service has its own `module` → use it as `active_module` (overrides `tech_stack.module`)
@@ -184,13 +184,14 @@ If `services` section is present:
184
184
  **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
185
185
  - Override `paths.prd_dir` → `{spec_source}/specs/prd`
186
186
  - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
187
+ - Override `paths.tech_docs_dir` → `{spec_source}/specs/tech-docs` — **always when `spec_source` is set** (step 2 no longer pins tech-docs per-service in this case). The tech-design IS the cross-team API contract: BE authors it here, and FE/App read it from the same spec submodule at `/generate-code --phase=integration`. *(Per-service tech-docs only happen when there is no `spec_source` — a pure multi-service BE repo with no shared spec module.)*
187
188
  - Override `paths.domain_knowledge_dir` → `{spec_source}/specs/domain-knowledge`
188
189
  - Override `paths.business_dictionary` → `{spec_source}/specs/domain-knowledge/business-dictionary.md`
189
190
  - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
190
191
  - Override `paths.bug_reports_dir` → `{spec_source}/feedback/bug-reports`
191
192
  - Override `paths.bdd_proposals_dir` → `{spec_source}/feedback/bdd-proposals`
192
193
 
193
- > **Why under `spec_source`:** tester feedback (`/report-bug`, `/propose-scenario`) must land in the **shared spec repo** so PO/Dev see it when they `/sync`. In single-service mode (no `spec_source`), these default to `feedback/bug-reports` and `feedback/bdd-proposals` at repo root — still shared, same repo.
194
+ > **Why under `spec_source`:** PRD, design-spec, domain knowledge, the **API contract (tech-docs)**, and tester feedback are all **cross-team artifacts** — they must live in the **shared spec repo** so every umbrella (FE/App/BE) reads the same source via `/sync`. Tech-docs specifically: BE authors the tech-design (API contract), commits + pushes it into the spec submodule (2-layer commit), and FE/App pull it on their next `/sync` to wire the real API in `/generate-code --phase=integration`. In single-service mode (no `spec_source`), these default under the repo root — still shared, same repo.
194
195
 
195
196
  ---
196
197
 
@@ -214,7 +215,7 @@ When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-
214
215
  | `paths.specs_dir` | `{active_service}/{service paths.specs_dir}` (if set in service config, else keep Step 1.5 override) |
215
216
 
216
217
  **3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
217
- - Shell commands (`/run-tests`, `/generate-tests`) run **from within** `service_root`
218
+ - Shell commands (`/dev-run-test`, `/dev-gen-test`) run **from within** `service_root`
218
219
  - File write operations (test files, trace TSVs) use paths **relative to** `service_root`
219
220
 
220
221
  **4. If service config not found** — keep umbrella defaults, still set `service_root = {active_service}` (path anchor is always needed even without a config override).
@@ -307,7 +308,7 @@ active_module = tech_stack.module (e.g. "java-spring", "react", "flutter")
307
308
 
308
309
  If `tech_stack.module` is blank or not recognized → set `platform_type = "unknown"` and flag as ⚠️ in the Step 7 recap.
309
310
 
310
- 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).
311
+ These two variables (`active_module`, `platform_type`) are the canonical source for all branching logic in commands that need platform-specific behavior (dev-gen-test, debug, fix-bug, dev-smoke-test).
311
312
 
312
313
  ---
313
314
 
@@ -469,13 +470,13 @@ Suggest the logical next command based on workflow phase:
469
470
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
470
471
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
471
472
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
472
- | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
473
- | /generate-tests | `/run-tests {UC-ID}` |
474
- | /run-tests (passing) | `/review-code {UC-ID}` |
475
- | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
476
- | /review-code | `/smoke-test {UC-ID}` or create PR |
477
- | /smoke-test | Create PR and link to ticket |
478
- | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
473
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/dev-gen-test {UC-ID}` |
474
+ | /dev-gen-test | `/dev-run-test {UC-ID}` |
475
+ | /dev-run-test (passing) | `/review-code {UC-ID}` |
476
+ | /dev-run-test (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
477
+ | /review-code | `/dev-smoke-test {UC-ID}` or create PR |
478
+ | /dev-smoke-test | Create PR and link to ticket |
479
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/dev-gen-test {UC-ID}`; all OK → create PR |
479
480
  | /fix-bug | Create PR and link to ticket |
480
481
  | /debug | `/fix-bug {ticket-id}` if fix needed |
481
482
  | /report-bug | Send to dev (`/fix-bug {BUG-ID}`); if coverage gap → `/propose-scenario {UC-ID}` |
@@ -510,7 +511,7 @@ Proposed scenario (DRAFT — pending PO/Dev review):
510
511
  For PO/Dev to promote:
511
512
  [ ] AC mapping correct? (or update PRD if requirement is actually new)
512
513
  [ ] Add scenario to {bdd_path} (edit, or re-run /generate-bdd if PRD changed)
513
- [ ] Then: /generate-code {UC-ID} + /generate-tests {UC-ID}
514
+ [ ] Then: /generate-code {UC-ID} + /dev-gen-test {UC-ID}
514
515
 
515
516
  Handoff : {✅ committed + pushed to spec repo | ⚠️ run git commands above / open a PR}
516
517
 
@@ -98,7 +98,7 @@ Proposed scenario (DRAFT — pending PO/Dev review):
98
98
  For PO/Dev to promote:
99
99
  [ ] AC mapping correct? (or update PRD if requirement is actually new)
100
100
  [ ] Add scenario to {bdd_path} (edit, or re-run /generate-bdd if PRD changed)
101
- [ ] Then: /generate-code {UC-ID} + /generate-tests {UC-ID}
101
+ [ ] Then: /generate-code {UC-ID} + /dev-gen-test {UC-ID}
102
102
 
103
103
  Handoff : {✅ committed + pushed to spec repo | ⚠️ run git commands above / open a PR}
104
104