@anhth2/spec-driven-dev-plugin 0.7.0 → 0.9.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/ARCHITECTURE.md +6 -2
- package/bin/index.js +105 -0
- package/commands/debug.md +189 -1
- package/commands/debug.tmpl +16 -0
- package/commands/define-product.md +94 -1
- package/commands/fix-bug.md +190 -1
- package/commands/fix-bug.tmpl +17 -0
- package/commands/generate-bdd.md +314 -14
- package/commands/generate-bdd.tmpl +220 -13
- package/commands/generate-code.md +191 -3
- package/commands/generate-code.tmpl +97 -2
- package/commands/generate-design-spec.md +811 -0
- package/commands/generate-design-spec.tmpl +399 -0
- package/commands/generate-prd.md +133 -1
- package/commands/generate-prd.tmpl +39 -0
- package/commands/generate-spec-manifest.md +576 -0
- package/commands/generate-spec-manifest.tmpl +164 -0
- package/commands/generate-tech-docs.md +116 -2
- package/commands/generate-tech-docs.tmpl +22 -1
- package/commands/generate-tests.md +94 -1
- package/commands/learn.md +554 -0
- package/commands/learn.tmpl +63 -0
- package/commands/propose-scenario.md +521 -0
- package/commands/propose-scenario.tmpl +109 -0
- package/commands/refine-prd.md +94 -1
- package/commands/report-bug.md +543 -0
- package/commands/report-bug.tmpl +131 -0
- package/commands/review-code.md +190 -1
- package/commands/review-code.tmpl +17 -0
- package/commands/review-context.md +134 -1
- package/commands/review-context.tmpl +40 -0
- package/commands/review-tech-docs.md +176 -5
- package/commands/review-tech-docs.tmpl +82 -4
- package/commands/run-tests.md +119 -1
- package/commands/run-tests.tmpl +25 -0
- package/commands/setup-ai-first.md +142 -4
- package/commands/setup-ai-first.tmpl +135 -3
- package/commands/smoke-test.md +94 -1
- package/commands/sync.md +405 -0
- package/commands/sync.tmpl +345 -0
- package/commands/update-framework.md +211 -0
- package/commands/update-framework.tmpl +151 -0
- package/commands/validate-traces.md +152 -3
- package/commands/validate-traces.tmpl +58 -2
- package/core/FRAMEWORK_VERSION +1 -1
- package/core/commands/debug.md +189 -1
- package/core/commands/define-product.md +94 -1
- package/core/commands/fix-bug.md +190 -1
- package/core/commands/generate-bdd.md +314 -14
- package/core/commands/generate-code.md +191 -3
- package/core/commands/generate-design-spec.md +811 -0
- package/core/commands/generate-prd.md +133 -1
- package/core/commands/generate-spec-manifest.md +576 -0
- package/core/commands/generate-tech-docs.md +116 -2
- package/core/commands/generate-tests.md +94 -1
- package/core/commands/learn.md +554 -0
- package/core/commands/propose-scenario.md +521 -0
- package/core/commands/refine-prd.md +94 -1
- package/core/commands/report-bug.md +543 -0
- package/core/commands/review-code.md +190 -1
- package/core/commands/review-context.md +134 -1
- package/core/commands/review-tech-docs.md +176 -5
- package/core/commands/run-tests.md +119 -1
- package/core/commands/setup-ai-first.md +142 -4
- package/core/commands/smoke-test.md +94 -1
- package/core/commands/sync.md +405 -0
- package/core/commands/update-framework.md +211 -0
- package/core/commands/validate-traces.md +152 -3
- package/core/skills/code/SKILL.md +101 -2
- package/core/skills/debug/SKILL.md +108 -3
- package/core/skills/design-spec/SKILL.md +507 -0
- package/core/skills/discovery/SKILL.md +94 -1
- package/core/skills/prd/SKILL.md +14 -2
- package/core/skills/setup-ai-first/SKILL.md +7 -1
- package/core/skills/spec/SKILL.md +14 -2
- package/core/skills/test/SKILL.md +195 -3
- package/core/steps/capture-lesson.md +79 -0
- package/core/steps/context-loader.md +87 -0
- package/core/steps/report-footer.md +7 -1
- package/core/templates/design-spec.template.md +209 -0
- package/core/templates/project-context.yaml +40 -0
- package/package.json +1 -1
- package/skills/code/SKILL.md +101 -2
- package/skills/debug/SKILL.md +108 -3
- package/skills/design-spec/SKILL.md +507 -0
- package/skills/design-spec/SKILL.tmpl +95 -0
- package/skills/discovery/SKILL.md +94 -1
- package/skills/prd/SKILL.md +14 -2
- package/skills/setup-ai-first/SKILL.md +7 -1
- package/skills/spec/SKILL.md +14 -2
- package/skills/test/SKILL.md +195 -3
- package/steps/capture-lesson.md +79 -0
- package/steps/context-loader.md +87 -0
- package/steps/report-footer.md +7 -1
- package/templates/design-spec.template.md +209 -0
- package/templates/project-context.yaml +40 -0
|
@@ -30,6 +30,39 @@ Read:
|
|
|
30
30
|
|
|
31
31
|
---
|
|
32
32
|
|
|
33
|
+
## Phase Detection
|
|
34
|
+
|
|
35
|
+
Parse `$ARGUMENTS` for a `--phase` flag:
|
|
36
|
+
|
|
37
|
+
| Flag | Meaning |
|
|
38
|
+
|---|---|
|
|
39
|
+
| `--phase=ui` | FE Phase 1 — generate UI + mock API layer from System BDD contract |
|
|
40
|
+
| `--phase=integration` | FE Phase 2 — replace mock adapter with real API calls from tech docs |
|
|
41
|
+
| *(none)* | Default — full implementation (BE or full-stack without mock split) |
|
|
42
|
+
|
|
43
|
+
**If `--phase` is set — confirm platform:**
|
|
44
|
+
Read `@trace.platform` from the feature file header.
|
|
45
|
+
- If `system` → warn: "`--phase` flag is not applicable for system BDD (BE-facing). Proceeding with default mode." Treat as no flag.
|
|
46
|
+
- If `web` or `app` → continue with phase logic below.
|
|
47
|
+
|
|
48
|
+
**If `--phase=ui`:**
|
|
49
|
+
Load System BDD for this UC: find `{specs_dir}/{domain}/system/{TICKET-ID}*.feature`.
|
|
50
|
+
Extract all `Then` clauses → collect implied response shapes and error states.
|
|
51
|
+
If System BDD not found → warn: "System BDD not found — mock layer will use placeholder fixtures." Continue.
|
|
52
|
+
|
|
53
|
+
**If `--phase=integration`:**
|
|
54
|
+
Read tech-doc `@trace.status` from `{paths.tech_docs_dir}/{domain}/{UC-ID}-tech-design.md`.
|
|
55
|
+
If `draft` or `in-review` → warn:
|
|
56
|
+
```
|
|
57
|
+
⚠ Tech docs for {UC-ID} are {status}.
|
|
58
|
+
BE may not have a stable API contract yet.
|
|
59
|
+
Proceeding — ensure BE endpoint is deployed or confirm contract manually.
|
|
60
|
+
```
|
|
61
|
+
Locate existing mock adapter from `--phase=ui` run (search for `{UC-ID}MockApiAdapter` in `{paths.src_dir}/{domain}/`).
|
|
62
|
+
If not found → warn: "Mock adapter not found — generating real API adapter from scratch using tech-doc contract."
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
33
66
|
## Read Trace State
|
|
34
67
|
|
|
35
68
|
Read `{paths.trace_dir}/{UC-ID}.tsv` if it exists. For each scenario row, note its current `status`:
|
|
@@ -74,6 +107,7 @@ Ticket : {TICKET_ID if known}
|
|
|
74
107
|
Domain : {domain}
|
|
75
108
|
UC : {UC-ID} only ← other feature files in this folder are NOT read
|
|
76
109
|
Tech : {language} / {framework}
|
|
110
|
+
Phase : {UI — mock layer | Integration — real API | Default — full} ← omit if no --phase flag
|
|
77
111
|
Scenarios: {N} total ({X} new, {Y} drifted, {Z} synced-skip)
|
|
78
112
|
Layer : {from CLAUDE.md §2}
|
|
79
113
|
|
|
@@ -120,6 +154,53 @@ DTOs → Entity/Model → Repository → Service interface → Service impl →
|
|
|
120
154
|
|
|
121
155
|
> **Entry-point rule:** `@trace.implements` must appear on the **entry-point layer** as defined in `CLAUDE.md §2`. For REST APIs → Controller. For event-driven modules → event handler / consumer class. For context-engineering → the prompt orchestration function. Never put it only on an inner layer.
|
|
122
156
|
|
|
157
|
+
## Mock API Layer (`--phase=ui` only)
|
|
158
|
+
|
|
159
|
+
*Skip this section entirely if `--phase` is not `ui`.*
|
|
160
|
+
|
|
161
|
+
Using the System BDD `Then` clauses loaded in Phase Detection:
|
|
162
|
+
|
|
163
|
+
1. **Extract fixture data** per scenario — success responses + error responses.
|
|
164
|
+
2. **Generate mock adapter** at `{paths.src_dir}/{domain}/{UC-ID}MockApiAdapter.{ext}`:
|
|
165
|
+
- Implements interface `{UC-ID}ApiPort` (same interface the real adapter will implement)
|
|
166
|
+
- Each method returns fixture data matching the BDD `Then` clause
|
|
167
|
+
- Include both success and error states (map to error scenarios in BDD)
|
|
168
|
+
- Traceability tags:
|
|
169
|
+
```
|
|
170
|
+
@trace.mock_for={UC-ID}
|
|
171
|
+
@trace.system_bdd={paths.specs_dir}/{domain}/system/{UC-ID}*.feature
|
|
172
|
+
```
|
|
173
|
+
3. **Wire into service/hook layer** via environment flag or DI:
|
|
174
|
+
```
|
|
175
|
+
const adapter = IS_MOCK ? new {UC-ID}MockApiAdapter() : new {UC-ID}ApiAdapter()
|
|
176
|
+
```
|
|
177
|
+
- `IS_MOCK` defaults to `true` in development/test env until real adapter is generated.
|
|
178
|
+
|
|
179
|
+
> Tester uses the mock adapter to test all FE scenarios without waiting for BE.
|
|
180
|
+
> Mock fixture data is derived directly from System BDD — BDD is the source of truth.
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## Integration Phase (`--phase=integration` only)
|
|
185
|
+
|
|
186
|
+
*Skip this section entirely if `--phase` is not `integration`.*
|
|
187
|
+
|
|
188
|
+
1. **Read tech-doc API contract** from `{paths.tech_docs_dir}/{domain}/{UC-ID}-tech-design.md` — extract endpoints, request/response shapes, error codes.
|
|
189
|
+
2. **Read existing mock adapter** interface (`{UC-ID}ApiPort`) from the `--phase=ui` output.
|
|
190
|
+
3. **Generate real API adapter** at `{paths.src_dir}/{domain}/{UC-ID}ApiAdapter.{ext}`:
|
|
191
|
+
- Implements the same `{UC-ID}ApiPort` interface as mock adapter
|
|
192
|
+
- Makes real HTTP calls to endpoints from tech-doc contract
|
|
193
|
+
- Maps response fields to the same shapes the mock adapter returned
|
|
194
|
+
- Traceability tags:
|
|
195
|
+
```
|
|
196
|
+
@trace.implements={UC-ID}-SC{N}
|
|
197
|
+
@trace.tech_doc_revision={read from tech-doc header}
|
|
198
|
+
```
|
|
199
|
+
4. **Flip wire-up**: switch DI binding / env flag so service/hook uses `{UC-ID}ApiAdapter` (real) instead of mock.
|
|
200
|
+
5. **Do NOT delete mock adapter** — keep it for unit testing.
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
123
204
|
## Self-Review (3 rounds)
|
|
124
205
|
- [ ] Every scenario has a corresponding endpoint
|
|
125
206
|
- [ ] @trace.implements on every endpoint
|
|
@@ -142,6 +223,7 @@ Update `{paths.trace_dir}/{UC-ID}.tsv` — for each implemented scenario, find t
|
|
|
142
223
|
| `implemented_by` | `{ControllerClass}.{methodName}` |
|
|
143
224
|
| `bdd_version` | `@trace.bdd_version` from `.feature` header |
|
|
144
225
|
| `tech_doc_revision` | `@trace.revision` from tech-doc header, or `—` if no tech-doc |
|
|
226
|
+
| `fe_phase` | `ui` if `--phase=ui` \| `integrated` if `--phase=integration` \| `—` if no phase flag |
|
|
145
227
|
| `last_updated` | today `YYYY-MM-DD` |
|
|
146
228
|
|
|
147
229
|
Leave all other columns (`sc_title`, `spec_ver`, `prd_version`, `prd_status`, `uc_status`, `test_count`, `test_classes`) unchanged.
|
|
@@ -161,7 +243,20 @@ git commit -m "{commit_format}: {description}"
|
|
|
161
243
|
/generate-code Complete — {UC-ID}
|
|
162
244
|
Files: created={N}, extended={M}, skipped={K} | Build: SUCCESS
|
|
163
245
|
Branch: feature/{TICKET_ID}-{slug}
|
|
246
|
+
Phase : {UI (mock layer) | Integration (real API) | Default (full)}
|
|
247
|
+
fe_phase : {ui | integrated | —}
|
|
248
|
+
|
|
164
249
|
Next:
|
|
165
|
-
|
|
166
|
-
|
|
250
|
+
--phase=ui done:
|
|
251
|
+
→ Notify tester: FE is testable via mock adapter
|
|
252
|
+
→ Collect BE sign-offs → /review-tech-docs {tech-design-file}
|
|
253
|
+
→ When BE ready → /generate-code {feature-file} --phase=integration
|
|
254
|
+
|
|
255
|
+
--phase=integration done:
|
|
256
|
+
→ /review-code {UC-ID} ← code review required
|
|
257
|
+
→ /generate-tests {UC-ID} ← integration test suite
|
|
258
|
+
|
|
259
|
+
Default (no phase flag):
|
|
260
|
+
→ /review-code {UC-ID} ← code review required before tests
|
|
261
|
+
→ /generate-tests {UC-ID}
|
|
167
262
|
```
|