@anselmdk/feature-spec-md 0.1.1-rc.6 → 0.2.1-rc.1
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/README.md +153 -59
- package/SPEC_FORMAT.md +44 -17
- package/dist/cli.js +27 -3
- package/dist/cli.js.map +1 -1
- package/dist/featureSpecs.d.ts +34 -0
- package/dist/featureSpecs.d.ts.map +1 -0
- package/dist/featureSpecs.js +240 -0
- package/dist/featureSpecs.js.map +1 -0
- package/dist/filePatterns.d.ts.map +1 -1
- package/dist/filePatterns.js +4 -0
- package/dist/filePatterns.js.map +1 -1
- package/dist/githubActionReport.d.ts +3 -0
- package/dist/githubActionReport.d.ts.map +1 -0
- package/dist/githubActionReport.js +247 -0
- package/dist/githubActionReport.js.map +1 -0
- package/dist/html.d.ts +3 -0
- package/dist/html.d.ts.map +1 -1
- package/dist/html.js +3 -0
- package/dist/html.js.map +1 -1
- package/dist/index.d.ts +3 -34
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -338
- package/dist/index.js.map +1 -1
- package/dist/playwright.d.ts.map +1 -1
- package/dist/playwright.js +13 -21
- package/dist/playwright.js.map +1 -1
- package/dist/reportTemplate.d.ts.map +1 -1
- package/dist/reportTemplate.js +4 -0
- package/dist/reportTemplate.js.map +1 -1
- package/dist/screenshots.d.ts.map +1 -1
- package/dist/screenshots.js +4 -0
- package/dist/screenshots.js.map +1 -1
- package/dist/specDocuments.d.ts.map +1 -1
- package/dist/specDocuments.js +16 -112
- package/dist/specDocuments.js.map +1 -1
- package/dist/specMarkdown.d.ts +26 -0
- package/dist/specMarkdown.d.ts.map +1 -0
- package/dist/specMarkdown.js +126 -0
- package/dist/specMarkdown.js.map +1 -0
- package/dist/testImplementationReport.d.ts +4 -0
- package/dist/testImplementationReport.d.ts.map +1 -1
- package/dist/testImplementationReport.js.map +1 -1
- package/dist/types.d.ts +4 -0
- package/dist/types.d.ts.map +1 -1
- package/docs/releasing.md +108 -0
- package/docs/spec-driven-flow.md +175 -0
- package/package.json +9 -3
package/README.md
CHANGED
|
@@ -1,83 +1,189 @@
|
|
|
1
1
|
# feature-spec-md
|
|
2
2
|
|
|
3
|
-
Markdown
|
|
3
|
+
Markdown specs for AI-assisted, testable spec driven development.
|
|
4
4
|
|
|
5
|
-
The
|
|
5
|
+
The concept is deliberately small:
|
|
6
6
|
|
|
7
7
|
```txt
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
model + features + stack + design
|
|
9
|
+
-> AI-written executable tests that reference stable spec IDs
|
|
10
|
+
-> validation, coverage, screenshots, and reports
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
The
|
|
13
|
+
The specs are meant to be written with an AI before implementation. The tests are meant to be written with an AI from those specs. `feature-spec-md` checks that the Markdown stays structured and that executable tests still cover the model items, rules, and scenarios the specs define.
|
|
14
14
|
|
|
15
|
-
##
|
|
15
|
+
## What You Write
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
Use four ordinary Markdown document types:
|
|
18
18
|
|
|
19
19
|
```txt
|
|
20
|
-
*.model.md
|
|
21
|
-
*.feature.md
|
|
20
|
+
*.model.md shared domain vocabulary
|
|
21
|
+
*.feature.md user-facing behavior, rules, and scenarios
|
|
22
|
+
*.stack.md technical platform choices
|
|
23
|
+
*.design.md product, UI, and interaction direction
|
|
22
24
|
```
|
|
23
25
|
|
|
24
|
-
|
|
26
|
+
Each document has frontmatter, a short `## Purpose`, and stable IDs. Tests reference those IDs in titles, tags, annotations, comments, or metadata.
|
|
25
27
|
|
|
26
|
-
|
|
27
|
-
-
|
|
28
|
-
- optional `## Rules` for global invariants
|
|
28
|
+
```md
|
|
29
|
+
### ACCOUNT-ACCESS-S001: Registered person signs in
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
Given a registered person is on the sign-in page
|
|
32
|
+
When they request and open a valid sign-in link
|
|
33
|
+
Then they are signed in
|
|
34
|
+
```
|
|
31
35
|
|
|
32
|
-
|
|
33
|
-
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
```ts
|
|
37
|
+
test("ACCOUNT-ACCESS-S001 registered person signs in", async ({ page }) => {
|
|
38
|
+
// Covers ACCOUNT-ACCESS-R001 and ACCOUNT-M001.
|
|
39
|
+
});
|
|
40
|
+
```
|
|
36
41
|
|
|
37
|
-
See
|
|
42
|
+
See [SPEC_FORMAT.md](SPEC_FORMAT.md) for the exact document format.
|
|
43
|
+
|
|
44
|
+
## Install
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npm install -D @anselmdk/feature-spec-md
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Create starter specs:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
npx feature-spec-md init --kind model --dir specs
|
|
54
|
+
npx feature-spec-md init --kind feature --dir specs
|
|
55
|
+
npx feature-spec-md init --kind stack --dir specs
|
|
56
|
+
npx feature-spec-md init --kind design --dir specs
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Workflow
|
|
60
|
+
|
|
61
|
+
1. Ask an AI to draft or update `*.model.md`, `*.feature.md`, `*.stack.md`, and `*.design.md` files.
|
|
62
|
+
2. Run `npx feature-spec-md check` until the spec set is valid.
|
|
63
|
+
3. Ask an AI to write executable tests from the specs, preserving the relevant `-M001`, `-R001`, and `-S001` IDs in the test source.
|
|
64
|
+
4. Run `npx feature-spec-md coverage` to see which scenarios, rules, and model items have tests.
|
|
65
|
+
5. Run `npx feature-spec-md report` to generate an HTML implementation report for review or CI artifacts.
|
|
66
|
+
|
|
67
|
+
The longer flow, including AI prompts and CI setup, is in [docs/spec-driven-flow.md](docs/spec-driven-flow.md).
|
|
38
68
|
|
|
39
69
|
## CLI
|
|
40
70
|
|
|
41
71
|
```bash
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
npm run dev -- report --specs "examples/**/*.feature.md" --tests "tests/**/*.test.ts"
|
|
46
|
-
npm run dev -- report --specs "examples/**/*.feature.md" --tests "tests/**/*.test.ts" --screenshots "test-results/spec-report/screenshots-*.json"
|
|
72
|
+
npx feature-spec-md check
|
|
73
|
+
npx feature-spec-md coverage --fail-on-missing
|
|
74
|
+
npx feature-spec-md report --out test-results/feature-spec-report/index.html
|
|
47
75
|
```
|
|
48
76
|
|
|
49
|
-
|
|
50
|
-
specs by whether all, some, or none of their scenarios have matching test
|
|
51
|
-
references. Use `--fail-on-missing` when missing scenario tests should fail CI.
|
|
77
|
+
By default the CLI scans:
|
|
52
78
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
79
|
+
```txt
|
|
80
|
+
specs/**/*.model.md
|
|
81
|
+
specs/**/*.feature.md
|
|
82
|
+
specs/**/*.stack.md
|
|
83
|
+
specs/**/*.design.md
|
|
84
|
+
tests/**/*.spec.ts
|
|
85
|
+
```
|
|
56
86
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
87
|
+
Use explicit patterns when your project uses different paths:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
npx feature-spec-md check \
|
|
91
|
+
--specs "product/**/*.model.md,product/**/*.feature.md,product/**/*.stack.md,product/**/*.design.md" \
|
|
92
|
+
--tests "e2e/**/*.spec.ts"
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
The `check` command validates spec structure, references between documents, and test coverage. Scenario coverage is required by default when tests are scanned. Use `--require-scenario-coverage=false` while drafting. Use `--require-rule-coverage` and `--require-model-coverage` when rules and model items must also fail validation if they have no test references.
|
|
96
|
+
|
|
97
|
+
The `coverage` command prints a terminal implementation report. Use `--fail-on-missing` when missing model item, rule, or scenario coverage should fail CI.
|
|
98
|
+
|
|
99
|
+
The `report` command writes an HTML report. It can include screenshot evidence from Playwright or another test runner by passing one or more screenshot manifest files:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
npx feature-spec-md report \
|
|
103
|
+
--screenshots "test-results/spec-report/screenshots-*.json"
|
|
68
104
|
```
|
|
69
105
|
|
|
106
|
+
## GitHub Actions report publishing
|
|
107
|
+
|
|
108
|
+
`feature-spec-md github-report` writes the GitHub Actions job summary and can either prepare outputs for a GitHub artifact upload or publish the generated report to FTP.
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
npx feature-spec-md github-report \
|
|
112
|
+
--report-dir test-results/spec-report \
|
|
113
|
+
--publish ftp
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
For FTP publishing, configure repository secrets in GitHub under **Settings → Secrets and variables → Actions → Repository secrets**. For this repository, the direct settings URL is:
|
|
117
|
+
|
|
118
|
+
```txt
|
|
119
|
+
https://github.com/anselmdk/feature-spec-md/settings/secrets/actions
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
GitHub's documentation for repository secrets is here:
|
|
123
|
+
|
|
124
|
+
```txt
|
|
125
|
+
https://docs.github.com/actions/security-guides/using-secrets-in-github-actions#creating-secrets-for-a-repository
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Required secrets or environment variables:
|
|
129
|
+
|
|
130
|
+
```txt
|
|
131
|
+
FEATURE_SPEC_FTP_HOST=ftp.example.com
|
|
132
|
+
FEATURE_SPEC_FTP_USER=feature-spec-md
|
|
133
|
+
FEATURE_SPEC_FTP_PASSWORD=<your FTP password>
|
|
134
|
+
FEATURE_SPEC_REPORT_BASE_URL=http://feature-spec-md.anselm.dk/
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Optional values:
|
|
138
|
+
|
|
139
|
+
```txt
|
|
140
|
+
FEATURE_SPEC_FTP_REMOTE_DIR=/public_html/feature-spec-md
|
|
141
|
+
FEATURE_SPEC_FTP_PORT=21
|
|
142
|
+
FEATURE_SPEC_FTP_SECURE=false
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Example GitHub Actions step:
|
|
146
|
+
|
|
147
|
+
```yaml
|
|
148
|
+
- name: Publish feature spec report
|
|
149
|
+
if: always() && hashFiles('test-results/spec-report/index.html') != ''
|
|
150
|
+
run: npx feature-spec-md github-report --publish ftp --report-dir test-results/spec-report
|
|
151
|
+
env:
|
|
152
|
+
FEATURE_SPEC_FTP_HOST: ${{ secrets.FEATURE_SPEC_FTP_HOST }}
|
|
153
|
+
FEATURE_SPEC_FTP_USER: ${{ secrets.FEATURE_SPEC_FTP_USER }}
|
|
154
|
+
FEATURE_SPEC_FTP_PASSWORD: ${{ secrets.FEATURE_SPEC_FTP_PASSWORD }}
|
|
155
|
+
FEATURE_SPEC_REPORT_BASE_URL: ${{ secrets.FEATURE_SPEC_REPORT_BASE_URL }}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
With `FEATURE_SPEC_REPORT_BASE_URL=http://feature-spec-md.anselm.dk/` and GitHub Actions build number `42`, the report is uploaded to a build-numbered directory and linked as:
|
|
159
|
+
|
|
160
|
+
```txt
|
|
161
|
+
http://feature-spec-md.anselm.dk/42/
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
The build index is created or updated at:
|
|
165
|
+
|
|
166
|
+
```txt
|
|
167
|
+
http://feature-spec-md.anselm.dk/
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
FTP reports are uploaded into a build-numbered directory using `GITHUB_RUN_NUMBER`, and an `index.html` file is created or updated at the public base URL so all uploaded builds can be browsed. When FTP publishing is used, the command emits `upload-github-artifact=false` and links the GitHub Actions job summary directly to the hosted report URL.
|
|
171
|
+
|
|
70
172
|
## Library API
|
|
71
173
|
|
|
174
|
+
Most integrations can use the top-level document API:
|
|
175
|
+
|
|
72
176
|
```ts
|
|
73
177
|
import {
|
|
74
|
-
|
|
75
|
-
|
|
178
|
+
checkSpecDocuments,
|
|
179
|
+
parseSpecDocument,
|
|
76
180
|
renderHtmlReport,
|
|
77
|
-
|
|
78
|
-
} from "feature-spec-md";
|
|
181
|
+
validateSpecDocument,
|
|
182
|
+
} from "@anselmdk/feature-spec-md";
|
|
79
183
|
```
|
|
80
184
|
|
|
185
|
+
Feature-only helpers such as `parseFeatureSpec` and `checkFeatureSpecs` remain available for compatibility.
|
|
186
|
+
|
|
81
187
|
## Development
|
|
82
188
|
|
|
83
189
|
```bash
|
|
@@ -89,16 +195,4 @@ npm run build
|
|
|
89
195
|
|
|
90
196
|
## Releases
|
|
91
197
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
Release candidates are published manually from GitHub Actions:
|
|
95
|
-
|
|
96
|
-
1. Open the `Publish RC to npm` workflow.
|
|
97
|
-
2. Run the workflow from `main`.
|
|
98
|
-
3. The workflow verifies the package, creates a prerelease version using the current package version and GitHub run number, and publishes it with the npm `rc` dist-tag.
|
|
99
|
-
|
|
100
|
-
Install the latest release candidate with:
|
|
101
|
-
|
|
102
|
-
```bash
|
|
103
|
-
npm install @anselmdk/feature-spec-md@rc
|
|
104
|
-
```
|
|
198
|
+
Release candidates and stable releases are documented in [docs/releasing.md](docs/releasing.md).
|
package/SPEC_FORMAT.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
# Feature Spec Markdown
|
|
1
|
+
# Feature Spec Markdown Format
|
|
2
2
|
|
|
3
|
-
Feature Spec Markdown is a lightweight
|
|
3
|
+
Feature Spec Markdown is a lightweight format for testable specs.
|
|
4
4
|
|
|
5
|
-
It uses ordinary Markdown
|
|
5
|
+
It uses ordinary Markdown plus stable IDs so an AI can write clear product specs, another AI pass can write executable tests from those specs, and tooling can verify that the tests still cover the documented behavior.
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Document Set
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
A spec set can contain four document types:
|
|
10
10
|
|
|
11
11
|
```txt
|
|
12
12
|
*.model.md
|
|
@@ -15,10 +15,19 @@ The format has four document types:
|
|
|
15
15
|
*.design.md
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
- `*.model.md` defines shared domain vocabulary.
|
|
18
|
+
- `*.model.md` defines shared domain vocabulary and global domain rules.
|
|
19
19
|
- `*.feature.md` defines user-facing behavior with rules and scenarios.
|
|
20
|
-
- `*.stack.md` defines technical platform choices.
|
|
21
|
-
- `*.design.md` defines product, UI, and interaction
|
|
20
|
+
- `*.stack.md` defines technical platform choices and their rationale.
|
|
21
|
+
- `*.design.md` defines product, UI, layout, visual, and interaction direction.
|
|
22
|
+
|
|
23
|
+
The short version:
|
|
24
|
+
|
|
25
|
+
```txt
|
|
26
|
+
model tells tests what things mean
|
|
27
|
+
features tell tests what behavior must work
|
|
28
|
+
stack tells implementation what tools and constraints to use
|
|
29
|
+
design tells implementation what experience to create
|
|
30
|
+
```
|
|
22
31
|
|
|
23
32
|
## Frontmatter
|
|
24
33
|
|
|
@@ -45,13 +54,15 @@ Optional fields:
|
|
|
45
54
|
- `model`: a single referenced model id, for feature and design files
|
|
46
55
|
- `models`: comma-separated referenced model ids, for feature and design files
|
|
47
56
|
|
|
57
|
+
IDs use uppercase words separated by hyphens. IDs are the contract between specs, tests, reports, and implementation work.
|
|
58
|
+
|
|
48
59
|
## Purpose
|
|
49
60
|
|
|
50
61
|
Every model, feature, stack, and design file MUST include a short `## Purpose` section.
|
|
51
62
|
|
|
52
63
|
Purpose explains the document boundary and intent. It SHOULD be one or two short paragraphs and SHOULD NOT contain rules, scenarios, implementation details, or roadmap notes.
|
|
53
64
|
|
|
54
|
-
## Model
|
|
65
|
+
## Model Files
|
|
55
66
|
|
|
56
67
|
Model files use the `.model.md` suffix.
|
|
57
68
|
|
|
@@ -79,9 +90,13 @@ Model items use stable `-M001` IDs:
|
|
|
79
90
|
A card represents one work item on the board.
|
|
80
91
|
```
|
|
81
92
|
|
|
82
|
-
Model rules use stable `-R001` IDs and
|
|
93
|
+
Model rules use stable `-R001` IDs and describe global invariants for the domain vocabulary:
|
|
94
|
+
|
|
95
|
+
```md
|
|
96
|
+
- KANBAN-R001: A card MUST have one current workflow state.
|
|
97
|
+
```
|
|
83
98
|
|
|
84
|
-
## Feature
|
|
99
|
+
## Feature Files
|
|
85
100
|
|
|
86
101
|
Feature files use the `.feature.md` suffix.
|
|
87
102
|
|
|
@@ -121,7 +136,9 @@ Allowed step keywords:
|
|
|
121
136
|
- `And`
|
|
122
137
|
- `But`
|
|
123
138
|
|
|
124
|
-
|
|
139
|
+
Rules state durable product truths. Scenarios show concrete examples that executable tests can implement.
|
|
140
|
+
|
|
141
|
+
## Stack Files
|
|
125
142
|
|
|
126
143
|
Stack files use the `.stack.md` suffix.
|
|
127
144
|
|
|
@@ -171,7 +188,7 @@ Define the initial technical stack for implementing the Kanban board.
|
|
|
171
188
|
| Testing | Playwright |
|
|
172
189
|
```
|
|
173
190
|
|
|
174
|
-
## Design
|
|
191
|
+
## Design Files
|
|
175
192
|
|
|
176
193
|
Design files use the `.design.md` suffix.
|
|
177
194
|
|
|
@@ -220,17 +237,19 @@ Define the visual and interaction design direction for the Kanban board.
|
|
|
220
237
|
The board should feel lightweight, immediate, and calm.
|
|
221
238
|
```
|
|
222
239
|
|
|
223
|
-
## Splitting
|
|
240
|
+
## Splitting Guidance
|
|
224
241
|
|
|
225
242
|
Split model files by coherent domain vocabulary, ownership, or lifecycle.
|
|
226
243
|
|
|
227
|
-
|
|
244
|
+
Split feature files by user capability.
|
|
228
245
|
|
|
229
|
-
Use stack files for broad technical choices such as framework, language, testing, persistence, and
|
|
246
|
+
Use stack files for broad technical choices such as framework, language, testing, persistence, deployment, and runtime constraints.
|
|
230
247
|
|
|
231
248
|
Use design files for product/UI direction such as layout, interaction, visual style, and design principles.
|
|
232
249
|
|
|
233
|
-
|
|
250
|
+
Keep each document small enough for an AI to read, revise, and use as test-writing context without extra explanation.
|
|
251
|
+
|
|
252
|
+
## Test Coverage Convention
|
|
234
253
|
|
|
235
254
|
Spec files do not contain test mappings.
|
|
236
255
|
|
|
@@ -243,3 +262,11 @@ Generated tooling can answer:
|
|
|
243
262
|
- Which rules have executable coverage?
|
|
244
263
|
- Which tests reference deleted or unknown spec IDs?
|
|
245
264
|
- Which visible flows have screenshots, traces, or other evidence?
|
|
265
|
+
|
|
266
|
+
Example:
|
|
267
|
+
|
|
268
|
+
```ts
|
|
269
|
+
test("KANBAN-CARD-AUTHORING-S001 user creates a card", async ({ page }) => {
|
|
270
|
+
// Covers KANBAN-M001 and KANBAN-CARD-AUTHORING-R001.
|
|
271
|
+
});
|
|
272
|
+
```
|
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Command-line interface for initializing, validating, reporting on, and
|
|
4
|
+
* measuring test coverage for Feature Spec Markdown documents.
|
|
5
|
+
*/
|
|
2
6
|
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
3
7
|
import path from "node:path";
|
|
4
8
|
import { collectSpecScreenshots, renderHtmlReport, writeTextFile, } from "./index.js";
|
|
9
|
+
import { publishGithubActionReport } from "./githubActionReport.js";
|
|
5
10
|
import { checkSpecDocuments } from "./specDocuments.js";
|
|
6
11
|
import { buildSpecImplementationReport, formatSpecImplementationReport, } from "./testImplementationReport.js";
|
|
7
12
|
const defaultSpecPattern = "specs/**/*.model.md,specs/**/*.feature.md,specs/**/*.stack.md,specs/**/*.design.md";
|
|
@@ -19,6 +24,8 @@ async function main() {
|
|
|
19
24
|
return runReport(options);
|
|
20
25
|
if (command === "coverage")
|
|
21
26
|
return runCoverage(options);
|
|
27
|
+
if (command === "github-report")
|
|
28
|
+
return publishGithubActionReport(options);
|
|
22
29
|
if (command === "init")
|
|
23
30
|
return runInit(options);
|
|
24
31
|
printHelp();
|
|
@@ -28,6 +35,7 @@ async function runCheck(options) {
|
|
|
28
35
|
const result = await checkSpecDocuments({
|
|
29
36
|
specs: optionList(options.specs, defaultSpecPattern),
|
|
30
37
|
tests: options.tests === "" ? [] : optionList(options.tests, defaultTestPattern),
|
|
38
|
+
requireModelCoverage: options["require-model-coverage"] === "true",
|
|
31
39
|
requireRuleCoverage: options["require-rule-coverage"] === "true",
|
|
32
40
|
requireScenarioCoverage: options["require-scenario-coverage"] !== "false",
|
|
33
41
|
});
|
|
@@ -56,7 +64,7 @@ async function runCoverage(options) {
|
|
|
56
64
|
}
|
|
57
65
|
const report = buildSpecImplementationReport(result.features, result.coverage, result.models);
|
|
58
66
|
console.log(formatSpecImplementationReport(report));
|
|
59
|
-
if (options["fail-on-missing"] === "true" && report
|
|
67
|
+
if (options["fail-on-missing"] === "true" && hasMissingCoverage(report)) {
|
|
60
68
|
process.exit(1);
|
|
61
69
|
}
|
|
62
70
|
}
|
|
@@ -125,6 +133,11 @@ function printIssues(issues) {
|
|
|
125
133
|
console.error(`${issue.severity.toUpperCase()} ${issue.code}${location ? ` ${location}` : ""}: ${issue.message}`);
|
|
126
134
|
}
|
|
127
135
|
}
|
|
136
|
+
function hasMissingCoverage(report) {
|
|
137
|
+
return (report.missingScenarios > 0 ||
|
|
138
|
+
report.missingRules > 0 ||
|
|
139
|
+
report.missingModelItems > 0);
|
|
140
|
+
}
|
|
128
141
|
async function reportTitle() {
|
|
129
142
|
const packageName = await readPackageName();
|
|
130
143
|
return packageName
|
|
@@ -149,15 +162,26 @@ function printHelp() {
|
|
|
149
162
|
Usage:
|
|
150
163
|
feature-spec-md init [--kind feature|model|stack|design] [--dir specs]
|
|
151
164
|
feature-spec-md check [--specs "specs/**/*.model.md,specs/**/*.feature.md,specs/**/*.stack.md,specs/**/*.design.md"] [--tests "tests/**/*.spec.ts"]
|
|
152
|
-
feature-spec-md coverage [--specs "specs/**/*.feature.md"] [--tests "tests/**/*.spec.ts"] [--fail-on-missing]
|
|
165
|
+
feature-spec-md coverage [--specs "specs/**/*.model.md,specs/**/*.feature.md,specs/**/*.stack.md,specs/**/*.design.md"] [--tests "tests/**/*.spec.ts"] [--fail-on-missing]
|
|
153
166
|
feature-spec-md report [--specs "specs/**/*.model.md,specs/**/*.feature.md,specs/**/*.stack.md,specs/**/*.design.md"] [--tests "tests/**/*.spec.ts"] [--screenshots "test-results/spec-report/screenshots.json"] [--out test-results/feature-spec-report/index.html]
|
|
167
|
+
feature-spec-md github-report [--report-dir test-results/spec-report] [--publish artifact|ftp]
|
|
154
168
|
|
|
155
169
|
Options:
|
|
170
|
+
--require-model-coverage Fail when model items have no matching test references.
|
|
156
171
|
--require-rule-coverage Fail when rules have no matching test references.
|
|
157
172
|
--require-scenario-coverage Defaults to true for check. Use --require-scenario-coverage=false to disable.
|
|
158
|
-
--fail-on-missing Exit with status 1 when coverage finds missing
|
|
173
|
+
--fail-on-missing Exit with status 1 when coverage finds missing model items, rules, or scenarios.
|
|
159
174
|
--screenshots Screenshot manifest JSON glob for report evidence.
|
|
160
175
|
--tests "" Disable test coverage lookup.
|
|
176
|
+
|
|
177
|
+
GitHub report publishing:
|
|
178
|
+
--publish artifact Write summary and outputs for GitHub artifact upload.
|
|
179
|
+
--publish ftp Upload report files and an index.html to FTP; no GitHub artifact is needed.
|
|
180
|
+
--ftp-host FTP host, or FEATURE_SPEC_FTP_HOST.
|
|
181
|
+
--ftp-user FTP username, or FEATURE_SPEC_FTP_USER.
|
|
182
|
+
--ftp-password FTP password, or FEATURE_SPEC_FTP_PASSWORD.
|
|
183
|
+
--ftp-remote-dir FTP root directory for reports, or FEATURE_SPEC_FTP_REMOTE_DIR.
|
|
184
|
+
--base-url Public base URL, or FEATURE_SPEC_REPORT_BASE_URL.
|
|
161
185
|
`);
|
|
162
186
|
}
|
|
163
187
|
function fileNameForKind(kind) {
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EACL,sBAAsB,EACtB,gBAAgB,EAChB,aAAa,GAEd,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAA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.js";
|
|
2
|
+
/** Parse one feature spec Markdown document into structured metadata, rules, and scenarios. */
|
|
3
|
+
export declare function parseFeatureSpec(source: string, options?: {
|
|
4
|
+
filePath?: string;
|
|
5
|
+
}): FeatureSpec;
|
|
6
|
+
/** Validate spec structure, ID prefixes, duplicate IDs, and required sections. */
|
|
7
|
+
export declare function validateFeatureSpec(spec: FeatureSpec): ValidationIssue[];
|
|
8
|
+
/** Find rule and scenario IDs referenced by one test source file. */
|
|
9
|
+
export declare function parseTestReferences(source: string, filePath?: string): TestReference[];
|
|
10
|
+
/** Expand test file globs and collect all rule and scenario references from them. */
|
|
11
|
+
export declare function collectTestReferences(patterns: string[]): Promise<TestReference[]>;
|
|
12
|
+
/** Build rule and scenario coverage from parsed specs and collected test references. */
|
|
13
|
+
export declare function buildCoverageSummary(specs: FeatureSpec[], references: TestReference[]): CoverageSummary;
|
|
14
|
+
/** Validate coverage expectations and orphaned references. */
|
|
15
|
+
export declare function validateCoverage(coverage: CoverageSummary, options?: {
|
|
16
|
+
requireRuleCoverage?: boolean;
|
|
17
|
+
requireScenarioCoverage?: boolean;
|
|
18
|
+
}): ValidationIssue[];
|
|
19
|
+
/** Load and parse all feature specs matching the provided globs. */
|
|
20
|
+
export declare function loadFeatureSpecs(patterns: string[]): Promise<FeatureSpec[]>;
|
|
21
|
+
/** Run spec validation and optional test coverage validation in one call. */
|
|
22
|
+
export declare function checkFeatureSpecs(options: {
|
|
23
|
+
specs: string[];
|
|
24
|
+
tests?: string[];
|
|
25
|
+
requireRuleCoverage?: boolean;
|
|
26
|
+
requireScenarioCoverage?: boolean;
|
|
27
|
+
}): Promise<{
|
|
28
|
+
specs: FeatureSpec[];
|
|
29
|
+
validationIssues: ValidationIssue[];
|
|
30
|
+
coverage: CoverageSummary | undefined;
|
|
31
|
+
coverageIssues: ValidationIssue[];
|
|
32
|
+
ok: boolean;
|
|
33
|
+
}>;
|
|
34
|
+
//# sourceMappingURL=featureSpecs.d.ts.map
|
|
@@ -0,0 +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