@benjaminthomas/spec-driven-dev 1.14.0 → 1.14.2

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
@@ -150,7 +150,7 @@ before it writes the file. If any skill finds no config, it runs this setup firs
150
150
  | What it asks | Detected from | Example answer |
151
151
  |---|---|---|
152
152
  | How the project is organised | git repos and workspace files (`pnpm-workspace.yaml`, `turbo.json`, `nx.json`, `go.work`, …). A Shopify app's `extensions/` count as one app | `single`, `monorepo`, or `multi-repo` |
153
- | *multi-repo:* which repos you work on | git repos nearby, grouped by GitHub owner, plus the team's `team-repos.yml` | `soreto-shopify, reverb-backend` |
153
+ | *multi-repo:* which repos you work on | each repo's purpose, evidence of how it connects to this one (env vars, API calls, docs), your recent commits, and `team-repos.yml`; it recommends a selection with reasons | `soreto-shopify, reverb-backend` |
154
154
  | *multi-repo:* where specs live | (you choose) | a dedicated specs repo, a code repo, or this machine only |
155
155
  | Issue tracker | ticket keys in branch names and commits | Jira, key `STP` |
156
156
  | Base branch / PR target | default branch, `staging`/`develop`, recent PR targets | `staging` |
@@ -760,7 +760,7 @@ skips that step rather than failing.
760
760
 
761
761
  | Skill | Stage | SKILL.md lines | Words | Supporting files |
762
762
  |---|---|---:|---:|---:|
763
- | `spec-setup` | 0 · configure | 210 | 2,201 | 3 |
763
+ | `spec-setup` | 0 · configure | 273 | 2,829 | 4 |
764
764
  | `spec-investigate` | 1 · understand | 387 | 3,367 | 1 |
765
765
  | `spec-create` | 2 · plan | 198 | 1,782 | 6 |
766
766
  | `spec-implement` | 3 · build | 327 | 2,753 | 3 |
@@ -769,7 +769,7 @@ skips that step rather than failing.
769
769
  | `spec-checkpoint` | 6 · commit | 140 | 1,144 | 0 |
770
770
  | `spec-ship` | 7 · PR | 230 | 1,388 | 0 |
771
771
  | `generative-seo` | standalone | 255 | 2,209 | 7 |
772
- | **Total** | | **2,047** | **17,695** | **22** |
772
+ | **Total** | | **2,110** | **18,323** | **23** |
773
773
 
774
774
  - **8** skills: **1** setup + **6** workflow stages + **1** standalone
775
775
  - **4** tools supported natively (Claude Code, Codex CLI, Cursor, Antigravity), plus an MCP fallback
@@ -822,7 +822,7 @@ plugin/evals/ `claude plugin eval` cases
822
822
  1. Increase `version` in both `package.json` and `plugin/.claude-plugin/plugin.json` (the check fails if
823
823
  they differ).
824
824
  2. Add a `CHANGELOG.md` entry, then commit and push.
825
- 3. Tag the release and push the tag: `git tag v1.14.0 && git push origin v1.14.0`.
825
+ 3. Tag the release and push the tag: `git tag v1.14.2 && git push origin v1.14.2`.
826
826
  4. Watch the **publish** run in the repo's Actions tab. When it's green, the new version is on
827
827
  npm. Claude Code plugin users get it from the marketplace once the commit is on `main`.
828
828
 
package/bin/cli.mjs CHANGED
@@ -20,7 +20,7 @@ import path from "node:path";
20
20
  import { execFileSync } from "node:child_process";
21
21
  import prompts from "prompts"; // arrow-key menus that work in PowerShell, cmd, macOS and Linux terminals
22
22
  import { fileURLToPath } from "node:url";
23
- import { scoreRepo, riskMarkdown, normWeights, weightProblems, setConfigValue } from "./risk.mjs";
23
+ import { scoreRepo, riskMarkdown, normWeights, weightProblems, setConfigValue, riskSummaryBlock, withRiskSummary } from "./risk.mjs";
24
24
  import { SHARE_MODES, shareState, planShare, shareTitle } from "./share.mjs";
25
25
 
26
26
  const ROOT = path.dirname(path.dirname(fileURLToPath(import.meta.url)));
