@skitterbyte/skitterspec-github 2.18.1 → 3.1.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 (36) hide show
  1. package/MIGRATION.md +126 -0
  2. package/README.md +11 -2
  3. package/assets/claude-md-section.md +23 -123
  4. package/assets/core/SETUP.md +4 -2
  5. package/assets/project-conventions.md +17 -0
  6. package/assets/rules/commit-trailers.md +41 -99
  7. package/assets/rules/negative-checks.md +21 -48
  8. package/assets/rules/offered-unblocks.md +39 -74
  9. package/assets/rules/spec-format.md +117 -0
  10. package/assets/rules/spec-planning.md +128 -1013
  11. package/assets/rules/spec-reports.md +70 -607
  12. package/assets/skills/no-spec/SKILL.md +4 -4
  13. package/assets/skills/spec/SKILL.md +7 -7
  14. package/assets/skills/spec/kind-routing.md +35 -0
  15. package/assets/skills/spec-bug/SKILL.md +6 -6
  16. package/assets/skills/spec-cancel/SKILL.md +1 -1
  17. package/assets/skills/spec-complete/SKILL.md +1 -1
  18. package/assets/skills/spec-diff/SKILL.md +6 -2
  19. package/assets/skills/spec-diff/review-page.md +89 -0
  20. package/assets/skills/spec-diff/review-wait.md +133 -0
  21. package/assets/skills/spec-epic-next/SKILL.md +2 -1
  22. package/assets/skills/spec-epic-next/epics.md +44 -0
  23. package/assets/skills/spec-hotfix/SKILL.md +5 -5
  24. package/assets/skills/spec-incident/SKILL.md +1 -1
  25. package/assets/skills/spec-next/SKILL.md +5 -5
  26. package/assets/skills/spec-resume/SKILL.md +204 -8
  27. package/assets/skills/spec-review/SKILL.md +1 -1
  28. package/assets/skills/spec-start/isolation.md +90 -0
  29. package/bin/skitterspec-github.js +3 -2
  30. package/package.json +2 -3
  31. package/src/cli.js +72 -5
  32. package/src/conventions.js +43 -0
  33. package/src/env/resume.js +116 -3
  34. package/src/init.js +180 -30
  35. package/src/spec-planning-history.json +103 -0
  36. package/src/updateall.js +152 -0
@@ -31,13 +31,207 @@ each spec branch, local then remote-tracking, never fetched. That matters
31
31
  because the base branch reads `backlog` for the whole life of a spec, and under
32
32
  `land.specDocs: "branch"` an in-flight spec may exist only on its branch.
33
33
 
34
- - **`ok: false`.** Relay the `refused` text and stop with `⏸`. It covers a
35
- name or ticket that matches nothing (it never guesses the nearest), a spec in
36
- `backlog` (`Next` is `/spec-start <name>`), one already complete or
37
- cancelled, and one with no branch anywhere to resume from.
34
+ - **`ok: false` with an `offer`.** That is a completed spec, and the offer is
35
+ re-opening it. Relay the `refused` text, **then** put the offer's `label`
36
+ and Cancel to the operator as `.claude/rules/offered-unblocks.md`
37
+ describes: the label verbatim, nothing pre-selected, and no third option.
38
+ On the label, go to **1b**. On Cancel, stop with `⏸` and record nothing.
39
+ - **`ok: false` and no `offer`.** Relay the `refused` text and stop with
40
+ `⏸`. It covers a name or ticket that matches nothing (it never guesses the
41
+ nearest), a spec in `backlog` (`Next` is `/spec-start <name>`), a cancelled
42
+ spec, a completed hotfix or epic, and one with no branch anywhere to resume
43
+ from. **Never offer a re-open the engine did not declare**, however
44
+ obviously one seems to fit.
38
45
  - **`ok: true`.** Carry on. `blockers`, `progress` and `identifier` are read
39
46
  in step 3.
40
47
 
