speckeeper 0.9.2 → 0.9.4

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.
@@ -0,0 +1,449 @@
1
+ # speckeeper CLI
2
+
3
+ TypeScript-first specification validation framework — validate design consistency, external SSOT integrity, and traceability with type-safe TypeScript DSL. Supports design lint, external source checks (OpenAPI, DDL, annotations), drift detection, impact analysis, and scaffolding from Mermaid flowcharts.
4
+
5
+ **Version:** 0.9.4
6
+
7
+ ## Table of Contents
8
+
9
+ - [speckeeper](#speckeeper)
10
+ - [init](#speckeeper-init)
11
+ - [build](#speckeeper-build)
12
+ - [lint](#speckeeper-lint)
13
+ - [drift](#speckeeper-drift)
14
+ - [check](#speckeeper-check)
15
+ - [new](#speckeeper-new)
16
+ - [impact](#speckeeper-impact)
17
+ - [scaffold](#speckeeper-scaffold)
18
+
19
+ ---
20
+
21
+ ## speckeeper
22
+
23
+ Requirements and design management framework with TypeScript DSL.
24
+
25
+ ### Global Options
26
+
27
+ | Option | Aliases | Required | Default | Description |
28
+ |---|---|---|---|---|
29
+ | `--version` | -V | No | | Print version and exit. |
30
+ | `--help` | -h | No | | Show help and exit. |
31
+
32
+ ### init
33
+
34
+ Initialize a new speckeeper project with starter templates.
35
+
36
+ Copies starter template files (speckeeper.config.ts, design/ directory structure) into the current project. Provides a minimal working setup with generic models and example specs.
37
+
38
+ **Usage:**
39
+
40
+ ```
41
+ speckeeper init
42
+ ```
43
+ ```
44
+ speckeeper init --force
45
+ ```
46
+
47
+ #### Options
48
+
49
+ | Option | Aliases | Required | Default | Description |
50
+ |---|---|---|---|---|
51
+ | `--force` | -f | No | `false` | Overwrite existing files. |
52
+
53
+ #### Exit Codes
54
+
55
+ **Exit 0:** Project initialized successfully.
56
+
57
+ - **stdout:** format=`text`
58
+
59
+ **Exit 1:** Initialization failed (files already exist without --force).
60
+
61
+ - **stderr:** format=`text`
62
+
63
+ #### Extensions
64
+
65
+ ```yaml
66
+ x-agent:
67
+ riskLevel: low
68
+ requiresConfirmation: false
69
+ idempotent: false
70
+ sideEffects:
71
+ - file_write
72
+ ```
73
+
74
+ ---
75
+
76
+ ### build
77
+
78
+ Generate docs/ and specs/ from TypeScript models.
79
+
80
+ Loads the design TypeScript models and generates machine-readable specs/ output and optionally human-readable docs/ output. Supports markdown, JSON, or both formats. Can watch for file changes and auto-regenerate.
81
+
82
+ **Usage:**
83
+
84
+ ```
85
+ speckeeper build
86
+ ```
87
+ ```
88
+ speckeeper build --format json --output ./out
89
+ ```
90
+ ```
91
+ speckeeper build --watch --verbose
92
+ ```
93
+
94
+ #### Options
95
+
96
+ | Option | Aliases | Required | Default | Description |
97
+ |---|---|---|---|---|
98
+ | `--config` | -c | No | | Path to config file. |
99
+ | `--output` | -o | No | `"."` | Base output directory path. |
100
+ | `--format` | -f | No | `"both"` | Output format: markdown, json, both. |
101
+ | `--watch` | -w | No | `false` | Watch for changes and auto-regenerate. |
102
+ | `--verbose` | -v | No | `false` | Show detailed output. |
103
+
104
+ #### Exit Codes
105
+
106
+ **Exit 0:** Build completed successfully.
107
+
108
+ - **stdout:** format=`text`
109
+
110
+ **Exit 1:** Build failed (config error, model loading error, or generation error).
111
+
112
+ - **stderr:** format=`text`
113
+
114
+ #### Extensions
115
+
116
+ ```yaml
117
+ x-agent:
118
+ riskLevel: low
119
+ requiresConfirmation: false
120
+ idempotent: true
121
+ sideEffects:
122
+ - file_write
123
+ ```
124
+
125
+ ---
126
+
127
+ ### lint
128
+
129
+ Check design integrity (ID duplicates, references, layer violations, etc.).
130
+
131
+ Validates design models for structural integrity. Checks include ID uniqueness, ID naming conventions, reference integrity, circular dependency detection, phase gate enforcement, and custom model-specific lint rules. Optionally auto-fixes issues.
132
+
133
+ **Usage:**
134
+
135
+ ```
136
+ speckeeper lint
137
+ ```
138
+ ```
139
+ speckeeper lint --strict --format github
140
+ ```
141
+ ```
142
+ speckeeper lint --phase HLD --fix
143
+ ```
144
+
145
+ #### Options
146
+
147
+ | Option | Aliases | Required | Default | Description |
148
+ |---|---|---|---|---|
149
+ | `--config` | -c | No | | Path to config file. |
150
+ | `--phase` | -p | No | | Phase gate to check against: REQ, HLD, LLD, OPS. |
151
+ | `--strict` | -s | No | `false` | Treat warnings as errors. |
152
+ | `--fix` | | No | `false` | Attempt to fix auto-fixable issues. |
153
+ | `--format` | -f | No | `"text"` | Output format: text, json, github. |
154
+
155
+ #### Exit Codes
156
+
157
+ **Exit 0:** No lint issues found (or all issues auto-fixed).
158
+
159
+ - **stdout:** format=`text`
160
+
161
+ **Exit 1:** Lint issues found (errors or warnings with --strict).
162
+
163
+ - **stderr:** format=`text`
164
+
165
+ #### Extensions
166
+
167
+ ```yaml
168
+ x-agent:
169
+ riskLevel: low
170
+ requiresConfirmation: false
171
+ idempotent: true
172
+ sideEffects:
173
+
174
+ ```
175
+
176
+ ---
177
+
178
+ ### drift
179
+
180
+ Check if generated files have been manually edited.
181
+
182
+ Compares generated files against their expected content to detect manual edits (drift). Useful for CI pipelines to ensure generated docs/ files stay in sync with model definitions. Can auto-update drifted files.
183
+
184
+ **Usage:**
185
+
186
+ ```
187
+ speckeeper drift
188
+ ```
189
+ ```
190
+ speckeeper drift --fail-on-drift
191
+ ```
192
+ ```
193
+ speckeeper drift --update --format diff
194
+ ```
195
+
196
+ #### Options
197
+
198
+ | Option | Aliases | Required | Default | Description |
199
+ |---|---|---|---|---|
200
+ | `--config` | -c | No | | Path to config file. |
201
+ | `--update` | -u | No | `false` | Auto-update if differences are found. |
202
+ | `--format` | -f | No | `"text"` | Output format: text, json, diff. |
203
+ | `--fail-on-drift` | | No | `false` | Exit with code 1 if drift is detected (for CI). |
204
+
205
+ #### Exit Codes
206
+
207
+ **Exit 0:** No drift detected (or drift auto-updated with --update).
208
+
209
+ - **stdout:** format=`text`
210
+
211
+ **Exit 1:** Drift detected (with --fail-on-drift), or update failed.
212
+
213
+ - **stderr:** format=`text`
214
+
215
+ #### Extensions
216
+
217
+ ```yaml
218
+ x-agent:
219
+ riskLevel: low
220
+ requiresConfirmation: false
221
+ idempotent: true
222
+ sideEffects:
223
+
224
+ safeDryRunOption: Omit --update to run in read-only mode.
225
+ ```
226
+
227
+ ---
228
+
229
+ ### check
230
+
231
+ Check external SSOT conformance (including custom models).
232
+
233
+ Validates specifications against actual implementation artifacts using a global source scan. Performs existence checks (is the spec ID found in configured sources?), optional structural checks (via deep validation), and optional type checks. Sources include OpenAPI, DDL, annotations, and custom scanners. Supports filtering by check type and test coverage reporting.
234
+
235
+ **Usage:**
236
+
237
+ ```
238
+ speckeeper check
239
+ ```
240
+ ```
241
+ speckeeper check external-ssot --verbose
242
+ ```
243
+ ```
244
+ speckeeper check test --coverage
245
+ ```
246
+ ```
247
+ speckeeper check openapi --strict
248
+ ```
249
+
250
+ #### Arguments
251
+
252
+ | Name | Required | Description |
253
+ |---|---|---|
254
+ | `type` | No | Type of check to run. Filters sources by type. When omitted, checks all configured sources. |
255
+
256
+ #### Options
257
+
258
+ | Option | Aliases | Required | Default | Description |
259
+ |---|---|---|---|---|
260
+ | `--config` | -c | No | | Path to config file. |
261
+ | `--strict` | | No | `false` | Treat warnings as errors. |
262
+ | `--verbose` | -v | No | `false` | Show detailed output (e.g. list unmatched specs). |
263
+ | `--coverage` | | No | `false` | Check if all testable acceptance criteria are covered by TestRefs. |
264
+
265
+ #### Exit Codes
266
+
267
+ **Exit 0:** All checks passed (all specs found in sources, deep validation passed).
268
+
269
+ - **stdout:** format=`text`
270
+
271
+ **Exit 1:** Check failures found (missing specs, structural mismatches, or coverage gaps).
272
+
273
+ - **stderr:** format=`text`
274
+
275
+ #### Extensions
276
+
277
+ ```yaml
278
+ x-agent:
279
+ riskLevel: low
280
+ requiresConfirmation: false
281
+ idempotent: true
282
+ sideEffects:
283
+
284
+ ```
285
+
286
+ ---
287
+
288
+ ### new
289
+
290
+ Create a new element with auto-generated ID.
291
+
292
+ Generates a new design element file with a unique auto-generated ID based on the model's ID prefix and existing elements. Supports all built-in model types and uses templates for file generation.
293
+
294
+ **Usage:**
295
+
296
+ ```
297
+ speckeeper new requirement --name "User Authentication"
298
+ ```
299
+ ```
300
+ speckeeper new entity --kind functional
301
+ ```
302
+ ```
303
+ speckeeper new usecase --template custom-template.ts
304
+ ```
305
+
306
+ #### Arguments
307
+
308
+ | Name | Required | Description |
309
+ |---|---|---|
310
+ | `type` | Yes | Element type to create: requirement, usecase, entity, component, screen, flow, error-case, term. |
311
+
312
+ #### Options
313
+
314
+ | Option | Aliases | Required | Default | Description |
315
+ |---|---|---|---|---|
316
+ | `--kind` | -k | No | | Sub-kind (e.g. functional, non-functional for requirements). |
317
+ | `--name` | -n | No | | Name of the element. |
318
+ | `--output` | -o | No | | Output directory path. |
319
+ | `--template` | -t | No | | Path to template file. |
320
+
321
+ #### Exit Codes
322
+
323
+ **Exit 0:** Element file created with auto-generated ID.
324
+
325
+ - **stdout:** format=`text`
326
+
327
+ **Exit 1:** Creation failed (invalid type, template error, or write error).
328
+
329
+ - **stderr:** format=`text`
330
+
331
+ #### Extensions
332
+
333
+ ```yaml
334
+ x-agent:
335
+ riskLevel: low
336
+ requiresConfirmation: false
337
+ idempotent: false
338
+ sideEffects:
339
+ - file_write
340
+ ```
341
+
342
+ ---
343
+
344
+ ### impact
345
+
346
+ Analyze impact of changes to an ID.
347
+
348
+ Performs change impact analysis by traversing the relation graph starting from the specified spec ID. Shows upstream (dependants) and/or downstream (dependencies) elements up to the configured depth. Supports text, JSON, and Mermaid diagram output.
349
+
350
+ **Usage:**
351
+
352
+ ```
353
+ speckeeper impact FR-001
354
+ ```
355
+ ```
356
+ speckeeper impact ENT-ORDER --direction upstream --depth 5
357
+ ```
358
+ ```
359
+ speckeeper impact COMP-AUTH --format mermaid
360
+ ```
361
+
362
+ #### Arguments
363
+
364
+ | Name | Required | Description |
365
+ |---|---|---|
366
+ | `id` | Yes | Spec ID to analyze (e.g. REQ-001, ENT-ORDER, COMP-AUTH). |
367
+
368
+ #### Options
369
+
370
+ | Option | Aliases | Required | Default | Description |
371
+ |---|---|---|---|---|
372
+ | `--config` | -c | No | | Path to config file. |
373
+ | `--depth` | -d | No | `"3"` | Analysis depth (reference tracking level). |
374
+ | `--direction` | | No | `"both"` | Analysis direction: upstream, downstream, both. |
375
+ | `--format` | -f | No | `"text"` | Output format: text, json, mermaid. |
376
+
377
+ #### Exit Codes
378
+
379
+ **Exit 0:** Impact analysis completed and displayed.
380
+
381
+ - **stdout:** format=`text`
382
+
383
+ **Exit 1:** Analysis failed (ID not found or config error).
384
+
385
+ - **stderr:** format=`text`
386
+
387
+ #### Extensions
388
+
389
+ ```yaml
390
+ x-agent:
391
+ riskLevel: low
392
+ requiresConfirmation: false
393
+ idempotent: true
394
+ sideEffects:
395
+
396
+ ```
397
+
398
+ ---
399
+
400
+ ### scaffold
401
+
402
+ Generate _models/ from a Mermaid flowchart definition.
403
+
404
+ Parses a Mermaid flowchart from a Markdown file and generates TypeScript model classes, spec data files, and an index file in the design directory. Uses class-based artifact resolution to determine model types from Mermaid node classes.
405
+
406
+ **Usage:**
407
+
408
+ ```
409
+ speckeeper scaffold --source requirements.md
410
+ ```
411
+ ```
412
+ speckeeper scaffold --source flow.md --output design/ --force
413
+ ```
414
+ ```
415
+ speckeeper scaffold --source arch.md --dry-run
416
+ ```
417
+
418
+ #### Options
419
+
420
+ | Option | Aliases | Required | Default | Description |
421
+ |---|---|---|---|---|
422
+ | `--source` | -s | Yes | | Path to Markdown file containing Mermaid flowchart. |
423
+ | `--output` | -o | No | `"design/"` | Output directory. |
424
+ | `--force` | -f | No | `false` | Overwrite existing files. |
425
+ | `--dry-run` | | No | `false` | Preview generated files without writing. |
426
+
427
+ #### Exit Codes
428
+
429
+ **Exit 0:** Model files generated (or previewed with --dry-run) successfully.
430
+
431
+ - **stdout:** format=`text`
432
+
433
+ **Exit 1:** Scaffold failed (source file not found, invalid Mermaid syntax, or write error).
434
+
435
+ - **stderr:** format=`text`
436
+
437
+ #### Extensions
438
+
439
+ ```yaml
440
+ x-agent:
441
+ riskLevel: low
442
+ requiresConfirmation: false
443
+ idempotent: false
444
+ sideEffects:
445
+ - file_write
446
+ safeDryRunOption: --dry-run
447
+ ```
448
+
449
+ ---
@@ -0,0 +1,72 @@
1
+ # Actors
2
+
3
+ | ID | Name | Type | Description |
4
+ |----|------|------|-------------|
5
+ | UC-ACTOR-001 | Requirements Engineer | human | PO/PM/Business representative. Defines requirements and acceptance criteria in TS models and generates documentation |
6
+ | UC-ACTOR-002 | Design Engineer | human | Architect/Development lead. Defines logical architecture and concept models in TS models and generates C4/ER diagrams |
7
+ | UC-ACTOR-003 | Implementation Engineer | human | App/Infrastructure developer. Defines screen specifications and process flows, checks consistency with external SSOT |
8
+ | UC-ACTOR-004 | Operations Engineer | human | SRE/Operations staff. Manages observability requirements, Runbook and monitoring configuration consistency |
9
+ | UC-ACTOR-005 | Reviewer | human | Quality/Security staff. Performs design reviews and verifies consistency check results |
10
+ | UC-ACTOR-SYS-001 | CI/CD System | system | System that automatically executes lint/drift/check commands |
11
+
12
+ ---
13
+
14
+ ## UC-ACTOR-001: Requirements Engineer
15
+
16
+ **Type**: human
17
+
18
+ ### Description
19
+
20
+ PO/PM/Business representative. Defines requirements and acceptance criteria in TS models and generates documentation
21
+
22
+ ---
23
+
24
+ ## UC-ACTOR-002: Design Engineer
25
+
26
+ **Type**: human
27
+
28
+ ### Description
29
+
30
+ Architect/Development lead. Defines logical architecture and concept models in TS models and generates C4/ER diagrams
31
+
32
+ ---
33
+
34
+ ## UC-ACTOR-003: Implementation Engineer
35
+
36
+ **Type**: human
37
+
38
+ ### Description
39
+
40
+ App/Infrastructure developer. Defines screen specifications and process flows, checks consistency with external SSOT
41
+
42
+ ---
43
+
44
+ ## UC-ACTOR-004: Operations Engineer
45
+
46
+ **Type**: human
47
+
48
+ ### Description
49
+
50
+ SRE/Operations staff. Manages observability requirements, Runbook and monitoring configuration consistency
51
+
52
+ ---
53
+
54
+ ## UC-ACTOR-005: Reviewer
55
+
56
+ **Type**: human
57
+
58
+ ### Description
59
+
60
+ Quality/Security staff. Performs design reviews and verifies consistency check results
61
+
62
+ ---
63
+
64
+ ## UC-ACTOR-SYS-001: CI/CD System
65
+
66
+ **Type**: system
67
+
68
+ ### Description
69
+
70
+ System that automatically executes lint/drift/check commands
71
+
72
+ ---
@@ -0,0 +1,42 @@
1
+ # Components
2
+
3
+ | ID | Name | Type | Description |
4
+ |----|------|------|-------------|
5
+ | ACTOR-001 | Requirements Engineer | person | Requirements engineer. Defines requirements and acceptance criteria in TS models |
6
+ | ACTOR-002 | Architect | person | Architect. Defines logical architecture and concept models in TS models |
7
+ | ACTOR-003 | Developer | person | Developer. Defines screen specifications and process flows in TS models, maintains consistency with implementation |
8
+ | ACTOR-004 | CI/CD System | person | CI/CD pipeline. Automatically executes lint/drift/check commands |
9
+
10
+ ---
11
+
12
+ ## ACTOR-001: Requirements Engineer
13
+
14
+ **Type**: person
15
+
16
+ Requirements engineer. Defines requirements and acceptance criteria in TS models
17
+
18
+ ---
19
+
20
+ ## ACTOR-002: Architect
21
+
22
+ **Type**: person
23
+
24
+ Architect. Defines logical architecture and concept models in TS models
25
+
26
+ ---
27
+
28
+ ## ACTOR-003: Developer
29
+
30
+ **Type**: person
31
+
32
+ Developer. Defines screen specifications and process flows in TS models, maintains consistency with implementation
33
+
34
+ ---
35
+
36
+ ## ACTOR-004: CI/CD System
37
+
38
+ **Type**: person
39
+
40
+ CI/CD pipeline. Automatically executes lint/drift/check commands
41
+
42
+ ---
@@ -0,0 +1,69 @@
1
+ # Artifacts
2
+
3
+ ## SSOT (Single Source of Truth)
4
+
5
+ | ID | Name | Location | Purpose | Drift Target |
6
+ |----|------|----------|---------|--------------|
7
+ | ART-001 | SSOT | `design/` | TypeScript models (source of truth) = requirement/design definitions | No |
8
+
9
+ ## Human-readable artifacts
10
+
11
+ | ID | Name | Location | Purpose | Drift Target |
12
+ |----|------|----------|---------|--------------|
13
+ | ART-002 | Human-readable artifacts | `docs/` | Markdown/Mermaid (for review) | Yes |
14
+
15
+ ## Machine-readable artifacts
16
+
17
+ | ID | Name | Location | Purpose | Drift Target |
18
+ |----|------|----------|---------|--------------|
19
+ | ART-003 | Machine-readable artifacts | `specs/` | JSON/JSON Schema for consistency checking | Yes |
20
+
21
+ ## Implementation code
22
+
23
+ | ID | Name | Location | Purpose | Drift Target |
24
+ |----|------|----------|---------|--------------|
25
+ | ART-004 | Implementation code | `src/` | Application implementation (not managed by speckeeper) | No |
26
+
27
+ ---
28
+
29
+ ## ART-001: SSOT
30
+
31
+ **Category**: ssot | **Location**: `design/` | **Drift Target**: No
32
+
33
+ ### Purpose
34
+
35
+ TypeScript models (source of truth) = requirement/design definitions
36
+
37
+ ---
38
+
39
+ ## ART-002: Human-readable artifacts
40
+
41
+ **Category**: human-readable | **Location**: `docs/` | **Drift Target**: Yes
42
+ **Generated From**: ART-001
43
+
44
+ ### Purpose
45
+
46
+ Markdown/Mermaid (for review)
47
+
48
+ ---
49
+
50
+ ## ART-003: Machine-readable artifacts
51
+
52
+ **Category**: machine-readable | **Location**: `specs/` | **Drift Target**: Yes
53
+ **Generated From**: ART-001
54
+
55
+ ### Purpose
56
+
57
+ JSON/JSON Schema for consistency checking
58
+
59
+ ---
60
+
61
+ ## ART-004: Implementation code
62
+
63
+ **Category**: implementation | **Location**: `src/` | **Drift Target**: No
64
+
65
+ ### Purpose
66
+
67
+ Application implementation (not managed by speckeeper)
68
+
69
+ ---