@@ -818,6 +818,11 @@ function risk() {
818
818
  const out = path.join(specs, "context", "risk.md");
819
819
  fs.writeFileSync(out, riskMarkdown({ rows, repos: scored, weights, since, top: Number(opt("top")) || 40 }));
820
820
  ignoreGenerated(out);
821
+ const ctx = path.join(specs, "CONTEXT.md");
822
+ if (fs.existsSync(ctx)) {
823
+ fs.writeFileSync(ctx, withRiskSummary(fs.readFileSync(ctx, "utf8"), riskSummaryBlock(rows, new Date().toISOString().slice(0, 10))));
824
+ console.log(` Updated the "Risk hotspots" summary in ${path.relative(DIR, ctx) || ctx}, which is shared with the team.`);
825
+ }
821
826
  const count = (t) => rows.filter((r) => r.tier === t).length;
822
827
  console.log(`✓ Scored ${rows.length} files from ${scored.reduce((t, s) => t + s.commits, 0)} commits → ${path.relative(DIR, out) || out}`);
823
828
  console.log(` ${count("critical")} critical · ${count("high")} high · ${count("medium")} medium · ${count("new")} new. Top 5:`);
package/bin/risk.mjs CHANGED
@@ -167,3 +167,18 @@ export function setConfigValue(text, blockName, key, value) {
167
167
  const body = line.test(block[0]) ? block[0].replace(line, `$1${value}`) : block[0].replace(new RegExp(`^${blockName}:.*\\n`), `$& ${key}: ${value}\n`);
168
168
  return text.replace(block[0], body);
169
169
  }
170
+
171
+ // A short, committed summary inside CONTEXT.md, so the hotspots are part of the shared project memory
172
+ // (risk.md itself is gitignored: it's regenerated on every run). Replaced in place between markers.
173
+ const RB = "<!-- risk:start (written by spec-driven-dev risk; don't edit) -->", RE = "<!-- risk:end -->";
174
+ export function riskSummaryBlock(rows, date) {
175
+ const top = rows.filter((r) => r.tier === "critical" || r.tier === "high").slice(0, 5);
176
+ const counts = ["critical", "high", "medium"].map((t) => `${rows.filter((r) => r.tier === t).length} ${t}`).join(" · ");
177
+ return [RB, "## Risk hotspots", `GitRisk on ${date}: ${counts}. Full table: context/risk.md (regenerate: spec-driven-dev risk).`,
178
+ ...(top.length ? top.map((r) => `- \`${r.file}\` ${r.score} ${r.tier}`) : ["- No high or critical files."]), RE].join("\n");
179
+ }
180
+ export function withRiskSummary(text, block) {
181
+ const i = text.indexOf(RB), j = text.indexOf(RE);
182
+ if (i >= 0 && j > i) return text.slice(0, i) + block + text.slice(j + RE.length);
183
+ return `${text.replace(/\n*$/, "")}\n\n${block}\n`;
184
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@benjaminthomas/spec-driven-dev",
3
- "version": "1.14.0",
3
+ "version": "1.14.2",
4
4
  "description": "Spec-driven AI development workflow (investigate → spec → implement → verify → review → ship) as Agent Skills for Claude Code, Cursor, Codex CLI and Antigravity.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ticket-to-pr",
3
- "version": "1.14.0",
3
+ "version": "1.14.2",
4
4
  "description": "Parallel-batch spec-driven feature workflow (spec-setup, spec-investigate, spec-create, spec-implement, spec-verify, spec-review, spec-checkpoint, spec-ship) plus a portable SEO/GEO operations skill (generative-seo) for any codebase.",
5
5
  "author": {
6
6
  "name": "Benjamin Thomas",
@@ -51,10 +51,13 @@ Read, don't guess. Collect a draft of every field in `references/config-template
51
51
  multi-repo workspace). The same goes for any repo whose "packages" are plug-ins of one app.
52
52
  - **Ask when one repo works with others.** Even inside a single repo, ask once: "Does this repo
53
53
  change together with other repos (for example a backend)?" A yes means `multi-repo`.
54
- - Not inside a git repo, but sibling folders are git repos → candidate `multi-repo`. Group them
55
- by remote owner (`git remote get-url origin`) and show the groups — the user picks which repos
56
- belong together. Never assume every folder in the parent belongs. Always also ask whether
57
- repos in **other folders** belong (e.g. `~/clients/billing`). Check each path is a git repo,
54
+ - Not inside a git repo, but sibling folders are git repos → candidate `multi-repo`.
55
+ - **Choosing the repos is a required question for `multi-repo`, never a detection.** Someone new
56
+ doesn't know what `soreto-melissa` is, so never show bare folder names. Follow
57
+ `references/repo-picker.md`: say what each candidate repo is, show evidence of how it connects
58
+ to the current repo, note whether the user commits to it, and recommend a selection with a
59
+ reason per repo. Ask once, and don't write the config until they've answered. Always also
60
+ offer repos in **other folders** (e.g. `~/clients/billing`). Check each path is a git repo,
58
61
  and store paths inside the workspace as relative and paths outside it as absolute.
59
62
  - The repos of one workspace can live in unrelated places (`/Projects/frontend`,
60
63
  `~/Work/backend`, `/srv/database`). Put the config in their shared parent folder, or in
@@ -120,16 +123,76 @@ Read, don't guess. Collect a draft of every field in `references/config-template
120
123
  Store the answer as `context.share`. A dedicated specs repo is shared by nature: set
121
124
  `context.share: all`.
122
125
 
126
+ ## How to ask
127
+
128
+ Two kinds of question, asked two different ways:
129
+
130
+ 1. **Choices** (layout and repos, sharing, specs location, after-approval mode, a guessed command):
131
+ use the host's **interactive question tool** when it has one (Claude Code: `AskUserQuestion`).
132
+ - Up to 4 questions per call; each needs **2 to 4 options** (a one-option question is rejected
133
+ and the user never sees it; "Other" is added automatically and doesn't count).
134
+ - Put the recommended option first and end its label with "(Recommended)". Put the evidence in
135
+ each option's description (e.g. "called via BACKBONE_URL, app/services/x.ts:105").
136
+ - **Layout and repos are two separate calls, always** (Step 2). Never ask layout together with
137
+ other questions.
138
+ - **Repos are never offered as preset bundles** ("+backend +melissa", "all four"); bundles don't
139
+ scale and stop people mixing their own. Ask in two calls:
140
+ 1. **Layout first**, on its own: "Single repo" vs "Several repos that change together"
141
+ (vs "Monorepo" when it fits), recommendation first with the evidence.
142
+ 2. **Only if several:** a `multiSelect` question with **one option per repo**: label = repo
143
+ name (the recommended ones first, marked "(Recommended)"), description = what it is plus the
144
+ link evidence. At most 4 options. The menu can't show the rest, so the **question text** must
145
+ end by naming the other repos found ("Also found: a, b, c (no code link).") and saying how to
146
+ add them: "To add any of these, or a repo from another folder, choose *Type something* and
147
+ enter names or paths, e.g. `a, ~/Work/billing`." Put the remaining choices (specs location,
148
+ sharing, pipeline) in this same call.
149
+ - If the tool isn't available (or a call fails), ask the same choices as a short numbered list
150
+ in text instead. Never drop a question.
151
+ 2. **Open questions** (what the product does, fragile spots, direction, unwritten rules): plain text
152
+ in **one chat message**, asked **after** the choices are answered. Never turn these into a menu.
153
+
123
154
  ## Step 2 — Confirm in one round
124
155
 
125
156
  Show the draft as a short table grouped by layout, tracker, git, commands, and specs location.
126
- Mark each value **detected** (with where it came from) or **guess**. Then ask only about guesses
127
- and conflicts — in one message, not a drip of questions. Typical ones:
157
+ Mark each value **detected** (with where it came from) or **guess**. Then ask in exactly this order
158
+ (interactive question tool when there is one; see How to ask):
159
+
160
+ **Call 1: layout, alone. Nothing else in this call.** Use these option labels exactly; no repo names
161
+ in them:
162
+ - `Single repo`: "Only <this repo>." (+ the evidence for or against)
163
+ - `Several repos`: "<this repo> changes together with other repos. You'll pick which next."
164
+ - `Monorepo`: only when workspace markers were found.
165
+
166
+ Recommend one (first, with "(Recommended)") and put the evidence in the question text.
167
+
168
+ **Call 2: repos (only if the answer was `Several repos`).** The repo tick-box list (`multiSelect`, one
169
+ option per repo, see `references/repo-picker.md`) and where specs live (a dedicated specs repo, inside
170
+ one code repo, or this machine only).
171
+
172
+ **Call 3: git conventions, always, even when detected.** These decide how every branch and commit is
173
+ made, and detection can be wrong, so confirm them. Four questions, the detected value first with its
174
+ evidence in the description, then the common alternatives:
175
+ - **Base branch** (work starts from): e.g. `staging (Recommended)`: "16 of the last 20 merged PRs";
176
+ `main`; `develop`. In multi-repo, say which repos differ ("staging; soreto-cms has none, uses main").
177
+ - **PR target**: usually the same as the base branch.
178
+ - **Branch names**: e.g. `STP-123 (Recommended)` (bare ticket id, seen in recent branches);
179
+ `feat/STP-123-short-name`; `feat/short-name`.
180
+ - **Commit style**: e.g. `STP-123: message (Recommended)`; `feat: message`; free text. In multi-repo,
181
+ name any repo that uses a different style.
182
+
183
+ **Call 4: tracker, team and pipeline.** The tracker, confirmed like the git conventions (e.g.
184
+ `Jira, key STP (Recommended)`: "STP-123 in recent branches", `GitHub Issues`, `Linear`, `None`), then
185
+ sharing (if specs are inside a repo), after approval (stop / run straight through), and any command
186
+ that's a guess (e.g. typecheck). At most 4; a guessed command that doesn't fit goes in the summary as
187
+ "I'll use X, say if that's wrong".
188
+
189
+ Then the open questions, as plain text (see How to ask).
190
+
191
+ Typical things to flag in the descriptions:
128
192
 
129
- - "Your repos default to `master`, but recent PRs targeted `staging`. Cut work from `staging`?"
130
- - "Recent branches are bare ticket IDs (`STP-282`). Keep that, or use `fix/STP-282-short-slug`?"
131
- - "These 6 repos share the `acme` GitHub org. Do they form one workspace for the pipeline?"
132
- - "Where should specs live — this folder's `specs/`, or inside one repo so they go through PRs?"
193
+ - "Your repos default to `master`, but recent PRs targeted `staging`."
194
+ - "Recent branches are bare ticket IDs (`STP-282`)."
195
+ - "These 6 repos share the `acme` GitHub org."
133
196
 
134
197
  If the user says "just use the defaults", accept the detected values and the template defaults
135
198
  for the rest.
@@ -41,7 +41,10 @@ never ask again.
41
41
  ## 3. Discovery questions (one round)
42
42
 
43
43
  Show the draft map first, with each line marked **detected** (with its source) or **guess**. Then
44
- ask only what the code can't answer, in one message:
44
+ ask only what the code can't answer, as **plain text in one message**, after the setup choices have
45
+ been answered. These are open questions, so
46
+ never put them in a menu or multiple-choice tool (a menu needs two or more real options, and these
47
+ have none). The user replies in their own words, or "skip":
45
48
 
46
49
  - What does the product do, and who uses it?
47
50
  - Which areas are legacy, frozen, or off-limits?
@@ -54,8 +54,18 @@ Project: existing · audited at a1b2c3d (2026-11-10) · graph: none
54
54
 
55
55
  ## Specs
56
56
  - {stp-123: retry failed webhooks, touched billing (2026-11-10)}
57
+
58
+ <!-- risk:start (written by spec-driven-dev risk; don't edit) -->
59
+ ## Risk hotspots
60
+ GitRisk on 2026-11-10: 0 critical · 8 high · 30 medium. Full table: context/risk.md (regenerate: spec-driven-dev risk).
61
+ - `app/services/billing.ts` 61.7 high
62
+ <!-- risk:end -->
57
63
  ```
58
64
 
65
+ The **Risk hotspots** block is written by `spec-driven-dev risk` (setup, every batch, checkpoint) and
66
+ replaced in place, so don't edit it. It's the shared part of GitRisk: `context/risk.md` itself is
67
+ gitignored because it's regenerated on every run.
68
+
59
69
  ## context/<area>.md
60
70
 
61
71
  ```markdown
@@ -0,0 +1,79 @@
1
+ # Choosing the repos of a multi-repo workspace
2
+
3
+ People can't choose from folder names alone, and every team's machine looks different. Do the
4
+ homework first, then recommend a selection with reasons. Work from evidence, never from the names.
5
+
6
+ ## 1. Find candidates (any folder layout)
7
+
8
+ - Git repos below the workspace folder. Start two levels down; go deeper only when the layout calls
9
+ for it (`~/code/github.com/<org>/<repo>`, `~/work/<client>/<repo>`). Skip worktrees (their `.git`
10
+ is a file), `node_modules`, vendor and build folders.
11
+ - Repos in `{specs_dir}/team-repos.yml` if it exists, including ones not cloned here.
12
+ - Repos the user names from other folders, and git submodules of the current repo.
13
+ - **Lots of repos?** Don't list them all. Rank by the evidence below and show the top 8 or so, then
14
+ "N other repos found, name any you want added".
15
+
16
+ ## 2. For each candidate, gather (cheap commands; read only what's needed)
17
+
18
+ **What it is**, in one line. The first that exists:
19
+ 1. `team-repos.yml` role.
20
+ 2. README's first heading and paragraph. Skip boilerplate from a framework template.
21
+ 3. Manifest description: `package.json`, `pyproject.toml`, `Cargo.toml`, `go.mod` module path,
22
+ `pom.xml`/`build.gradle` artifact, `composer.json`.
23
+ 4. `AGENTS.md`/`CLAUDE.md` first lines.
24
+ 5. Its shape: main folders and entry point (e.g. "a Go service with `cmd/worker`").
25
+
26
+ **How it connects to the current repo.** Search the current repo (and the candidate) for any of
27
+ these, and quote one piece of evidence with `path:line`:
28
+
29
+ | Link | What to look for |
30
+ |---|---|
31
+ | Runtime calls | the candidate's name, hostnames, base-URL env vars, API paths, in code, `.env.example`, config |
32
+ | Contracts | OpenAPI/Swagger clients, GraphQL schemas, gRPC/protobuf files, generated SDKs naming the other service |
33
+ | Packages | one repo depends on the other's package (npm, PyPI, Go module, Maven, NuGet, internal registry) |
34
+ | Infrastructure | `docker-compose` services, Kubernetes/Helm manifests, Terraform, CI jobs that check out the other repo |
35
+ | Messages and data | queue or topic names, event names, a shared database or schema both mention |
36
+ | Code layout | git submodules, shared generated code, copied types |
37
+ | Docs | `README`, `AGENTS.md`, architecture docs saying "calls X" or "consumed by Y". A passing mention ("unlike X") is not a link |
38
+
39
+ **Whether the user works on it:** `git log --since=90.days --author="$(git config user.email)"
40
+ --oneline | wc -l`. Use it as a hint only. A new team member has no commits anywhere, so recommend
41
+ from code links and `team-repos.yml` alone, and don't mention commits.
42
+
43
+ **Owner:** `git remote get-url origin`. Same organisation is weak evidence, never enough alone.
44
+
45
+ ## 3. Recommend, then ask once
46
+
47
+ Group the candidates:
48
+ - **I'd include**: the current repo, plus repos with a real link (any row above). Give the reason
49
+ and the evidence for each.
50
+ - **Probably not needed for this repo**: the rest, each with a short why ("no link found").
51
+ - **No links found at all?** Say so plainly and ask the user to describe which repos change together
52
+ with this one. Some systems connect only through a shared database or a message queue the code
53
+ doesn't name.
54
+
55
+ Ask it with the host's interactive question tool when there is one: after the layout question, a
56
+ `multiSelect` question with **one option per repo** (never bundles of repos), the recommended ones
57
+ first, evidence in each option's description, 2–4 options. End the question text with the other
58
+ repos found by name and how to add them ("choose *Type something* and enter names or paths, e.g.
59
+ `old-admin, ~/Work/billing`"), since the menu only shows 4. Otherwise as text.
60
+ Shape of the question, with placeholders rather than real names:
61
+
62
+ > I found 6 repos under ~/code/github.com/acme. Based on the code, I'd include:
63
+ > - ✓ **orders-api**: this repo, the orders REST service (FastAPI)
64
+ > - ✓ **payments-worker**: a Go worker. `docker-compose.yml:31` runs it next to this API, and both
65
+ > use the `payment.requested` queue (`app/events.py:12`)
66
+ > - ✓ **storefront-web**: React app. Its generated client `src/api/orders.ts` is built from this
67
+ > repo's OpenAPI spec
68
+ >
69
+ > Probably not needed for this repo:
70
+ > - **design-tokens**, **marketing-site**, **old-admin**: no link to orders-api found
71
+ >
72
+ > Keep these three, or add any of the others (or a repo from another folder)? You can change this
73
+ > any time: "add old-admin to the workspace".
74
+
75
+ Rules:
76
+ - Never pick for the user silently, and never include a repo because it's in the same folder.
77
+ - Someone new should be able to answer "yes". An expert can adjust.
78
+ - Fewer repos is better: investigations search every listed repo, so extra ones cost tokens.
79
+ - Write nothing until they answer, and show the chosen repos again in the final summary.