48
+ ## 1b. Re-open a completed spec (only on the offer's pick)
49
+
50
+ Sometimes a spec was completed to get its work onto the base branch, and more
51
+ phases turn out to be needed. Its branch went at teardown, and its work is on
52
+ the base, so re-opening is a fresh branch **at the base as it is now**. This
53
+ step does what `/spec-start` does for that branch, and nothing more.
54
+
55
+ 1. **Ask for the plan.** Run
56
+ `skitterspec spec-env resume <spec> --reopen --json`. A refusal here
57
+ (a worktree still standing, or a leftover branch holding commits the base
58
+ does not have) is relayed and ends `⏸`. It never resets work, and neither
59
+ do you.
60
+ 2. **Provision.** Bring the review server up as step 2 says. Run the plan's
61
+ `commands` in order from the primary checkout. The first creates the
62
+ branch at the base, and the second is `spec-env up`, a planner: run the
63
+ commands it prints, then its `then` line with the `cd` in front, exactly
64
+ as `/spec-start` step 3 does. Confirm with `skitterspec spec-env resolve`
65
+ (no argument) as step 2 below does.
66
+ 3. **Move it back, and say why.** Run the plan's `move` command. Add a dated
67
+ Changelog line, `Re-opened from complete: <reason>`. The reason comes from
68
+ the message, or is **asked once** when there is none.
69
+
70
+ **Who owns this spec's status.** Only when `specs/.core/github.config.json` exists.
71
+ Run `skitterspec spec-sync ownership --json` once and read both values:
72
+
73
+ - **`workflowState: "pull"`** — GitHub is the record of this spec's status, so
74
+ this skill **writes no `> **Status:**` header and appends no State log row**,
75
+ wherever its steps below say to. A spec this skill creates gets neither: its
76
+ header carries `> **Tracker:** <issue url>` instead, filled in once linking
77
+ has stamped the url, and its body has no `## State log` section. Readiness is
78
+ the spec's own content — a `Draft` is a spec whose **Open questions** is not
79
+ empty — so nothing is lost with the header.
80
+ - **`assignee: "pull"`** — GitHub holds who is building it, so this skill
81
+ **writes no `> **Developer:**` line** either.
82
+ - **Anything else** — `push`, `none`, sync reported off, or the command failing
83
+ — is cannot-tell, and the steps below run exactly as written.
84
+
85
+ What `pull` leaves alone: the folder move (a bucket records what the repo did to
86
+ the code, not a planning status), the phase files and index, and the Changelog.
87
+ A reason a `Status:` header would have carried — a cancellation's, a knock-back
88
+ to Draft — goes in a dated Changelog line instead. A spec that already carries
89
+ any of these lines keeps them untouched: they are history, and nothing rewrites
90
+ them.
91
+
92
+ - Set the **Status** header: `> **Status:** In Progress — re-opened <YYYY-MM-DD>`.
93
+ - Append a **State log** row: `| <YYYY-MM-DD> | In Progress | in-progress | <git user.name> |`.
94
+
95
+ 4. **Put the ticket back in progress.** The bucket move is the same code fact
96
+ `/spec-start` reports, so it takes the same steps. On a re-open, the board
97
+ reporting the ticket Done or Cancelled is **expected rather than a warning**:
98
+ the push below is what moves it back. Do not relay it.
99
+
100
+ **Only when all three hold**: `specs/.core/github.config.json` exists, the repo
101
+ **owns** `assignee` in its `sync.fieldOwnership`, and the spec carries a
102
+ `github_identifier`. Any one missing → skip this step silently and carry on; a
103
+ project that declined must see no trace of assignment.
104
+
105
+ Ownership is the **value**, not the key: `assignee` is owned by default, and
106
+ `"none"` is how a project declines it. Testing whether the key is *present* would
107
+ read as opted-in everywhere, since the default puts it in every config.
108
+
109
+ **Never blocks, never fails the skill.** Everything below is best-effort: the
110
+ branch is provisioned and the spec is moving either way, and an unassigned issue
111
+ is a cosmetic gap that `/spec-claim` closes later.
112
+
113
+ 1. **Work out who you are.** Run `skitterspec spec-sync whoami --json`.
114
+ - `ok: true` → use `id` and `name`. Nothing to ask.
115
+ - `source: "mcp"` or the command reports no token → call the discovered
116
+ `get_me` tool, then cache its login:
117
+ `skitterspec spec-sync whoami --set <id> --name "<name>"`.
118
+ - `ok: false` → identity is **unknown**, which is an ordinary state (a shared
119
+ or bot key, an offline machine). Go to step 2.
120
+ 2. **Unknown identity — three states, not two.** Decide by what is actually
121
+ reachable, and route the third to inaction:
122
+ - **GitHub reachable *and* this is an interactive session** → offer a short
123
+ user search (`skitterspec spec-sync users <name-or-email>`, or the
124
+ user-list tool on MCP), let the operator pick, and offer to cache it with
125
+ `whoami --set` so this is asked once per machine rather than once per spec.
126
+ - **Not reachable, or not interactive** → say so in one line
127
+ (`assignment skipped — no GitHub identity`) and **carry on**. Do not prompt
128
+ for something you could not act on, and never stall a `/spec-start` on it.
129
+ 3. **Record it on the spec** — through the engine, never by hand-editing
130
+ frontmatter:
131
+
132
+ ```
133
+ skitterspec spec-sync assign <spec> --to <login> --name "<display name>"
134
+ ```
135
+
136
+ **Where `spec-sync ownership` reports `assignee: pull`**, the issue is the
137
+ record and the spec file is not: add `--if-unassigned`. It writes GitHub
138
+ directly, claims the issue only when nobody holds it, and stamps nothing —
139
+ so step 4 has no header to leave alone, since under `pull` no `Developer:`
140
+ line was written.
141
+
142
+ 4. **Leave `> **Developer:**` as `git config user.name`** — the step above this
143
+ seam already set it, and this seam must not overwrite it with the tracker's
144
+ display name.
145
+
146
+ Those two names are the same person and often not the same string, and the
147
+ git one is the one everything else in the spec already uses: `Author:`, every
148
+ **State log** `By` row, and every commit. Writing the tracker's name into this
149
+ one field would leave a spec whose own audit trail contradicts its header —
150
+ a worse problem than the one it would solve. Anyone wanting a different name
151
+ on their specs sets `git config user.name`, and it stays consistent
152
+ everywhere.
153
+
154
+ The header names **who is building this**; the stamp in step 3 names
155
+ **which tracker account it is assigned to**. They answer different questions,
156
+ so they need not be the same string. The one place that reasoning does not hold
157
+ is handing a spec to *someone else* — there is no local git name for them —
158
+ and that case belongs to `/spec-claim --to`, which sets the header from the
159
+ tracker deliberately.
160
+
161
+ **Nothing is pushed here.** `assign` writes the repo only, and the refresh these
162
+ skills already run sends it. Assignment is an ordinary field of the projection,
163
+ not a side errand with its own network call. Under `pull` the
164
+ `assign` call is itself the write, so there is nothing for a push to carry.
165
+
166
+ **There is no unassign step anywhere.** The projection derives the assignee from
167
+ the spec's lifecycle bucket, so `/spec-complete` and `/spec-cancel` release the
168
+ issue through the push they already make. The stamp deliberately stays in the
169
+ file: who actioned the work outlives who is currently holding it. Under `pull`
170
+ the projection carries no assignee at all, so finishing a spec leaves it on
171
+ the issue: the board keeps who did the work.
172
+
173
+ **Only when `specs/.core/github.config.json` exists** and the spec's overview
174
+ carries a `github_identifier`. Either missing → **skip**, in one line
175
+ (`not linked to GitHub — /spec-push to mirror it`), and carry on. Nothing else in
176
+ this step changes.
177
+
178
+ **Ask the board first.** Run `skitterspec spec-sync board <spec>`. It is silent
179
+ unless GitHub already says Done or Cancelled for this issue; when it prints a
180
+ line, relay it once as a warning and **carry on** — you are the one about to hold
181
+ this branch, so the cleanup it names is yours to choose, and nothing here runs it
182
+ or refuses on it.
183
+
184
+ **Refresh the mirror now, without asking.** Run `/spec-push`. The spec has just
185
+ moved to `in-progress/` and been stamped with a developer — two real state
186
+ changes, and the tracker is a generated mirror of them. It costs one engine call
187
+ and no model tokens when a GitHub token is set (see `apply.transport` in
188
+ `github.config.md`).
189
+
190
+ - **Never mint.** An unlinked spec is skipped, not created. A spec kept
191
+ deliberately local should stay that way — `/spec-push` is how someone opts in.
192
+ - **Never fatal.** If the push fails — offline, no token, a GitHub error — say so
193
+ and **finish the operation anyway**. The spec is in flight in the repo
194
+ regardless; the mirror is disposable and the next push repairs it. Do not roll
195
+ the provisioning back, and do not stop to ask.
196
+ - **Say what happened** in the skill's report: mirror updated, skipped as
197
+ unlinked, or failed with the reason.
198
+
199
+ ### Why it sits here
200
+
201
+ Pinned **after the `git mv` and before the commit**, and both halves matter:
202
+
203
+ - **After the move**, because the projection reads a spec's workflow state from
204
+ its folder bucket. Push while the folder is still in `backlog/` and the issue
205
+ is set to the state the spec is *leaving*.
206
+ - **Before the commit**, because the push stamps ids into the spec and writes a
207
+ snapshot under `specs/.core/`. The `git add` that follows sweeps both up with
208
+ the status change; push after it instead and those files are left uncommitted —
209
+ which strands a dirty worktree on the hand-off, and makes `spec-env integrate`
210
+ refuse to land the branch.
211
+
212
+ ### Why this is not the refresh `/spec-next` already runs
213
+
214
+ It was once reasoned that a push here would send the same thing twice, one commit
215
+ apart, because `/spec-next` refreshes the moment it starts. That holds only in
216
+ `checkout` mode, where `/spec-next` follows immediately. In `worktree` mode the
217
+ spec is built elsewhere and the refresh can be hours away or never come — and
218
+ until it does, the issue sits in its old workflow state with nobody assigned
219
+ while the repo reads `in-progress` with a developer on it.
220
+
221
+ The two pushes are not duplicates either way. This one carries the issue's
222
+ workflow state and its assignee; the one `/spec-next` runs carries phase 1
223
+ starting. Every other lifecycle skill mirrors the state change it makes, and this
224
+ is the seam that stops `/spec-start` being the exception.
225
+
226
+ 5. **Commit it** before anything is built: `skitterspec spec-env stage <spec>`
227
+ and its `owned` paths, pathspec-bounded on both the `add` and the
228
+ `commit`, as `docs(spec): reopen <spec>` with the `Refs:` trailer when
229
+ there is a ticket.
230
+
231
+ Then carry on at **step 3**. Every phase reads `✅`, so step 4's rule for new
232
+ work applies: the message becomes a new phase file plus an index row. With no
233
+ message, **ask what the new phase is** rather than inventing one.
234
+
41
235
  ## 2. Get into its worktree
