speckeeper 0.9.3 → 0.10.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 CHANGED
@@ -36,6 +36,7 @@ design/*.ts
36
36
  - **Traceability** — Track relationships across model levels (L0-L3) with impact analysis
37
37
  - **Scaffold from Mermaid** — Generate `_models/` skeletons from a mermaid flowchart with class-based artifact resolution
38
38
  - **Custom models** — Extend with domain-specific models (Runbooks, Policies, etc.)
39
+ - **Agent-native** — Domain-specific semantic reasoning is encapsulated inside the toolchain itself. Higher-level agents do not need to know every design quality heuristic — they invoke speckeeper and consume structured findings
39
40
  - **CI-ready** — Built-in lint, drift detection, and coverage checks
40
41
 
41
42
  ## Installation
@@ -145,6 +146,10 @@ npx speckeeper check test --coverage
145
146
 
146
147
  # Analyze change impact
147
148
  npx speckeeper impact FR-001
149
+
150
+ # LLM-powered quality audit (optional — requires agent-contracts-runtime + API key)
151
+ npm install --save-dev agent-contracts-runtime
152
+ npx speckeeper audit-requirements --adapter openai
148
153
  ```
149
154
 
150
155
  > **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.
@@ -153,17 +158,46 @@ npx speckeeper impact FR-001
153
158
 
154
159
  > **Full CLI reference:** [docs/cli-reference.md](./docs/cli-reference.md) | **Machine-readable contract:** [cli-contract.yaml](./cli-contract.yaml)
155
160
 
161
+ ### Deterministic Commands
162
+
156
163
  | Command | Description |
157
164
  |---------|-------------|
158
165
  | `speckeeper init` | Initialize a new project with starter templates |
166
+ | `speckeeper build` | Generate `docs/` and `specs/` from TypeScript models |
159
167
  | `speckeeper lint` | Validate design integrity (ID uniqueness, references, phase gates) |
160
168
  | `speckeeper check` | Verify consistency with external SSOT |
161
169
  | `speckeeper check test --coverage` | Verify test coverage for requirements |
162
- | `speckeeper scaffold` | Generate model skeletons from a mermaid flowchart |
163
170
  | `speckeeper drift` | Detect manual edits to generated `docs/` files |
164
171
  | `speckeeper impact <id>` | Analyze change impact for a specific element |
172
+ | `speckeeper new <type>` | Create a new element with auto-generated ID |
173
+ | `speckeeper scaffold` | Generate `_models/` from a Mermaid flowchart |
174
+
175
+ ### LLM-Powered Commands
176
+
177
+ | Command | Description |
178
+ |---------|-------------|
179
+ | `speckeeper audit-requirements` | Semantic requirement quality audit via LLM |
180
+ | `speckeeper propose-trace-links` | Propose candidate traceability links with confidence scores |
181
+ | `speckeeper explain-impact` | Explain impact analysis output in human-readable form (accepts JSON from `impact` via stdin) |
182
+ | `speckeeper propose-acceptance-criteria` | Propose testable acceptance criteria in Given/When/Then format |
183
+
184
+ LLM-powered commands are read-only by default. `audit-requirements` and `explain-impact` do not modify files or state. `propose-*` commands produce proposals; generated output should be reviewed before use. LLM commands do not replace deterministic gates — they are an additional semantic review layer on top of `lint`, `check`, and `impact`.
185
+
186
+ All LLM commands require `agent-contracts-runtime` (optional peer dependency) and an adapter key, and support `--dry-run` to inspect the prompt without calling the LLM.
187
+
188
+ ```bash
189
+ # Audit requirement quality
190
+ npx speckeeper audit-requirements --adapter openai
191
+
192
+ # Propose traceability links
193
+ npx speckeeper propose-trace-links --adapter cursor
165
194
 
166
- **Note**: `speckeeper build` generates machine-readable `specs/` output. For human-readable docs (`docs/`), use [embedoc](https://www.npmjs.com/package/embedoc) or similar tools with the model rendering API.
195
+ # Explain impact analysis for a PR comment
196
+ npx speckeeper impact FR-001 --format json | npx speckeeper explain-impact --adapter openai
197
+
198
+ # Inspect the prompt without calling the LLM
199
+ npx speckeeper audit-requirements --dry-run
200
+ ```
167
201
 
168
202
  ## Validation Features
169
203
 
@@ -466,11 +500,97 @@ class RunbookModel extends Model<typeof RunbookSchema> {
466
500
 
467
501
  Core DSL factories (`speckeeper/dsl`) include `requireField`, `arrayMinLength`, `idFormat`, `childIdFormat`, `markdownExporter`, `annotationCoverage`, `relationCoverage`, and `baseSpecSchema`. Global scanner utilities (`openapiScanner`, `ddlScanner`, `annotationScanner`, `createAnnotationScanner`) are also re-exported for advanced use.
468
502
 
503
+ ## CI Integration
504
+
505
+ ```yaml
506
+ name: Design Validation
507
+ on:
508
+ pull_request:
509
+ paths: ['design/**', 'speckeeper.config.ts']
510
+
511
+ jobs:
512
+ validate:
513
+ runs-on: ubuntu-latest
514
+ steps:
515
+ - uses: actions/checkout@v4
516
+ - uses: actions/setup-node@v4
517
+ with:
518
+ node-version: '20'
519
+ - run: npm ci
520
+ - run: npx speckeeper lint --strict
521
+ - run: npx speckeeper check
522
+ - run: npx speckeeper drift --fail-on-drift
523
+ # Optional: LLM semantic audit (requires API key)
524
+ # - run: npx speckeeper audit-requirements --adapter openai --report-format json --fail-on error
525
+ # env:
526
+ # OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
527
+ ```
528
+
529
+ ## Agent-Native Toolchain
530
+
531
+ speckeeper is designed for development workflows where AI agents are first-class participants in design review, traceability analysis, and quality assurance. It encapsulates domain-specific semantic reasoning inside the toolchain itself, returning structured results that humans, CI systems, and AI agents consume in the same way.
532
+
533
+ ### Deterministic checks first
534
+
535
+ Anything that can be validated mechanically is validated deterministically: ID uniqueness, reference integrity, circular dependency detection, phase gate enforcement, external SSOT conformance, drift detection, and impact analysis via relation graph traversal.
536
+
537
+ ### Semantic audit inside the toolchain
538
+
539
+ Domain-specific reasoning that is difficult to express as static rules is handled by LLM-based commands:
540
+
541
+ - **`audit-requirements`** — Requirement verifiability, ambiguity, granularity, terminology consistency, and design-mixing detection
542
+ - **`propose-trace-links`** — Identify candidate traceability links between specs and implementation artifacts with confidence scores and rationale
543
+ - **`explain-impact`** — Translate machine-readable impact analysis output into human-readable explanations for PM and executive stakeholders
544
+ - **`propose-acceptance-criteria`** — Generate testable acceptance criteria in Given/When/Then or verification format
545
+
546
+ ### Structured findings
547
+
548
+ LLM output is not free-form text. Results conform to typed schemas such as `RequirementAuditResult`, `TraceLinkResult`, `ImpactExplainResult`, and `AcceptanceCriteriaResult`. Audit-style results are compatible with the common `AgentAuditResult` / `AgentFinding` shape so that higher-level workflow agents can aggregate findings across toolchains.
549
+
550
+ ### Tool-owned domain knowledge
551
+
552
+ speckeeper owns the rules and reasoning for design specification quality. Instead of embedding design review heuristics into a top-level agent prompt, domain expertise is encapsulated inside the tool. Higher-level agents only need to invoke the command and interpret the structured output.
553
+
554
+ ### Agent-readable interface
555
+
556
+ Tool capabilities are described in machine-readable form via [cli-contract.yaml](cli-contract.yaml): artifacts read/written, side effects, risk levels, confirmation requirements, and output schemas.
557
+
558
+ ### LLM Adapter Configuration
559
+
560
+ | Adapter | Default Model | Environment Variable |
561
+ |---------|---------------|---------------------|
562
+ | `cursor` | runtime default | `CURSOR_API_KEY` |
563
+ | `openai` | runtime default | `OPENAI_API_KEY` |
564
+ | `gemini` | runtime default | `GEMINI_API_KEY` |
565
+ | `claude` | runtime default | `ANTHROPIC_API_KEY` |
566
+ | `mock` | — | — |
567
+
568
+ Default models are defined by `agent-contracts-runtime` and may change between releases. Use `--model` to pin a specific model.
569
+
570
+ ```bash
571
+ # Install the runtime dependency to enable LLM features
572
+ npm install agent-contracts-runtime
573
+ ```
574
+
575
+ ## Technology Stack
576
+
577
+ | Component | Technology |
578
+ |-----------|-----------|
579
+ | Language | TypeScript (Node.js) |
580
+ | Schema validation | [Zod](https://github.com/colinhacks/zod) |
581
+ | LLM integration | [agent-contracts-runtime](https://www.npmjs.com/package/agent-contracts-runtime) (optional peer dep) |
582
+ | Agent DSL | [agent-contracts](https://www.npmjs.com/package/agent-contracts) — agent/task/workflow definitions |
583
+ | CLI contract | [cli-contracts](https://www.npmjs.com/package/cli-contracts) — machine-readable interface spec |
584
+ | Package manager | npm |
585
+
469
586
  ## Documentation
470
587
 
471
588
  - **[Model Definition Guide](./docs/model-guide.md)** — Start here for model customization and API reference
472
589
  - [Framework Requirements Specification](./docs/framework_requirements_spec.md) — Detailed feature specifications
473
590
  - [Model Entity Catalog](./docs/model_entity_catalog.md) — Model hierarchy and relation types
591
+ - [docs/cli-reference.md](./docs/cli-reference.md) — Generated CLI reference (commands, options, exit codes, AI agent policies)
592
+ - [cli-contract.yaml](./cli-contract.yaml) — Machine-readable CLI contract ([CLI Contracts](https://www.npmjs.com/package/cli-contracts) format)
593
+ - [dsl/](./dsl/) — Agent DSL definitions (agent, tasks, workflows, handoff types, guardrails)
474
594
 
475
595
  ## Compatibility
476
596