@anselmdk/feature-spec-md 0.4.0 → 0.5.0-rc.2

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 (39) hide show
  1. package/README.md +59 -78
  2. package/SPEC_FORMAT.md +38 -78
  3. package/dist/cli.js +75 -81
  4. package/dist/cli.js.map +1 -1
  5. package/dist/featureSpecs.d.ts +1 -1
  6. package/dist/featureSpecs.d.ts.map +1 -1
  7. package/dist/featureSpecs.js +57 -10
  8. package/dist/featureSpecs.js.map +1 -1
  9. package/dist/githubActionDiffReport.d.ts +4 -0
  10. package/dist/githubActionDiffReport.d.ts.map +1 -0
  11. package/dist/githubActionDiffReport.js +159 -0
  12. package/dist/githubActionDiffReport.js.map +1 -0
  13. package/dist/githubActionFtp.d.ts +25 -0
  14. package/dist/githubActionFtp.d.ts.map +1 -0
  15. package/dist/githubActionFtp.js +210 -0
  16. package/dist/githubActionFtp.js.map +1 -0
  17. package/dist/githubActionOutput.d.ts +3 -0
  18. package/dist/githubActionOutput.d.ts.map +1 -0
  19. package/dist/githubActionOutput.js +33 -0
  20. package/dist/githubActionOutput.js.map +1 -0
  21. package/dist/githubActionReport.d.ts +2 -1
  22. package/dist/githubActionReport.d.ts.map +1 -1
  23. package/dist/githubActionReport.js +15 -182
  24. package/dist/githubActionReport.js.map +1 -1
  25. package/dist/index.d.ts +2 -2
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/index.js +1 -1
  28. package/dist/index.js.map +1 -1
  29. package/dist/reportTemplate.js +37 -33
  30. package/dist/reportTemplate.js.map +1 -1
  31. package/dist/screenshots.d.ts +3 -1
  32. package/dist/screenshots.d.ts.map +1 -1
  33. package/dist/screenshots.js +23 -0
  34. package/dist/screenshots.js.map +1 -1
  35. package/dist/types.d.ts +11 -1
  36. package/dist/types.d.ts.map +1 -1
  37. package/docs/evidence-policy.md +63 -0
  38. package/docs/spec-driven-flow.md +67 -8
  39. package/package.json +1 -1
package/dist/types.d.ts CHANGED
@@ -14,8 +14,17 @@ export type ModelReferenceFrontmatter = SpecFrontmatter & {
14
14
  model?: string;
15
15
  models?: string[] | string;
16
16
  };
17
+ export type ScenarioTestType = "unit" | "integration" | "playwright" | "manual" | "skip";
18
+ export type ScreenshotPolicy = "required" | "optional" | "skip";
19
+ export type ScenarioEvidencePolicy = {
20
+ test: ScenarioTestType;
21
+ screenshots: ScreenshotPolicy;
22
+ };
17
23
  /** Frontmatter fields supported by `*.feature.md` files. */
18
- export type FeatureFrontmatter = ModelReferenceFrontmatter;
24
+ export type FeatureFrontmatter = ModelReferenceFrontmatter & {
25
+ test?: ScenarioTestType;
26
+ screenshots?: ScreenshotPolicy;
27
+ };
19
28
  /** Frontmatter fields supported by `*.design.md` files. */
20
29
  export type DesignFrontmatter = ModelReferenceFrontmatter;
21
30
  /** Parsed contents of one `*.model.md` file. */
@@ -91,6 +100,7 @@ export type FeatureScenario = {
91
100
  id: string;
92
101
  title: string;
93
102
  line: number;
103
+ evidence: ScenarioEvidencePolicy;
94
104
  steps: FeatureStep[];
95
105
  };
96
106
  /** A single Given / When / Then style step inside a scenario. */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,iEAAiE;AACjE,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,YAAY,CAAC;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,2EAA2E;AAC3E,MAAM,MAAM,yBAAyB,GAAG,eAAe,GAAG;IACxD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;CAC5B,CAAC;AAEF,4DAA4D;AAC5D,MAAM,MAAM,kBAAkB,GAAG,yBAAyB,CAAC;AAE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