42
236
 
43
237
  **Only when the project has per-spec isolation** (`specs/.core/env.config.json`).
@@ -101,7 +295,7 @@ be several:
101
295
  dated Changelog line quoting the report.
102
296
  - **Work outside this spec.** For example: a different feature, or a defect in
103
297
  code the spec never touched. Propose the right door with a one-line reason,
104
- confirm first, as `.claude/rules/spec-planning.md`'s kind routing does. A
298
+ confirm first, as `.claude/skills/spec/kind-routing.md` does. A
105
299
  defect goes to `/spec-bug`; new behaviour goes to `/spec`. On a no, carry
106
300
  on with whatever part of the message was this spec's.
107
301
 
@@ -140,13 +334,15 @@ Otherwise, end with the block defined in `.claude/rules/spec-reports.md`.
140
334
  stands, or bootstrap failed a step that does not stop the reading.
141
335
  - `❌`: provisioning or the move failed part-way. Name what was left and
142
336
  where.
143
- - `⏸`: the engine refused. Nothing was provisioned and nothing moved.
337
+ - `⏸`: the engine refused, or a re-open offer was answered Cancel. Nothing
338
+ was provisioned and nothing moved.
144
339
 
145
340
  **Fields:** `Tracker` · `Spec` · `Built` · `Notes` · `Worktree` ·
