@rsaglobaltech/specgate 0.8.1 → 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.
Files changed (144) hide show
  1. package/CHANGELOG.md +196 -0
  2. package/README.md +17 -25
  3. package/bin/specgate.ts +23 -5
  4. package/dist/bin/specgate.js +19 -4
  5. package/dist/bin/specgate.js.map +1 -1
  6. package/dist/packages/core/src/application/GenerateAgentPromptUseCase.js +56 -0
  7. package/dist/packages/core/src/application/GenerateAgentPromptUseCase.js.map +1 -1
  8. package/dist/packages/core/src/application/ValidateProjectUseCase.js +54 -0
  9. package/dist/packages/core/src/application/ValidateProjectUseCase.js.map +1 -1
  10. package/dist/packages/core/src/domain/AdversarialProbe.js +75 -0
  11. package/dist/packages/core/src/domain/AdversarialProbe.js.map +1 -0
  12. package/dist/packages/core/src/domain/AgentPrompt.js +52 -3
  13. package/dist/packages/core/src/domain/AgentPrompt.js.map +1 -1
  14. package/dist/packages/core/src/domain/DeclaredArtifacts.js +25 -0
  15. package/dist/packages/core/src/domain/DeclaredArtifacts.js.map +1 -1
  16. package/dist/packages/core/src/domain/DoneVerification.js +89 -0
  17. package/dist/packages/core/src/domain/DoneVerification.js.map +1 -0
  18. package/dist/packages/core/src/domain/GateCommandIntegrity.js +139 -0
  19. package/dist/packages/core/src/domain/GateCommandIntegrity.js.map +1 -0
  20. package/dist/packages/core/src/domain/GherkinQuality.js +19 -3
  21. package/dist/packages/core/src/domain/GherkinQuality.js.map +1 -1
  22. package/dist/packages/core/src/domain/HarnessConfig.js +6 -0
  23. package/dist/packages/core/src/domain/HarnessConfig.js.map +1 -1
  24. package/dist/packages/core/src/domain/MultiStack.js +96 -0
  25. package/dist/packages/core/src/domain/MultiStack.js.map +1 -0
  26. package/dist/packages/core/src/domain/NewRequirement.js +46 -0
  27. package/dist/packages/core/src/domain/NewRequirement.js.map +1 -0
  28. package/dist/packages/core/src/domain/Precedents.js +96 -0
  29. package/dist/packages/core/src/domain/Precedents.js.map +1 -0
  30. package/dist/packages/core/src/domain/RequirementPlan.js +1 -0
  31. package/dist/packages/core/src/domain/RequirementPlan.js.map +1 -1
  32. package/dist/packages/core/src/domain/RequirementRemoval.js +161 -0
  33. package/dist/packages/core/src/domain/RequirementRemoval.js.map +1 -0
  34. package/dist/packages/core/src/domain/ScenarioCoverage.js +178 -0
  35. package/dist/packages/core/src/domain/ScenarioCoverage.js.map +1 -0
  36. package/dist/packages/core/src/domain/SpecSections.js +206 -0
  37. package/dist/packages/core/src/domain/SpecSections.js.map +1 -0
  38. package/dist/packages/core/src/domain/TestCommand.js +82 -0
  39. package/dist/packages/core/src/domain/TestCommand.js.map +1 -0
  40. package/dist/packages/core/src/domain/TraceabilityFormat.js +45 -2
  41. package/dist/packages/core/src/domain/TraceabilityFormat.js.map +1 -1
  42. package/dist/packages/core/src/infrastructure/HarnessConfigFile.js +31 -0
  43. package/dist/packages/core/src/infrastructure/HarnessConfigFile.js.map +1 -1
  44. package/dist/packages/core/test/unit/adversarial-probe.test.js +81 -0
  45. package/dist/packages/core/test/unit/adversarial-probe.test.js.map +1 -0
  46. package/dist/packages/core/test/unit/done-verification.test.js +84 -0
  47. package/dist/packages/core/test/unit/done-verification.test.js.map +1 -0
  48. package/dist/packages/core/test/unit/gate-command-integrity.test.js +114 -0
  49. package/dist/packages/core/test/unit/gate-command-integrity.test.js.map +1 -0
  50. package/dist/packages/core/test/unit/gherkin-quality.test.js +28 -0
  51. package/dist/packages/core/test/unit/gherkin-quality.test.js.map +1 -1
  52. package/dist/packages/core/test/unit/multi-stack.test.js +86 -0
  53. package/dist/packages/core/test/unit/multi-stack.test.js.map +1 -0
  54. package/dist/packages/core/test/unit/new-requirement.test.js +67 -0
  55. package/dist/packages/core/test/unit/new-requirement.test.js.map +1 -0
  56. package/dist/packages/core/test/unit/precedents.test.js +99 -0
  57. package/dist/packages/core/test/unit/precedents.test.js.map +1 -0
  58. package/dist/packages/core/test/unit/requirement-removal.test.js +124 -0
  59. package/dist/packages/core/test/unit/requirement-removal.test.js.map +1 -0
  60. package/dist/packages/core/test/unit/scenario-coverage.test.js +146 -0
  61. package/dist/packages/core/test/unit/scenario-coverage.test.js.map +1 -0
  62. package/dist/packages/core/test/unit/spec-sections.test.js +146 -0
  63. package/dist/packages/core/test/unit/spec-sections.test.js.map +1 -0
  64. package/dist/packages/core/test/unit/test-command.test.js +81 -0
  65. package/dist/packages/core/test/unit/test-command.test.js.map +1 -0
  66. package/dist/packages/core/test/unit/validate-project.test.js +21 -0
  67. package/dist/packages/core/test/unit/validate-project.test.js.map +1 -1
  68. package/dist/scripts/agents/commands.js +1 -1
  69. package/dist/scripts/agents/commands.js.map +1 -1
  70. package/dist/scripts/agents/init.js +59 -15
  71. package/dist/scripts/agents/init.js.map +1 -1
  72. package/dist/scripts/change/instructions.js +2 -2
  73. package/dist/scripts/change/instructions.js.map +1 -1
  74. package/dist/scripts/check.js +10 -0
  75. package/dist/scripts/check.js.map +1 -0
  76. package/dist/scripts/cli/commands/change/ChangeCommand.js +2 -2
  77. package/dist/scripts/cli/commands/change/ChangeCommand.js.map +1 -1
  78. package/dist/scripts/cli/commands/config/CiInitCommand.js +1 -1
  79. package/dist/scripts/cli/commands/config/CiInitCommand.js.map +1 -1
  80. package/dist/scripts/cli/commands/harness/RunCommand.js +214 -9
  81. package/dist/scripts/cli/commands/harness/RunCommand.js.map +1 -1
  82. package/dist/scripts/cli/commands/pack/InferPackCommand.js +331 -31
  83. package/dist/scripts/cli/commands/pack/InferPackCommand.js.map +1 -1
  84. package/dist/scripts/cli/commands/project/AdoptCommand.js +86 -9
  85. package/dist/scripts/cli/commands/project/AdoptCommand.js.map +1 -1
  86. package/dist/scripts/cli/commands/project/InitProjectCommand.js +286 -45
  87. package/dist/scripts/cli/commands/project/InitProjectCommand.js.map +1 -1
  88. package/dist/scripts/cli/commands/project/UpdateCommand.js +118 -8
  89. package/dist/scripts/cli/commands/project/UpdateCommand.js.map +1 -1
  90. package/dist/scripts/cli/commands/quality/CheckCommand.js +184 -0
  91. package/dist/scripts/cli/commands/quality/CheckCommand.js.map +1 -0
  92. package/dist/scripts/cli/commands/quality/DoctorCommand.js +20 -2
  93. package/dist/scripts/cli/commands/quality/DoctorCommand.js.map +1 -1
  94. package/dist/scripts/cli/commands/quality/FixCommand.js +1 -1
  95. package/dist/scripts/cli/commands/quality/FixCommand.js.map +1 -1
  96. package/dist/scripts/cli/commands/quality/ReportCommand.js +1 -1
  97. package/dist/scripts/cli/commands/quality/ReportCommand.js.map +1 -1
  98. package/dist/scripts/cli/commands/quality/ValidateSpecsCommand.js +406 -24
  99. package/dist/scripts/cli/commands/quality/ValidateSpecsCommand.js.map +1 -1
  100. package/dist/scripts/cli/commands/spec/DoneCommand.js +108 -0
  101. package/dist/scripts/cli/commands/spec/DoneCommand.js.map +1 -1
  102. package/dist/scripts/cli/commands/spec/NewCommand.js +178 -0
  103. package/dist/scripts/cli/commands/spec/NewCommand.js.map +1 -0
  104. package/dist/scripts/cli/commands/spec/PlanCommand.js +8 -2
  105. package/dist/scripts/cli/commands/spec/PlanCommand.js.map +1 -1
  106. package/dist/scripts/cli/commands/spec/ReqCommand.js +124 -4
  107. package/dist/scripts/cli/commands/spec/ReqCommand.js.map +1 -1
  108. package/dist/scripts/cli/commands/spec/StatusCommand.js +84 -32
  109. package/dist/scripts/cli/commands/spec/StatusCommand.js.map +1 -1
  110. package/dist/scripts/docs/build-site.js +145 -35
  111. package/dist/scripts/docs/build-site.js.map +1 -1
  112. package/dist/scripts/docs/components.js +208 -0
  113. package/dist/scripts/docs/components.js.map +1 -0
  114. package/dist/scripts/docs/highlight.js +180 -0
  115. package/dist/scripts/docs/highlight.js.map +1 -0
  116. package/dist/scripts/docs/icons.js +63 -0
  117. package/dist/scripts/docs/icons.js.map +1 -0
  118. package/dist/scripts/docs/nav.js +9 -3
  119. package/dist/scripts/docs/nav.js.map +1 -1
  120. package/dist/scripts/gen_mcp_tools.js +22 -2
  121. package/dist/scripts/gen_mcp_tools.js.map +1 -1
  122. package/dist/scripts/harness/init.js +101 -40
  123. package/dist/scripts/harness/init.js.map +1 -1
  124. package/dist/scripts/harness/worktree-lock.js +161 -0
  125. package/dist/scripts/harness/worktree-lock.js.map +1 -0
  126. package/dist/scripts/infer_pack.js +4 -1
  127. package/dist/scripts/infer_pack.js.map +1 -1
  128. package/dist/scripts/lib/surface.js +88 -38
  129. package/dist/scripts/lib/surface.js.map +1 -1
  130. package/dist/scripts/new.js +10 -0
  131. package/dist/scripts/new.js.map +1 -0
  132. package/dist/scripts/plugin/gate-hook.js +2 -2
  133. package/dist/scripts/plugin/gate-hook.js.map +1 -1
  134. package/package.json +5 -2
  135. package/templates/adopt/AI_RULES.md.tpl +1 -1
  136. package/templates/adopt/spec.md.tpl +4 -4
  137. package/templates/base/spec.md.tpl +12 -0
  138. package/templates/ci/azure.yml.tpl +2 -2
  139. package/templates/ci/github.yml.tpl +2 -2
  140. package/templates/ci/gitlab.yml.tpl +1 -1
  141. package/templates/ci/jenkins.tpl +1 -1
  142. package/templates/contracts/test-strategy.md.tpl +2 -2
  143. package/templates/harness/harness.config.yaml.tpl +3 -3
  144. package/templates/harness/prompt-prefix.md.tpl +2 -5
