@edupia-tutor/spec-driven-docs 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/bin/build.js +230 -0
- package/bin/index.js +598 -0
- package/commands/debug.md +830 -0
- package/commands/debug.tmpl +257 -0
- package/commands/define-product.md +652 -0
- package/commands/define-product.tmpl +158 -0
- package/commands/dev-gen-test.md +1010 -0
- package/commands/dev-gen-test.tmpl +490 -0
- package/commands/dev-run-test.md +744 -0
- package/commands/dev-run-test.tmpl +224 -0
- package/commands/dev-smoke-test.md +711 -0
- package/commands/dev-smoke-test.tmpl +217 -0
- package/commands/fix-bug.md +744 -0
- package/commands/fix-bug.tmpl +171 -0
- package/commands/generate-bdd.md +1054 -0
- package/commands/generate-bdd.tmpl +534 -0
- package/commands/generate-code.md +869 -0
- package/commands/generate-code.tmpl +349 -0
- package/commands/generate-design-spec.md +958 -0
- package/commands/generate-design-spec.tmpl +464 -0
- package/commands/generate-prd.md +748 -0
- package/commands/generate-prd.tmpl +254 -0
- package/commands/generate-spec-manifest.md +658 -0
- package/commands/generate-spec-manifest.tmpl +164 -0
- package/commands/generate-tech-docs.md +849 -0
- package/commands/generate-tech-docs.tmpl +355 -0
- package/commands/learn.md +636 -0
- package/commands/learn.tmpl +63 -0
- package/commands/map-testids.md +575 -0
- package/commands/map-testids.tmpl +81 -0
- package/commands/propose-scenario.md +623 -0
- package/commands/propose-scenario.tmpl +129 -0
- package/commands/qc-analyze.md +580 -0
- package/commands/qc-analyze.tmpl +86 -0
- package/commands/qc-design-test.md +562 -0
- package/commands/qc-design-test.tmpl +68 -0
- package/commands/qc-plan.md +543 -0
- package/commands/qc-plan.tmpl +49 -0
- package/commands/qc-report.md +554 -0
- package/commands/qc-report.tmpl +60 -0
- package/commands/qc-review.md +547 -0
- package/commands/qc-review.tmpl +53 -0
- package/commands/qc-run-test.md +604 -0
- package/commands/qc-run-test.tmpl +84 -0
- package/commands/refine-prd.md +772 -0
- package/commands/refine-prd.tmpl +140 -0
- package/commands/report-bug.md +639 -0
- package/commands/report-bug.tmpl +145 -0
- package/commands/review-code.md +677 -0
- package/commands/review-code.tmpl +104 -0
- package/commands/review-context.md +1047 -0
- package/commands/review-context.tmpl +415 -0
- package/commands/review-tech-docs.md +811 -0
- package/commands/review-tech-docs.tmpl +317 -0
- package/commands/setup-ai-first.md +545 -0
- package/commands/setup-ai-first.tmpl +358 -0
- package/commands/sync.md +451 -0
- package/commands/sync.tmpl +351 -0
- package/commands/update-framework.md +251 -0
- package/commands/update-framework.tmpl +151 -0
- package/commands/validate-traces.md +842 -0
- package/commands/validate-traces.tmpl +348 -0
- package/core/FRAMEWORK_VERSION +1 -0
- package/core/commands/debug.md +830 -0
- package/core/commands/define-product.md +652 -0
- package/core/commands/dev-gen-test.md +1010 -0
- package/core/commands/dev-run-test.md +744 -0
- package/core/commands/dev-smoke-test.md +711 -0
- package/core/commands/fix-bug.md +744 -0
- package/core/commands/generate-bdd.md +1054 -0
- package/core/commands/generate-code.md +869 -0
- package/core/commands/generate-design-spec.md +958 -0
- package/core/commands/generate-prd.md +748 -0
- package/core/commands/generate-spec-manifest.md +658 -0
- package/core/commands/generate-tech-docs.md +849 -0
- package/core/commands/learn.md +636 -0
- package/core/commands/map-testids.md +575 -0
- package/core/commands/propose-scenario.md +623 -0
- package/core/commands/qc-analyze.md +580 -0
- package/core/commands/qc-design-test.md +562 -0
- package/core/commands/qc-plan.md +543 -0
- package/core/commands/qc-report.md +554 -0
- package/core/commands/qc-review.md +547 -0
- package/core/commands/qc-run-test.md +604 -0
- package/core/commands/refine-prd.md +772 -0
- package/core/commands/report-bug.md +639 -0
- package/core/commands/review-code.md +677 -0
- package/core/commands/review-context.md +1047 -0
- package/core/commands/review-tech-docs.md +811 -0
- package/core/commands/setup-ai-first.md +545 -0
- package/core/commands/sync.md +451 -0
- package/core/commands/update-framework.md +251 -0
- package/core/commands/validate-traces.md +842 -0
- package/core/hooks/data-guard.js +141 -0
- package/core/hooks/settings.json +18 -0
- package/core/modules/android-compose/module.yaml +13 -0
- package/core/modules/android-compose/stack-profile.yaml +57 -0
- package/core/modules/angular/architecture-snippets/component-patterns.md +187 -0
- package/core/modules/angular/module.yaml +6 -0
- package/core/modules/angular/stack-profile.yaml +38 -0
- package/core/modules/context-engineering/architecture-snippets/context-design.md +119 -0
- package/core/modules/context-engineering/module.yaml +9 -0
- package/core/modules/context-engineering/stack-profile.yaml +61 -0
- package/core/modules/dotnet/architecture-snippets/clean-arch.md +160 -0
- package/core/modules/dotnet/module.yaml +6 -0
- package/core/modules/dotnet/stack-profile.yaml +50 -0
- package/core/modules/flutter/module.yaml +14 -0
- package/core/modules/flutter/stack-profile.yaml +59 -0
- package/core/modules/golang/architecture-snippets/domain-layout.md +283 -0
- package/core/modules/golang/module.yaml +6 -0
- package/core/modules/golang/stack-profile.yaml +40 -0
- package/core/modules/ios-swiftui/module.yaml +13 -0
- package/core/modules/ios-swiftui/stack-profile.yaml +55 -0
- package/core/modules/java-spring/architecture-snippets/layered-arch.md +201 -0
- package/core/modules/java-spring/module.yaml +15 -0
- package/core/modules/java-spring/stack-profile.yaml +28 -0
- package/core/modules/nextjs/architecture-snippets/app-router-patterns.md +269 -0
- package/core/modules/nextjs/module.yaml +14 -0
- package/core/modules/nextjs/stack-profile.yaml +74 -0
- package/core/modules/nuxt/module.yaml +14 -0
- package/core/modules/nuxt/stack-profile.yaml +58 -0
- package/core/modules/php-laravel/architecture-snippets/service-repository.md +302 -0
- package/core/modules/php-laravel/module.yaml +15 -0
- package/core/modules/php-laravel/stack-profile.yaml +56 -0
- package/core/modules/qc-playwright/stack-profile.yaml +66 -0
- package/core/modules/react/architecture-snippets/hooks-query-patterns.md +254 -0
- package/core/modules/react/module.yaml +14 -0
- package/core/modules/react/stack-profile.yaml +63 -0
- package/core/modules/react-native/module.yaml +14 -0
- package/core/modules/react-native/stack-profile.yaml +56 -0
- package/core/modules/vue/module.yaml +14 -0
- package/core/modules/vue/stack-profile.yaml +65 -0
- package/core/rules/data-protection.md +80 -0
- package/core/rules/workflow.md +44 -0
- package/core/skills/code/SKILL.md +770 -0
- package/core/skills/debug/SKILL.md +869 -0
- package/core/skills/design-spec/SKILL.md +589 -0
- package/core/skills/discovery/SKILL.md +554 -0
- package/core/skills/prd/SKILL.md +562 -0
- package/core/skills/qc/qa-analyst/DOC_GAPS.template.md +63 -0
- package/core/skills/qc/qa-analyst/acceptance-criteria.md +60 -0
- package/core/skills/qc/qa-analyst/business-rules.md +59 -0
- package/core/skills/qc/qa-analyst/data-flow.md +64 -0
- package/core/skills/qc/qa-analyst/spec-breakdown.md +61 -0
- package/core/skills/qc/qa-designer/e2e/journey.md +41 -0
- package/core/skills/qc/qa-designer/exploratory/charter.md +68 -0
- package/core/skills/qc/qa-designer/exploratory/explore-to-functional.md +43 -0
- package/core/skills/qc/qa-designer/functional/api.md +45 -0
- package/core/skills/qc/qa-designer/functional/gui-feature.md +46 -0
- package/core/skills/qc/qa-designer/functional/gui-screen.md +52 -0
- package/core/skills/qc/qa-designer/integration/api.md +42 -0
- package/core/skills/qc/qa-designer/integration/db.md +39 -0
- package/core/skills/qc/qa-designer/integration/gui.md +40 -0
- package/core/skills/qc/qa-designer/integration/kafka.md +40 -0
- package/core/skills/qc/qa-designer/non-functional.md +40 -0
- package/core/skills/qc/qa-planner/test-plan.md +120 -0
- package/core/skills/qc/qa-reviewer/script/e2e.md +87 -0
- package/core/skills/qc/qa-reviewer/script/exploratory.md +45 -0
- package/core/skills/qc/qa-reviewer/script/functional.md +101 -0
- package/core/skills/qc/qa-reviewer/script/integration.md +91 -0
- package/core/skills/qc/qa-reviewer/script/non-functional.md +126 -0
- package/core/skills/qc/qa-reviewer/test-case/e2e.md +73 -0
- package/core/skills/qc/qa-reviewer/test-case/exploratory.md +43 -0
- package/core/skills/qc/qa-reviewer/test-case/functional.md +76 -0
- package/core/skills/qc/qa-reviewer/test-case/integration.md +69 -0
- package/core/skills/qc/qa-reviewer/test-case/non-functional.md +73 -0
- package/core/skills/qc/qa-runner/e2e.md +49 -0
- package/core/skills/qc/qa-runner/exploratory/session.md +36 -0
- package/core/skills/qc/qa-runner/functional/api.md +35 -0
- package/core/skills/qc/qa-runner/functional/gui-feature.md +51 -0
- package/core/skills/qc/qa-runner/functional/gui-screen.md +55 -0
- package/core/skills/qc/qa-runner/integration.md +47 -0
- package/core/skills/qc/qa-runner/non-functional.md +49 -0
- package/core/skills/qc/qa-runner/report/report.md +37 -0
- package/core/skills/setup-ai-first/SKILL.md +216 -0
- package/core/skills/spec/SKILL.md +461 -0
- package/core/skills/test/SKILL.md +1297 -0
- package/core/steps/capture-lesson.md +79 -0
- package/core/steps/context-loader.md +307 -0
- package/core/steps/gate.md +87 -0
- package/core/steps/report-footer.md +100 -0
- package/core/steps/review-fanout.md +138 -0
- package/core/steps/spawn-agent.md +124 -0
- package/core/steps/trace-mirror.md +26 -0
- package/core/templates/architecture.template.md +113 -0
- package/core/templates/design-spec.template.md +217 -0
- package/core/templates/feature.template +259 -0
- package/core/templates/platform-guide.template.md +145 -0
- package/core/templates/prd.template.md +327 -0
- package/core/templates/product-definition.template.md +168 -0
- package/core/templates/project-context.yaml +161 -0
- package/docs/01-getting-started/README.md +19 -0
- package/docs/01-getting-started/core-concepts.md +102 -0
- package/docs/01-getting-started/installation.md +156 -0
- package/docs/01-getting-started/quickstart.md +85 -0
- package/docs/02-guides/README.md +26 -0
- package/docs/02-guides/developer/README.md +46 -0
- package/docs/02-guides/developer/bdd-and-trace.md +125 -0
- package/docs/02-guides/developer/commands.md +76 -0
- package/docs/02-guides/developer/pr-checklist.md +15 -0
- package/docs/02-guides/developer/scenarios.md +460 -0
- package/docs/02-guides/developer/workflow.md +121 -0
- package/docs/02-guides/product-owner/README.md +79 -0
- package/docs/02-guides/product-owner/commands.md +30 -0
- package/docs/02-guides/product-owner/handoff-checklist.md +42 -0
- package/docs/02-guides/product-owner/prd-writing-rules.md +45 -0
- package/docs/02-guides/product-owner/scenarios.md +436 -0
- package/docs/02-guides/tester/README.md +75 -0
- package/docs/02-guides/tester/bug-reporting.md +117 -0
- package/docs/02-guides/tester/qc-automation.md +165 -0
- package/docs/02-guides/tester/reading-specs.md +79 -0
- package/docs/02-guides/tester/scenarios.md +186 -0
- package/docs/02-guides/tester/spec-manifest.md +130 -0
- package/docs/02-guides/tester/test-checklist.md +31 -0
- package/docs/02-guides/tester/workflow.md +77 -0
- package/docs/03-concepts/README.md +19 -0
- package/docs/03-concepts/architecture.md +248 -0
- package/docs/03-concepts/pipeline.md +274 -0
- package/docs/03-concepts/traceability.md +149 -0
- package/docs/04-operations/README.md +33 -0
- package/docs/04-operations/bug-flow.md +362 -0
- package/docs/04-operations/publishing.md +137 -0
- package/docs/04-operations/sync-and-update.md +522 -0
- package/docs/05-reference/README.md +32 -0
- package/docs/05-reference/command-cheatsheet.md +147 -0
- package/docs/05-reference/commands.md +232 -0
- package/docs/05-reference/modules.md +110 -0
- package/docs/05-reference/trace-schema.md +153 -0
- package/docs/README.md +49 -0
- package/hooks/data-guard.js +141 -0
- package/hooks/settings.json +18 -0
- package/modules/android-compose/module.yaml +13 -0
- package/modules/android-compose/stack-profile.yaml +57 -0
- package/modules/angular/architecture-snippets/component-patterns.md +187 -0
- package/modules/angular/module.yaml +6 -0
- package/modules/angular/stack-profile.yaml +38 -0
- package/modules/context-engineering/architecture-snippets/context-design.md +119 -0
- package/modules/context-engineering/module.yaml +9 -0
- package/modules/context-engineering/stack-profile.yaml +61 -0
- package/modules/dotnet/architecture-snippets/clean-arch.md +160 -0
- package/modules/dotnet/module.yaml +6 -0
- package/modules/dotnet/stack-profile.yaml +50 -0
- package/modules/flutter/module.yaml +14 -0
- package/modules/flutter/stack-profile.yaml +59 -0
- package/modules/golang/architecture-snippets/domain-layout.md +283 -0
- package/modules/golang/module.yaml +6 -0
- package/modules/golang/stack-profile.yaml +40 -0
- package/modules/ios-swiftui/module.yaml +13 -0
- package/modules/ios-swiftui/stack-profile.yaml +55 -0
- package/modules/java-spring/architecture-snippets/layered-arch.md +201 -0
- package/modules/java-spring/module.yaml +15 -0
- package/modules/java-spring/stack-profile.yaml +28 -0
- package/modules/nextjs/architecture-snippets/app-router-patterns.md +269 -0
- package/modules/nextjs/module.yaml +14 -0
- package/modules/nextjs/stack-profile.yaml +74 -0
- package/modules/nuxt/module.yaml +14 -0
- package/modules/nuxt/stack-profile.yaml +58 -0
- package/modules/php-laravel/architecture-snippets/service-repository.md +302 -0
- package/modules/php-laravel/module.yaml +15 -0
- package/modules/php-laravel/stack-profile.yaml +56 -0
- package/modules/qc-playwright/stack-profile.yaml +66 -0
- package/modules/react/architecture-snippets/hooks-query-patterns.md +254 -0
- package/modules/react/module.yaml +14 -0
- package/modules/react/stack-profile.yaml +63 -0
- package/modules/react-native/module.yaml +14 -0
- package/modules/react-native/stack-profile.yaml +56 -0
- package/modules/vue/module.yaml +14 -0
- package/modules/vue/stack-profile.yaml +65 -0
- package/package.json +49 -0
- package/rules/data-protection.md +80 -0
- package/rules/workflow.md +44 -0
- package/scripts/init.sh +49 -0
- package/scripts/migrate-specs.js +256 -0
- package/scripts/upgrade.sh +94 -0
- package/skills/code/SKILL.md +770 -0
- package/skills/code/SKILL.tmpl +176 -0
- package/skills/debug/SKILL.md +869 -0
- package/skills/debug/SKILL.tmpl +262 -0
- package/skills/design-spec/SKILL.md +589 -0
- package/skills/design-spec/SKILL.tmpl +95 -0
- package/skills/discovery/SKILL.md +554 -0
- package/skills/discovery/SKILL.tmpl +147 -0
- package/skills/prd/SKILL.md +562 -0
- package/skills/prd/SKILL.tmpl +188 -0
- package/skills/qc/qa-analyst/DOC_GAPS.template.md +63 -0
- package/skills/qc/qa-analyst/acceptance-criteria.md +60 -0
- package/skills/qc/qa-analyst/business-rules.md +59 -0
- package/skills/qc/qa-analyst/data-flow.md +64 -0
- package/skills/qc/qa-analyst/spec-breakdown.md +61 -0
- package/skills/qc/qa-designer/e2e/journey.md +41 -0
- package/skills/qc/qa-designer/exploratory/charter.md +68 -0
- package/skills/qc/qa-designer/exploratory/explore-to-functional.md +43 -0
- package/skills/qc/qa-designer/functional/api.md +45 -0
- package/skills/qc/qa-designer/functional/gui-feature.md +46 -0
- package/skills/qc/qa-designer/functional/gui-screen.md +52 -0
- package/skills/qc/qa-designer/integration/api.md +42 -0
- package/skills/qc/qa-designer/integration/db.md +39 -0
- package/skills/qc/qa-designer/integration/gui.md +40 -0
- package/skills/qc/qa-designer/integration/kafka.md +40 -0
- package/skills/qc/qa-designer/non-functional.md +40 -0
- package/skills/qc/qa-planner/test-plan.md +120 -0
- package/skills/qc/qa-reviewer/script/e2e.md +87 -0
- package/skills/qc/qa-reviewer/script/exploratory.md +45 -0
- package/skills/qc/qa-reviewer/script/functional.md +101 -0
- package/skills/qc/qa-reviewer/script/integration.md +91 -0
- package/skills/qc/qa-reviewer/script/non-functional.md +126 -0
- package/skills/qc/qa-reviewer/test-case/e2e.md +73 -0
- package/skills/qc/qa-reviewer/test-case/exploratory.md +43 -0
- package/skills/qc/qa-reviewer/test-case/functional.md +76 -0
- package/skills/qc/qa-reviewer/test-case/integration.md +69 -0
- package/skills/qc/qa-reviewer/test-case/non-functional.md +73 -0
- package/skills/qc/qa-runner/e2e.md +49 -0
- package/skills/qc/qa-runner/exploratory/session.md +36 -0
- package/skills/qc/qa-runner/functional/api.md +35 -0
- package/skills/qc/qa-runner/functional/gui-feature.md +51 -0
- package/skills/qc/qa-runner/functional/gui-screen.md +55 -0
- package/skills/qc/qa-runner/integration.md +47 -0
- package/skills/qc/qa-runner/non-functional.md +49 -0
- package/skills/qc/qa-runner/report/report.md +37 -0
- package/skills/setup-ai-first/SKILL.md +216 -0
- package/skills/setup-ai-first/SKILL.tmpl +116 -0
- package/skills/spec/SKILL.md +461 -0
- package/skills/spec/SKILL.tmpl +174 -0
- package/skills/test/SKILL.md +1297 -0
- package/skills/test/SKILL.tmpl +296 -0
- package/steps/capture-lesson.md +79 -0
- package/steps/context-loader.md +307 -0
- package/steps/gate.md +87 -0
- package/steps/report-footer.md +100 -0
- package/steps/review-fanout.md +138 -0
- package/steps/spawn-agent.md +124 -0
- package/steps/trace-mirror.md +26 -0
- package/templates/architecture.template.md +113 -0
- package/templates/design-spec.template.md +217 -0
- package/templates/feature.template +259 -0
- package/templates/platform-guide.template.md +145 -0
- package/templates/prd.template.md +327 -0
- package/templates/product-definition.template.md +168 -0
- package/templates/project-context.yaml +161 -0
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
# /generate-tech-docs — Generate Technical Design Document
|
|
2
|
+
|
|
3
|
+
## Gate
|
|
4
|
+
{{include:steps/gate.md}}
|
|
5
|
+
|
|
6
|
+
*Note: For this command, the target in Step 1 is a `.feature` file or UC-ID. If `$ARGUMENTS` is a bare UC-ID, locate the feature by globbing `{paths.specs_dir}/{domain}/*/bdd/**/{UC-ID}*.feature` (wildcard `*` for the unknown prd-slug, recursive `**` for the `web/`·`app/`·`system/` subfolders — a BE tech-doc resolves from the `system/` BDD); take `domain` + `prd_slug` from the matched path. All outputs below then use that resolved `{prd-slug}`.*
|
|
7
|
+
|
|
8
|
+
**Quality Gate**: Before generating, check the BDD findings file:
|
|
9
|
+
|
|
10
|
+
1. Look for `{paths.refinement_dir}/{uc-id}-review-bdd-findings.yaml`.
|
|
11
|
+
2. **If file does not exist** → warn and ask:
|
|
12
|
+
```
|
|
13
|
+
⚠️ /review-context has not been run for this feature file.
|
|
14
|
+
Recommended: run /review-context {feature-file} first to verify BDD quality.
|
|
15
|
+
Continue without review? (Y/N)
|
|
16
|
+
```
|
|
17
|
+
- Y → proceed (accept risk)
|
|
18
|
+
- N → stop; run `/review-context {feature-file}` first
|
|
19
|
+
3. **If file exists** → check for unresolved `status: "pending"` critical findings.
|
|
20
|
+
If any found → **HALT** and print:
|
|
21
|
+
```
|
|
22
|
+
❌ Quality Gate Failed — {feature-file}
|
|
23
|
+
Unresolved critical BDD findings detected.
|
|
24
|
+
Run: /review-context --fix {feature-file} ← auto-fix what's possible
|
|
25
|
+
Then: /review-context --resume {feature-file} ← apply remaining accepted findings
|
|
26
|
+
Then re-run: /generate-tech-docs {feature-file}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Context
|
|
30
|
+
{{include:steps/context-loader.md}}
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Step 0 — Detect Platform & Route Output
|
|
35
|
+
|
|
36
|
+
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).
|
|
37
|
+
|
|
38
|
+
| Platform | `active_tech_design` | Output file |
|
|
39
|
+
|----------|----------------------|-------------|
|
|
40
|
+
| `system` / backend | **`be`** — the cross-team **API contract** (authoritative) | `{paths.tech_docs_dir}/{domain}/{prd-slug}/tech-docs/{UC-ID}-tech-design.md` |
|
|
41
|
+
| `web` / `app` (web-frontend / mobile) | **`fe`** — the **client technical design** (consumes the BE contract) | `{paths.tech_docs_dir}/{domain}/{prd-slug}/tech-docs/{UC-ID}-tech-design-{platform}.md` |
|
|
42
|
+
|
|
43
|
+
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.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Step 0.5 — FE/App Precondition Gate
|
|
48
|
+
|
|
49
|
+
*Skip this entire step for BE (`active_tech_design = be`).*
|
|
50
|
+
|
|
51
|
+
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:
|
|
52
|
+
|
|
53
|
+
1. **System BDD** — locate `{paths.specs_dir}/{domain}/{prd-slug}/bdd/system/{TICKET-ID}*.feature`.
|
|
54
|
+
If not found → HALT:
|
|
55
|
+
```
|
|
56
|
+
❌ Cannot generate FE tech-design — System BDD not found for {TICKET-ID}.
|
|
57
|
+
The FE design needs the system-level (BE-facing) behavior first.
|
|
58
|
+
→ PO/BE: /generate-bdd {prd-file} (produces the `system/` platform BDD)
|
|
59
|
+
```
|
|
60
|
+
2. **BE tech-docs (API contract)** — locate the BE doc `{paths.tech_docs_dir}/{domain}/{prd-slug}/tech-docs/{UC-ID}-tech-design.md` and read its `@trace.status`.
|
|
61
|
+
- Not found → HALT:
|
|
62
|
+
```
|
|
63
|
+
❌ Cannot generate FE tech-design — BE API contract not found.
|
|
64
|
+
The FE integration layer maps to the BE contract; it must exist first.
|
|
65
|
+
→ BE: /generate-tech-docs {system .feature} → /review-tech-docs (approve) → publish to spec repo
|
|
66
|
+
```
|
|
67
|
+
- Found but `@trace.status` ≠ `approved` → WARN and ask:
|
|
68
|
+
```
|
|
69
|
+
⚠️ BE contract {UC-ID}-tech-design.md is status: {status} (not approved) — it may still change.
|
|
70
|
+
Designing the FE integration against a non-final contract risks rework.
|
|
71
|
+
Continue anyway? (Y/N)
|
|
72
|
+
```
|
|
73
|
+
- Y → proceed (accept risk) · N → stop, wait for BE to approve.
|
|
74
|
+
|
|
75
|
+
Store `system_bdd_path` and `be_contract_path` — they are the primary inputs for the FE §3/§4 below.
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Brownfield Check
|
|
80
|
+
|
|
81
|
+
*BE (`active_tech_design = be`) only — for FE the "existing contract" is the BE doc loaded in Step 0.5.*
|
|
82
|
+
|
|
83
|
+
Read the source `.feature` file header for `@trace.api_source`.
|
|
84
|
+
Also check the source PRD Metadata table for `| **API Source** | existing |`.
|
|
85
|
+
|
|
86
|
+
| Value | Mode |
|
|
87
|
+
|-------|------|
|
|
88
|
+
| `existing` | **Reverse-document** — API đã tồn tại; mô tả lại as-is, note gaps, không cần design mới |
|
|
89
|
+
| absent / other | **Greenfield** — thiết kế API từ đầu |
|
|
90
|
+
|
|
91
|
+
Store `active_mode = {reverse-document | greenfield}`.
|
|
92
|
+
|
|
93
|
+
If `active_mode = reverse-document` → load bảng "Existing API Contract" từ PRD làm input cho §2.
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## CHECKPOINT — Tech Design Plan
|
|
98
|
+
|
|
99
|
+
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:
|
|
100
|
+
|
|
101
|
+
**If `active_tech_design = be`:**
|
|
102
|
+
```
|
|
103
|
+
Tech Design Plan — {UC-ID} (BE · API contract)
|
|
104
|
+
──────────────────────────────────────────────────────
|
|
105
|
+
UC : {UC-ID} — {feature title}
|
|
106
|
+
Service : {trace.service}
|
|
107
|
+
Module : {trace.module}
|
|
108
|
+
Mode : {Reverse-document (API đã tồn tại) | Greenfield (thiết kế mới)}
|
|
109
|
+
Scenarios: {N} scenarios
|
|
110
|
+
BDD ver : {trace.bdd_version}
|
|
111
|
+
Output : {paths.tech_docs_dir}/{domain}/{prd-slug}/tech-docs/{UC-ID}-tech-design.md
|
|
112
|
+
|
|
113
|
+
Sections to generate:
|
|
114
|
+
§1 Overview
|
|
115
|
+
§2 API Endpoints ({Reverse-document: mô tả lại từ PRD contract | Greenfield: infer từ scenarios})
|
|
116
|
+
§3 Data Model ({entities from core-entities.md relevant to this UC})
|
|
117
|
+
§4 Service Flow
|
|
118
|
+
§5 Business Rules ({N} BRs from feature header)
|
|
119
|
+
§6 Error Handling
|
|
120
|
+
§7 Database Changes
|
|
121
|
+
§8 Caching Strategy
|
|
122
|
+
§9 Cross-Service Dependencies
|
|
123
|
+
──────────────────────────────────────────────────────
|
|
124
|
+
Proceed? (Y/N)
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
**If `active_tech_design = fe`:**
|
|
128
|
+
```
|
|
129
|
+
Tech Design Plan — {UC-ID} (FE · {platform} · client design)
|
|
130
|
+
──────────────────────────────────────────────────────
|
|
131
|
+
UC : {UC-ID} — {feature title}
|
|
132
|
+
Service : {trace.service} Module: {trace.module} ({platform})
|
|
133
|
+
Inputs : System BDD → {system_bdd_path}
|
|
134
|
+
BE contract → {be_contract_path} (status: {be status})
|
|
135
|
+
Scenarios : {N} FE scenarios | BDD ver: {trace.bdd_version}
|
|
136
|
+
Output : {paths.tech_docs_dir}/{domain}/{prd-slug}/tech-docs/{UC-ID}-tech-design-{platform}.md
|
|
137
|
+
|
|
138
|
+
Sections to generate:
|
|
139
|
+
§1 Overview (FE scope of this UC)
|
|
140
|
+
§2 Component Architecture (tree + reuse from figma-components catalog)
|
|
141
|
+
§2b Test Selectors (stable test-id cho element có action — QC contract, attr theo platform)
|
|
142
|
+
§3 State Management (store/slices/state shape ← System BDD Then-clauses)
|
|
143
|
+
§4 API Integration Layer (port/adapter: each BE endpoint → FE service → DTO/model)
|
|
144
|
+
§5 Routing / Navigation
|
|
145
|
+
§6 Data Fetching & Client Caching (query keys, invalidation, optimistic updates)
|
|
146
|
+
§7 Error & Loading States (per scenario)
|
|
147
|
+
§8 Cross-Cutting (auth token, i18n, feature flags)
|
|
148
|
+
{§9 Offline / platform specifics — app only}
|
|
149
|
+
──────────────────────────────────────────────────────
|
|
150
|
+
Proceed? (Y/N)
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Wait for explicit "Y" before generating.
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## Generate
|
|
158
|
+
|
|
159
|
+
Generate the document for the resolved `active_tech_design`.
|
|
160
|
+
|
|
161
|
+
### Path A — BE API contract (`active_tech_design = be`)
|
|
162
|
+
|
|
163
|
+
Write `{paths.tech_docs_dir}/{domain}/{prd-slug}/tech-docs/{UC-ID}-tech-design.md`:
|
|
164
|
+
|
|
165
|
+
```markdown
|
|
166
|
+
# Technical Design — {UC-ID}: {Feature}
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
@trace.id: {UC-ID}
|
|
170
|
+
@trace.domain: {domain}
|
|
171
|
+
@trace.service: {read @trace.service from the .feature file header}
|
|
172
|
+
@trace.module: {read @trace.module from the .feature file header}
|
|
173
|
+
@trace.prd: {TICKET-ID}
|
|
174
|
+
@trace.bdd_version: {read @trace.bdd_version from the .feature file header}
|
|
175
|
+
@trace.revision: 1
|
|
176
|
+
@trace.status: draft
|
|
177
|
+
@trace.api_source: {existing | —}
|
|
178
|
+
@trace.generated_at: {YYYY-MM-DD}
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## §1. Overview
|
|
182
|
+
|
|
183
|
+
{Tóm tắt ngắn: UC này implement gì, scope kỹ thuật chính.}
|
|
184
|
+
|
|
185
|
+
## §2. API Endpoints
|
|
186
|
+
|
|
187
|
+
*Greenfield:* endpoints được infer từ BDD scenarios — thiết kế mới.
|
|
188
|
+
*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.
|
|
189
|
+
|
|
190
|
+
| Method | Path | Auth/Role | Request | Response |
|
|
191
|
+
|--------|------|-----------|---------|----------|
|
|
192
|
+
| {GET/POST/PUT/DELETE} | {/api/v1/...} | {Bearer / role} | `{ field: type }` | `{ field: type }` |
|
|
193
|
+
|
|
194
|
+
## §3. Data Model
|
|
195
|
+
|
|
196
|
+
Key entities and relationships.
|
|
197
|
+
|
|
198
|
+
## §4. Service Flow
|
|
199
|
+
|
|
200
|
+
{Client} → Controller → {Facade/Service} → {Repository}
|
|
201
|
+
|
|
202
|
+
## §5. Business Rules Implementation
|
|
203
|
+
|
|
204
|
+
| BR-ID | Rule | Implementation approach |
|
|
205
|
+
|-------|------|-------------------------|
|
|
206
|
+
| {UC-ID}-BR1 | {rule} | {approach} |
|
|
207
|
+
|
|
208
|
+
## §6. Error Handling
|
|
209
|
+
|
|
210
|
+
| Scenario | Exception | HTTP Status |
|
|
211
|
+
|----------|-----------|-------------|
|
|
212
|
+
| {scenario} | {ExceptionClass} | {4xx/5xx} |
|
|
213
|
+
|
|
214
|
+
## §7. Database Changes
|
|
215
|
+
|
|
216
|
+
Migration scripts or schema changes.
|
|
217
|
+
|
|
218
|
+
## §8. Caching Strategy
|
|
219
|
+
|
|
220
|
+
What to cache, TTL, invalidation triggers.
|
|
221
|
+
|
|
222
|
+
## §9. Cross-Service Dependencies
|
|
223
|
+
|
|
224
|
+
External calls, events produced/consumed.
|
|
225
|
+
|
|
226
|
+
## Changelog
|
|
227
|
+
|
|
228
|
+
| Revision | Date | Changes |
|
|
229
|
+
|----------|------|---------|
|
|
230
|
+
| 1 | {YYYY-MM-DD} | Initial generation from {UC-ID}.feature (BDD v{bdd_version}) |
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### Path B — FE/App client technical design (`active_tech_design = fe`)
|
|
234
|
+
|
|
235
|
+
Write `{paths.tech_docs_dir}/{domain}/{prd-slug}/tech-docs/{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.
|
|
236
|
+
|
|
237
|
+
```markdown
|
|
238
|
+
# FE Technical Design — {UC-ID} ({platform}): {Feature}
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
@trace.id: {UC-ID}
|
|
242
|
+
@trace.domain: {domain}
|
|
243
|
+
@trace.platform: {web | app}
|
|
244
|
+
@trace.service: {read @trace.service from the .feature file header}
|
|
245
|
+
@trace.module: {read @trace.module — e.g. react / nextjs / vue / angular / flutter}
|
|
246
|
+
@trace.prd: {TICKET-ID}
|
|
247
|
+
@trace.bdd_version: {read @trace.bdd_version from the FE .feature header}
|
|
248
|
+
@trace.system_bdd: {system_bdd_path}
|
|
249
|
+
@trace.be_contract: {UC-ID}-tech-design.md # the BE API contract this design consumes
|
|
250
|
+
@trace.testid_attr: {data-testid (web) | testID (react-native) | Key/Semantics (flutter) | accessibilityIdentifier (native-ios)}
|
|
251
|
+
@trace.revision: 1
|
|
252
|
+
@trace.status: draft
|
|
253
|
+
@trace.generated_at: {YYYY-MM-DD}
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
## §1. Overview
|
|
257
|
+
|
|
258
|
+
{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.}
|
|
259
|
+
|
|
260
|
+
## §2. Component Architecture
|
|
261
|
+
|
|
262
|
+
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.
|
|
263
|
+
|
|
264
|
+
| Component | Type | Reuse (catalog) / New | Responsibility |
|
|
265
|
+
|-----------|------|-----------------------|----------------|
|
|
266
|
+
| {Name} | container/presentational | {catalog name \| NEW} | {what it renders / handles} |
|
|
267
|
+
|
|
268
|
+
## §2b. Test Selectors — Element IDs cho element CÓ ACTION (QC contract)
|
|
269
|
+
|
|
270
|
+
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).
|
|
271
|
+
|
|
272
|
+
- **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).
|
|
273
|
+
- **Attribute theo platform** (`@trace.testid_attr`): web `data-testid` · React Native `testID` · Flutter `Key('id')` + `Semantics(identifier:)` · native iOS `accessibilityIdentifier`.
|
|
274
|
+
- **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.
|
|
275
|
+
- Chỉ gán cho element **có action**; element tĩnh (label, text thuần) không cần.
|
|
276
|
+
|
|
277
|
+
| Test-ID | Element | Component (§2) | Action | Serves SC |
|
|
278
|
+
|---------|---------|----------------|--------|-----------|
|
|
279
|
+
| `{uc}-{screen}-{element}-{type}` | {Submit button} | {LoginForm} | {submit login} | SC1, SC3 |
|
|
280
|
+
|
|
281
|
+
> 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.
|
|
282
|
+
>
|
|
283
|
+
> **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**.
|
|
284
|
+
|
|
285
|
+
## §3. State Management
|
|
286
|
+
|
|
287
|
+
State shape suy ra từ System BDD `Then` clauses + response shapes trong BE contract. Nêu store/slices, server-state vs UI-state.
|
|
288
|
+
|
|
289
|
+
| Slice / Key | Shape | Nguồn (BE field / local) | Updated by |
|
|
290
|
+
|-------------|-------|--------------------------|------------|
|
|
291
|
+
|
|
292
|
+
## §4. API Integration Layer (port/adapter)
|
|
293
|
+
|
|
294
|
+
**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`.
|
|
295
|
+
|
|
296
|
+
| FE service method | BE endpoint (từ contract) | Request map | Response → model | Error → UI |
|
|
297
|
+
|-------------------|---------------------------|-------------|------------------|-----------|
|
|
298
|
+
| {svc.getX()} | {GET /api/v1/...} | {params} | {DTO → ViewModel} | {4xx/5xx → state/toast} |
|
|
299
|
+
|
|
300
|
+
## §5. Routing / Navigation
|
|
301
|
+
|
|
302
|
+
Routes / màn hình, params, guards (auth/role), lazy-load.
|
|
303
|
+
|
|
304
|
+
## §6. Data Fetching & Client Caching
|
|
305
|
+
|
|
306
|
+
Query keys, cache invalidation triggers, optimistic updates, refetch policy (client-side — KHÔNG phải server cache).
|
|
307
|
+
|
|
308
|
+
## §7. Error & Loading States
|
|
309
|
+
|
|
310
|
+
| Scenario (BDD) | Loading UI | Error UI | Empty state |
|
|
311
|
+
|----------------|-----------|----------|-------------|
|
|
312
|
+
|
|
313
|
+
## §8. Cross-Cutting
|
|
314
|
+
|
|
315
|
+
Auth token injection/refresh, i18n keys, feature flags, analytics events.
|
|
316
|
+
|
|
317
|
+
{## §9. Offline / Platform Specifics — app only}
|
|
318
|
+
{Cached-data behavior, offline banner, background sync, platform permissions.}
|
|
319
|
+
|
|
320
|
+
## Changelog
|
|
321
|
+
|
|
322
|
+
| Revision | Date | Changes |
|
|
323
|
+
|----------|------|---------|
|
|
324
|
+
| 1 | {YYYY-MM-DD} | Initial FE design from {UC-ID} ({platform}) BDD v{bdd_version}, mapping BE contract {UC-ID}-tech-design.md |
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
## Publish — share the doc (umbrella + shared spec repo)
|
|
328
|
+
|
|
329
|
+
If `paths.tech_docs_dir` resolved **under `setup.spec_source`** (e.g. `{spec_source}/specs/{domain}/{prd-slug}/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:
|
|
330
|
+
|
|
331
|
+
```bash
|
|
332
|
+
cd {spec_source}
|
|
333
|
+
git add {tech_design_path} # be: {UC-ID}-tech-design.md · fe: {UC-ID}-tech-design-{platform}.md
|
|
334
|
+
git commit -m "docs({UC-ID}): {be: tech design / API contract | fe: FE tech design ({platform})}"
|
|
335
|
+
git push origin {spec_branch} # the branch teammates track in .gitmodules
|
|
336
|
+
cd -
|
|
337
|
+
git add {spec_source} && git commit -m "chore: bump spec pointer ({UC-ID} {be|fe} tech design)"
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
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.
|
|
341
|
+
|
|
342
|
+
## Output
|
|
343
|
+
|
|
344
|
+
{{include:steps/report-footer.md}}
|
|
345
|
+
|
|
346
|
+
```
|
|
347
|
+
/generate-tech-docs Complete — {UC-ID} ({active_tech_design: BE API contract | FE {platform} client design})
|
|
348
|
+
File: {tech_design_path}
|
|
349
|
+
Next: /review-tech-docs {tech_design_path}
|
|
350
|
+
← SA/Lead review required before code generation
|
|
351
|
+
→ if it lives in the shared spec repo: commit + push to the spec submodule (see Publish above) so teammates `/sync` can read it
|
|
352
|
+
→ after approved:
|
|
353
|
+
BE → /generate-code {system .feature}
|
|
354
|
+
FE → /generate-code {web|app .feature} --phase=integration (wires real API per §4 of this doc)
|
|
355
|
+
```
|