146
341
  `Follow-ups` · `Next`
147
342
 
148
- `Spec` is the bucket and progress (`2 of 4 done, phase 3 in progress`).
149
- `Worktree` is the path, and says **entered** or **provisioned**. `Built` lists
343
+ `Spec` is the bucket and progress (`2 of 4 done, phase 3 in progress`), and
344
+ says **re-opened from complete** after 1b. `Worktree` is the path, and says
345
+ **entered**, **provisioned** or **re-opened**. `Built` lists
150
346
  what the message added to the spec (tasks, a cleared blocker), and is absent
151
347
  when nothing was written. `Notes` carries any blocker still standing, quoted.
152
348
  `Next` is `/spec-next` when the spec is ready to build, or the blocker when one
@@ -280,7 +280,7 @@ API that moved, a task the code already does. `Spec` carries the status the
280
280
  review leaves it in, which is the answer to "can I start this?".
281
281
 
282
282
  **Where step 4b rendered a page the run is waiting**, so the block omits the
283
- `Review` row and ends on the banner from `.claude/rules/spec-reports.md` — the
283
+ `Review` row and ends on the banner from `.claude/skills/spec-diff/review-wait.md` — the
284
284
  tier stack copied from the engine's own lines, never one link chosen for the
285
285
  reader:
