@skitterbyte/skitterspec-github 1.3.0 → 2.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.
- package/MIGRATION.md +170 -1
- package/README.md +9 -7
- package/assets/core/SETUP.md +10 -12
- package/assets/core/env.config.md +1 -1
- package/assets/core/github.config.json.example +2 -1
- package/assets/core/github.config.md +51 -69
- package/assets/rules/spec-planning.md +35 -12
- package/assets/rules/spec-reports.md +28 -2
- package/assets/skills/no-spec/SKILL.md +2 -2
- package/assets/skills/spec/SKILL.md +31 -8
- package/assets/skills/spec-bug/SKILL.md +2 -2
- package/assets/skills/spec-github-setup/SKILL.md +6 -4
- package/assets/skills/spec-list/SKILL.md +28 -4
- package/assets/skills/spec-next/SKILL.md +2 -2
- package/assets/skills/spec-status/SKILL.md +28 -27
- package/assets/skills/spec-sync/SKILL.md +11 -27
- package/package.json +1 -1
- package/src/cli.js +108 -3
- package/src/env/resolve.js +11 -4
- package/src/env/review.js +79 -0
- package/src/vendor/github/api.js +86 -123
- package/src/vendor/github/cli-sync.js +106 -83
- package/src/vendor/github/config.js +21 -58
- package/src/vendor/github/mcp.js +1 -5
- package/src/vendor/provider-kit/src/config.js +101 -48
- package/src/vendor/provider-kit/src/list-assignee.js +71 -0
- package/src/vendor/provider-kit/src/list-rows.js +35 -0
- package/src/vendor/provider-kit/src/released.js +27 -77
- package/src/vendor/provider-kit/src/specs.js +89 -7
- package/src/vendor/sync-core/index.js +3 -4
- package/src/vendor/sync-core/src/compare.js +6 -6
- package/src/vendor/sync-core/src/normalize.js +60 -59
- package/src/vendor/provider-kit/src/releases.js +0 -595
|
@@ -93,9 +93,10 @@ automations are theirs to choose.
|
|
|
93
93
|
merged → Done" workflows**, or leave them knowingly: the engine sets Status
|
|
94
94
|
itself, and a board automation moving it too is a second writer the next push
|
|
95
95
|
overrides.
|
|
96
|
-
- **
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
- **Release stages never go on Status** (Test, Demo, Prod), or a finished
|
|
97
|
+
phase reads as deployed. If the user tracks deploys, that is a field of their
|
|
98
|
+
own that their CI sets from `spec-sync released --json` — setup does not need
|
|
99
|
+
it, and skitterspec never writes it.
|
|
99
100
|
|
|
100
101
|
## 5. Check the Status options
|
|
101
102
|
|
|
@@ -203,7 +204,8 @@ Then name the next step:
|
|
|
203
204
|
|
|
204
205
|
- `/spec` — write a spec; with GitHub configured it creates the linked issue in
|
|
205
206
|
the configured repo, puts it on the board and stamps its number.
|
|
206
|
-
- `/spec-status` — read-only
|
|
207
|
+
- `/spec-status` — read-only report of what would push, the safe way to prove
|
|
208
|
+
the link works.
|
|
207
209
|
- `/spec-push` — send a spec up.
|
|
208
210
|
|
|
209
211
|
Mention what setup did **not** configure, so the defaults aren't mistaken for
|
|
@@ -32,6 +32,10 @@ The user asks in plain language; the engine takes flags. Map, then run:
|
|
|
32
32
|
| "what specs are there", "/spec-list" | *(none — the live default)* |
|
|
33
33
|
| "what's done", "everything" | `--all` |
|
|
34
34
|
| "what's cancelled", a named status | `--state "<name>"` (repeatable) |
|
|
35
|
+
| "what's next", "the next few in the backlog" | `--next N` |
|
|
36
|
+
| "what's in progress", a lifecycle bucket | `--state in-progress` |
|
|
37
|
+
| "what's mine", "what am I on" | `--mine` |
|
|
38
|
+
| "what is Priya doing", a named person | `--by "<name or email>"` |
|
|
35
39
|
|
|
36
40
|
The default scope is **live** — whatever `config.states` maps `backlog` and
|
|
37
41
|
`in-progress` to. It is deliberately not everything: in a project with any
|
|
@@ -40,14 +44,34 @@ history, Done dwarfs the rows anyone wanted.
|
|
|
40
44
|
`--state` and `--all` are **alternatives**, and the engine refuses the pair
|
|
41
45
|
rather than letting one win silently.
|
|
42
46
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
47
|
+
`--mine` and `--by` filter by **assignee** and combine with the scope; they
|
|
48
|
+
cannot be combined with each other. Every row carries its assignee, and a
|
|
49
|
+
ticket no spec has adopted yet is listed too, marked `(no spec)` — under
|
|
50
|
+
`--mine` that is often exactly what is next. `--mine` with an unknown identity
|
|
51
|
+
lists **nothing** and says why (`spec-sync whoami --set` fixes it); relay that
|
|
52
|
+
rather than retrying without the filter. `--by` matching nobody or several
|
|
53
|
+
people exits 1 and names them — relay it and ask which one.
|
|
54
|
+
|
|
55
|
+
`--next N` is the top of the backlog in the tracker's own order, board position (the order items are dragged into). It picks the scope itself, so it does not combine with `--state`
|
|
56
|
+
or `--all`; the engine refuses that pair rather than picking a winner. It does
|
|
57
|
+
combine with `--mine` / `--by`.
|
|
58
|
+
|
|
59
|
+
**Every row shows the board's state and the spec's own status side by side.**
|
|
60
|
+
The spec status is read from the spec's **own worktree** when one exists, so an
|
|
61
|
+
in-flight spec reads `in-progress` even on the base branch, where its folder
|
|
62
|
+
still says `backlog`. `≠ <bucket>` marks a row whose board state maps to a
|
|
63
|
+
different bucket than its spec; a state that maps to no bucket never gets one.
|
|
64
|
+
`—` means the spec is not on this machine. Relay it as printed; never "correct"
|
|
65
|
+
either column from the other. The board says where the ticket is, and the spec
|
|
66
|
+
says where the work is.
|
|
67
|
+
|
|
68
|
+
`--state` also takes a lifecycle bucket: `--state in-progress` matches every
|
|
69
|
+
board state configured for it (`states` aliases included).
|
|
46
70
|
|
|
47
71
|
## 2. Run the engine
|
|
48
72
|
|
|
49
73
|
```
|
|
50
|
-
skitterspec spec-sync list [--state <name> …|--all] [--json]
|
|
74
|
+
skitterspec spec-sync list [--state <name|bucket> …|--all|--next N] [--mine | --by <user>] [--json]
|
|
51
75
|
```
|
|
52
76
|
|
|
53
77
|
- **`transport = api`** (credentials resolve) → it queried GitHub and printed the
|
|
@@ -506,8 +506,8 @@ reading — and that is the gap the whole gate exists to close.
|
|
|
506
506
|
|
|
507
507
|
**A watch that dies is re-armed on the same window**, silently and bounded by
|
|
508
508
|
the age of that window — `.claude/rules/spec-reports.md` carries the contract,
|
|
509
|
-
including when to stop
|
|
510
|
-
here.
|
|
509
|
+
including when to stop, what the banner says instead, and when the
|
|
510
|
+
engine's `re-show:` brings the banner back. Do not restate it here.
|
|
511
511
|
|
|
512
512
|
Then **end your turn**. Do not poll it and do not hold the turn open: the
|
|
513
513
|
point is that the reader has the terminal back while they read.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: spec-status
|
|
3
|
-
description: Show a spec's one-way sync status against GitHub — a read-only
|
|
3
|
+
description: Show a spec's one-way sync status against GitHub — a read-only report naming what would push, and whether someone edited the issue's description since the last push. Changes nothing. Opt-in — needs specs/.core/github.config.json. Use when the user says "/spec-status", "is this spec in sync with GitHub", "what would push", or "show spec sync status".
|
|
4
4
|
disable-model-invocation: true
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
# /spec-status — one-way sync
|
|
7
|
+
# /spec-status — one-way sync report
|
|
8
8
|
|
|
9
9
|
> Stay silent while this runs — speak only to ask something you cannot answer
|
|
10
10
|
> yourself, or to report a failure at the moment it happens. Read
|
|
@@ -15,13 +15,17 @@ Read-only. Reports two things and writes nothing:
|
|
|
15
15
|
|
|
16
16
|
1. **Pending push** — has the spec changed since the last push (is there an issue
|
|
17
17
|
description/state or any phase sub-issue to create or update)?
|
|
18
|
-
2. **
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
2. **Description edited** — did someone edit the issue's description on GitHub
|
|
19
|
+
since the last push? The next push replaces it, so this is worth reading
|
|
20
|
+
first.
|
|
21
|
+
|
|
22
|
+
**Status is not compared, deliberately.** Skitterspec tells GitHub about its
|
|
23
|
+
own transitions and never reads a status back: a card someone moved by hand is
|
|
24
|
+
theirs to have moved, and push resends State only when the spec itself moves.
|
|
21
25
|
|
|
22
26
|
The repo is the source of truth; GitHub is a generated mirror, so there is no
|
|
23
|
-
per-field "conflict" — only "what would the next push send" and "did
|
|
24
|
-
|
|
27
|
+
per-field "conflict" — only "what would the next push send" and "did someone
|
|
28
|
+
write over the mirror's text".
|
|
25
29
|
|
|
26
30
|
**Opt-in**: only runs when `specs/.core/github.config.json` exists. If absent,
|
|
27
31
|
tell the user how to enable GitHub sync and stop.
|
|
@@ -30,19 +34,16 @@ tell the user how to enable GitHub sync and stop.
|
|
|
30
34
|
|
|
31
35
|
Use the argument, else the spec in context; ask if unclear.
|
|
32
36
|
|
|
33
|
-
## 2. Fetch the GitHub issue (optional, for
|
|
37
|
+
## 2. Fetch the GitHub issue (optional, for the description check)
|
|
34
38
|
|
|
35
39
|
If the spec has a `github_identifier`, discover the GitHub MCP read tool
|
|
36
|
-
(`issue_read`) and write the issue JSON to a temp file
|
|
37
|
-
|
|
38
|
-
connected, skip the drift lines (still report pending-push).
|
|
40
|
+
(`issue_read`) and write the issue JSON to a temp file. If GitHub isn't
|
|
41
|
+
connected, skip the description check (still report pending-push).
|
|
39
42
|
|
|
40
|
-
**Write the whole issue, including its `description`.**
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
loss is silent. Keep `url` too: it is what the description line points the
|
|
45
|
-
reader at.
|
|
43
|
+
**Write the whole issue, including its `description`.** That is the field the
|
|
44
|
+
check reads; without it the check has nothing to look at, and it says nothing
|
|
45
|
+
rather than guessing, so the loss is silent. Keep `url` too: it is what the
|
|
46
|
+
description line points the reader at.
|
|
46
47
|
|
|
47
48
|
**The description itself never enters the conversation.** The engine hashes it
|
|
48
49
|
and compares hashes; what it prints is *that* the text changed, plus where to
|
|
@@ -59,8 +60,9 @@ skitterspec spec-sync status <spec> [--remote <issuefile>] [--workspace-states <
|
|
|
59
60
|
```
|
|
60
61
|
|
|
61
62
|
- Reports `push: pending — N to create, M to update` or `up to date`.
|
|
62
|
-
- With `--remote`, adds a `drift:` line
|
|
63
|
-
|
|
63
|
+
- With `--remote`, adds a `drift:` line when the issue's description was
|
|
64
|
+
edited on GitHub since the last push, and nothing otherwise. It never reports
|
|
65
|
+
the board's Status.
|
|
64
66
|
- With `--workspace-states`, fails loudly if a configured state name isn't a
|
|
65
67
|
Status option on the board (the push would refuse at apply time).
|
|
66
68
|
|
|
@@ -88,18 +90,17 @@ the shape; this section carries only what is specific here.
|
|
|
88
90
|
**Verdicts**
|
|
89
91
|
|
|
90
92
|
- `✅` — in sync; nothing would push.
|
|
91
|
-
- `⚠️` —
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
description means a person wrote something that the next push replaces.
|
|
93
|
+
- `⚠️` — N objects would push, or the issue's **description** was edited on
|
|
94
|
+
GitHub since the last push. Neither is an error, but both are the reason
|
|
95
|
+
someone ran this. **Say which**, since they call for different things: a
|
|
96
|
+
pending push is routine, and an edited description means a person wrote
|
|
97
|
+
something that the next push replaces.
|
|
97
98
|
- `⏸` — no config, or the spec is not linked. Nothing to compare.
|
|
98
99
|
|
|
99
100
|
**Fields:** `Tracker` · `Follow-ups` · `Next`
|
|
100
101
|
|
|
101
|
-
`Tracker` is the
|
|
102
|
-
|
|
102
|
+
`Tracker` is the answer in one line — what would push, and whether the
|
|
103
|
+
description was edited. `Next` is `/spec-push` when a push is pending, and nothing to
|
|
103
104
|
do when it is not.
|
|
104
105
|
|
|
105
106
|
A **`phases: <mode>`** line names the phase mode that resolved for this spec's
|
|
@@ -45,7 +45,7 @@ In a project that installs the GitHub superset the binary is
|
|
|
45
45
|
| "link this spec to #1 by hand" | `stamp <spec> --issue #1` |
|
|
46
46
|
| "mirror the whole backlog / every complete spec" | `apply --all <bucket>` — **confirm first** |
|
|
47
47
|
| "what ticket am I on?", writing a commit | `ref` |
|
|
48
|
-
| "what shipped in this release?" | `released` |
|
|
48
|
+
| "what shipped in this release?", "which issues does CI mark deployed?" | `released` — `--json` for a script; recording deploys is the project's own |
|
|
49
49
|
| "is any of this wired up?", "why isn't sync working?" | `doctor` — scaffold, isolation, tracker and credentials in one |
|
|
50
50
|
| "set my GitHub credentials", "am I authenticated?" | `credentials <status\|set\|unset>` |
|
|
51
51
|
| push one spec, or "what would push?" | **defer** — see below |
|
|
@@ -68,7 +68,7 @@ Two front doors to one write path is worse than none:
|
|
|
68
68
|
|
|
69
69
|
- **Push one spec** → `/spec-push`. It owns the transport choice, the
|
|
70
70
|
status-name gate, the plan, the apply, the stamping and the snapshot.
|
|
71
|
-
- **Per-spec
|
|
71
|
+
- **Per-spec status** ("is this spec in sync?", "what would push?") →
|
|
72
72
|
`/spec-status`.
|
|
73
73
|
|
|
74
74
|
Say which skill you're handing to and stop; don't reimplement either.
|
|
@@ -178,8 +178,10 @@ and never write `Refs: none`.
|
|
|
178
178
|
|
|
179
179
|
`released` reports the tickets in a commit range — by default since the most
|
|
180
180
|
recent tag, and it always prints the range it chose so a wrong default is
|
|
181
|
-
visible. It is **read-only**: it does not move anything in GitHub.
|
|
182
|
-
|
|
181
|
+
visible. It is **read-only**: it does not move anything in GitHub. Each issue
|
|
182
|
+
row names the `spec` and `url` behind it (`null` when no spec linked the ref),
|
|
183
|
+
so `--json` is what a project's CI pipes into its own tooling to record a
|
|
184
|
+
release or a deploy. Recording those is the project's job, not skitterspec's.
|
|
183
185
|
|
|
184
186
|
Relay the **unreferenced count** even when it is zero. A chore commit
|
|
185
187
|
legitimately carries no ticket and a *missed* trailer looks identical, so
|
|
@@ -193,30 +195,12 @@ A commit whose changed paths are **all** under `release.ignorePaths` (default
|
|
|
193
195
|
file still counts. Relay the **ignored count** whenever it is non-zero — that is
|
|
194
196
|
the report saying which commits it set aside.
|
|
195
197
|
|
|
196
|
-
## 7b. `release`
|
|
198
|
+
## 7b. `release` is retired
|
|
197
199
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
pnpm exec skitterspec-github spec-sync release reconcile [--apply] [--json]
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
These need `releases.series` in the config — `github.config.md` → "Releases"
|
|
206
|
-
carries the field reference and semantics. Every verb is a **dry run without
|
|
207
|
-
`--apply`**, so relay the plan rather than re-deriving it. `create` mints a
|
|
208
|
-
prerelease listing the tag's tickets, `deployed` sets the board's Deployed
|
|
209
|
-
option on them, `complete` clears the prerelease flag. They are CI's verbs
|
|
210
|
-
first — run by the host project's pipeline on a tag — and re-run by hand to
|
|
211
|
-
repair the mirror.
|
|
212
|
-
|
|
213
|
-
`reconcile` is the self-healing one: it probes the npm registry for each
|
|
214
|
-
series' live versions and moves every marked release that shipped — including
|
|
215
|
-
one superseded by a newer live version — to the series' final env, backfilling
|
|
216
|
-
a release for a pushed tag that never got one. It is schedule-friendly: a
|
|
217
|
-
version the registry lacks is "not yet" and exits 0, so relay its per-release
|
|
218
|
-
lines verbatim and never read a `kept` as a failure. It refuses over MCP and on
|
|
219
|
-
a shallow clone, exactly as `create` does.
|
|
200
|
+
`spec-sync release` exits 1 naming `released --json`. Recording a release or a
|
|
201
|
+
deploy is the host project's job: point the user at `released --json` (§7) and
|
|
202
|
+
`github.config.md` → "Releases and deploys". Do not re-create the old verbs out
|
|
203
|
+
of `gh` calls on their behalf.
|
|
220
204
|
|
|
221
205
|
## 8. Report
|
|
222
206
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skitterbyte/skitterspec-github",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Spec-driven development for Claude Code, with one-way GitHub sync — a superset of @skitterbyte/skitterspec: the base filesystem workflow plus /spec-status · /spec-push · /spec-claim and the spec-sync CLI, mirroring specs to GitHub Issues, sub-issues and a Projects v2 board, with GitHub Releases. The repo is canonical; GitHub is a generated mirror. Install this OR the base OR one other superset — exactly one.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"claude",
|
package/src/cli.js
CHANGED
|
@@ -119,6 +119,9 @@ const {
|
|
|
119
119
|
passesSince,
|
|
120
120
|
waitForPass,
|
|
121
121
|
WAIT_HEARTBEAT_MS,
|
|
122
|
+
WAIT_RESHOW_EVERY,
|
|
123
|
+
recordWaitStart,
|
|
124
|
+
reshowDue,
|
|
122
125
|
waitingPasses,
|
|
123
126
|
describePending,
|
|
124
127
|
pendingAge,
|
|
@@ -903,7 +906,7 @@ function specEnvUp(dir, config, specArg, flags = {}) {
|
|
|
903
906
|
try {
|
|
904
907
|
spec = resolveSpecWithWorktree(dir, config, specArg)
|
|
905
908
|
} catch (err) {
|
|
906
|
-
const specShaped = typeof specArg === 'string' && /^(feat|bug|hotfix)-./.test(specArg)
|
|
909
|
+
const specShaped = typeof specArg === 'string' && /^(feat|bug|hotfix|chore)-./.test(specArg)
|
|
907
910
|
if (err.code !== 'SPEC_NOT_FOUND' || !docs || !specShaped || config.mode === 'checkout') {
|
|
908
911
|
throw err
|
|
909
912
|
}
|
|
@@ -2761,6 +2764,74 @@ function resolveHeartbeatMs(flags) {
|
|
|
2761
2764
|
return seconds * 1000
|
|
2762
2765
|
}
|
|
2763
2766
|
|
|
2767
|
+
/**
|
|
2768
|
+
* Every this-many re-arms the stack is printed again. Default 5, `0` disables.
|
|
2769
|
+
* A value that is not a whole number takes the DEFAULT rather than disabling
|
|
2770
|
+
* (`.claude/rules/negative-checks.md` rule 4), the same as `--heartbeat`.
|
|
2771
|
+
*/
|
|
2772
|
+
function resolveReshowEvery(flags) {
|
|
2773
|
+
if (flags.reshowEvery === undefined || flags.reshowEvery === null) return WAIT_RESHOW_EVERY
|
|
2774
|
+
const n = Number(flags.reshowEvery)
|
|
2775
|
+
if (!Number.isInteger(n) || n < 0) return WAIT_RESHOW_EVERY
|
|
2776
|
+
return n
|
|
2777
|
+
}
|
|
2778
|
+
|
|
2779
|
+
/**
|
|
2780
|
+
* The review server that is running, read and never touched — or null.
|
|
2781
|
+
*
|
|
2782
|
+
* NOT `ensureReviewServer`. That one adopts, and where a server is stale it
|
|
2783
|
+
* replaces it, and a re-show that restarted the server would kill the link
|
|
2784
|
+
* open on the reader's phone in order to remind them of it. This reads the
|
|
2785
|
+
* pidfile and the settings and stops there.
|
|
2786
|
+
*
|
|
2787
|
+
* WHAT WOULD FOOL THIS: a pidfile left by a crash names a pid the OS may have
|
|
2788
|
+
* reused for something else. `isAlive` cannot tell those apart, so the URL it
|
|
2789
|
+
* offers could point at nothing — the same blind spot every adopt has, and the
|
|
2790
|
+
* cost is a dead link in a reminder, never a lost pass.
|
|
2791
|
+
*/
|
|
2792
|
+
function readRunningReviewServer(dir, config) {
|
|
2793
|
+
const abs = (rel) => path.resolve(dir, rel)
|
|
2794
|
+
const settingsFile = `${stateDirLabel(config)}/review-serve.json`
|
|
2795
|
+
const proc = serveProcFor(config, abs(settingsFile), { root: dir })
|
|
2796
|
+
const pid = readPid(abs(proc.pidFile))
|
|
2797
|
+
if (!pid || !isAlive(pid)) return null
|
|
2798
|
+
let settings = null
|
|
2799
|
+
try {
|
|
2800
|
+
settings = JSON.parse(fs.readFileSync(abs(settingsFile), 'utf-8'))
|
|
2801
|
+
} catch {
|
|
2802
|
+
return null
|
|
2803
|
+
}
|
|
2804
|
+
if (!settings || !settings.port) return null
|
|
2805
|
+
return {
|
|
2806
|
+
port: settings.port,
|
|
2807
|
+
token: settings.token || null,
|
|
2808
|
+
loopback: settings.host === '127.0.0.1' || settings.host === 'localhost',
|
|
2809
|
+
}
|
|
2810
|
+
}
|
|
2811
|
+
|
|
2812
|
+
/**
|
|
2813
|
+
* The stack a re-show prints: the same tiers and `live` a render reports, from
|
|
2814
|
+
* the same functions, with nothing rendered and nothing started.
|
|
2815
|
+
*/
|
|
2816
|
+
function reshowStack(dir, config, spec, out) {
|
|
2817
|
+
const cfg = withSpecRemote(config, out)
|
|
2818
|
+
const up = readRunningReviewServer(dir, cfg)
|
|
2819
|
+
const served = up ? reviewServedUrls(up, offerableLanAddresses(), spec.folder) : null
|
|
2820
|
+
const tiers = reviewTierStack({ served, fileUrl: reviewFileUrl(out), publishedUrl: readReviewUrl(out), config: cfg })
|
|
2821
|
+
let live = null
|
|
2822
|
+
try {
|
|
2823
|
+
const primaryState = assertPrimaryOnMain(cfg, gitReader(dir))
|
|
2824
|
+
live = liveStateFor(
|
|
2825
|
+
spec,
|
|
2826
|
+
liveContext(dir, cfg, spec, { onBase: primaryState.onBase, primaryBranch: primaryState.branch }),
|
|
2827
|
+
)
|
|
2828
|
+
} catch {
|
|
2829
|
+
// Cannot tell whether it is live — print no line rather than a wrong one.
|
|
2830
|
+
live = null
|
|
2831
|
+
}
|
|
2832
|
+
return { tiers, live }
|
|
2833
|
+
}
|
|
2834
|
+
|
|
2764
2835
|
async function specEnvReviewWait(dir, config, specArg, flags) {
|
|
2765
2836
|
let spec
|
|
2766
2837
|
try {
|
|
@@ -2794,10 +2865,28 @@ async function specEnvReviewWait(dir, config, specArg, flags) {
|
|
|
2794
2865
|
// SAID BEFORE THE FIRST POLL, not after it. The whole point is that a caller
|
|
2795
2866
|
// knows the wait is running; a line printed on the way out would arrive only
|
|
2796
2867
|
// for the waits that already worked.
|
|
2868
|
+
//
|
|
2869
|
+
// WHICH START THIS IS, counted per window. A wait that dies is re-armed on the
|
|
2870
|
+
// same `--since`, and every re-arm leaves a trace in the conversation, so
|
|
2871
|
+
// after enough of them the banner and its links have scrolled out of sight.
|
|
2872
|
+
// Every `reshowEvery`th re-arm prints the stack again, read-only, for the
|
|
2873
|
+
// skill to relay as the banner.
|
|
2874
|
+
const reshowEvery = resolveReshowEvery(flags)
|
|
2875
|
+
const started = recordWaitStart(out, spec.folder, flags.since)
|
|
2876
|
+
const rearm = started ? started.rearm : null
|
|
2877
|
+
const reshow = reshowDue(rearm, reshowEvery)
|
|
2878
|
+
const stack = reshow ? reshowStack(dir, config, spec, out) : null
|
|
2879
|
+
|
|
2797
2880
|
if (!flags.json) {
|
|
2798
2881
|
process.stdout.write(
|
|
2799
2882
|
`spec-env review wait: ${spec.folder} — waiting for a verdict sent since ${flags.since}` +
|
|
2800
|
-
`${timeoutMs === null ? '' : ` (up to ${flags.timeout}s)`}
|
|
2883
|
+
`${timeoutMs === null ? '' : ` (up to ${flags.timeout}s)`}` +
|
|
2884
|
+
`${rearm ? ` (re-arm ${rearm})` : ''}\n` +
|
|
2885
|
+
(stack
|
|
2886
|
+
? ` re-show: banner (re-arm ${rearm})\n` +
|
|
2887
|
+
stack.tiers.map((t) => reviewTierLine(t) + '\n').join('') +
|
|
2888
|
+
(liveStateLine(stack.live) ? `${liveStateLine(stack.live)}\n` : '')
|
|
2889
|
+
: ''),
|
|
2801
2890
|
)
|
|
2802
2891
|
}
|
|
2803
2892
|
|
|
@@ -2827,7 +2916,20 @@ async function specEnvReviewWait(dir, config, specArg, flags) {
|
|
|
2827
2916
|
})
|
|
2828
2917
|
|
|
2829
2918
|
if (flags.json) {
|
|
2830
|
-
process.stdout.write(
|
|
2919
|
+
process.stdout.write(
|
|
2920
|
+
`${JSON.stringify(
|
|
2921
|
+
{
|
|
2922
|
+
spec: spec.folder,
|
|
2923
|
+
since: flags.since,
|
|
2924
|
+
rearm,
|
|
2925
|
+
reshow,
|
|
2926
|
+
...(stack ? { tiers: stack.tiers, live: stack.live } : {}),
|
|
2927
|
+
...result,
|
|
2928
|
+
},
|
|
2929
|
+
null,
|
|
2930
|
+
2,
|
|
2931
|
+
)}\n`,
|
|
2932
|
+
)
|
|
2831
2933
|
}
|
|
2832
2934
|
|
|
2833
2935
|
if (result.state === 'arrived') {
|
|
@@ -5617,6 +5719,7 @@ async function specEnv(rest) {
|
|
|
5617
5719
|
claim: null,
|
|
5618
5720
|
offered: false,
|
|
5619
5721
|
heartbeat: null,
|
|
5722
|
+
reshowEvery: null,
|
|
5620
5723
|
drop: null,
|
|
5621
5724
|
buttons: null,
|
|
5622
5725
|
json: false,
|
|
@@ -5652,6 +5755,7 @@ async function specEnv(rest) {
|
|
|
5652
5755
|
else if (args[i] === '--claim') flags.claim = args[++i]
|
|
5653
5756
|
else if (args[i] === '--claim-since') flags.claimSince = args[++i]
|
|
5654
5757
|
else if (args[i] === '--heartbeat') flags.heartbeat = args[++i]
|
|
5758
|
+
else if (args[i] === '--reshow-every') flags.reshowEvery = args[++i]
|
|
5655
5759
|
else if (args[i] === '--since') flags.since = args[++i]
|
|
5656
5760
|
else if (args[i] === '--timeout') flags.timeout = args[++i]
|
|
5657
5761
|
else if (args[i] === '--drop') flags.drop = args[++i]
|
|
@@ -5831,6 +5935,7 @@ async function specEnv(rest) {
|
|
|
5831
5935
|
' review skip [spec] "<reason>" move on without one, on the record\n' +
|
|
5832
5936
|
' review gate [spec] --offered record that the bypass was offered (spends it)\n' +
|
|
5833
5937
|
' review wait [spec] --heartbeat <secs> proof-of-life cadence on stderr; 0 disables\n' +
|
|
5938
|
+
' review wait [spec] --reshow-every <n> print the stack again every nth re-arm (5); 0 disables\n' +
|
|
5834
5939
|
' review wait [spec] --since <iso> block until a verdict arrives ([--timeout <s>])\n' +
|
|
5835
5940
|
' review waiting [--json] every pass waiting, across every spec\n' +
|
|
5836
5941
|
' review [spec] --claim-since <iso> claim the one pass that arrived since <iso>\n' +
|
package/src/env/resolve.js
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* Pure spec/branch resolution for per-spec isolation.
|
|
5
5
|
*
|
|
6
6
|
* Given a spec argument (a folder name or path) it locates the spec folder under
|
|
7
|
-
* `specs/**`, splits the `feat-`/`bug-` prefix into
|
|
7
|
+
* `specs/**`, splits the `feat-`/`bug-`/`hotfix-`/`chore-` prefix into
|
|
8
|
+
* `{ type, slug }`, derives the
|
|
8
9
|
* git branch from the config's `branch.pattern` (provider-neutral; `{identifier}`
|
|
9
10
|
* is filled from a tracker id when one is configured, else it falls back to
|
|
10
11
|
* `{type}/{slug}`), and expands the config's path/name tokens (`{repo}`,
|
|
@@ -294,10 +295,10 @@ function phaseIsDone(text) {
|
|
|
294
295
|
return /^#\s.*✅\s*$/m.test(text)
|
|
295
296
|
}
|
|
296
297
|
|
|
297
|
-
// Split a `feat-`/`bug-`/`hotfix-` prefix. Unknown prefix → type
|
|
298
|
-
// `feat` and the whole folder name is the slug.
|
|
298
|
+
// Split a `feat-`/`bug-`/`hotfix-`/`chore-` prefix. Unknown prefix → type
|
|
299
|
+
// defaults to `feat` and the whole folder name is the slug.
|
|
299
300
|
function splitPrefix(folder) {
|
|
300
|
-
const m = /^(feat|bug|hotfix)-(.+)$/.exec(folder)
|
|
301
|
+
const m = /^(feat|bug|hotfix|chore)-(.+)$/.exec(folder)
|
|
301
302
|
if (m) return { type: m[1], slug: m[2] }
|
|
302
303
|
return { type: 'feat', slug: folder }
|
|
303
304
|
}
|
|
@@ -498,6 +499,12 @@ function assertPrimaryOnMain(config, git) {
|
|
|
498
499
|
* was actually created against, and re-deriving it would go wrong the moment a
|
|
499
500
|
* project changed its pattern under a standing branch.
|
|
500
501
|
*
|
|
502
|
+
* A `chore-foo` SPEC derives the same `chore/foo` branch as `/no-spec foo`
|
|
503
|
+
* does, deliberately left colliding: both cannot exist at once, and git
|
|
504
|
+
* refuses the second `worktree add -b` loudly rather than either lane
|
|
505
|
+
* silently adopting the other's branch (spec feat-chore-kind-bug-bodies,
|
|
506
|
+
* decision 9).
|
|
507
|
+
*
|
|
501
508
|
* Pure but for `repoInfo`, like `resolveSpec`.
|
|
502
509
|
*/
|
|
503
510
|
function resolveSpecless(name, dir, config, entry = {}) {
|
package/src/env/review.js
CHANGED
|
@@ -1282,6 +1282,81 @@ const WAIT_POLL_MS = 400
|
|
|
1282
1282
|
// whatever is supervising the process.
|
|
1283
1283
|
const WAIT_HEARTBEAT_MS = 5 * 60 * 1000
|
|
1284
1284
|
|
|
1285
|
+
// Every this-many re-arms on one window, the wait prints the stack again. A
|
|
1286
|
+
// COUNT, not an interval, and deliberately: what buries the banner is how many
|
|
1287
|
+
// re-arms have scrolled past it, and a death every five minutes and one every
|
|
1288
|
+
// forty-five push it up the same distance each. This is not the count
|
|
1289
|
+
// `spec-reports.md` rejects — that one bounded how long to keep waiting, and
|
|
1290
|
+
// the 12-hour age bound below still does.
|
|
1291
|
+
const WAIT_RESHOW_EVERY = 5
|
|
1292
|
+
|
|
1293
|
+
// How old a window may be before its start count is pruned. The same 12 hours
|
|
1294
|
+
// the skills stop re-arming at: past it nobody is counting, so nothing is kept.
|
|
1295
|
+
const WAIT_WINDOW_MAX_MS = 12 * 60 * 60 * 1000
|
|
1296
|
+
|
|
1297
|
+
// Beside the pending store, under gitignored `.spec-env/`.
|
|
1298
|
+
const WAITS_SUFFIX = '.waits.json'
|
|
1299
|
+
|
|
1300
|
+
function reviewWaitsPath(outPath) {
|
|
1301
|
+
return outPath.replace(/\.html$/, '') + WAITS_SUFFIX
|
|
1302
|
+
}
|
|
1303
|
+
|
|
1304
|
+
/**
|
|
1305
|
+
* Record that a wait started on `since`, and say which start this is.
|
|
1306
|
+
* Returns `{ starts, rearm }` — `rearm` is 0 for the first wait on a window —
|
|
1307
|
+
* or `null` when it cannot tell.
|
|
1308
|
+
*
|
|
1309
|
+
* CANNOT-TELL IS NULL, and null means no re-show (`.claude/rules/negative-checks.md`
|
|
1310
|
+
* rule 4). A store that will not parse, a window that is not a timestamp, a
|
|
1311
|
+
* write that failed: each costs the reader one reminder, never a verdict, so
|
|
1312
|
+
* none of them is worth more than silence. An unreadable store is also never
|
|
1313
|
+
* written over — it may be someone's history.
|
|
1314
|
+
*
|
|
1315
|
+
* WHAT WOULD FOOL THIS: it counts STARTS, so anything that runs `review wait`
|
|
1316
|
+
* on the same window counts too — a second session waiting on one spec, or a
|
|
1317
|
+
* person running it by hand. That over-counts, and the cost is a banner shown
|
|
1318
|
+
* a little early, which is the harmless direction.
|
|
1319
|
+
*/
|
|
1320
|
+
function recordWaitStart(outPath, specFolder, since, { now = Date.now() } = {}) {
|
|
1321
|
+
if (!Number.isFinite(Date.parse(since))) return null
|
|
1322
|
+
const file = reviewWaitsPath(outPath)
|
|
1323
|
+
let store = { version: 1, spec: specFolder, windows: {} }
|
|
1324
|
+
let raw = null
|
|
1325
|
+
try {
|
|
1326
|
+
raw = fs.readFileSync(file, 'utf8')
|
|
1327
|
+
} catch {}
|
|
1328
|
+
if (raw !== null) {
|
|
1329
|
+
try {
|
|
1330
|
+
const parsed = JSON.parse(raw)
|
|
1331
|
+
if (!parsed || typeof parsed.windows !== 'object' || parsed.windows === null) return null
|
|
1332
|
+
store = { version: parsed.version || 1, spec: parsed.spec || specFolder, windows: parsed.windows }
|
|
1333
|
+
} catch {
|
|
1334
|
+
return null
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
const windows = {}
|
|
1338
|
+
for (const [key, count] of Object.entries(store.windows)) {
|
|
1339
|
+
const at = Date.parse(key)
|
|
1340
|
+
if (Number.isFinite(at) && now - at <= WAIT_WINDOW_MAX_MS) windows[key] = count
|
|
1341
|
+
}
|
|
1342
|
+
const prior = Number.isInteger(windows[since]) && windows[since] > 0 ? windows[since] : 0
|
|
1343
|
+
const starts = prior + 1
|
|
1344
|
+
windows[since] = starts
|
|
1345
|
+
try {
|
|
1346
|
+
fs.mkdirSync(path.dirname(file), { recursive: true })
|
|
1347
|
+
fs.writeFileSync(file, JSON.stringify({ ...store, windows }, null, 2) + '\n')
|
|
1348
|
+
} catch {
|
|
1349
|
+
return null
|
|
1350
|
+
}
|
|
1351
|
+
return { starts, rearm: starts - 1 }
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1354
|
+
// Is this re-arm one that re-shows the stack? Pure. The first wait never does —
|
|
1355
|
+
// the banner is right above it — and `every` of 0 turns it off.
|
|
1356
|
+
function reshowDue(rearm, every = WAIT_RESHOW_EVERY) {
|
|
1357
|
+
return Number.isInteger(every) && every > 0 && Number.isInteger(rearm) && rearm > 0 && rearm % every === 0
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1285
1360
|
/**
|
|
1286
1361
|
* Block until exactly one pass arrives inside a window. Impure only in that it
|
|
1287
1362
|
* reads the store and sleeps; it writes nothing and claims nothing.
|
|
@@ -2555,6 +2630,10 @@ module.exports = {
|
|
|
2555
2630
|
waitingPasses,
|
|
2556
2631
|
waitForPass,
|
|
2557
2632
|
WAIT_HEARTBEAT_MS,
|
|
2633
|
+
WAIT_RESHOW_EVERY,
|
|
2634
|
+
recordWaitStart,
|
|
2635
|
+
reshowDue,
|
|
2636
|
+
reviewWaitsPath,
|
|
2558
2637
|
WAIT_POLL_MS,
|
|
2559
2638
|
passState,
|
|
2560
2639
|
describePending,
|