specky-sdd 3.0.0 → 3.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.
Files changed (151) hide show
  1. package/CHANGELOG.md +94 -1
  2. package/README.md +234 -224
  3. package/SECURITY.md +137 -3
  4. package/dist/config.d.ts +14 -1
  5. package/dist/config.d.ts.map +1 -1
  6. package/dist/config.js +90 -18
  7. package/dist/config.js.map +1 -1
  8. package/dist/constants.d.ts +5 -1
  9. package/dist/constants.d.ts.map +1 -1
  10. package/dist/constants.js +9 -1
  11. package/dist/constants.js.map +1 -1
  12. package/dist/index.js +57 -6
  13. package/dist/index.js.map +1 -1
  14. package/dist/schemas/context.d.ts +9 -0
  15. package/dist/schemas/context.d.ts.map +1 -0
  16. package/dist/schemas/context.js +10 -0
  17. package/dist/schemas/context.js.map +1 -0
  18. package/dist/schemas/metrics.d.ts +9 -0
  19. package/dist/schemas/metrics.d.ts.map +1 -0
  20. package/dist/schemas/metrics.js +10 -0
  21. package/dist/schemas/metrics.js.map +1 -0
  22. package/dist/schemas/routing.d.ts +9 -0
  23. package/dist/schemas/routing.d.ts.map +1 -0
  24. package/dist/schemas/routing.js +21 -0
  25. package/dist/schemas/routing.js.map +1 -0
  26. package/dist/services/audit-logger.d.ts +46 -0
  27. package/dist/services/audit-logger.d.ts.map +1 -0
  28. package/dist/services/audit-logger.js +143 -0
  29. package/dist/services/audit-logger.js.map +1 -0
  30. package/dist/services/cognitive-debt-engine.d.ts +22 -0
  31. package/dist/services/cognitive-debt-engine.d.ts.map +1 -0
  32. package/dist/services/cognitive-debt-engine.js +52 -0
  33. package/dist/services/cognitive-debt-engine.js.map +1 -0
  34. package/dist/services/context-tiering-engine.d.ts +38 -0
  35. package/dist/services/context-tiering-engine.d.ts.map +1 -0
  36. package/dist/services/context-tiering-engine.js +66 -0
  37. package/dist/services/context-tiering-engine.js.map +1 -0
  38. package/dist/services/intent-drift-engine.d.ts +41 -0
  39. package/dist/services/intent-drift-engine.d.ts.map +1 -0
  40. package/dist/services/intent-drift-engine.js +101 -0
  41. package/dist/services/intent-drift-engine.js.map +1 -0
  42. package/dist/services/metrics-generator.d.ts +42 -0
  43. package/dist/services/metrics-generator.d.ts.map +1 -0
  44. package/dist/services/metrics-generator.js +200 -0
  45. package/dist/services/metrics-generator.js.map +1 -0
  46. package/dist/services/model-routing-engine.d.ts +38 -0
  47. package/dist/services/model-routing-engine.d.ts.map +1 -0
  48. package/dist/services/model-routing-engine.js +127 -0
  49. package/dist/services/model-routing-engine.js.map +1 -0
  50. package/dist/services/rate-limiter.d.ts +33 -0
  51. package/dist/services/rate-limiter.d.ts.map +1 -0
  52. package/dist/services/rate-limiter.js +61 -0
  53. package/dist/services/rate-limiter.js.map +1 -0
  54. package/dist/services/rbac-engine.d.ts +29 -0
  55. package/dist/services/rbac-engine.d.ts.map +1 -0
  56. package/dist/services/rbac-engine.js +85 -0
  57. package/dist/services/rbac-engine.js.map +1 -0
  58. package/dist/services/state-machine.d.ts +16 -3
  59. package/dist/services/state-machine.d.ts.map +1 -1
  60. package/dist/services/state-machine.js +69 -7
  61. package/dist/services/state-machine.js.map +1 -1
  62. package/dist/services/template-engine.d.ts +5 -2
  63. package/dist/services/template-engine.d.ts.map +1 -1
  64. package/dist/services/template-engine.js +20 -5
  65. package/dist/services/template-engine.js.map +1 -1
  66. package/dist/services/test-result-parser.d.ts +23 -0
  67. package/dist/services/test-result-parser.d.ts.map +1 -0
  68. package/dist/services/test-result-parser.js +90 -0
  69. package/dist/services/test-result-parser.js.map +1 -0
  70. package/dist/services/test-traceability-mapper.d.ts +37 -0
  71. package/dist/services/test-traceability-mapper.d.ts.map +1 -0
  72. package/dist/services/test-traceability-mapper.js +102 -0
  73. package/dist/services/test-traceability-mapper.js.map +1 -0
  74. package/dist/tools/analysis.d.ts +2 -1
  75. package/dist/tools/analysis.d.ts.map +1 -1
  76. package/dist/tools/analysis.js +25 -1
  77. package/dist/tools/analysis.js.map +1 -1
  78. package/dist/tools/context.d.ts +9 -0
  79. package/dist/tools/context.d.ts.map +1 -0
  80. package/dist/tools/context.js +86 -0
  81. package/dist/tools/context.js.map +1 -0
  82. package/dist/tools/metrics.d.ts +11 -0
  83. package/dist/tools/metrics.d.ts.map +1 -0
  84. package/dist/tools/metrics.js +105 -0
  85. package/dist/tools/metrics.js.map +1 -0
  86. package/dist/tools/pipeline.d.ts.map +1 -1
  87. package/dist/tools/pipeline.js +21 -0
  88. package/dist/tools/pipeline.js.map +1 -1
  89. package/dist/tools/rbac.d.ts +8 -0
  90. package/dist/tools/rbac.d.ts.map +1 -0
  91. package/dist/tools/rbac.js +64 -0
  92. package/dist/tools/rbac.js.map +1 -0
  93. package/dist/tools/response-builder.d.ts.map +1 -1
  94. package/dist/tools/response-builder.js +4 -0
  95. package/dist/tools/response-builder.js.map +1 -1
  96. package/dist/tools/routing.d.ts +7 -0
  97. package/dist/tools/routing.d.ts.map +1 -0
  98. package/dist/tools/routing.js +67 -0
  99. package/dist/tools/routing.js.map +1 -0
  100. package/dist/tools/testing.d.ts +3 -1
  101. package/dist/tools/testing.d.ts.map +1 -1
  102. package/dist/tools/testing.js +47 -3
  103. package/dist/tools/testing.js.map +1 -1
  104. package/dist/tools/utility.d.ts +2 -1
  105. package/dist/tools/utility.d.ts.map +1 -1
  106. package/dist/tools/utility.js +51 -1
  107. package/dist/tools/utility.js.map +1 -1
  108. package/dist/types.d.ts +16 -0
  109. package/dist/types.d.ts.map +1 -1
  110. package/dist/utils/context-helper.d.ts +13 -0
  111. package/dist/utils/context-helper.d.ts.map +1 -0
  112. package/dist/utils/context-helper.js +14 -0
  113. package/dist/utils/context-helper.js.map +1 -0
  114. package/dist/utils/routing-helper.d.ts +16 -0
  115. package/dist/utils/routing-helper.d.ts.map +1 -0
  116. package/dist/utils/routing-helper.js +16 -0
  117. package/dist/utils/routing-helper.js.map +1 -0
  118. package/package.json +5 -7
  119. package/hooks/auto-checkpoint.md +0 -22
  120. package/hooks/auto-docs.md +0 -53
  121. package/hooks/auto-test.md +0 -61
  122. package/hooks/changelog.md +0 -74
  123. package/hooks/security-scan.md +0 -72
  124. package/hooks/spec-sync.md +0 -80
  125. package/hooks/srp-validator.md +0 -86
  126. package/references/design-patterns.md +0 -434
  127. package/references/ears-notation.md +0 -605
  128. package/references/spec-templates.md +0 -936
  129. /package/{templates → dist/templates}/analysis.md +0 -0
  130. /package/{templates → dist/templates}/api-docs.md +0 -0
  131. /package/{templates → dist/templates}/bugfix.md +0 -0
  132. /package/{templates → dist/templates}/checklist.md +0 -0
  133. /package/{templates → dist/templates}/compliance.md +0 -0
  134. /package/{templates → dist/templates}/constitution.md +0 -0
  135. /package/{templates → dist/templates}/cross-analysis.md +0 -0
  136. /package/{templates → dist/templates}/data-model.md +0 -0
  137. /package/{templates → dist/templates}/design.md +0 -0
  138. /package/{templates → dist/templates}/devcontainer.md +0 -0
  139. /package/{templates → dist/templates}/dockerfile.md +0 -0
  140. /package/{templates → dist/templates}/journey.md +0 -0
  141. /package/{templates → dist/templates}/onboarding.md +0 -0
  142. /package/{templates → dist/templates}/research.md +0 -0
  143. /package/{templates → dist/templates}/runbook.md +0 -0
  144. /package/{templates → dist/templates}/specification.md +0 -0
  145. /package/{templates → dist/templates}/sync-report.md +0 -0
  146. /package/{templates → dist/templates}/tasks.md +0 -0
  147. /package/{templates → dist/templates}/terraform.md +0 -0
  148. /package/{templates → dist/templates}/test-stub.md +0 -0
  149. /package/{templates → dist/templates}/user-stories.md +0 -0
  150. /package/{templates → dist/templates}/verification.md +0 -0
  151. /package/{templates → dist/templates}/work-items.md +0 -0
