@skitterbyte/skitterspec-github 0.0.0-stage → 1.0.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 (112) hide show
  1. package/MIGRATION.md +1107 -0
  2. package/README.md +53 -2
  3. package/assets/claude-md-section.md +85 -0
  4. package/assets/commands/allow-main.md +33 -0
  5. package/assets/commands/spec-connect.md +13 -0
  6. package/assets/commands/spec-live.md +14 -0
  7. package/assets/commands/spec-remote-review.md +37 -0
  8. package/assets/commands/spec-skip.md +24 -0
  9. package/assets/core/SETUP.md +112 -0
  10. package/assets/core/env.config.json.example +56 -0
  11. package/assets/core/env.config.md +557 -0
  12. package/assets/core/gating.config.json.example +4 -0
  13. package/assets/core/gating.config.md +81 -0
  14. package/assets/core/github.config.json.example +18 -0
  15. package/assets/core/github.config.md +66 -0
  16. package/assets/hooks/main-guard.cjs +162 -0
  17. package/assets/hooks/review-gate.cjs +146 -0
  18. package/assets/review/page.html +3384 -0
  19. package/assets/rules/commit-trailers.md +103 -0
  20. package/assets/rules/negative-checks.md +69 -0
  21. package/assets/rules/offered-unblocks.md +100 -0
  22. package/assets/rules/spec-planning.md +692 -0
  23. package/assets/rules/spec-reports.md +557 -0
  24. package/assets/skills/no-spec/SKILL.md +246 -0
  25. package/assets/skills/spec/SKILL.md +718 -0
  26. package/assets/skills/spec-bug/SKILL.md +646 -0
  27. package/assets/skills/spec-cancel/SKILL.md +263 -0
  28. package/assets/skills/spec-claim/SKILL.md +122 -0
  29. package/assets/skills/spec-complete/SKILL.md +450 -0
  30. package/assets/skills/spec-diff/SKILL.md +870 -0
  31. package/assets/skills/spec-github-setup/SKILL.md +236 -0
  32. package/assets/skills/spec-hotfix/SKILL.md +668 -0
  33. package/assets/skills/spec-init/SKILL.md +178 -0
  34. package/assets/skills/spec-list/SKILL.md +172 -0
  35. package/assets/skills/spec-next/SKILL.md +685 -0
  36. package/assets/skills/spec-push/SKILL.md +307 -0
  37. package/assets/skills/spec-review/SKILL.md +258 -0
  38. package/assets/skills/spec-reviewed/SKILL.md +284 -0
  39. package/assets/skills/spec-start/SKILL.md +554 -0
  40. package/assets/skills/spec-status/SKILL.md +112 -0
  41. package/assets/skills/spec-sync/SKILL.md +226 -0
  42. package/assets/skills/spec-to-main/SKILL.md +139 -0
  43. package/bin/skitterspec-github.js +61 -0
  44. package/package.json +41 -4
  45. package/src/cli.js +5901 -0
  46. package/src/deprecate.js +138 -0
  47. package/src/env/bootstrap.js +188 -0
  48. package/src/env/building.js +143 -0
  49. package/src/env/classify.js +176 -0
  50. package/src/env/commitcmd.js +108 -0
  51. package/src/env/config.js +753 -0
  52. package/src/env/dev.js +63 -0
  53. package/src/env/hooks.js +226 -0
  54. package/src/env/hotfix.js +411 -0
  55. package/src/env/hotfixland.js +302 -0
  56. package/src/env/integrate.js +126 -0
  57. package/src/env/live.js +504 -0
  58. package/src/env/mainguard.js +299 -0
  59. package/src/env/provision.js +466 -0
  60. package/src/env/proxy.js +192 -0
  61. package/src/env/prune.js +119 -0
  62. package/src/env/registry.js +159 -0
  63. package/src/env/render.js +17 -0
  64. package/src/env/resolve.js +716 -0
  65. package/src/env/review.js +2577 -0
  66. package/src/env/reviewers/coderabbit.js +228 -0
  67. package/src/env/reviewers.js +517 -0
  68. package/src/env/serve.js +1044 -0
  69. package/src/env/supervise.js +157 -0
  70. package/src/env/teardown.js +248 -0
  71. package/src/env/trust.js +87 -0
  72. package/src/gating.js +155 -0
  73. package/src/init.js +1150 -0
  74. package/src/lines-diff.js +114 -0
  75. package/src/prompts.js +129 -0
  76. package/src/vendor/github/api.js +786 -0
  77. package/src/vendor/github/cli-sync.js +1530 -0
  78. package/src/vendor/github/commands.js +44 -0
  79. package/src/vendor/github/config.js +414 -0
  80. package/src/vendor/github/credentials.js +109 -0
  81. package/src/vendor/github/dialect.js +62 -0
  82. package/src/vendor/github/identity.js +38 -0
  83. package/src/vendor/github/mcp.js +85 -0
  84. package/src/vendor/provider-kit/index.js +41 -0
  85. package/src/vendor/provider-kit/src/adapter.js +23 -0
  86. package/src/vendor/provider-kit/src/apply.js +207 -0
  87. package/src/vendor/provider-kit/src/args.js +68 -0
  88. package/src/vendor/provider-kit/src/assignment.js +277 -0
  89. package/src/vendor/provider-kit/src/config.js +198 -0
  90. package/src/vendor/provider-kit/src/credentials.js +404 -0
  91. package/src/vendor/provider-kit/src/doctor.js +35 -0
  92. package/src/vendor/provider-kit/src/http.js +63 -0
  93. package/src/vendor/provider-kit/src/identity.js +93 -0
  94. package/src/vendor/provider-kit/src/md-compare.js +39 -0
  95. package/src/vendor/provider-kit/src/md-tables.js +94 -0
  96. package/src/vendor/provider-kit/src/prompt.js +50 -0
  97. package/src/vendor/provider-kit/src/released.js +269 -0
  98. package/src/vendor/provider-kit/src/releases.js +380 -0
  99. package/src/vendor/provider-kit/src/specs.js +166 -0
  100. package/src/vendor/provider-kit/src/transport.js +22 -0
  101. package/src/vendor/sync-core/index.js +93 -0
  102. package/src/vendor/sync-core/src/base.js +81 -0
  103. package/src/vendor/sync-core/src/compare.js +338 -0
  104. package/src/vendor/sync-core/src/dialect.js +51 -0
  105. package/src/vendor/sync-core/src/fields.js +36 -0
  106. package/src/vendor/sync-core/src/legacy.js +100 -0
  107. package/src/vendor/sync-core/src/normalize.js +998 -0
  108. package/src/vendor/sync-core/src/push.js +85 -0
  109. package/src/vendor/sync-core/src/retarget.js +278 -0
  110. package/src/vendor/sync-core/src/task-block.js +308 -0
  111. package/src/vendor/sync-core/src/verify.js +67 -0
  112. package/src/vendor/sync-core/src/write.js +191 -0
