speckeeper 0.1.0 → 0.2.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/README.md +36 -21
- package/dist/cli.js +1806 -299
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +36 -31
- package/dist/index.js +46 -164
- package/dist/index.js.map +1 -1
- package/dist/templates/init/design/requirements.ts +6 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,7 +11,9 @@
|
|
|
11
11
|
Requirements and design documents often drift from implementation. **speckeeper** treats specifications as **code** — type-safe, version-controlled, and continuously validated against your actual artifacts (tests, OpenAPI, DDL, IaC).
|
|
12
12
|
|
|
13
13
|
```
|
|
14
|
-
design
|
|
14
|
+
Mermaid flowchart ──► speckeeper scaffold ──► design/_models/ & _checkers/
|
|
15
|
+
│
|
|
16
|
+
design/*.ts ─────────────────────────────► Validation & Consistency Checks
|
|
15
17
|
│
|
|
16
18
|
├─► speckeeper lint → Design integrity (IDs, references, phase gates)
|
|
17
19
|
├─► speckeeper check → External SSOT validation (test coverage, etc.)
|
|
@@ -24,6 +26,7 @@ design/*.ts ──────► Validation & Consistency Checks
|
|
|
24
26
|
- **Design validation** — Lint rules for ID uniqueness, reference integrity, circular dependencies, and phase gates
|
|
25
27
|
- **External SSOT validation** — Check consistency with test files, and custom checkers for OpenAPI, DDL, etc.
|
|
26
28
|
- **Traceability** — Track relationships across model levels (L0-L3) with impact analysis
|
|
29
|
+
- **Scaffold from Mermaid** — Generate `_models/` and `_checkers/` skeletons from a mermaid flowchart
|
|
27
30
|
- **Custom models** — Extend with domain-specific models (Runbooks, Policies, etc.)
|
|
28
31
|
- **CI-ready** — Built-in lint, drift detection, and coverage checks
|
|
29
32
|
|
|
@@ -38,34 +41,43 @@ npx speckeeper --help
|
|
|
38
41
|
|
|
39
42
|
## Quick Start
|
|
40
43
|
|
|
41
|
-
### 1.
|
|
44
|
+
### 1. Define your metamodel as a Mermaid flowchart
|
|
42
45
|
|
|
43
|
-
|
|
44
|
-
npx speckeeper init
|
|
45
|
-
```
|
|
46
|
+
Create a Markdown file (e.g. `requirements.md`) containing a mermaid flowchart that describes the relationships between your specification entities:
|
|
46
47
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
```mermaid
|
|
49
|
+
flowchart TB
|
|
50
|
+
TERM[Term] <-->|relatedTo| SR[System Requirement]
|
|
51
|
+
SR -->|refines| FR[Functional Requirement]
|
|
52
|
+
SR -->|refines| NFR[Non-Functional Requirement]
|
|
53
|
+
FR -->|refines| UC[Use Case]
|
|
54
|
+
FR -->|includes| AT[Acceptance Test]
|
|
55
|
+
UC -->|implements| API[API Spec]
|
|
56
|
+
AT -->|implements| E2ET[E2E Test]
|
|
51
57
|
|
|
52
|
-
|
|
58
|
+
classDef speckeeper fill:#2563EB,stroke:#1D4ED8,color:#fff,stroke-width:2px
|
|
59
|
+
class TERM,SR,FR,NFR,UC,AT speckeeper
|
|
60
|
+
```
|
|
53
61
|
|
|
54
|
-
|
|
55
|
-
import { defineConfig } from 'speckeeper';
|
|
56
|
-
import { allModels } from './design/_models/index';
|
|
62
|
+
Nodes marked with `class ... speckeeper` become managed models. Edges define lint rules (reference integrity) and checkers (external validation) automatically.
|
|
57
63
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
64
|
+
### 2. Scaffold models and checkers
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
npx speckeeper scaffold --source requirements.md
|
|
62
68
|
```
|
|
63
69
|
|
|
64
|
-
|
|
70
|
+
This generates:
|
|
71
|
+
- `design/_models/` — Model classes with Zod schemas, lint rules, and exporters derived from your flowchart
|
|
72
|
+
- `design/_checkers/` — External checker skeletons for `implements` edges (e.g. OpenAPI, DDL)
|
|
73
|
+
- `design/_models/index.ts` — Re-exports and `allModels` array
|
|
74
|
+
- `speckeeper.config.ts` — Configuration wired to the generated models
|
|
65
75
|
|
|
66
|
-
|
|
76
|
+
See [Scaffold Mermaid Specification](./docs/scaffold-mermaid-spec.md) for the full input format and built-in node mappings.
|
|
67
77
|
|
|
68
|
-
|
|
78
|
+
### 3. Fill in your specifications
|
|
79
|
+
|
|
80
|
+
Edit files in `design/` to add your actual specification data:
|
|
69
81
|
|
|
70
82
|
```typescript
|
|
71
83
|
// design/requirements.ts
|
|
@@ -86,7 +98,7 @@ export const requirements: Requirement[] = [
|
|
|
86
98
|
];
|
|
87
99
|
```
|
|
88
100
|
|
|
89
|
-
###
|
|
101
|
+
### 4. Run validation
|
|
90
102
|
|
|
91
103
|
```bash
|
|
92
104
|
# Validate design integrity
|
|
@@ -99,6 +111,8 @@ npx speckeeper check test --coverage
|
|
|
99
111
|
npx speckeeper impact FR-001
|
|
100
112
|
```
|
|
101
113
|
|
|
114
|
+
> **Alternative**: `npx speckeeper init` creates a minimal project with generic starter templates. Use this if you prefer to build models from scratch. See [Model Definition Guide](./docs/model-guide.md) for details.
|
|
115
|
+
|
|
102
116
|
## CLI Commands
|
|
103
117
|
|
|
104
118
|
| Command | Description |
|
|
@@ -107,6 +121,7 @@ npx speckeeper impact FR-001
|
|
|
107
121
|
| `speckeeper lint` | Validate design integrity (ID uniqueness, references, phase gates) |
|
|
108
122
|
| `speckeeper check` | Verify consistency with external SSOT |
|
|
109
123
|
| `speckeeper check test --coverage` | Verify test coverage for requirements |
|
|
124
|
+
| `speckeeper scaffold` | Generate model/checker skeletons from a mermaid flowchart |
|
|
110
125
|
| `speckeeper drift` | Detect manual edits to generated `specs/` files |
|
|
111
126
|
| `speckeeper impact <id>` | Analyze change impact for a specific element |
|
|
112
127
|
|