@anhth2/spec-driven-dev-plugin 0.5.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 +243 -0
- package/bin/build.js +230 -0
- package/bin/index.js +311 -0
- package/commands/debug.md +374 -0
- package/commands/debug.tmpl +77 -0
- package/commands/define-product.md +451 -0
- package/commands/define-product.tmpl +154 -0
- package/commands/fix-bug.md +379 -0
- package/commands/fix-bug.tmpl +82 -0
- package/commands/generate-bdd.md +591 -0
- package/commands/generate-bdd.tmpl +294 -0
- package/commands/generate-code.md +395 -0
- package/commands/generate-code.tmpl +98 -0
- package/commands/generate-prd.md +488 -0
- package/commands/generate-prd.tmpl +191 -0
- package/commands/generate-tech-docs.md +362 -0
- package/commands/generate-tech-docs.tmpl +65 -0
- package/commands/generate-tests.md +377 -0
- package/commands/generate-tests.tmpl +80 -0
- package/commands/refine-prd.md +408 -0
- package/commands/refine-prd.tmpl +111 -0
- package/commands/review-code.md +354 -0
- package/commands/review-code.tmpl +57 -0
- package/commands/review-context.md +646 -0
- package/commands/review-context.tmpl +349 -0
- package/commands/review-tech-docs.md +518 -0
- package/commands/review-tech-docs.tmpl +221 -0
- package/commands/run-tests.md +343 -0
- package/commands/run-tests.tmpl +46 -0
- package/commands/setup-ai-first.md +278 -0
- package/commands/setup-ai-first.tmpl +197 -0
- package/commands/smoke-test.md +366 -0
- package/commands/smoke-test.tmpl +69 -0
- package/commands/validate-traces.md +529 -0
- package/commands/validate-traces.tmpl +232 -0
- package/core/FRAMEWORK_VERSION +1 -0
- package/core/commands/debug.md +374 -0
- package/core/commands/define-product.md +451 -0
- package/core/commands/fix-bug.md +379 -0
- package/core/commands/generate-bdd.md +591 -0
- package/core/commands/generate-code.md +395 -0
- package/core/commands/generate-prd.md +488 -0
- package/core/commands/generate-tech-docs.md +362 -0
- package/core/commands/generate-tests.md +377 -0
- package/core/commands/refine-prd.md +408 -0
- package/core/commands/review-code.md +354 -0
- package/core/commands/review-context.md +646 -0
- package/core/commands/review-tech-docs.md +518 -0
- package/core/commands/run-tests.md +343 -0
- package/core/commands/setup-ai-first.md +278 -0
- package/core/commands/smoke-test.md +366 -0
- package/core/commands/validate-traces.md +529 -0
- package/core/hooks/data-guard.js +141 -0
- package/core/hooks/settings.json +18 -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/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/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/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/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/rules/data-protection.md +80 -0
- package/core/rules/workflow.md +44 -0
- package/core/skills/code/SKILL.md +526 -0
- package/core/skills/debug/SKILL.md +584 -0
- package/core/skills/discovery/SKILL.md +363 -0
- package/core/skills/prd/SKILL.md +456 -0
- package/core/skills/setup-ai-first/SKILL.md +160 -0
- package/core/skills/spec/SKILL.md +361 -0
- package/core/skills/test/SKILL.md +862 -0
- package/core/steps/context-loader.md +163 -0
- package/core/steps/gate.md +81 -0
- package/core/steps/report-footer.md +53 -0
- package/core/steps/spawn-agent.md +123 -0
- package/core/templates/architecture.template.md +113 -0
- package/core/templates/feature.template +259 -0
- package/core/templates/platform-guide.template.md +145 -0
- package/core/templates/prd.template.md +312 -0
- package/core/templates/product-definition.template.md +168 -0
- package/core/templates/project-context.yaml +78 -0
- package/hooks/data-guard.js +141 -0
- package/hooks/settings.json +18 -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/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/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/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/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/package.json +42 -0
- package/rules/data-protection.md +80 -0
- package/rules/workflow.md +44 -0
- package/scripts/init.sh +49 -0
- package/scripts/upgrade.sh +94 -0
- package/skills/code/SKILL.md +526 -0
- package/skills/code/SKILL.tmpl +176 -0
- package/skills/debug/SKILL.md +584 -0
- package/skills/debug/SKILL.tmpl +262 -0
- package/skills/discovery/SKILL.md +363 -0
- package/skills/discovery/SKILL.tmpl +147 -0
- package/skills/prd/SKILL.md +456 -0
- package/skills/prd/SKILL.tmpl +188 -0
- package/skills/setup-ai-first/SKILL.md +160 -0
- package/skills/setup-ai-first/SKILL.tmpl +107 -0
- package/skills/spec/SKILL.md +361 -0
- package/skills/spec/SKILL.tmpl +174 -0
- package/skills/test/SKILL.md +862 -0
- package/skills/test/SKILL.tmpl +296 -0
- package/steps/context-loader.md +163 -0
- package/steps/gate.md +81 -0
- package/steps/report-footer.md +53 -0
- package/steps/spawn-agent.md +123 -0
- package/templates/architecture.template.md +113 -0
- package/templates/feature.template +259 -0
- package/templates/platform-guide.template.md +145 -0
- package/templates/prd.template.md +312 -0
- package/templates/product-definition.template.md +168 -0
- package/templates/project-context.yaml +78 -0
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
# /review-context — Review PRD or BDD for Quality & Consistency
|
|
2
|
+
|
|
3
|
+
**READ-ONLY analysis mode — writes a findings file, does NOT modify the target.**
|
|
4
|
+
**Use `--resume` to apply accepted findings.**
|
|
5
|
+
|
|
6
|
+
## Gate
|
|
7
|
+
{{include:steps/gate.md}}
|
|
8
|
+
|
|
9
|
+
*Note: For this command, the target in Step 1 is either a `.md` PRD file or a `.feature` BDD file.
|
|
10
|
+
If the path is in `{paths.prd_dir}` → PRD Review Mode.
|
|
11
|
+
If the path ends with `.feature` → BDD Review Mode.
|
|
12
|
+
If `$ARGUMENTS` contains `--resume` → skip to Resume Mode below.
|
|
13
|
+
If `$ARGUMENTS` contains `--fix` → skip to Fix Mode below (apply all auto-fixable findings immediately).*
|
|
14
|
+
|
|
15
|
+
## Context
|
|
16
|
+
{{include:steps/context-loader.md}}
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Detect Review Mode
|
|
21
|
+
|
|
22
|
+
After resolving the target file:
|
|
23
|
+
- `.feature` file → **BDD Review Mode** (jump to BDD section)
|
|
24
|
+
- `.md` in `{paths.prd_dir}/**` → **PRD Review Mode** (continue below)
|
|
25
|
+
- Unknown → ask: "Is this a PRD file or a BDD feature file? (prd/bdd)"
|
|
26
|
+
|
|
27
|
+
Also check flags:
|
|
28
|
+
- `--fix` present → after running all checks, apply `auto_fixable: true` findings immediately (skip Review Board)
|
|
29
|
+
- `--resume` present → skip analysis entirely, go to Resume Mode
|
|
30
|
+
|
|
31
|
+
Derive the output findings filename:
|
|
32
|
+
- PRD: `{paths.refinement_dir}/{prd-slug}-review-context-findings.yaml`
|
|
33
|
+
- BDD: `{paths.refinement_dir}/{uc-id}-review-bdd-findings.yaml`
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## PRD Review Mode
|
|
38
|
+
|
|
39
|
+
### P1 — Terminology Check (Business Dictionary)
|
|
40
|
+
|
|
41
|
+
Load `{paths.business_dictionary}`.
|
|
42
|
+
Scan the entire PRD for terminology issues:
|
|
43
|
+
|
|
44
|
+
1. **Banned terms** — every occurrence of a term in §Banned Terms:
|
|
45
|
+
→ Severity: **critical**. AI can auto-fix in `--resume`.
|
|
46
|
+
|
|
47
|
+
2. **Inconsistent usage** — same concept named differently across sections:
|
|
48
|
+
→ Severity: **major**. Flag both occurrences. Human decides canonical form in Review Board note.
|
|
49
|
+
|
|
50
|
+
3. **Unlisted business terms** — important terms absent from the dictionary:
|
|
51
|
+
→ Severity: **minor**. Suggest adding to `business-dictionary.md`.
|
|
52
|
+
|
|
53
|
+
### P2 — Ambiguity Check
|
|
54
|
+
|
|
55
|
+
Scan each AC and BR for:
|
|
56
|
+
|
|
57
|
+
| Signal | Example | Severity |
|
|
58
|
+
|--------|---------|----------|
|
|
59
|
+
| Vague quantifier | "fast", "large", "reasonable", "quickly" | Critical |
|
|
60
|
+
| Missing actor | "the system should" with no trigger specified | Major |
|
|
61
|
+
| Undefined reference | "{SomeThing}" used but never defined in this PRD | Major |
|
|
62
|
+
| Missing negative path | AC only describes happy path but BR has error conditions | Minor |
|
|
63
|
+
| Passive voice hiding actor | "Invoice is created" — who creates it? | Minor |
|
|
64
|
+
|
|
65
|
+
→ AI cannot auto-fix P2 findings. Human must write the fix in Review Board "Modify" note.
|
|
66
|
+
|
|
67
|
+
### P3 — Domain Conflict Check
|
|
68
|
+
|
|
69
|
+
List all other PRDs in `{paths.prd_dir}/{domain}/`.
|
|
70
|
+
For each one, check if this PRD contradicts a defined BR (same trigger, different outcome)
|
|
71
|
+
or redefines an entity field/status transition differently.
|
|
72
|
+
|
|
73
|
+
→ Severity: **critical**. Human decides which PRD is correct. Note required.
|
|
74
|
+
|
|
75
|
+
### P4 — Structural Completeness
|
|
76
|
+
|
|
77
|
+
- [ ] Metadata block: Version, Author, Date, Status
|
|
78
|
+
- [ ] At least 1 UC with `#### {TICKET-ID}-UC{N}:` heading
|
|
79
|
+
- [ ] Each UC has: Description, Actors, Preconditions, Acceptance Criteria, Business Rules
|
|
80
|
+
- [ ] `## Changelog` section exists
|
|
81
|
+
- [ ] No `{{PLACEHOLDER}}` values unfilled
|
|
82
|
+
|
|
83
|
+
→ Missing sections: **major**. AI can add skeleton in `--resume` if accepted.
|
|
84
|
+
|
|
85
|
+
### P5 — Custom Criteria (optional)
|
|
86
|
+
|
|
87
|
+
If `$ARGUMENTS` contains additional criteria after the file path, evaluate them and create
|
|
88
|
+
findings with `check_id: "P5"` and severity as appropriate.
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## BDD Review Mode
|
|
93
|
+
|
|
94
|
+
### B1 — PRD Coverage Check
|
|
95
|
+
|
|
96
|
+
Load the PRD referenced by `# @trace.prd:` in the feature file header.
|
|
97
|
+
Map every AC and every BR (including sub-bullets) to scenarios:
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
AC1 ({short text}) → SC1, SC2 ✅
|
|
101
|
+
AC2 ({short text}) → MISSING ❌
|
|
102
|
+
BR1 ({short text}) → SC1 ✅
|
|
103
|
+
BR2 ({short text}) → MISSING ❌
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
→ Each missing AC/BR coverage: **critical** finding.
|
|
107
|
+
If accepted in Review Board, `--resume` generates the missing scenario(s).
|
|
108
|
+
|
|
109
|
+
### B2 — Terminology & Entity Check
|
|
110
|
+
|
|
111
|
+
Using `{paths.business_dictionary}` and `{paths.core_entities}`:
|
|
112
|
+
|
|
113
|
+
1. **Banned terms in steps** → **critical**, auto-fixable in `--resume`
|
|
114
|
+
2. **Non-canonical entity names** → **major**, auto-fixable
|
|
115
|
+
3. **Non-canonical field names in data tables** → **major**, auto-fixable
|
|
116
|
+
4. **Technically-looking sample data** (UUIDs, `item_123`) → **minor**, auto-fixable
|
|
117
|
+
|
|
118
|
+
### B3 — Gherkin Rules Check (R1–R10)
|
|
119
|
+
|
|
120
|
+
| Rule | Check | Auto-fixable? |
|
|
121
|
+
|------|-------|---------------|
|
|
122
|
+
| R1 | Every scenario has Given + When + Then | No — needs scenario redesign |
|
|
123
|
+
| R2 | No chained `When … Then … When` | No — needs redesign |
|
|
124
|
+
| R3 | No UI selectors / API paths / tech terms in steps | Yes — replace with business phrasing |
|
|
125
|
+
| R4 | Scenario name is a business outcome | No — needs human rename |
|
|
126
|
+
| R5 | Declarative WHAT, not imperative HOW | No — needs rewrite |
|
|
127
|
+
| R6 | `Then` asserts observable business outcome | No — needs redesign |
|
|
128
|
+
| R7 | Concrete values, not "valid data" | Yes — substitute realistic values |
|
|
129
|
+
| R8 | Each scenario is independently runnable | No — needs redesign |
|
|
130
|
+
| R9 | Data tables have enough columns for Then | Yes — add missing columns |
|
|
131
|
+
| R10 | Cross-UC reference uses navigation phrasing + Note | Yes — add Note comment |
|
|
132
|
+
|
|
133
|
+
→ R3, R7, R9, R10 violations: auto-fixable. Others require human guidance via Review Board note.
|
|
134
|
+
|
|
135
|
+
### B4 — Compliance Checks (C.1–C.5)
|
|
136
|
+
|
|
137
|
+
- [ ] C.1 Wireframe Coverage: every screen component/action has ≥1 SC → finding per missing item
|
|
138
|
+
- [ ] C.2 PRD Traceability: same as B1 (deduplicate)
|
|
139
|
+
- [ ] C.3 Business Dictionary terms used → same as B2
|
|
140
|
+
- [ ] C.4 Banned Terms: 0 banned terms → **critical**, auto-fixable
|
|
141
|
+
- [ ] C.5 NHÓM Grouping: if ≥3 SCs, grouped by business theme → **major**, auto-fixable
|
|
142
|
+
|
|
143
|
+
### B5 — Metadata & Structural Check
|
|
144
|
+
|
|
145
|
+
- [ ] File header has all `@trace.*` fields → **minor**, auto-fixable
|
|
146
|
+
- [ ] Every scenario has `# @trace.scenario`, `# @trace.sc_version`, `# @trace.business_rules`, `# Side-effects:` → **minor**, auto-fixable
|
|
147
|
+
- [ ] Coverage Matrix at end of file → **major**, auto-fixable (AI regenerates)
|
|
148
|
+
- [ ] Pre-merge Checklist at end of file → **minor**, auto-fixable
|
|
149
|
+
|
|
150
|
+
### B6 — Side-effect Completeness
|
|
151
|
+
|
|
152
|
+
For each `@happy` scenario:
|
|
153
|
+
- `# Side-effects:` comment lists all observable side effects
|
|
154
|
+
- `Then` block has `And <side-effect>` for each listed side effect
|
|
155
|
+
|
|
156
|
+
→ Missing side-effect assertion: **major**, auto-fixable.
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Write Findings File
|
|
161
|
+
|
|
162
|
+
After running all checks, write `{paths.refinement_dir}/{slug}-review-*-findings.yaml`:
|
|
163
|
+
|
|
164
|
+
```yaml
|
|
165
|
+
source_file: "{absolute path to reviewed file}"
|
|
166
|
+
generated_at: "{ISO datetime}"
|
|
167
|
+
review_type: "{prd | bdd}"
|
|
168
|
+
status: "pending_review"
|
|
169
|
+
|
|
170
|
+
findings:
|
|
171
|
+
- id: "F001"
|
|
172
|
+
check_id: "P1" # P1-P5 for PRD; B1-B6 for BDD
|
|
173
|
+
severity: "critical" # critical | major | minor
|
|
174
|
+
section: "{section or scenario ID where issue was found}"
|
|
175
|
+
finding: "{clear description of the issue}"
|
|
176
|
+
suggestion: "{specific actionable fix — AI will apply this in --resume if accepted}"
|
|
177
|
+
auto_fixable: true # true = AI can apply; false = human must write note in Review Board
|
|
178
|
+
status: "pending" # pending | accepted | modified | rejected | deferred
|
|
179
|
+
|
|
180
|
+
summary:
|
|
181
|
+
total_findings: {N}
|
|
182
|
+
by_severity: { critical: {N}, major: {N}, minor: {N} }
|
|
183
|
+
auto_fixable: {N}
|
|
184
|
+
requires_human_decision: {N}
|
|
185
|
+
recommendation: "APPROVED | NEEDS_REVISION | BLOCKED"
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## Post-Analysis Routing
|
|
189
|
+
|
|
190
|
+
After running all checks and writing the findings file:
|
|
191
|
+
|
|
192
|
+
**If `--fix` flag present** → jump to Fix Mode (apply `auto_fixable: true` findings immediately).
|
|
193
|
+
|
|
194
|
+
**If no flag** → print Report below and stop.
|
|
195
|
+
|
|
196
|
+
## Report
|
|
197
|
+
|
|
198
|
+
{{include:steps/report-footer.md}}
|
|
199
|
+
|
|
200
|
+
```
|
|
201
|
+
/review-context Complete — {target file}
|
|
202
|
+
Mode: {PRD | BDD}
|
|
203
|
+
Findings: {total} | 🔴 Critical: {N} | 🟡 Major: {N} | 🟢 Minor: {N}
|
|
204
|
+
Auto-fixable: {N} | Needs human decision: {N}
|
|
205
|
+
|
|
206
|
+
Findings file: {paths.refinement_dir}/{slug}-findings.yaml
|
|
207
|
+
|
|
208
|
+
Next options:
|
|
209
|
+
A) Quick fix : /review-context --fix {target-file}
|
|
210
|
+
→ applies all auto-fixable findings immediately
|
|
211
|
+
B) Review Board: open findings file → accept/modify/reject
|
|
212
|
+
→ /review-context --resume {target-file}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## Fix Mode — Apply Auto-Fixable Findings Immediately
|
|
218
|
+
|
|
219
|
+
*Triggered when `$ARGUMENTS` contains `--fix`.*
|
|
220
|
+
*Example: `/review-context --fix specs/bdd/payment/PAY-001.feature`*
|
|
221
|
+
|
|
222
|
+
This mode runs the full analysis (same as default), then immediately applies every
|
|
223
|
+
`auto_fixable: true` finding without going through the Review Board.
|
|
224
|
+
|
|
225
|
+
Use for: BDD cleanup, terminology fixes, metadata gaps — anything the AI can safely
|
|
226
|
+
correct without a human judgment call. Findings requiring human decisions are written
|
|
227
|
+
to the findings file as usual and left `status: pending`.
|
|
228
|
+
|
|
229
|
+
### Phase 1 — Run analysis
|
|
230
|
+
|
|
231
|
+
Run all checks (P1–P5 or B1–B6) exactly as in the default mode.
|
|
232
|
+
Write the findings file with all `status: "pending"` as usual.
|
|
233
|
+
|
|
234
|
+
### Phase 2 — Apply auto-fixable findings
|
|
235
|
+
|
|
236
|
+
For each finding where `auto_fixable: true`, in order (critical → major → minor):
|
|
237
|
+
|
|
238
|
+
**For PRD files:**
|
|
239
|
+
|
|
240
|
+
| check_id | What to apply |
|
|
241
|
+
|----------|--------------|
|
|
242
|
+
| P1 (Banned term) | Replace every banned term occurrence with canonical term |
|
|
243
|
+
| P4 (Structure) | Add missing section/metadata skeleton |
|
|
244
|
+
|
|
245
|
+
**For BDD files:**
|
|
246
|
+
|
|
247
|
+
| check_id | What to apply |
|
|
248
|
+
|----------|--------------|
|
|
249
|
+
| B2 (Terminology) | Replace banned terms, fix entity/field names, fix technical sample data |
|
|
250
|
+
| B3 R3 | Replace tech terms/UI selectors with business phrasing |
|
|
251
|
+
| B3 R7 | Substitute concrete realistic values |
|
|
252
|
+
| B3 R9 | Add missing data table columns |
|
|
253
|
+
| B3 R10 | Add cross-UC navigation Note comment |
|
|
254
|
+
| B4 C4 | Fix banned terms in tags |
|
|
255
|
+
| B4 C5 | Add NHÓM grouping if ≥3 SCs |
|
|
256
|
+
| B5 | Add missing @trace headers, regenerate Coverage Matrix / Pre-merge Checklist |
|
|
257
|
+
| B6 | Add missing `And <side-effect>` to Then blocks |
|
|
258
|
+
|
|
259
|
+
After applying each finding, mark it `status: "applied_automatically"` in the findings file.
|
|
260
|
+
|
|
261
|
+
### Phase 3 — Version bump
|
|
262
|
+
|
|
263
|
+
- **PRD**: if ≥1 finding applied → bump minor version, add Changelog entry:
|
|
264
|
+
`Auto-fix: applied {N} auto-fixable review-context findings`
|
|
265
|
+
- **BDD**: if ≥1 finding applied → increment `@trace.bdd_version` by 0.1
|
|
266
|
+
|
|
267
|
+
### Phase 4 — Report
|
|
268
|
+
|
|
269
|
+
```
|
|
270
|
+
/review-context --fix Applied — {target file}
|
|
271
|
+
Mode: {PRD | BDD}
|
|
272
|
+
|
|
273
|
+
Auto-fixed : {N} findings ({critical} critical, {major} major, {minor} minor)
|
|
274
|
+
- {change 1 summary}
|
|
275
|
+
- {change 2 summary}
|
|
276
|
+
|
|
277
|
+
Still pending (needs human decision): {N}
|
|
278
|
+
- F00X [{severity}] {finding summary} ← open findings file in Review Board
|
|
279
|
+
|
|
280
|
+
{If PRD}: Version bumped: {old} → {new}
|
|
281
|
+
{If BDD}: bdd_version: {old} → {new}
|
|
282
|
+
|
|
283
|
+
Findings file: {paths.refinement_dir}/{slug}-findings.yaml
|
|
284
|
+
Re-run /review-context {file} to confirm 0 remaining critical findings.
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
If 0 findings were auto-fixable → print:
|
|
288
|
+
```
|
|
289
|
+
Nothing to auto-fix. All {N} findings require human decision.
|
|
290
|
+
Open findings file in Review Board → then run: /review-context --resume {file}
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
---
|
|
294
|
+
|
|
295
|
+
## Resume Mode — Apply Accepted Findings
|
|
296
|
+
|
|
297
|
+
*Triggered when `$ARGUMENTS` contains `--resume`.*
|
|
298
|
+
*Example: `/review-context --resume specs/prd/payment/PAY-001.md`*
|
|
299
|
+
|
|
300
|
+
### Phase 1 — Read accepted findings
|
|
301
|
+
|
|
302
|
+
1. Derive findings filename from target file (same rule as above).
|
|
303
|
+
2. Read `{paths.refinement_dir}/{slug}-findings.yaml`.
|
|
304
|
+
3. Collect findings where `status: "accepted"` or `status: "modified"`.
|
|
305
|
+
4. If none → report "No accepted findings. File unchanged." and stop.
|
|
306
|
+
|
|
307
|
+
### Phase 2 — Apply fixes
|
|
308
|
+
|
|
309
|
+
Apply in order: critical → major → minor.
|
|
310
|
+
|
|
311
|
+
**For PRD findings:**
|
|
312
|
+
| check_id | What to do |
|
|
313
|
+
|----------|-----------|
|
|
314
|
+
| P1 (Banned term) | Replace every occurrence of banned term with canonical term |
|
|
315
|
+
| P2 (Ambiguity) | Apply the fix stated in `suggestion` or `modified` note |
|
|
316
|
+
| P3 (Conflict) | Apply the resolution stated in the modified note |
|
|
317
|
+
| P4 (Structure) | Add the missing section/metadata field |
|
|
318
|
+
| P5 (Custom) | Apply as stated in suggestion/note |
|
|
319
|
+
|
|
320
|
+
→ After applying, bump PRD version (minor) and add Changelog entry.
|
|
321
|
+
|
|
322
|
+
**For BDD findings:**
|
|
323
|
+
| check_id | What to do |
|
|
324
|
+
|----------|-----------|
|
|
325
|
+
| B1 (Coverage gap) | Generate new scenario(s) for the uncovered AC/BR and insert into correct NHÓM |
|
|
326
|
+
| B2 (Terminology) | Replace banned terms, fix entity/field names |
|
|
327
|
+
| B3 (Gherkin rule) | Apply rule-specific fix (replace tech terms, add concrete values, etc.) |
|
|
328
|
+
| B4 (Compliance) | Add NHÓM grouping, fix @trace tags |
|
|
329
|
+
| B5 (Metadata) | Add missing @trace headers, regenerate Coverage Matrix / Pre-merge Checklist |
|
|
330
|
+
| B6 (Side effects) | Add missing `And <side-effect>` to Then block |
|
|
331
|
+
|
|
332
|
+
→ After applying, increment `@trace.bdd_version` in file header by 0.1.
|
|
333
|
+
|
|
334
|
+
### Phase 3 — Report
|
|
335
|
+
|
|
336
|
+
```
|
|
337
|
+
/review-context --resume Applied — {target file}
|
|
338
|
+
Applied : {N} findings ({critical} critical, {major} major, {minor} minor)
|
|
339
|
+
Skipped : {N} rejected/deferred
|
|
340
|
+
|
|
341
|
+
Changes:
|
|
342
|
+
- {change 1 summary}
|
|
343
|
+
- {change 2 summary}
|
|
344
|
+
|
|
345
|
+
{If PRD}: Version bumped: {old} → {new}
|
|
346
|
+
{If BDD}: bdd_version: {old} → {new}
|
|
347
|
+
|
|
348
|
+
Re-run /review-context {file} to confirm 0 remaining critical findings.
|
|
349
|
+
```
|