package/CHANGELOG.md CHANGED
@@ -6,6 +6,202 @@ and [Semantic Versioning](https://semver.org/).
6
6
 
7
7
  The release process is in [`docs/release-process.md`](docs/release-process.md).
8
8
 
9
+ ## [Unreleased]
10
+
11
+ ## [0.10.0] — 2026-10-06
12
+
13
+ **Five verbs.** A team said the tool was hard to absorb; this release is the
14
+ answer's first half. The short help is now the whole daily loop — `init`,
15
+ `status`, `new`, `check`, `done`, plus `req` until the matrix is generated —
16
+ and each verb does what used to take several commands. Nothing was removed:
17
+ every older command still works and is in `--help --all`.
18
+
19
+ Agent files generated by earlier versions are named `csda`; run
20
+ `specgate update` once to move them to `specgate`, keeping your edits.
21
+
22
+ ### Added
23
+
24
+ - **`specgate check` — the gate under one name.** `validate --strict`, then the
25
+ project's tests (`--test-cmd`, or `test_cmd:` in `harness.config.yaml`). It
26
+ replaces `validate` in the daily help. Without a test command it passes and
27
+ says it checked the specification, not the code. First verb of phase 1 of
28
+ the team-simplification plan.
29
+
30
+ - **`specgate new "<title>"` — a requirement in one step.** A draft
31
+ `## REQ-NNN` in `spec.md`, a scenario tagged `@REQ-NNN @SCN-NNN` under
32
+ `features/` with `<placeholder>` steps, and the matrix row linked to it —
33
+ what used to take `req add`, two hand edits and `req link`.
34
+ - **`scenario_placeholder_step`.** An unfilled `<placeholder>` in a plain
35
+ Scenario is an error under `--strict-scenarios`. Measured first: a scenario
36
+ of three template steps passed `validate --strict` and `done --strict` with
37
+ its requirement Implemented.
38
+
39
+ ### Changed
40
+
41
+ - **The short help is the daily loop.** `specgate --help` lists `init`, then
42
+ `status`, `new`, `req`, `check` and `done` — nothing else. `change`, `plan`,
43
+ `validate`, `adopt` and `onboard` keep working and are in `--help --all`. A
44
+ test fails if a line is added, so growing it is a decision.
45
+ - **One name in the agent too: `/specgate:*`.** The generated slash commands
46
+ were `/csda:*`, the tool's old name, so a team typed `specgate` in the
47
+ terminal and `/csda:apply` in their agent. Every generated file moves:
48
+ `.claude/commands/specgate/`, `.cursor/rules/specgate.mdc`,
49
+ `.windsurf/rules/specgate.md`, `.clinerules/specgate.md`,
50
+ `.agents/rules/specgate.md`, and the Claude plugin is named `specgate`.
51
+ **Upgrading:** `specgate update` moves each `csda` file — and its baseline —
52
+ to the new path before merging, so edits survive. Files from `agents init`
53
+ before this release have no baseline; `update` reconstructs one from the
54
+ old name, and where that guess is wrong the merge reports a conflict rather
55
+ than choosing. When both names exist it touches neither (`rename_conflict`).
56
+ The `csda:` annotations in spec files keep their name (ADR-0024).
57
+ - **The committed Claude plugin is regenerated.** `packages/claude-plugin` had
58
+ not been rebuilt since 0.6.0: its gate hook still ran
59
+ `npx csda validate --strict-tdd`.
60
+ - **`specgate init` is the one way in.** In a repository that already has code
61
+ it adopts it in place — the same as `adopt`, touching no code — instead of
62
+ scaffolding a second project inside the first; running it again says the
63
+ repository is already spec-driven and exits 0. `--new` forces a scaffold, and
64
+ `--yes`, `--config`, `--out` and `--multi-stack` keep scaffolding, so no
65
+ script that calls `init` changes behaviour. `adopt` and `onboard` leave the
66
+ short help and keep working. `adopt`'s next steps now teach `check`, `new`,
67
+ `status` and `ci init`.
68
+ - **`status` lists the queue itself.** One line per requirement — its title and
69
+ what it still needs — split into *Ready to close* and *To do*, capped at 12
70
+ per group. `Next` names a requirement (`specgate done REQ-003 --strict`)
71
+ instead of answering `specgate plan`. `--json` gains a `requirements` array.
72
+ `plan` leaves the daily help and keeps the full detail.
73
+ - **`plan` no longer says "code & test exist" over a row with no code.** A
74
+ declared code path is optional; the heading now says *its declared test and
75
+ code exist*.
76
+ - **The scenario rules are owed on delivery, like the files.** A Draft row's
77
+ feature file is not held to `--strict-scenarios`, so a fresh `specgate new`
78
+ does not turn CI red. The three rules that make a suite report a pass it
79
+ never ran — no steps, keyword case, Outline without Examples — apply to
80
+ every row.
81
+ - **`done --strict` is the whole gate.** It ran a subset without
82
+ `--strict-scenarios`; it now runs `validate --strict`.
83
+ - **`req link --status` is refused instead of silently dropped.** It printed a
84
+ tick and left the row `Draft`. The status changes through `specgate done`,
85
+ which can check the requirement first.
86
+
87
+ - **The harness and the agent `Stop` hook run the same gate as CI.** Both ran
88
+ `validate --strict-tdd` while `ci init` generated `--strict`, so the harness
89
+ could mark a requirement Implemented on a `src/…` file that did not exist and
90
+ leave the next CI run red. They now run `validate --strict`.
91
+
92
+ ### Fixed
93
+
94
+ - **`update` no longer takes the project's `README.md` for the Claude
95
+ plugin's.** Same path, different file: it adopted the project README as the
96
+ opt-in plugin's and wrote it a baseline, so the next run would have merged
97
+ the plugin's README into it. Opt-in tools now count only where installed.
98
+ - **`--strict-links` no longer fails a requirement that has not been delivered.**
99
+ A `Draft` or `In Dev` row names where the work is going to land; with
100
+ `--strict` as the CI gate, every team that declared paths before writing them
101
+ had a red build, and in the harness one pending requirement's paths failed
102
+ its sibling's worktree. Only `Implemented`, `Verified` and `Released` rows owe
103
+ their files now.
104
+ - **`done --check` and `harness run` check the requirement they are closing.**
105
+ They validate before the status flips, so the requirement was still `Draft`
106
+ and the rule above would have skipped it. They now hold it to what a
107
+ delivered row owes.
108
+
109
+ ## [0.9.0] — 2026-10-06
110
+
111
+ ### Added
112
+
113
+ - **`prompt_precedents` shows the agent an accepted requirement from the same
114
+ bounded context.** Everything else in the prompt is normative — facts,
115
+ Gherkin, `AI_RULES.md`, the definition of done — and none of it is an
116
+ example. An agent with no conversation history has never seen what an
117
+ accepted implementation looks like in your repository, so it invents a house
118
+ style and the next attempt is spent correcting it.
119
+
120
+ Three rules keep the section from doing harm: the same bounded context only
121
+ (a precedent from elsewhere teaches conventions that do not apply, with the
122
+ authority of having been accepted), `Verified` rather than `Implemented`
123
+ (one means the code exists, the other means somebody checked it), and an
124
+ earlier requirement only. It says in as many words that it is an example of
125
+ shape and not of behaviour. Nothing qualifying means no section rather than
126
+ an empty one, and a moved artifact never stops a run.
127
+
128
+ Off by default. Closes #106.
129
+
130
+ - **`pack infer` stops making five corrections you had to make by hand.** The
131
+ same operation inferred from two scenarios is proposed once rather than twice
132
+ with two ids; a `When` that reads becomes a query with a `QRY-` id, which the
133
+ pack model already distinguished and inference did not; names drop glue words,
134
+ so "10 more vehicles enter the facility" gives `MoreVehiclesEnterFacility`
135
+ rather than spending its four-word budget on "the"; field names are proposed
136
+ from `<placeholders>` and `key: value` pairs, each with a `TODO` for its type;
137
+ and `--from` repeats and accepts a directory, so a command shared by three
138
+ files is proposed once.
139
+
140
+ `--llm` is *not* here: ADR-0014 defers it, and reopening that needs an ADR
141
+ rather than a flag. Everything above stays a skeleton to review with every
142
+ guess carrying its `TODO` — an inference that stops looking like a guess is
143
+ the failure mode the ADR names. Closes #32.
144
+
145
+ Also fixes a latent bug in the renderer: an empty list rendered as a bare `[]`
146
+ on its own line, which the project's YAML reader rejects. Nothing had an empty
147
+ list to render until queries arrived.
148
+
149
+ - **`adversary_profile` lets a second agent try to break a green
150
+ implementation.** The advisory reviewer that already exists returns prose; an
151
+ adversary returns a test, and a test either fails or it does not. After the
152
+ gate passes and the work is committed, it is asked for one case the
153
+ requirement should handle and might not; the project's tests then run again
154
+ with it in place.
155
+
156
+ A failing probe is a recorded warning and **never** a verdict. An adversary
157
+ can always assert a behaviour nobody specified, so letting it fail the run
158
+ would block correct work and make it a second judge — the gate stays the only
159
+ one. Runs once per requirement, on a green gate only, and its writes are
160
+ discarded so the branch carries the implementer's work alone. Closes #107.
161
+
162
+ - **`harness run --verbose`** streams the gate command's output as it runs,
163
+ on stderr. Without it the output only appeared when the gate failed, so a run
164
+ that takes minutes showed nothing and a hung test looked like a working one.
165
+ Stdout stays reserved for `--format json`. Closes #34.
166
+
167
+ ### Fixed
168
+
169
+ - **Every place that recommends a gate now recommends the gate.** `--strict`
170
+ became the one gate in #174, but `specgate --help --all`, its example,
171
+ `status`, `fix`, `change`, the instructions written for agents, the MCP tool
172
+ description, the README, seven documentation pages and two templates still
173
+ sold `--strict-tdd` — which passes a requirement whose test file is gone.
174
+ The individual `--strict-*` flags keep working.
175
+ - **`req add|link|rm|done --help` answer with the subcommand's own help.** They
176
+ printed the parent usage, whose last line tells you to run exactly that.
177
+ - **The `spec.md` written by `adopt` describes `req add` as it is.** It still
178
+ said `req add` "does not write a section here" after it started writing one.
179
+
180
+ - **`git worktree add` raced itself under `--concurrency`.** Each requirement
181
+ runs in its own process and every one creates a worktree in the same
182
+ repository; git writes `.git/worktrees/<name>/` incrementally, so a sibling
183
+ read an entry that was half there and failed with `failed to read …
184
+ /commondir`. Worse, the failure was *attributed*: the run reported the
185
+ requirement as failed with "the agent produced no files", so a race in the
186
+ harness read as the agent's fault.
187
+
188
+ `git worktree add` is now serialised across processes with a lock directory
189
+ in `.git/`. Only the creation is inside it — the agent and the gate stay
190
+ parallel. Closes #158.
191
+
192
+ - **MCP could edit the specification it was being measured against.** The
193
+ prompt said not to; nothing enforced it. Tools that write a protected path
194
+ are refused unless a change is open, with the list declared once on the
195
+ command surface and the escape hatch written down in `.csda/config.json`
196
+ rather than passed with the call. Closes #138.
197
+
198
+ ### Changed
199
+
200
+ - **Pull requests target `develop`, not `main`.** `main` is the branch releases
201
+ are cut from and the first thing an evaluator sees, so it does not get to be
202
+ red — not even briefly. A green `develop` is fast-forwarded into `main` and
203
+ the release is cut from there. CI runs on pushes to both.
204
+
9
205
  ## [0.8.1] — 2026-09-01
10
206
 
11
207
  ### Changed
package/README.md CHANGED
@@ -5,8 +5,8 @@
5
5
  **Specs as executable contracts — requirements, scenarios and traceability that CI enforces.**
6
6
 
7
7
  [![CI](https://github.com/rsaglobaltech/specgate/actions/workflows/ci.yml/badge.svg)](https://github.com/rsaglobaltech/specgate/actions/workflows/ci.yml)
8
- [![npm latest](https://img.shields.io/npm/v/specgate?logo=npm&label=npm)](https://www.npmjs.com/package/specgate)
9
- [![npm beta](https://img.shields.io/npm/v/specgate/beta?logo=npm&label=beta)](https://www.npmjs.com/package/specgate)
8
+ [![npm](https://img.shields.io/npm/v/%40rsaglobaltech%2Fspecgate?logo=npm&label=npm)](https://www.npmjs.com/package/@rsaglobaltech/specgate)
9
+ [![Docker](https://img.shields.io/badge/ghcr.io-specgate-2496ed?logo=docker&logoColor=white)](https://github.com/rsaglobaltech/specgate/pkgs/container/specgate)
10
10
  [![Docs](https://img.shields.io/badge/docs-github_pages-0e8078)](https://rsaglobaltech.github.io/specgate/)
11
11
  [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](#-license)
12
12
 
@@ -20,28 +20,20 @@
20
20
 
21
21
  ## ⚡ Start
22
22
 
23
- > **Just renamed** ([ADR-0024](docs/specs/adr/0024-the-tool-is-renamed-the-format-is-not.md)): until the
24
- > first release under the new name the registries still hold `create-spec-driven-app` and the `csda` image — both kept as aliases.
25
-
26
- **Existing codebase** — the common enterprise case:
27
-
28
- ```bash
29
- cd your-repo
30
- npx @rsaglobaltech/specgate@latest onboard # reads the repo, proposes its capabilities
31
- npx @rsaglobaltech/specgate@latest adopt # writes the spec skeleton, touches no code
32
- npx @rsaglobaltech/specgate@latest validate .
33
- ```
34
-
35
- **New project:**
23
+ > **The npm package is scoped; the binary is not.** `spec-gate` already claims the
24
+ > unscoped name ([ADR-0024](docs/specs/adr/0024-the-tool-is-renamed-the-format-is-not.md)). You type `specgate`; `csda` still works too.
36
25
 
37
26
  ```bash
38
- npx @rsaglobaltech/specgate@latest init # interactive wizard
27
+ cd your-repo # or an empty directory
28
+ npx @rsaglobaltech/specgate@latest init # adopts code that is there, touching none of it;
29
+ # scaffolds a new project where there is none
30
+ npx @rsaglobaltech/specgate@latest check # the gate
39
31
  ```
40
32
 
41
33
  Requires **Node.js ≥ 22** — or none at all with the Docker image:
42
34
 
43
35
  ```bash
44
- docker run --rm -v "$PWD:/workspace" ghcr.io/rsaglobaltech/specgate validate . --strict-tdd
36
+ docker run --rm -v "$PWD:/workspace" ghcr.io/rsaglobaltech/specgate validate . --strict
45
37
  ```
46
38
 
47
39
  → [Getting started](docs/getting-started.md) · [Quickstart for joiners](docs/quickstart.md)
@@ -52,22 +44,22 @@ Each level is useful on its own and never requires the ones above it.
52
44
 
53
45
  | Level | You get | Commands | Cost |
54
46
  | --- | --- | --- | --- |
55
- | **L1** | Traceable specs in your repo | `onboard`, `adopt` | ~1 hour |
56
- | **L2** | A PR gate enforcing spec and test coverage | `validate --strict-tdd` | ~1 hour |
47
+ | **L1** | Traceable specs in your repo | `init`, `new` | ~1 hour |
48
+ | **L2** | A PR gate enforcing spec and test coverage | `check`, `ci init` | ~1 hour |
57
49
  | **L3** | Versioned, reusable domain requirements | `specops add / sync / diff` | ~1 day |
58
50
  | **L4** | Agent-driven delivery, one requirement at a time | `agents init`, `harness run` | ~1 week |
59
51
 
60
52
  ## 🛠️ What it does
61
53
 
62
- **A daily loop, not a one-shot scaffolder.** `specgate status` says where the
63
- project stands and what to run next; `specgate plan` is the queue; `specgate req` adds
64
- and links requirements so nobody hand-edits the ten-column matrix; `specgate done`
65
- closes them.
54
+ **A daily loop, not a one-shot scaffolder.** `specgate status` lists what is left
55
+ and the next command; `specgate new` adds a requirement with its scenario and row;
56
+ `specgate check` is the gate before a PR; `specgate done` closes a requirement.
57
+ Nobody hand-edits the matrix.
66
58
  → [Quickstart](docs/quickstart.md) · [Command reference](docs/commands.md)
67
59
 
68
60
  **Specs that are checked.** `specgate validate` fails the build when a requirement
69
- has no scenario, no test, or no row in the traceability matrix. `--strict-tdd`
70
- fails it when a requirement moves past Draft without a test.
61
+ has no scenario, no test, or no row in the traceability matrix. `--strict` — the
62
+ gate — also fails one past Draft without a test, or linked to a missing file.
71
63
  → [Writing specs](docs/writing-specs.md) · [Validating](docs/validating.md)
72
64
 
73
65
  **Changes you review as intent.** Modify a spec that already shipped through a
package/bin/specgate.ts CHANGED
@@ -86,8 +86,8 @@ const EXAMPLES =
86
86
  "Generate a new project from a config file"
87
87
  ) +
88
88
  example(
89
- `npx @rsaglobaltech/specgate@latest validate ./projects/my-app --strict-tdd`,
90
- "Validate with the TDD gate"
89
+ `npx @rsaglobaltech/specgate@latest validate ./projects/my-app --strict`,
90
+ "Validate with the gate"
91
91
  ) +
92
92
  example(
93
93
  `npx @rsaglobaltech/specgate@latest expand --pack-root ./domain-packs \\\n --pack parking-management/backend --project-dir ./projects/my-app \\\n --var PROJECT_NAME="My App" --var PROJECT_SLUG=my-app --var DOMAIN="parking ops"`,
@@ -152,9 +152,9 @@ function usageCore() {
152
152
  ` ${c.green}specgate --help --all${c.reset}${c.dim} show every command${c.reset}\n` +
153
153
  ` ${c.green}specgate config set profile full${c.reset}${c.dim} make that the default${c.reset}\n` +
154
154
  section("EXAMPLES") +
155
- example(`npx @rsaglobaltech/specgate@latest adopt`, "Existing codebase") +
156
- example(`npx @rsaglobaltech/specgate@latest init`, "New project (wizard)") +
155
+ example(`npx @rsaglobaltech/specgate@latest init`, "Existing repo or empty directory") +
157
156
  example(`specgate status`, "Start of day") +
157
+ example(`specgate check`, "Before a pull request") +
158
158
  "\n"
159
159
  );
160
160
  }
@@ -313,19 +313,37 @@ function dispatchValidate(validateArgs: string[]): void {
313
313
  const script = resolveScript(["validate_specs.js"]);
314
314
  ensureExecutable(script);
315
315
 
316
- const positional = validateArgs.filter((a) => !a.startsWith("-"));
316
+ // `--help` before the positional check. Asking a command what it does must
317
+ // never be a usage error — `specgate validate --help` answered "expects
318
+ // exactly one positional argument", which is the tool refusing to explain
319
+ // itself to someone who is trying to learn it.
320
+ if (validateArgs.includes("--help") || validateArgs.includes("-h")) {
321
+ runNodeScript(script, ["--help"]);
322
+ return;
323
+ }
324
+
325
+ // `--delivering` takes a value; it is not a second project directory.
326
+ const deliveringAt = validateArgs.indexOf("--delivering");
327
+ const positional = validateArgs.filter(
328
+ (a, i) => !a.startsWith("-") && !(deliveringAt >= 0 && i === deliveringAt + 1)
329
+ );
317
330
  if (positional.length !== 1) {
318
331
  error(`'validate' expects exactly one positional argument: <project_dir>`);
319
332
  usage();
320
333
  process.exit(2);
321
334
  }
322
335
  const VALIDATE_FLAGS = new Set([
336
+ "--strict",
323
337
  "--strict-tdd",
324
338
  "--strict-scenarios",
325
339
  "--strict-requirements",
326
340
  "--strict-links",
341
+ "--strict-coverage",
327
342
  "--against-lock",
328
343
  "--json",
344
+ // Internal: `done --check` and the harness hold the requirement they are
345
+ // delivering to what a delivered row owes. Not in the help on purpose.
346
+ "--delivering",
329
347
  ]);
330
348
  const unknownFlags = validateArgs.filter((a) => a.startsWith("-") && !VALIDATE_FLAGS.has(a));
331
349
  if (unknownFlags.length > 0) {
@@ -96,7 +96,7 @@ function example(line, comment) {
96
96
  const EXAMPLES = example(`npx @rsaglobaltech/specgate@latest init`, "Generate a new project (wizard)") +
97
97
  example(`npx @rsaglobaltech/specgate@latest adopt --project-dir ./my-existing-repo`, "Adopt SDD on an existing codebase") +
98
98
  example(`npx @rsaglobaltech/specgate@latest init --config ./project.config --out ./projects`, "Generate a new project from a config file") +
99
- example(`npx @rsaglobaltech/specgate@latest validate ./projects/my-app --strict-tdd`, "Validate with the TDD gate") +
99
+ example(`npx @rsaglobaltech/specgate@latest validate ./projects/my-app --strict`, "Validate with the gate") +
100
100
  example(`npx @rsaglobaltech/specgate@latest expand --pack-root ./domain-packs \\\n --pack parking-management/backend --project-dir ./projects/my-app \\\n --var PROJECT_NAME="My App" --var PROJECT_SLUG=my-app --var DOMAIN="parking ops"`, "Apply a local pack") +
101
101
  example(`npx @rsaglobaltech/specgate@latest expand --pack-repo https://github.com/acme/parking-specops.git \\\n --pack-version v0.1.0 --pack backend --project-dir ./projects/smart-parking \\\n --var PROJECT_NAME="Smart Parking"`, "Apply a remote pack pinned to a git tag") +
102
102
  example(`npx @rsaglobaltech/specgate@latest specops sync --project-dir ./projects/smart-parking`, "Re-expand everything in .specops.lock / specops.config.yaml") +
@@ -133,9 +133,9 @@ function usageCore() {
133
133
  ` ${c.green}specgate --help --all${c.reset}${c.dim} show every command${c.reset}\n` +
134
134
  ` ${c.green}specgate config set profile full${c.reset}${c.dim} make that the default${c.reset}\n` +
135
135
  section("EXAMPLES") +
136
- example(`npx @rsaglobaltech/specgate@latest adopt`, "Existing codebase") +
137
- example(`npx @rsaglobaltech/specgate@latest init`, "New project (wizard)") +
136
+ example(`npx @rsaglobaltech/specgate@latest init`, "Existing repo or empty directory") +
138
137
  example(`specgate status`, "Start of day") +
138
+ example(`specgate check`, "Before a pull request") +
139
139
  "\n");
140
140
  }
141
141
  /**
@@ -276,19 +276,34 @@ function dispatchInit(passThrough) {
276
276
  function dispatchValidate(validateArgs) {
277
277
  const script = resolveScript(["validate_specs.js"]);
278
278
  ensureExecutable(script);
279
- const positional = validateArgs.filter((a) => !a.startsWith("-"));
279
+ // `--help` before the positional check. Asking a command what it does must
280
+ // never be a usage error — `specgate validate --help` answered "expects
281
+ // exactly one positional argument", which is the tool refusing to explain
282
+ // itself to someone who is trying to learn it.
283
+ if (validateArgs.includes("--help") || validateArgs.includes("-h")) {
284
+ runNodeScript(script, ["--help"]);
285
+ return;
286
+ }
287
+ // `--delivering` takes a value; it is not a second project directory.
288
+ const deliveringAt = validateArgs.indexOf("--delivering");
289
+ const positional = validateArgs.filter((a, i) => !a.startsWith("-") && !(deliveringAt >= 0 && i === deliveringAt + 1));
280
290
  if (positional.length !== 1) {
281
291
  error(`'validate' expects exactly one positional argument: <project_dir>`);
282
292
  usage();
283
293
  process.exit(2);
284
294
  }
285
295
  const VALIDATE_FLAGS = new Set([
296
+ "--strict",
286
297
  "--strict-tdd",
287
298
  "--strict-scenarios",
288
299
  "--strict-requirements",
289
300
  "--strict-links",
301
+ "--strict-coverage",
290
302
  "--against-lock",
291
303
  "--json",
304
+ // Internal: `done --check` and the harness hold the requirement they are
305
+ // delivering to what a delivered row owes. Not in the help on purpose.
306
+ "--delivering",
292
307
  ]);
293
308
  const unknownFlags = validateArgs.filter((a) => a.startsWith("-") && !VALIDATE_FLAGS.has(a));
294
309
  if (unknownFlags.length > 0) {
@@ -1 +1 @@
1
- {"version":3,"file":"specgate.js","sourceRoot":"","sources":["../../bin/specgate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,uCAAyB;AACzB,2CAA6B;AAC7B,iDAA0C;AAE1C,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AACpD,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;AAC1D,MAAM,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC;AAChE,MAAM,OAAO,GAAW,WAAW,CAAC,OAAO,IAAI,OAAO,CAAC;AAEvD,oDAA6F;AAE7F,+EAA+E;AAC/E,SAAS,aAAa,CAAC,QAAkB;IACvC,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,QAAQ,CAAC,CAAC;AAC7C,CAAC;AAED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I,KAAK,MAAM;IACvB,CAAC,OAAO,CAAC,IAAI;QACX,CAAC,CAAC,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC/E,CAAC,CAAC,KAAK,CAAC,CAAC;AAEb,IAAI,YAAY,EAAE,CAAC;IACjB,IAAI,0BAA0B,EAAE,CAAC,OAAO,EAAE,CAAC;AAC7C,CAAC"}
@@ -3,6 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GenerateAgentPromptUseCase = void 0;
4
4
  const AgentPrompt_1 = require("../domain/AgentPrompt");
5
5
  const HarnessRun_1 = require("../domain/HarnessRun");
6
+ const Precedents_1 = require("../domain/Precedents");
7
+ const SpecSections_1 = require("../domain/SpecSections");
8
+ const TraceabilityFormat_1 = require("../domain/TraceabilityFormat");
9
+ const MATRIX = "docs/specs/traceability.md";
6
10
  class GenerateAgentPromptUseCase {
7
11
  configRepo;
8
12
  constructor(configRepo) {
@@ -14,11 +18,63 @@ class GenerateAgentPromptUseCase {
14
18
  ? this.configRepo.readProjectFile(projectDir, featurePath)
15
19
  : null;
16
20
  const aiRulesContent = this.configRepo.readProjectFile(projectDir, "AI_RULES.md");
21
+ // The requirement's own prose. Not reading it is how the prompt came to say
22
+ // "Implement REQ-002" with every fact `-` and nothing to implement.
23
+ const specSource = this.configRepo.readProjectFile(projectDir, "spec.md");
24
+ const requirementText = specSource
25
+ ? (0, SpecSections_1.extractRequirementSection)(specSource, String(req.requirement || ""))
26
+ : null;
17
27
  return AgentPrompt_1.AgentPrompt.build(req, {
18
28
  ...opts,
19
29
  featureContent,
20
30
  aiRulesContent,
31
+ requirementText: requirementText || undefined,
32
+ // Opt-in: the caller decides, because a precedent costs prompt budget and
33
+ // is only worth it once a project has accepted work to point at.
34
+ precedent: opts.withPrecedents ? this.findPrecedent(req, projectDir) : null,
35
+ });
36
+ }
37
+ /**
38
+ * The most recent accepted requirement in the same bounded context, with the
39
+ * top of its test and its implementation.
40
+ *
41
+ * Returns null rather than throwing on anything missing. A prompt that fails
42
+ * to build because an artifact was moved would stop a run over a section that
43
+ * is, by design, optional.
44
+ */
45
+ findPrecedent(req, projectDir) {
46
+ const matrix = this.configRepo.readProjectFile(projectDir, MATRIX);
47
+ if (!matrix)
48
+ return null;
49
+ const mode = (0, TraceabilityFormat_1.detectTraceabilityMode)(matrix);
50
+ if (!mode)
51
+ return null;
52
+ const rows = (0, TraceabilityFormat_1.parseMatrixRows)(matrix).map((cells) => {
53
+ const fields = (0, TraceabilityFormat_1.readRowFields)(cells, mode);
54
+ return {
55
+ requirementId: fields.requirementId,
56
+ status: fields.status,
57
+ testArtifact: fields.testArtifact,
58
+ // The production artifact is the column before the test one in a rich
59
+ // matrix, and absent from a legacy one.
60
+ technicalArtifact: mode === "rich" ? cells[8] || "" : "",
61
+ };
21
62
  });
63
+ const choice = (0, Precedents_1.choosePrecedent)(rows, (0, TraceabilityFormat_1.parseMatrixContexts)(matrix), req.requirement);
64
+ if (!choice)
65
+ return null;
66
+ const read = (rel) => (rel ? this.configRepo.readProjectFile(projectDir, rel) : null);
67
+ const testSource = read(choice.testArtifact);
68
+ const codeSource = read(choice.technicalArtifact);
69
+ if (!testSource && !codeSource)
70
+ return null;
71
+ return {
72
+ requirementId: choice.requirementId,
73
+ testArtifact: choice.testArtifact,
74
+ testExcerpt: testSource ? (0, Precedents_1.excerpt)(testSource) : "",
75
+ technicalArtifact: choice.technicalArtifact,
76
+ technicalExcerpt: codeSource ? (0, Precedents_1.excerpt)(codeSource) : "",
77
+ };
22
78
  }
23
79
  }
24
80
  exports.GenerateAgentPromptUseCase = GenerateAgentPromptUseCase;
@@ -1 +1 @@
1
- {"version":3,"file":"GenerateAgentPromptUseCase.js","sourceRoot":"","sources":["../../../../../packages/core/src/application/GenerateAgentPromptUseCase.ts"],"names":[],"mappings":";;;AACA,uDAAsF;AACtF,qDAAuD;AAEvD,MAAa,0BAA0B;IACjB;IAApB,YAAoB,UAAoC;QAApC,eAAU,GAAV,UAAU,CAA0B;IAAG,CAAC;IAErD,OAAO,CAAC,GAAsB,EAAE,UAAkB,EAAE,OAAsB,EAAE;QACjF,MAAM,WAAW,GAAG,IAAA,4BAAe,EAAC,GAAG,CAAC,IAAI,IAAI,CAAC;QACjD,MAAM,cAAc,GAAG,WAAW;YAChC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,UAAU,EAAE,WAAW,CAAC;YAC1D,CAAC,CAAC,IAAI,CAAC;QACT,MAAM,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;QAElF,OAAO,yBAAW,CAAC,KAAK,CAAC,GAAG,EAAE;YAC5B,GAAG,IAAI;YACP,cAAc;YACd,cAAc;SACf,CAAC,CAAC;IACL,CAAC;CACF;AAhBD,gEAgBC"}
1
+ {"version":3,"file":"GenerateAgentPromptUseCase.js","sourceRoot":"","sources":["../../../../../packages/core/src/application/GenerateAgentPromptUseCase.ts"],"names":[],"mappings":";;;AACA,uDAAsF;AACtF,qDAAuD;AACvD,qDAA8E;AAC9E,yDAAmE;AACnE,qEAKsC;AAEtC,MAAM,MAAM,GAAG,4BAA4B,CAAC;AAE5C,MAAa,0BAA0B;IACjB;IAApB,YAAoB,UAAoC;QAApC,eAAU,GAAV,UAAU,CAA0B;IAAG,CAAC;IAErD,OAAO,CAAC,GAAsB,EAAE,UAAkB,EAAE,OAAsB,EAAE;QACjF,MAAM,WAAW,GAAG,IAAA,4BAAe,EAAC,GAAG,CAAC,IAAI,IAAI,CAAC;QACjD,MAAM,cAAc,GAAG,WAAW;YAChC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,UAAU,EAAE,WAAW,CAAC;YAC1D,CAAC,CAAC,IAAI,CAAC;QACT,MAAM,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,UA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Y_HEADER = exports.ValidateProjectUseCase = void 0;
4
4
  const ValidationReport_1 = require("../domain/ValidationReport");
5
+ const SpecSections_1 = require("../domain/SpecSections");
5
6
  const TraceabilityFormat_1 = require("../domain/TraceabilityFormat");
6
7
  Object.defineProperty(exports, "ALLOWED_STATUS", { enumerable: true, get: function () { return TraceabilityFormat_1.ALLOWED_STATUS; } });
7
8
  Object.defineProperty(exports, "LEGACY_HEADER", { enumerable: true, get: function () { return TraceabilityFormat_1.LEGACY_HEADER; } });
@@ -53,8 +54,30 @@ class ValidateProjectUseCase {
53
54
  }
54
55
  const strictTdd = opts.strictTdd === true;
55
56
  const seenScenarios = new Set();
57
+ const seenRequirements = new Set();
56
58
  for (const cells of (0, TraceabilityFormat_1.parseMatrixRows)(traceContent)) {
57
59
  const { requirementId, scenarioId, testArtifact, status } = (0, TraceabilityFormat_1.readRowFields)(cells, mode);
60
+ // A requirement id is the primary key of this table: `done`, `req link`
61
+ // and `plan` all address a row by it, and every writer allocates a fresh
62
+ // one. Two rows under one id is not a broken link, it is a broken table —
63
+ // `req link REQ-003` then writes *both*, so one requirement's test
64
+ // artifact silently becomes another's, and the matrix asserts a proof
65
+ // that was never run. Three cold adoptions reached that state through the
66
+ // tool's own commands while every gate stayed green.
67
+ if (requirementId && requirementId !== "-") {
68
+ if (seenRequirements.has(requirementId)) {
69
+ report.addError("duplicate_requirement_id", `Duplicate Requirement ID in traceability.md: ${requirementId}`, {
70
+ target: requirementId,
71
+ fixLines: [
72
+ "A requirement id addresses exactly one row — `req link` and `done` write every",
73
+ `row that matches, so two ${requirementId} rows corrupt each other.`,
74
+ "Renumber the later row to the next free id, or delete it if it is a leftover",
75
+ "proposal from `adopt` that you have since replaced.",
76
+ ],
77
+ });
78
+ }
79
+ seenRequirements.add(requirementId);
80
+ }
58
81
  if (requirementId)
59
82
  requirements.add(requirementId);
60
83
  if (scenarioId && scenarioId !== "-") {
@@ -93,6 +116,37 @@ class ValidateProjectUseCase {
93
116
  report.addError("strict_tdd_violation", `[TDD-3] Requirement ${reqId} found in spec.md but has no row in traceability.md`, { target: "TDD-3" });
94
117
  }
95
118
  }
119
+ // The other direction. `req add` used to write a matrix row and no
120
+ // prose, so a requirement could exist as a table entry with no text
121
+ // anywhere — and the harness prompt then asked an agent to implement
122
+ // something the prompt could not describe.
123
+ //
124
+ // A mention in prose is not a section: TDD-3 above matches `REQ-014`
125
+ // wherever it appears, which is right for "is this row missing", and
126
+ // wrong here. This asks for a `## REQ-014` heading.
127
+ const declared = new Set((0, SpecSections_1.requirementSections)(opts.specContent));
128
+ for (const reqId of requirements) {
129
+ // Same scope as TDD-3 above: `REQ-` ids only. A matrix may also carry
130
+ // `NFR-` rows, which live in their own section of spec.md and are not
131
+ // what the harness prompt asks an agent to implement.
132
+ if (!/^REQ-\d+/.test(reqId))
133
+ continue;
134
+ if (declared.has(reqId))
135
+ continue;
136
+ // A warning, not an error, and deliberately so. ADR-0026 commits to the
137
+ // 0.9 line warning about checks that become mandatory in 1.0, because a
138
+ // green-to-red flip in a minor release is how a tool gets removed from
139
+ // a pipeline. Every project whose matrix predates `req add` writing
140
+ // prose would go red on upgrade over text nobody asked them for.
141
+ report.addWarning("requirement_without_prose", `${reqId} has a row in traceability.md but no requirement text in spec.md. ` +
142
+ `This becomes an error in 1.0 (ADR-0026).`, {
143
+ target: reqId,
144
+ file: "spec.md",
145
+ fix: `Write its prose — \`specgate req add\` does it for you, and \`## ${reqId} — ` +
146
+ `<title>\` by hand works too. Until then the harness prompt cannot tell an ` +
147
+ `agent what ${reqId} requires.`,
148
+ });
149
+ }
96
150
  }
97
151
  return { report, mode, requirements };
98
152
  }