286
286
 
@@ -0,0 +1,90 @@
1
+ # Isolation, worktrees and the live overlay
2
+
3
+ Applies only when `specs/.core/env.config.json` exists. Without it, every skill
4
+ works in the checkout it is standing in.
5
+
6
+ ## Workspace modes (`mode` in `env.config.json`)
7
+
8
+ - **`worktree`** (the default): each spec gets its own checkout, so several can
9
+ be in flight and `main` stays free. `/spec-start` builds the branch there,
10
+ moves the session in with a plain `cd`, and asks whether to build phase 1. The
11
+ primary checkout stays on the base branch, so the base branch still shows an
12
+ in-flight spec under `backlog`. `skitterspec status` reads each worktree's own
13
+ copy.
14
+ - **`checkout`**: the branch is built in the primary checkout, one spec at a
15
+ time, and the build carries straight on. `/spec-connect` and `/spec-live` do
16
+ not apply and say so.
17
+
18
+ **Omit the spec name anywhere** and the engine uses the worktree you are
19
+ standing in, or else the only provisioned spec.
20
+
21
+ ## Per-spec isolation
22
+
23
+ `/spec-start` gives every in-progress spec its own worktree. Docker is a
24
+ per-spec escalation: `> **Stack:** worktree` (the default) or
25
+ `worktree + docker` when the spec touches the database or stateful services.
26
+ `/spec-start` brings up a namespaced stack only for the latter, and starts the
27
+ host **dev servers** (`dev` in `env.config.json`) on the spec's ports.
28
+ `/spec-connect <name>` maps that spec onto your normal `localhost` ports, and
29
+ `/spec-connect main` hands them back. Teardown is part of `/spec-complete` and
30
+ `/spec-cancel`, which drop the spec's test-DB volume and offer to prune orphans
31
+ first.
32
+
33
+ The engine is `skitterspec spec-env
34
+ <up|bootstrap|nospec|main|project|down|prune|dev|connect|integrate|disposition|handoff|hotfix|live|review|stage|checks|status|resolve|resume|base>`.
35
+ `up` plans the fork, and **`bootstrap` runs the worktree's own steps**: seeding
36
+ the gitignored files, the env file, `setup` and the stack. Never reconstruct
37
+ those steps as shell commands.
38
+
39
+ A **hotfix** is the one spec that does not fork from `main`. `/spec-hotfix` forks
40
+ from a release tag, and `/spec-complete` lands it through `spec-env hotfix land`
41
+ (release, push on consent, carry to `main` without the version commit). Its
42
+ worktree stays until the deploy is out and a second `/spec-complete` runs
43
+ `spec-env hotfix finish`.
44
+
45
+ ## The live overlay (`/spec-live`)
46
+
47
+ `/spec-connect` runs a spec's own dev stack. The live overlay instead reuses the
48
+ dev server you already have running. `/spec-live <spec>`, or a bare
49
+ `/spec-live`, rebases the branch onto the base (the fetched remote base under PR
50
+ landing), frees it from its worktree, and checks it out
51
+ **in the primary checkout**, so the running server hot-reloads it. The checked-out branch is the
52
+ lock, so only one spec is live at a time. `/spec-live main` hands the checkout
53
+ back. Fixes made while live commit straight onto the branch, and
54
+ `/spec-complete` knows about live specs and lands them.
55
+
56
+ - It is for **testing** a code-only spec, not for starting work, and no
57
+ lifecycle skill invokes it.
58
+ - It **refuses** stateful specs (`Stack: worktree + docker`, or a branch that
59
+ touches migrations). Use `/spec-connect` and a Docker stack for those.
60
+ - `live.afterSwitch` entries (`{ run, when }`) run in the primary checkout after
61
+ taking and after releasing. The engine runs them itself.
62
+ - The engine is `skitterspec spec-env live <take|release|abort|status>`.
63
+
64
+ ## Authoring a spec off the base branch
65
+
66
+ With isolation, `/spec` grills first, then runs `spec-env up <name> --docs`,
67
+ moves into that worktree and writes the spec there. `--docs` skips `setup` and
68
+ Docker, so the tree costs one `git worktree add`. `/spec-start` later re-runs
69
+ `up` without the flag, and the install happens then.
70
+
71
+ Both committing verdicts on the authoring page (`Commit & Start`, `Commit`)
72
+ commit on the branch, then `spec-env integrate` rebases and fast-forwards, so
73
+ the base gains the spec as one commit. `Commit & Start` keeps the worktree and
74
+ carries into `/spec-start`. `Commit` tears it down. The authoring page arms
75
+ nothing, because a backlog spec owes no phase.
76
+
77
+ **`land.specDocs: "branch"`** (the default once a ticketing provider is
78
+ configured and the key is unset) keeps the spec on its feature branch, to land
79
+ with the work. Both verdicts commit and skip the integrate, plain `Commit` keeps
80
+ the branch and worktree, and the backlog is found through the tracker. Setting
81
+ the key, to either value, always wins.
82
+
83
+ ## Staging one spec and not another
84
+
85
+ `skitterspec spec-env stage [<spec>] [--json]` splits the uncommitted tree you
86
+ are standing in into what belongs to this spec and what does not. **Owned** is
87
+ the spec's folder in any bucket plus each `spec.companionPaths` entry. Code is
88
+ always **foreign**, because the commits this bounds are the lifecycle ones.
89
+ Nothing here refuses. Commit with the pathspec on both `git add` and
90
+ `git commit`.
@@ -51,8 +51,9 @@ async function main(argv) {
51
51
  // A source package HAS a runnable bin and src, but its assets/ is
52
52
  // PRE-composition (seam markers still literal). Installing from it would
53
53
  // write those markers into the user's skills — refuse before any install
54
- // command runs.
55
- if (cmd === 'init' || cmd === 'update') {
54
+ // command runs. `update --all` installs nothing itself — it runs each
55
+ // project's own bin — so it is not asked.
56
+ if (cmd === 'init' || (cmd === 'update' && !rest.includes('--all'))) {
56
57
  require('../src/init.js').assertComposedAssets()
57
58
  }
58
59
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skitterbyte/skitterspec-github",
3
- "version": "2.18.1",
3
+ "version": "3.1.0",
4
4
  "description": "Spec-driven development for Claude Code, with one-way GitHub sync — a superset of @skitterbyte/skitterspec: the base filesystem workflow plus /spec-status · /spec-push · /spec-claim and the spec-sync CLI, mirroring specs to GitHub Issues, sub-issues and a Projects v2 board, with GitHub Releases. The repo is canonical; GitHub is a generated mirror. Install this OR the base OR one other superset — exactly one.",
5
5
  "keywords": [
6
6
  "claude",
@@ -16,8 +16,7 @@
16
16
  "author": "Reuben Greaves",
17
17
  "type": "commonjs",
18
18
  "bin": {
19
- "skitterspec-github": "bin/skitterspec-github.js",
20
- "skitterspec": "bin/skitterspec-github.js"
19
+ "skitterspec-github": "bin/skitterspec-github.js"
21
20
  },
22
21
  "files": [
23
22
  "bin",
package/src/cli.js CHANGED
@@ -4,7 +4,7 @@ const fs = require('fs')
4
4
  const path = require('path')
5
5
  const os = require('os')
6
6
  const { pathToFileURL } = require('url')
7
- const { execFileSync } = require('child_process')
7
+ const { execFileSync, spawnSync } = require('child_process')
8
8
  const { init, resync, reset, uninstall, disable, enable, checkSync, isExistingSetup, localSeedFiles } = require('./init.js')
9
9
  const {
10
10
  detectReleaseTooling,
@@ -197,7 +197,7 @@ const {
197
197
  const { planPrune, liveSlugsForSpecs, reconcileRegistry } = require('./env/prune.js')
198
198
  const { planIntegrate, planIntegrateCheckout, planIntegratePr, planIntegrateDocs } = require('./env/integrate.js')
199
199
  const { specBranchDocs, preferBranches } = require('./env/specbranches.js')
200
- const { findTarget, planResume, resumeLines, blockingNext } = require('./env/resume.js')
200
+ const { findTarget, planResume, planReopen, resumeLines, reopenLines, blockingNext } = require('./env/resume.js')
201
201
  const { parseRemote, prFor, prPlanCommand, prAbandonCommand, preferRemoteBase } = require('./env/host.js')
202
202
  const { collectDisposition } = require('./env/disposition.js')
203
203
  const { planHandoff } = require('./env/handoff.js')
@@ -286,7 +286,10 @@ Usage:
286
286
  skitterspec update [dir] Resync managed files to the latest, keeping your
287
287
  edits (--force to overwrite). Leaves specs/ + live
288
288
  .core config alone. --check reports what it would
289
- change and writes nothing.
289
+ change and writes nothing. --all updates every
290
+ local install this machine's Claude Code has run
291
+ in, each with its own provider; team installs are
292
+ listed, not written.
290
293
  skitterspec uninstall [dir] Take a local install (init --local) back off this
291
294
  machine: managed files, hooks, the CLAUDE.local.md
292
295
  block, the git excludes. Prints the plan; --yes
@@ -353,6 +356,8 @@ Usage:
353
356
  resume [spec|#N] an in-flight spec: its blockers, and the plan
354
357
  to rebuild its worktree from its branch
355
358
  (prints commands; creates nothing)
359
+ --reopen: a completed spec, re-opened on a
360
+ fresh branch from the base
356
361
  base fetch, list baseBranchPattern matches
357
362
  newest-first, mark the base, and name
358
363
  specs forked from an older match
@@ -486,6 +491,39 @@ function parse(argv) {
486
491
  return { opts, positional }
487
492
  }
488
493
 
494
+ // `update --all`: plan from Claude Code's project list, run each project's own
495
+ // distribution, one line per project. Exit 1 only when an update failed.
496
+ function updateAll() {
497
+ const { planUpdateAll, runUpdateAll } = require('./updateall.js')
498
+ const { readManifest, hasPathInstall } = require('./init.js')
499
+ const git = (dir, args) => {
500
+ try {
501
+ return execFileSync('git', ['-C', dir, ...args], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }).trim()
502
+ } catch {
503
+ return null
504
+ }
505
+ }
506
+ const rows = planUpdateAll({
507
+ dirs: knownDirs(defaultRoot()),
508
+ exists: fs.existsSync,
509
+ git,
510
+ readManifest,
511
+ onPath: (bin) => hasPathInstall(process.env, bin),
512
+ })
513
+ if (!rows.length) {
514
+ process.stdout.write("update --all — no skitterspec installs found in Claude Code's project list\n")
515
+ return 0
516
+ }
517
+ process.stdout.write(`update --all — ${rows.length} project${rows.length === 1 ? '' : 's'}\n`)
518
+ // The run is in the project folder with no dir argument, so no path is ever
519
+ // quoted for a shell — cmd.exe needs the shell to start a `.cmd` shim.
520
+ const run = (bin, _args, cwd) =>
521
+ spawnSync(bin, ['update'], { cwd, encoding: 'utf8', shell: process.platform === 'win32' })
522
+ const { lines, failed } = runUpdateAll(rows, run)
523
+ for (const l of lines) process.stdout.write(`${l}\n`)
524
+ return failed ? 1 : 0
525
+ }
526
+
489
527
  // After an `update`, clean up release tooling left by an older skitterspec (it
490
528
  // now lives in @skitterbyte/skittership). Deletes only on an explicit interactive
491
529
  // "yes" or --remove-release-tooling; a non-TTY/--yes run only prints the pointer,
@@ -4613,12 +4651,14 @@ function specEnvResolve(dir, config, specArg, flags = {}) {
4613
4651
  }
4614
4652
 
4615
4653
  /**
4616
- * `skitterspec spec-env resume <name|#N> [--json]` (feat-spec-resume)
4654
+ * `skitterspec spec-env resume <name|#N> [--reopen] [--json]` (feat-spec-resume)
4617
4655
  *
4618
4656
  * Which in-flight spec the argument means, what it is blocked on, and — where
4619
4657
  * this machine has no worktree for it — the commands that rebuild one from its
4620
4658
  * branch. Plans and prints; creates nothing, moves nothing, asks no tracker.
4621
- * A refusal exits 1.
4659
+ * A refusal exits 1. A completed spec's refusal carries an `offer` of
4660
+ * `--reopen` (feat-resume-reopen), which plans a fresh branch at the base and
4661
+ * the move back to in-progress.
4622
4662
  *
4623
4663
  * Every copy of the spec this clone can see is read — the checkout it runs
4624
4664
  * from, each live worktree, and each spec branch (local, then remote-tracking,
@@ -4695,6 +4735,28 @@ function specEnvResume(dir, config, arg, flags = {}) {
4695
4735
  }
4696
4736
  }
4697
4737
  const worktreePath = ownTree(target.folder)
4738
+ if (flags.reopen) {
4739
+ // Merged means an ancestor of the base: `merge-base --is-ancestor` exits 0
4740
+ // for yes and 1 for no, and the reader returns null for any non-zero exit,
4741
+ // so a git error reads as NOT merged, the side that resets nothing.
4742
+ const merged = (ref) => (base ? git(['merge-base', '--is-ancestor', ref, base]) !== null : null)
4743
+ const localBranch = git(['show-ref', '--verify', '--quiet', `refs/heads/${branch}`]) !== null
4744
+ const remoteBranch = git(['show-ref', '--verify', '--quiet', `refs/remotes/${remote}/${branch}`]) !== null
4745
+ const rr = planReopen(target, {
4746
+ branch,
4747
+ base,
4748
+ remote,
4749
+ worktreePath,
4750
+ worktreeExists: fs.existsSync(worktreePath),
4751
+ localBranch,
4752
+ localMerged: localBranch ? merged(`refs/heads/${branch}`) : null,
4753
+ remoteBranch,
4754
+ remoteMerged: remoteBranch ? merged(`refs/remotes/${remote}/${branch}`) : null,
4755
+ })
4756
+ if (!rr.ok) process.exitCode = 1
4757
+ process.stdout.write(flags.json ? JSON.stringify(rr, null, 2) + '\n' : reopenLines(rr).join('\n') + '\n')
4758
+ return
4759
+ }
4698
4760
  const r = planResume(target, {
4699
4761
  branch,
4700
4762
  worktreePath,
@@ -8188,6 +8250,7 @@ async function specEnv(rest) {
8188
8250
  else if (args[i] === '--assert-primary-clean') flags.assertPrimaryClean = true
8189
8251
  else if (args[i] === '--use-fallback') flags.useFallback = true
8190
8252
  else if (args[i] === '--unpin') flags.unpin = true
8253
+ else if (args[i] === '--reopen') flags.reopen = true
8191
8254
  else positional.push(args[i])
8192
8255
  }
8193
8256
  dir = path.resolve(dir)
@@ -8550,6 +8613,10 @@ async function run(argv) {
8550
8613
  // `update` is a resync — refresh managed files, keep customized ones
8551
8614
  // (--force to overwrite). Leaves specs/ and live .core config alone.
8552
8615
  // `--check` reports what it WOULD change and writes nothing.
8616
+ if (opts.all) {
8617
+ process.exitCode = updateAll()
8618
+ break
8619
+ }
8553
8620
  if (opts.check) {
8554
8621
  checkSync(dir, { claudeMd: opts.claudeMd })
8555
8622
  break
@@ -0,0 +1,43 @@
1
+ 'use strict'
2
+
3
+ // Moving a project's conventions out of the old `spec-planning.md`
4
+ // (feat-rules-budget). Before that spec, the typecheck and test commands lived
5
+ // in a "Project conventions (fill this in)" section inside the managed rule.
6
+ // Filling it in made the whole 66k file "customized", so `update` kept it and
7
+ // the host went on loading all of it every session.
8
+ //
9
+ // `split` cuts that section out. `KNOWN` holds the hash of every shipped
10
+ // version with the section cut out, so a file whose ONLY edits were in that
11
+ // section hashes to a known value, and its edits can be carried over to
12
+ // `project-conventions.md` safely. Any other edit is cannot-tell, and the file
13
+ // is kept (`.claude/rules/negative-checks.md` rule 4).
14
+
15
+ const crypto = require('crypto')
16
+
17
+ const HEADING = /^## Project conventions \(fill this in\)[^\n]*\n/m
18
+
19
+ // `{ rest, body }`: `rest` is the file without the section, `body` the
20
+ // section's text below its heading. `null` when the section is not there.
21
+ function split(text) {
22
+ const t = text.replace(/\r\n/g, '\n')
23
+ const m = HEADING.exec(t)
24
+ if (!m) return null
25
+ const from = m.index
26
+ const after = from + m[0].length
27
+ const next = t.slice(after).search(/^## /m)
28
+ const end = next === -1 ? t.length : after + next
29
+ return { rest: t.slice(0, from) + t.slice(end), body: t.slice(after, end).trim() }
30
+ }
31
+
32
+ function strippedHash(text) {
33
+ const parts = split(text)
34
+ return parts && crypto.createHash('sha1').update(parts.rest).digest('hex')
35
+ }
36
+
37
+ let known = null
38
+ function KNOWN() {
39
+ if (!known) known = new Set(require('./spec-planning-history.json').stripped)
40
+ return known
41
+ }
42
+
43
+ module.exports = { split, strippedHash, KNOWN }