@anhth2/spec-driven-dev-plugin 0.12.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.
Files changed (130) hide show
  1. package/commands/debug.md +42 -7
  2. package/commands/define-product.md +42 -7
  3. package/commands/dev-gen-test.md +60 -17
  4. package/commands/dev-run-test.md +61 -18
  5. package/commands/dev-run-test.tmpl +1 -1
  6. package/commands/dev-smoke-test.md +42 -7
  7. package/commands/fix-bug.md +42 -7
  8. package/commands/generate-bdd.md +67 -21
  9. package/commands/generate-bdd.tmpl +7 -4
  10. package/commands/generate-code.md +113 -35
  11. package/commands/generate-code.tmpl +53 -18
  12. package/commands/generate-design-spec.md +42 -7
  13. package/commands/generate-prd.md +42 -7
  14. package/commands/generate-spec-manifest.md +42 -7
  15. package/commands/generate-tech-docs.md +229 -20
  16. package/commands/generate-tech-docs.tmpl +187 -13
  17. package/commands/learn.md +42 -7
  18. package/commands/map-testids.md +564 -0
  19. package/commands/map-testids.tmpl +81 -0
  20. package/commands/propose-scenario.md +42 -7
  21. package/commands/qc-analyze.md +42 -7
  22. package/commands/qc-design-test.md +44 -8
  23. package/commands/qc-design-test.tmpl +2 -1
  24. package/commands/qc-plan.md +42 -7
  25. package/commands/qc-report.md +42 -7
  26. package/commands/qc-review.md +42 -7
  27. package/commands/qc-run-test.md +62 -18
  28. package/commands/qc-run-test.tmpl +2 -1
  29. package/commands/refine-prd.md +42 -7
  30. package/commands/report-bug.md +42 -7
  31. package/commands/review-code.md +42 -7
  32. package/commands/review-context.md +42 -7
  33. package/commands/review-tech-docs.md +45 -9
  34. package/commands/review-tech-docs.tmpl +3 -2
  35. package/commands/setup-ai-first.md +37 -4
  36. package/commands/setup-ai-first.tmpl +2 -2
  37. package/commands/sync.md +35 -2
  38. package/commands/update-framework.md +35 -2
  39. package/commands/validate-traces.md +85 -40
  40. package/commands/validate-traces.tmpl +43 -33
  41. package/core/FRAMEWORK_VERSION +1 -1
  42. package/core/commands/debug.md +42 -7
  43. package/core/commands/define-product.md +42 -7
  44. package/core/commands/dev-gen-test.md +60 -17
  45. package/core/commands/dev-run-test.md +61 -18
  46. package/core/commands/dev-smoke-test.md +42 -7
  47. package/core/commands/fix-bug.md +42 -7
  48. package/core/commands/generate-bdd.md +67 -21
  49. package/core/commands/generate-code.md +113 -35
  50. package/core/commands/generate-design-spec.md +42 -7
  51. package/core/commands/generate-prd.md +42 -7
  52. package/core/commands/generate-spec-manifest.md +42 -7
  53. package/core/commands/generate-tech-docs.md +229 -20
  54. package/core/commands/learn.md +42 -7
  55. package/core/commands/map-testids.md +564 -0
  56. package/core/commands/propose-scenario.md +42 -7
  57. package/core/commands/qc-analyze.md +42 -7
  58. package/core/commands/qc-design-test.md +44 -8
  59. package/core/commands/qc-plan.md +42 -7
  60. package/core/commands/qc-report.md +42 -7
  61. package/core/commands/qc-review.md +42 -7
  62. package/core/commands/qc-run-test.md +62 -18
  63. package/core/commands/refine-prd.md +42 -7
  64. package/core/commands/report-bug.md +42 -7
  65. package/core/commands/review-code.md +42 -7
  66. package/core/commands/review-context.md +42 -7
  67. package/core/commands/review-tech-docs.md +45 -9
  68. package/core/commands/setup-ai-first.md +37 -4
  69. package/core/commands/sync.md +35 -2
  70. package/core/commands/update-framework.md +35 -2
  71. package/core/commands/validate-traces.md +85 -40
  72. package/core/modules/qc-playwright/stack-profile.yaml +1 -0
  73. package/core/skills/code/SKILL.md +77 -9
  74. package/core/skills/debug/SKILL.md +112 -11
  75. package/core/skills/design-spec/SKILL.md +42 -7
  76. package/core/skills/discovery/SKILL.md +42 -7
  77. package/core/skills/prd/SKILL.md +70 -4
  78. package/core/skills/setup-ai-first/SKILL.md +35 -2
  79. package/core/skills/spec/SKILL.md +70 -4
  80. package/core/skills/test/SKILL.md +119 -16
  81. package/core/steps/context-loader.md +7 -5
  82. package/core/steps/report-footer.md +35 -2
  83. package/core/steps/trace-mirror.md +18 -10
  84. package/core/templates/project-context.yaml +8 -5
  85. package/docs/01-getting-started/core-concepts.md +7 -7
  86. package/docs/01-getting-started/installation.md +2 -2
  87. package/docs/01-getting-started/quickstart.md +1 -1
  88. package/docs/02-guides/README.md +1 -2
  89. package/docs/02-guides/developer/README.md +1 -1
  90. package/docs/02-guides/developer/bdd-and-trace.md +10 -8
  91. package/docs/02-guides/developer/commands.md +3 -3
  92. package/docs/02-guides/developer/scenarios.md +26 -14
  93. package/docs/02-guides/developer/workflow.md +80 -20
  94. package/docs/02-guides/product-owner/README.md +6 -4
  95. package/docs/02-guides/product-owner/commands.md +1 -1
  96. package/docs/02-guides/product-owner/scenarios.md +80 -1
  97. package/docs/02-guides/tester/README.md +12 -11
  98. package/docs/02-guides/tester/bug-reporting.md +1 -1
  99. package/docs/02-guides/{qc-automation.md → tester/qc-automation.md} +14 -6
  100. package/docs/02-guides/tester/reading-specs.md +4 -4
  101. package/docs/02-guides/tester/scenarios.md +5 -5
  102. package/docs/02-guides/tester/spec-manifest.md +17 -12
  103. package/docs/02-guides/tester/test-checklist.md +3 -3
  104. package/docs/02-guides/tester/workflow.md +8 -11
  105. package/docs/03-concepts/architecture.md +5 -4
  106. package/docs/03-concepts/pipeline.md +18 -6
  107. package/docs/03-concepts/traceability.md +17 -17
  108. package/docs/04-operations/README.md +1 -1
  109. package/docs/04-operations/bug-flow.md +4 -4
  110. package/docs/04-operations/sync-and-update.md +163 -38
  111. package/docs/05-reference/README.md +3 -0
  112. package/docs/05-reference/command-cheatsheet.md +147 -0
  113. package/docs/05-reference/commands.md +72 -69
  114. package/docs/05-reference/modules.md +2 -2
  115. package/docs/05-reference/trace-schema.md +15 -14
  116. package/docs/README.md +3 -5
  117. package/modules/qc-playwright/stack-profile.yaml +1 -0
  118. package/package.json +1 -1
  119. package/skills/code/SKILL.md +77 -9
  120. package/skills/debug/SKILL.md +112 -11
  121. package/skills/design-spec/SKILL.md +42 -7
  122. package/skills/discovery/SKILL.md +42 -7
  123. package/skills/prd/SKILL.md +70 -4
  124. package/skills/setup-ai-first/SKILL.md +35 -2
  125. package/skills/spec/SKILL.md +70 -4
  126. package/skills/test/SKILL.md +119 -16
  127. package/steps/context-loader.md +7 -5
  128. package/steps/report-footer.md +35 -2
  129. package/steps/trace-mirror.md +18 -10
  130. package/templates/project-context.yaml +8 -5