package/CHANGELOG.md CHANGED
@@ -5,6 +5,99 @@ All notable changes to Specky are documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [3.2.0] - 2026-04-12
9
+
10
+ ### Enterprise Security Hardening
11
+
12
+ #### Rate Limiting (opt-in)
13
+ - **`RateLimiter` service**: Token bucket algorithm — no external deps, pure TypeScript
14
+ - HTTP transport now supports `rate_limit.enabled: true` in `.specky/config.yml`
15
+ - Config: `max_requests_per_minute` (default 60), `burst` (default 10)
16
+ - Returns HTTP 429 with `Retry-After` header when limit exceeded
17
+ - stdio mode bypasses rate limiting by design (single-session, process-isolated)
18
+
19
+ #### State File Integrity
20
+ - **`StateMachine.saveState()`** now writes HMAC-SHA256 signature to `.sdd-state.json.sig`
21
+ - **`StateMachine.loadState()`** verifies signature on every load — tamper warning to stderr on mismatch
22
+ - Key: `SDD_STATE_KEY` env var, or derived from workspace path using SHA-256
23
+ - Missing `.sig` treated as unverified (no warning) — backward-compatible with pre-v3.2.0 state files
24
+
25
+ #### Enhanced Audit Logger
26
+ - **Hash-chaining**: every `AuditEntry` includes `previous_hash` (SHA-256 of previous line, seed `specky-audit-v1`)
27
+ - **Log rotation**: rotates `.audit.jsonl` → `.audit.jsonl.1` when `audit.max_file_size_mb` exceeded (default 10 MB)
28
+ - **Syslog export**: RFC 5424 format written to `.audit.syslog` when `audit.export_format: syslog`
29
+ - **OTLP stub**: `audit.export_format: otlp` logs placeholder — implementation in next release
30
+
31
+ #### RBAC Foundation (opt-in)
32
+ - **`RbacEngine` service**: `viewer` / `contributor` / `admin` roles; disabled by default
33
+ - **`sdd_check_access`** (NEW tool #57): Returns active role, per-tool access check, full role summary
34
+ - Role enforcement via `SDD_ROLE` env var or `rbac.default_role` in config
35
+ - Viewer: read-only tools only; Contributor: all except `sdd_create_pr`; Admin: all 57 tools
36
+ - Config: `rbac.enabled: true`, `rbac.default_role: contributor`
37
+
38
+ #### Config Extension
39
+ - `.specky/config.yml` now supports nested blocks: `rate_limit:`, `audit:`, `rbac:`
40
+ - Parser upgraded to handle indented YAML child keys (dot-notation flattening)
41
+ - All new options opt-in with safe defaults — existing behavior unchanged from v3.1.0
42
+
43
+ ### NPM-as-Default Migration
44
+ - Global install (`npm install -g specky-sdd`) is now the recommended installation method
45
+ - npx retained as an "alternative" option for per-workspace and convenience use
46
+ - All docs updated: README.md, GETTING-STARTED.md, SYSTEM-DESIGN.md, ONBOARDING.md, SECURITY.md
47
+ - New "Enterprise Installation Methods" section in GETTING-STARTED.md
48
+ - New "NPX Supply Chain Risk" + "MCP Security Framework Compliance" sections in SECURITY.md
49
+
50
+ ### Security Documentation
51
+ - **CoSAI MCP Security White Paper** — full T-01 through T-12 threat coverage table in SECURITY.md
52
+ - **OWASP MCP Top 10** — M1 through M10 coverage table in SECURITY.md
53
+
54
+ ### Tests
55
+ - 561 tests (+54): `rate-limiter.test.ts` (11), `state-integrity.test.ts` (8), `audit-enhanced.test.ts` (12), `rbac-engine.test.ts` (15), plus existing suite maintained at 100%
56
+
57
+ ---
58
+
59
+ ## [3.1.0] - 2026-04-12
60
+
61
+ ### Intelligence Layer (Specs 003–007)
62
+
63
+ #### Model Routing Guidance (Spec 003)
64
+ - **`sdd_model_routing`** (NEW tool #54): Returns the full 10-phase model routing decision table with optimal model, mode, extended thinking settings, arXiv evidence, and cost savings calculator
65
+ - **`model_routing_hint`** field added to ALL 55 tool responses via `buildToolResponse()` — every response now tells the AI client which model to use for the current phase
66
+ - Complexity override: `implement`/`design` phases with >10 files escalate to Opus automatically
67
+ - `ModelRoutingEngine` service with empirically-grounded ROUTING_TABLE (arXiv:2601.08419)
68
+
69
+ #### Context Tiering (Spec 004)
70
+ - **`sdd_context_status`** (NEW tool #55): Returns Hot/Domain/Cold tier assignment for all spec artifacts with estimated token savings
71
+ - **`context_load_summary`** field added to ALL 55 tool responses — shows which files are loaded per call
72
+ - `ContextTieringEngine` service: CONSTITUTION.md=Hot, SPEC/DESIGN/TASKS=Domain, ANALYSIS/CHECKLIST/etc=Cold
73
+ - Token estimation: `Math.ceil(content.length / 4)` — matches GPT/Claude tokenization heuristic
74
+
75
+ #### Cognitive Debt Metrics (Spec 005)
76
+ - **`cognitive_debt`** field in `sdd_metrics` and `sdd_get_status` responses (when gate history available)
77
+ - Gate instrumentation in `sdd_advance_phase`: records mtime-based modified/unmodified detection per gate
78
+ - `CognitiveDebtEngine` service: LGTM-without-modification rate as cognitive surrender signal; score = `(lgtm_rate × 0.6) + (delta_normalized × 0.4)`, labels: healthy/caution/high_risk
79
+ - Warning shown in `sdd_advance_phase` response when unmodified approval is detected
80
+
81
+ #### Verified Test Loop (Spec 006)
82
+ - **`TestResultParser`** service: auto-detects and parses Vitest JSON, pytest JSON, and JUnit XML into normalized `TestResult[]`
83
+ - **`TestTraceabilityMapper`** service: maps test names to REQ-XXX IDs via `// REQ-XXX` comment convention, builds per-requirement coverage report and failure details with `suggested_fix_prompt`
84
+ - `sdd_verify_tests` enhanced: adds `enhanced_coverage` (per-requirement breakdown) and `failure_details` to response when parsers are wired
85
+ - JUnit XML parser bug fixed: self-closing `<testcase .../>` was greedily consumed by open-tag alternative, merging two testcases; fixed with negative lookbehind `(?<!\/)`
86
+
87
+ #### Intent Drift Detection (Spec 007)
88
+ - **`intent_drift`** report in `sdd_check_sync` and `sdd_metrics` responses
89
+ - **`drift_amendment_suggestion`** in `sdd_amend` response when last drift score > 40 — lists orphaned constitutional principles with recommended spec actions
90
+ - `IntentDriftEngine` service: extracts principles from CONSTITUTION.md `## Article` sections, keyword-overlap coverage detection (≥2 keywords threshold), trend analysis (improving/stable/worsening) over last 3 DriftSnapshots
91
+ - `drift_history` stored in `.sdd-state.json` (FIFO, max 100 entries)
92
+
93
+ ### Stats
94
+ - **56 tools** (was 53, corrected to 56 — sdd_metrics, sdd_validate_ears, sdd_check_ecosystem were already implemented but undercounted): +sdd_model_routing, +sdd_context_status, count reconciled
95
+ - **24 services** (was 18): +ModelRoutingEngine, +ContextTieringEngine, +CognitiveDebtEngine, +IntentDriftEngine, +TestResultParser, +TestTraceabilityMapper
96
+ - **507 unit tests** across 30 test files (was 321 across 22 files)
97
+ - All 7 specs (001–007) at ≥93% acceptance criteria coverage
98
+
99
+ ---
100
+
8
101
  ## [3.0.0] - 2026-03-26
9
102
 
10
103
  ### Pipeline Validation & Enforcement
@@ -105,7 +198,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
105
198
  - `sdd_verify_tests` tool — verifies test results JSON against specification requirements, reports traceability coverage
106
199
  - `.specky/config.yml` support — project-local configuration for templates path, default framework, compliance frameworks, audit toggle
107
200
  - `src/config.ts` — centralized configuration loader with simple YAML parsing
108
- - MCP integration test (`tests/integration/pipeline-e2e.test.ts`) — end-to-end pipeline validation with real FileManager
201
+ - MCP integration test (`tests/integration/pipeline-e2e.test.ts`) — full pipeline validation with real FileManager
109
202
  - Unit tests for 6 additional services: DocGenerator, GitManager, IacGenerator, WorkItemExporter, TranscriptParser, DocumentConverter
110
203
  - OpenSSF Scorecard workflow (`.github/workflows/scorecard.yml`)
111
204
  - SBOM generation (CycloneDX) in CI pipeline