@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
package/MIGRATION.md CHANGED
@@ -1,5 +1,131 @@
1
1
  # Migration guide
2
2
 
3
+ ## Providers drop the `skitterspec` bin: install the base alongside (action required)
4
+
5
+ Every provider used to answer to two names: its own (`skitterspec-github`)
6
+ and `skitterspec`. That alias kept a machine to **one** global provider, because
7
+ npm refuses a second package claiming a bin another already owns:
8
+
9
+ ```
10
+ npm error File exists: /usr/local/bin/skitterspec
11
+ npm error Remove the existing file and try again, or run npm
12
+ npm error with --force to overwrite files recklessly.
13
+ ```
14
+
15
+ Now `skitterspec` belongs to the base package, `@skitterbyte/skitterspec`, and
16
+ each provider exposes only its own name. The skills and commands still run
17
+ `skitterspec …`, so
18
+ **the base is installed alongside your provider, and the two are updated together**.
19
+ In exchange, every provider can be installed globally on one
20
+ machine, and `skitterspec update --all` updates every local install in one go.
21
+
22
+ `update` warns when it cannot find `skitterspec` beside a provider. The two
23
+ packages number their versions separately (the base is v23, GitHub v3), so
24
+ they never match by number. Install the latest of each at the same time.
25
+
26
+ Find your install below. You can check what you have with:
27
+
28
+ ```bash
29
+ npm ls -g --depth=0 | grep skitterbyte # global installs
30
+ grep skitterbyte package.json # a project dependency
31
+ ```
32
+
33
+ ### A global provider (the usual setup for `init --local`)
34
+
35
+ Upgrade the provider and install the base **in the same command**. The upgrade
36
+ removes the old `skitterspec` link, so the base can take it. List every
37
+ provider you use:
38
+
39
+ ```bash
40
+ npm i -g @skitterbyte/skitterspec@latest @skitterbyte/skitterspec-github@latest @skitterbyte/skitterspec-azure-boards@latest
41
+ skitterspec update --all
42
+ ```
43
+
44
+ Then check that both names answer:
45
+
46
+ ```bash
47
+ skitterspec --version
48
+ skitterspec-github --version
49
+ ```
50
+
51
+ **If you installed the base on its own first** and got the `File exists` error
52
+ above, the old provider still owns the name. Upgrade the provider
53
+ (`npm i -g @skitterbyte/skitterspec-<provider>@latest`), then install the base
54
+ again. Don't use `--force`: it overwrites the link and leaves the old
55
+ provider's files in place.
56
+
57
+ ### A solo project with a committed install or a `package.json` dependency
58
+
59
+ Move it to a local install with a global CLI, so that later releases never
60
+ touch a tracked file there:
61
+
62
+ 1. Do the global install above on this machine.
63
+ 2. In the project, start a branch (`/no-spec skitterspec-local`), because the
64
+ next steps change tracked files.
65
+ 3. `skitterspec init --local`. This stages the managed files for removal from
66
+ git, moves the hooks into `.claude/settings.local.json`, and moves the
67
+ CLAUDE block into `CLAUDE.local.md`. The files stay on disk.
68
+ 4. Remove the dependency, which updates `package.json` and the lockfile:
69
+ `npm uninstall @skitterbyte/skitterspec-<provider>` (or `pnpm remove …`).
70
+ 5. `skitterspec update`. The commands are rewritten to call `skitterspec`
71
+ from your PATH.
72
+ 6. Commit the staged removals together with `package.json` and the lockfile
73
+ (`/commit`), review the page and land.
74
+
75
+ From then on, `skitterspec update --all` covers this project.
76
+
77
+ ### A team project with a `package.json` dependency
78
+
79
+ The dependency stays, because that is how everyone runs one version. Add the
80
+ base beside it, taking the latest of both together:
81
+
82
+ ```bash
83
+ pnpm add -D @skitterbyte/skitterspec@latest @skitterbyte/skitterspec-<provider>@latest
84
+ skitterspec update
85
+ ```
86
+
87
+ Do this on a `/no-spec` branch, since it changes tracked files. On every
88
+ later bump, move the two together:
89
+ `pnpm up @skitterbyte/skitterspec @skitterbyte/skitterspec-<provider>`.
90
+ `update --all` lists a team project and never writes to it.
91
+
92
+ ### A Windows VM
93
+
94
+ Global installs belong to one machine, and the VM has its own. Inside the VM,
95
+ run the same `npm i -g …` line and then `skitterspec update --all`. That reads
96
+ the VM's own Claude Code project list. Where the Mac and the VM share one
97
+ checkout, update both machines at the same time. Otherwise each `update`
98
+ rewrites the other's files.
99
+
100
+ ### After every release, from now on
101
+
102
+ ```bash
103
+ npm i -g @skitterbyte/skitterspec@latest @skitterbyte/skitterspec-<provider>@latest # every provider you use
104
+ skitterspec update --all
105
+ ```
106
+
107
+ Repeat both lines inside the VM.
108
+
109
+ ## `@skitterbyte/skitterspec-github` v2 → v3 (the `skitterspec` bin moves to the base)
110
+
111
+ Install `@skitterbyte/skitterspec` alongside. See
112
+ [Providers drop the `skitterspec` bin](#providers-drop-the-skitterspec-bin-install-the-base-alongside-action-required).
113
+
114
+ ## `@skitterbyte/skitterspec-azure-boards` v2 → v3 (the `skitterspec` bin moves to the base)
115
+
116
+ Install `@skitterbyte/skitterspec` alongside. See
117
+ [Providers drop the `skitterspec` bin](#providers-drop-the-skitterspec-bin-install-the-base-alongside-action-required).
118
+
119
+ ## `@skitterbyte/skitterspec-jira` v2 → v3 (the `skitterspec` bin moves to the base)
120
+
121
+ Install `@skitterbyte/skitterspec` alongside. See
122
+ [Providers drop the `skitterspec` bin](#providers-drop-the-skitterspec-bin-install-the-base-alongside-action-required).
123
+
124
+ ## `@skitterbyte/skitterspec-linear` v19 → v20 (the `skitterspec` bin moves to the base)
125
+
126
+ Install `@skitterbyte/skitterspec` alongside. See
127
+ [Providers drop the `skitterspec` bin](#providers-drop-the-skitterspec-bin-install-the-base-alongside-action-required).
128
+
3
129
  ## A PR-mode finish runs the `afterLand` entries its land matched (nothing to edit)
4
130
 
5
131
  After the host merged a PR, `spec-env integrate` used to print `nothing to
package/README.md CHANGED
@@ -5,8 +5,17 @@ superset of [`@skitterbyte/skitterspec`](https://www.npmjs.com/package/@skitterb
5
5
  the base filesystem workflow plus `/spec-push` · `/spec-status` · `/spec-list` · `/spec-claim`
6
6
  and the `spec-sync` CLI. The repo is canonical; GitHub is a generated mirror.
7
7
 
8
- Install exactly one distribution — this, the base, or one other superset —
9
- never two:
8
+ Install this provider **and** the base, `@skitterbyte/skitterspec`, and
9
+ update the two together: the provider carries the sync, and the base answers the
10
+ `skitterspec` command the skills run. Use one provider per project; several
11
+ can be installed globally side by side — see `MIGRATION.md`,
12
+ *Providers drop the `skitterspec` bin*.
13
+
14
+ ```
15
+ npm i -g @skitterbyte/skitterspec @skitterbyte/skitterspec-github
16
+ ```
17
+
18
+ Then, in the project:
10
19
 
11
20
  ```
12
21
  npx @skitterbyte/skitterspec-github init
@@ -1,125 +1,25 @@
1
1
  ## Spec workflow
2
2
 
3
- Spec-driven development runs through the lifecycle **skills** — use them so
4
- structure and lifecycle stay consistent. The everyday loop is
5
- **`spec → start → next → commit → complete`**, with **`/spec-diff`** to read what
6
- a phase changed and `/spec-connect` when you want to test the spec in a browser.
7
-
8
- **Skills vs commands.** The lifecycle skills are read by Claude, which exercises
9
- judgment. `/spec-connect` and `/spec-live` are **slash commands** instead — each
10
- pre-executes one `spec-env` verb and relays it, so only you can run them; a
11
- skill that wants one will tell you to type it.
12
-
13
- **Seeing the work.** A phase is built in its own worktree, so `git diff` in your
14
- terminal answers about the base branch. **`/spec-diff`** renders that worktree's
15
- diff as a self-contained HTML page you open locally — or on a phone, over your
16
- LAN or tailnet. The diff never passes through the model, so the page costs no context
17
- tokens however large it is; the optional written review is the part that costs,
18
- and it is offered rather than assumed. `/spec-next` writes the page at the end of
19
- every phase. **`skitterspec status`** lists what is in flight across worktrees.
20
- At the end of the day, **`/spec-tada`** is the ta-da list: what you did across
21
- every project, grouped by spec — what landed, what was explored, what is still
22
- in flight — ending in a three-line standup (`skitterspec tada` is the engine).
23
- It covers the projects that share this one's `project.category`, leads with
24
- the day's wins, and names only this project's work as the thing to do next;
25
- **`skitterspec project`** shows and sets the name and category, and
26
- `/spec-init` asks for both. In the morning, **`/spec-todo`** answers the other
27
- question: where each project was left on your last working day, what is
28
- waiting on you, and what to pick up first. Both read across projects, and
29
- neither acts on one: a session works on the project it was started in, and a
30
- hook refuses its writes and lifecycle commands anywhere else until you type
31
- `/allow-project <name>`.
32
-
33
- **Coming back to a spec** that waited on a deploy, another project or a soak
34
- is **`/spec-resume <name|#N> [message]`**. It finds the spec even if it exists
35
- only on its branch, rebuilds its worktree if this machine has none, moves the
36
- session there and shows what it was blocked on. Then it acts on the message:
37
- feedback on the shipped work becomes tasks, "the deploy is out" clears the
38
- blocker, and a question gets an answer from the spec. It never starts
39
- anything. `/spec #N` on a ticket that already has a spec offers it instead.
40
- **`/spec-park "<reason>"`** records the wait in the first place, as a
41
- `Blocked on:` line. `/spec` writes the planned ones ("phase 4 waits until
42
- phase 3 has run in prod a week"), and `/spec-next` stops before building
43
- past either kind.
44
-
45
- **Handing the review back.** The page takes marks: tick `✓ accept` per file as
46
- you read, note anything against a line or a whole file, answer the questions a
47
- written review asked — then **end it in a decision**. At the end of a phase the
48
- buttons are `✓ Commit`, `✓ Commit & Continue` (commit, then build the next
49
- phase), `↺ Request changes` and `… Discuss first`. A spec that has just been
50
- written gets `✓ Commit & Start` instead — the `commit-start` verdict, which is
51
- the `commit && /spec-start` you would otherwise type. A **served** page hands
52
- the pass to the engine, which **holds** it and shows a six-digit code. Committing
53
- is unavailable while a note is open — you asked for something, so it cannot also
54
- be fine — and it hands off to your own commit skill (`review.commitWith`,
55
- `/commit` by default) rather than a copy living here. Fixes come back as
56
- resolutions, so the next render shows each note struck through with what changed.
57
- An accept remembers the file's content, so it lapses by itself when that file
58
- changes again. The marks are information — nothing gates on them; the verdict is
59
- the one thing you choose, once.
60
-
61
- **The phase waits for that press.** `/spec-next` ends a phase by rendering the
62
- page and then watching for your verdict, so the button is what carries the work
63
- on — no command to remember. What makes that safe is not that the page is
64
- unreachable (it is reachable, deliberately): it is the **serve token** in the
65
- URL, 48 random bits deciding who can POST at all, plus the **window** — only a
66
- pass that arrives *while the session is waiting* is claimed for you, and two
67
- arrivals refuse rather than pick. Outside that window nothing is claimed
68
- unasked: type `/spec-reviewed`, or `/spec-reviewed 324199` to name one exactly,
69
- which matters only when two are waiting. A `file://` page has no server to talk
70
- to, so it copies and you paste, as before.
71
-
72
- **And a phase that ended owes you an answer.** The gate is armed when the page
73
- is rendered at the end of a phase, and cleared by a committing verdict or by
74
- `skitterspec spec-env review skip "<reason>"` — while it is armed, `/spec-next`
75
- refuses to build the next phase. Mid-phase renders arm nothing, every
76
- cannot-tell exits 0 and says nothing, and `review.required: false` turns it off
77
- for a project. The exit is always one command; one of them is *"I am moving
78
- on"*, and that reason goes on the record.
79
-
80
- **A second opinion, when you want one** (`review.reviewers`, empty by default).
81
- Point it at a code reviewer that runs from your terminal — CodeRabbit's CLI has
82
- a free tier and `{ "use": "coderabbit" }` is the whole setup; anything printing
83
- [rdjsonl](https://github.com/reviewdog/reviewdog) works too — and its findings
84
- land on the page beside your own notes, each badged with the tool that found it
85
- and linked to the line it is about. `/spec-next` runs them once per phase;
86
- `/spec-diff --reviewers` is the mid-phase ask. **They never block a commit** —
87
- reply to one and your reply does, because then a person has asked for something.
88
- A reviewer that could not run says `did not run — <why>` rather than passing as
89
- clean, because on the page you commit from those two must not look alike.
90
- Adding one sends your diff to whatever the command talks to, which is why the
91
- list starts empty and `init` never writes one.
92
-
93
- **Above the verdicts sits one line that is not a verdict.** `▶ Put it live`
94
- commits the phase, checks the branch out where your dev server can see it, and
95
- hands you back the same page with the same options — so you can judge the change
96
- by *using* it, not only by reading it. It clears no gate: you have looked at it
97
- running and concluded nothing, so the phase still owes an answer.
98
-
99
- **Every render lists where the page can be read**, labelled, in a fixed order —
100
- `local`, `network`, `remote` — each either a URL or the one command that turns it
101
- on, plus a `live:` line saying whether the change is also running. They are
102
- labelled by address: `local` is this machine, `network` your LAN, `remote` your
103
- tailnet. All three are doors into one room — the same server and the same
104
- waiting verdict — so one wait covers every one the stack shows.
105
-
106
- **One ending.** Every spec skill finishes with the same block — a verdict
107
- (`✅` · `⚠️` · `❌` · `⏸`), then a table of the fields that skill declares,
108
- ending on the one thing to do next. A refusal emits it too, so "nothing
109
- happened" is reported rather than absent, and `Follow-ups` is always there
110
- because a recorded `none` is a decision. Skills stay quiet while they run. The
111
- shape lives in **`.claude/rules/spec-reports.md`**.
112
-
113
- The skill table, the spec type/folder conventions and the per-spec isolation
114
- model all live in **`.claude/rules/spec-planning.md`**, the canonical reference
115
- every spec skill points at. Tailor its per-phase test commands to this stack.
116
-
117
- **Release gating** *(only when `specs/.core/gating.config.json` exists)* — each
118
- spec records whether it ships behind a feature flag, as
119
- `> **Gating:** <flag name>` or `> **Gating:** none: <one-line reason>`. `/spec`,
120
- `/spec-bug` and `/spec-hotfix` ask; `/spec-review`, `/spec-start` and
121
- `/spec-complete` report a spec that has no answer, and never block over it.
122
- `skitterspec gating check` lists them and always exits 0. The point is that the
123
- question is **on the record**: a missing line is an oversight, a reason is a
124
- decision. Skitterspec never reads your flag system — it asks and cites the doc
125
- you point it at. Without that config, none of this appears.
3
+ Spec-driven development runs through the lifecycle **skills**. The everyday
4
+ loop is **`spec → start → next → commit → complete`**. Use **`/spec-diff`** to
5
+ read what a phase changed, and `/spec-connect` or `/spec-live` to try it in a
6
+ browser. `/spec-resume` goes back into a spec that was waiting, and
7
+ `/spec-park` records what it is waiting on. `/spec-tada` and `/spec-todo` recap
8
+ the day and plan the next one across projects.
9
+
10
+ - **Each phase ends on a review page**, listed as `local`, `network` (LAN) and
11
+ `remote` (tailnet), with a `live:` line saying whether it is also running.
12
+ Mark it up and press a verdict. `/spec-next` waits for that press, and a phase
13
+ that ended owes one before the next is built. A newly written spec's page
14
+ offers `Commit & Start` (`commit-start`).
15
+ - **Every skill ends with the same report block**: a verdict, a table, and
16
+ `Next`.
17
+ - **Guards**: work never happens in the primary checkout on the base branch,
18
+ and a session works only on its own project. Only a person can lift either
19
+ guard (`/allow-main`, `/allow-project`).
20
+
21
+ The rules are in `.claude/rules/spec-planning.md` (lifecycle and guards),
22
+ `.claude/rules/spec-reports.md` (the report block) and
23
+ `.claude/rules/spec-format.md` (spec layout, which loads under `specs/`). This
24
+ project's typecheck and test commands are in
25
+ `.claude/rules/project-conventions.md`.
@@ -20,8 +20,10 @@ pnpm add -D @skitterbyte/skitterspec-github
20
20
  {{exec}} skitterspec init --isolation
21
21
  ```
22
22
 
23
- Install exactly one distribution: the base, or one superset. This one provides
24
- both `skitterspec-github` and `skitterspec`.
23
+ Install this provider and the base, `@skitterbyte/skitterspec`, beside it,
24
+ updating the two together: the base answers the `skitterspec` command the
25
+ skills run.
26
+ Every provider contains the whole base engine, so a project uses one provider.
25
27
 
26
28
  **A project in a subfolder of its repo** (a solution folder beside `Sql/`,
27
29
  say) installs and runs exactly the same way, from that folder: install the
@@ -0,0 +1,17 @@
1
+ # Project conventions
2
+
3
+ This file belongs to the project. skitterspec writes it once and never
4
+ overwrites it, so fill it in.
5
+
6
+ The spec skills tell you to run "your project's typecheck and test commands"
7
+ and to "honour project conventions". Spell those out here so specs stay
8
+ consistent with the codebase. skitterspec never runs these commands itself and
9
+ knows nothing about what this project is written in. Pick the example below
10
+ that fits, or write your own.
11
+
12
+ - **Typecheck command:** `<e.g. npm run typecheck · dotnet build · mypy . · go vet ./...>`
13
+ - **Test command:** `<e.g. npm test · dotnet test · pytest · go test ./...>`
14
+ (single file/dir: `<e.g. npx vitest run path · dotnet test --filter · pytest path>`)
15
+ - **Lint/format:** `<e.g. npm run lint · dotnet format · ruff check · golangci-lint run>`
16
+ - **Other rules specs must honour:** link the relevant `.claude/rules/*.md`
17
+ (architecture, code style, testing, database, etc.) rather than restating them.
@@ -1,126 +1,68 @@
1
1
  # Commit Trailers
2
2
 
3
- Extends `commit-messages.md` — the format, length limits and `Release-Note:`
4
- grammar there all still apply. This file adds one trailer, and it is only
5
- installed when a ticketing provider is.
6
-
7
- ## `Refs:` — the ticket this commit belongs to
8
-
9
- A commit carries the GitHub issue **its own changes** belong to, as the **last**
10
- trailer in the message:
3
+ This extends `commit-messages.md`. It adds one trailer, `Refs:`: the GitHub
4
+ issue that **this commit's own changes** belong to, written as the **last**
5
+ trailer.
11
6
 
12
7
  ```
13
8
  fix(sync): verify no longer flags every update
14
9
 
15
10
  - Key the apply read-back by ref, resolving id via the projection
16
11
 
17
- Release-Note: Pushing a spec whose phases already exist on GitHub no
18
- longer reports every one of them as a possible stale reference.
12
+ Release-Note: Pushing a spec whose phases already exist no longer
13
+ reports every one of them as a possible stale reference.
19
14
 
20
15
  Refs: #29
21
16
  ```
22
17
 
23
- Get the value from the engine rather than reading it off a spec by hand:
18
+ Get the value from the engine. Never read it off a spec by hand:
24
19
 
25
20
  ```
26
21
  {{exec}} skitterspec-github spec-sync ref
27
22
  ```
28
23
 
29
- Bare, that answers **from the branch** — correct whenever you are committing
30
- that branch's own implementation work, which is nearly always.
31
-
32
- ## When the branch and the commit disagree
24
+ Bare, it answers **from the branch**, which is correct when you commit that
25
+ branch's own work. That is nearly always.
33
26
 
34
- The branch is a proxy for "what this commit is about", and it is a good one
35
- right up until you commit something that is not this branch's work.
27
+ **`/spec` closes the usual way in** for a mismatch. Where isolation is
28
+ configured, it writes each new spec in that spec's own worktree, so the branch
29
+ and the commit's subject match and the **bare** command is then correct.
36
30
 
37
- **Where isolation is configured, `/spec` closes the usual way in.** It
38
- provisions the new spec's own `--docs` worktree before writing a line of it and
39
- moves the session there, so the spec commit happens on the new spec's branch —
40
- and the **bare** command is then correct, because the branch and the commit's
41
- subject are the same spec. This is the normal path, and it needs nothing typed.
42
-
43
- **Without isolation the split is still real.** Part-way through a spec a design
44
- question warrants its own spec, `/spec` writes it into `specs/backlog/` on the
45
- branch you are standing on, and that commit is **entirely the new spec's** while
46
- the bare command answers with the old spec's ticket.
47
-
48
- Name the spec instead — still the engine, never a hand-written id:
31
+ **Without isolation the split is still real.** A spec written part-way through
32
+ another spec lands on the branch you are standing on, so name it instead:
49
33
 
50
34
  ```
51
35
  {{exec}} skitterspec-github spec-sync ref feat-distance-prescriptions
52
36
  ```
53
37
 
54
- The branch is not consulted, so this works from `main` too. An unknown spec name
55
- fails rather than falling back to the branch, so a typo can't become a
56
- confidently wrong ref.
57
-
58
- **A spec in ANOTHER spec's worktree is still the thing to avoid**, and the fix
59
- is no longer "author from the base branch" — it is the provision above, which
60
- moves the session out of that tree and into the new spec's own. What was always
61
- true of the accident stays true: a spec written inside another spec's worktree
62
- physically lives on that branch, so it is not on `main` until that spec lands,
63
- and it is cancelled along with it.
38
+ An unknown spec name fails rather than falling back to the branch. A spec
39
+ written in **another spec's worktree** is still the thing to avoid: it lives on
40
+ that branch and is cancelled along with it.
64
41
 
65
42
  ## Rules
66
43
 
67
- - **The ref names the commit's subject, not your location.** If they disagree,
68
- the commit's subject wins — resolve it with `spec-sync ref <spec>`.
69
- - **Omit the trailer entirely when there is no ref.** `spec-sync ref` exits
70
- non-zero and prints nothing on a commit that has no ticket — on `main`, or on
71
- a spec kept deliberately local. Never invent one, and never write
72
- `Refs: none`: the release report counts unreferenced commits, and a fabricated
73
- ref is worse than an honest gap.
74
- - **One ref per commit.** A commit belongs to one spec. If work genuinely spans
75
- two tickets, that is two commits — and that is the fix when a single commit
76
- would mix a branch's own work with another spec's files.
77
- - **Never use GitHub's closing keywords** — `close`, `closes`, `closed`,
78
- `fix`, `fixes`, `fixed`, `resolve`, `resolves`, `resolved`, followed by an
79
- issue number. Those close the issue the moment the commit reaches the default
80
- branch, which is wrong here: a ticket moves when its work is **released**, not
81
- when it merges, and the board's Status is the engine's to set. `Refs:` is
82
- deliberately inert to GitHub's automation.
83
- - **`#N` only — never `owner/repo#N`.** The trailer names an issue in THIS repo,
84
- and `spec-sync released` ignores a cross-repo ref by design, so writing one
85
- moves the commit out of every release report.
86
- - **An older tracker's ref is history, not a ref.** A repo that moved here from
87
- Linear or Jira still has `Refs: SKS-29` all through its log; `released`
88
- counts those commits as `historical`, never as missing a trailer. Never
89
- rewrite them, and never write a new one.
90
- - **Blank line before it**, like `Release-Note:` — it is a git trailer, not body
91
- text.
92
- - Put it **after** `Release-Note:` when both are present, so the human-facing
93
- note reads first.
94
-
95
- ## Why it exists
96
-
97
- In trunk mode the repo lands specs with `merge --ff-only`, so history is linear and branch
98
- names never reach it. The commit message is the only artefact that survives into
99
- the range a release scans, which is what lets
100
- `spec-sync released <range>` report the tickets a release contains. A ref that
101
- names the wrong ticket does not merely lose information — it moves a commit onto
102
- another ticket's release report, which is worse than the gap it was meant to
103
- close.
104
-
105
- ## Merge styles, and which range still holds the trailers
106
-
107
- Trunk mode keeps this simple: `merge --ff-only` means linear history and every
108
- trailer survives. PR mode (`land.strategy: "pr"`) hands the merge to the host,
109
- and no merge style is required — teams pick their own — so the scan copes
110
- per style instead:
111
-
112
- - **Merge commits** — every branch commit survives, trailers intact. A
113
- trailer-less merge commit counts as transport, never as an unreferenced gap —
114
- while a merge that CARRIES a trailer still counts, because a hand merge is
115
- where a ticket's only trailer sometimes lives.
116
- - **Squashed feature PRs** — the branch's commits collapse into one. The
117
- trailers survive when the squash message keeps the commit bodies (GitHub:
118
- the "Default commit message" squash setting; Azure DevOps: keep the commit
119
- descriptions in the squash message) — `released` counts every `Refs:` line
120
- in the one body, so a squashed PR carrying three commits still reports three
121
- tickets.
122
- - **A squashed integration-to-release merge** — one commit for a whole cycle,
123
- and attribution on the release branch is gone by construction. No setting
124
- fixes that: point `released <range>` at the integration branch's range
125
- instead, where the commits still exist. The range argument has always been
126
- arbitrary, and this is what it is for.
44
+ - **The ref names the commit's subject, not your location.** When they
45
+ disagree, the subject wins: `spec-sync ref <spec>`.
46
+ - **Omit the trailer when there is no ref.** `spec-sync ref` exits non-zero and
47
+ prints nothing. Never invent a ref, and never write `Refs: none`.
48
+ - **One ref per commit.** Work that spans two tickets is two commits.
49
+ - **Never use GitHub's closing keywords** (`close`, `closes`, `closed`, `fix`,
50
+ `fixes`, `fixed`, `resolve`, `resolves`, `resolved`) before an issue number.
51
+ They close the issue when the commit reaches the default branch, but a
52
+ ticket moves when its work is **released**. `Refs:` is inert.
53
+ - **`#N` only, never `owner/repo#N`.** `spec-sync released` ignores cross-repo
54
+ refs, so writing one drops the commit from every release report.
55
+ - **An older tracker's ref is history.** `Refs: SKS-29` from before a move to
56
+ GitHub counts as `historical`. Never rewrite one, and never write a new one.
57
+ - **Leave a blank line before it**, as with `Release-Note:`, and put it **after**
58
+ `Release-Note:` when both are present.
59
+
60
+ Under PR landing, every trailer survives a merge commit. A squash keeps them
61
+ only if the squash message keeps the commit bodies. For a squashed
62
+ integration-to-release merge, point `spec-sync released <range>` at the
63
+ integration branch.
64
+
65
+ ---
66
+
67
+ Why the trailer exists, and how each merge style treats it:
68
+ [docs/rationale/commit-trailers.md](https://github.com/SkitterByte/skitterspec/blob/main/docs/rationale/commit-trailers.md).
@@ -1,69 +1,42 @@
1
1
  # Checks That Accuse
2
2
 
3
3
  A check **accuses** when being wrong costs something: it deletes, it exits
4
- non-zero, or it tells the user their code is broken. Those checks earn the four
5
- rules below. An ordinary conditional does not — this is about the ones that act
6
- on what they conclude.
7
-
8
- Almost every accusation begins as an **absence**: a name not in a list, a
9
- directory not on disk, a version not in a response. An absence is evidence only
10
- once you have established that the lookup could have seen the thing. Three
11
- times in one day, in unrelated code, we established nothing and acted anyway:
12
-
13
- | Absence observed | Concluded | What had blinded the lookup |
14
- |------------------|-----------|-----------------------------|
15
- | ref not in the issue list | "it does not exist" | the query excluded archived issues, and capped at 250 |
16
- | version not in the registry's list | "the publish failed" | the registry is eventually consistent |
17
- | lifecycle folder not on disk | "half-installed" | git does not store an empty directory |
18
-
19
- The bills: 146 healthy refs accused, a valid release tag deleted, a non-zero
20
- exit on a healthy repo. Each blind spot was knowable in advance.
4
+ non-zero, or it tells the user their code is broken. Most accusations start
5
+ from an **absence** (a name not in a list, a directory not on disk). An absence
6
+ is evidence only once you have established that the lookup could have seen the
7
+ thing.
21
8
 
22
9
  ## 1. Prefer a positive signal to an absence
23
10
 
24
11
  Assert something that must be **present**, not something that must not be
25
- missing. A positive signal fails loudly when you are wrong about it; an absence
26
- fails silently whenever the lookup was narrower than you assumed.
27
-
28
- The scaffold check above stopped asking "is the lifecycle folder there?" — a
29
- folder git drops as soon as it empties — and started asking whether the config
30
- folder the installer always writes into is there. Same intent, and the new
31
- question has an answer.
32
-
33
- Where no positive signal exists, widen the lookup until absence means
34
- something (include the archived rows, ask the API for the one id rather than
35
- scanning a page) — or do not conclude.
12
+ missing. Where no positive signal exists, widen the lookup until an absence
13
+ means something (include archived rows, ask for the one id rather than scanning
14
+ a page), or draw no conclusion.
36
15
 
37
16
  ## 2. Name the blind spot beside the check
38
17
 
39
- A comment naming what could make this lookup lie is what makes the next reader
40
- check it. Not what the code does — what would fool it:
18
+ Write a comment saying what could make this lookup lie. Describe what would
19
+ fool the check, not what the code does:
41
20
 
42
21
  ```js
43
22
  // A LIFECYCLE FOLDER IS NOT CHECKED, deliberately. git does not track empty
44
- // directories, so it disappears whenever the bucket empties and returns the
45
- // moment something lands in it.
23
+ // directories, so it disappears whenever the bucket empties.
46
24
  ```
47
25
 
48
- Write it when you write the check, while you still know why it is safe.
49
-
50
26
  ## 3. Pair every accusation with a stays-silent test
51
27
 
52
- For each accusing check, a test that feeds it a **healthy but unusual** input
53
- and asserts it says nothing: the empty bucket, the archived record, the
54
- just-published version, the file the user edited on purpose. The positive test
55
- proves the check can fire; only this one proves it does not fire at everyone
56
- else. All three incidents would have been caught by it, and prose alone had
57
- already failed to prevent them.
28
+ Give each accusing check a test that feeds it a **healthy but unusual** input
29
+ (an empty bucket, an archived record, a just-published version, a file edited on
30
+ purpose) and asserts that it says nothing.
58
31
 
59
32
  ## 4. Bias the unknown case toward inaction
60
33
 
61
- Three states, not two: yes, no, and *cannot tell*. Route the third to the
62
- harmless branch — skip, warn, keep, retry — never to the destructive one.
34
+ There are three states: yes, no and *cannot tell*. Route *cannot tell* to the
35
+ harmless branch (skip, warn, keep, retry), never to the destructive one. For
36
+ example, a file whose hash the manifest does not recognise is treated as
37
+ `customized` and kept, never as stale.
38
+
39
+ ---
63
40
 
64
- The install manifest classifies a file whose hash it does not recognise as
65
- `customized` rather than stale, so a resync **keeps** it (`managedState`,
66
- `packages/common/src/init.js`). An unrecognised hash could mean a user's edit or
67
- a lost manifest; only one of those readings is safe to act on, so it takes that
68
- one. Being wrong there costs a redundant file on disk. The opposite default
69
- costs the user their work.
41
+ The incidents behind these rules:
42
+ [docs/rationale/negative-checks.md](https://github.com/SkitterByte/skitterspec/blob/main/docs/rationale/negative-checks.md).