@@ -0,0 +1,564 @@
1
+ # /map-testids — Define/backfill stable test-ids onto reused & existing FE components
2
+
3
+ > Companion to the FE tech-design §2b *Test Selectors* contract. `/generate-tech-docs` (FE) and
4
+ > `/generate-code` assign test-ids to **new** code; this command handles the rest: **reused**
5
+ > catalog components (id lives at the usage site; the component must *forward* a test-id) and
6
+ > **existing / brownfield** screens already coded without test-ids. It reverse-documents what
7
+ > exists, assigns stable ids where missing, ensures reusable components forward an id, records the
8
+ > forwarding in the figma-components catalog, patches usage sites, and writes the §2b map — so QC
9
+ > locates elements by id instead of scanning at runtime.
10
+
11
+ Usage: `/map-testids {UC-ID}`
12
+
13
+ ## Gate
14
+ # Gate — Universal Entry Procedure
15
+
16
+ Every command must execute this gate before proceeding with its specific logic.
17
+
18
+ ## Step 0 — Sub-Agent Mode Check
19
+
20
+ Before anything else, check if `$ARGUMENTS` is a JSON payload from an orchestrator:
21
+
22
+ 1. Attempt to parse `$ARGUMENTS` as JSON.
23
+ 2. If it parses successfully **and** contains `"_agent_mode": true`:
24
+ - **Skip Steps 1, 2, and 3 of this Gate entirely.**
25
+ - Set target file = `payload.target_file`
26
+ - Set loaded context = `payload.context` (do NOT run context-loader.md)
27
+ - Set UC scope = `payload.uc_id` (process only this UC)
28
+ - Set line range = `payload.uc_section` (read only that PRD section)
29
+ - Proceed directly to the command-specific logic.
30
+ 3. If `$ARGUMENTS` is not JSON or `_agent_mode` is absent → continue to Step 1 (normal mode).
31
+
32
+ ## Step 0-B — Model Check
33
+
34
+ *Skip this step if `_agent_mode: true` (sub-agent — orchestrator already validated).*
35
+
36
+ Complex generation and review commands require strong reasoning.
37
+ Using a smaller model risks missed edge cases, incomplete spec analysis, and architecture violations.
38
+
39
+ Display and wait for response:
40
+
41
+ ```
42
+ ⚙️ MODEL CHECK
43
+ ──────────────────────────────────────────────────────────────────
44
+ Recommended : claude-opus-4 (or latest Opus model)
45
+ Why needed : Spec analysis, architecture review, code generation
46
+ require deep reasoning. Smaller models miss edge cases.
47
+
48
+ To switch in Claude Code:
49
+ • Settings → Model → select "claude-opus"
50
+ • or: /model → choose claude-opus
51
+
52
+ Running on claude-opus?
53
+ Y — yes, on claude-opus → proceed
54
+ S — skip check (I accept lower quality risk with current model)
55
+ ──────────────────────────────────────────────────────────────────
56
+ ```
57
+
58
+ - "Y" → proceed to Step 1.
59
+ - "S" → proceed to Step 1 (user accepts risk, add ⚠️ to final report).
60
+ - "N" or anything else → **STOP.** Output: "Please switch to claude-opus, then re-run this command."
61
+
62
+ ## Step 1 — Resolve Target File
63
+
64
+ 1. If `$ARGUMENTS` is provided and points to an existing file → use it directly as the target.
65
+ 2. If `$ARGUMENTS` is a UC-ID, ticket ID, or partial name → search for matching files in the relevant directory.
66
+ 3. If `$ARGUMENTS` is empty or no match found:
67
+ - List files in the relevant directory for this command (e.g., `specs/prd/**/*.md` for PRD commands, `specs/bdd/**/*.feature` for BDD commands).
68
+ - Present the list to the user and ask: "Which file do you want to work with? (Enter number or filename)"
69
+ - Wait for user selection before continuing.
70
+
71
+ ## Step 2 — Execute Context Loader
72
+
73
+ Load all project context by following the procedure in `steps/context-loader.md`.
74
+ Store all loaded context in memory for use throughout this command session.
75
+
76
+ ## Step 3 — CHECKPOINT
77
+
78
+ After completing Steps 1 and 2, display a summary and wait for confirmation:
79
+
80
+ ```
81
+ CHECKPOINT
82
+ -----------
83
+ Target : {resolved file path}
84
+ Project : {project.name from project-context.yaml}
85
+ Tech stack : {language} / {framework}
86
+ Module : {module if set, else "not configured"}
87
+ Domains : {comma-separated domain list}
88
+
89
+ Proceed? (Y/N)
90
+ ```
91
+
92
+ Wait for explicit "Y" or "N" from the user before continuing.
93
+ - "Y" → proceed to the command-specific steps below.
94
+ - "N" → stop and ask what the user wants to change.
95
+
96
+
97
+ *Note: For this command, the target in Step 1 is a UC-ID. Read the UC's FE `.feature` (web/app), its Design Spec screens, the FE tech-design `{paths.tech_docs_dir}/{domain}/{UC-ID}-tech-design-{platform}.md` (if any), and the figma-components catalog for `active_module`.*
98
+
99
+ ## Context
100
+ # Context Loader — Load All Project Context
101
+
102
+ Execute these steps in order. Store everything in memory for the duration of the command session.
103
+
104
+ **Priority guide (anti-lost-in-middle):**
105
+ - Steps 1–2 are PROJECT-CONFIG — loaded first, resolve all paths and metadata.
106
+ - Step 3 is CRITICAL — architecture + coding standards, the highest-priority facts for generation.
107
+ - Step 4 is SAFETY — data protection rules, enforced silently for the entire session.
108
+ - Steps 5–6 are DOMAIN KNOWLEDGE — terminology and entity definitions.
109
+ - Step 7 is the WORKING MEMORY RECAP — locks critical facts into the top of working memory.
110
+
111
+ ---
112
+
113
+ ## Step 1 — [PROJECT-CONFIG] Load project-context.yaml
114
+
115
+ Read `.agent/project-context.yaml`. Extract and store:
116
+
117
+ **Tech Stack:**
118
+ - `tech_stack.language` → active language (e.g., Java 17, TypeScript, C#, Go)
119
+ - `tech_stack.framework` → active framework (e.g., Spring Boot 3.2, Angular 17, .NET 8)
120
+ - `tech_stack.build_tool` → build tool (e.g., Maven, npm, dotnet, go)
121
+ - `tech_stack.test_framework` → test framework (e.g., JUnit 5 + Mockito, Jest, xUnit)
122
+ - `tech_stack.database` → database (e.g., PostgreSQL, MySQL, MongoDB)
123
+ - `tech_stack.module` → active module profile (e.g., java-spring, angular, dotnet, golang, context-engineering)
124
+
125
+ **Conventions:**
126
+ - `conventions.build_command` → how to compile/build
127
+ - `conventions.test_command` → how to run tests
128
+ - `conventions.service_run` → how to start the service
129
+ - `conventions.ticket_prefix` → ticket ID prefix (e.g., PROJ, FEAT, UC)
130
+
131
+ **Domains:**
132
+ - `domains` → list of active business domains
133
+
134
+ **Paths (if present):**
135
+ - `paths.specs_dir` → BDD specs root
136
+ - `paths.prd_dir` → PRD documents root
137
+ - `paths.refinement_dir` → findings/review output dir
138
+ - `paths.qc_dir` → QC automation artifacts root (visible top-level, one subfolder per UC: `{qc_dir}/{UC-ID}/`)
139
+ - `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)
140
+ - `paths.product_definitions_dir` → product definitions root
141
+ - `paths.domain_knowledge_dir` → domain knowledge root
142
+ - `paths.business_dictionary` → path to business-dictionary.md
143
+ - `paths.core_entities` → path to core-entities.md
144
+ - `paths.tech_docs_dir` → technical documentation root
145
+ - `paths.trace_dir` → trace state directory
146
+ - `paths.design_spec_dir` → Design Spec documents root (FE/App only)
147
+
148
+ If `paths` section is absent, use these defaults:
149
+ - `specs_dir` = `specs/bdd`
150
+ - `prd_dir` = `specs/prd`
151
+ - `refinement_dir` = `.agent/review`
152
+ - `qc_dir` = `docs`
153
+ - `qc_skills_dir` = `.agent/skills/qc`
154
+ - `product_definitions_dir` = `specs/product-definition`
155
+ - `domain_knowledge_dir` = `specs/domain-knowledge`
156
+ - `business_dictionary` = `specs/domain-knowledge/business-dictionary.md`
157
+ - `core_entities` = `specs/domain-knowledge/core-entities.md`
158
+ - `tech_docs_dir` = `specs/tech-docs`
159
+ - `trace_dir` = `.trace`
160
+ - `design_spec_dir` = `specs/design-spec`
161
+
162
+ If `tech_stack.module` is set, also load `.agent/modules/{module}/stack-profile.yaml` if it exists.
163
+
164
+ ---
165
+
166
+ ## Step 1.5 — [SERVICE ROUTING] Resolve service paths (umbrella mode)
167
+
168
+ *Skip this step entirely if `setup.mode` is not `"umbrella"` and `services` section is absent from project-context.yaml.*
169
+
170
+ If `services` section is present:
171
+
172
+ **1. Detect active domain** (in priority order):
173
+ - Read `@trace.domain` from target file frontmatter (if Gate loaded a target file)
174
+ - Extract from target file path: segment immediately after `prd_dir` base path
175
+ *(e.g., `specs/prd/user/FEAT-01.md` → domain = `user`)*
176
+ - If `$ARGUMENTS` contains a path, extract the segment after `prd_dir`
177
+
178
+ **2. Route to service** — if active domain matches a key in `services`:
179
+ - 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.
180
+ - 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.
181
+ - Store `active_service` = `services.{domain}.path`
182
+ - Store `active_service_module` = `services.{domain}.module`
183
+ - If service has its own `module` → use it as `active_module` (overrides `tech_stack.module`)
184
+
185
+ **3. Fallback** — if domain not detected or no matching service key:
186
+ - Keep default paths from Step 1
187
+ - Set `active_service = unresolved`
188
+
189
+ **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
190
+ - 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`.)*
191
+ - Override `paths.prd_dir` → `{spec_source}/specs/prd`
192
+ - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
193
+ - 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.)*
194
+ - Override `paths.domain_knowledge_dir` → `{spec_source}/specs/domain-knowledge`
195
+ - Override `paths.business_dictionary` → `{spec_source}/specs/domain-knowledge/business-dictionary.md`
196
+ - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
197
+ - Override `paths.bug_reports_dir` → `{spec_source}/feedback/bug-reports`
198
+ - Override `paths.bdd_proposals_dir` → `{spec_source}/feedback/bdd-proposals`
199
+ - Override `paths.prd_change_requests_dir` → `{spec_source}/feedback/prd-change-requests`
200
+ - 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`.)*
201
+
202
+ > **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.
203
+
204
+ ---
205
+
206
+ ## Step 1.6 — [SERVICE CONVENTIONS] Load service-specific conventions (umbrella mode)
207
+
208
+ *Skip this step entirely if `active_service` is `"unresolved"` or context is single-service mode.*
209
+
210
+ When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-service/`):
211
+
212
+ **1. Locate service config** — try in priority order:
213
+ - `{active_service}/.agent/project-context.yaml`
214
+ - `{active_service}/project-context.yaml`
215
+
216
+ **2. If found, override with service-specific values:**
217
+
218
+ | Variable | Source |
219
+ |----------|--------|
220
+ | `conventions.test_command` | service's `conventions.test_command` |
221
+ | `conventions.build_command` | service's `conventions.build_command` |
222
+ | `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`). |
223
+ | `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. |
224
+
225
+ **3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
226
+ - Shell commands (`/dev-run-test`, `/dev-gen-test`) run **from within** `service_root`
227
+ - **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/`).
228
+
229
+ **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).
230
+
231
+ ---
232
+
233
+ ## Step 2 — [PROJECT-CONFIG] Load module stack profile (conditional)
234
+
235
+ If `tech_stack.module` is set, read `.agent/modules/{module}/stack-profile.yaml`.
236
+ Merge framework-specific conventions (layer patterns, test patterns, naming rules) into the loaded context.
237
+ If the file does not exist → skip silently.
238
+
239
+ ---
240
+
241
+ ## Step 3 — [CRITICAL] Load CLAUDE.md (layered: root + service overlay)
242
+
243
+ *This is the highest-priority context — it defines HOW to write code and documents for this project.*
244
+
245
+ CLAUDE.md is loaded in **two layers** so umbrella-wide rules and service-specific
246
+ architecture/coding standards compose correctly. The agent always sits at the umbrella
247
+ root, but the implementation code lives in a service submodule with its OWN stack,
248
+ architecture, and conventions — so the service's CLAUDE.md must win for code generation.
249
+
250
+ **Layer 1 — [BASE] Root CLAUDE.md (umbrella-wide).**
251
+ Read `CLAUDE.md` at the repo root. Treat its contents as the **shared baseline** for the
252
+ whole umbrella — git conventions, data-protection posture, cross-cutting rules, and (in
253
+ single-service mode) the project's only architecture + coding standards.
254
+
255
+ **Layer 2 — [OVERLAY] Service CLAUDE.md (umbrella mode only).**
256
+ *Run only if `service_root` was set in Step 1.6 (i.e. a real service was routed to).*
257
+ Read `{service_root}/CLAUDE.md`. This file defines the architecture + coding standards of
258
+ the **actual stack being implemented** (e.g. `user-service` = java-spring, `web` = nextjs).
259
+ Overlay it on top of Layer 1: **on any conflict, the service value WINS** for architecture,
260
+ coding standards, and error handling. Layer-1 values that the service does not redefine
261
+ (e.g. git conventions, banned patterns shared org-wide) remain in effect.
262
+
263
+ From the **merged** result, extract and store:
264
+
265
+ - **§1 Project Overview** → project name, language, framework, build/test commands, domains
266
+ - **§2 Architecture** → layer order (e.g., Controller → Facade → Service → Repository), architectural rules — *service overlay wins*
267
+ - **§3 Coding Standards** → naming conventions (classes, methods), response wrapper type, forbidden patterns — *service overlay wins*
268
+ - **§5 Error Handling** → exception types, HTTP status code mapping, not-found exception class name — *service overlay wins*
269
+ - **§7 Git Conventions** → branch naming pattern, commit message format — *root baseline unless service redefines*
270
+
271
+ **Resolution rules:**
272
+ - If both layers exist → merge as above; record `claude_md_source = root + {service_root}`.
273
+ - If only the service overlay exists (no root CLAUDE.md) → use the service file alone; `claude_md_source = {service_root}`.
274
+ - If `service_root` is set but `{service_root}/CLAUDE.md` is **missing** → fall back to root CLAUDE.md and flag ⚠️ in the Step 7 recap (the service has no architecture/coding-standards definition — code generation will use umbrella defaults, which may be the wrong stack).
275
+ - If neither exists → note CLAUDE.md as missing and continue with project-context.yaml data only.
276
+
277
+ ---
278
+
279
+ ## Step 4 — [SAFETY] Load Data Protection Rules
280
+
281
+ Read `.agent/rules/data-protection.md` (or `rules/data-protection.md` from the framework installation).
282
+
283
+ Store the sensitive file patterns — you must **never** read, write, display, or reference content from files matching those patterns for the entire session.
284
+
285
+ If neither file exists → apply built-in defaults: never access `.env*`, `*.key`, `*.pem`, `*secret*`, `*password*`, `*credential*`.
286
+
287
+ ---
288
+
289
+ ## Step 5 — [DOMAIN] Load Business Dictionary (conditional)
290
+
291
+ Check if the business dictionary file exists (use `paths.business_dictionary` resolved in Step 1).
292
+
293
+ If it exists, read it and extract:
294
+ - **Canonical Terms** → complete list of approved terms and their definitions
295
+ - **Banned Terms** → complete list of banned terms and their canonical replacements
296
+ - **Status / Enum Registry** → allowed enum values per entity
297
+
298
+ Store the banned terms list for **active enforcement** throughout the command session:
299
+ - When generating any text (PRD, BDD, code comments, tech docs), verify no banned terms appear
300
+ - Replace banned terms with their canonical equivalents automatically
301
+
302
+ If the file does not exist → skip silently. Do not warn or block.
303
+
304
+ ---
305
+
306
+ ## Step 6 — [DOMAIN] Load Core Entities (conditional)
307
+
308
+ Check if the core entities file exists at `paths.core_entities` (resolved in Step 1).
309
+ Default path: `specs/domain-knowledge/core-entities.md`.
310
+
311
+ If it exists, read it and store:
312
+ - **Entity catalog** → for each entity: its name, purpose, owner service, key fields (name + type), business invariants, and relationships
313
+ - **Field name registry** → canonical field names to use in generated code and documents
314
+ - **Relationship map** → how entities relate to each other (1:N, N:N, embedded, etc.)
315
+
316
+ **How to use this catalog:**
317
+ - When generating code: use the field names, types, and relationships defined here — do NOT infer from existing code
318
+ - When generating PRD/BDD: reference entity names from this catalog for consistency
319
+ - When generating tech-docs: use this catalog as the source-of-truth for entity definitions
320
+
321
+ If the file does not exist → skip silently.
322
+
323
+ ---
324
+
325
+ ## Step 6.5 — [PLATFORM] Derive active_module and platform_type
326
+
327
+ Using `tech_stack.module` loaded in Step 1, derive and store two variables for use by all downstream commands:
328
+
329
+ ```
330
+ active_module = tech_stack.module (e.g. "java-spring", "react", "flutter")
331
+ ```
332
+
333
+ | `platform_type` | Modules |
334
+ |---|---|
335
+ | `backend` | `java-spring`, `golang`, `dotnet`, `php-laravel`, `context-engineering` |
336
+ | `web-frontend` | `react`, `nextjs`, `vue`, `nuxt`, `angular` |
337
+ | `mobile` | `flutter`, `react-native`, `ios-swiftui`, `android-compose` |
338
+
339
+ If `tech_stack.module` is blank or not recognized → set `platform_type = "unknown"` and flag as ⚠️ in the Step 7 recap.
340
+
341
+ 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).
342
+
343
+ ---
344
+
345
+ ## Step 6.7 — [GUARDRAILS] Load Project Lessons (conditional)
346
+
347
+ *Accumulated mistakes the AI must not repeat in this project. These are added over time via `/learn`
348
+ or accepted during `/review-code`, `/fix-bug`, `/debug`.*
349
+
350
+ Resolve the lessons file path:
351
+ - Use `paths.lessons_file` if set (may be service-overridden in umbrella mode, Step 1.6)
352
+ - Else default `specs/domain-knowledge/lessons-learned.md`
353
+ - In umbrella/service mode (when `service_root` is set), if `paths.lessons_file` is unset, default to `{service_root}/.agent/project-lessons.md`
354
+
355
+ If the file exists, read it and store ALL lessons as **ACTIVE GUARDRAILS** for the session:
356
+ - Treat each lesson's **Rule** as a hard constraint — same priority as CLAUDE.md coding standards (Step 3).
357
+ - Before generating or modifying any artifact (PRD, BDD, tech-doc, code, test), check the output against every lesson whose `category` matches the current command AND whose `scope` matches the target (domain / file).
358
+ - If a generated output would violate a lesson → correct it **before** presenting, and note which lesson (`L-NNN`) was applied.
359
+
360
+ If the file does not exist → skip silently (no lessons captured yet).
361
+
362
+ ---
363
+
364
+ ## Step 7 — [RECAP] Working Memory Recap (anti-lost-in-middle)
365
+
366
+ After loading all context, synthesize and output a compact summary block.
367
+ This recap ensures the most critical facts are stated at the END of context loading
368
+ (recency effect — freshest in working memory when the task begins).
369
+
370
+ Output exactly this block:
371
+ ```
372
+ [CTX LOADED]
373
+ Stack : {language} / {framework} / {database}
374
+ Platform : {active_module} ({platform_type})
375
+ Layers : {layer order from merged CLAUDE.md §2, e.g., Controller → Facade → Service → Repository}
376
+ CLAUDE.md : {root + {service_root} | {service_root} only | root only | ⚠️ service overlay MISSING — using root | missing}
377
+ Ticket : {ticket_prefix}-
378
+ Dict : {loaded — N canonical terms, M banned terms | missing}
379
+ Entities : {loaded — EntityA, EntityB, EntityC | missing}
380
+ Lessons : {loaded — N guardrails | none yet}
381
+ Service : {active_service} ({active_service_module}) | single-service
382
+ Svc Root : {service_root} — conventions + trace_dir loaded from service config | —
383
+ Status : {FULL | PARTIAL — missing: CLAUDE.md / business-dict / core-entities | MINIMAL}
384
+ ```
385
+
386
+ If any CRITICAL file is missing (CLAUDE.md), flag it clearly so the user can decide whether to proceed.
387
+
388
+ ---
389
+
390
+ ## Context Load Complete
391
+
392
+ After completing all steps, you have loaded:
393
+ - Project identity, tech stack, module conventions
394
+ - Architecture rules and layer order ← **[CRITICAL — hold in working memory]**
395
+ - Coding standards and naming conventions ← **[CRITICAL — hold in working memory]**
396
+ - Data protection rules (sensitive file patterns to never access)
397
+ - Terminology rules with banned-term list ← **[DOMAIN — apply to every generated word]**
398
+ - Entity catalog (field names, types, invariants) ← **[DOMAIN — use for code generation]**
399
+ - All configured paths
400
+
401
+ Proceed to the next step of the calling command.
402
+
403
+
404
+ ---
405
+
406
+ ## Step 0 — Platform guard
407
+
408
+ Resolve `platform` from `@trace.platform` / `platform_type`. Test-ids are a **FE/App** concern — if `system` / backend → HALT:
409
+ ```
410
+ ❌ /map-testids applies to FE/App (web/app) only. BE has no UI test-ids.
411
+ ```
412
+ Resolve the test-id attribute from `@trace.testid_attr` (or by module): web `data-testid` · React Native `testID` · Flutter `Key`/`Semantics(identifier:)` · native iOS `accessibilityIdentifier`.
413
+
414
+ ## Step 1 — Collect actionable elements
415
+
416
+ From the UC's FE `.feature` `When` steps + the Design Spec screens, list every **actionable** element the scenarios touch (button, input, link, select, toggle, form-submit). Skip static text/labels. For each, resolve the rendering component and classify:
417
+ - **reused** — matches a row in the figma-components catalog (shared design-system component);
418
+ - **existing** — feature-specific component already in the codebase (brownfield);
419
+ - **new** — not yet coded (leave to `/generate-code`; just record the intended id).
420
+
421
+ ## Step 2 — Resolve a stable test-id per element
422
+
423
+ - **Existing/brownfield:** read the component file. If the element **already** has a test-id (in the platform attribute) → **reverse-document** it (reuse as-is). Else assign by convention `{uc-lower}-{screen}-{element}-{type}` (e.g. `ft001-login-submit-btn`). Never embed the scenario number.
424
+ - **Reused:** the id is applied at the **usage site** (not baked into the shared component) → assign by the same convention.
425
+ - **Cross-platform:** if the **other** platform's tech-design (`{UC-ID}-tech-design-{web|app}.md`) already has a §2b id for the same logical element, **reuse that id value** (only the attribute differs per platform) so web and app stay consistent and QC logic is portable.
426
+
427
+ ## Step 3 — Ensure reusable components forward a test-id (catalog)
428
+
429
+ For each **reused** actionable component, consult the catalog's **`## Test-ID Forwarding`** section (`{paths.domain_knowledge_dir}/figma-components/{active_module}.md`):
430
+ - **Forwarding prop recorded** → use it at the usage site (Step 4).
431
+ - **Not recorded** → inspect the component source:
432
+ - Already forwards (spreads `...props` / has a `testId`/`testID` prop / passes the attribute through) → **record** the prop in the catalog's Test-ID Forwarding table.
433
+ - Does **not** forward → **patch the component ONCE** to accept + forward a test-id (web: add prop `testId` → render `data-testid={testId}`; RN: `testID`; Flutter: pass `Key`/`Semantics(identifier:)`; iOS: `accessibilityIdentifier`), then record it in the catalog.
434
+
435
+ Print every catalog row added and every shared component patched (these touch shared code — call them out for review).
436
+
437
+ ## Step 4 — Patch usage sites (EXTEND only)
438
+
439
+ For each actionable element in this UC's **existing/reused** screens, add the test-id at the usage site — the raw attribute for plain elements, or the forwarding prop for a reused component — with the id from Step 2. **EXTEND mode:** touch only the attribute/prop; do not refactor anything else. Skip elements already carrying the correct id (idempotent).
440
+
441
+ ## Step 5 — Write/refresh the §2b Test Selectors map
442
+
443
+ Create or update §2b of `{paths.tech_docs_dir}/{domain}/{UC-ID}-tech-design-{platform}.md`:
444
+ - If the FE tech-design exists → update its §2b table.
445
+ - If it does **not** exist yet (pure brownfield) → write a minimal file: the `@trace` header (incl `@trace.testid_attr`) + only §2b. `/generate-tech-docs` (FE) fills the remaining sections later; it must not overwrite the §2b ids this command recorded.
446
+
447
+ Each row: `Test-ID | Element | Component (reused/existing/new) | Action | Serves SC`.
448
+
449
+ ## Step 6 — Handoff
450
+
451
+ If the tech-design lives in the shared spec repo (`spec_source` set), commit + push (2-layer) like `/generate-tech-docs`. Shared-component patches go in the FE service submodule (2-tang push, see Sync & Update §4.4).
452
+
453
+ ## Output
454
+
455
+ # Report Footer — Standard Command Output Format
456
+
457
+ Every command report must end with this standard footer section.
458
+
459
+ ## Status Badge
460
+
461
+ Choose one based on outcome:
462
+ - `✅ Complete` — all steps succeeded, no issues found
463
+ - `❌ Failed` — command could not complete due to a blocking error
464
+ - `⚠️ Warnings` — completed with non-blocking issues that should be reviewed
465
+
466
+ ## Output Artifacts
467
+
468
+ List every file created or modified by this command:
469
+ ```
470
+ Output Artifacts:
471
+ {created|updated} {file-path} ({brief description})
472
+ {created|updated} {file-path} ({brief description})
473
+ ```
474
+
475
+ If no files were written (e.g., review or analysis commands) → write `Output Artifacts: none (read-only)`.
476
+
477
+ ## Pipeline Position
478
+
479
+ Print a one-line map of the pipeline with the CURRENT command's phase marked `◀ bạn ở đây`,
480
+ so the user always sees where this command sits in the end-to-end flow:
481
+
482
+ ```
483
+ Discovery → PRD → [Design Spec] → BDD → Tech Design → Code → Dev Self-Check → QC → Trace Audit
484
+ ```
485
+
486
+ Find the current command in this phase legend and mark **its** phase in the map above:
487
+
488
+ | Phase | Commands |
489
+ |-------|----------|
490
+ | Discovery | `/define-product` |
491
+ | PRD | `/generate-prd` · `/refine-prd` · `/review-context` (PRD) |
492
+ | Design Spec | `/generate-design-spec` |
493
+ | BDD | `/generate-bdd` · `/review-context` (BDD) |
494
+ | Tech Design | `/generate-tech-docs` · `/map-testids` · `/review-tech-docs` |
495
+ | Code | `/generate-code` · `/review-code` |
496
+ | Dev Self-Check | `/dev-gen-test` · `/dev-run-test` · `/dev-smoke-test` |
497
+ | QC | `/qc-analyze` · `/qc-plan` · `/qc-design-test` · `/qc-review` · `/qc-run-test` · `/qc-report` |
498
+ | Trace Audit | `/validate-traces` |
499
+
500
+ For a **review command**, also append the 3-step review loop with the current step marked, e.g.:
501
+ `Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume`.
502
+
503
+ **Cross-cutting commands** (`/sync`, `/update-framework`, `/fix-bug`, `/debug`, `/learn`,
504
+ `/report-bug`, `/propose-scenario`, `/generate-spec-manifest`) sit outside the linear pipeline —
505
+ **omit the Pipeline line entirely** for these (do not force-fit them onto the map).
506
+
507
+ ## Next Command Suggestion
508
+
509
+ Suggest the logical next command based on workflow phase:
510
+
511
+ | Current command | Suggest next |
512
+ |-------------------------|-----------------------------------------------|
513
+ | /setup-ai-first | `/define-product` to start your first feature |
514
+ | /define-product | `/generate-prd {product-definition-file}` |
515
+ | /generate-prd | `/refine-prd {prd-file}` then `/review-context {prd-file}` |
516
+ | /refine-prd | Open Review Board → update PRD → `/review-context {prd-file}` |
517
+ | /review-context (PRD) | FE/App: `/generate-design-spec {prd-file}` (then BDD after sign-off); BE: `/generate-bdd {prd-file}` directly; fix PRD if NEEDS_FIX |
518
+ | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
519
+ | /generate-bdd | `/review-context {feature-file}` to verify coverage |
520
+ | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
521
+ | /qc-analyze | `/qc-plan {UC-ID}` (resolve 🔴 blocker gaps first) |
522
+ | /qc-plan | `/qc-design-test {UC-ID}` |
523
+ | /qc-design-test | `/qc-review {UC-ID}` (test-case review) |
524
+ | /qc-review (test-case) | `/qc-run-test {UC-ID}` if APPROVED; fix TCs if NEEDS_FIX |
525
+ | /qc-run-test | `/qc-report {UC-ID}` then `/qc-review {UC-ID}` (script review) |
526
+ | /qc-review (script) | `/qc-report {UC-ID}` then create PR if APPROVED |
527
+ | /qc-report | `/validate-traces {UC-ID}` to refresh Living Docs (qc_status) |
528
+ | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
529
+ | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
530
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/dev-gen-test {UC-ID}` |
531
+ | /dev-gen-test | `/dev-run-test {UC-ID}` |
532
+ | /dev-run-test (passing) | `/review-code {UC-ID}` |
533
+ | /dev-run-test (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
534
+ | /review-code | `/dev-smoke-test {UC-ID}` or create PR |
535
+ | /dev-smoke-test | Create PR and link to ticket |
536
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/dev-gen-test {UC-ID}`; all OK → create PR |
537
+ | /fix-bug | Create PR and link to ticket |
538
+ | /debug | `/fix-bug {ticket-id}` if fix needed |
539
+ | /report-bug | Send to dev (`/fix-bug {BUG-ID}`); if coverage gap → `/propose-scenario {UC-ID}` |
540
+ | /propose-scenario | Notify PO/Dev to review the proposal in `feedback/bdd-proposals/` |
541
+ | /learn | Continue working — lesson applies on next command |
542
+ | /sync | `/validate-traces` for full coverage; act on any `📥 tester feedback` surfaced |
543
+ | /update-framework | Review `git diff .agent/`, commit; `/sync` for project content |
544
+
545
+ Format the footer as:
546
+ ```
547
+ ---
548
+ Status : {badge}
549
+ {Output Artifacts block}
550
+ Pipeline : Discovery → PRD → [BDD ◀ bạn ở đây] → Tech Design → Code → Dev Self-Check → QC → Trace Audit
551
+ (review cmd) Vòng review: [① phân tích ◀] → ② Review Board → ③ --resume
552
+ Next : {suggested command with example arguments}
553
+ ```
554
+ *(Omit the `Pipeline` line for cross-cutting commands listed above.)*
555
+
556
+
557
+ ```
558
+ /map-testids Complete — {UC-ID} ({platform})
559
+ Elements: {N} mapped — {reused} reused · {existing} existing (backfilled) · {new} deferred to /generate-code
560
+ Forwarding: {M} shared components patched to forward a test-id · {K} catalog rows recorded
561
+ §2b: {paths.tech_docs_dir}/{domain}/{UC-ID}-tech-design-{platform}.md updated ({N} selectors)
562
+ Next: /review-tech-docs {tech-design} ← review the §2b map + shared-component patches
563
+ /qc-design-test {UC-ID} ← QC now locates by test-id (no scan)
564
+ ```
@@ -0,0 +1,81 @@
1
+ # /map-testids — Define/backfill stable test-ids onto reused & existing FE components
2
+
3
+ > Companion to the FE tech-design §2b *Test Selectors* contract. `/generate-tech-docs` (FE) and
4
+ > `/generate-code` assign test-ids to **new** code; this command handles the rest: **reused**
5
+ > catalog components (id lives at the usage site; the component must *forward* a test-id) and
6
+ > **existing / brownfield** screens already coded without test-ids. It reverse-documents what
7
+ > exists, assigns stable ids where missing, ensures reusable components forward an id, records the
8
+ > forwarding in the figma-components catalog, patches usage sites, and writes the §2b map — so QC
9
+ > locates elements by id instead of scanning at runtime.
10
+
11
+ Usage: `/map-testids {UC-ID}`
12
+
13
+ ## Gate
14
+ {{include:steps/gate.md}}
15
+
16
+ *Note: For this command, the target in Step 1 is a UC-ID. Read the UC's FE `.feature` (web/app), its Design Spec screens, the FE tech-design `{paths.tech_docs_dir}/{domain}/{UC-ID}-tech-design-{platform}.md` (if any), and the figma-components catalog for `active_module`.*
17
+
18
+ ## Context
19
+ {{include:steps/context-loader.md}}
20
+
21
+ ---
22
+
23
+ ## Step 0 — Platform guard
24
+
25
+ Resolve `platform` from `@trace.platform` / `platform_type`. Test-ids are a **FE/App** concern — if `system` / backend → HALT:
26
+ ```
27
+ ❌ /map-testids applies to FE/App (web/app) only. BE has no UI test-ids.
28
+ ```
29
+ Resolve the test-id attribute from `@trace.testid_attr` (or by module): web `data-testid` · React Native `testID` · Flutter `Key`/`Semantics(identifier:)` · native iOS `accessibilityIdentifier`.
30
+
31
+ ## Step 1 — Collect actionable elements
32
+
33
+ From the UC's FE `.feature` `When` steps + the Design Spec screens, list every **actionable** element the scenarios touch (button, input, link, select, toggle, form-submit). Skip static text/labels. For each, resolve the rendering component and classify:
34
+ - **reused** — matches a row in the figma-components catalog (shared design-system component);
35
+ - **existing** — feature-specific component already in the codebase (brownfield);
36
+ - **new** — not yet coded (leave to `/generate-code`; just record the intended id).
37
+
38
+ ## Step 2 — Resolve a stable test-id per element
39
+
40
+ - **Existing/brownfield:** read the component file. If the element **already** has a test-id (in the platform attribute) → **reverse-document** it (reuse as-is). Else assign by convention `{uc-lower}-{screen}-{element}-{type}` (e.g. `ft001-login-submit-btn`). Never embed the scenario number.
41
+ - **Reused:** the id is applied at the **usage site** (not baked into the shared component) → assign by the same convention.
42
+ - **Cross-platform:** if the **other** platform's tech-design (`{UC-ID}-tech-design-{web|app}.md`) already has a §2b id for the same logical element, **reuse that id value** (only the attribute differs per platform) so web and app stay consistent and QC logic is portable.
43
+
44
+ ## Step 3 — Ensure reusable components forward a test-id (catalog)
45
+
46
+ For each **reused** actionable component, consult the catalog's **`## Test-ID Forwarding`** section (`{paths.domain_knowledge_dir}/figma-components/{active_module}.md`):
47
+ - **Forwarding prop recorded** → use it at the usage site (Step 4).
48
+ - **Not recorded** → inspect the component source:
49
+ - Already forwards (spreads `...props` / has a `testId`/`testID` prop / passes the attribute through) → **record** the prop in the catalog's Test-ID Forwarding table.
50
+ - Does **not** forward → **patch the component ONCE** to accept + forward a test-id (web: add prop `testId` → render `data-testid={testId}`; RN: `testID`; Flutter: pass `Key`/`Semantics(identifier:)`; iOS: `accessibilityIdentifier`), then record it in the catalog.
51
+
52
+ Print every catalog row added and every shared component patched (these touch shared code — call them out for review).
53
+
54
+ ## Step 4 — Patch usage sites (EXTEND only)
55
+
56
+ For each actionable element in this UC's **existing/reused** screens, add the test-id at the usage site — the raw attribute for plain elements, or the forwarding prop for a reused component — with the id from Step 2. **EXTEND mode:** touch only the attribute/prop; do not refactor anything else. Skip elements already carrying the correct id (idempotent).
57
+
58
+ ## Step 5 — Write/refresh the §2b Test Selectors map
59
+
60
+ Create or update §2b of `{paths.tech_docs_dir}/{domain}/{UC-ID}-tech-design-{platform}.md`:
61
+ - If the FE tech-design exists → update its §2b table.
62
+ - If it does **not** exist yet (pure brownfield) → write a minimal file: the `@trace` header (incl `@trace.testid_attr`) + only §2b. `/generate-tech-docs` (FE) fills the remaining sections later; it must not overwrite the §2b ids this command recorded.
63
+
64
+ Each row: `Test-ID | Element | Component (reused/existing/new) | Action | Serves SC`.
65
+
66
+ ## Step 6 — Handoff
67
+
68
+ If the tech-design lives in the shared spec repo (`spec_source` set), commit + push (2-layer) like `/generate-tech-docs`. Shared-component patches go in the FE service submodule (2-tang push, see Sync & Update §4.4).
69
+
70
+ ## Output
71
+
72
+ {{include:steps/report-footer.md}}
73
+
74
+ ```
75
+ /map-testids Complete — {UC-ID} ({platform})
76
+ Elements: {N} mapped — {reused} reused · {existing} existing (backfilled) · {new} deferred to /generate-code
77
+ Forwarding: {M} shared components patched to forward a test-id · {K} catalog rows recorded
78
+ §2b: {paths.tech_docs_dir}/{domain}/{UC-ID}-tech-design-{platform}.md updated ({N} selectors)
79
+ Next: /review-tech-docs {tech-design} ← review the §2b map + shared-component patches
80
+ /qc-design-test {UC-ID} ← QC now locates by test-id (no scan)
81
+ ```