@skitterbyte/skitterspec-github 1.2.1 → 1.3.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/core/SETUP.md +9 -2
- package/assets/core/github.config.md +69 -0
- package/assets/rules/spec-reports.md +19 -4
- package/assets/skills/spec-bug/SKILL.md +3 -1
- package/assets/skills/spec-hotfix/SKILL.md +3 -1
- package/assets/skills/spec-next/SKILL.md +3 -1
- package/assets/skills/spec-sync/SKILL.md +25 -0
- package/package.json +1 -1
- package/src/cli.js +6 -25
- package/src/env/review.js +47 -2
- package/src/vendor/github/api.js +17 -2
- package/src/vendor/github/config.js +10 -1
- package/src/vendor/provider-kit/src/releases.js +219 -4
package/assets/core/SETUP.md
CHANGED
|
@@ -35,8 +35,15 @@ its number from the URL (`…/projects/7` → `7`).
|
|
|
35
35
|
merged* (both set Done): the engine sets Status itself, and a second writer
|
|
36
36
|
is one the next push overrides.
|
|
37
37
|
- Optional, for releases: a second single-select field, **Deployed**, with
|
|
38
|
-
options such as `Test`, `Demo`, `Prod
|
|
39
|
-
otherwise a finished phase
|
|
38
|
+
options such as `Test`, `Demo`, `Prod` (or `Staged`, `Published` for an npm
|
|
39
|
+
package). Keep release stages out of Status — otherwise a finished phase
|
|
40
|
+
reads as deployed. Declare the matching `releases.series` in the config, and
|
|
41
|
+
give each series its `npm` name so a scheduled
|
|
42
|
+
`spec-sync release reconcile --apply` run can repair the mirror when an
|
|
43
|
+
approval happens outside your pipeline — `github.config.md` → "Releases" has
|
|
44
|
+
the semantics and a copy-paste workflow. The workflow's secret must be a
|
|
45
|
+
classic PAT (`repo` + `project`): the Actions `GITHUB_TOKEN` cannot write a
|
|
46
|
+
user-owned Projects board.
|
|
40
47
|
|
|
41
48
|
## 3. The token
|
|
42
49
|
|
|
@@ -51,6 +51,75 @@ deployed.
|
|
|
51
51
|
| `apply.transport` | — | `api` or `mcp`; unset = API when a token resolves. |
|
|
52
52
|
| `sync.baseDir` | `specs/.core/github-base` | Last-pushed snapshots. Commit them. |
|
|
53
53
|
| `sync.fieldOwnership` | all `push` | Per-field ownership; `"none"` declines one (e.g. `assignee`). |
|
|
54
|
+
| `releases.deployedField` | `Deployed` | The second single-select the release verbs set. |
|
|
55
|
+
| `releases.series` | `[]` | One entry per tag series: `{ tagPrefix, envs, npm }` — see below. |
|
|
56
|
+
|
|
57
|
+
## Releases — the mirror of what shipped
|
|
58
|
+
|
|
59
|
+
The `spec-sync release` verbs write a release onto GitHub and move its issues'
|
|
60
|
+
`Deployed` field: `create <tag> --stage <env>` mints a prerelease listing the
|
|
61
|
+
tickets the tag's range contains, `deployed <tag> <env>` sets the field on
|
|
62
|
+
every one of them, `complete <tag>` clears the prerelease flag. Every verb is a
|
|
63
|
+
dry run unless `--apply`. A series declares its envs in order:
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
"releases": {
|
|
67
|
+
"series": [
|
|
68
|
+
{ "tagPrefix": "myapp@",
|
|
69
|
+
"envs": { "staged": "Staged", "published": "Published" },
|
|
70
|
+
"npm": "@scope/myapp" }
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**`reconcile` is the self-healing verb**, for the approvals that happen where
|
|
76
|
+
no verb runs — the npm website, a batched tag push that fired no workflow. It
|
|
77
|
+
asks the npm registry which versions of `npm` are live and repairs the mirror:
|
|
78
|
+
|
|
79
|
+
- A marked release whose version is live — **or contained in a newer live
|
|
80
|
+
version of its series**, since that version carries its commits — moves to
|
|
81
|
+
the series' **final** env and is completed. Ascending, and only the newest
|
|
82
|
+
takes GitHub's "Latest".
|
|
83
|
+
- A pushed tag with **no release at all** is backfilled at the first env, then
|
|
84
|
+
probed like the rest — bounded to tags newer than the series' newest
|
|
85
|
+
release (the newest tag alone where the series has none), so old history is
|
|
86
|
+
never flooded onto the releases page.
|
|
87
|
+
- **Absence is never failure**: a version the registry lacks is "not yet" and
|
|
88
|
+
the release is kept; an unreachable registry, a 404 package, or a series
|
|
89
|
+
with no `npm` key skips that series in one line and exits 0. Only a release
|
|
90
|
+
listing that could not be read refuses.
|
|
91
|
+
- Only releases carrying the skitterspec marker are touched — a hand-made
|
|
92
|
+
release is never read or written.
|
|
93
|
+
|
|
94
|
+
Run it hourly from a scheduled workflow (plus `workflow_dispatch` for an
|
|
95
|
+
instant run after an approval). The checkout needs `fetch-depth: 0` — tag
|
|
96
|
+
ranges are refused on a shallow clone — and the token must be a classic PAT
|
|
97
|
+
(`repo` + `project`) in a secret: the Actions `GITHUB_TOKEN` cannot write a
|
|
98
|
+
user-owned Projects board.
|
|
99
|
+
|
|
100
|
+
```yaml
|
|
101
|
+
on:
|
|
102
|
+
schedule:
|
|
103
|
+
- cron: '17 * * * *'
|
|
104
|
+
workflow_dispatch:
|
|
105
|
+
permissions:
|
|
106
|
+
contents: read
|
|
107
|
+
jobs:
|
|
108
|
+
reconcile:
|
|
109
|
+
runs-on: ubuntu-latest
|
|
110
|
+
steps:
|
|
111
|
+
- uses: actions/checkout@v7
|
|
112
|
+
with:
|
|
113
|
+
fetch-depth: 0
|
|
114
|
+
# …install your toolchain…
|
|
115
|
+
- env:
|
|
116
|
+
GITHUB_TOKEN: ${{ secrets.YOUR_PAT_SECRET }}
|
|
117
|
+
run: |
|
|
118
|
+
if [ -z "$GITHUB_TOKEN" ]; then
|
|
119
|
+
echo "::notice::no PAT secret — reconcile skipped"; exit 0
|
|
120
|
+
fi
|
|
121
|
+
skitterspec-github spec-sync release reconcile --apply
|
|
122
|
+
```
|
|
54
123
|
|
|
55
124
|
## The token
|
|
56
125
|
|
|
@@ -36,7 +36,7 @@ A verdict sentence, a blank line, then a two-column table:
|
|
|
36
36
|
| **Branch** | `spec/feat-foo` · 3 commits, clean |
|
|
37
37
|
| **Built** | POST /orders handler, orders schema |
|
|
38
38
|
| **Tests** | 128 passed · dotnet test |
|
|
39
|
-
| **Review** | 7 files, +212 −18 · **local** [http://127.0.0.1:7760/…](http://127.0.0.1:7760/…) · **network** [http://192.168.0.136:7760/…](http://192.168.0.136:7760/…) · **remote** off |
|
|
39
|
+
| **Review** | 7 files, +212 −18 · **local** [http://127.0.0.1:7760/…](http://127.0.0.1:7760/…) · **network** [http://192.168.0.136:7760/…](http://192.168.0.136:7760/…) also [http://100.126.111.34:7760/…](http://100.126.111.34:7760/…) (tailnet) · **remote** off |
|
|
40
40
|
| **Follow-ups** | none |
|
|
41
41
|
| **Next** | `/spec-next` → phase 3 (Auth) |
|
|
42
42
|
|
|
@@ -89,6 +89,7 @@ the options may be offered after the table.
|
|
|
89
89
|
|
|
90
90
|
- **local** — [http://127.0.0.1:7760/7e9e123e7540/feat-orders](http://127.0.0.1:7760/7e9e123e7540/feat-orders)
|
|
91
91
|
- **network** — [http://192.168.0.136:7760/7e9e123e7540/feat-orders](http://192.168.0.136:7760/7e9e123e7540/feat-orders)
|
|
92
|
+
- also — [http://100.126.111.34:7760/7e9e123e7540/feat-orders](http://100.126.111.34:7760/7e9e123e7540/feat-orders) (tailnet)
|
|
92
93
|
- **remote** — off · `/spec-remote-review` turns it on
|
|
93
94
|
|
|
94
95
|
live: off — /spec-live to put it live
|
|
@@ -156,6 +157,17 @@ on. Dropping the line is what left a reader who had walked out of the house with
|
|
|
156
157
|
nothing on screen to tell them a remote page was even possible — they could not
|
|
157
158
|
ask for what they could not see.
|
|
158
159
|
|
|
160
|
+
**The `network` tier may carry alternates, and they are part of it — not a fourth tier.**
|
|
161
|
+
The engine offers the other addresses this machine has (a
|
|
162
|
+
tailnet one, for a reader off the wifi) as `also:` lines under `network`, each
|
|
163
|
+
labelled; `--json` carries them as that tier's `alternates`, labelled the same
|
|
164
|
+
way. Copy them as indented sub-bullets under the network bullet, verbatim,
|
|
165
|
+
labels included. This is not an amendment to the tier rule: the stack is the
|
|
166
|
+
engine's, copied rather than composed, and the engine was already printing
|
|
167
|
+
these — a contract that made the skill edit them out was the composing this
|
|
168
|
+
section forbids. A machine with no alternates renders the banner exactly as
|
|
169
|
+
above, minus the sub-bullet.
|
|
170
|
+
|
|
159
171
|
**Only promise a wait the transport can deliver.** The wait itself is real in
|
|
160
172
|
every case; what varies is what carries it back, not whether the run is
|
|
161
173
|
stopped. Three transports, three true sentences:
|
|
@@ -298,8 +310,11 @@ behind, and they cannot.
|
|
|
298
310
|
`fetch(location.pathname, …)`, so a page opened at `127.0.0.1:7760/…` and one
|
|
299
311
|
opened at `192.168.0.136:7760/…` reach the same server process and the same
|
|
300
312
|
pending store. One wait covers both, and a verdict pressed on either wakes the
|
|
301
|
-
same run.
|
|
302
|
-
|
|
313
|
+
same run. A `network` alternate — the `also:` tailnet address — is one more
|
|
314
|
+
door into the same room: the same server answers on it, so the wait-coverage
|
|
315
|
+
line stays true with nothing added to it. Between all of those the objection
|
|
316
|
+
does not apply — which is why they are offered, and why offering them gives
|
|
317
|
+
nothing up.
|
|
303
318
|
|
|
304
319
|
**So two things are required, and the second is what the old rule lacked.**
|
|
305
320
|
Every link is **labelled** with its tier, and one line says
|
|
@@ -410,7 +425,7 @@ behind it — say nothing rather than reporting that there was nothing to report
|
|
|
410
425
|
| `Landed` | A fast-forward, a tag, a cherry-pick. |
|
|
411
426
|
| `Worktree` | A worktree provisioned, entered, or torn down. |
|
|
412
427
|
| `Untouched` | Uncommitted work the run deliberately left alone — whose, and how much. |
|
|
413
|
-
| `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, 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. |
|
|
428
|
+
| `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. |
|
|
414
429
|
| `Follow-ups` | **Always.** `none`, or one line each. |
|
|
415
430
|
| `Next` | **Last.** The single next action for this work — runnable from the state the run leaves behind. |
|
|
416
431
|
|
|
@@ -590,7 +590,9 @@ underneath a reader when detection flipped mid-session.
|
|
|
590
590
|
|
|
591
591
|
So: **relay all three tier lines, every time.** Any `also:` lines sit under
|
|
592
592
|
`network` — the other addresses this machine has, offered because the
|
|
593
|
-
best-guess one can be wrong — so pass them on rather than editing them out
|
|
593
|
+
best-guess one can be wrong — so pass them on rather than editing them out: in
|
|
594
|
+
the banner they are indented sub-bullets under **network**, labels
|
|
595
|
+
(`(tailnet)`) included, exactly as `.claude/rules/spec-reports.md` shows.
|
|
594
596
|
|
|
595
597
|
**Never read an environment variable to decide anything about the offer** — not
|
|
596
598
|
`SSH_CONNECTION`, not `CLAUDE_CODE_*`, not a tty check. There is nothing left
|
|
@@ -601,7 +601,9 @@ underneath a reader when detection flipped mid-session.
|
|
|
601
601
|
|
|
602
602
|
So: **relay all three tier lines, every time.** Any `also:` lines sit under
|
|
603
603
|
`network` — the other addresses this machine has, offered because the
|
|
604
|
-
best-guess one can be wrong — so pass them on rather than editing them out
|
|
604
|
+
best-guess one can be wrong — so pass them on rather than editing them out: in
|
|
605
|
+
the banner they are indented sub-bullets under **network**, labels
|
|
606
|
+
(`(tailnet)`) included, exactly as `.claude/rules/spec-reports.md` shows.
|
|
605
607
|
|
|
606
608
|
**Never read an environment variable to decide anything about the offer** — not
|
|
607
609
|
`SSH_CONNECTION`, not `CLAUDE_CODE_*`, not a tty check. There is nothing left
|
|
@@ -583,7 +583,9 @@ underneath a reader when detection flipped mid-session.
|
|
|
583
583
|
|
|
584
584
|
So: **relay all three tier lines, every time.** Any `also:` lines sit under
|
|
585
585
|
`network` — the other addresses this machine has, offered because the
|
|
586
|
-
best-guess one can be wrong — so pass them on rather than editing them out
|
|
586
|
+
best-guess one can be wrong — so pass them on rather than editing them out: in
|
|
587
|
+
the banner they are indented sub-bullets under **network**, labels
|
|
588
|
+
(`(tailnet)`) included, exactly as `.claude/rules/spec-reports.md` shows.
|
|
587
589
|
|
|
588
590
|
**Never read an environment variable to decide anything about the offer** — not
|
|
589
591
|
`SSH_CONNECTION`, not `CLAUDE_CODE_*`, not a tty check. There is nothing left
|
|
@@ -193,6 +193,31 @@ A commit whose changed paths are **all** under `release.ignorePaths` (default
|
|
|
193
193
|
file still counts. Relay the **ignored count** whenever it is non-zero — that is
|
|
194
194
|
the report saying which commits it set aside.
|
|
195
195
|
|
|
196
|
+
## 7b. `release` — mirror what shipped onto GitHub Releases and the board
|
|
197
|
+
|
|
198
|
+
```
|
|
199
|
+
pnpm exec skitterspec-github spec-sync release create <tag> --stage <env> [--apply]
|
|
200
|
+
pnpm exec skitterspec-github spec-sync release deployed <tag> <env> [--apply]
|
|
201
|
+
pnpm exec skitterspec-github spec-sync release complete <tag> [--apply]
|
|
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.
|
|
220
|
+
|
|
196
221
|
## 8. Report
|
|
197
222
|
|
|
198
223
|
Relay the engine's output **above the block**, and name the subcommand you ran
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skitterbyte/skitterspec-github",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.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
|
@@ -88,6 +88,8 @@ const {
|
|
|
88
88
|
collectReview,
|
|
89
89
|
reviewTierStack,
|
|
90
90
|
reviewTierLine,
|
|
91
|
+
isTailnetAddress,
|
|
92
|
+
tailnetLabel,
|
|
91
93
|
renderReviewPage,
|
|
92
94
|
renderReviewBlock,
|
|
93
95
|
reviewOutPath,
|
|
@@ -4258,6 +4260,10 @@ async function specEnvReview(dir, config, specArg, flags, invokedFrom = dir) {
|
|
|
4258
4260
|
// use, and the engine cannot know — that guess failed three separate ways
|
|
4259
4261
|
// in one day. Now every tier is listed, labelled, and either a URL or the
|
|
4260
4262
|
// one command that turns it on.
|
|
4263
|
+
// The runners-up print as `also:` lines inside the network tier's own
|
|
4264
|
+
// rendering — `reviewTierLine` carries them, which is what puts them
|
|
4265
|
+
// under `network:` rather than dangling after the stack (they used to
|
|
4266
|
+
// print below `remote:`, against the comment that placed them).
|
|
4261
4267
|
reviewTierStack({
|
|
4262
4268
|
served,
|
|
4263
4269
|
fileUrl: reviewFileUrl(out),
|
|
@@ -4266,11 +4272,6 @@ async function specEnvReview(dir, config, specArg, flags, invokedFrom = dir) {
|
|
|
4266
4272
|
})
|
|
4267
4273
|
.map((t) => reviewTierLine(t) + '\n')
|
|
4268
4274
|
.join('') +
|
|
4269
|
-
// The runners-up sit UNDER the network tier, because that is what they are
|
|
4270
|
-
// alternatives to — and virtual adapters are gone from them entirely.
|
|
4271
|
-
(served && !served.loopback && (served.alternates || []).length
|
|
4272
|
-
? served.alternates.map((u) => ` also: ${u}${tailnetLabel(u)}\n`).join('')
|
|
4273
|
-
: '') +
|
|
4274
4275
|
// WHICH TIERS THE WAIT COVERS, once, next to the stack. `local` and
|
|
4275
4276
|
// `network` are two doors into one room — the page POSTs to
|
|
4276
4277
|
// `location.pathname`, so both reach this server and this pending store.
|
|
@@ -4583,26 +4584,6 @@ function offerableLanAddresses(nets = require('node:os').networkInterfaces()) {
|
|
|
4583
4584
|
.map((e) => e.address)
|
|
4584
4585
|
}
|
|
4585
4586
|
|
|
4586
|
-
// 100.64.0.0/10 — the CGNAT range Tailscale assigns from.
|
|
4587
|
-
//
|
|
4588
|
-
// WHAT WOULD FOOL THIS: a carrier-grade NAT or another overlay network using
|
|
4589
|
-
// the same range on a utun adapter is offered too. That costs one dud `also:`
|
|
4590
|
-
// line, where filtering it hides the only link a reader off the wifi can open.
|
|
4591
|
-
function isTailnetAddress(address) {
|
|
4592
|
-
const m = /^100\.(\d+)\./.exec(address)
|
|
4593
|
-
return !!m && Number(m[1]) >= 64 && Number(m[1]) <= 127
|
|
4594
|
-
}
|
|
4595
|
-
|
|
4596
|
-
// The suffix on an `also:` line whose host is a tailnet address, so it reads
|
|
4597
|
-
// apart from the LAN one — a reader off the wifi needs to know which to tap.
|
|
4598
|
-
function tailnetLabel(url) {
|
|
4599
|
-
let host = ''
|
|
4600
|
-
try {
|
|
4601
|
-
host = new URL(url).hostname
|
|
4602
|
-
} catch {}
|
|
4603
|
-
return isTailnetAddress(host) ? ' (tailnet)' : ''
|
|
4604
|
-
}
|
|
4605
|
-
|
|
4606
4587
|
/**
|
|
4607
4588
|
* Bring the review server up, or adopt the one already running.
|
|
4608
4589
|
*
|
package/src/env/review.js
CHANGED
|
@@ -715,7 +715,21 @@ function reviewTierStack({ served, fileUrl, publishedUrl, config }) {
|
|
|
715
715
|
if (!config.review.allowNetwork) {
|
|
716
716
|
tiers.push({ tier: 'network', off: true, enable: 'skitterspec spec-env review allow network' })
|
|
717
717
|
} else if (served && !served.loopback && served.url) {
|
|
718
|
-
|
|
718
|
+
// LABELLED HERE, not by the renderer: `--json`'s `tiers` is the stack a
|
|
719
|
+
// skill copies, and an unlabelled alternate made the `(tailnet)` suffix a
|
|
720
|
+
// fact only the text render knew — so the one link a reader off the wifi
|
|
721
|
+
// could open reached the JSON indistinguishable from a second LAN address.
|
|
722
|
+
tiers.push({
|
|
723
|
+
tier: 'network',
|
|
724
|
+
url: served.url,
|
|
725
|
+
alternates: (served.alternates || []).map((u) => {
|
|
726
|
+
let host = ''
|
|
727
|
+
try {
|
|
728
|
+
host = new URL(u).hostname
|
|
729
|
+
} catch {}
|
|
730
|
+
return isTailnetAddress(host) ? { url: u, label: 'tailnet' } : { url: u }
|
|
731
|
+
}),
|
|
732
|
+
})
|
|
719
733
|
} else {
|
|
720
734
|
// Permitted, but there is no address to offer — a machine with no network,
|
|
721
735
|
// or a server that could not take one. Not a problem to report as an error.
|
|
@@ -738,13 +752,42 @@ function reviewTierStack({ served, fileUrl, publishedUrl, config }) {
|
|
|
738
752
|
}
|
|
739
753
|
|
|
740
754
|
// One tier as a line, padded so the labels form a column the eye can run down.
|
|
755
|
+
// A tier with alternates renders them as indented `also:` lines of its own —
|
|
756
|
+
// they are PART of the tier, which is what puts them under `network:` rather
|
|
757
|
+
// than dangling after the stack (they used to print below `remote:`, against
|
|
758
|
+
// the comment that placed them).
|
|
741
759
|
function reviewTierLine(t) {
|
|
742
760
|
const label = ` ${t.tier}:`.padEnd(11)
|
|
743
|
-
if (t.url)
|
|
761
|
+
if (t.url) {
|
|
762
|
+
return [
|
|
763
|
+
`${label}${t.url}${t.note ? ` (${t.note})` : ''}`,
|
|
764
|
+
...(t.alternates || []).map((a) => ` also: ${a.url}${a.label ? ` (${a.label})` : ''}`),
|
|
765
|
+
].join('\n')
|
|
766
|
+
}
|
|
744
767
|
if (t.off) return `${label}off — turn on with: ${t.enable}`
|
|
745
768
|
return `${label}— (${t.note})`
|
|
746
769
|
}
|
|
747
770
|
|
|
771
|
+
// 100.64.0.0/10 — the CGNAT range Tailscale assigns from.
|
|
772
|
+
//
|
|
773
|
+
// WHAT WOULD FOOL THIS: a carrier-grade NAT or another overlay network using
|
|
774
|
+
// the same range on a utun adapter is offered too. That costs one dud `also:`
|
|
775
|
+
// line, where filtering it hides the only link a reader off the wifi can open.
|
|
776
|
+
function isTailnetAddress(address) {
|
|
777
|
+
const m = /^100\.(\d+)\./.exec(address)
|
|
778
|
+
return !!m && Number(m[1]) >= 64 && Number(m[1]) <= 127
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
// The suffix on an `also:` line whose host is a tailnet address, so it reads
|
|
782
|
+
// apart from the LAN one — a reader off the wifi needs to know which to tap.
|
|
783
|
+
function tailnetLabel(url) {
|
|
784
|
+
let host = ''
|
|
785
|
+
try {
|
|
786
|
+
host = new URL(url).hostname
|
|
787
|
+
} catch {}
|
|
788
|
+
return isTailnetAddress(host) ? ' (tailnet)' : ''
|
|
789
|
+
}
|
|
790
|
+
|
|
748
791
|
|
|
749
792
|
// The verdicts that COMMIT, and are therefore blocked by an open comment. One
|
|
750
793
|
// list, so a fifth verdict cannot become a way around the single refusal this
|
|
@@ -2482,6 +2525,8 @@ module.exports = {
|
|
|
2482
2525
|
surfacesFor,
|
|
2483
2526
|
reviewTierStack,
|
|
2484
2527
|
reviewTierLine,
|
|
2528
|
+
isTailnetAddress,
|
|
2529
|
+
tailnetLabel,
|
|
2485
2530
|
COMMITTING,
|
|
2486
2531
|
BUTTON_SETS,
|
|
2487
2532
|
DEFAULT_BUTTON_SET,
|
package/src/vendor/github/api.js
CHANGED
|
@@ -705,6 +705,16 @@ function makeApiAdapter({
|
|
|
705
705
|
return raw ? releaseOf(raw) : null
|
|
706
706
|
},
|
|
707
707
|
|
|
708
|
+
/**
|
|
709
|
+
* Every release in the repo, for `release reconcile`. Hand-made releases
|
|
710
|
+
* ride through here too — the caller filters to the ones carrying the
|
|
711
|
+
* skitterspec marker and must leave the rest alone.
|
|
712
|
+
*/
|
|
713
|
+
async releaseList() {
|
|
714
|
+
const raw = await restAll(`${repoPath}/releases`)
|
|
715
|
+
return raw.map(releaseOf).filter(Boolean)
|
|
716
|
+
},
|
|
717
|
+
|
|
708
718
|
async releaseCreate({ tag, name, body, prerelease = true }) {
|
|
709
719
|
assertBodyFits(body, `the ${tag} release`)
|
|
710
720
|
// `make_latest: false` while staged: a release still on its way through
|
|
@@ -771,8 +781,13 @@ function makeApiAdapter({
|
|
|
771
781
|
return { set }
|
|
772
782
|
},
|
|
773
783
|
|
|
774
|
-
|
|
775
|
-
|
|
784
|
+
/**
|
|
785
|
+
* `latest: false` completes without taking GitHub's "Latest" badge — what
|
|
786
|
+
* reconcile passes for every release but a series' newest, so a backfilled
|
|
787
|
+
* old version cannot steal it from the one that actually is.
|
|
788
|
+
*/
|
|
789
|
+
async releaseComplete(release, { latest = true } = {}) {
|
|
790
|
+
const raw = await rest('PATCH', `${repoPath}/releases/${release.id}`, { body: { prerelease: false, make_latest: latest ? 'true' : 'false' } })
|
|
776
791
|
Object.assign(release, releaseOf(raw) || {})
|
|
777
792
|
return release
|
|
778
793
|
},
|
|
@@ -246,7 +246,16 @@ function mergeConfig(base, parsed) {
|
|
|
246
246
|
envs[key] = option.trim()
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
|
-
|
|
249
|
+
// `npm` is the series' registry name, probed by `release reconcile`.
|
|
250
|
+
// Optional: a series without one is simply never reconciled.
|
|
251
|
+
let npm = null
|
|
252
|
+
if (entry.npm !== undefined) {
|
|
253
|
+
if (typeof entry.npm !== 'string' || !entry.npm.trim()) {
|
|
254
|
+
throw invalid(`releases.series[${i}].npm`, entry.npm, 'the package\'s npm name, e.g. "@scope/name"')
|
|
255
|
+
}
|
|
256
|
+
npm = entry.npm.trim()
|
|
257
|
+
}
|
|
258
|
+
return npm ? { tagPrefix, envs, npm } : { tagPrefix, envs }
|
|
250
259
|
})
|
|
251
260
|
}
|
|
252
261
|
}
|
|
@@ -125,6 +125,59 @@ function composeBody({ notes, tickets, links, stage, describe }) {
|
|
|
125
125
|
return withStage(parts.join('\n\n'), stage)
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
+
/**
|
|
129
|
+
* Parse an `x.y.z[-suffix]` version for ordering. A bare version outranks a
|
|
130
|
+
* suffixed one at the same triplet (so `1.0.0` > `1.0.0-stage`), which is all
|
|
131
|
+
* the precedence these tags need: the release workflow validates them to
|
|
132
|
+
* `x.y.z`, and suffixes only appear on registry placeholders.
|
|
133
|
+
*/
|
|
134
|
+
function parseVersion(v) {
|
|
135
|
+
const m = /^(\d+)\.(\d+)\.(\d+)(?:[-+].*)?$/.exec(String(v || ''))
|
|
136
|
+
return m ? { n: [Number(m[1]), Number(m[2]), Number(m[3])], bare: !/[-+]/.test(v) } : null
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/** -1 / 0 / 1 over parseVersion; an unparseable version sorts below everything. */
|
|
140
|
+
function compareVersions(a, b) {
|
|
141
|
+
const pa = parseVersion(a)
|
|
142
|
+
const pb = parseVersion(b)
|
|
143
|
+
if (!pa || !pb) return (pa ? 1 : 0) - (pb ? 1 : 0)
|
|
144
|
+
for (let i = 0; i < 3; i++) {
|
|
145
|
+
if (pa.n[i] !== pb.n[i]) return pa.n[i] < pb.n[i] ? -1 : 1
|
|
146
|
+
}
|
|
147
|
+
if (pa.bare !== pb.bare) return pa.bare ? 1 : -1
|
|
148
|
+
return 0
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* The versions of `name` that are live on the npm registry, as a Set.
|
|
153
|
+
*
|
|
154
|
+
* ABSENCE IS NOT FAILURE, in either direction. A version missing from the set
|
|
155
|
+
* means "not published yet" — the registry is eventually consistent, so a
|
|
156
|
+
* just-approved version can be minutes away. A 404 on the whole package means
|
|
157
|
+
* "unpublished, private, or too new", three states this unauthenticated read
|
|
158
|
+
* cannot tell apart — so the caller treats every `ok: false` as a cannot-tell
|
|
159
|
+
* and moves nothing (`.claude/rules/negative-checks.md` rule 4).
|
|
160
|
+
*/
|
|
161
|
+
async function npmLiveVersions(name, fetchImpl) {
|
|
162
|
+
const url = `https://registry.npmjs.org/${encodeURIComponent(String(name))}`
|
|
163
|
+
let res
|
|
164
|
+
try {
|
|
165
|
+
res = await fetchImpl(url, { headers: { accept: 'application/json' } })
|
|
166
|
+
} catch (error) {
|
|
167
|
+
return { ok: false, reason: `registry unreachable (${String(error.message).split('\n')[0]})` }
|
|
168
|
+
}
|
|
169
|
+
if (res.status === 404) return { ok: false, reason: 'not on the public registry (unpublished, private, or not settled yet)' }
|
|
170
|
+
if (!res.ok) return { ok: false, reason: `registry answered ${res.status}` }
|
|
171
|
+
let doc
|
|
172
|
+
try {
|
|
173
|
+
doc = await res.json()
|
|
174
|
+
} catch {
|
|
175
|
+
return { ok: false, reason: 'unreadable registry answer' }
|
|
176
|
+
}
|
|
177
|
+
const versions = doc && doc.versions && typeof doc.versions === 'object' ? Object.keys(doc.versions) : []
|
|
178
|
+
return { ok: true, versions: new Set(versions) }
|
|
179
|
+
}
|
|
180
|
+
|
|
128
181
|
// `--link <url>[=label]`, repeatable. http(s) only: this lands in a body a
|
|
129
182
|
// tracker renders as a link, and a `javascript:` url there is script.
|
|
130
183
|
function parseLinks(raw) {
|
|
@@ -288,7 +341,10 @@ function makeReleaseCommands(p) {
|
|
|
288
341
|
header.push(` unchanged: ${release.url || release.id}`)
|
|
289
342
|
}
|
|
290
343
|
const attached = await adapter.releaseAttach(release, t.attach)
|
|
291
|
-
header.push(
|
|
344
|
+
header.push(
|
|
345
|
+
` issues: ${attached.attached} noted, ${attached.already} already noted` +
|
|
346
|
+
(attached.tagged != null ? `, ${attached.tagged} tagged` : ''),
|
|
347
|
+
)
|
|
292
348
|
return emit(out, flags, header, { tag, range: t.range.range, attach: t.attach.map((x) => x.ref), apply: true, url: release.url || null })
|
|
293
349
|
}
|
|
294
350
|
|
|
@@ -337,6 +393,163 @@ function makeReleaseCommands(p) {
|
|
|
337
393
|
return emit(out, flags, lines, { tag, apply: true })
|
|
338
394
|
}
|
|
339
395
|
|
|
396
|
+
/**
|
|
397
|
+
* `reconcile` — move every marked release whose version is live on npm (or
|
|
398
|
+
* contained in a newer live version of its series) to the series' final env,
|
|
399
|
+
* then complete it. The self-healing half of the mirror: approvals that
|
|
400
|
+
* happen outside `release deployed` — the npm website, a missed CI run — are
|
|
401
|
+
* caught here on the next run. Dry by default, like every other verb.
|
|
402
|
+
*
|
|
403
|
+
* Only releases carrying the skitterspec stage marker are considered, so a
|
|
404
|
+
* hand-made release is never read or written. A release already at the final
|
|
405
|
+
* env owes nothing and is skipped in silence.
|
|
406
|
+
*/
|
|
407
|
+
async function reconcile(dir, config, flags, out) {
|
|
408
|
+
const series = p.series(config)
|
|
409
|
+
if (!series.length) return refuse(out, `no releases.series configured — add one to the ${p.tracker} config`)
|
|
410
|
+
if (p.impossibleOverMcp) {
|
|
411
|
+
const why = p.impossibleOverMcp(config, flags)
|
|
412
|
+
if (why) return refuse(out, why)
|
|
413
|
+
}
|
|
414
|
+
const got = p.adapterFor(config, flags)
|
|
415
|
+
if (!got.ok) return refuse(out, got.error)
|
|
416
|
+
const adapter = got.adapter
|
|
417
|
+
const missing = [...REQUIRED_OPS, 'releaseList'].filter((op) => typeof adapter[op] !== 'function')
|
|
418
|
+
if (missing.length) return refuse(out, `the ${p.tracker} provider has no reconcile support (${missing.join(', ')})`)
|
|
419
|
+
|
|
420
|
+
let all
|
|
421
|
+
try {
|
|
422
|
+
all = await adapter.releaseList()
|
|
423
|
+
} catch (error) {
|
|
424
|
+
// A listing that failed is a cannot-tell about every release at once:
|
|
425
|
+
// refuse loudly (a scheduled run should go red) and write nothing.
|
|
426
|
+
return refuse(out, `could not list releases (${String(error.message).split('\n')[0]}) — nothing reconciled`)
|
|
427
|
+
}
|
|
428
|
+
const marked = all.filter((r) => stageOf(r.body) != null)
|
|
429
|
+
|
|
430
|
+
const git = gitReader(dir)
|
|
431
|
+
// Same refusal as `create`: `describe` in a shallow clone finds no previous
|
|
432
|
+
// tag and a range silently becomes "everything".
|
|
433
|
+
if (git(['rev-parse', '--is-shallow-repository']) === 'true') {
|
|
434
|
+
return refuse(out, 'this clone is shallow, so tag ranges cannot be resolved — check out with fetch-depth: 0')
|
|
435
|
+
}
|
|
436
|
+
const existingTags = new Set(all.map((r) => r.tag))
|
|
437
|
+
|
|
438
|
+
const fetchImpl = flags.fetch || p.fetch || globalThis.fetch
|
|
439
|
+
const lines = [`${prog} reconcile:${flags.apply ? '' : ' (dry run — pass --apply to write)'}`]
|
|
440
|
+
const result = { apply: !!flags.apply, releases: [] }
|
|
441
|
+
const note = (tag, action, reason) => {
|
|
442
|
+
lines.push(` ${tag}: ${action}${reason ? ` — ${reason}` : ''}`)
|
|
443
|
+
result.releases.push({ tag, action, ...(reason ? { reason } : {}) })
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
for (const s of series) {
|
|
447
|
+
const envKeys = Object.keys(s.envs || {})
|
|
448
|
+
const firstEnv = envKeys[0]
|
|
449
|
+
const finalEnv = envKeys[envKeys.length - 1]
|
|
450
|
+
const mine = marked.filter((r) => seriesFor(series, r.tag) === s)
|
|
451
|
+
const tailOf = (tag) => tag.slice(s.tagPrefix.length)
|
|
452
|
+
|
|
453
|
+
// Backfill: pushed tags with NO release at all — the batched-push case,
|
|
454
|
+
// where no workflow ran. Bounded so history never floods the releases
|
|
455
|
+
// page: only tags newer than the series' newest marked release, and the
|
|
456
|
+
// newest tag alone where the series has none — OLDER UNMIRRORED TAGS ARE
|
|
457
|
+
// DELIBERATELY LEFT AS HISTORY. A tag whose release exists but carries
|
|
458
|
+
// no marker is hand-made, so `existingTags` (not `mine`) excludes it.
|
|
459
|
+
const newestKnown = mine.map((r) => tailOf(r.tag)).sort(compareVersions).pop() || null
|
|
460
|
+
let missing = (git(['tag', '--list', `${s.tagPrefix}*`]) || '')
|
|
461
|
+
.split('\n')
|
|
462
|
+
.filter((t) => t && !existingTags.has(t))
|
|
463
|
+
.sort((a, b) => compareVersions(tailOf(a), tailOf(b)))
|
|
464
|
+
missing = newestKnown ? missing.filter((t) => compareVersions(tailOf(t), newestKnown) > 0) : missing.slice(-1)
|
|
465
|
+
|
|
466
|
+
const open = [
|
|
467
|
+
...mine.filter((r) => stageOf(r.body) !== finalEnv).map((r) => ({ tag: r.tag, release: r })),
|
|
468
|
+
...missing.map((tag) => ({ tag, release: null })),
|
|
469
|
+
].sort((a, b) => compareVersions(tailOf(a.tag), tailOf(b.tag)))
|
|
470
|
+
if (!finalEnv || !open.length) continue
|
|
471
|
+
if (!s.npm) {
|
|
472
|
+
note(`${s.tagPrefix}*`, 'skipped', `${open.length} release(s) owe a move or a backfill, but the series has no "npm" name to probe`)
|
|
473
|
+
continue
|
|
474
|
+
}
|
|
475
|
+
const live = await npmLiveVersions(s.npm, fetchImpl)
|
|
476
|
+
if (!live.ok) {
|
|
477
|
+
// Cannot tell is not "not published": keep every release where it is.
|
|
478
|
+
note(`${s.tagPrefix}*`, 'skipped', `npm ${s.npm}: ${live.reason}`)
|
|
479
|
+
continue
|
|
480
|
+
}
|
|
481
|
+
const newestLive = [...live.versions].sort(compareVersions).pop() || null
|
|
482
|
+
// A release already at the final env bounds `make_latest`: a reconciled
|
|
483
|
+
// older version must never steal Latest from it.
|
|
484
|
+
const newestFinal = mine
|
|
485
|
+
.filter((r) => stageOf(r.body) === finalEnv)
|
|
486
|
+
.map((r) => tailOf(r.tag))
|
|
487
|
+
.sort(compareVersions)
|
|
488
|
+
.pop()
|
|
489
|
+
const movable = open.filter((entry) => {
|
|
490
|
+
const v = tailOf(entry.tag)
|
|
491
|
+
// Live itself, or contained: a NEWER live version in the same series
|
|
492
|
+
// carries this tag's commits, so its issues shipped.
|
|
493
|
+
return live.versions.has(v) || (newestLive && compareVersions(newestLive, v) > 0)
|
|
494
|
+
})
|
|
495
|
+
const latestTag = movable.length ? movable[movable.length - 1].tag : null
|
|
496
|
+
for (const entry of open) {
|
|
497
|
+
const v = tailOf(entry.tag)
|
|
498
|
+
const mov = movable.includes(entry)
|
|
499
|
+
const latest = mov && entry.tag === latestTag && (!newestFinal || compareVersions(v, newestFinal) > 0)
|
|
500
|
+
if (!flags.apply) {
|
|
501
|
+
if (!entry.release) note(entry.tag, mov ? `would create, move to ${finalEnv} and complete${latest ? ' (latest)' : ''}` : `would create at ${firstEnv}`, 'no release yet')
|
|
502
|
+
else if (!mov) note(entry.tag, 'kept', `not on npm yet (${s.npm})`)
|
|
503
|
+
else note(entry.tag, `would move to ${finalEnv} and complete${latest ? ' (latest)' : ''}`)
|
|
504
|
+
continue
|
|
505
|
+
}
|
|
506
|
+
if (entry.release && !mov) {
|
|
507
|
+
note(entry.tag, 'kept', `not on npm yet (${s.npm})`)
|
|
508
|
+
continue
|
|
509
|
+
}
|
|
510
|
+
const t = ticketsOf(dir, config, entry.tag, s)
|
|
511
|
+
if (!t.ok) {
|
|
512
|
+
note(entry.tag, 'skipped', t.error)
|
|
513
|
+
continue
|
|
514
|
+
}
|
|
515
|
+
let r = entry.release
|
|
516
|
+
let created = false
|
|
517
|
+
if (!r) {
|
|
518
|
+
// The same guard `create` carries: a tracker handed a tag it lacks
|
|
519
|
+
// CREATES it at the default branch's head. `false` refuses this tag;
|
|
520
|
+
// a throw is a cannot-tell and the create goes ahead.
|
|
521
|
+
if (adapter.releaseTagExists) {
|
|
522
|
+
let exists = null
|
|
523
|
+
try {
|
|
524
|
+
exists = await adapter.releaseTagExists(entry.tag)
|
|
525
|
+
} catch {
|
|
526
|
+
exists = null
|
|
527
|
+
}
|
|
528
|
+
if (exists === false) {
|
|
529
|
+
note(entry.tag, 'skipped', `not on the ${p.tracker} remote yet — push the tag first`)
|
|
530
|
+
continue
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
const body = composeBody({ notes: null, tickets: await describeAll(adapter, t.attach), links: [], stage: firstEnv, describe: p.describe })
|
|
534
|
+
r = await adapter.releaseCreate({ tag: entry.tag, name: entry.tag, body, prerelease: true })
|
|
535
|
+
await adapter.releaseAttach(r, t.attach)
|
|
536
|
+
await adapter.releaseStage(r, s.envs[firstEnv], t.attach)
|
|
537
|
+
created = true
|
|
538
|
+
if (!mov) {
|
|
539
|
+
note(entry.tag, `created at ${firstEnv}`, `${t.attach.length} issue(s)`)
|
|
540
|
+
continue
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
await adapter.releaseStage(r, s.envs[finalEnv], t.attach)
|
|
544
|
+
await adapter.releaseUpdate(r, { name: entry.tag, body: withStage(r.body, finalEnv) })
|
|
545
|
+
await adapter.releaseComplete(r, { latest })
|
|
546
|
+
note(entry.tag, `${created ? 'created, ' : ''}moved to ${finalEnv} and completed${latest ? ' (latest)' : ''}`, `${t.attach.length} issue(s)`)
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
if (lines.length === 1) lines.push(' nothing to reconcile')
|
|
550
|
+
return emit(out, flags, lines, result)
|
|
551
|
+
}
|
|
552
|
+
|
|
340
553
|
// Titles for the body, best-effort: a ticket the tracker cannot read is
|
|
341
554
|
// still listed, by ref. The body is information, not a gate.
|
|
342
555
|
async function describeAll(adapter, tickets) {
|
|
@@ -366,15 +579,17 @@ function makeReleaseCommands(p) {
|
|
|
366
579
|
if (verb === 'create') return create(dir, config, tag, flags, out)
|
|
367
580
|
if (verb === 'deployed') return deployed(dir, config, tag, env, flags, out)
|
|
368
581
|
if (verb === 'complete') return complete(dir, config, tag, flags, out)
|
|
582
|
+
if (verb === 'reconcile') return reconcile(dir, config, flags, out)
|
|
369
583
|
out.write(
|
|
370
584
|
`Usage: ${prog} create <tag> [--notes <f>] [--link <url>[=label]] [--stage <env>] [--apply] [--json]\n` +
|
|
371
585
|
` ${prog} deployed <tag> <env> [--apply] [--json]\n` +
|
|
372
|
-
` ${prog} complete <tag> [--apply] [--json]\n
|
|
586
|
+
` ${prog} complete <tag> [--apply] [--json]\n` +
|
|
587
|
+
` ${prog} reconcile [--apply] [--json]\n`,
|
|
373
588
|
)
|
|
374
589
|
return verb ? 1 : 0
|
|
375
590
|
}
|
|
376
591
|
|
|
377
|
-
return { run, create, deployed, complete }
|
|
592
|
+
return { run, create, deployed, complete, reconcile }
|
|
378
593
|
}
|
|
379
594
|
|
|
380
|
-
module.exports = { makeReleaseCommands, resolveRange, seriesFor, composeBody, stageOf, withStage, parseLinks, REQUIRED_OPS }
|
|
595
|
+
module.exports = { makeReleaseCommands, resolveRange, seriesFor, composeBody, stageOf, withStage, parseLinks, parseVersion, compareVersions, npmLiveVersions, REQUIRED_OPS }
|