@anhth2/spec-driven-dev-plugin 0.11.0 → 0.14.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.
- package/commands/debug.md +47 -7
- package/commands/define-product.md +47 -7
- package/commands/dev-gen-test.md +65 -17
- package/commands/dev-run-test.md +66 -18
- package/commands/dev-run-test.tmpl +1 -1
- package/commands/dev-smoke-test.md +47 -7
- package/commands/fix-bug.md +83 -13
- package/commands/fix-bug.tmpl +36 -6
- package/commands/generate-bdd.md +74 -21
- package/commands/generate-bdd.tmpl +9 -4
- package/commands/generate-code.md +118 -35
- package/commands/generate-code.tmpl +53 -18
- package/commands/generate-design-spec.md +47 -7
- package/commands/generate-prd.md +47 -7
- package/commands/generate-spec-manifest.md +47 -7
- package/commands/generate-tech-docs.md +234 -20
- package/commands/generate-tech-docs.tmpl +187 -13
- package/commands/learn.md +47 -7
- package/commands/map-testids.md +564 -0
- package/commands/map-testids.tmpl +81 -0
- package/commands/propose-scenario.md +78 -18
- package/commands/propose-scenario.tmpl +31 -11
- package/commands/qc-analyze.md +67 -12
- package/commands/qc-analyze.tmpl +20 -5
- package/commands/qc-design-test.md +51 -10
- package/commands/qc-design-test.tmpl +4 -3
- package/commands/qc-plan.md +50 -10
- package/commands/qc-plan.tmpl +3 -3
- package/commands/qc-report.md +60 -8
- package/commands/qc-report.tmpl +13 -1
- package/commands/qc-review.md +49 -9
- package/commands/qc-review.tmpl +2 -2
- package/commands/qc-run-test.md +75 -20
- package/commands/qc-run-test.tmpl +10 -3
- package/commands/refine-prd.md +47 -7
- package/commands/report-bug.md +63 -9
- package/commands/report-bug.tmpl +16 -2
- package/commands/review-code.md +47 -7
- package/commands/review-context.md +47 -7
- package/commands/review-tech-docs.md +50 -9
- package/commands/review-tech-docs.tmpl +3 -2
- package/commands/setup-ai-first.md +37 -4
- package/commands/setup-ai-first.tmpl +2 -2
- package/commands/sync.md +47 -11
- package/commands/sync.tmpl +12 -9
- package/commands/update-framework.md +35 -2
- package/commands/validate-traces.md +98 -40
- package/commands/validate-traces.tmpl +51 -33
- package/core/FRAMEWORK_VERSION +1 -1
- package/core/commands/debug.md +47 -7
- package/core/commands/define-product.md +47 -7
- package/core/commands/dev-gen-test.md +65 -17
- package/core/commands/dev-run-test.md +66 -18
- package/core/commands/dev-smoke-test.md +47 -7
- package/core/commands/fix-bug.md +83 -13
- package/core/commands/generate-bdd.md +74 -21
- package/core/commands/generate-code.md +118 -35
- package/core/commands/generate-design-spec.md +47 -7
- package/core/commands/generate-prd.md +47 -7
- package/core/commands/generate-spec-manifest.md +47 -7
- package/core/commands/generate-tech-docs.md +234 -20
- package/core/commands/learn.md +47 -7
- package/core/commands/map-testids.md +564 -0
- package/core/commands/propose-scenario.md +78 -18
- package/core/commands/qc-analyze.md +67 -12
- package/core/commands/qc-design-test.md +51 -10
- package/core/commands/qc-plan.md +50 -10
- package/core/commands/qc-report.md +60 -8
- package/core/commands/qc-review.md +49 -9
- package/core/commands/qc-run-test.md +75 -20
- package/core/commands/refine-prd.md +47 -7
- package/core/commands/report-bug.md +63 -9
- package/core/commands/review-code.md +47 -7
- package/core/commands/review-context.md +47 -7
- package/core/commands/review-tech-docs.md +50 -9
- package/core/commands/setup-ai-first.md +37 -4
- package/core/commands/sync.md +47 -11
- package/core/commands/update-framework.md +35 -2
- package/core/commands/validate-traces.md +98 -40
- package/core/modules/qc-playwright/stack-profile.yaml +4 -3
- package/core/skills/code/SKILL.md +82 -9
- package/core/skills/debug/SKILL.md +117 -11
- package/core/skills/design-spec/SKILL.md +47 -7
- package/core/skills/discovery/SKILL.md +47 -7
- package/core/skills/prd/SKILL.md +70 -4
- package/core/skills/qc/qa-analyst/acceptance-criteria.md +5 -1
- package/core/skills/qc/qa-analyst/business-rules.md +6 -2
- package/core/skills/qc/qa-analyst/data-flow.md +6 -2
- package/core/skills/qc/qa-analyst/spec-breakdown.md +7 -3
- package/core/skills/qc/qa-designer/e2e/journey.md +1 -1
- package/core/skills/qc/qa-designer/exploratory/charter.md +2 -2
- package/core/skills/qc/qa-designer/exploratory/explore-to-functional.md +1 -1
- package/core/skills/qc/qa-designer/functional/api.md +1 -1
- package/core/skills/qc/qa-designer/functional/gui-feature.md +1 -1
- package/core/skills/qc/qa-designer/functional/gui-screen.md +1 -1
- package/core/skills/qc/qa-designer/integration/api.md +1 -1
- package/core/skills/qc/qa-designer/integration/db.md +1 -1
- package/core/skills/qc/qa-designer/integration/gui.md +1 -1
- package/core/skills/qc/qa-designer/integration/kafka.md +1 -1
- package/core/skills/qc/qa-designer/non-functional.md +1 -1
- package/core/skills/qc/qa-planner/test-plan.md +4 -4
- package/core/skills/qc/qa-runner/exploratory/session.md +2 -2
- package/core/skills/setup-ai-first/SKILL.md +35 -2
- package/core/skills/spec/SKILL.md +70 -4
- package/core/skills/test/SKILL.md +129 -16
- package/core/steps/context-loader.md +12 -5
- package/core/steps/report-footer.md +35 -2
- package/core/steps/trace-mirror.md +18 -10
- package/core/templates/project-context.yaml +27 -6
- package/docs/01-getting-started/core-concepts.md +7 -7
- package/docs/01-getting-started/installation.md +4 -2
- package/docs/01-getting-started/quickstart.md +1 -1
- package/docs/02-guides/README.md +1 -2
- package/docs/02-guides/developer/README.md +1 -1
- package/docs/02-guides/developer/bdd-and-trace.md +10 -8
- package/docs/02-guides/developer/commands.md +4 -4
- package/docs/02-guides/developer/scenarios.md +26 -14
- package/docs/02-guides/developer/workflow.md +81 -19
- package/docs/02-guides/product-owner/README.md +6 -4
- package/docs/02-guides/product-owner/commands.md +1 -1
- package/docs/02-guides/product-owner/scenarios.md +80 -1
- package/docs/02-guides/tester/README.md +13 -10
- package/docs/02-guides/tester/bug-reporting.md +2 -2
- package/docs/02-guides/tester/qc-automation.md +165 -0
- package/docs/02-guides/tester/reading-specs.md +4 -4
- package/docs/02-guides/tester/scenarios.md +5 -5
- package/docs/02-guides/tester/spec-manifest.md +17 -12
- package/docs/02-guides/tester/test-checklist.md +3 -3
- package/docs/02-guides/tester/workflow.md +12 -14
- package/docs/03-concepts/architecture.md +7 -4
- package/docs/03-concepts/pipeline.md +37 -12
- package/docs/03-concepts/traceability.md +19 -18
- package/docs/04-operations/README.md +1 -1
- package/docs/04-operations/bug-flow.md +46 -5
- package/docs/04-operations/sync-and-update.md +186 -24
- package/docs/05-reference/README.md +3 -0
- package/docs/05-reference/command-cheatsheet.md +147 -0
- package/docs/05-reference/commands.md +73 -70
- package/docs/05-reference/modules.md +4 -4
- package/docs/05-reference/trace-schema.md +23 -16
- package/docs/README.md +3 -5
- package/modules/qc-playwright/stack-profile.yaml +4 -3
- package/package.json +1 -1
- package/skills/code/SKILL.md +82 -9
- package/skills/debug/SKILL.md +117 -11
- package/skills/design-spec/SKILL.md +47 -7
- package/skills/discovery/SKILL.md +47 -7
- package/skills/prd/SKILL.md +70 -4
- package/skills/qc/qa-analyst/acceptance-criteria.md +5 -1
- package/skills/qc/qa-analyst/business-rules.md +6 -2
- package/skills/qc/qa-analyst/data-flow.md +6 -2
- package/skills/qc/qa-analyst/spec-breakdown.md +7 -3
- package/skills/qc/qa-designer/e2e/journey.md +1 -1
- package/skills/qc/qa-designer/exploratory/charter.md +2 -2
- package/skills/qc/qa-designer/exploratory/explore-to-functional.md +1 -1
- package/skills/qc/qa-designer/functional/api.md +1 -1
- package/skills/qc/qa-designer/functional/gui-feature.md +1 -1
- package/skills/qc/qa-designer/functional/gui-screen.md +1 -1
- package/skills/qc/qa-designer/integration/api.md +1 -1
- package/skills/qc/qa-designer/integration/db.md +1 -1
- package/skills/qc/qa-designer/integration/gui.md +1 -1
- package/skills/qc/qa-designer/integration/kafka.md +1 -1
- package/skills/qc/qa-designer/non-functional.md +1 -1
- package/skills/qc/qa-planner/test-plan.md +4 -4
- package/skills/qc/qa-runner/exploratory/session.md +2 -2
- package/skills/setup-ai-first/SKILL.md +35 -2
- package/skills/spec/SKILL.md +70 -4
- package/skills/test/SKILL.md +129 -16
- package/steps/context-loader.md +12 -5
- package/steps/report-footer.md +35 -2
- package/steps/trace-mirror.md +18 -10
- package/templates/project-context.yaml +27 -6
- package/docs/02-guides/qc-automation.md +0 -92
package/commands/generate-prd.md
CHANGED
|
@@ -125,6 +125,8 @@ Read `.agent/project-context.yaml`. Extract and store:
|
|
|
125
125
|
- `paths.specs_dir` → BDD specs root
|
|
126
126
|
- `paths.prd_dir` → PRD documents root
|
|
127
127
|
- `paths.refinement_dir` → findings/review output dir
|
|
128
|
+
- `paths.qc_dir` → QC automation artifacts root (visible top-level, one subfolder per UC: `{qc_dir}/{UC-ID}/`)
|
|
129
|
+
- `paths.qc_skills_dir` → where qc-* commands load QC skills from (default bundled `.agent/skills/qc`; override to the QC team's own repo/submodule so framework upgrade won't overwrite them)
|
|
128
130
|
- `paths.product_definitions_dir` → product definitions root
|
|
129
131
|
- `paths.domain_knowledge_dir` → domain knowledge root
|
|
130
132
|
- `paths.business_dictionary` → path to business-dictionary.md
|
|
@@ -137,6 +139,8 @@ If `paths` section is absent, use these defaults:
|
|
|
137
139
|
- `specs_dir` = `specs/bdd`
|
|
138
140
|
- `prd_dir` = `specs/prd`
|
|
139
141
|
- `refinement_dir` = `.agent/review`
|
|
142
|
+
- `qc_dir` = `docs`
|
|
143
|
+
- `qc_skills_dir` = `.agent/skills/qc`
|
|
140
144
|
- `product_definitions_dir` = `specs/product-definition`
|
|
141
145
|
- `domain_knowledge_dir` = `specs/domain-knowledge`
|
|
142
146
|
- `business_dictionary` = `specs/domain-knowledge/business-dictionary.md`
|
|
@@ -162,7 +166,7 @@ If `services` section is present:
|
|
|
162
166
|
- If `$ARGUMENTS` contains a path, extract the segment after `prd_dir`
|
|
163
167
|
|
|
164
168
|
**2. Route to service** — if active domain matches a key in `services`:
|
|
165
|
-
- Override `paths.specs_dir` → `services.{domain}.specs_dir`
|
|
169
|
+
- Override `paths.specs_dir` → `services.{domain}.specs_dir` — **only if `setup.spec_source` is NOT set.** When `spec_source` IS set, ALL BDD (web/app/**system**) is a shared cross-team artifact → leave `specs_dir` for step 4 to route to the spec repo; do NOT pin it per-service here.
|
|
166
170
|
- 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.
|
|
167
171
|
- Store `active_service` = `services.{domain}.path`
|
|
168
172
|
- Store `active_service_module` = `services.{domain}.module`
|
|
@@ -173,6 +177,7 @@ If `services` section is present:
|
|
|
173
177
|
- Set `active_service = unresolved`
|
|
174
178
|
|
|
175
179
|
**4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
|
|
180
|
+
- Override `paths.specs_dir` → `{spec_source}/specs/bdd` — **always when `spec_source` is set.** All BDD (web/app/**system**) lives in the shared spec repo so every umbrella (FE/App/BE) reads the same scenarios; the FE tech-design gate + `/generate-code --phase=ui`/`--phase=integration` resolve the `system/` BDD here. *(Per-service `specs/bdd` only when there is no `spec_source`.)*
|
|
176
181
|
- Override `paths.prd_dir` → `{spec_source}/specs/prd`
|
|
177
182
|
- Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
|
|
178
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.)*
|
|
@@ -181,8 +186,10 @@ If `services` section is present:
|
|
|
181
186
|
- Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
|
|
182
187
|
- Override `paths.bug_reports_dir` → `{spec_source}/feedback/bug-reports`
|
|
183
188
|
- Override `paths.bdd_proposals_dir` → `{spec_source}/feedback/bdd-proposals`
|
|
189
|
+
- Override `paths.prd_change_requests_dir` → `{spec_source}/feedback/prd-change-requests`
|
|
190
|
+
- Override `paths.trace_dir` → `{spec_source}/.trace` — **always when `spec_source` is set.** Trace TSVs are consolidated in the spec repo (single authoritative location, no per-service split) so the PM/PO has one place to manage status. Code-side commands (`/generate-code`, `/dev-run-test`, `/qc-run-test`) run from `service_root` but **write their trace row into `{spec_source}/.trace`** — like they already push `feedback/` there. *(Per-service `.trace` only when there is no `spec_source`.)*
|
|
184
191
|
|
|
185
|
-
> **Why under `spec_source`:** PRD, design-spec, domain knowledge, the **API contract (tech-docs)**,
|
|
192
|
+
> **Why under `spec_source`:** PRD, design-spec, domain knowledge, **all BDD (web/app/system)**, the **API contract (tech-docs)**, tester feedback, **and the `.trace/` coverage state** are all **cross-team artifacts** — they live in the **shared spec repo** so every umbrella (FE/App/BE) and the PM read one source via `/sync`. The service submodule holds only **code** (+ build/test tooling). `.trace/` and `feedback/` are the dev/QC **write areas** in the spec repo (the PRD/BDD/design-spec/tech-docs there stay read-only for dev/QC — only PO edits those). In single-service mode (no `spec_source`), everything defaults under the repo root — still one repo.
|
|
186
193
|
|
|
187
194
|
---
|
|
188
195
|
|
|
@@ -202,12 +209,12 @@ When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-
|
|
|
202
209
|
|----------|--------|
|
|
203
210
|
| `conventions.test_command` | service's `conventions.test_command` |
|
|
204
211
|
| `conventions.build_command` | service's `conventions.build_command` |
|
|
205
|
-
| `paths.trace_dir` | `{active_service}/{service paths.trace_dir}`
|
|
206
|
-
| `paths.specs_dir` | `{active_service}/{service paths.specs_dir}`
|
|
212
|
+
| `paths.trace_dir` | **If `spec_source` is set → keep the Step 4 spec-repo route (`{spec_source}/.trace`); ignore any service-level `trace_dir`.** Only when there is no `spec_source`: `{active_service}/{service paths.trace_dir}` (default `{active_service}/.trace`). |
|
|
213
|
+
| `paths.specs_dir` | **If `spec_source` is set → keep the Step 4 spec-repo route (`{spec_source}/specs/bdd`); ignore any service-level `specs_dir`** (BDD is cross-team, never per-service in this mode). Only when there is no `spec_source`: `{active_service}/{service paths.specs_dir}` if set, else the Step 1.5 override. |
|
|
207
214
|
|
|
208
215
|
**3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
|
|
209
216
|
- Shell commands (`/dev-run-test`, `/dev-gen-test`) run **from within** `service_root`
|
|
210
|
-
-
|
|
217
|
+
- **Source/test files** are written relative to `service_root`; **trace TSVs** are written to `{paths.trace_dir}` (the spec repo when `spec_source` is set — a cross-repo write, committed/pushed to the spec submodule like `feedback/`).
|
|
211
218
|
|
|
212
219
|
**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).
|
|
213
220
|
|
|
@@ -639,6 +646,36 @@ Output Artifacts:
|
|
|
639
646
|
|
|
640
647
|
If no files were written (e.g., review or analysis commands) → write `Output Artifacts: none (read-only)`.
|
|
641
648
|
|
|
649
|
+
## Pipeline Position
|
|
650
|
+
|
|
651
|
+
Print a one-line map of the pipeline with the CURRENT command's phase marked `◀ bạn ở đây`,
|
|
652
|
+
so the user always sees where this command sits in the end-to-end flow:
|
|
653
|
+
|
|
654
|
+
```
|
|
655
|
+
Discovery → PRD → [Design Spec] → BDD → Tech Design → Code → Dev Self-Check → QC → Trace Audit
|
|
656
|
+
```
|
|
657
|
+
|
|
658
|
+
Find the current command in this phase legend and mark **its** phase in the map above:
|
|
659
|
+
|
|
660
|
+
| Phase | Commands |
|
|
661
|
+
|-------|----------|
|
|
662
|
+
| Discovery | `/define-product` |
|
|
663
|
+
| PRD | `/generate-prd` · `/refine-prd` · `/review-context` (PRD) |
|
|
664
|
+
| Design Spec | `/generate-design-spec` |
|
|
665
|
+
| BDD | `/generate-bdd` · `/review-context` (BDD) |
|
|
666
|
+
| Tech Design | `/generate-tech-docs` · `/map-testids` · `/review-tech-docs` |
|
|
667
|
+
| Code | `/generate-code` · `/review-code` |
|
|
668
|
+
| Dev Self-Check | `/dev-gen-test` · `/dev-run-test` · `/dev-smoke-test` |
|
|
669
|
+
| QC | `/qc-analyze` · `/qc-plan` · `/qc-design-test` · `/qc-review` · `/qc-run-test` · `/qc-report` |
|
|
670
|
+
| Trace Audit | `/validate-traces` |
|
|
671
|
+
|
|
672
|
+
For a **review command**, also append the 3-step review loop with the current step marked, e.g.:
|
|
673
|
+
`Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume`.
|
|
674
|
+
|
|
675
|
+
**Cross-cutting commands** (`/sync`, `/update-framework`, `/fix-bug`, `/debug`, `/learn`,
|
|
676
|
+
`/report-bug`, `/propose-scenario`, `/generate-spec-manifest`) sit outside the linear pipeline —
|
|
677
|
+
**omit the Pipeline line entirely** for these (do not force-fit them onto the map).
|
|
678
|
+
|
|
642
679
|
## Next Command Suggestion
|
|
643
680
|
|
|
644
681
|
Suggest the logical next command based on workflow phase:
|
|
@@ -680,10 +717,13 @@ Suggest the logical next command based on workflow phase:
|
|
|
680
717
|
Format the footer as:
|
|
681
718
|
```
|
|
682
719
|
---
|
|
683
|
-
Status
|
|
720
|
+
Status : {badge}
|
|
684
721
|
{Output Artifacts block}
|
|
685
|
-
|
|
722
|
+
Pipeline : Discovery → PRD → [BDD ◀ bạn ở đây] → Tech Design → Code → Dev Self-Check → QC → Trace Audit
|
|
723
|
+
(review cmd) Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume
|
|
724
|
+
Next : {suggested command with example arguments}
|
|
686
725
|
```
|
|
726
|
+
*(Omit the `Pipeline` line for cross-cutting commands listed above.)*
|
|
687
727
|
|
|
688
728
|
|
|
689
729
|
```
|
|
@@ -130,6 +130,8 @@ Read `.agent/project-context.yaml`. Extract and store:
|
|
|
130
130
|
- `paths.specs_dir` → BDD specs root
|
|
131
131
|
- `paths.prd_dir` → PRD documents root
|
|
132
132
|
- `paths.refinement_dir` → findings/review output dir
|
|
133
|
+
- `paths.qc_dir` → QC automation artifacts root (visible top-level, one subfolder per UC: `{qc_dir}/{UC-ID}/`)
|
|
134
|
+
- `paths.qc_skills_dir` → where qc-* commands load QC skills from (default bundled `.agent/skills/qc`; override to the QC team's own repo/submodule so framework upgrade won't overwrite them)
|
|
133
135
|
- `paths.product_definitions_dir` → product definitions root
|
|
134
136
|
- `paths.domain_knowledge_dir` → domain knowledge root
|
|
135
137
|
- `paths.business_dictionary` → path to business-dictionary.md
|
|
@@ -142,6 +144,8 @@ If `paths` section is absent, use these defaults:
|
|
|
142
144
|
- `specs_dir` = `specs/bdd`
|
|
143
145
|
- `prd_dir` = `specs/prd`
|
|
144
146
|
- `refinement_dir` = `.agent/review`
|
|
147
|
+
- `qc_dir` = `docs`
|
|
148
|
+
- `qc_skills_dir` = `.agent/skills/qc`
|
|
145
149
|
- `product_definitions_dir` = `specs/product-definition`
|
|
146
150
|
- `domain_knowledge_dir` = `specs/domain-knowledge`
|
|
147
151
|
- `business_dictionary` = `specs/domain-knowledge/business-dictionary.md`
|
|
@@ -167,7 +171,7 @@ If `services` section is present:
|
|
|
167
171
|
- If `$ARGUMENTS` contains a path, extract the segment after `prd_dir`
|
|
168
172
|
|
|
169
173
|
**2. Route to service** — if active domain matches a key in `services`:
|
|
170
|
-
- Override `paths.specs_dir` → `services.{domain}.specs_dir`
|
|
174
|
+
- Override `paths.specs_dir` → `services.{domain}.specs_dir` — **only if `setup.spec_source` is NOT set.** When `spec_source` IS set, ALL BDD (web/app/**system**) is a shared cross-team artifact → leave `specs_dir` for step 4 to route to the spec repo; do NOT pin it per-service here.
|
|
171
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.
|
|
172
176
|
- Store `active_service` = `services.{domain}.path`
|
|
173
177
|
- Store `active_service_module` = `services.{domain}.module`
|
|
@@ -178,6 +182,7 @@ If `services` section is present:
|
|
|
178
182
|
- Set `active_service = unresolved`
|
|
179
183
|
|
|
180
184
|
**4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
|
|
185
|
+
- Override `paths.specs_dir` → `{spec_source}/specs/bdd` — **always when `spec_source` is set.** All BDD (web/app/**system**) lives in the shared spec repo so every umbrella (FE/App/BE) reads the same scenarios; the FE tech-design gate + `/generate-code --phase=ui`/`--phase=integration` resolve the `system/` BDD here. *(Per-service `specs/bdd` only when there is no `spec_source`.)*
|
|
181
186
|
- Override `paths.prd_dir` → `{spec_source}/specs/prd`
|
|
182
187
|
- Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
|
|
183
188
|
- 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.)*
|
|
@@ -186,8 +191,10 @@ If `services` section is present:
|
|
|
186
191
|
- Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
|
|
187
192
|
- Override `paths.bug_reports_dir` → `{spec_source}/feedback/bug-reports`
|
|
188
193
|
- Override `paths.bdd_proposals_dir` → `{spec_source}/feedback/bdd-proposals`
|
|
194
|
+
- Override `paths.prd_change_requests_dir` → `{spec_source}/feedback/prd-change-requests`
|
|
195
|
+
- Override `paths.trace_dir` → `{spec_source}/.trace` — **always when `spec_source` is set.** Trace TSVs are consolidated in the spec repo (single authoritative location, no per-service split) so the PM/PO has one place to manage status. Code-side commands (`/generate-code`, `/dev-run-test`, `/qc-run-test`) run from `service_root` but **write their trace row into `{spec_source}/.trace`** — like they already push `feedback/` there. *(Per-service `.trace` only when there is no `spec_source`.)*
|
|
189
196
|
|
|
190
|
-
> **Why under `spec_source`:** PRD, design-spec, domain knowledge, the **API contract (tech-docs)**,
|
|
197
|
+
> **Why under `spec_source`:** PRD, design-spec, domain knowledge, **all BDD (web/app/system)**, the **API contract (tech-docs)**, tester feedback, **and the `.trace/` coverage state** are all **cross-team artifacts** — they live in the **shared spec repo** so every umbrella (FE/App/BE) and the PM read one source via `/sync`. The service submodule holds only **code** (+ build/test tooling). `.trace/` and `feedback/` are the dev/QC **write areas** in the spec repo (the PRD/BDD/design-spec/tech-docs there stay read-only for dev/QC — only PO edits those). In single-service mode (no `spec_source`), everything defaults under the repo root — still one repo.
|
|
191
198
|
|
|
192
199
|
---
|
|
193
200
|
|
|
@@ -207,12 +214,12 @@ When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-
|
|
|
207
214
|
|----------|--------|
|
|
208
215
|
| `conventions.test_command` | service's `conventions.test_command` |
|
|
209
216
|
| `conventions.build_command` | service's `conventions.build_command` |
|
|
210
|
-
| `paths.trace_dir` | `{active_service}/{service paths.trace_dir}`
|
|
211
|
-
| `paths.specs_dir` | `{active_service}/{service paths.specs_dir}`
|
|
217
|
+
| `paths.trace_dir` | **If `spec_source` is set → keep the Step 4 spec-repo route (`{spec_source}/.trace`); ignore any service-level `trace_dir`.** Only when there is no `spec_source`: `{active_service}/{service paths.trace_dir}` (default `{active_service}/.trace`). |
|
|
218
|
+
| `paths.specs_dir` | **If `spec_source` is set → keep the Step 4 spec-repo route (`{spec_source}/specs/bdd`); ignore any service-level `specs_dir`** (BDD is cross-team, never per-service in this mode). Only when there is no `spec_source`: `{active_service}/{service paths.specs_dir}` if set, else the Step 1.5 override. |
|
|
212
219
|
|
|
213
220
|
**3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
|
|
214
221
|
- Shell commands (`/dev-run-test`, `/dev-gen-test`) run **from within** `service_root`
|
|
215
|
-
-
|
|
222
|
+
- **Source/test files** are written relative to `service_root`; **trace TSVs** are written to `{paths.trace_dir}` (the spec repo when `spec_source` is set — a cross-repo write, committed/pushed to the spec submodule like `feedback/`).
|
|
216
223
|
|
|
217
224
|
**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).
|
|
218
225
|
|
|
@@ -536,6 +543,36 @@ Output Artifacts:
|
|
|
536
543
|
|
|
537
544
|
If no files were written (e.g., review or analysis commands) → write `Output Artifacts: none (read-only)`.
|
|
538
545
|
|
|
546
|
+
## Pipeline Position
|
|
547
|
+
|
|
548
|
+
Print a one-line map of the pipeline with the CURRENT command's phase marked `◀ bạn ở đây`,
|
|
549
|
+
so the user always sees where this command sits in the end-to-end flow:
|
|
550
|
+
|
|
551
|
+
```
|
|
552
|
+
Discovery → PRD → [Design Spec] → BDD → Tech Design → Code → Dev Self-Check → QC → Trace Audit
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
Find the current command in this phase legend and mark **its** phase in the map above:
|
|
556
|
+
|
|
557
|
+
| Phase | Commands |
|
|
558
|
+
|-------|----------|
|
|
559
|
+
| Discovery | `/define-product` |
|
|
560
|
+
| PRD | `/generate-prd` · `/refine-prd` · `/review-context` (PRD) |
|
|
561
|
+
| Design Spec | `/generate-design-spec` |
|
|
562
|
+
| BDD | `/generate-bdd` · `/review-context` (BDD) |
|
|
563
|
+
| Tech Design | `/generate-tech-docs` · `/map-testids` · `/review-tech-docs` |
|
|
564
|
+
| Code | `/generate-code` · `/review-code` |
|
|
565
|
+
| Dev Self-Check | `/dev-gen-test` · `/dev-run-test` · `/dev-smoke-test` |
|
|
566
|
+
| QC | `/qc-analyze` · `/qc-plan` · `/qc-design-test` · `/qc-review` · `/qc-run-test` · `/qc-report` |
|
|
567
|
+
| Trace Audit | `/validate-traces` |
|
|
568
|
+
|
|
569
|
+
For a **review command**, also append the 3-step review loop with the current step marked, e.g.:
|
|
570
|
+
`Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume`.
|
|
571
|
+
|
|
572
|
+
**Cross-cutting commands** (`/sync`, `/update-framework`, `/fix-bug`, `/debug`, `/learn`,
|
|
573
|
+
`/report-bug`, `/propose-scenario`, `/generate-spec-manifest`) sit outside the linear pipeline —
|
|
574
|
+
**omit the Pipeline line entirely** for these (do not force-fit them onto the map).
|
|
575
|
+
|
|
539
576
|
## Next Command Suggestion
|
|
540
577
|
|
|
541
578
|
Suggest the logical next command based on workflow phase:
|
|
@@ -577,10 +614,13 @@ Suggest the logical next command based on workflow phase:
|
|
|
577
614
|
Format the footer as:
|
|
578
615
|
```
|
|
579
616
|
---
|
|
580
|
-
Status
|
|
617
|
+
Status : {badge}
|
|
581
618
|
{Output Artifacts block}
|
|
582
|
-
|
|
619
|
+
Pipeline : Discovery → PRD → [BDD ◀ bạn ở đây] → Tech Design → Code → Dev Self-Check → QC → Trace Audit
|
|
620
|
+
(review cmd) Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume
|
|
621
|
+
Next : {suggested command with example arguments}
|
|
583
622
|
```
|
|
623
|
+
*(Omit the `Pipeline` line for cross-cutting commands listed above.)*
|
|
584
624
|
|
|
585
625
|
|
|
586
626
|
```
|
|
@@ -146,6 +146,8 @@ Read `.agent/project-context.yaml`. Extract and store:
|
|
|
146
146
|
- `paths.specs_dir` → BDD specs root
|
|
147
147
|
- `paths.prd_dir` → PRD documents root
|
|
148
148
|
- `paths.refinement_dir` → findings/review output dir
|
|
149
|
+
- `paths.qc_dir` → QC automation artifacts root (visible top-level, one subfolder per UC: `{qc_dir}/{UC-ID}/`)
|
|
150
|
+
- `paths.qc_skills_dir` → where qc-* commands load QC skills from (default bundled `.agent/skills/qc`; override to the QC team's own repo/submodule so framework upgrade won't overwrite them)
|
|
149
151
|
- `paths.product_definitions_dir` → product definitions root
|
|
150
152
|
- `paths.domain_knowledge_dir` → domain knowledge root
|
|
151
153
|
- `paths.business_dictionary` → path to business-dictionary.md
|
|
@@ -158,6 +160,8 @@ If `paths` section is absent, use these defaults:
|
|
|
158
160
|
- `specs_dir` = `specs/bdd`
|
|
159
161
|
- `prd_dir` = `specs/prd`
|
|
160
162
|
- `refinement_dir` = `.agent/review`
|
|
163
|
+
- `qc_dir` = `docs`
|
|
164
|
+
- `qc_skills_dir` = `.agent/skills/qc`
|
|
161
165
|
- `product_definitions_dir` = `specs/product-definition`
|
|
162
166
|
- `domain_knowledge_dir` = `specs/domain-knowledge`
|
|
163
167
|
- `business_dictionary` = `specs/domain-knowledge/business-dictionary.md`
|
|
@@ -183,7 +187,7 @@ If `services` section is present:
|
|
|
183
187
|
- If `$ARGUMENTS` contains a path, extract the segment after `prd_dir`
|
|
184
188
|
|
|
185
189
|
**2. Route to service** — if active domain matches a key in `services`:
|
|
186
|
-
- Override `paths.specs_dir` → `services.{domain}.specs_dir`
|
|
190
|
+
- Override `paths.specs_dir` → `services.{domain}.specs_dir` — **only if `setup.spec_source` is NOT set.** When `spec_source` IS set, ALL BDD (web/app/**system**) is a shared cross-team artifact → leave `specs_dir` for step 4 to route to the spec repo; do NOT pin it per-service here.
|
|
187
191
|
- 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
192
|
- Store `active_service` = `services.{domain}.path`
|
|
189
193
|
- Store `active_service_module` = `services.{domain}.module`
|
|
@@ -194,6 +198,7 @@ If `services` section is present:
|
|
|
194
198
|
- Set `active_service = unresolved`
|
|
195
199
|
|
|
196
200
|
**4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
|
|
201
|
+
- Override `paths.specs_dir` → `{spec_source}/specs/bdd` — **always when `spec_source` is set.** All BDD (web/app/**system**) lives in the shared spec repo so every umbrella (FE/App/BE) reads the same scenarios; the FE tech-design gate + `/generate-code --phase=ui`/`--phase=integration` resolve the `system/` BDD here. *(Per-service `specs/bdd` only when there is no `spec_source`.)*
|
|
197
202
|
- Override `paths.prd_dir` → `{spec_source}/specs/prd`
|
|
198
203
|
- Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
|
|
199
204
|
- 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.)*
|
|
@@ -202,8 +207,10 @@ If `services` section is present:
|
|
|
202
207
|
- Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
|
|
203
208
|
- Override `paths.bug_reports_dir` → `{spec_source}/feedback/bug-reports`
|
|
204
209
|
- Override `paths.bdd_proposals_dir` → `{spec_source}/feedback/bdd-proposals`
|
|
210
|
+
- Override `paths.prd_change_requests_dir` → `{spec_source}/feedback/prd-change-requests`
|
|
211
|
+
- Override `paths.trace_dir` → `{spec_source}/.trace` — **always when `spec_source` is set.** Trace TSVs are consolidated in the spec repo (single authoritative location, no per-service split) so the PM/PO has one place to manage status. Code-side commands (`/generate-code`, `/dev-run-test`, `/qc-run-test`) run from `service_root` but **write their trace row into `{spec_source}/.trace`** — like they already push `feedback/` there. *(Per-service `.trace` only when there is no `spec_source`.)*
|
|
205
212
|
|
|
206
|
-
> **Why under `spec_source`:** PRD, design-spec, domain knowledge, the **API contract (tech-docs)**,
|
|
213
|
+
> **Why under `spec_source`:** PRD, design-spec, domain knowledge, **all BDD (web/app/system)**, the **API contract (tech-docs)**, tester feedback, **and the `.trace/` coverage state** are all **cross-team artifacts** — they live in the **shared spec repo** so every umbrella (FE/App/BE) and the PM read one source via `/sync`. The service submodule holds only **code** (+ build/test tooling). `.trace/` and `feedback/` are the dev/QC **write areas** in the spec repo (the PRD/BDD/design-spec/tech-docs there stay read-only for dev/QC — only PO edits those). In single-service mode (no `spec_source`), everything defaults under the repo root — still one repo.
|
|
207
214
|
|
|
208
215
|
---
|
|
209
216
|
|
|
@@ -223,12 +230,12 @@ When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-
|
|
|
223
230
|
|----------|--------|
|
|
224
231
|
| `conventions.test_command` | service's `conventions.test_command` |
|
|
225
232
|
| `conventions.build_command` | service's `conventions.build_command` |
|
|
226
|
-
| `paths.trace_dir` | `{active_service}/{service paths.trace_dir}`
|
|
227
|
-
| `paths.specs_dir` | `{active_service}/{service paths.specs_dir}`
|
|
233
|
+
| `paths.trace_dir` | **If `spec_source` is set → keep the Step 4 spec-repo route (`{spec_source}/.trace`); ignore any service-level `trace_dir`.** Only when there is no `spec_source`: `{active_service}/{service paths.trace_dir}` (default `{active_service}/.trace`). |
|
|
234
|
+
| `paths.specs_dir` | **If `spec_source` is set → keep the Step 4 spec-repo route (`{spec_source}/specs/bdd`); ignore any service-level `specs_dir`** (BDD is cross-team, never per-service in this mode). Only when there is no `spec_source`: `{active_service}/{service paths.specs_dir}` if set, else the Step 1.5 override. |
|
|
228
235
|
|
|
229
236
|
**3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
|
|
230
237
|
- Shell commands (`/dev-run-test`, `/dev-gen-test`) run **from within** `service_root`
|
|
231
|
-
-
|
|
238
|
+
- **Source/test files** are written relative to `service_root`; **trace TSVs** are written to `{paths.trace_dir}` (the spec repo when `spec_source` is set — a cross-repo write, committed/pushed to the spec submodule like `feedback/`).
|
|
232
239
|
|
|
233
240
|
**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).
|
|
234
241
|
|
|
@@ -405,10 +412,57 @@ After completing all steps, you have loaded:
|
|
|
405
412
|
Proceed to the next step of the calling command.
|
|
406
413
|
|
|
407
414
|
|
|
415
|
+
---
|
|
416
|
+
|
|
417
|
+
## Step 0 — Detect Platform & Route Output
|
|
418
|
+
|
|
419
|
+
Read `@trace.platform` from the feature file header (`web` | `app` | `system`). If absent, fall back to `platform_type` from context (`web-frontend`/`mobile` → FE; `backend` → BE).
|
|
420
|
+
|
|
421
|
+
| Platform | `active_tech_design` | Output file |
|
|
422
|
+
|----------|----------------------|-------------|
|
|
423
|
+
| `system` / backend | **`be`** — the cross-team **API contract** (authoritative) | `{paths.tech_docs_dir}/{domain}/{UC-ID}-tech-design.md` |
|
|
424
|
+
| `web` / `app` (web-frontend / mobile) | **`fe`** — the **client technical design** (consumes the BE contract) | `{paths.tech_docs_dir}/{domain}/{UC-ID}-tech-design-{platform}.md` |
|
|
425
|
+
|
|
426
|
+
Store `active_tech_design` and `tech_design_path`. The `-{platform}` suffix (mirroring design-spec) keeps the FE doc from colliding with the BE contract — both live in the shared spec repo when `spec_source` is set.
|
|
427
|
+
|
|
428
|
+
---
|
|
429
|
+
|
|
430
|
+
## Step 0.5 — FE/App Precondition Gate
|
|
431
|
+
|
|
432
|
+
*Skip this entire step for BE (`active_tech_design = be`).*
|
|
433
|
+
|
|
434
|
+
An FE/App technical design is a **derived** artifact: its API-integration layer maps onto the locked BE contract, and its state/error model comes from the system behavior. Both upstream inputs MUST exist first — **HALT** if either is missing:
|
|
435
|
+
|
|
436
|
+
1. **System BDD** — locate `{paths.specs_dir}/{domain}/system/{TICKET-ID}*.feature`.
|
|
437
|
+
If not found → HALT:
|
|
438
|
+
```
|
|
439
|
+
❌ Cannot generate FE tech-design — System BDD not found for {TICKET-ID}.
|
|
440
|
+
The FE design needs the system-level (BE-facing) behavior first.
|
|
441
|
+
→ PO/BE: /generate-bdd {prd-file} (produces the `system/` platform BDD)
|
|
442
|
+
```
|
|
443
|
+
2. **BE tech-docs (API contract)** — locate the BE doc `{paths.tech_docs_dir}/{domain}/{UC-ID}-tech-design.md` and read its `@trace.status`.
|
|
444
|
+
- Not found → HALT:
|
|
445
|
+
```
|
|
446
|
+
❌ Cannot generate FE tech-design — BE API contract not found.
|
|
447
|
+
The FE integration layer maps to the BE contract; it must exist first.
|
|
448
|
+
→ BE: /generate-tech-docs {system .feature} → /review-tech-docs (approve) → publish to spec repo
|
|
449
|
+
```
|
|
450
|
+
- Found but `@trace.status` ≠ `approved` → WARN and ask:
|
|
451
|
+
```
|
|
452
|
+
⚠️ BE contract {UC-ID}-tech-design.md is status: {status} (not approved) — it may still change.
|
|
453
|
+
Designing the FE integration against a non-final contract risks rework.
|
|
454
|
+
Continue anyway? (Y/N)
|
|
455
|
+
```
|
|
456
|
+
- Y → proceed (accept risk) · N → stop, wait for BE to approve.
|
|
457
|
+
|
|
458
|
+
Store `system_bdd_path` and `be_contract_path` — they are the primary inputs for the FE §3/§4 below.
|
|
459
|
+
|
|
408
460
|
---
|
|
409
461
|
|
|
410
462
|
## Brownfield Check
|
|
411
463
|
|
|
464
|
+
*BE (`active_tech_design = be`) only — for FE the "existing contract" is the BE doc loaded in Step 0.5.*
|
|
465
|
+
|
|
412
466
|
Read the source `.feature` file header for `@trace.api_source`.
|
|
413
467
|
Also check the source PRD Metadata table for `| **API Source** | existing |`.
|
|
414
468
|
|
|
@@ -425,10 +479,11 @@ If `active_mode = reverse-document` → load bảng "Existing API Contract" từ
|
|
|
425
479
|
|
|
426
480
|
## CHECKPOINT — Tech Design Plan
|
|
427
481
|
|
|
428
|
-
Before generating, scan the feature file for scenario count, referenced BRs, and entities. Display and wait for Y:
|
|
482
|
+
Before generating, scan the feature file for scenario count, referenced BRs, and entities. Display the plan for the resolved `active_tech_design` and wait for Y:
|
|
429
483
|
|
|
484
|
+
**If `active_tech_design = be`:**
|
|
430
485
|
```
|
|
431
|
-
Tech Design Plan — {UC-ID}
|
|
486
|
+
Tech Design Plan — {UC-ID} (BE · API contract)
|
|
432
487
|
──────────────────────────────────────────────────────
|
|
433
488
|
UC : {UC-ID} — {feature title}
|
|
434
489
|
Service : {trace.service}
|
|
@@ -452,12 +507,42 @@ Sections to generate:
|
|
|
452
507
|
Proceed? (Y/N)
|
|
453
508
|
```
|
|
454
509
|
|
|
510
|
+
**If `active_tech_design = fe`:**
|
|
511
|
+
```
|
|
512
|
+
Tech Design Plan — {UC-ID} (FE · {platform} · client design)
|
|
513
|
+
──────────────────────────────────────────────────────
|
|
514
|
+
UC : {UC-ID} — {feature title}
|
|
515
|
+
Service : {trace.service} Module: {trace.module} ({platform})
|
|
516
|
+
Inputs : System BDD → {system_bdd_path}
|
|
517
|
+
BE contract → {be_contract_path} (status: {be status})
|
|
518
|
+
Scenarios : {N} FE scenarios | BDD ver: {trace.bdd_version}
|
|
519
|
+
Output : {paths.tech_docs_dir}/{domain}/{UC-ID}-tech-design-{platform}.md
|
|
520
|
+
|
|
521
|
+
Sections to generate:
|
|
522
|
+
§1 Overview (FE scope of this UC)
|
|
523
|
+
§2 Component Architecture (tree + reuse from figma-components catalog)
|
|
524
|
+
§2b Test Selectors (stable test-id cho element có action — QC contract, attr theo platform)
|
|
525
|
+
§3 State Management (store/slices/state shape ← System BDD Then-clauses)
|
|
526
|
+
§4 API Integration Layer (port/adapter: each BE endpoint → FE service → DTO/model)
|
|
527
|
+
§5 Routing / Navigation
|
|
528
|
+
§6 Data Fetching & Client Caching (query keys, invalidation, optimistic updates)
|
|
529
|
+
§7 Error & Loading States (per scenario)
|
|
530
|
+
§8 Cross-Cutting (auth token, i18n, feature flags)
|
|
531
|
+
{§9 Offline / platform specifics — app only}
|
|
532
|
+
──────────────────────────────────────────────────────
|
|
533
|
+
Proceed? (Y/N)
|
|
534
|
+
```
|
|
535
|
+
|
|
455
536
|
Wait for explicit "Y" before generating.
|
|
456
537
|
|
|
457
538
|
---
|
|
458
539
|
|
|
459
540
|
## Generate
|
|
460
541
|
|
|
542
|
+
Generate the document for the resolved `active_tech_design`.
|
|
543
|
+
|
|
544
|
+
### Path A — BE API contract (`active_tech_design = be`)
|
|
545
|
+
|
|
461
546
|
Write `{paths.tech_docs_dir}/{domain}/{UC-ID}-tech-design.md`:
|
|
462
547
|
|
|
463
548
|
```markdown
|
|
@@ -528,17 +613,111 @@ External calls, events produced/consumed.
|
|
|
528
613
|
| 1 | {YYYY-MM-DD} | Initial generation from {UC-ID}.feature (BDD v{bdd_version}) |
|
|
529
614
|
```
|
|
530
615
|
|
|
531
|
-
|
|
616
|
+
### Path B — FE/App client technical design (`active_tech_design = fe`)
|
|
617
|
+
|
|
618
|
+
Write `{paths.tech_docs_dir}/{domain}/{UC-ID}-tech-design-{platform}.md`. The §4 integration layer maps **directly onto the BE contract** loaded in Step 0.5 — every FE service method must trace to a real endpoint in `{be_contract_path}` (no invented endpoints). State and error models in §3/§7 derive from the **System BDD** `Then` clauses.
|
|
619
|
+
|
|
620
|
+
```markdown
|
|
621
|
+
# FE Technical Design — {UC-ID} ({platform}): {Feature}
|
|
622
|
+
|
|
623
|
+
---
|
|
624
|
+
@trace.id: {UC-ID}
|
|
625
|
+
@trace.domain: {domain}
|
|
626
|
+
@trace.platform: {web | app}
|
|
627
|
+
@trace.service: {read @trace.service from the .feature file header}
|
|
628
|
+
@trace.module: {read @trace.module — e.g. react / nextjs / vue / angular / flutter}
|
|
629
|
+
@trace.prd: {TICKET-ID}
|
|
630
|
+
@trace.bdd_version: {read @trace.bdd_version from the FE .feature header}
|
|
631
|
+
@trace.system_bdd: {system_bdd_path}
|
|
632
|
+
@trace.be_contract: {UC-ID}-tech-design.md # the BE API contract this design consumes
|
|
633
|
+
@trace.testid_attr: {data-testid (web) | testID (react-native) | Key/Semantics (flutter) | accessibilityIdentifier (native-ios)}
|
|
634
|
+
@trace.revision: 1
|
|
635
|
+
@trace.status: draft
|
|
636
|
+
@trace.generated_at: {YYYY-MM-DD}
|
|
637
|
+
---
|
|
638
|
+
|
|
639
|
+
## §1. Overview
|
|
640
|
+
|
|
641
|
+
{FE scope của UC: màn hình/luồng nào, render gì, tích hợp API nào. Nêu rõ design này map theo BE contract {UC-ID}-tech-design.md.}
|
|
642
|
+
|
|
643
|
+
## §2. Component Architecture
|
|
644
|
+
|
|
645
|
+
Component tree (container vs presentational). Ưu tiên tái dùng từ figma-components catalog (Step 6-B context); chỉ tạo mới khi không có sẵn.
|
|
646
|
+
|
|
647
|
+
| Component | Type | Reuse (catalog) / New | Responsibility |
|
|
648
|
+
|-----------|------|-----------------------|----------------|
|
|
649
|
+
| {Name} | container/presentational | {catalog name \| NEW} | {what it renders / handles} |
|
|
650
|
+
|
|
651
|
+
## §2b. Test Selectors — Element IDs cho element CÓ ACTION (QC contract)
|
|
652
|
+
|
|
653
|
+
Mỗi element tương tác (button, input, link, select, toggle, form-submit…) được gán **test-id ổn định** để QC locate **trực tiếp** — không scan/giả lập runtime. Đây là contract giữa FE code (emit id) và QC Page Object (đọc id).
|
|
654
|
+
|
|
655
|
+
- **Quy ước (semantic-stable):** `{uc-lower}-{screen}-{element}-{type}` — vd `ft001-login-submit-btn`, `ft001-login-email-input`. **KHÔNG** nhúng số scenario (đổi khi renumber).
|
|
656
|
+
- **Attribute theo platform** (`@trace.testid_attr`): web `data-testid` · React Native `testID` · Flutter `Key('id')` + `Semantics(identifier:)` · native iOS `accessibilityIdentifier`.
|
|
657
|
+
- **Cross-platform (web ↔ app):** cùng một element logic dùng **CÙNG test-id value** trên cả web và app — chỉ *attribute* khác theo platform. Mỗi platform có file tech-design riêng (`-web.md` / `-app.md`) với §2b riêng, nhưng id value phải khớp để QC tái dùng logic test và 2 doc không lệch. Khi gen platform thứ hai, **đọc §2b của file platform kia** và tái dùng id đã có; chỉ thêm id cho element mà platform này có riêng.
|
|
658
|
+
- Chỉ gán cho element **có action**; element tĩnh (label, text thuần) không cần.
|
|
659
|
+
|
|
660
|
+
| Test-ID | Element | Component (§2) | Action | Serves SC |
|
|
661
|
+
|---------|---------|----------------|--------|-----------|
|
|
662
|
+
| `{uc}-{screen}-{element}-{type}` | {Submit button} | {LoginForm} | {submit login} | SC1, SC3 |
|
|
663
|
+
|
|
664
|
+
> QC: Page Object locator lấy test-id từ bảng này (ưu tiên `data-testid`/attribute tương ứng). Element có action mà **chưa** có test-id ở đây → QC fallback role/text (chậm hơn) và nên bổ sung vào bảng này.
|
|
665
|
+
>
|
|
666
|
+
> **Element từ component reuse / code có sẵn (brownfield):** id sống ở **usage site**, component dùng chung phải *forward* được test-id. Đừng tự bịa ở đây — chạy `/map-testids {UC-ID}` để reverse-document id đang có, gán id còn thiếu, patch forwarding + ghi catalog, rồi điền §2b này. Lệnh này chỉ tự gán id cho component **mới**.
|
|
667
|
+
|
|
668
|
+
## §3. State Management
|
|
669
|
+
|
|
670
|
+
State shape suy ra từ System BDD `Then` clauses + response shapes trong BE contract. Nêu store/slices, server-state vs UI-state.
|
|
671
|
+
|
|
672
|
+
| Slice / Key | Shape | Nguồn (BE field / local) | Updated by |
|
|
673
|
+
|-------------|-------|--------------------------|------------|
|
|
674
|
+
|
|
675
|
+
## §4. API Integration Layer (port/adapter)
|
|
676
|
+
|
|
677
|
+
**Mỗi method phải map tới một endpoint CÓ THẬT trong BE contract `{UC-ID}-tech-design.md`.** Đây là hợp đồng thay thế mock adapter của `/generate-code --phase=ui`.
|
|
678
|
+
|
|
679
|
+
| FE service method | BE endpoint (từ contract) | Request map | Response → model | Error → UI |
|
|
680
|
+
|-------------------|---------------------------|-------------|------------------|-----------|
|
|
681
|
+
| {svc.getX()} | {GET /api/v1/...} | {params} | {DTO → ViewModel} | {4xx/5xx → state/toast} |
|
|
682
|
+
|
|
683
|
+
## §5. Routing / Navigation
|
|
684
|
+
|
|
685
|
+
Routes / màn hình, params, guards (auth/role), lazy-load.
|
|
686
|
+
|
|
687
|
+
## §6. Data Fetching & Client Caching
|
|
688
|
+
|
|
689
|
+
Query keys, cache invalidation triggers, optimistic updates, refetch policy (client-side — KHÔNG phải server cache).
|
|
690
|
+
|
|
691
|
+
## §7. Error & Loading States
|
|
692
|
+
|
|
693
|
+
| Scenario (BDD) | Loading UI | Error UI | Empty state |
|
|
694
|
+
|----------------|-----------|----------|-------------|
|
|
695
|
+
|
|
696
|
+
## §8. Cross-Cutting
|
|
697
|
+
|
|
698
|
+
Auth token injection/refresh, i18n keys, feature flags, analytics events.
|
|
699
|
+
|
|
700
|
+
{## §9. Offline / Platform Specifics — app only}
|
|
701
|
+
{Cached-data behavior, offline banner, background sync, platform permissions.}
|
|
702
|
+
|
|
703
|
+
## Changelog
|
|
704
|
+
|
|
705
|
+
| Revision | Date | Changes |
|
|
706
|
+
|----------|------|---------|
|
|
707
|
+
| 1 | {YYYY-MM-DD} | Initial FE design from {UC-ID} ({platform}) BDD v{bdd_version}, mapping BE contract {UC-ID}-tech-design.md |
|
|
708
|
+
```
|
|
709
|
+
|
|
710
|
+
## Publish — share the doc (umbrella + shared spec repo)
|
|
532
711
|
|
|
533
|
-
If `paths.tech_docs_dir` resolved **under `setup.spec_source`** (e.g. `{spec_source}/specs/tech-docs`), the
|
|
712
|
+
If `paths.tech_docs_dir` resolved **under `setup.spec_source`** (e.g. `{spec_source}/specs/tech-docs`), the doc was just written **inside the spec submodule**. Publish it (2-layer commit) so the rest of the team reads it via `/sync` — the BE doc is the cross-team **API contract**; the FE doc is the **client design** other FE/App devs (and reviewers) consume:
|
|
534
713
|
|
|
535
714
|
```bash
|
|
536
715
|
cd {spec_source}
|
|
537
|
-
git add
|
|
538
|
-
git commit -m "docs({UC-ID}): tech design / API contract"
|
|
539
|
-
git push origin {spec_branch} # the branch
|
|
716
|
+
git add {tech_design_path} # be: {UC-ID}-tech-design.md · fe: {UC-ID}-tech-design-{platform}.md
|
|
717
|
+
git commit -m "docs({UC-ID}): {be: tech design / API contract | fe: FE tech design ({platform})}"
|
|
718
|
+
git push origin {spec_branch} # the branch teammates track in .gitmodules
|
|
540
719
|
cd -
|
|
541
|
-
git add {spec_source} && git commit -m "chore: bump spec pointer ({UC-ID} tech design)"
|
|
720
|
+
git add {spec_source} && git commit -m "chore: bump spec pointer ({UC-ID} {be|fe} tech design)"
|
|
542
721
|
```
|
|
543
722
|
|
|
544
723
|
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.
|
|
@@ -567,6 +746,36 @@ Output Artifacts:
|
|
|
567
746
|
|
|
568
747
|
If no files were written (e.g., review or analysis commands) → write `Output Artifacts: none (read-only)`.
|
|
569
748
|
|
|
749
|
+
## Pipeline Position
|
|
750
|
+
|
|
751
|
+
Print a one-line map of the pipeline with the CURRENT command's phase marked `◀ bạn ở đây`,
|
|
752
|
+
so the user always sees where this command sits in the end-to-end flow:
|
|
753
|
+
|
|
754
|
+
```
|
|
755
|
+
Discovery → PRD → [Design Spec] → BDD → Tech Design → Code → Dev Self-Check → QC → Trace Audit
|
|
756
|
+
```
|
|
757
|
+
|
|
758
|
+
Find the current command in this phase legend and mark **its** phase in the map above:
|
|
759
|
+
|
|
760
|
+
| Phase | Commands |
|
|
761
|
+
|-------|----------|
|
|
762
|
+
| Discovery | `/define-product` |
|
|
763
|
+
| PRD | `/generate-prd` · `/refine-prd` · `/review-context` (PRD) |
|
|
764
|
+
| Design Spec | `/generate-design-spec` |
|
|
765
|
+
| BDD | `/generate-bdd` · `/review-context` (BDD) |
|
|
766
|
+
| Tech Design | `/generate-tech-docs` · `/map-testids` · `/review-tech-docs` |
|
|
767
|
+
| Code | `/generate-code` · `/review-code` |
|
|
768
|
+
| Dev Self-Check | `/dev-gen-test` · `/dev-run-test` · `/dev-smoke-test` |
|
|
769
|
+
| QC | `/qc-analyze` · `/qc-plan` · `/qc-design-test` · `/qc-review` · `/qc-run-test` · `/qc-report` |
|
|
770
|
+
| Trace Audit | `/validate-traces` |
|
|
771
|
+
|
|
772
|
+
For a **review command**, also append the 3-step review loop with the current step marked, e.g.:
|
|
773
|
+
`Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume`.
|
|
774
|
+
|
|
775
|
+
**Cross-cutting commands** (`/sync`, `/update-framework`, `/fix-bug`, `/debug`, `/learn`,
|
|
776
|
+
`/report-bug`, `/propose-scenario`, `/generate-spec-manifest`) sit outside the linear pipeline —
|
|
777
|
+
**omit the Pipeline line entirely** for these (do not force-fit them onto the map).
|
|
778
|
+
|
|
570
779
|
## Next Command Suggestion
|
|
571
780
|
|
|
572
781
|
Suggest the logical next command based on workflow phase:
|
|
@@ -608,17 +817,22 @@ Suggest the logical next command based on workflow phase:
|
|
|
608
817
|
Format the footer as:
|
|
609
818
|
```
|
|
610
819
|
---
|
|
611
|
-
Status
|
|
820
|
+
Status : {badge}
|
|
612
821
|
{Output Artifacts block}
|
|
613
|
-
|
|
822
|
+
Pipeline : Discovery → PRD → [BDD ◀ bạn ở đây] → Tech Design → Code → Dev Self-Check → QC → Trace Audit
|
|
823
|
+
(review cmd) Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume
|
|
824
|
+
Next : {suggested command with example arguments}
|
|
614
825
|
```
|
|
826
|
+
*(Omit the `Pipeline` line for cross-cutting commands listed above.)*
|
|
615
827
|
|
|
616
828
|
|
|
617
829
|
```
|
|
618
|
-
/generate-tech-docs Complete — {UC-ID}
|
|
619
|
-
File: {
|
|
620
|
-
Next: /review-tech-docs {
|
|
830
|
+
/generate-tech-docs Complete — {UC-ID} ({active_tech_design: BE API contract | FE {platform} client design})
|
|
831
|
+
File: {tech_design_path}
|
|
832
|
+
Next: /review-tech-docs {tech_design_path}
|
|
621
833
|
← SA/Lead review required before code generation
|
|
622
|
-
→ if
|
|
623
|
-
→ after approved:
|
|
834
|
+
→ if it lives in the shared spec repo: commit + push to the spec submodule (see Publish above) so teammates `/sync` can read it
|
|
835
|
+
→ after approved:
|
|
836
|
+
BE → /generate-code {system .feature}
|
|
837
|
+
FE → /generate-code {web|app .feature} --phase=integration (wires real API per §4 of this doc)
|
|
624
838
|
```
|