@@ -0,0 +1,668 @@
1
+ ---
2
+ name: spec-hotfix
3
+ description: Fix a production bug on the exact released version — fork a worktree from a release tag, drive it red→green, then land it by cutting the release, pushing it on consent, and carrying the fix onto main. ALWAYS starts from a base tag and works on the hotfix's own branch, never on main. Use when the user says "/spec-hotfix", "hotfix <tag>", "prod is broken on <version>", "patch the released version", or needs a fix shipped against a tagged release rather than main.
4
+ ---
5
+
6
+ # /spec-hotfix — fix a released version, release it, carry it back to main
7
+
8
+ > Stay silent while this runs — speak only to ask something you cannot answer
9
+ > yourself, or to report a failure at the moment it happens. Read
10
+ > `.claude/rules/spec-reports.md` before reporting; it defines the block this
11
+ > skill ends with.
12
+
13
+ This is the **hotfix** counterpart to `/spec-bug`. Same test-first discipline
14
+ (reproduce as a **failing test (RED)**, then drive to **GREEN**), but the base is
15
+ a **release tag**, not `main`: prod is running a tagged version, so the fix must
16
+ be built on **that** commit line, shipped as a **new patch tag** (your CI/CD
17
+ deploys tags), and only then cherry-picked onto `main` for the next release.
18
+
19
+ Spec type convention (see `.claude/rules/spec-planning.md`):
20
+ - Hotfix specs are named `hotfix-<kebab-name>`; every header carries
21
+ `> **Type:** Hotfix` and `> **Base version:** <tag>`.
22
+ - Branch is `hotfix/<slug>`, forked from the base tag.
23
+
24
+ **Isolation is required.** A hotfix forks a worktree from a tag and lands by
25
+ tag + cherry-pick — it needs the isolation engine (`specs/.core/env.config.json`).
26
+ If isolation is absent, say so and stop; there is no in-place path.
27
+
28
+ ## Phase 0 — start from a GitHub issue (only when asked)
29
+
30
+ **Only when `specs/.core/github.config.json` exists** *and* the invocation names an
31
+ issue. Otherwise skip this phase entirely and grill from the user's own words.
32
+
33
+ Two ways in:
34
+
35
+ - **`<ISSUE-REF>`** (`#123`, an issue URL, or a bare `#N` anywhere in the
36
+ arguments) — adopt that issue.
37
+ - **`--from-issue [query]`** — browse the intake inbox:
38
+ `skitterspec spec-sync intake [query] --json` lists the open issues carrying
39
+ `intake.label` that no spec has adopted and that are not spec or phase issues
40
+ themselves, each with the skill its labels route it to. `query` filters titles
41
+ case-insensitively. Show the shortlist and let the user pick one. Without a
42
+ token it says so and exits 0 — fall back to `list_issues` over MCP.
43
+
44
+ Then:
45
+
46
+ 1. **Exclude what's already adopted.** Run `skitterspec spec-sync linked --json`
47
+ and drop any issue whose identifier is already stamped on a spec. If the user
48
+ named such an issue directly, **stop** and point them at that spec — one issue
49
+ never becomes two specs.
50
+ 2. **Read the issue** with the discovered issue-read tool (`issue_read`):
51
+ title, description, labels, reporter, URL. If GitHub isn't connected, say so
52
+ and offer to carry on without it — a spec written from the user's own
53
+ description is still a spec.
54
+ 3. **Route the issue to the right skill.** Match the issue's labels
55
+ (case-insensitively) against two lists, **checking `hotfixLabels` first**:
56
+
57
+ - **`intake.hotfixLabels`** → this is broken in **production**, so it needs a
58
+ fix against the released version, not `main`. Say so, name the matching
59
+ label, and tell the user to run **`/spec-hotfix <ISSUE-REF>`** — then stop.
60
+ - **`intake.bugLabels`** → a bug report, not a feature request. Say so, name
61
+ the label, and tell the user to run **`/spec-bug <ISSUE-REF>`** — then stop,
62
+ without authoring a Feature spec.
63
+
64
+ **Hotfix wins when an issue carries both**, and deliberately: production is the
65
+ more specific destination, and the two mistakes are not equally costly. Routing
66
+ a prod issue to `/spec-bug` produces a fix that lands on `main` and never
67
+ reaches the running version — discovered only when someone asks why it hasn't
68
+ shipped. The reverse is a hotfix branch for something that could have waited,
69
+ which is merely wasteful.
70
+
71
+ With a list unset, nothing routes through it; with both unset every issue is
72
+ treated as a feature request, exactly as before.
73
+
74
+ **Which checks run depends on where you are**, because a skip is about not
75
+ bouncing someone to the skill they are already in — not about ignoring an
76
+ escalation:
77
+
78
+ - **In `/spec`** — both checks run.
79
+ - **In `/spec-bug`** — the bug check is skipped (it would route you to
80
+ yourself), but the **hotfix check still runs**. A bug report labelled for
81
+ production is not "already handled" by being in the bug path: `/spec-bug`
82
+ fixes on `main`, and prod would stay broken. Say so and hand off.
83
+ - **In `/spec-hotfix`** — both are skipped. It is already the most specific
84
+ destination; there is nowhere left to route.
85
+
86
+ Then adopt the issue and reproduce it as usual: the issue body is your repro
87
+ material, and the failing test comes before the spec exactly as normal.
88
+ 4. **Seed, don't skip, the grill.** The issue's title becomes the working spec
89
+ title and its description the starting material for **Problem** — or
90
+ **Symptom** in a bug or hotfix spec, which is where a report belongs. Quote the
91
+ reporter's words rather than paraphrasing them away. Note the reporter and the
92
+ issue URL for context. Everything after this runs exactly as normal: an issue
93
+ is a *request*, not a groomed spec, so grill it as hard as anything else.
94
+
95
+ **In `/spec-hotfix`, also mine the issue for a version.** Any release-shaped
96
+ string in the report is a *suggestion* for the base tag, offered when the skill
97
+ asks which version prod is running — never used as a default. The reporter's
98
+ version is the one they saw the bug on, which is often not what is deployed.
99
+
100
+ ### Adopting the issue
101
+
102
+ The issue **becomes** the spec's issue — it is not copied and no second issue is
103
+ minted. This is identical in `/spec`, `/spec-bug` and `/spec-hotfix`; only *when*
104
+ it happens differs (`/spec` writes the spec in Phase B, `/spec-bug` in its step 4,
105
+ `/spec-hotfix` in its step 5). Once the spec file exists:
106
+
107
+ - **Stamp `github_identifier` and `github_url`** in `00-overview.md` frontmatter
108
+ from the adopted issue. That is the whole link: every later skill
109
+ (`/spec-push`, `/spec-status`, `/spec-start`) keys off it being present.
110
+ - **Adoption is not a mint.** The issue was filed somewhere deliberately — it
111
+ stays where it is, and nothing moves it to another repo or board.
112
+ - **Do not write a base sidecar.** Leaving `sync.baseDir` empty for this spec is
113
+ what makes the **linking push** send the spec over the reporter's original
114
+ description (an **update** to the existing issue, plus a sub-issue per phase).
115
+ Recording a snapshot here would declare the mirror already in sync and strand
116
+ the issue showing the raw report forever.
117
+ - **Preserve the original, before anything replaces it.** Run this the moment
118
+ the spec file exists and **before the linking push**:
119
+
120
+ ```
121
+ skitterspec spec-sync preserve <spec>
122
+ ```
123
+
124
+ It posts the issue's current description onto the issue as a comment — the one
125
+ surface one-way sync never touches, so no push can clobber it. On the API path
126
+ it reads the description itself; without credentials it prints the body and
127
+ the marker, and you post it with the discovered GitHub comment tool after
128
+ checking the comments for that marker.
129
+
130
+ **The ordering is the whole correctness condition.** Run before the push, this
131
+ keeps what the reporter filed. Run after it, it would keep the generated spec
132
+ and report success — which is why it is a step of its own here rather than a
133
+ line in the push sequence. The engine warns when it can tell it is late, but it
134
+ cannot always tell.
135
+
136
+ **It never fails the adoption.** A project that set
137
+ `intake.preserveOriginal: false`, an unreachable GitHub, an issue with no
138
+ description, a comment GitHub refused — every one of them exits 0 and says so.
139
+ Relay what it printed and carry on.
140
+ - **Say what will happen** in the finish-up message. The linking step runs right
141
+ after the spec is written, so the issue's description is replaced by the spec
142
+ **then** — not on some later manual push. Say both halves: the description
143
+ becomes the spec, **and** the original is preserved as a comment on the same
144
+ issue, so the reporter can still read what they wrote.
145
+
146
+ **Do not send anyone to the issue's history for it.** This used to say the
147
+ tracker keeps the original there, and that is true and useless: history is a
148
+ diff viewer nobody opens, it is not quotable, and it degrades to "it is in
149
+ there somewhere". The comment is the answer, and the other half is the spec's
150
+ own **Problem** (or **Symptom**) section quoting the reporter.
151
+
152
+ ## 1. Establish the base version (the tag)
153
+
154
+ - **Read the arguments.** `/spec-hotfix <tag> <name>` (e.g.
155
+ `/spec-hotfix v33.16.4 login-crash`). An argument shaped like an issue
156
+ reference — letters, a hyphen, digits (`SKI-123`) —
157
+ is **always a reference, never a name**, so `/spec-hotfix v33.16.4 SKI-123` and
158
+ `/spec-hotfix SKI-123`
159
+ both mean "adopt that issue". Release tags don't take that shape, so the two
160
+ can't be confused. With no name and no reference, ask what to call it.
161
+ - Take the release tag from the argument. If it's missing,
162
+ **ask which version prod is running** — don't guess. When an issue was adopted
163
+ above, **offer any versions it mentions** as suggestions — clearly labelled as
164
+ the reporter's words, not a default — and still wait for the answer. A reporter
165
+ usually names
166
+ the version they *saw* the bug on, which is not necessarily what is deployed,
167
+ and a hotfix forked from the wrong tag fails late.
168
+ **A hotfix tag is a valid base**: prod may be running `v36.4.0-hotfix.2`, and a
169
+ hotfix on it continues that line (`-hotfix.3` under `hotfix.bump:
170
+ "hotfix-suffix"` or skittership's release).
171
+ - **Verify the tag exists** before anything else:
172
+ `git rev-parse --verify <tag>^{commit}`. If it doesn't resolve, stop and ask.
173
+
174
+ ## 2. Reproduce & isolate (light investigation)
175
+
176
+ Hotfixes are concrete — confirm, don't over-grill. Establish:
177
+
178
+ - **Repro:** exact steps / input that triggers it on the released version.
179
+ - **Expected vs actual:** what *should* happen vs what does.
180
+ - **Root cause:** read the code **at the base tag** and trace it to `file:line`.
181
+ The fix belongs on the tag's line, so reason about that code, not `main`'s.
182
+
183
+ ## 3. Provision the worktree from the tag, then write in it
184
+
185
+ **Provision before you write, not after.** §1 settled the tag and the name and
186
+ §2 put nothing on disk, so this is the one moment where a worktree costs nothing
187
+ to obtain and everything — the red test, the fix, the spec — is still ahead of
188
+ it:
189
+
190
+ ```
191
+ skitterspec spec-env up hotfix-<name> --docs --from <tag>
192
+ ```
193
+
194
+ **`--from` is how the tag reaches the engine, and it is not the header twice.**
195
+ Everywhere else `up` forks a hotfix from the spec's own
196
+ `> **Base version:**` line — but here the spec that would carry it does not
197
+ exist yet, which is the whole of what this lane is for. Without the flag the
198
+ branch would fork from `main`: the fix gets written against code prod is not
199
+ running, while the tag and the cherry-pick downstream go on believing it is on
200
+ the release line, and nothing says otherwise until someone asks why the patch
201
+ did not take. The engine refuses a ref git does not know rather than forking
202
+ from somewhere else quietly; where git cannot answer at all it passes the ref
203
+ through to `git worktree add`, which refuses far more loudly than a planner
204
+ guessing from an absence.
205
+
206
+ Run what it prints — the `git worktree add … -b hotfix/<slug> <tag>` is checked
207
+ out **at the tag**, not at `main`, and the
208
+ `skitterspec spec-env bootstrap hotfix-<name> --docs` under `then, run:` where
209
+ there is one — then move this session into the worktree
210
+ with a plain `cd`; the Bash working directory persists between calls, so from
211
+ here on the test, the fix and the spec are all written on the hotfix's own
212
+ branch. Confirm the move landed rather than reading silence as success
213
+ (`.claude/rules/negative-checks.md` rule 1): `skitterspec spec-env resolve` with
214
+ no argument must name this spec. If it does not, say so and stop rather than
215
+ writing into a tree you cannot name.
216
+
217
+ **Then run `up` again, without the flags:**
218
+
219
+ ```
220
+ skitterspec spec-env up hotfix-<name>
221
+ ```
222
+
223
+ `--docs` skips the `setup` commands — everything whose only purpose is making a
224
+ tree *runnable* — because provisioning somewhere to write markdown should cost a
225
+ `git worktree add` and nothing else. A hotfix has no `/spec-start` to leave them
226
+ to: §4 runs the project's suite in this same tree, and
227
+ **a tree that cannot run the suite cannot go red**.
228
+ The flagless re-run re-attaches the worktree that now exists (no second `-b`
229
+ fork, and no fork point — the branch is already on the tag's line) and prints
230
+ `skitterspec spec-env bootstrap hotfix-<name>` — run it, and it runs the steps
231
+ the flag deferred.
232
+
233
+ **The worktree steps are the engine's to run, never yours.** Seeding the
234
+ gitignored files, the env file, `setup` and the stack all happen inside
235
+ `skitterspec spec-env bootstrap <name>` — one call that names no file. Do not
236
+ reconstruct them as shell: they used to be printed that way, an agent's copy was
237
+ never faithful, and a project's secrets hook refused every rewrite that named a
238
+ `.env` path. `bootstrap --plan` says what it would do, for reading only.
239
+
240
+ **Why nothing is seeded on the base branch, and nothing is moved.** This step
241
+ used to write `specs/in-progress/hotfix-<name>/00-overview.md` in the primary
242
+ checkout for the engine to resolve, and then `mv` the folder across into a
243
+ worktree checked out at a tag — a move with a hazard paragraph of its own, since
244
+ `specs/in-progress/` is usually absent at an old release tag. Both halves are
245
+ gone. `main` is where work **lands**, not where it happens: where the project
246
+ installs `.claude/hooks/main-guard.cjs` that first write is refused outright,
247
+ and a step whose documented opening the repo will not perform is not a step. The
248
+ spec is written in the worktree at §5, on the branch it belongs to.
249
+
250
+ **§5 records the same tag you passed to `--from`**, on the spec's
251
+ `> **Base version:**` header. That is not bookkeeping: `/spec-complete` cuts the
252
+ release and carries the fix off the header, so a worktree forked from one ref and
253
+ a header naming another is this whole bug again with the halves swapped.
254
+
255
+ - **Bootstrap the worktree.** A fresh worktree has no installed dependencies and
256
+ none of the repo's gitignored files (`.env`, local overrides). Run the printed
257
+ `in the worktree, run:` steps (file seeding, then `setup`) in order, before
258
+ anything else.
259
+ - **Trust the worktree for this session.** The engine wrote the printed
260
+ `trusted:` root into `.claude/settings.local.json`, but it won't hot-reload now
261
+ — run `/add-dir <trusted root>` before editing into the worktree, or the first
262
+ edits will prompt.
263
+ - **Do everything below in the worktree**, on the `hotfix/<slug>` branch — the red
264
+ test, the fix, and the rest of the spec. The `cd` above is what makes that the
265
+ default rather than something to remember; where a step has to reach out of
266
+ the tree, use an absolute path or `git -C <worktreePath>`. `main` changes
267
+ only at `/spec-complete` (via cherry-pick, not merge).
268
+
269
+ ## 4. Write the failing test FIRST (RED) — mandatory
270
+
271
+ Encode the **correct** (expected) behaviour as a test, then run it and confirm it
272
+ **fails for the right reason**, on the hotfix branch:
273
+
274
+ - Put it where the suite already covers that area. Reuse existing test helpers /
275
+ factories; follow the project's test rules (see `.claude/rules/`). Never
276
+ hardcode dates — compute them relative to now.
277
+ - Run it with the project's test command. Quote the red output. A test that
278
+ passes before the fix proves nothing — keep refining until it genuinely
279
+ captures the bug on this version.
280
+
281
+ ## 5. Write the Hotfix spec
282
+
283
+ Write `00-overview.md` in the worktree — §3 provisioned it at the tag and moved
284
+ you there, so create the folder and write it here. A hotfix
285
+ is usually a single-pass fix, so the `## Fix` block can live directly in
286
+ `00-overview.md`. Keep it lean:
287
+
288
+ ```markdown
289
+ # Hotfix: <short title>
290
+
291
+ > **Type:** Hotfix
292
+ > **Name:** hotfix-<kebab-name> (the spec folder name — the handle you paste into `/spec-start`)
293
+ > **Status:** In Progress — fixing (red test added)
294
+ > **Author:** <git user.name — who reported/captured it>
295
+ > **Developer:** <git user.name — you, since you're fixing it now>
296
+ > **Base version:** <tag prod is running, e.g. v33.16.4>
297
+ > **Raised:** <YYYY-MM-DD (today)>
298
+ > **Area:** <files/modules>
299
+ > **Gating:** <pre-filled "none: hotfix — restoring released behaviour"; only
300
+ > when release gating is configured, and overridable — see below>
301
+
302
+ ## Symptom
303
+
304
+ <observed wrong behaviour on the released version + repro steps; paste any error>
305
+
306
+ ## Root cause
307
+
308
+ <the actual cause, at `file:line` on the base tag. One paragraph — be specific.>
309
+
310
+ ## Failing test (red)
311
+
312
+ <test name + path; what it asserts. How to run it. Paste the red failure line.>
313
+
314
+ ## Fix
315
+
316
+ - [ ] <the minimal change that addresses the root cause, not the symptom>
317
+ - [ ] Failing test now passes (GREEN); run the project's typecheck and test
318
+ commands — confirm no regressions.
319
+ - [ ] <any follow-up hardening, or "None">
320
+
321
+ ## Impact
322
+
323
+ <The concrete surfaces this spec touches — the scannable blast radius, so a
324
+ reader can eyeball where the spec got something wrong without reading prose.
325
+ `Change` is `add` · `update` · `remove`. `Surface` is guided-but-open: use
326
+ values like Endpoint, Route/UI, Schema/model, DB table/migration, Domain object,
327
+ Service, CLI command, Config key, Skill/rule, Business rule — or whatever fits
328
+ this project (skitterspec itself is a CLI with no HTTP surface). Keep `Detail`
329
+ terse — names/signatures, not sentences. List **only** surfaces that actually
330
+ change; the heading is always present, but if nothing external changes write the
331
+ single line below instead of an empty table.>
332
+
333
+ <A hotfix should be minimal — often no external surface changes; that's
334
+ fine, use the one-liner.>
335
+
336
+ | Surface | Change | Detail |
337
+ |---------|--------|--------|
338
+ | <e.g. Endpoint> | update | <e.g. GET /orders (fix null total)> |
339
+
340
+ <_No external surface changes — internal refactor only._ — use this line in
341
+ place of the table when the spec touches no external surface.>
342
+
343
+ ## Landing
344
+
345
+ - [ ] Release cut at `/spec-complete` (`hotfix.releaseWith`, else the
346
+ `hotfix.bump` tag) and pushed — branch, then tag — on your say-so, which
347
+ triggers CI/CD.
348
+ - [ ] Fix carried onto `main` without the version commit (and tagged onto any
349
+ `--also` release lines).
350
+ - [ ] Deploy confirmed, then `/spec-complete` again to run `hotfix finish`.
351
+
352
+ ## State log
353
+
354
+ | Date | Status | Folder | By |
355
+ |------|--------|--------|----|
356
+ | <YYYY-MM-DD> | In Progress | in-progress | <developer> |
357
+
358
+ ## Changelog
359
+
360
+ - <YYYY-MM-DD> — Hotfix reproduced on <tag>; failing test added (red).
361
+ ```
362
+
363
+ Keep the **State log** (state transitions) separate from the **Changelog** (fix
364
+ narrative and decisions).
365
+
366
+ **Only when `specs/.core/github.config.json` exists** (GitHub sync is opted in).
367
+ If it's absent, skip this entirely — the spec stays local-only and the skill
368
+ behaves exactly as above. When present, link the spec you just wrote so status
369
+ and discussion live in GitHub while the repo stays the source of truth. A spec is
370
+ a GitHub **issue**; each phase is a **sub-issue**, carrying that phase's tasks in
371
+ its description as a read-only checklist.
372
+
373
+ **Linking is just the first push**, so it runs the same engine path `/spec-push`
374
+ does — you never create the issue by hand:
375
+
376
+ 1. **Pick the transport.** `skitterspec spec-sync states --json`. With a GitHub
377
+ token set it answers `api` and prints the board's Status options; without
378
+ one it answers `mcp` and you do the MCP work `/spec-push` describes. Write
379
+ the option names to a file for step 2.
380
+ 2. **Get the plan.**
381
+ `skitterspec spec-sync plan <spec> --workspace-states <file> --json > plan.json`
382
+ — the spec is unlinked, so this plan is all-creates: the issue and one
383
+ sub-issue per phase.
384
+ 3. **Apply it.**
385
+ `skitterspec spec-sync apply <spec> --plan plan.json`. There is no project
386
+ to pick: the issue lands in the configured repo, on the configured board.
387
+ That creates the issue and its sub-issues, adds each to the board with its
388
+ Status, and checks what GitHub stored. It then
389
+ **stamps the numbers into the spec** — `github_identifier`/`github_url` on the
390
+ overview, `github_issue_id` on each phase — and **records the base snapshot**,
391
+ so `/spec-status` reports in-sync immediately. There is no hand-editing of
392
+ frontmatter and no separate `stamp` or `record` call.
393
+
394
+ If it prints `transport = mcp`, it wrote nothing: apply the plan over MCP as
395
+ `/spec-push` steps 4a–5 describe, ending with `spec-sync stamp` and
396
+ `spec-sync record`. That path is fully supported — it is what anyone without
397
+ credentials uses.
398
+ 4. **Echo the branch name** from `branch.pattern` so the user knows what
399
+ `/spec-start` will fork.
400
+
401
+ **If GitHub can't be reached**, say so in one line and leave the spec written and
402
+ local — it is still a perfectly good spec, and `/spec-push` links it later. Do
403
+ nothing destructive.
404
+
405
+ **A spec that adopted an existing issue** (see the intake step) is already
406
+ stamped, so its plan is an **update**, not a create: applying it replaces the
407
+ reporter's description with the spec. That is the one-way rule working as
408
+ intended — the repo is canonical, and the original was preserved as a comment
409
+ on the issue by the intake step. Nothing re-homes an adopted issue: where it
410
+ lives stays GitHub's.
411
+
412
+ Leave committing to the existing convention (the user commits the spec as usual)
413
+ and **never auto-push git** — GitHub's own automation reacts to real branch/PR
414
+ events later. Report the GitHub issue URL as part of the skill's finish-up
415
+ message.
416
+
417
+ **Only when all three hold**: `specs/.core/github.config.json` exists, the repo
418
+ **owns** `assignee` in its `sync.fieldOwnership`, and the spec carries a
419
+ `github_identifier`. Any one missing → skip this step silently and carry on; a
420
+ project that declined must see no trace of assignment.
421
+
422
+ Ownership is the **value**, not the key: `assignee` is owned by default, and
423
+ `"none"` is how a project declines it. Testing whether the key is *present* would
424
+ read as opted-in everywhere, since the default puts it in every config.
425
+
426
+ **Never blocks, never fails the skill.** Everything below is best-effort: the
427
+ branch is provisioned and the spec is moving either way, and an unassigned issue
428
+ is a cosmetic gap that `/spec-claim` closes later.
429
+
430
+ 1. **Work out who you are.** Run `skitterspec spec-sync whoami --json`.
431
+ - `ok: true` → use `id` and `name`. Nothing to ask.
432
+ - `source: "mcp"` or the command reports no token → call the discovered
433
+ `get_me` tool, then cache its login:
434
+ `skitterspec spec-sync whoami --set <id> --name "<name>"`.
435
+ - `ok: false` → identity is **unknown**, which is an ordinary state (a shared
436
+ or bot key, an offline machine). Go to step 2.
437
+ 2. **Unknown identity — three states, not two.** Decide by what is actually
438
+ reachable, and route the third to inaction:
439
+ - **GitHub reachable *and* this is an interactive session** → offer a short
440
+ user search (`skitterspec spec-sync users <name-or-email>`, or the
441
+ user-list tool on MCP), let the operator pick, and offer to cache it with
442
+ `whoami --set` so this is asked once per machine rather than once per spec.
443
+ - **Not reachable, or not interactive** → say so in one line
444
+ (`assignment skipped — no GitHub identity`) and **carry on**. Do not prompt
445
+ for something you could not act on, and never stall a `/spec-start` on it.
446
+ 3. **Record it on the spec** — through the engine, never by hand-editing
447
+ frontmatter:
448
+
449
+ ```
450
+ skitterspec spec-sync assign <spec> --to <login> --name "<display name>"
451
+ ```
452
+
453
+ 4. **Leave `> **Developer:**` as `git config user.name`** — the step above this
454
+ seam already set it, and this seam must not overwrite it with the tracker's
455
+ display name.
456
+
457
+ Those two names are the same person and often not the same string, and the
458
+ git one is the one everything else in the spec already uses: `Author:`, every
459
+ **State log** `By` row, and every commit. Writing the tracker's name into this
460
+ one field would leave a spec whose own audit trail contradicts its header —
461
+ a worse problem than the one it would solve. Anyone wanting a different name
462
+ on their specs sets `git config user.name`, and it stays consistent
463
+ everywhere.
464
+
465
+ The header names **who is building this**; the stamp in step 3 names
466
+ **which tracker account it is assigned to**. They answer different questions,
467
+ so they need not be the same string. The one place that reasoning does not hold
468
+ is handing a spec to *someone else* — there is no local git name for them —
469
+ and that case belongs to `/spec-claim --to`, which sets the header from the
470
+ tracker deliberately.
471
+
472
+ **Nothing is pushed here.** `assign` writes the repo only, and the refresh these
473
+ skills already run sends it. Assignment is an ordinary field of the projection,
474
+ not a side errand with its own network call.
475
+
476
+ **There is no unassign step anywhere.** The projection derives the assignee from
477
+ the spec's lifecycle bucket, so `/spec-complete` and `/spec-cancel` release the
478
+ issue through the push they already make. The stamp deliberately stays in the
479
+ file: who actioned the work outlives who is currently holding it.
480
+
481
+ GitHub has no project picker: a minted issue lands in the configured
482
+ `github.owner`/`github.repo`, on the one board `github.project` names — both
483
+ decided once in `specs/.core/github.config.json`. There is nothing to ask.
484
+
485
+ ### Release gating (only when configured)
486
+
487
+ **Only when `specs/.core/gating.config.json` exists.** A hotfix is the one spec
488
+ type that does **not** ask the question cold: it writes
489
+ `none: hotfix — restoring released behaviour` and asks only for confirmation.
490
+
491
+ The default differs on purpose. A hotfix restores behaviour a release already
492
+ had, under time pressure, and the fix is captured by a deploy tag rather than
493
+ riding the next release — so a flag has nothing to gate and nothing to roll back
494
+ to. Making someone answer a design question mid-incident buys nothing.
495
+
496
+ It is a **default, not a rule**: say what you are writing and let the user
497
+ override it. If they name a flag, record that instead. Skip entirely when the
498
+ config is absent.
499
+
500
+ ## 6. Drive to GREEN
501
+
502
+ - Implement the **minimal, root-cause** fix on the branch. Match surrounding code;
503
+ honour all project rules (see `.claude/rules/`).
504
+ - Re-run the failing test → it must pass. Then run the project's typecheck and
505
+ test commands to confirm no regressions. Quote results.
506
+ - Commit the fix to the `hotfix/<slug>` branch (this commit is what gets tagged
507
+ and cherry-picked). Tick the Fix tasks; add a Changelog line.
508
+
509
+ **Then refresh the mirror (only if a provider is installed).** The Fix tasks are
510
+ ticked, so the repo is now the truth about this fix — and this skill can take a
511
+ bug all the way to green without `/spec-next` ever running. Without a provider this
512
+ is a no-op.
513
+
514
+ **Only when `specs/.core/github.config.json` exists** and the spec carries a
515
+ `github_identifier`. Either missing → **skip**, in one line
516
+ (`not linked to GitHub — /spec-push to mirror it`), and carry on.
517
+
518
+ **Refresh the mirror now, without asking.** Run `/spec-push`. The repo has just
519
+ become the truth about this phase's progress, and progress is what the mirror
520
+ exists to show. Deferring it to `/spec-complete` is what makes every phase
521
+ sub-issue jump from To Do straight to Done, with nothing visible in between.
522
+
523
+ - **Never mint.** An unlinked spec is skipped, not created.
524
+ - **Never fatal.** If the push fails — offline, no credentials, a GitHub error —
525
+ say so and **finish the operation anyway**. The phase is done in the repo
526
+ regardless; the mirror is disposable and the next push repairs it.
527
+ - **Expect a dirty `specs/.core/` afterwards.** The push writes a base snapshot
528
+ and stamps any new keys, and these skills do not commit. The next `/commit`
529
+ sweeps it up with the phase's own work.
530
+ - **Say what happened** in the skill's report: mirror updated, skipped as
531
+ unlinked, or failed with the reason.
532
+
533
+ ## 6b. Render the page, arm the gate, then wait for the verdict
534
+
535
+ **Only when the project has per-spec isolation** (`specs/.core/env.config.json`
536
+ present). Without it there is no worktree to read and this step does not exist —
537
+ skip it in silence rather than explaining an absence.
538
+
539
+ The fix is green and nothing is committed yet. That is the moment the page is
540
+ about, so render it now — **after** the tests pass and **before** the commit:
541
+
542
+ ```
543
+ skitterspec spec-env review <spec> --buttons fix
544
+ ```
545
+
546
+ **This is free.** The engine reads git and splices the patches into a template;
547
+ the diff never passes through you, so a 266KB patch costs nothing.
548
+
549
+ **`--buttons fix` drops `Commit & Continue`**, because a hotfix has no next
550
+ phase for `/spec-next` to build and that verb would name work which does not
551
+ exist. There is no exception to this the way there is in `/spec-bug`: a hotfix
552
+ is a single pass against a released tag by construction, so it never has phase
553
+ files and the flag is unconditional here.
554
+
555
+ **Then arm the gate**, so the fix now owes a verdict:
556
+
557
+ ```
558
+ skitterspec spec-env review arm <spec>
559
+ ```
560
+
561
+ **Then wait**, and `/spec-next` §5 owns the sequence — follow it there rather
562
+ than reading a second copy here: note the moment you start waiting, watch the
563
+ pending store, end your turn, and let `--claim-since` pick the one pass that
564
+ arrived inside the window. The banner it describes is what this skill emits in
565
+ place of a `Review` row, and the routing on the verdict is `/spec-diff` §2 and
566
+ §4, as it is everywhere.
567
+
568
+ **Why this skill arms as well as waits.** Waiting is what any offer does;
569
+ **arming** asserts an obligation that outlives the turn, and belongs only to
570
+ work that is finished. A hotfix is a completed unit — red→green against a
571
+ released tag — so it qualifies, and a wait with nothing owed behind it is a
572
+ suggestion rather than a gate.
573
+
574
+ **A hotfix is the case where reading it matters most.** This change is about to
575
+ be tagged and shipped to production from a release line, not merged into a
576
+ branch someone else will read first. The verdict is the only review it gets.
577
+
578
+ **It is user-visible, and that is deliberate.** Once armed, a `git commit` in
579
+ this worktree is refused until a verdict is sent or
580
+ `skitterspec spec-env review skip "<reason>"` records the decision to move on.
581
+ The exit is always one command, and one of them is *"I am moving on"*.
582
+
583
+ Relay the engine's **stack** — the `local:`, `network:` and `remote:` lines, all
584
+ three — rather than the bare `page:` path: a path is not clickable in any
585
+ terminal, and a page nobody can open is a page nobody reads. Relay the `live:`
586
+ line with it where the engine printed one, and nothing where it did not.
587
+ `.claude/rules/spec-reports.md` carries the shape, including why a rigid
588
+ contract took that line.
589
+
590
+ - **Never write the review unasked**, and **never publish**. Publishing leaves
591
+ something behind that this tooling cannot remove, so it is always an ask. A
592
+ `file://` link is no use on a phone, and saying so **is** the ask —
593
+ `/spec-diff` §6 owns how.
594
+ **The `reader:` line no longer decides anything here, and that is the point.**
595
+ It is still printed, and it is still the only place that question is answered —
596
+ but the offer does not change with it, because the stack lists every tier
597
+ whatever it says. Three reader states used to mean three different offers, and
598
+ that branching is exactly what produced a `file://` page on a session detected
599
+ `unknown`, a LAN URL for a phone off the network, and an address that changed
600
+ underneath a reader when detection flipped mid-session.
601
+
602
+ So: **relay all three tier lines, every time.** Any `also:` lines sit under
603
+ `network` — the other addresses this machine has, offered because the
604
+ best-guess one can be wrong — so pass them on rather than editing them out.
605
+
606
+ **Never read an environment variable to decide anything about the offer** — not
607
+ `SSH_CONNECTION`, not `CLAUDE_CODE_*`, not a tty check. There is nothing left
608
+ here for a detection to decide, and a second implementation of one could not be
609
+ tested and would drift.
610
+
611
+ **Serving is the engine's to do; publishing is never.** A `remote` reader
612
+ authorises a local server — one process, ended by one flag, leaving nothing
613
+ behind — and authorises nothing else. Publishing leaves a page this tooling
614
+ cannot remove, so it stays an ask in every case, always. If the engine could not
615
+ serve (a busy port, a machine with no network address) it falls back to the
616
+ `file://` URL with its marker, and that is when publishing is worth naming.
617
+
618
+ - **Never fatal.** A failed render — no worktree, a git error — is one line, and
619
+ the fix is still done. The page is a convenience; the repo is the record.
620
+
621
+ **The range is measured from the base tag, not from `main`.** A hotfix forks its
622
+ worktree from its `> **Base version:**` tag, and the engine reads that header, so
623
+ the header line says `since <tag>` — do not relay it as `since main`, and do not
624
+ reach for a branch view expecting the base branch.
625
+
626
+ ## 7. Report
627
+
628
+ Do **not** `git push` or `git tag`-and-push unless the user asks — deploying to
629
+ prod is theirs to trigger. The spec stays in `in-progress`.
630
+
631
+ - **`/spec-live` is refused for a hotfix** — its branch is built on an old tag, so
632
+ hot-reloading it onto the running dev server could break the shared instance.
633
+ To test it, the user runs `/spec-connect` (its own isolated stack).
634
+ - `Next` points at **`/spec-complete`** to land it. That cuts the configured
635
+ release — `hotfix.releaseWith` (e.g. skittership's
636
+ `node scripts/release-hotfix.cjs --json`) or the built-in tagger's `hotfix.bump`
637
+ tag — asks before pushing the branch and then the tag, and carries the fix onto
638
+ `main` without the version commit. The worktree stays until the deploy is
639
+ confirmed; a second `/spec-complete` then runs `spec-env hotfix finish`. Add
640
+ `--also <tag>` at completion to also tag other release lines (test/demo,
641
+ tag-only).
642
+
643
+ End with the block defined in `.claude/rules/spec-reports.md`. That file carries
644
+ the shape; this section carries only what is specific here.
645
+
646
+ **Verdicts**
647
+
648
+ - `✅` — red→green on the base tag, fix in, suite passing.
649
+ - `⚠️` — green, with something worth knowing.
650
+ - `❌` — still red, or a later test broke. Quote the failure.
651
+ - `⏸` — no reproduction on that tag, or the tag could not be established.
652
+
653
+ **Fields:** `Tracker` · `Branch` · `Spec` · `Cause` · `Built` · `Tests` ·
654
+ `Review` · `Follow-ups` · `Next`
655
+
656
+ **`Review` is emitted only where step 6b did not run** — a project with no
657
+ isolation, or a render that failed. Where the run is waiting, the banner carries
658
+ the whole subject and the row is dropped, per `.claude/rules/spec-reports.md`.
659
+
660
+ **The base tag goes in the verdict clause** — `✅ /spec-hotfix · hotfix-foo ·
661
+ green on v2.3.1`. Which released version this was fixed against is the first
662
+ thing anyone needs, and it is not a field: the clause is where the run says
663
+ where it got to.
664
+
665
+ Step 6b ends in the **banner**, not a paragraph and not a row — the run is
666
+ waiting on a verdict, and the banner is the shape that says so. Nothing follows
667
+ it. Where the run is not waiting it asks nothing at all: a `Review` row carries
668
+ the counts and the link, and no question (*asking implies waiting*).