@skitterbyte/skitterspec 23.6.0 → 23.8.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.
- package/assets/claude-md-section.md +20 -1
- package/assets/core/env.config.json.example +1 -0
- package/assets/core/env.config.md +143 -8
- package/assets/hooks/main-guard.cjs +40 -6
- package/assets/hooks/review-gate.cjs +42 -7
- package/assets/rules/spec-planning.md +81 -18
- package/assets/rules/spec-reports.md +1 -1
- package/assets/skills/spec/SKILL.md +32 -1
- package/assets/skills/spec-bug/SKILL.md +2 -0
- package/assets/skills/spec-cancel/SKILL.md +11 -0
- package/assets/skills/spec-complete/SKILL.md +89 -0
- package/assets/skills/spec-hotfix/SKILL.md +17 -1
- package/assets/skills/spec-incident/SKILL.md +2 -0
- package/assets/skills/spec-review/SKILL.md +8 -0
- package/assets/skills/spec-start/SKILL.md +13 -1
- package/assets/skills/spec-to-main/SKILL.md +47 -1
- package/package.json +1 -1
- package/src/cli.js +1188 -79
- package/src/env/base.js +104 -0
- package/src/env/bootstrap.js +22 -3
- package/src/env/classify.js +12 -4
- package/src/env/config.js +77 -5
- package/src/env/disposition.js +62 -0
- package/src/env/handoff.js +81 -0
- package/src/env/host.js +262 -0
- package/src/env/hotfix.js +237 -9
- package/src/env/hotfixland.js +105 -10
- package/src/env/inflight.js +98 -0
- package/src/env/integrate.js +136 -9
- package/src/env/live.js +8 -7
- package/src/env/mainguard.js +20 -5
- package/src/env/phases.js +28 -0
- package/src/env/project.js +223 -0
- package/src/env/provision.js +30 -8
- package/src/env/resolve.js +147 -25
- package/src/env/review.js +21 -7
- package/src/env/reviewers.js +7 -10
- package/src/env/serve.js +27 -11
- package/src/env/specstate.js +101 -0
- package/src/env/supervise.js +15 -2
- package/src/env/teardown.js +46 -3
- package/src/init.js +49 -9
|
@@ -16,7 +16,7 @@ diff as a self-contained HTML page you open locally — or publish, and read on
|
|
|
16
16
|
phone. The diff never passes through the model, so the page costs no context
|
|
17
17
|
tokens however large it is; the optional written review is the part that costs,
|
|
18
18
|
and it is offered rather than assumed. `/spec-next` writes the page at the end of
|
|
19
|
-
every phase.
|
|
19
|
+
every phase. **`skitterspec status`** lists what is in flight across worktrees.
|
|
20
20
|
|
|
21
21
|
**Handing the review back.** The page takes marks: tick `✓ accept` per file as
|
|
22
22
|
you read, note anything against a line or a whole file, answer the questions a
|
|
@@ -34,6 +34,25 @@ An accept remembers the file's content, so it lapses by itself when that file
|
|
|
34
34
|
changes again. The marks are information — nothing gates on them; the verdict is
|
|
35
35
|
the one thing you choose, once.
|
|
36
36
|
|
|
37
|
+
**The phase waits for that press.** `/spec-next` ends a phase by rendering the
|
|
38
|
+
page and then watching for your verdict, so the button is what carries the work
|
|
39
|
+
on — no command to remember. What makes that safe is not that the page is
|
|
40
|
+
unreachable (it is reachable, deliberately): it is the **serve token** in the
|
|
41
|
+
URL, 48 random bits deciding who can POST at all, plus the **window** — only a
|
|
42
|
+
pass that arrives *while the session is waiting* is claimed for you, and two
|
|
43
|
+
arrivals refuse rather than pick. Outside that window nothing is claimed
|
|
44
|
+
unasked: type `/spec-reviewed`, or `/spec-reviewed 324199` to name one exactly,
|
|
45
|
+
which matters only when two are waiting. A `file://` page has no server to talk
|
|
46
|
+
to, so it copies and you paste, as before.
|
|
47
|
+
|
|
48
|
+
**And a phase that ended owes you an answer.** The gate is armed when the page
|
|
49
|
+
is rendered at the end of a phase, and cleared by a committing verdict or by
|
|
50
|
+
`skitterspec spec-env review skip "<reason>"` — while it is armed, `/spec-next`
|
|
51
|
+
refuses to build the next phase. Mid-phase renders arm nothing, every
|
|
52
|
+
cannot-tell exits 0 and says nothing, and `review.required: false` turns it off
|
|
53
|
+
for a project. The exit is always one command; one of them is *"I am moving
|
|
54
|
+
on"*, and that reason goes on the record.
|
|
55
|
+
|
|
37
56
|
**A second opinion, when you want one** (`review.reviewers`, empty by default).
|
|
38
57
|
Point it at a code reviewer that runs from your terminal — CodeRabbit's CLI has
|
|
39
58
|
a free tier and `{ "use": "coderabbit" }` is the whole setup; anything printing
|
|
@@ -5,7 +5,7 @@ stack + host dev servers + a front-door proxy per in-progress spec).
|
|
|
5
5
|
Provisioning is folded into `/spec-start`, teardown into `/spec-complete` ·
|
|
6
6
|
`/spec-cancel`, traffic diversion is `/spec-connect`, and reading a spec's diff
|
|
7
7
|
is `/spec-diff`; the `skitterspec spec-env
|
|
8
|
-
<up|bootstrap|nospec|main|down|prune|dev|connect|integrate|hotfix|live|review|stage|status|resolve>` CLI is
|
|
8
|
+
<up|bootstrap|nospec|main|down|prune|dev|connect|integrate|disposition|handoff|hotfix|live|review|stage|status|resolve|base>` CLI is
|
|
9
9
|
the engine beneath them.
|
|
10
10
|
|
|
11
11
|
**Once this file is present, isolation is the default policy:** `/spec-start` gives
|
|
@@ -68,6 +68,8 @@ through to a documented conservative default; see the field notes below.
|
|
|
68
68
|
"worktree": {
|
|
69
69
|
"root": "../{repo}-wt", // dir that holds all spec worktrees; sibling of
|
|
70
70
|
// the primary checkout, never nested inside it.
|
|
71
|
+
// Resolved against the REPO root, even for a
|
|
72
|
+
// project in a subfolder of its repo (below).
|
|
71
73
|
"folderPattern": "{slug}" // per-spec worktree dir name.
|
|
72
74
|
},
|
|
73
75
|
|
|
@@ -141,7 +143,8 @@ through to a documented conservative default; see the field notes below.
|
|
|
141
143
|
// typechecks, builds and tests work immediately instead of failing on a
|
|
142
144
|
// missing node_modules. An array, run in order, stopping at the first that
|
|
143
145
|
// exits non-zero; [] = none. Each string is a shell command; {slug}/{branch}/{worktreePath}/{projectName}/{portOffset}
|
|
144
|
-
// expand (the cwd is already the worktree
|
|
146
|
+
// expand (the cwd is already the worktree — the project folder inside it, for a
|
|
147
|
+
// project in a subfolder of its repo — so {worktreePath} is usually
|
|
145
148
|
// redundant). Example: ["pnpm install --frozen-lockfile"].
|
|
146
149
|
// An entry may also be { "run": "<cmd>", "when": ["<glob>", ...] }. `when` is
|
|
147
150
|
// IGNORED here — a fresh worktree always runs every setup step — and exists
|
|
@@ -275,9 +278,65 @@ through to a documented conservative default; see the field notes below.
|
|
|
275
278
|
// Integration base branch — the branch specs fork from and land back onto
|
|
276
279
|
// (used by the teardown "merged?" guard and, later, the integrate step).
|
|
277
280
|
// Empty = auto-detect: origin/HEAD → main → master. Set it when your default
|
|
278
|
-
// branch isn't discoverable (e.g. no remote) or differs (trunk, develop
|
|
281
|
+
// branch isn't discoverable (e.g. no remote) or differs (trunk, develop, a
|
|
282
|
+
// release-candidate branch). An explicit value always wins — it is the pin.
|
|
279
283
|
"baseBranch": "",
|
|
280
284
|
|
|
285
|
+
// A base that ROLLS: a glob over the remote's branch names (e.g. "20??/Q?")
|
|
286
|
+
// for teams that work off a release candidate versioned per release. The
|
|
287
|
+
// base is the NEWEST match by commit date, so cutting the next rc is all it
|
|
288
|
+
// takes to move every spec onto it — no config edit per release, no message
|
|
289
|
+
// to the team. Precedence: baseBranch (pin) → this pattern → origin/HEAD →
|
|
290
|
+
// main → master.
|
|
291
|
+
// - Matched against `refs/remotes/<land.remote>/*`, never the network:
|
|
292
|
+
// `spec-env up`, `integrate` and `spec-env base` fetch first; everything
|
|
293
|
+
// else reads what the last fetch saw.
|
|
294
|
+
// - git's glob does not cross "/": "rc/*" matches rc/2026-11 but not
|
|
295
|
+
// rc/a/b. Spell each segment ("20??/Q?").
|
|
296
|
+
// - No match REFUSES, naming `spec-env base` — it never falls back to
|
|
297
|
+
// origin/HEAD, because zero matches usually means "not fetched", and
|
|
298
|
+
// the default branch is exactly where a rolling base must not land.
|
|
299
|
+
// - Newest-by-date is only right when one rc is live at a time (the next
|
|
300
|
+
// is cut after the last merges). If your rcs overlap, pin `baseBranch`.
|
|
301
|
+
// - A spec that outlived a roll lands on the new rc; the integrate plan
|
|
302
|
+
// says `retarget: forked from <old> · landing onto <new>`, and switches
|
|
303
|
+
// a primary checkout still on the old rc before the fast-forward.
|
|
304
|
+
// A pattern holding whitespace or ".." is dropped (treated as unset).
|
|
305
|
+
// `spec-env base` lists the matches, the base, and specs on an older one.
|
|
306
|
+
"baseBranchPattern": "",
|
|
307
|
+
|
|
308
|
+
// How a finished branch reaches the base branch.
|
|
309
|
+
// strategy: "ff" (default) — trunk-based: rebase + local `merge --ff-only`,
|
|
310
|
+
// exactly as always; nothing below applies.
|
|
311
|
+
// "pr" — the branch is pushed and a pull request carries it; the
|
|
312
|
+
// base branch moves only when the host merges. `spec-env
|
|
313
|
+
// integrate` then plans a rebase onto <remote>/<base> and a
|
|
314
|
+
// consent-gated push (`--push` consents; already-pushed-at-HEAD
|
|
315
|
+
// counts as consent; otherwise the plan holds), and a landed
|
|
316
|
+
// branch prints the finish — base catch-up plus the deferred
|
|
317
|
+
// `afterLand`. `--strategy ff|pr` on integrate overrides this per
|
|
318
|
+
// invocation; an unrecognised config value falls back to "ff".
|
|
319
|
+
// remote: where the branch is pushed. Default "origin".
|
|
320
|
+
// draft: mid-spec PRs open as drafts (a draft cannot be merged, so
|
|
321
|
+
// nothing downstream can close a ticket early); /spec-complete is
|
|
322
|
+
// what flips the PR to ready. Default true.
|
|
323
|
+
// specDocs: where a SPEC DOCUMENT lands under "pr". "trunk" (default) keeps
|
|
324
|
+
// today's authoring land — needs direct push for docs. "branch"
|
|
325
|
+
// has the spec ride the feature branch and land with the work's
|
|
326
|
+
// PR; the backlog is then found via the tracker listing, and the
|
|
327
|
+
// authoring worktree stays (it is the document's only copy).
|
|
328
|
+
// The merged-check and PR commands need the host's CLI — `gh` on github.com,
|
|
329
|
+
// `az` on dev.azure.com — detected from the remote URL, never configured. An
|
|
330
|
+
// unknown host (Enterprise/Server domains included) degrades to the ancestry
|
|
331
|
+
// test plus generic printed commands, and every failed lookup is a
|
|
332
|
+
// cannot-tell: teardown then HOLDS the worktree rather than guessing.
|
|
333
|
+
"land": {
|
|
334
|
+
"strategy": "ff",
|
|
335
|
+
"remote": "origin",
|
|
336
|
+
"draft": true,
|
|
337
|
+
"specDocs": "trunk"
|
|
338
|
+
},
|
|
339
|
+
|
|
281
340
|
// Teardown safety. --force overrides both. refuseTeardownIfUnpushed only
|
|
282
341
|
// blocks when the commits are ALSO unmerged into the base branch — a branch
|
|
283
342
|
// already landed on base tears down (and its branch is deleted) without
|
|
@@ -288,9 +347,12 @@ through to a documented conservative default; see the field notes below.
|
|
|
288
347
|
},
|
|
289
348
|
|
|
290
349
|
// What teardown cleans up beyond this machine. Nothing publishes a spec
|
|
291
|
-
// branch
|
|
292
|
-
//
|
|
293
|
-
// forever.
|
|
350
|
+
// branch unasked — a remote copy exists because you pushed it by hand, or
|
|
351
|
+
// because a PR-mode land pushed it behind the consent gate — and without this
|
|
352
|
+
// a completed spec leaves that merged branch on the remote forever. (Hosts
|
|
353
|
+
// that auto-delete the branch on merge make the planned delete an
|
|
354
|
+
// already-gone no-op, reported as such, never as a failure.)
|
|
355
|
+
// `deleteRemoteBranch`:
|
|
294
356
|
// "prompt" (default) — plan `git push <remote> --delete <branch>` in its own
|
|
295
357
|
// "confirm with the user first" section; /spec-complete and
|
|
296
358
|
// /spec-cancel ask before running it.
|
|
@@ -349,11 +411,36 @@ through to a documented conservative default; see the field notes below.
|
|
|
349
411
|
// `hotfix land --push`; without it the land holds before the carry. The
|
|
350
412
|
// worktree stays until `spec-env hotfix finish`. Default: built-in patch tag,
|
|
351
413
|
// carry to main, no targets.
|
|
414
|
+
//
|
|
415
|
+
// `releaseBranch` makes hotfixes BRANCH-BASED, for a team whose release line
|
|
416
|
+
// is a branch rather than a tag. Worked example — an rc flow:
|
|
417
|
+
// master takes only rc merges and hotfixes; prod is whatever it holds
|
|
418
|
+
// 2026/Q4 the current release candidate (`baseBranchPattern: "20??/Q?"`)
|
|
419
|
+
// Test/Demo/Live env branches that take merges from master — OUT OF SCOPE:
|
|
420
|
+
// merging master into them stays your pipeline's job
|
|
421
|
+
// With `"releaseBranch": "master"`, `spec-env up hotfix-<name> --docs` fetches
|
|
422
|
+
// and forks from origin/master's head and prints the header to record —
|
|
423
|
+
// `> **Base version:** master@<sha>`. `hotfix land` then rebases onto
|
|
424
|
+
// origin/master and lands ON it by `land.strategy` (`--strategy` overrides):
|
|
425
|
+
// "ff" pushes the hotfix onto master; "pr" opens a READY pull request and
|
|
426
|
+
// holds until the host merges it. The fix is then carried to the resolved base
|
|
427
|
+
// (the newest rc) — directly under "ff", through a `carry/<slug>` branch and
|
|
428
|
+
// its own ready PR under "pr". `hotfix finish` tears down once both are
|
|
429
|
+
// confirmed. Empty (the default) = the tag flow above, unchanged; a hotfix
|
|
430
|
+
// keeps landing the way its own `Base version` says it was cut.
|
|
431
|
+
//
|
|
432
|
+
// `tag` (default true) keeps the release tag on a branch-based hotfix, bumped
|
|
433
|
+
// from the newest tag the release branch has; false is for a team whose deploy
|
|
434
|
+
// is driven by the env-branch merge rather than a tag. Under "pr",
|
|
435
|
+
// `releaseWith` refuses — a squash or rebase merge leaves its tag on a commit
|
|
436
|
+
// the release branch never has — so use the built-in tag there.
|
|
352
437
|
"hotfix": {
|
|
353
438
|
"releaseWith": "",
|
|
354
439
|
"bump": "patch",
|
|
355
440
|
"cherryPickMain": true,
|
|
356
|
-
"targets": []
|
|
441
|
+
"targets": [],
|
|
442
|
+
"releaseBranch": "",
|
|
443
|
+
"tag": true
|
|
357
444
|
},
|
|
358
445
|
|
|
359
446
|
// Reading a spec's diff (`spec-env review`, `/spec-diff`).
|
|
@@ -566,9 +653,57 @@ through to a documented conservative default; see the field notes below.
|
|
|
566
653
|
}
|
|
567
654
|
```
|
|
568
655
|
|
|
656
|
+
## A project in a subfolder of its repo
|
|
657
|
+
|
|
658
|
+
Most projects ARE their repo: `specs/` and `.claude/` sit at the git root. Some
|
|
659
|
+
cannot — a Visual Studio solution folder beside `Sql/` and a prototype or two,
|
|
660
|
+
where sessions start in the solution folder, so that is where `.claude/` must be
|
|
661
|
+
for its skills and hooks to load, and where `specs/` belongs. That works with no
|
|
662
|
+
configuration:
|
|
663
|
+
|
|
664
|
+
```
|
|
665
|
+
C:\Code\LSC App\ ← git root
|
|
666
|
+
├── FF.CSC.Solution\ ← the project: specs/, .claude/, run Claude here
|
|
667
|
+
├── Sql\
|
|
668
|
+
└── Prototype\
|
|
669
|
+
C:\Code\LSC App-wt\<spec>\ ← each spec's worktree, beside the repo
|
|
670
|
+
```
|
|
671
|
+
|
|
672
|
+
- **The project is found, not configured.** Every `spec-env` verb walks up from
|
|
673
|
+
where it is run to the nearest folder holding `specs/.core/`, stopping at the
|
|
674
|
+
git root. Found at the root, it behaves exactly as it always has; found in a
|
|
675
|
+
subfolder, that subfolder is the project — from inside it or anywhere beneath
|
|
676
|
+
it. `spec-env resolve` and `skitterspec status` print a
|
|
677
|
+
`subfolder: FF.CSC.Solution/ (in repo C:\Code\LSC App)` line when it is not
|
|
678
|
+
the root, and nothing extra when it is. Several projects in one repo are not
|
|
679
|
+
supported: the nearest `specs/.core/` wins.
|
|
680
|
+
- **Repo-level things resolve against the repo root**: `worktree.root`, `{repo}`
|
|
681
|
+
(`LSC App`, not the project folder's name) and therefore the worktree layout.
|
|
682
|
+
A spec's worktree is a checkout of the whole repo, with the project at the same
|
|
683
|
+
place inside it.
|
|
684
|
+
- **Everything in this file is project-relative**: `setup`, `dev`, seed files,
|
|
685
|
+
`docker.composeFile` and `docker.envFile`, `registry`, `spec.companionPaths`,
|
|
686
|
+
and the folder `/spec-start` moves the session into
|
|
687
|
+
(`<worktree>/FF.CSC.Solution`). Git commands run against the worktree.
|
|
688
|
+
- **The review page lists git paths**, so the project's files carry its folder
|
|
689
|
+
(`FF.CSC.Solution/specs/…`) and a change beside it (`Sql/…`) is shown as code.
|
|
690
|
+
- **The main guard covers the whole primary checkout**, not only the project
|
|
691
|
+
folder: a write to `Sql/` on the base branch is unreviewed work too.
|
|
692
|
+
- **Install skitterspec in the project folder or above it.** The hooks find the
|
|
693
|
+
engine by walking UP from the session's folder to a `node_modules/.bin`; an
|
|
694
|
+
install below the project (say an Angular `ClientApp/node_modules`) is not
|
|
695
|
+
found, and the hooks fall back to `skitterspec` on your PATH.
|
|
696
|
+
- **Run `spec-sync` from the project folder.** The tracker providers take the
|
|
697
|
+
project from where they are run (or `--dir`); `release.ignorePaths` are read
|
|
698
|
+
against the project, so `specs/` means the project's.
|
|
699
|
+
- **Windows**: git prints `/` and paths with spaces are quoted in every command
|
|
700
|
+
the engine prints. A deep spec folder inside a worktree can pass 260
|
|
701
|
+
characters — set `git config --global core.longpaths true` once.
|
|
702
|
+
|
|
569
703
|
## Token expansion
|
|
570
704
|
|
|
571
|
-
- `{repo}` —
|
|
705
|
+
- `{repo}` — the repo root's dir basename (e.g. `skitterspec`) — the primary
|
|
706
|
+
checkout's root, which for a project in a subfolder is the folder above it.
|
|
572
707
|
- `{repoSlug}` — `{repo}` lower-cased, non-alphanumerics collapsed to `-`
|
|
573
708
|
(safe for a `COMPOSE_PROJECT_NAME`).
|
|
574
709
|
- `{slug}` — the spec slug (folder name minus its `feat-`/`bug-`/`hotfix-`/`chore-` prefix).
|
|
@@ -81,12 +81,22 @@ function readPayload() {
|
|
|
81
81
|
* the local install is looked for by path first — walking up from the project,
|
|
82
82
|
* because a git worktree's checkout has its own `node_modules`.
|
|
83
83
|
*/
|
|
84
|
-
|
|
84
|
+
const ENGINES = ['skitterspec', 'skitterspec-linear', 'skitterspec-jira', 'skitterspec-github', 'skitterspec-azure-boards']
|
|
85
|
+
|
|
86
|
+
function findEngine(projectDir, platform = process.platform) {
|
|
85
87
|
if (process.env.SKITTERSPEC_BIN) return process.env.SKITTERSPEC_BIN
|
|
86
88
|
let at = projectDir
|
|
87
89
|
for (let i = 0; i < 6 && at; i++) {
|
|
88
|
-
for (const name of
|
|
89
|
-
|
|
90
|
+
for (const name of ENGINES) {
|
|
91
|
+
// ON WINDOWS, THE PACKAGE'S OWN JS ENTRY, never `.bin/<name>`. That is a
|
|
92
|
+
// shell shim nothing here can execute (spawn refuses it: EFTYPE), and the
|
|
93
|
+
// `.cmd` beside it needs a shell — which a hook handing a tool's command
|
|
94
|
+
// line over as an argument must never use. Unreachable, the hook failed
|
|
95
|
+
// open, and every guard was silently off on Windows (chore-windows-ci).
|
|
96
|
+
const candidate =
|
|
97
|
+
platform === 'win32'
|
|
98
|
+
? path.join(at, 'node_modules', '@skitterbyte', name, 'bin', `${name}.js`)
|
|
99
|
+
: path.join(at, 'node_modules', '.bin', name)
|
|
90
100
|
if (fs.existsSync(candidate)) return candidate
|
|
91
101
|
}
|
|
92
102
|
const up = path.dirname(at)
|
|
@@ -96,6 +106,13 @@ function findEngine(projectDir) {
|
|
|
96
106
|
return 'skitterspec'
|
|
97
107
|
}
|
|
98
108
|
|
|
109
|
+
// How to run what `findEngine` found: a `.js` engine through this node, since
|
|
110
|
+
// Windows cannot execute one directly — anything else as itself, as before.
|
|
111
|
+
function engineCommand(projectDir, platform = process.platform) {
|
|
112
|
+
const engine = findEngine(projectDir, platform)
|
|
113
|
+
return /\.[cm]?js$/i.test(engine) ? { file: process.execPath, args: [engine] } : { file: engine, args: [] }
|
|
114
|
+
}
|
|
115
|
+
|
|
99
116
|
// The tools that write a file. A matcher is configured too, but a hook that is
|
|
100
117
|
// reached some other way must still be inert rather than guessing.
|
|
101
118
|
//
|
|
@@ -117,6 +134,15 @@ function writeTarget(input) {
|
|
|
117
134
|
return null
|
|
118
135
|
}
|
|
119
136
|
|
|
137
|
+
// The engine's own refusal line, from `spec-env main check`. Pure.
|
|
138
|
+
//
|
|
139
|
+
// WHAT WOULD FOOL THIS: an engine that crashes after printing that line. The
|
|
140
|
+
// refusal is the last thing `check` writes, so a crash before it prints nothing
|
|
141
|
+
// — and one after it has already decided.
|
|
142
|
+
function isRefusal(stdout) {
|
|
143
|
+
return /^spec-env main: /m.test(stdout || '')
|
|
144
|
+
}
|
|
145
|
+
|
|
120
146
|
function main() {
|
|
121
147
|
const payload = readPayload()
|
|
122
148
|
if (!payload) allow()
|
|
@@ -138,14 +164,22 @@ function main() {
|
|
|
138
164
|
const target = writeTarget(payload.tool_input)
|
|
139
165
|
if (target) argv.push('--path', target)
|
|
140
166
|
|
|
141
|
-
const
|
|
167
|
+
const engine = engineCommand(cwd)
|
|
168
|
+
const result = spawnSync(engine.file, [...engine.args, ...argv], { cwd, encoding: 'utf8', timeout: 8000 })
|
|
142
169
|
|
|
143
170
|
// No engine, a crash, a timeout — all cannot-tell. `status` is null when the
|
|
144
171
|
// process never ran or was killed, and neither is a refusal.
|
|
145
172
|
if (result.error || result.status === null) allow()
|
|
146
173
|
if (result.status !== 1) allow()
|
|
147
174
|
|
|
148
|
-
|
|
175
|
+
// EXIT 1 ALONE IS NOT A REFUSAL. Node exits 1 on an uncaught exception, so an
|
|
176
|
+
// engine that cannot even load looks exactly like one refusing — and read
|
|
177
|
+
// that way it denied every Edit and Write in the session. The positive signal
|
|
178
|
+
// is the refusal the engine PRINTS; a crash prints nothing on stdout.
|
|
179
|
+
const said = (result.stdout || '').trim()
|
|
180
|
+
if (!isRefusal(said)) allow()
|
|
181
|
+
|
|
182
|
+
deny(said)
|
|
149
183
|
}
|
|
150
184
|
|
|
151
185
|
// Guarded so the pieces above can be required and tested without the script
|
|
@@ -159,4 +193,4 @@ if (require.main === module) {
|
|
|
159
193
|
}
|
|
160
194
|
}
|
|
161
195
|
|
|
162
|
-
module.exports = { findEngine, WRITE_TOOLS, writeTarget }
|
|
196
|
+
module.exports = { findEngine, engineCommand, WRITE_TOOLS, writeTarget, isRefusal }
|
|
@@ -78,12 +78,22 @@ function readPayload() {
|
|
|
78
78
|
* is the fallback for a global install, and `SKITTERSPEC_BIN` overrides
|
|
79
79
|
* everything for anyone whose layout is neither.
|
|
80
80
|
*/
|
|
81
|
-
|
|
81
|
+
const ENGINES = ['skitterspec', 'skitterspec-linear', 'skitterspec-jira', 'skitterspec-github', 'skitterspec-azure-boards']
|
|
82
|
+
|
|
83
|
+
function findEngine(projectDir, platform = process.platform) {
|
|
82
84
|
if (process.env.SKITTERSPEC_BIN) return process.env.SKITTERSPEC_BIN
|
|
83
85
|
let at = projectDir
|
|
84
86
|
for (let i = 0; i < 6 && at; i++) {
|
|
85
|
-
for (const name of
|
|
86
|
-
|
|
87
|
+
for (const name of ENGINES) {
|
|
88
|
+
// ON WINDOWS, THE PACKAGE'S OWN JS ENTRY, never `.bin/<name>`. That is a
|
|
89
|
+
// shell shim nothing here can execute (spawn refuses it: EFTYPE), and the
|
|
90
|
+
// `.cmd` beside it needs a shell — which a hook handing a tool's command
|
|
91
|
+
// line over as an argument must never use. Unreachable, the hook failed
|
|
92
|
+
// open, and every guard was silently off on Windows (chore-windows-ci).
|
|
93
|
+
const candidate =
|
|
94
|
+
platform === 'win32'
|
|
95
|
+
? path.join(at, 'node_modules', '@skitterbyte', name, 'bin', `${name}.js`)
|
|
96
|
+
: path.join(at, 'node_modules', '.bin', name)
|
|
87
97
|
if (fs.existsSync(candidate)) return candidate
|
|
88
98
|
}
|
|
89
99
|
const up = path.dirname(at)
|
|
@@ -93,6 +103,22 @@ function findEngine(projectDir) {
|
|
|
93
103
|
return 'skitterspec'
|
|
94
104
|
}
|
|
95
105
|
|
|
106
|
+
// How to run what `findEngine` found: a `.js` engine through this node, since
|
|
107
|
+
// Windows cannot execute one directly — anything else as itself, as before.
|
|
108
|
+
function engineCommand(projectDir, platform = process.platform) {
|
|
109
|
+
const engine = findEngine(projectDir, platform)
|
|
110
|
+
return /\.[cm]?js$/i.test(engine) ? { file: process.execPath, args: [engine] } : { file: engine, args: [] }
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// The engine's own refusal line, from `spec-env review gate --check`. Pure.
|
|
114
|
+
//
|
|
115
|
+
// WHAT WOULD FOOL THIS: an engine that crashes after printing that line. The
|
|
116
|
+
// refusal is written last, after every read has succeeded, so a crash before
|
|
117
|
+
// it prints nothing — and one after it has already decided.
|
|
118
|
+
function isRefusal(stdout) {
|
|
119
|
+
return /^spec-env review gate: /m.test(stdout || '')
|
|
120
|
+
}
|
|
121
|
+
|
|
96
122
|
function main() {
|
|
97
123
|
const payload = readPayload()
|
|
98
124
|
if (!payload) allow()
|
|
@@ -108,9 +134,10 @@ function main() {
|
|
|
108
134
|
// its own checkout, and the answer differs per worktree.
|
|
109
135
|
const cwd = typeof payload.cwd === 'string' && payload.cwd ? payload.cwd : process.cwd()
|
|
110
136
|
|
|
137
|
+
const engine = engineCommand(cwd)
|
|
111
138
|
const result = spawnSync(
|
|
112
|
-
|
|
113
|
-
['spec-env', 'review', 'gate', '--check', '--for-command', command, '--dir', cwd],
|
|
139
|
+
engine.file,
|
|
140
|
+
[...engine.args, 'spec-env', 'review', 'gate', '--check', '--for-command', command, '--dir', cwd],
|
|
114
141
|
{ cwd, encoding: 'utf8', timeout: 8000 },
|
|
115
142
|
)
|
|
116
143
|
|
|
@@ -119,8 +146,16 @@ function main() {
|
|
|
119
146
|
if (result.error || result.status === null) allow()
|
|
120
147
|
if (result.status !== 1) allow()
|
|
121
148
|
|
|
149
|
+
// EXIT 1 ALONE IS NOT A REFUSAL. Node exits 1 on an uncaught exception, so an
|
|
150
|
+
// engine that cannot even load looks exactly like one saying "armed" — and
|
|
151
|
+
// once read that way it denied every Bash call in the session, the operator's
|
|
152
|
+
// own `!` commands included. The positive signal is the refusal the engine
|
|
153
|
+
// PRINTS; a crash prints nothing on stdout, so it allows.
|
|
154
|
+
const said = (result.stdout || '').trim()
|
|
155
|
+
if (!isRefusal(said)) allow()
|
|
156
|
+
|
|
122
157
|
deny(
|
|
123
|
-
|
|
158
|
+
said +
|
|
124
159
|
'\n\nThis phase is waiting on a verdict. Relay these to the operator ' +
|
|
125
160
|
'rather than choosing one: press a verdict on the page, /spec-reviewed if ' +
|
|
126
161
|
'a pass is already waiting, or /spec-skip "<reason>" to move on with the ' +
|
|
@@ -143,4 +178,4 @@ if (require.main === module) {
|
|
|
143
178
|
}
|
|
144
179
|
}
|
|
145
180
|
|
|
146
|
-
module.exports = { findEngine }
|
|
181
|
+
module.exports = { findEngine, engineCommand, isRefusal }
|
|
@@ -7,7 +7,7 @@ and lifecycle stay consistent. Each sets a status on the spec header
|
|
|
7
7
|
|
|
8
8
|
| Skill | Purpose | Status | Folder |
|
|
9
9
|
|-------|---------|--------|--------|
|
|
10
|
-
| `/spec` | (Feature/Chore/Issue) Grill to a clear shared understanding, propose the kind, write a groomed spec in its own worktree, then land it on the verdict | `Ready` (or `Draft`) | `specs/backlog/` (on the base branch
|
|
10
|
+
| `/spec` | (Feature/Chore/Issue) Grill to a clear shared understanding, propose the kind, write a groomed spec in its own worktree, then land it on the verdict | `Ready` (or `Draft`) | `specs/backlog/` (on the base branch by a fast-forward — or riding the feature branch under `land.specDocs: "branch"`) |
|
|
11
11
|
| `/spec-bug` | (Bug) Reproduce with a failing test, capture spec, drive red→green | `In Progress` | `specs/in-progress/` |
|
|
12
12
|
| `/spec-hotfix` | (Hotfix) Fork a worktree from a release tag, red→green, land by tag + cherry-pick | `In Progress` | `specs/in-progress/` |
|
|
13
13
|
| `/spec-incident` | (Incident) Capture a live outage as a record written during it — grill, write in flight, fixes as separate linked specs | `In Progress` | `specs/in-progress/` |
|
|
@@ -157,6 +157,9 @@ build phase 1 now? Say yes and it carries on into a bare `/spec-next`; say no an
|
|
|
157
157
|
you are already standing in the worktree, so `/spec-next` typed later does the
|
|
158
158
|
same thing. The primary checkout stays on the base branch throughout — the
|
|
159
159
|
session followed the spec, nothing was checked out anywhere.
|
|
160
|
+
That is also why the base branch reads `backlog` for a spec being built: the
|
|
161
|
+
move happened on its branch. **`skitterspec status`** reads each worktree's own
|
|
162
|
+
copy and lists what is in flight and how far along it is.
|
|
160
163
|
**`checkout`** builds the branch in the primary checkout instead: one spec at a
|
|
161
164
|
time, nowhere else to stand, and the build always carries straight on.
|
|
162
165
|
The difference is how many specs can be in flight at once.
|
|
@@ -179,7 +182,7 @@ your canonical `localhost` ports so you can test it at the normal URL
|
|
|
179
182
|
move, header edits, the code) happens on the spec's branch in the worktree; `main`
|
|
180
183
|
changes only when it merges. Teardown is folded into `/spec-complete` ·
|
|
181
184
|
`/spec-cancel`. Beneath the skills, `skitterspec spec-env
|
|
182
|
-
<up|bootstrap|nospec|main|down|prune|dev|connect|integrate|hotfix|live|review|stage|status|resolve>` is the CLI
|
|
185
|
+
<up|bootstrap|nospec|main|down|prune|dev|connect|integrate|disposition|handoff|hotfix|live|review|stage|status|resolve|base>` is the CLI
|
|
183
186
|
engine. `up` plans the fork;
|
|
184
187
|
**`bootstrap` then runs the worktree's own steps itself** — seeding the gitignored files, the env file, `setup`, the stack — so
|
|
185
188
|
the command a skill runs names no file, and a secrets hook that refuses any
|
|
@@ -234,6 +237,16 @@ worktree: `Commit & Start` keeps it and carries into `/spec-start`, plain
|
|
|
234
237
|
`commit` tears it down, because a spec parked in the backlog should hold no
|
|
235
238
|
checkout.
|
|
236
239
|
|
|
240
|
+
**`land.specDocs: "branch"` is the exception, taken deliberately.** Where the
|
|
241
|
+
base branch accepts no direct push even for documents, the spec rides its
|
|
242
|
+
feature branch and lands with the work's PR: both verdicts commit and skip the
|
|
243
|
+
integrate, plain `commit` keeps branch and worktree (they are the document's
|
|
244
|
+
only copy), and the backlog is found through the tracker listing rather than
|
|
245
|
+
`ls specs/backlog/` on base — the known branch-relative-bucket cost, accepted
|
|
246
|
+
because the alternative is a spec that cannot be written at all. The worktree
|
|
247
|
+
fork-point check is exempt in this mode for the hotfix's reason: the spec is
|
|
248
|
+
*supposed* to be absent from the fork point.
|
|
249
|
+
|
|
237
250
|
**What this bought is the reason it changed.** The page waits for a verdict
|
|
238
251
|
without a timeout — deliberately, because a reader walking away from a diff is
|
|
239
252
|
the normal case — and while the spec was authored in the primary checkout that
|
|
@@ -497,15 +510,60 @@ against a committed last-pushed snapshot and applies it) and `/spec-status`
|
|
|
497
510
|
backed by a `spec-sync` CLI. There is no content pull — the tracker is never
|
|
498
511
|
read back or merged.
|
|
499
512
|
|
|
500
|
-
**
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
with
|
|
508
|
-
|
|
513
|
+
**What a ticket carries is the project's choice (`mapping.description`).**
|
|
514
|
+
Under `"spec"` the issue body is the whole overview and each phase sub-issue
|
|
515
|
+
its phase file, replaced on every push — what every config written before the
|
|
516
|
+
setting existed gets. Under `"summary"`, what a new config is written with, the
|
|
517
|
+
spec stays in git and the ticket gets what a ticket is for: a delimited
|
|
518
|
+
**block** holding the spec's `## Summary`, its `## Acceptance criteria`, the
|
|
519
|
+
Impact table's surfaces, its gating and its progress (`62% · phase 3 of 4`),
|
|
520
|
+
with each sub-issue's block holding its goal and task count. Push **splices**
|
|
521
|
+
the block into whatever the description holds, so a team's own text around it
|
|
522
|
+
survives every push, and only an edit *inside* the block is drift. That is a
|
|
523
|
+
splice, not a pull: nothing outside the block is parsed, merged or written
|
|
524
|
+
back. A delimiter edited by hand is cannot-tell — the push names it and writes
|
|
525
|
+
nothing there rather than guess. `mapping.phases: "none"` drops the phase
|
|
526
|
+
objects entirely; `subissue` stays the default because assignable phases are
|
|
527
|
+
what let them run in parallel.
|
|
528
|
+
|
|
529
|
+
**The tracker owns status; the repo owns the spec.** With a provider attached,
|
|
530
|
+
a team runs its work from the board — assignment, Ready, Blocked, Cancelled and
|
|
531
|
+
Done all happen there — so a status kept in the repo as well is a copy somebody
|
|
532
|
+
has to keep in step by hand, and on the base branch it was already wrong (an
|
|
533
|
+
in-flight spec still reads `backlog` there). The split follows what each side
|
|
534
|
+
can actually know:
|
|
535
|
+
|
|
536
|
+
1. **The repo owns the content** — Problem, Decisions, phases, checkboxes,
|
|
537
|
+
Changelog. Content follows branches, lands in the same commit as its code,
|
|
538
|
+
and is read offline by the agent building it. That is why specs did not move
|
|
539
|
+
into the tracker wholesale: a ticket has no branches.
|
|
540
|
+
2. **The tracker owns status and assignee** — `sync.fieldOwnership`
|
|
541
|
+
`workflowState` and `assignee` ship as **`pull`**. Under `pull` the skills
|
|
542
|
+
write no `Status:` header, no `Developer:` line and no State log row (the
|
|
543
|
+
`spec-status-owner` seam asks `spec-sync ownership` first), `assign` writes
|
|
544
|
+
the ticket directly, and the repo stores nothing it reads.
|
|
545
|
+
3. **Buckets are code facts**, not planning status: `backlog` (not started),
|
|
546
|
+
`in-progress` (`/spec-start` ran), `complete` (landed — merged on the host
|
|
547
|
+
under PR landing), `cancelled` (torn down). Only skills that act on code move
|
|
548
|
+
them.
|
|
549
|
+
4. **The repo writes status only when it acts on code** — creation, start,
|
|
550
|
+
complete, cancel — detected as a bucket move, never on a push that merely
|
|
551
|
+
cannot tell. Under PR landing the complete transition waits for run 2: a
|
|
552
|
+
ready PR is not a merged one.
|
|
553
|
+
5. **A board that finished first is reported, never obeyed.** `spec-sync board`
|
|
554
|
+
says one line when the ticket is Done or Cancelled while the spec is still in
|
|
555
|
+
flight, naming the cleanup; `/spec-start` and `/spec-next` warn and carry on,
|
|
556
|
+
`/spec-status` reports. Nobody is obliged to sync, because nothing reads the
|
|
557
|
+
bucket as planning truth any more.
|
|
558
|
+
|
|
559
|
+
`"push"` on either field restores the repo-owned behaviour; `"none"` leaves it
|
|
560
|
+
alone entirely. Without a provider none of this applies: the header, the State
|
|
561
|
+
log and the buckets keep their meaning, because there is nowhere else for status
|
|
562
|
+
to live. Releases and deployments are the host project's to record. The one
|
|
563
|
+
release question skitterspec answers is which tickets a commit range contains
|
|
564
|
+
(`spec-sync released <range> --json`, each row with its spec and url), because
|
|
565
|
+
only the `Refs:` trailers know. What the project's CI does with that list is its
|
|
566
|
+
own business.
|
|
509
567
|
|
|
510
568
|
**One-way means the repo wins, and it now wins *loudly*.** Those are different
|
|
511
569
|
claims and only the first was ever in doubt. A ticket's description is generated
|
|
@@ -538,13 +596,14 @@ disk at all. The tracker knows both, and each row carries the spec's folder name
|
|
|
538
596
|
so `/spec-start <name>` is a copy-paste away. See the provider's own docs for
|
|
539
597
|
what it calls the command.
|
|
540
598
|
|
|
541
|
-
A provider
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
599
|
+
A provider also knows **who is building a spec**, and under the default `pull`
|
|
600
|
+
the ticket's assignee is the record: `/spec-start` assigns the operator only when
|
|
601
|
+
nobody holds the ticket (`assign --if-unassigned`), never reassigns anyone, and
|
|
602
|
+
leaves the assignee in place when the spec finishes — the board keeps who did
|
|
603
|
+
the work. `/spec-claim` moves ownership mid-flight — take it, hand it back, or
|
|
604
|
+
hand it to a teammate — by writing the ticket directly. Under `push` the spec
|
|
605
|
+
file is the record and the ticket the mirror, as before. See the provider's own
|
|
606
|
+
docs for both.
|
|
548
607
|
|
|
549
608
|
**Every skill that moves a spec through the lifecycle carries a seam**, so the
|
|
550
609
|
mirror keeps up without anyone remembering to push: `/spec`, `/spec-bug` and
|
|
@@ -713,6 +772,10 @@ Every spec header carries:
|
|
|
713
772
|
(one-way; the repo owns the link), and `/spec-complete` on the incident
|
|
714
773
|
counts the spec among its fixes. Absent on everything else.
|
|
715
774
|
|
|
775
|
+
**Under a provider's default `pull`, these three are the tracker's** —
|
|
776
|
+
`Status:`, `Developer:` and the State log — and new specs carry
|
|
777
|
+
`> **Tracker:** <url>` instead; see the ticketing section above. A spec that already has them keeps them as history.
|
|
778
|
+
|
|
716
779
|
Every spec also has a **State log** table — the audit trail of folder/status
|
|
717
780
|
transitions. Each lifecycle skill appends exactly one row when it changes state:
|
|
718
781
|
|
|
@@ -448,7 +448,7 @@ behind it — say nothing rather than reporting that there was nothing to report
|
|
|
448
448
|
| `Built` | What the run produced — the code, the edits, the spec written. |
|
|
449
449
|
| `Tests` | The result and the command that produced it. |
|
|
450
450
|
| `Notes` | What this run hit and handled — one short paragraph. Named `Snags` once, which announced a problem before the reader had read one; most of what belongs here is neither good nor bad, just worth knowing. A wrong turn, a guard that fired, a check of yours that turned out to be a false negative. Not a caveat on the outcome (`⚠️` and `Why` carry those) and not future work (`Follow-ups` carries that): this is what happened on the way. |
|
|
451
|
-
| `Landed` | A fast-forward, a tag, a cherry-pick. |
|
|
451
|
+
| `Landed` | A fast-forward, a tag, a cherry-pick — or in PR mode the PR itself: `PR #14 (draft) updated` · `PR #14 opened — finish after merge` · `PR #14 merged` · `held — not pushed` (a declined consent is a true outcome, not a failure). |
|
|
452
452
|
| `Worktree` | A worktree provisioned, entered, or torn down. |
|
|
453
453
|
| `Untouched` | Uncommitted work the run deliberately left alone — whose, and how much. |
|
|
454
454
|
| `Review` | The rendered diff page: files, `+`/`−`, and the stack — the same tiers the banner lists, labelled, run together with `·` because a row is one cell, with any `network` alternates inline after the network URL (`also <url> (tailnet)`), plus `live` where the engine reported one. **No question** — a row cannot be waited on, so a question in one is unanswerable by construction (see *asking implies waiting*). **Omitted entirely when the run is waiting on a verdict**: the banner after the block carries it instead, and a row saying the same thing beside it splits the reader's attention across two places. |
|