speckeeper 0.9.2 → 0.9.3

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 CHANGED
@@ -151,6 +151,8 @@ npx speckeeper impact FR-001
151
151
 
152
152
  ## CLI Commands
153
153
 
154
+ > **Full CLI reference:** [docs/cli-reference.md](./docs/cli-reference.md) | **Machine-readable contract:** [cli-contract.yaml](./cli-contract.yaml)
155
+
154
156
  | Command | Description |
155
157
  |---------|-------------|
156
158
  | `speckeeper init` | Initialize a new project with starter templates |
@@ -0,0 +1,574 @@
1
+ # yaml-language-server: $schema=./node_modules/cli-contracts/schemas/cli-contract.schema.json
2
+ cliContracts: 0.1.0
3
+
4
+ info:
5
+ title: speckeeper CLI
6
+ version: 0.9.3
7
+ description: >-
8
+ TypeScript-first specification validation framework — validate design
9
+ consistency, external SSOT integrity, and traceability with type-safe
10
+ TypeScript DSL. Supports design lint, external source checks (OpenAPI,
11
+ DDL, annotations), drift detection, impact analysis, and scaffolding
12
+ from Mermaid flowcharts.
13
+ license:
14
+ name: MIT
15
+
16
+ commandSets:
17
+ speckeeper:
18
+ summary: Requirements and design management framework with TypeScript DSL.
19
+ executable: speckeeper
20
+
21
+ globalOptions:
22
+ - name: version
23
+ aliases: [V]
24
+ description: Print version and exit.
25
+ schema:
26
+ type: boolean
27
+
28
+ - name: help
29
+ aliases: [h]
30
+ description: Show help and exit.
31
+ schema:
32
+ type: boolean
33
+
34
+ commands:
35
+ # ── init ──────────────────────────────────────────
36
+ init:
37
+ summary: Initialize a new speckeeper project with starter templates.
38
+ description: >-
39
+ Copies starter template files (speckeeper.config.ts, design/
40
+ directory structure) into the current project. Provides a minimal
41
+ working setup with generic models and example specs.
42
+ usage:
43
+ - speckeeper init
44
+ - speckeeper init --force
45
+
46
+ options:
47
+ - name: force
48
+ aliases: [f]
49
+ description: Overwrite existing files.
50
+ schema:
51
+ type: boolean
52
+ default: false
53
+
54
+ exits:
55
+ '0':
56
+ description: Project initialized successfully.
57
+ stdout:
58
+ format: text
59
+
60
+ '1':
61
+ description: Initialization failed (files already exist without --force).
62
+ stderr:
63
+ format: text
64
+
65
+ x-agent:
66
+ riskLevel: low
67
+ requiresConfirmation: false
68
+ idempotent: false
69
+ sideEffects:
70
+ - file_write
71
+
72
+ # ── build ─────────────────────────────────────────
73
+ build:
74
+ summary: Generate docs/ and specs/ from TypeScript models.
75
+ description: >-
76
+ Loads the design TypeScript models and generates machine-readable
77
+ specs/ output and optionally human-readable docs/ output. Supports
78
+ markdown, JSON, or both formats. Can watch for file changes and
79
+ auto-regenerate.
80
+ usage:
81
+ - speckeeper build
82
+ - speckeeper build --format json --output ./out
83
+ - speckeeper build --watch --verbose
84
+
85
+ options:
86
+ - name: config
87
+ aliases: [c]
88
+ description: Path to config file.
89
+ valueName: path
90
+ schema:
91
+ type: string
92
+ file:
93
+ mode: read
94
+ exists: true
95
+ encoding: utf-8
96
+
97
+ - name: output
98
+ aliases: [o]
99
+ description: Base output directory path.
100
+ valueName: path
101
+ schema:
102
+ type: string
103
+ default: "."
104
+
105
+ - name: format
106
+ aliases: [f]
107
+ description: "Output format: markdown, json, both."
108
+ valueName: format
109
+ schema:
110
+ type: string
111
+ default: both
112
+ enum: [markdown, json, both]
113
+
114
+ - name: watch
115
+ aliases: [w]
116
+ description: Watch for changes and auto-regenerate.
117
+ schema:
118
+ type: boolean
119
+ default: false
120
+
121
+ - name: verbose
122
+ aliases: [v]
123
+ description: Show detailed output.
124
+ schema:
125
+ type: boolean
126
+ default: false
127
+
128
+ exits:
129
+ '0':
130
+ description: Build completed successfully.
131
+ stdout:
132
+ format: text
133
+
134
+ '1':
135
+ description: Build failed (config error, model loading error, or generation error).
136
+ stderr:
137
+ format: text
138
+
139
+ x-agent:
140
+ riskLevel: low
141
+ requiresConfirmation: false
142
+ idempotent: true
143
+ sideEffects:
144
+ - file_write
145
+
146
+ # ── lint ──────────────────────────────────────────
147
+ lint:
148
+ summary: Check design integrity (ID duplicates, references, layer violations, etc.).
149
+ description: >-
150
+ Validates design models for structural integrity. Checks include
151
+ ID uniqueness, ID naming conventions, reference integrity, circular
152
+ dependency detection, phase gate enforcement, and custom model-specific
153
+ lint rules. Optionally auto-fixes issues.
154
+ usage:
155
+ - speckeeper lint
156
+ - speckeeper lint --strict --format github
157
+ - speckeeper lint --phase HLD --fix
158
+
159
+ options:
160
+ - name: config
161
+ aliases: [c]
162
+ description: Path to config file.
163
+ valueName: path
164
+ schema:
165
+ type: string
166
+ file:
167
+ mode: read
168
+ exists: true
169
+ encoding: utf-8
170
+
171
+ - name: phase
172
+ aliases: [p]
173
+ description: "Phase gate to check against: REQ, HLD, LLD, OPS."
174
+ valueName: phase
175
+ schema:
176
+ type: string
177
+ enum: [REQ, HLD, LLD, OPS]
178
+
179
+ - name: strict
180
+ aliases: [s]
181
+ description: Treat warnings as errors.
182
+ schema:
183
+ type: boolean
184
+ default: false
185
+
186
+ - name: fix
187
+ description: Attempt to fix auto-fixable issues.
188
+ schema:
189
+ type: boolean
190
+ default: false
191
+
192
+ - name: format
193
+ aliases: [f]
194
+ description: "Output format: text, json, github."
195
+ valueName: format
196
+ schema:
197
+ type: string
198
+ default: text
199
+ enum: [text, json, github]
200
+
201
+ exits:
202
+ '0':
203
+ description: No lint issues found (or all issues auto-fixed).
204
+ stdout:
205
+ format: text
206
+
207
+ '1':
208
+ description: Lint issues found (errors or warnings with --strict).
209
+ stderr:
210
+ format: text
211
+
212
+ x-agent:
213
+ riskLevel: low
214
+ requiresConfirmation: false
215
+ idempotent: true
216
+ sideEffects: []
217
+
218
+ # ── drift ─────────────────────────────────────────
219
+ drift:
220
+ summary: Check if generated files have been manually edited.
221
+ description: >-
222
+ Compares generated files against their expected content to detect
223
+ manual edits (drift). Useful for CI pipelines to ensure generated
224
+ docs/ files stay in sync with model definitions. Can auto-update
225
+ drifted files.
226
+ usage:
227
+ - speckeeper drift
228
+ - speckeeper drift --fail-on-drift
229
+ - speckeeper drift --update --format diff
230
+
231
+ options:
232
+ - name: config
233
+ aliases: [c]
234
+ description: Path to config file.
235
+ valueName: path
236
+ schema:
237
+ type: string
238
+ file:
239
+ mode: read
240
+ exists: true
241
+ encoding: utf-8
242
+
243
+ - name: update
244
+ aliases: [u]
245
+ description: Auto-update if differences are found.
246
+ schema:
247
+ type: boolean
248
+ default: false
249
+
250
+ - name: format
251
+ aliases: [f]
252
+ description: "Output format: text, json, diff."
253
+ valueName: format
254
+ schema:
255
+ type: string
256
+ default: text
257
+ enum: [text, json, diff]
258
+
259
+ - name: fail-on-drift
260
+ description: Exit with code 1 if drift is detected (for CI).
261
+ schema:
262
+ type: boolean
263
+ default: false
264
+
265
+ exits:
266
+ '0':
267
+ description: No drift detected (or drift auto-updated with --update).
268
+ stdout:
269
+ format: text
270
+
271
+ '1':
272
+ description: Drift detected (with --fail-on-drift), or update failed.
273
+ stderr:
274
+ format: text
275
+
276
+ x-agent:
277
+ riskLevel: low
278
+ requiresConfirmation: false
279
+ idempotent: true
280
+ sideEffects: []
281
+ safeDryRunOption: Omit --update to run in read-only mode.
282
+
283
+ # ── check ─────────────────────────────────────────
284
+ check:
285
+ summary: Check external SSOT conformance (including custom models).
286
+ description: >-
287
+ Validates specifications against actual implementation artifacts
288
+ using a global source scan. Performs existence checks (is the spec
289
+ ID found in configured sources?), optional structural checks (via
290
+ deep validation), and optional type checks. Sources include OpenAPI,
291
+ DDL, annotations, and custom scanners. Supports filtering by check
292
+ type and test coverage reporting.
293
+ usage:
294
+ - speckeeper check
295
+ - speckeeper check external-ssot --verbose
296
+ - speckeeper check test --coverage
297
+ - speckeeper check openapi --strict
298
+
299
+ arguments:
300
+ - name: type
301
+ index: 0
302
+ required: false
303
+ description: >-
304
+ Type of check to run. Filters sources by type. When omitted,
305
+ checks all configured sources.
306
+ schema:
307
+ type: string
308
+ enum: [external-ssot, openapi, ddl, iac, custom, all, test]
309
+
310
+ options:
311
+ - name: config
312
+ aliases: [c]
313
+ description: Path to config file.
314
+ valueName: path
315
+ schema:
316
+ type: string
317
+ file:
318
+ mode: read
319
+ exists: true
320
+ encoding: utf-8
321
+
322
+ - name: strict
323
+ description: Treat warnings as errors.
324
+ schema:
325
+ type: boolean
326
+ default: false
327
+
328
+ - name: verbose
329
+ aliases: [v]
330
+ description: Show detailed output (e.g. list unmatched specs).
331
+ schema:
332
+ type: boolean
333
+ default: false
334
+
335
+ - name: coverage
336
+ description: Check if all testable acceptance criteria are covered by TestRefs.
337
+ schema:
338
+ type: boolean
339
+ default: false
340
+
341
+ exits:
342
+ '0':
343
+ description: All checks passed (all specs found in sources, deep validation passed).
344
+ stdout:
345
+ format: text
346
+
347
+ '1':
348
+ description: Check failures found (missing specs, structural mismatches, or coverage gaps).
349
+ stderr:
350
+ format: text
351
+
352
+ x-agent:
353
+ riskLevel: low
354
+ requiresConfirmation: false
355
+ idempotent: true
356
+ sideEffects: []
357
+
358
+ # ── new ───────────────────────────────────────────
359
+ new:
360
+ summary: Create a new element with auto-generated ID.
361
+ description: >-
362
+ Generates a new design element file with a unique auto-generated ID
363
+ based on the model's ID prefix and existing elements. Supports all
364
+ built-in model types and uses templates for file generation.
365
+ usage:
366
+ - speckeeper new requirement --name "User Authentication"
367
+ - speckeeper new entity --kind functional
368
+ - speckeeper new usecase --template custom-template.ts
369
+
370
+ arguments:
371
+ - name: type
372
+ index: 0
373
+ required: true
374
+ description: >-
375
+ Element type to create: requirement, usecase, entity, component,
376
+ screen, flow, error-case, term.
377
+ schema:
378
+ type: string
379
+ enum: [requirement, usecase, entity, component, screen, flow, error-case, term]
380
+
381
+ options:
382
+ - name: kind
383
+ aliases: [k]
384
+ description: Sub-kind (e.g. functional, non-functional for requirements).
385
+ valueName: kind
386
+ schema:
387
+ type: string
388
+
389
+ - name: name
390
+ aliases: [n]
391
+ description: Name of the element.
392
+ valueName: name
393
+ schema:
394
+ type: string
395
+
396
+ - name: output
397
+ aliases: [o]
398
+ description: Output directory path.
399
+ valueName: path
400
+ schema:
401
+ type: string
402
+
403
+ - name: template
404
+ aliases: [t]
405
+ description: Path to template file.
406
+ valueName: path
407
+ schema:
408
+ type: string
409
+ file:
410
+ mode: read
411
+ exists: true
412
+ encoding: utf-8
413
+
414
+ exits:
415
+ '0':
416
+ description: Element file created with auto-generated ID.
417
+ stdout:
418
+ format: text
419
+
420
+ '1':
421
+ description: Creation failed (invalid type, template error, or write error).
422
+ stderr:
423
+ format: text
424
+
425
+ x-agent:
426
+ riskLevel: low
427
+ requiresConfirmation: false
428
+ idempotent: false
429
+ sideEffects:
430
+ - file_write
431
+
432
+ # ── impact ────────────────────────────────────────
433
+ impact:
434
+ summary: Analyze impact of changes to an ID.
435
+ description: >-
436
+ Performs change impact analysis by traversing the relation graph
437
+ starting from the specified spec ID. Shows upstream (dependants)
438
+ and/or downstream (dependencies) elements up to the configured
439
+ depth. Supports text, JSON, and Mermaid diagram output.
440
+ usage:
441
+ - speckeeper impact FR-001
442
+ - speckeeper impact ENT-ORDER --direction upstream --depth 5
443
+ - speckeeper impact COMP-AUTH --format mermaid
444
+
445
+ arguments:
446
+ - name: id
447
+ index: 0
448
+ required: true
449
+ description: "Spec ID to analyze (e.g. REQ-001, ENT-ORDER, COMP-AUTH)."
450
+ schema:
451
+ type: string
452
+
453
+ options:
454
+ - name: config
455
+ aliases: [c]
456
+ description: Path to config file.
457
+ valueName: path
458
+ schema:
459
+ type: string
460
+ file:
461
+ mode: read
462
+ exists: true
463
+ encoding: utf-8
464
+
465
+ - name: depth
466
+ aliases: [d]
467
+ description: Analysis depth (reference tracking level).
468
+ valueName: depth
469
+ schema:
470
+ type: string
471
+ default: "3"
472
+
473
+ - name: direction
474
+ description: "Analysis direction: upstream, downstream, both."
475
+ valueName: direction
476
+ schema:
477
+ type: string
478
+ default: both
479
+ enum: [upstream, downstream, both]
480
+
481
+ - name: format
482
+ aliases: [f]
483
+ description: "Output format: text, json, mermaid."
484
+ valueName: format
485
+ schema:
486
+ type: string
487
+ default: text
488
+ enum: [text, json, mermaid]
489
+
490
+ exits:
491
+ '0':
492
+ description: Impact analysis completed and displayed.
493
+ stdout:
494
+ format: text
495
+
496
+ '1':
497
+ description: Analysis failed (ID not found or config error).
498
+ stderr:
499
+ format: text
500
+
501
+ x-agent:
502
+ riskLevel: low
503
+ requiresConfirmation: false
504
+ idempotent: true
505
+ sideEffects: []
506
+
507
+ # ── scaffold ──────────────────────────────────────
508
+ scaffold:
509
+ summary: Generate _models/ from a Mermaid flowchart definition.
510
+ description: >-
511
+ Parses a Mermaid flowchart from a Markdown file and generates
512
+ TypeScript model classes, spec data files, and an index file in
513
+ the design directory. Uses class-based artifact resolution to
514
+ determine model types from Mermaid node classes.
515
+ usage:
516
+ - speckeeper scaffold --source requirements.md
517
+ - speckeeper scaffold --source flow.md --output design/ --force
518
+ - speckeeper scaffold --source arch.md --dry-run
519
+
520
+ options:
521
+ - name: source
522
+ aliases: [s]
523
+ description: Path to Markdown file containing Mermaid flowchart.
524
+ valueName: path
525
+ required: true
526
+ schema:
527
+ type: string
528
+ file:
529
+ mode: read
530
+ exists: true
531
+ encoding: utf-8
532
+
533
+ - name: output
534
+ aliases: [o]
535
+ description: Output directory.
536
+ valueName: path
537
+ schema:
538
+ type: string
539
+ default: design/
540
+
541
+ - name: force
542
+ aliases: [f]
543
+ description: Overwrite existing files.
544
+ schema:
545
+ type: boolean
546
+ default: false
547
+
548
+ - name: dry-run
549
+ description: Preview generated files without writing.
550
+ schema:
551
+ type: boolean
552
+ default: false
553
+
554
+ exits:
555
+ '0':
556
+ description: >-
557
+ Model files generated (or previewed with --dry-run) successfully.
558
+ stdout:
559
+ format: text
560
+
561
+ '1':
562
+ description: >-
563
+ Scaffold failed (source file not found, invalid Mermaid syntax,
564
+ or write error).
565
+ stderr:
566
+ format: text
567
+
568
+ x-agent:
569
+ riskLevel: low
570
+ requiresConfirmation: false
571
+ idempotent: false
572
+ sideEffects:
573
+ - file_write
574
+ safeDryRunOption: --dry-run