2
+
3
+ Feature specs can declare how scenarios are expected to be tested and whether screenshot evidence is required.
4
+
5
+ Use feature frontmatter to set defaults for all scenarios in a feature:
6
+
7
+ ```md
8
+ ---
9
+ id: KANBAN-CARD-AUTHORING
10
+ title: Card authoring
11
+ test: playwright
12
+ screenshots: required
13
+ ---
14
+ ```
15
+
16
+ Use scenario-level overrides directly below a scenario heading when one scenario needs different evidence:
17
+
18
+ ```md
19
+ ### KANBAN-CARD-AUTHORING-S002: Card title is normalized
20
+ Test: unit
21
+ Screenshots: skip
22
+
23
+ Given the raw card title contains leading whitespace
24
+ When the title is normalized
25
+ Then the stored title has no leading whitespace
26
+ ```
27
+
28
+ ## `test` values
29
+
30
+ - `unit`: behavior is expected to be covered by unit tests.
31
+ - `integration`: behavior is expected to be covered by integration tests.
32
+ - `playwright`: behavior is expected to be covered by Playwright or another UI/browser test.
33
+ - `manual`: behavior is intentionally verified manually.
34
+ - `skip`: no executable test is expected for this scenario.
35
+
36
+ ## `screenshots` values
37
+
38
+ - `required`: every scenario step should have screenshot evidence in the report manifest.
39
+ - `optional`: screenshot evidence may be included when useful, but missing screenshots do not fail validation.
40
+ - `skip`: screenshots are not expected and should not be treated as missing evidence.
41
+
42
+ `screenshots: none` is accepted as an alias for `screenshots: skip`.
43
+
44
+ ## Defaults
45
+
46
+ - If `test` is omitted, scenarios default to `unit`.
47
+ - If `screenshots` is omitted and `test` resolves to `playwright`, screenshots default to `required`.
48
+ - If `screenshots` is omitted and `test` resolves to `unit`, `integration`, `manual`, or `skip`, screenshots default to `skip`.
49
+
50
+ This lets UI scenarios fail CI when screenshot evidence is missing, while unit-only domain behavior does not need screenshots.
51
+
52
+ ## CI enforcement
53
+
54
+ Use report evidence enforcement in CI when declared screenshot evidence should block a build:
55
+
56
+ ```bash
57
+ npx feature-spec-md report \
58
+ --screenshots "test-results/spec-report/screenshots-*.json" \
59
+ --enforce-evidence \
60
+ --out test-results/spec-report/index.html
61
+ ```
62
+
63
+ The gate only fails for scenarios whose resolved screenshot policy is `required`.
@@ -4,9 +4,9 @@
4
4
 
5
5
  ```txt
6
6
  AI drafts specs
7
- -> humans review intent
7
+ -> humans review intent and evidence policy
8
8
  -> AI writes tests from stable IDs
9
- -> tooling checks coverage
9
+ -> tooling checks coverage and declared evidence
10
10
  -> implementation follows failing tests
11
11
  -> reports show what is implemented
12
12
  ```
@@ -54,7 +54,9 @@ Useful instruction:
54
54
  ```txt
55
55
  Create feature-spec-md documents for this change. Keep the documents small.
56
56
  Use stable uppercase IDs. Put durable behavior in rules. Put testable examples
57
- in scenarios. Do not include test mappings inside the specs.
57
+ in scenarios. For each feature or scenario, declare whether the expected test
58
+ is unit, integration, playwright, manual, or skip. Require screenshots only for
59
+ UI flows where visual evidence should be part of the review.
58
60
  ```
59
61
 
60
62
  Run:
@@ -74,9 +76,34 @@ Check that:
74
76
  - model terms are clear enough for test authors
75
77
  - feature rules are durable product truths
76
78
  - scenarios are concrete enough to become executable tests
79
+ - each scenario has the right test policy
80
+ - screenshots are required only for UI/browser behavior where visual evidence is valuable
77
81
  - stack choices are specific enough to guide implementation
78
82
  - design direction covers the visible behavior users will judge
79
83
 
84
+ Example feature-level policy for UI behavior:
85
+
86
+ ```md
87
+ ---
88
+ id: ACCOUNT-ACCESS
89
+ title: Account access
90
+ test: playwright
91
+ screenshots: required
92
+ ---
93
+ ```
94
+
95
+ Example scenario-level override for unit-only behavior:
96
+
97
+ ```md
98
+ ### ACCOUNT-ACCESS-S002: Link expiry is calculated
99
+ Test: unit
100
+ Screenshots: skip
101
+
102
+ Given a sign-in link was created 31 minutes ago
103
+ When expiry is calculated
104
+ Then the link is expired
105
+ ```
106
+
80
107
  Then run:
81
108
 
82
109
  ```bash
@@ -87,14 +114,17 @@ This keeps the spec set valid while allowing missing tests.
87
114
 
88
115
  ## 3. Ask AI To Write Tests From The Specs
89
116
 
90
- Give the AI the relevant spec files and tell it to write executable tests that preserve spec IDs in the test source.
117
+ Give the AI the relevant spec files and tell it to write executable tests that preserve spec IDs in the test source and match the declared test policy.
91
118
 
92
119
  Useful instruction:
93
120
 
94
121
  ```txt
95
122
  Write tests from these feature-spec-md specs. Each scenario test must include
96
123
  the scenario ID in the test title. Add comments or annotations for covered
97
- rule IDs and model item IDs. Do not invent IDs that are not in the specs.
124
+ rule IDs and model item IDs. Use Playwright and the screenshot evidence helper
125
+ for scenarios declared as test: playwright with screenshots: required. Use unit
126
+ or integration tests for scenarios declared that way. Do not invent IDs that are
127
+ not in the specs.
98
128
  ```
99
129
 
100
130
  Example:
@@ -137,7 +167,7 @@ Run:
137
167
  npx feature-spec-md report --out test-results/feature-spec-report/index.html
138
168
  ```
139
169
 
140
- The report is useful as a PR artifact because it shows specs, coverage state, validation issues, and optional screenshot evidence.
170
+ The report is useful as a PR artifact because it shows specs, coverage state, validation issues, declared evidence policy, and optional screenshot evidence.
141
171
 
142
172
  If your tests produce screenshot manifests, include them:
143
173
 
@@ -147,6 +177,17 @@ npx feature-spec-md report \
147
177
  --out test-results/feature-spec-report/index.html
148
178
  ```
149
179
 
180
+ When missing declared screenshot evidence should block the build, enforce evidence policy:
181
+
182
+ ```bash
183
+ npx feature-spec-md report \
184
+ --screenshots "test-results/spec-report/screenshots-*.json" \
185
+ --enforce-evidence \
186
+ --out test-results/feature-spec-report/index.html
187
+ ```
188
+
189
+ The gate only fails for scenarios whose resolved screenshot policy is `required`.
190
+
150
191
  Screenshot manifest shape:
151
192
 
152
193
  ```json
@@ -162,14 +203,32 @@ Screenshot manifest shape:
162
203
  }
163
204
  ```
164
205
 
165
- ## 6. Keep The Loop Honest
206
+ ## 6. Publish The Report From CI
207
+
208
+ A typical CI sequence is:
209
+
210
+ ```bash
211
+ npm run build
212
+ npx feature-spec-md check --require-rule-coverage --require-model-coverage
213
+ npx feature-spec-md coverage --fail-on-missing
214
+ npm test
215
+ npx feature-spec-md report \
216
+ --screenshots "test-results/spec-report/screenshots-*.json" \
217
+ --enforce-evidence \
218
+ --out test-results/spec-report/index.html
219
+ npx feature-spec-md github-report --publish ftp --report-dir test-results/spec-report
220
+ ```
221
+
222
+ Use `--enforce-evidence` when the project wants missing required screenshots to fail the build. Leave it out when the report should show screenshot state without blocking.
223
+
224
+ ## 7. Keep The Loop Honest
166
225
 
167
226
  When behavior changes, update specs first, then regenerate or update tests from the changed specs.
168
227
 
169
228
  The expected loop is:
170
229
 
171
230
  ```txt
172
- spec change -> validation -> AI test update -> coverage -> implementation -> report
231
+ spec change -> validation -> AI test update -> coverage -> implementation -> evidence report
173
232
  ```
174
233
 
175
234
  That keeps the AI-generated work anchored to a small, reviewable contract instead of a loose conversation history.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anselmdk/feature-spec-md",
3
- "version": "0.4.0",
3
+ "version": "0.5.0-rc.2",
4
4
  "description": "Markdown specs for AI-assisted, testable spec driven development across model, feature, stack, and design documents.",
5
5
  "type": "module",
6
6
  "repository": {