pi-dev-flow 0.95.2 → 0.96.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/CHANGELOG.md +12 -0
- package/docs/gates.md +22 -8
- package/docs/playbook.md +1 -1
- package/package.json +1 -1
- package/skills/dev-flow/SKILL.md +1 -1
- package/skills/dev-flow/references/implement.md +5 -7
- package/skills/dev-flow/references/plan.md +7 -2
- package/skills/dev-flow/references/pre-release.md +14 -7
- package/src/core.ts +82 -23
- package/src/projectmd.ts +1 -1
- package/src/runtime/base.ts +20 -2
- package/src/runtime/gates.ts +43 -4
- package/src/runtime/publish.ts +60 -18
- package/src/runtime/ship.ts +47 -60
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,18 @@ Format: newest first. `Unreleased` collects what's merged but not yet tagged.
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.96.0] - 2026-11-23
|
|
8
|
+
|
|
9
|
+
**The release call is a kind of bump (patch, minor, major or unreleased) made at Approve?, changeable until the tag; the tag takes the number the merge commit's version file carries. Also: lettuce-style versions order and bump by their x.y.z part, and a tag-push run no longer counts as the merge commit's CI.**
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
- **The release call is a kind of bump, made at Approve?, and no number is fixed before the tag.** On a versioned project, Approve? now also asks *patch, minor or major, or merge unreleased?* (`flow approve --confirmed --version=<kind>` or `--no-version`). An Approve? answer without the call is refused and nothing is kept. No later gate asks it again. The operator can change it at any point until the tag: `flow bump <patch|minor|major|none> --confirmed`, or `--version` / `--no-version` on a confirmed `verify` or `release` call, including a resumed publish. An exact number (`--version=1.2.0`) is no longer accepted, because the number is always counted from the newest tag. A flow approved by an older dev-flow, with no call on record, is still asked at Verified?.
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
- **`flow release` no longer tags a number the merged tree doesn't carry.** Release? used to fix the version it saw at that moment. If another flow released first, the publish step stopped on a conflict and the agent re-bumped the branch, as told. The gate then tagged the old number anyway, on a merge commit whose version file said otherwise. CI refused to publish it, and every re-run pushed the stale tag again. Now no number is fixed at Release?. Before the merge, the gate checks the branch's version against the newest tag and names the number to re-bump to (alongside the conflict, when there is one). At the tag, it reads the version file at the merge commit and checks it against the call once more. A tag of the same name already on another commit stops the release instead of being taken as done.
|
|
16
|
+
- **Release-gate version checks read the x.y.z part.** A version such as `v0.49.1-letta_0.34.68` broke the bump arithmetic (the call went unchecked) and the newest-tag ordering (the suffix decided which tag was newest). Versions now order and bump by their x.y.z core, with any prefix or suffix kept by the project.
|
|
17
|
+
- **A failed run started by a tag push no longer counts as the merge commit's CI.** That run is the release's publish job, not a check on the merge. A refused tag used to block the next tag attempt as "merge commit checks failed".
|
|
18
|
+
|
|
7
19
|
## [0.95.2] - 2026-11-20
|
|
8
20
|
|
|
9
21
|
**`flow release` stops waiting on a check that GitHub left stuck at "in progress" after its job finished.**
|
package/docs/gates.md
CHANGED
|
@@ -53,7 +53,7 @@ the session. It also takes over a feature another session holds. Nothing binds a
|
|
|
53
53
|
|
|
54
54
|
## approve: Approve?
|
|
55
55
|
|
|
56
|
-
`flow approve [--yolo]`
|
|
56
|
+
`flow approve [--yolo] [--version=patch|minor|major | --no-version]`
|
|
57
57
|
|
|
58
58
|
- `plan/plan.md` must exist with exactly that name.
|
|
59
59
|
- For a `--ui` feature, every screenshot under `plan/` must be embedded in plan.md, every
|
|
@@ -62,6 +62,16 @@ the session. It also takes over a feature another session holds. Nothing binds a
|
|
|
62
62
|
- On yes, it creates the worktree and the `feat/<slug>` branch, then runs `setup` there. If setup
|
|
63
63
|
fails, the next `approve` retries it.
|
|
64
64
|
|
|
65
|
+
**The release call rides on Approve?** On a versioned project with `version = ask` (the default),
|
|
66
|
+
the question also asks: *patch, minor or major release, or merge unreleased?* Your answer is recorded
|
|
67
|
+
with `--version=<kind>` or `--no-version`; an Approve? answer without it is refused and nothing is
|
|
68
|
+
kept. Only the kind of step is recorded, never a number: the number is counted from the newest tag
|
|
69
|
+
when the release runs, so a flow that released first moves yours along instead of colliding with it.
|
|
70
|
+
No later gate asks the call again. You can change it at any point until the tag is cut: say so,
|
|
71
|
+
and the agent runs `flow bump <patch|minor|major|none> --confirmed`, or passes
|
|
72
|
+
`--version=<kind>` / `--no-version` on a confirmed `verify` or `release` call. A flow approved by an
|
|
73
|
+
older dev-flow, with no call on record, is asked at Verified? instead.
|
|
74
|
+
|
|
65
75
|
## test, check, health
|
|
66
76
|
|
|
67
77
|
- `flow test` runs the `test` command and records the result.
|
|
@@ -94,10 +104,6 @@ It refuses if:
|
|
|
94
104
|
- a check, the build or the post-deploy health probe fails;
|
|
95
105
|
- `servedBuild` is set and the running app isn't serving this commit.
|
|
96
106
|
|
|
97
|
-
**The release call rides on Verified?** On a versioned project with `version = ask` (the default),
|
|
98
|
-
the question also asks: *patch, minor or major release, or merge unreleased?* Your answer is recorded
|
|
99
|
-
with `--version=…` or `--no-version`.
|
|
100
|
-
|
|
101
107
|
With `--confirmed`, it never rewrites history. If main moved since the review deploy, re-run
|
|
102
108
|
`flow verify`. It also doesn't build or deploy a second time: when the tree is the one it deployed for
|
|
103
109
|
your review, it only checks that the app still answers. If the tree changed, or the app stopped
|
|
@@ -117,12 +123,14 @@ probes on the current tree and asks Verified? again. A standing yolo never answe
|
|
|
117
123
|
|
|
118
124
|
## release: Release?
|
|
119
125
|
|
|
120
|
-
`flow release [--yolo] [--version=<
|
|
126
|
+
`flow release [--yolo] [--version=<kind> | --no-version] [--no-fold-check] [--no-marker-check]`
|
|
121
127
|
|
|
122
128
|
Proves the branch is ready to ship:
|
|
123
129
|
|
|
124
130
|
- **The version** matches your release call. Patch, minor or major is counted from the newest tag
|
|
125
|
-
at release time, so if a parallel flow shipped first, yours moves to the next number.
|
|
131
|
+
at release time, so if a parallel flow shipped first, yours moves to the next number. Versions
|
|
132
|
+
that carry more than x.y.z (a `v` prefix, a suffix such as `-letta_0.34.68`) are ordered and
|
|
133
|
+
bumped by their x.y.z part.
|
|
126
134
|
- **The version is new**: the manifest's version isn't tagged yet.
|
|
127
135
|
- **The changelog** has a heading for this version, this branch edited it, every entry that was
|
|
128
136
|
pending under `Unreleased` is kept in the new section, and `Unreleased` is now empty.
|
|
@@ -163,12 +171,18 @@ On GitHub, the same `flow release` call then publishes. Your Release? answer is
|
|
|
163
171
|
(`.github/pull_request_template.md`), the gate refuses until `pr-body.md` exists, before
|
|
164
172
|
Release? is asked, so the template's sections are filled before the merge.
|
|
165
173
|
2. Checks the branch merges cleanly into the default branch. On a conflict it names the files and pushes nothing.
|
|
174
|
+
It also checks the version again against the newest tag: if another release landed since Release?, it
|
|
175
|
+
names the number to re-bump to (with the conflict, when there is one) and merges nothing until the branch
|
|
176
|
+
carries it.
|
|
166
177
|
3. Waits for the PR's CI, up to 30 minutes. A repo with no CI is given a minute for checks to show up. A check pending for 5 minutes has its Actions job asked directly: GitHub can leave a check run `in_progress` after its job finished, and the job's result is used then.
|
|
167
178
|
4. Merges in the playbook's `merge` style.
|
|
168
179
|
5. Waits for the merge commit's own CI to go green, because the tag publishes from that commit. If it's red, the
|
|
169
180
|
gate stops without tagging. If no CI runs on that commit, it tags after a minute. `tagWait = none` under
|
|
170
181
|
`## release` skips this wait.
|
|
171
|
-
6. Creates an annotated tag on the PR's merge commit and pushes it (versioned flows).
|
|
182
|
+
6. Creates an annotated tag on the PR's merge commit and pushes it (versioned flows). The tag is the version
|
|
183
|
+
file **at that merge commit**, checked against your call one last time. No number is fixed earlier, so a
|
|
184
|
+
re-bump after a merge of the default branch is what gets tagged. A tag of the same name on another commit
|
|
185
|
+
stops it. A failed run that a tag push started does not count as the merge commit's CI.
|
|
172
186
|
7. Records the release (below).
|
|
173
187
|
|
|
174
188
|
Each step first asks GitHub whether it's already done, so a re-run picks up where it stopped, and a
|
package/docs/playbook.md
CHANGED
|
@@ -171,7 +171,7 @@ These go under `## pre-release` or `## release`. Either section works.
|
|
|
171
171
|
| `versionTag` | `v{version}` | tag format |
|
|
172
172
|
| `changelog` | `CHANGELOG.md` | set it empty (`changelog =` or `changelog = ""`) to opt out |
|
|
173
173
|
| `merge` | *(asked)* | how a PR lands: `squash`, `merge`, `rebase` or `any`. See below. |
|
|
174
|
-
| `version` | `ask` | who makes the release call: `ask` (you, at
|
|
174
|
+
| `version` | `ask` | who makes the release call: `ask` (you, at Approve? — the kind of bump, changeable until the tag), or `versioned` / `unversioned` for every flow |
|
|
175
175
|
| `ask` | `on-change` | `on-change`: Release? answers itself when only release prep changed. `always`: ask every time. |
|
|
176
176
|
| `finish` | `on-change` | `on-change`: Finish? answers itself when nothing is open (see [gates](gates.md#finish-finish)). `always`: ask every time. |
|
|
177
177
|
| `publish` | `gate` | `gate`: on GitHub, `flow release` pushes, opens the PR, waits for CI, merges and tags itself. `manual`: the agent runs those steps. Other forges are always manual. |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-dev-flow",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.96.0",
|
|
4
4
|
"description": "Enforced feature workflow for Pi: plan → implement → pre-release → release, gated checkpoints, self-improvement reflections, one git worktree per feature, changelog + publish as part of the release",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
package/skills/dev-flow/SKILL.md
CHANGED
|
@@ -42,7 +42,7 @@ criteria hold. Call it with an args array — `["start", "dark-mode"]`,
|
|
|
42
42
|
internal identifiers; give depth when asked.
|
|
43
43
|
- **yolo** at a checkpoint → that gate with `--yolo --confirmed`; run the
|
|
44
44
|
remaining gates back to back without asking, honoring guidance attached to
|
|
45
|
-
the word ("yolo, patch bump"
|
|
45
|
+
the word ("yolo, patch bump" → `--version=patch`, "yolo, no tag" → `--no-version`). Checks,
|
|
46
46
|
guard rules and any `NEEDS-OPERATOR` still apply.
|
|
47
47
|
- **One session = one feature** (flow + branch + worktree). `flow start <slug>`
|
|
48
48
|
binds a new one, `flow use <slug>` takes one over; nothing auto-binds, and an
|
|
@@ -49,13 +49,11 @@ note). Other sessions' worktrees are theirs.
|
|
|
49
49
|
— say what changed for the user and how to see it, not which modules
|
|
50
50
|
changed.
|
|
51
51
|
Report opening: **🔨 implement · `<slug>`** (the gate's stage line).
|
|
52
|
-
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
3. Answer → `flow verify --confirmed` (yolo → `--yolo --confirmed`), plus
|
|
58
|
-
`--version=patch|minor|major` (or `--version=<exact>`) or `--no-version`. It does not
|
|
52
|
+
- The release call was made at Approve? and is not asked again. Only a flow
|
|
53
|
+
approved by an older dev-flow, with no call on record, gets it asked here.
|
|
54
|
+
If the operator changes it now, pass `--version=<kind>` / `--no-version`
|
|
55
|
+
with the answer.
|
|
56
|
+
3. Answer → `flow verify --confirmed` (yolo → `--yolo --confirmed`). It does not
|
|
59
57
|
deploy again when the tree is the one it deployed for review — it only
|
|
60
58
|
probes that the app still answers. If the
|
|
61
59
|
default branch moved since the review deploy it refuses: run `flow verify`
|
|
@@ -52,8 +52,13 @@ No code edits before approval. Reads are always allowed.
|
|
|
52
52
|
verify the state in the DOM and move on.
|
|
53
53
|
5. **Ask Approve? and stop.** Report opening: **📝 plan · `<slug>`** (the
|
|
54
54
|
gate's stage line). A `--patch` / `--docs` flow: name the mode and the
|
|
55
|
-
one-line change in the question — the answer grants the mode.
|
|
56
|
-
|
|
55
|
+
one-line change in the question — the answer grants the mode. Versioned project with playbook `version = ask`
|
|
56
|
+
(the default): the same question asks the **release call** — a patch, minor or major release (propose one by
|
|
57
|
+
the playbook's versioning rule) or merge unreleased. Only the kind is recorded, never a number: the gate counts
|
|
58
|
+
it from the newest tag when the release runs. Answer → `flow approve --confirmed --version=patch|minor|major` or
|
|
59
|
+
`--no-version` (yolo → add `--yolo`); without the call the gate refuses and keeps nothing.
|
|
60
|
+
The call is not asked again. The operator can change it at any later point until the tag: `flow bump
|
|
61
|
+
<patch|minor|major|none> --confirmed`, or `--version=<kind>` / `--no-version` on a confirmed verify or release call.
|
|
57
62
|
|
|
58
63
|
Approval creates the worktree and branch and runs `commands.setup` there; a
|
|
59
64
|
failing setup fails the gate and the next approve retries it. `(ui)` playbook
|
|
@@ -19,11 +19,17 @@ and settle the scheme with the operator; never invent one.
|
|
|
19
19
|
`flow release` refuses while that re-verify is unanswered.
|
|
20
20
|
2. **Docs**: update them to match the change.
|
|
21
21
|
3. **Changelog + bump** — manifest, changelog heading and tag must agree;
|
|
22
|
-
commit the prep on the feature branch. The release call
|
|
23
|
-
|
|
24
|
-
names the number — another flow that released first moves it
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
commit the prep on the feature branch. The release call made at Approve?
|
|
23
|
+
decides which: its kind of step, counted from the newest tag (the gate
|
|
24
|
+
names the number — another flow that released first moves it, and the
|
|
25
|
+
gate re-checks it before the merge and again at the tag), or *merge
|
|
26
|
+
unreleased* — no bump, the line goes under `Unreleased`. A project whose
|
|
27
|
+
versions carry more than x.y.z (a `v` prefix, a suffix) keeps those parts;
|
|
28
|
+
the call governs the x.y.z.
|
|
29
|
+
- **Another release landed first** (`flow release` stops: conflict, or "must
|
|
30
|
+
be <x.y.z>") → merge the default branch in, set the version file and its
|
|
31
|
+
changelog heading to the number the gate names, commit, re-run. Never
|
|
32
|
+
tag by hand around it: the gate tags the merged tree's own version.
|
|
27
33
|
- **The changelog writer reviews the branch, not its commit list**: read
|
|
28
34
|
`git log <default>..HEAD` *and* `git diff <default>...HEAD`, then write
|
|
29
35
|
what the branch delivers in the reader's terms (what was broken, what
|
|
@@ -65,8 +71,9 @@ and settle the scheme with the operator; never invent one.
|
|
|
65
71
|
as `--yolo`: the operator's answer is `flow release --confirmed`.
|
|
66
72
|
- Operator ships **without a version** → `flow release --no-version
|
|
67
73
|
--confirmed`: no bump or tag, but the branch must add its line under
|
|
68
|
-
`Unreleased`. A changed call is `--version=<
|
|
69
|
-
`--confirmed
|
|
74
|
+
`Unreleased`. A changed call is `--version=<kind>` / `--no-version` with
|
|
75
|
+
`--confirmed` (or `flow bump <kind> --confirmed`), on their word — taken
|
|
76
|
+
on any call until the tag, a resumed publish included.
|
|
70
77
|
|
|
71
78
|
The gate runs any tier-1 check that is stale, requires the manifest ahead of the last tag and a
|
|
72
79
|
changelog **heading** for that version written on this branch.
|
package/src/core.ts
CHANGED
|
@@ -49,15 +49,15 @@ export interface FlowState {
|
|
|
49
49
|
yolo?: boolean; // operator said "yolo" at any gate question: that one answered, every later one pre-confirmed; checks and guardrails stay
|
|
50
50
|
setupAt?: string; // commands.setup exited 0 in this worktree — a reused worktree reruns it only when unset (#49)
|
|
51
51
|
publish?: { pr?: number; merged?: string; tag?: string }; // set when the release gate publishes itself (GitHub): what it has done so far — every step re-probes the forge, this only feeds the hint and the result
|
|
52
|
-
releaseVersion?: string; // the
|
|
52
|
+
releaseVersion?: string; // the version that was tagged — read from the merge commit (or the branch head) when the tag is cut, never pinned earlier; release-done publishes this, not whatever a checkout says later (#52)
|
|
53
53
|
forgeReleaseSkipped?: string; // a gh/glab release create that failed: release-done says so, finish names it so the missing forge release cannot slip past (#63)
|
|
54
54
|
staleBuild?: string; // release ran under an older dev-flow than the checkout by operator choice ("<loaded> (checkout <disk>)"); release-done repeats the acknowledgement
|
|
55
55
|
pendingAsk?: string; // the checkpoint word a gate asked for and has not been given ("Approve?", "Verified?", …) — presentation only (💬 in the footer), it never gates
|
|
56
56
|
/** when flow verify at pre-release asked Verified? over review fixes; cleared by the answer — flow release refuses while it is set */
|
|
57
57
|
reverifyAsked?: string;
|
|
58
58
|
releaseOnly?: boolean; // verify found nothing on the branch but unreleased work on main: this flow only cuts the version (#161)
|
|
59
|
-
versionChoice?: string; // the operator's release call, recorded with
|
|
60
|
-
versionFrom?: string; // the manifest version when the call was recorded —
|
|
59
|
+
versionChoice?: string; // the operator's release call, recorded with Approve?: patch | minor | major (a decision, never a number: counted from the newest tag at release, so a parallel flow taking the number moves it), "next" (playbook version = versioned: any bump past the last tag) or "unreleased"; any gate call before the tag can change it
|
|
60
|
+
versionFrom?: string; // the manifest version when the call was recorded — only for the hint's "as things stand" number; the gate counts from the newest tag
|
|
61
61
|
/** the session and its operator-message count when Verified? moved this flow to pre-release (gh#254): under
|
|
62
62
|
* yolo = until-release, a message after it is the operator's own Release? word, not a replayed plan-stage yolo */
|
|
63
63
|
verifiedAtMessage?: { key: string; users: number };
|
|
@@ -537,18 +537,37 @@ export function pickReleaseNotes(src: { changelog: string | null; version: strin
|
|
|
537
537
|
return { notes: "", source: "none" };
|
|
538
538
|
}
|
|
539
539
|
|
|
540
|
-
/**
|
|
541
|
-
* the
|
|
542
|
-
*
|
|
543
|
-
|
|
540
|
+
/** The operator's release call — a decision about the bump, never a number: a bump kind (`patch|minor|major`),
|
|
541
|
+
* `next` (the playbook says versioned: any bump past the last tag) or `unreleased` (merge + changelog only).
|
|
542
|
+
* Made at Approve? and changeable on any later gate call until the tag is cut. The number it means is counted
|
|
543
|
+
* from the newest tag whenever the gate needs it, so a flow that released first moves this one along instead
|
|
544
|
+
* of colliding with it (a pinned number was tagged onto a tree whose manifest said otherwise). */
|
|
544
545
|
export type BumpKind = "patch" | "minor" | "major";
|
|
545
546
|
export const isBumpKind = (c: string | null | undefined): c is BumpKind => c === "patch" || c === "minor" || c === "major";
|
|
546
547
|
|
|
547
|
-
/**
|
|
548
|
+
/** The x.y.z a version carries, wherever it sits: `v0.49.1-letta_0.34.68` → [0, 49, 1]. Null when there is none. */
|
|
549
|
+
export function versionCore(v: string | null | undefined): [number, number, number] | null {
|
|
550
|
+
const m = v?.match(/(\d+)\.(\d+)\.(\d+)/);
|
|
551
|
+
return m ? [Number(m[1]), Number(m[2]), Number(m[3])] : null;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
/** Release order: the x.y.z core first (a `v` prefix or a project suffix such as `-letta_0.34.68` must not reorder
|
|
555
|
+
* releases), what follows the core only to break a tie. */
|
|
556
|
+
export function cmpRelease(a: string, b: string): number {
|
|
557
|
+
const ca = versionCore(a);
|
|
558
|
+
const cb = versionCore(b);
|
|
559
|
+
if (!ca || !cb) return cmpVersions(a, b);
|
|
560
|
+
for (let i = 0; i < 3; i++) if (ca[i] !== cb[i]) return ca[i] - cb[i];
|
|
561
|
+
// same core: what follows it decides (lettuce's -letta_0.34.68 over -letta_0.34.67); a prefix never does
|
|
562
|
+
const rest = (v: string) => v.slice(v.search(/\d+\.\d+\.\d+/)).replace(/^\d+\.\d+\.\d+/, "");
|
|
563
|
+
return cmpVersions(rest(a), rest(b));
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
/** `from`'s x.y.z bumped by one `kind` step — the bare core, any prefix or suffix dropped — or null when `from` has none. */
|
|
548
567
|
export function bumpVersion(from: string | null | undefined, kind: BumpKind): string | null {
|
|
549
|
-
const
|
|
550
|
-
if (!
|
|
551
|
-
const [maj, min, pat] =
|
|
568
|
+
const c = versionCore(from);
|
|
569
|
+
if (!c) return null;
|
|
570
|
+
const [maj, min, pat] = c;
|
|
552
571
|
return kind === "major" ? `${maj + 1}.0.0` : kind === "minor" ? `${maj}.${min + 1}.0` : `${maj}.${min}.${pat + 1}`;
|
|
553
572
|
}
|
|
554
573
|
|
|
@@ -558,8 +577,9 @@ export const playbookVersionChoice = (cfg: Config): string | undefined =>
|
|
|
558
577
|
|
|
559
578
|
/** `to` raises the major version over `from` (1.x → 2.0, and 0.x → 1.0). */
|
|
560
579
|
export function majorBump(from: string, to: string): boolean {
|
|
561
|
-
const
|
|
562
|
-
|
|
580
|
+
const a = versionCore(from);
|
|
581
|
+
const b = versionCore(to);
|
|
582
|
+
return !!a && !!b && b[0] > a[0];
|
|
563
583
|
}
|
|
564
584
|
|
|
565
585
|
/** A recorded call in the operator's words. */
|
|
@@ -572,12 +592,47 @@ export const describeVersionChoice = (c: string, from?: string | null): string =
|
|
|
572
592
|
? `a ${c} release${bumpVersion(from, c) ? ` (${from} → ${bumpVersion(from, c)})` : ""}`
|
|
573
593
|
: `release ${c}`;
|
|
574
594
|
|
|
575
|
-
/** Does the version flag pair on a
|
|
595
|
+
/** Does the version flag pair on a gate call parse? Returns the call it makes, null for none, or an error. */
|
|
576
596
|
export function versionArg(value: string | null, noVersion: boolean): { choice: string | null } | { error: string } {
|
|
577
|
-
if (value !== null && noVersion) return { error: "--version=<
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
597
|
+
if (value !== null && noVersion) return { error: "--version=<kind> and --no-version contradict each other — pass the one the operator chose" };
|
|
598
|
+
const v = value?.trim() ?? null;
|
|
599
|
+
if (v !== null && !isBumpKind(v)) {
|
|
600
|
+
const exact = versionCore(v) ? ` — the number is not chosen up front: it is counted from the newest tag when the release runs, so pass the kind of step ${v} would be` : "";
|
|
601
|
+
return { error: `--version=${value} is not a release call — pass what the operator chose: patch, minor or major (or --no-version to merge unreleased)${exact}` };
|
|
602
|
+
}
|
|
603
|
+
return { choice: v !== null ? v : noVersion ? "unreleased" : null };
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
/** The question that collects the release call (asked with Approve?); `now` is the manifest's current version. */
|
|
607
|
+
export function releaseCallQuestion(now: string | null, file: string, docs?: boolean): { ask: string; flags: string } {
|
|
608
|
+
const kinds = (["patch", "minor", "major"] as const).map((k) => `${k}${bumpVersion(now, k) ? ` (→ ${bumpVersion(now, k)} as things stand)` : ""}`).join(", ");
|
|
609
|
+
return {
|
|
610
|
+
ask: `also ask the release call: a ${kinds} release — propose one by the playbook's versioning rule${now ? ` (${file} is at ${now})` : ""} — or merge unreleased (no bump, no tag)${docs ? "; a docs flow usually merges unreleased" : ""}. Only the kind of step is recorded: the number is counted from the newest tag at release, and the operator can change the call on any gate call before the tag`,
|
|
611
|
+
flags: "--version=patch|minor|major or --no-version (merge unreleased)",
|
|
612
|
+
};
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
/** Does `manifest` carry the operator's release call? `newest` is the newest tagged release, `base` the manifest the
|
|
616
|
+
* branch started from. Null when it does; otherwise what to fix, with the number the call means today. */
|
|
617
|
+
export function releaseCallProof(choice: string, manifest: string | null, newest: string | null, base: string | null, file: string): { error: string; want?: string } | null {
|
|
618
|
+
if (choice === "unreleased") {
|
|
619
|
+
if (manifest && base && base !== manifest) return { error: `the release call is to merge unreleased, but the branch bumps ${file} ${base} → ${manifest} — revert the bump (the entry goes under Unreleased), or change the call (--version=<kind>) on the operator's word` };
|
|
620
|
+
return null;
|
|
621
|
+
}
|
|
622
|
+
if (isBumpKind(choice)) {
|
|
623
|
+
const from = newest ?? base;
|
|
624
|
+
const want = bumpVersion(from, choice);
|
|
625
|
+
if (!want) return null; // nothing to count from: the generic proofs (a version past the last tag) still run
|
|
626
|
+
const have = versionCore(manifest);
|
|
627
|
+
if (!have || have.join(".") !== want) {
|
|
628
|
+
const extra = manifest && manifest.replace(/\d+\.\d+\.\d+/, "") ? " (its x.y.z part — keep the project's own prefix and suffix)" : "";
|
|
629
|
+
return { error: `the release call is a ${choice} release: ${file} must be ${want}${extra} — ${choice} past ${newest ? `the newest tag, ${newest}` : from} — it says ${manifest ?? "no version"}`, want };
|
|
630
|
+
}
|
|
631
|
+
return null;
|
|
632
|
+
}
|
|
633
|
+
if (choice === "next" && manifest && newest && cmpRelease(manifest, newest) <= 0)
|
|
634
|
+
return { error: `${file} says ${manifest}, which is not past the newest tag ${newest} — bump it past ${newest}` };
|
|
635
|
+
return null;
|
|
581
636
|
}
|
|
582
637
|
|
|
583
638
|
/**
|
|
@@ -883,7 +938,7 @@ export function newestTaggedVersion(pattern: string, tags: string[]): string | n
|
|
|
883
938
|
let best: string | null = null;
|
|
884
939
|
for (const t of tags) {
|
|
885
940
|
const m = t.match(re);
|
|
886
|
-
if (m && (best === null ||
|
|
941
|
+
if (m && (best === null || cmpRelease(m[1], best) > 0)) best = m[1];
|
|
887
942
|
}
|
|
888
943
|
return best;
|
|
889
944
|
}
|
|
@@ -2597,11 +2652,15 @@ export function nextHint(state: FlowState, cfg: Config): string {
|
|
|
2597
2652
|
return `${base} — linked reflections ${open.map((r) => `r${r.id}`).join(", ")}: fix each on this branch (finish closes them as fixed), or flow reflect defer <id> "<why>" for one it will not fix`;
|
|
2598
2653
|
}
|
|
2599
2654
|
|
|
2655
|
+
/** The release call still to be asked with Approve? — "" when the playbook makes it or it is on record. */
|
|
2656
|
+
const callAsk = (state: FlowState, cfg: Config): string =>
|
|
2657
|
+
cfg.versioning.file && !playbookVersionChoice(cfg) && !state.versionChoice ? " together with the release call (patch, minor or major — the kind of step, not a number — or merge unreleased)" : "";
|
|
2658
|
+
|
|
2600
2659
|
function stageHint(state: FlowState, cfg: Config): string {
|
|
2601
2660
|
switch (state.stage) {
|
|
2602
2661
|
case "plan":
|
|
2603
|
-
if (state.patch || state.docs) return `${state.patch ? "patch" : "docs"} (proposed — the Approve? answer grants the mode): describe the change in one line, ask Approve? in chat naming the mode, then flow approve --confirmed — no plan file${state.docs ? ", no tier-1 checks" : ""}`;
|
|
2604
|
-
return `clarify the direction in chat, write .dev-flow/${state.slug}/plan/plan.md${state.ui ? ` and render mockups to plan/mockups/ (${cfg.mockupGlobs.join(", ")}) with headless chromium, embedded in plan.md` : ""}, then ask Approve
|
|
2662
|
+
if (state.patch || state.docs) return `${state.patch ? "patch" : "docs"} (proposed — the Approve? answer grants the mode): describe the change in one line, ask Approve? in chat naming the mode${callAsk(state, cfg)}, then flow approve --confirmed${callAsk(state, cfg) ? " --version=<kind>|--no-version" : ""} — no plan file${state.docs ? ", no tier-1 checks" : ""}`;
|
|
2663
|
+
return `clarify the direction in chat, write .dev-flow/${state.slug}/plan/plan.md${state.ui ? ` and render mockups to plan/mockups/ (${cfg.mockupGlobs.join(", ")}) with headless chromium, embedded in plan.md` : ""}, then ask Approve?${callAsk(state, cfg)} and run flow approve --confirmed${callAsk(state, cfg) ? " --version=<kind>|--no-version" : ""} on the answer`;
|
|
2605
2664
|
case "implement":
|
|
2606
2665
|
if (state.docs) {
|
|
2607
2666
|
const open = openItemsNote(cfg, state, "implement");
|
|
@@ -2611,7 +2670,7 @@ function stageHint(state: FlowState, cfg: Config): string {
|
|
|
2611
2670
|
const rv = reviewOwed(state, cfg) ? `; then the review — ${cfg.release.review}, fix what it finds and record it (flow review done "<verdict>"; a flow_stage review worker records itself)` : "";
|
|
2612
2671
|
return `build and test in ${state.worktree}, commit as you go, flow check${rv}; then flow verify (deploys for review), look yourself, keep the app running, ask Verified? and run flow verify --confirmed on the answer`;
|
|
2613
2672
|
case "pre-release": {
|
|
2614
|
-
//
|
|
2673
|
+
// the release call (made with Approve?, changeable until the tag) decides which prep this is
|
|
2615
2674
|
const vc = state.versionChoice;
|
|
2616
2675
|
// gh#233: flow release refuses until the review is on record — the hint says how it gets there
|
|
2617
2676
|
const rv = reviewOwed(state, cfg) ? `${cfg.release.review} (then record it: flow review done "<verdict>")` : cfg.release.review && state.review ? "review on record" : "";
|
|
@@ -2622,7 +2681,7 @@ function stageHint(state: FlowState, cfg: Config): string {
|
|
|
2622
2681
|
const gateAsks = `${auto} — the gate asks Release? when it needs the operator's word (NEEDS-OPERATOR Release?): ask it then, never before the call`;
|
|
2623
2682
|
if (vc === "unreleased")
|
|
2624
2683
|
return `${review}fix must/should${state.docs ? "" : " (a fix that changes behaviour: flow verify redeploys and re-asks Verified? over it)"}, update docs${cfg.release.changelog && !state.docs ? `, add this flow's line under Unreleased in ${cfg.release.changelog} (the call is merge unreleased: no bump)` : ""}; show the PR summary, then run flow release${gateAsks}`;
|
|
2625
|
-
const prep = [cfg.release.changelog ? `prepare ${cfg.release.changelog} (fold Unreleased lines verbatim)` : "", cfg.versioning.file ? `bump version in ${cfg.versioning.file}${isBumpKind(vc) ? `
|
|
2684
|
+
const prep = [cfg.release.changelog ? `prepare ${cfg.release.changelog} (fold Unreleased lines verbatim)` : "", cfg.versioning.file ? `bump version in ${cfg.versioning.file}${isBumpKind(vc) ? ` one ${vc} step past the newest tag (${bumpVersion(state.versionFrom, vc) ?? `the next ${vc}`} as of approval — a flow that released since moves it; flow release names the number)` : ""}` : ""].filter(Boolean).join(" and ");
|
|
2626
2685
|
if (vc && prep) return `${review}fix must/should${state.docs ? "" : " (a fix that changes behaviour: flow verify redeploys and re-asks Verified? over it)"}, update docs, ${prep}; show the PR summary, version and changelog, then run flow release${gateAsks}`;
|
|
2627
2686
|
if (state.docs && prep) return `${review}fix must/should; a docs flow usually ships unversioned — ask the operator (flow release --no-version on their word); versioned instead: ${prep}; then run flow release${gateAsks}`;
|
|
2628
2687
|
return `${review}fix must/should${state.docs ? "" : " (a fix that changes behaviour: flow verify redeploys and re-asks Verified? over it)"}, update docs${prep ? `, ${prep}` : ""}; show the PR summary, version and changelog, then run flow release${gateAsks}`;
|
package/src/projectmd.ts
CHANGED
|
@@ -68,7 +68,7 @@ const KEYMAP: Record<string, Record<string, string>> = {
|
|
|
68
68
|
merge: "release.merge", // how a merged branch lands: squash | merge | rebase | any
|
|
69
69
|
yolo: "release.yolo", // how far a standing yolo reaches: all (default) | until-release (gh#176)
|
|
70
70
|
reflect: "release.reflect", // when finish runs the closing reflection: on-friction (default) | always
|
|
71
|
-
version: "release.version", // who
|
|
71
|
+
version: "release.version", // who makes the release call: ask (with Approve?, default) | versioned | unversioned (gh#198)
|
|
72
72
|
ask: "release.ask", // when Release? is asked: on-change (default) | always (gh#198)
|
|
73
73
|
finish: "release.finish", // when Finish? is asked: on-change (default, a clean flow closes itself) | always
|
|
74
74
|
publish: "release.publish", // who runs push, PR, merge and tag after Release?: gate (default on GitHub) | manual
|
package/src/runtime/base.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { copyFileSync, existsSync, mkdirSync, readdirSync, readFileSync, renameS
|
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { promisify } from "node:util";
|
|
6
6
|
import { compact, SettingsManager, type ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
7
|
-
import { isDocPath, checklistPending, claimBlocks, classifyMergeHistory, cmpVersions, detectForge, extractSkillCore, featureBranchPrefix, healthRetry, parseMergeStyle, parseLsRemoteTags, pluginVersion, reflectItems, sessionRunsOlderBuild, listFiles, shouldSelfCompact, sq, featureTmpDir, featureTmpEnv, staleScratch, mainCheckoutRoot, type ReflectItem, type Config, type FeatureRef, type FlowState, type SessionClaim, ensureReflectIds } from "../core.ts";
|
|
7
|
+
import { isDocPath, parseVersion, checklistPending, claimBlocks, classifyMergeHistory, cmpVersions, detectForge, extractSkillCore, featureBranchPrefix, healthRetry, parseMergeStyle, parseLsRemoteTags, pluginVersion, reflectItems, sessionRunsOlderBuild, listFiles, shouldSelfCompact, sq, featureTmpDir, featureTmpEnv, staleScratch, mainCheckoutRoot, type ReflectItem, type Config, type FeatureRef, type FlowState, type SessionClaim, ensureReflectIds } from "../core.ts";
|
|
8
8
|
import { loadProject, parseProjectMd, setPlaybookKey } from "../projectmd.ts";
|
|
9
9
|
import { bashTimeout } from "../timeouts.ts";
|
|
10
10
|
import { type RunResult, type Session } from "./checks.ts";
|
|
@@ -236,7 +236,7 @@ export async function releaseTags(root: string): Promise<string[] | null> {
|
|
|
236
236
|
}
|
|
237
237
|
|
|
238
238
|
export const GATE_HELP =
|
|
239
|
-
"help [--json] | init [--force|--draft|--write <text>|--write-file <path>|--answers key=value…|--answers-file <path>] [--confirmed] [--track] | reflect [<note> [--evidence=<file:line>]|list|plan|tidy|move <id> --playbook|--code|done <id>[,<id>…] [<what>]|reopen <id> [<why>]|defer <id> <why>|--same <id> [<evidence>]] | roadmap [add <text> [--slug=<slug>] [--brief=<notes>|--brief-file=<path>]|pick <n> <slug>|done <n>[,<n>…]|drop <n>[,<n>…]|tidy] | doctor [<issue note>] | status [slug] [--json] | start <slug> [--ui|--patch|--docs] [--reflections=r<id>,…] [--no-ui --confirmed] [--force] [--merge=squash|merge|rebase|any] [--check-upstream] | use <slug> | test | check | health | review [done <verdict>|--skip] | approve [--yolo] | verify [--yolo] [--port=<n>|--replace] [--version=<
|
|
239
|
+
"help [--json] | init [--force|--draft|--write <text>|--write-file <path>|--answers key=value…|--answers-file <path>] [--confirmed] [--track] | reflect [<note> [--evidence=<file:line>]|list|plan|tidy|move <id> --playbook|--code|done <id>[,<id>…] [<what>]|reopen <id> [<why>]|defer <id> <why>|--same <id> [<evidence>]] | roadmap [add <text> [--slug=<slug>] [--brief=<notes>|--brief-file=<path>]|pick <n> <slug>|done <n>[,<n>…]|drop <n>[,<n>…]|tidy] | doctor [<issue note>] | status [slug] [--json] | start <slug> [--ui|--patch|--docs] [--reflections=r<id>,…] [--no-ui --confirmed] [--force] [--merge=squash|merge|rebase|any] [--check-upstream] | use <slug> | test | check | health | review [done <verdict>|--skip] | approve [--yolo] [--version=patch|minor|major|--no-version] | bump <patch|minor|major|none> [slug] | verify [--yolo] [--port=<n>|--replace] [--version=<kind>|--no-version] | release [--yolo|--version=<kind>|--no-version|--no-fold-check|--no-marker-check] | finish [--yolo] [--no-reflect] [--note=<text>] [--no-artifact-check|--no-release-create] [slug] | abort [slug] [--purge] | version [--check-upstream] — state gates take [slug] and --confirmed (the operator already answered in chat); without it the agent's call returns NEEDS-OPERATOR with the question to ask in chat (it never opens a dialog), and the /flow slash command asks in a dialog — verify without --confirmed rebases a branch that is behind the default branch and deploys for review; --port=<n> / --replace answer its Dev port? question when another flow holds the stack — --ui on start is the agent's call whenever screens change (it only adds the mockup gate); --patch/--docs are proposed at start and granted by the Approve? answer; --no-ui (clearing ui on a plan-stage feature) and --merge=<style> are operator-granted (--confirmed); start refuses until the playbook has a merge policy and writes the answer into project.md — --yolo (with --confirmed) answers that checkpoint and pre-confirms every later one; checks and guardrails stay — approve --confirmed carries the operator's release call on a versioned project: --version=patch|minor|major (the kind of step — the number is counted from the newest tag when the release runs) or --no-version (merge unreleased), asked with Approve?; it is never asked again, and the operator changes it on any later gate call (verify/release take the same flags) or with bump <kind> --confirmed, until the tag is cut — on GitHub release then publishes itself (push, PR, CI wait, merge in the playbook style, annotated tag) and records the release; a 'publish stopped' or 'publish waiting' result is resumed by re-running flow release; publish = manual in the playbook (or another forge) leaves those steps to the agent, and finish records the release (--no-artifact-check / --no-release-create skip a proof on the operator's word) — release --no-version ships merge + changelog only (no bump, tag or forge release); --no-fold-check skips the changelog fold line proofs on the operator's word; --no-marker-check lets a branch add conflict-marker-shaped lines on purpose — finish runs the closing reflection worker first (before removing anything) and stops for the operator's fold/drop; the re-run with --confirmed cleans up; --no-reflect --confirmed skips it on the operator's explicit word (yolo never does), --note= hands the worker the operator's friction notes — release names a session running an older dev-flow build than the disk ships and asks update (/reload) or proceed — recorded, never a block — reflect <note> queues a project suggestion in reflections.md (--playbook = docs-flow fix, --code = patch-flow fix); --plugin never writes — dev-flow feedback goes upstream and it prints the GitHub issue recipe; bare reflect prints the session-reflection protocol (bound: run flow_stage op reflect); list prints open items by id (r<n>: never renumbered), plan groups them into flows with the start command, move <id> re-files one, done <id> checks a fixed one off, reopen <id> brings back one closed by mistake (from the archive too), --same <id> counts a recurrence on its row, defer <id> <why> leaves a row linked to the bound flow open, tidy moves closed ones to reflections-archive.md — start --reflections=<ids> links rows to the flow and finish closes them as fixed by it — roadmap manages .dev-flow/roadmap.md: pick <n> <slug> (or add --slug=) stamps an item for flow start, which seeds the new plan from its brief; finish checks it off; drop <n> removes an item nobody wants any more (done would record it as shipped); <n> is the row number list prints — done leaves the others in place, drop and tidy renumber — a new feature asked for mid-flow is parked there, never as a hand-made .dev-flow/<slug>/; start <slug> --confirmed adopts such a ghost dir — review records the review flow verify requires before it asks Verified? (and flow release before it ships): done <verdict> after the playbook's review step ran inline (a flow_stage review worker records itself); --skip (--confirmed, the operator's Skip review? answer) ships without one; bare review shows what is on record — doctor reviews structure, git consistency and open reflections (never writes); doctor <note> prints an investigation brief — abort unbinds and keeps the worktree; abort --purge (--confirmed, the operator's Purge? answer) removes the worktree, branch and feature folder of a dropped feature, never anything on origin — version prints the build the disk ships and any other dev-flow copies in this process (--check-upstream asks the registry)";
|
|
240
240
|
export const featDir = (root: string, slug: string) => path.join(dfDir(root), slug);
|
|
241
241
|
export const stateFile = (root: string, slug: string) => path.join(featDir(root, slug), "state.json");
|
|
242
242
|
export const claimFile = (root: string, slug: string) => path.join(featDir(root, slug), "claim.json");
|
|
@@ -528,6 +528,24 @@ export async function refreshDocsCode(root: string, state: FlowState, cfg: Confi
|
|
|
528
528
|
|
|
529
529
|
/** Where feature commands run: the feature worktree once it exists (that is where the
|
|
530
530
|
* code under test lives), else the main checkout. Keeps gates off the main branch. */
|
|
531
|
+
/** The version `file` under `dir` says, or null when it is missing or unparsable. */
|
|
532
|
+
export function manifestAt(dir: string, file: string): string | null {
|
|
533
|
+
const f = path.join(dir, file);
|
|
534
|
+
return existsSync(f) ? parseVersion(file, readFileSync(f, "utf8")) : null;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
/** Records the operator's release call — a kind of step, never a number. `versionFrom` (the manifest it was made
|
|
538
|
+
* over) only feeds the hint's "as things stand" number; the gates count from the newest tag. The caller writes state. */
|
|
539
|
+
export function recordReleaseCall(root: string, state: FlowState, cfg: Config, choice: string): void {
|
|
540
|
+
if (choice !== state.versionChoice || !state.versionFrom) {
|
|
541
|
+
const from = cfg.versioning.file ? manifestAt(gateCwd(root, state), cfg.versioning.file) : null;
|
|
542
|
+
if (from) state.versionFrom = from;
|
|
543
|
+
}
|
|
544
|
+
state.versionChoice = choice;
|
|
545
|
+
if (choice === "unreleased") state.noVersion = true;
|
|
546
|
+
else delete state.noVersion;
|
|
547
|
+
}
|
|
548
|
+
|
|
531
549
|
export function gateCwd(root: string, state: FlowState): string {
|
|
532
550
|
const wt = worktreeAbs(root, state);
|
|
533
551
|
return wt && existsSync(wt) ? wt : root;
|
package/src/runtime/gates.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/** dev-flow runtime — The gate runner and the gates that do not ship anything. Moved out of extensions/dev-flow.ts as is (exports added). */
|
|
2
2
|
import { copyFileSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
import { skipsChecks, approveGate, applicableItems, appendRoadmapItem, checklistHash, claimBlocks, doneItemCount, detectForge, gateHelpJson, healthProbe, parseMergeStyle, investigationBrief, pluginVersion, reflectProtocol, reflectUnfiledCount, reflectionNudges, reflectionRoutes, listFiles, needsOperator, newState, nextHint, openChecklistItems, releaseGate, roadmapDone, roadmapDrop, roadmapOpenCount, roadmapOpenRows, roadmapBriefFor, roadmapPick, roadmapTidy, statusJson, subst, sq, featureTmpDir, foreignWorktreeLinks, validSlug, verifyGate, STAGE_EMOJI, type ReflectTarget, type Config, type FlowState, parseRowIds, DF_GITIGNORE } from "../core.ts";
|
|
4
|
+
import { skipsChecks, approveGate, versionArg, playbookVersionChoice, releaseCallQuestion, describeVersionChoice, applicableItems, appendRoadmapItem, checklistHash, claimBlocks, doneItemCount, detectForge, gateHelpJson, healthProbe, parseMergeStyle, investigationBrief, pluginVersion, reflectProtocol, reflectUnfiledCount, reflectionNudges, reflectionRoutes, listFiles, needsOperator, newState, nextHint, openChecklistItems, releaseGate, roadmapDone, roadmapDrop, roadmapOpenCount, roadmapOpenRows, roadmapBriefFor, roadmapPick, roadmapTidy, statusJson, subst, sq, featureTmpDir, foreignWorktreeLinks, validSlug, verifyGate, STAGE_EMOJI, type ReflectTarget, type Config, type FlowState, parseRowIds, DF_GITIGNORE } from "../core.ts";
|
|
5
5
|
import { applyAnswers, buildDraft, doctorFindings, ghostFeatureDirs, ghostInfo, lineDiff, loadProject, mdDigest, parseAnswers, parseProjectMd } from "../projectmd.ts";
|
|
6
6
|
import { linkedTag } from "../fold.ts";
|
|
7
7
|
import { detectProject } from "../detect.ts";
|
|
8
8
|
import { AGENT_MARK } from "../present.ts";
|
|
9
|
-
import { GATE_HELP, SELF_BUILD, refreshDocsCode, type Ui, buildSkew, copyWarning, currentBranch, dfDir, featDir, featureEnv, flagValue, gateCwd, gitConsistency, initiated, loadedVersion, mergeHistoryEvidence, needState, now, originUrl, publishedVersion, readClaim, readReflections, readReflectionsText, readRoadmap, readState, roadmapFile, sh, stateFile, tail, unfinishedStates, writePlaybookMergePolicy, writeState } from "./base.ts";
|
|
9
|
+
import { GATE_HELP, SELF_BUILD, refreshDocsCode, type Ui, manifestAt, recordReleaseCall, buildSkew, copyWarning, currentBranch, dfDir, featDir, featureEnv, flagValue, gateCwd, gitConsistency, initiated, loadedVersion, mergeHistoryEvidence, needState, now, originUrl, publishedVersion, readClaim, readReflections, readReflectionsText, readRoadmap, readState, roadmapFile, sh, stateFile, tail, unfinishedStates, writePlaybookMergePolicy, writeState } from "./base.ts";
|
|
10
10
|
import { type RunResult, type Session, ago, behindNote, releaseDevSlot, pendingChecks, probeHealth, readDevPorts, runChecks, stampChecks, triedNote } from "./checks.ts";
|
|
11
11
|
import { GIT_TRACK_NOTE, isSelfRepo, renderQuestions, setupQuestions, tagPatternEvidence } from "./setup.ts";
|
|
12
12
|
import { foldRows, foldView, legacyPluginRows, pluginUpstream, reflectDeferNote, reflectDoneNote, reflectList, reflectMoveNote, reflectNote, reflectPlanNote, reflectReopenNote, reflectSameNote, reflectTidy } from "./reflect.ts";
|
|
@@ -81,6 +81,9 @@ export async function runFlow(args: string[], root: string, ui: Ui, sess: Sessio
|
|
|
81
81
|
case "approve":
|
|
82
82
|
return gateApprove(o);
|
|
83
83
|
|
|
84
|
+
case "bump":
|
|
85
|
+
return gateBump(o);
|
|
86
|
+
|
|
84
87
|
case "test":
|
|
85
88
|
return gateTest(o);
|
|
86
89
|
|
|
@@ -445,7 +448,18 @@ export async function gateApprove(o: GateCtx): Promise<RunResult> {
|
|
|
445
448
|
const errs = approveGate(state!, cfg, planFiles, existsSync(planMd) ? readFileSync(planMd, "utf8") : undefined, foreignWorktreeLinks(dfDir(root), state!.slug, mockupHtml));
|
|
446
449
|
if (errs.length) return { text: `plan gate FAILED:\n- ${errs.join("\n- ")}`, isError: true };
|
|
447
450
|
const planItems = applicableItems(cfg, state!, "plan");
|
|
451
|
+
// the release call is made here, with the plan: only the kind of step is recorded, never a number
|
|
452
|
+
const relArg = versionArg(flagValue(o.rest, "version"), flag("no-version"));
|
|
453
|
+
if ("error" in relArg) return { text: `plan gate FAILED:\n- ${relArg.error}`, isError: true };
|
|
454
|
+
const call = relArg.choice ?? state!.versionChoice ?? playbookVersionChoice(cfg);
|
|
455
|
+
const callQ = cfg.versioning.file && !call ? releaseCallQuestion(manifestAt(root, cfg.versioning.file), cfg.versioning.file, state!.docs) : null;
|
|
456
|
+
if (relArg.choice && relArg.choice !== "unreleased" && !cfg.versioning.file) return { text: "plan gate FAILED:\n- --version needs a version file to bump: the playbook sets none (versionFile under ## release)", isError: true };
|
|
448
457
|
let audit = flag("confirmed") ? " (confirmed by operator instruction)" : "";
|
|
458
|
+
// the /flow dialog is yes/no: a call it cannot carry comes on the command line, before anything is asked
|
|
459
|
+
if (!flag("confirmed") && ui.hasUI && callQ) return { text: `plan gate FAILED:\n- the release call rides on Approve? — run /flow approve ${callQ.flags}`, isError: true };
|
|
460
|
+
// an answer to Approve? without the call answers half the question: ask the call, keep nothing
|
|
461
|
+
if (flag("confirmed") && callQ)
|
|
462
|
+
return { text: needsOperator(`Approve? on this versioned project carries the release call, and none was passed — ${callQ.ask}`, "Approve?", `ask the operator the release call, then re-run flow approve --confirmed ${callQ.flags}`), isError: true };
|
|
449
463
|
const askPending = !flag("confirmed");
|
|
450
464
|
if (askPending) {
|
|
451
465
|
markPendingAsk(root, state!, "Approve?");
|
|
@@ -456,7 +470,7 @@ export async function gateApprove(o: GateCtx): Promise<RunResult> {
|
|
|
456
470
|
: state!.docs
|
|
457
471
|
? "this is proposed as a docs flow — no written plan and no build checks; your answer grants that"
|
|
458
472
|
: "the plan is waiting for your approval";
|
|
459
|
-
return { text: needsOperator(what
|
|
473
|
+
return { text: needsOperator(`${what}${callQ ? ` — ${callQ.ask}` : ""}`, "Approve?", `${state!.patch || state!.docs ? "say the mode and the one-line change when you ask; " : ""}re-run with --confirmed${callQ ? ` ${callQ.flags}` : ""} once the operator answered in chat`), isError: true };
|
|
460
474
|
}
|
|
461
475
|
const ok = await ui.confirm("Approve plan", `Approve ${state!.slug}${state!.ui ? " (UI)" : ""}${state!.patch ? " (patch)" : state!.docs ? " (docs)" : ""}? Creates the worktree.${flag("yolo") ? " YOLO: all later gate questions (Verified?/Release?/Finish?) are pre-confirmed — checks and guardrails stay in place." : ""}`);
|
|
462
476
|
if (!ok) {
|
|
@@ -495,9 +509,34 @@ export async function gateApprove(o: GateCtx): Promise<RunResult> {
|
|
|
495
509
|
state!.worktree = wtRel;
|
|
496
510
|
state!.stage = "implement";
|
|
497
511
|
state!.approvals.plan = now();
|
|
512
|
+
if (call) recordReleaseCall(root, state!, cfg, call);
|
|
498
513
|
delete state!.pendingAsk;
|
|
499
514
|
writeState(root, state!);
|
|
500
|
-
return { text: `plan approved${audit}${state!.yolo ? " — yolo: later gate questions pre-confirmed" : ""}; worktree ${wtRel} on branch ${branch}.${setupNote}\n${AGENT_MARK}next: ${nextHint(state!, cfg)}` };
|
|
515
|
+
return { text: `plan approved${audit}${state!.yolo ? " — yolo: later gate questions pre-confirmed" : ""}; worktree ${wtRel} on branch ${branch}.${call ? `\nrelease call: ${describeVersionChoice(call, state!.versionFrom)} — the number is counted from the newest tag at release; the operator can change the call on any gate call (or flow bump <kind>) until the tag` : ""}${setupNote}\n${AGENT_MARK}next: ${nextHint(state!, cfg)}` };
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
/** `flow bump <patch|minor|major|none> [slug]`: the operator changes the release call at any stage before the tag.
|
|
519
|
+
* Only the kind of step is recorded; the number is counted from the newest tag when the release runs. */
|
|
520
|
+
export async function gateBump(o: GateCtx): Promise<RunResult> {
|
|
521
|
+
const { root, cfg, flag, sess } = o;
|
|
522
|
+
const words = o.rest.filter((a) => !a.startsWith("--"));
|
|
523
|
+
const [kind, slug] = words;
|
|
524
|
+
const usage = "usage: flow bump <patch|minor|major|none> [slug] --confirmed — none merges unreleased (no bump, no tag)";
|
|
525
|
+
if (!kind) return { text: usage, isError: true };
|
|
526
|
+
const arg = kind === "none" || kind === "unreleased" ? versionArg(null, true) : versionArg(kind, false);
|
|
527
|
+
if ("error" in arg) return { text: `bump FAILED:\n- ${arg.error}\n${usage}`, isError: true };
|
|
528
|
+
const { state, err } = needState(root, sess, slug);
|
|
529
|
+
if (err) return err;
|
|
530
|
+
const choice = arg.choice!;
|
|
531
|
+
if (!cfg.versioning.file && choice !== "unreleased") return { text: "bump FAILED:\n- the playbook sets no version file (versionFile under ## release), so there is nothing to bump — set one first", isError: true };
|
|
532
|
+
if (state!.publish?.tag || state!.approvals.release) return { text: `bump FAILED:\n- ${state!.publish?.tag ?? "the release"} is already ${state!.publish?.tag ? "tagged" : "recorded"} — the call cannot change after the tag`, isError: true };
|
|
533
|
+
const was = state!.versionChoice;
|
|
534
|
+
if (was === choice) return { text: `release call unchanged: ${describeVersionChoice(choice, state!.versionFrom)}` };
|
|
535
|
+
if (!flag("confirmed")) return { text: needsOperator(`change the release call from ${was ? describeVersionChoice(was) : "none"} to ${describeVersionChoice(choice)}`, "Release call?", `this is the operator's word — on it, re-run flow bump ${kind}${slug ? ` ${slug}` : ""} --confirmed`), isError: true };
|
|
536
|
+
recordReleaseCall(root, state!, cfg, choice);
|
|
537
|
+
writeState(root, state!);
|
|
538
|
+
const prep = state!.stage === "pre-release" || state!.stage === "release" ? ` — redo the release prep to match (${choice === "unreleased" ? "revert any bump; the entry goes under Unreleased" : "the version file and its changelog heading"}); flow release names the number` : "";
|
|
539
|
+
return { text: `release call changed (confirmed by operator instruction): ${was ? describeVersionChoice(was) : "none"} → ${describeVersionChoice(choice, state!.versionFrom)}${prep}` };
|
|
501
540
|
}
|
|
502
541
|
|
|
503
542
|
export async function gateStatus(o: GateCtx): Promise<RunResult> {
|
package/src/runtime/publish.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* the forge whether it is already done, so a re-run resumes and a step done by hand is accepted. */
|
|
5
5
|
import { existsSync, readFileSync } from "node:fs";
|
|
6
6
|
import path from "node:path";
|
|
7
|
-
import { pickReleaseNotes, prepOnlyChange, sq } from "../core.ts";
|
|
7
|
+
import { newestTaggedVersion, parseVersion, pickReleaseNotes, prepOnlyChange, releaseCallProof, sq } from "../core.ts";
|
|
8
8
|
import type { Config, FlowState } from "../core.ts";
|
|
9
9
|
import { featDir, gateCwd, mergeBase, releaseTags, sh, tail, writeState } from "./base.ts";
|
|
10
10
|
|
|
@@ -18,7 +18,7 @@ export const publishWait = {
|
|
|
18
18
|
clock: () => Date.now(),
|
|
19
19
|
checks: (pr: number, cwd: string): Promise<PrCheck[] | null> => prChecks(pr, cwd),
|
|
20
20
|
/** the CI runs a commit started — the merge commit, before it is tagged (gh#271) */
|
|
21
|
-
commitChecks: (sha: string, cwd: string): Promise<PrCheck[] | null> => commitRuns(sha, cwd),
|
|
21
|
+
commitChecks: (sha: string, cwd: string, branch?: string): Promise<PrCheck[] | null> => commitRuns(sha, cwd, branch),
|
|
22
22
|
/** gh#275: a check pending this long has its Actions job asked directly — GitHub can leave a check run
|
|
23
23
|
* `in_progress` for good after its job concluded */
|
|
24
24
|
staleMs: 5 * 60_000,
|
|
@@ -39,12 +39,14 @@ async function actionsConclusion(link: string, cwd: string): Promise<string | nu
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
/** Workflow runs of one commit as checks; [] when none started, null when gh cannot say. */
|
|
42
|
-
async function commitRuns(sha: string, cwd: string): Promise<PrCheck[] | null> {
|
|
43
|
-
const r = await sh(`gh run list --commit ${sha} --limit 50 --json status,conclusion,name,url`, cwd, 60_000);
|
|
42
|
+
async function commitRuns(sha: string, cwd: string, branch?: string): Promise<PrCheck[] | null> {
|
|
43
|
+
const r = await sh(`gh run list --commit ${sha} --limit 50 --json status,conclusion,name,url,headBranch`, cwd, 60_000);
|
|
44
44
|
if (!r.ok) return null;
|
|
45
|
-
const rows = jsonArray<{ status?: string; conclusion?: string; name?: string; url?: string }>(r.out);
|
|
45
|
+
const rows = jsonArray<{ status?: string; conclusion?: string; name?: string; url?: string; headBranch?: string }>(r.out);
|
|
46
46
|
if (rows === null) return r.out.trim() ? null : [];
|
|
47
|
-
|
|
47
|
+
// the merge commit's own CI ran on the default branch: a run a tag push started on the same commit is the
|
|
48
|
+
// release's publish job, not a check on the merge — a refused tag's red run must not hold the next tag back
|
|
49
|
+
return rows.filter((x) => !branch || !x.headBranch || x.headBranch === branch).map((x) => ({ name: x.name ?? "run", bucket: checkBucket({ status: (x.status ?? "").toUpperCase(), conclusion: (x.conclusion ?? "").toUpperCase() }), link: x.url ?? "" }));
|
|
48
50
|
}
|
|
49
51
|
|
|
50
52
|
export interface PrCheck { name: string; bucket: string; link: string }
|
|
@@ -108,8 +110,8 @@ export const awaitPrChecks = (pr: number, cwd: string): Promise<CiVerdict> =>
|
|
|
108
110
|
});
|
|
109
111
|
|
|
110
112
|
/** gh#271: wait (bounded) for the CI the merge commit started — a tag publishes from it, so it is cut on green only. */
|
|
111
|
-
export const awaitCommitChecks = (sha: string, cwd: string): Promise<CiVerdict> =>
|
|
112
|
-
awaitChecks(() => publishWait.commitChecks(sha, cwd), cwd, { who: `merge commit ${sha.slice(0, 9)}`, read: `gh run list --commit ${sha}`, none: "no CI ran on the merge commit", green: "merge-commit CI green" });
|
|
113
|
+
export const awaitCommitChecks = (sha: string, cwd: string, branch?: string): Promise<CiVerdict> =>
|
|
114
|
+
awaitChecks(() => publishWait.commitChecks(sha, cwd, branch), cwd, { who: `merge commit ${sha.slice(0, 9)}`, read: `gh run list --commit ${sha}`, none: "no CI ran on the merge commit", green: "merge-commit CI green" });
|
|
113
115
|
|
|
114
116
|
async function awaitChecks(read: () => Promise<PrCheck[] | null>, cwd: string, l: { who: string; read: string; none: string; green: string; stuck?: string }): Promise<CiVerdict> {
|
|
115
117
|
const start = publishWait.clock();
|
|
@@ -203,13 +205,30 @@ async function prBody(root: string, cwd: string, cfg: Config, state: FlowState):
|
|
|
203
205
|
const authored = prBodyFile(root, state.slug);
|
|
204
206
|
if (existsSync(authored)) return readFileSync(authored, "utf8").trim();
|
|
205
207
|
const file = cfg.release.changelog ? path.join(cwd, cfg.release.changelog) : "";
|
|
206
|
-
const entry = pickReleaseNotes({ changelog: file && existsSync(file) ? readFileSync(file, "utf8") : null, version: state.releaseVersion ?? null, annotation: "" }).notes;
|
|
208
|
+
const entry = pickReleaseNotes({ changelog: file && existsSync(file) ? readFileSync(file, "utf8") : null, version: state.releaseVersion ?? (cfg.versioning.file ? await versionAt("HEAD", cfg.versioning.file, cwd) : null), annotation: "" }).notes;
|
|
207
209
|
if (entry) return entry;
|
|
208
210
|
const base = await mergeBase(cwd, cfg.defaultBranch);
|
|
209
211
|
const log = await sh(`git log -n 30 --format='- %s' ${base ? `${sq(base)}..HEAD` : "HEAD"}`, cwd);
|
|
210
212
|
return log.ok ? log.out.trim() : "";
|
|
211
213
|
}
|
|
212
214
|
|
|
215
|
+
/** The version `file` says at `ref`, or null when it is not there. */
|
|
216
|
+
async function versionAt(ref: string, file: string, cwd: string): Promise<string | null> {
|
|
217
|
+
const r = await sh(`git show ${sq(`${ref}:${file}`)} 2>/dev/null`, cwd);
|
|
218
|
+
return r.ok && r.out.trim() ? parseVersion(file, r.out) : null;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/** The release call against the version `file` says at `ref` — what the tag would be — counted from the newest
|
|
222
|
+
* tag. Null when it holds (or there is no call to prove); `version` is what `ref` carries. */
|
|
223
|
+
async function callAt(ref: string, base: string | null, state: FlowState, cfg: Config, tags: string[], cwd: string): Promise<{ version: string | null; bad: { error: string; want?: string } | null }> {
|
|
224
|
+
const file = cfg.versioning.file!;
|
|
225
|
+
const version = await versionAt(ref, file, cwd);
|
|
226
|
+
const newest = newestTaggedVersion(cfg.versioning.pattern, tags);
|
|
227
|
+
const baseVer = base ? await versionAt(base, file, cwd) : null;
|
|
228
|
+
const bad = state.versionChoice ? releaseCallProof(state.versionChoice, version, newest ? cfg.versioning.pattern.replace("{version}", newest) : null, baseVer, file) : null;
|
|
229
|
+
return { version, bad };
|
|
230
|
+
}
|
|
231
|
+
|
|
213
232
|
export type PublishResult = { ok: true; log: string } | { ok: false; text: string };
|
|
214
233
|
|
|
215
234
|
/** gh#259: the files a merge of `HEAD` into `origin/<default>` would conflict in, from a fresh fetch — [] when it
|
|
@@ -254,9 +273,17 @@ export async function publishRelease(root: string, state: FlowState, cfg: Config
|
|
|
254
273
|
else {
|
|
255
274
|
// gh#259: a conflict with the default branch is known before the push — never spend the CI wait to learn it
|
|
256
275
|
const d = cfg.defaultBranch;
|
|
257
|
-
const resolve = `merge origin/${d} into ${br} in the worktree (git merge origin/${d}), resolve the conflicts — keep both sides' changelog lines; a version file takes the bump past the newest release — and commit`;
|
|
258
276
|
const conflicts = await mergeConflicts(wt, d);
|
|
277
|
+
// the call, proven on what would merge: a flow that released since Release? moves the number, and the branch
|
|
278
|
+
// must say so before anything is pushed — never a tag that disagrees with the version file it lands on
|
|
279
|
+
const versioned = !state.noVersion && !!cfg.versioning.file;
|
|
280
|
+
const tagsNow = versioned ? await releaseTags(root) : [];
|
|
281
|
+
if (tagsNow === null) return stop("cannot list tags on origin", "check the network and git credentials");
|
|
282
|
+
const atHead = versioned ? await callAt("HEAD", await mergeBase(wt, d), state, cfg, tagsNow, wt) : null;
|
|
283
|
+
const want = atHead?.bad?.want ? ` and set ${cfg.versioning.file} to ${atHead.bad.want} (the release call, ${state.versionChoice}, counted from the newest tag)${cfg.release.changelog ? ` with its ${cfg.release.changelog} heading` : ""}` : "";
|
|
284
|
+
const resolve = `merge origin/${d} into ${br} in the worktree (git merge origin/${d}), resolve the conflicts — keep both sides' changelog lines${want || (versioned ? "; the version file stays one step of the release call past the newest tag" : "")} — and commit`;
|
|
259
285
|
if (conflicts?.length) return stop(`${br} conflicts with origin/${d} in ${conflicts.join(", ")} — the merge would be refused after the CI wait, so nothing was pushed`, resolve);
|
|
286
|
+
if (atHead?.bad) return stop(`${atHead.bad.error} — nothing was merged`, atHead.bad.want ? `set ${cfg.versioning.file} to ${atHead.bad.want}${cfg.release.changelog ? ` and its ${cfg.release.changelog} heading` : ""} on ${br} (merge origin/${d} first if it moved) and commit` : "fix the version on the branch and commit");
|
|
260
287
|
const remote = await sh(`git ls-remote origin ${sq(`refs/heads/${br}`)}`, wt, 60_000);
|
|
261
288
|
if (!remote.ok) return stop(`cannot reach origin:\n${tail(remote.out, 5)}`, "check the network and git credentials");
|
|
262
289
|
if (remote.out.split(/\s/)[0] === head) steps.push("branch already on origin");
|
|
@@ -315,25 +342,40 @@ export async function publishRelease(root: string, state: FlowState, cfg: Config
|
|
|
315
342
|
state.publish = { ...state.publish, pr: merged.number, merged: oid };
|
|
316
343
|
writeState(root, state);
|
|
317
344
|
await sh(`git fetch -q origin ${sq(cfg.defaultBranch)}`, root, 5 * 60_000);
|
|
318
|
-
if (state.
|
|
319
|
-
const tag = cfg.versioning.pattern.replace("{version}", state.releaseVersion);
|
|
345
|
+
if (!state.noVersion && cfg.versioning.file) {
|
|
320
346
|
const tags = await releaseTags(root);
|
|
321
347
|
if (tags === null) return stop("cannot list tags on origin", "check the network and git credentials");
|
|
322
|
-
|
|
323
|
-
|
|
348
|
+
// the version of record is the merged tree's own: read now, never pinned at Release? (a merge of the default
|
|
349
|
+
// branch after it may have re-bumped), and held to the release call once more before anything is tagged
|
|
350
|
+
if (!oid) return stop(`PR #${merged.number} shows no merge commit to tag`, "tag what shipped yourself (git tag -a <tag>) and push it");
|
|
351
|
+
if (!(await sh(`git cat-file -e ${sq(`${oid}^{commit}`)}`, root)).ok) return stop(`the merge commit ${oid.slice(0, 9)} of PR #${merged.number} is not in this clone after a fetch`, `git fetch origin ${cfg.defaultBranch}`);
|
|
352
|
+
const atMerge = await callAt(oid, `${oid}^1`, state, cfg, tags, root);
|
|
353
|
+
if (!atMerge.version) return stop(`${cfg.versioning.file} has no parsable version at the merge commit ${oid.slice(0, 9)} — the tag was not cut`, "fix it forward on the default branch, then tag by hand");
|
|
354
|
+
const tag = cfg.versioning.pattern.replace("{version}", atMerge.version);
|
|
355
|
+
if (tags.includes(tag)) {
|
|
356
|
+
// a resume finds its own tag on the merge commit; the same name on another commit is another flow's release
|
|
357
|
+
const at = await sh(`git ls-remote origin ${sq(`refs/tags/${tag}`)} ${sq(`refs/tags/${tag}^{}`)}`, root, 60_000);
|
|
358
|
+
const rows = at.out.split("\n").map((l) => l.split(/\s+/)).filter((r) => r.length >= 2);
|
|
359
|
+
const sha = (rows.find((r) => r[1].endsWith("^{}")) ?? rows[0])?.[0] ?? "";
|
|
360
|
+
if (at.ok && sha && sha !== oid) return stop(`merged, but the tag was not cut: ${tag} is already on origin at ${sha.slice(0, 9)}, not on the merge commit ${oid.slice(0, 9)} — another release took that number`, "tell the operator; fix the version forward in a new flow");
|
|
361
|
+
state.releaseVersion = atMerge.version;
|
|
362
|
+
steps.push(`tag ${tag} already on origin`);
|
|
363
|
+
} else {
|
|
364
|
+
if (atMerge.bad) return stop(`merged, but the tag was not cut: ${atMerge.bad.error} (at the merge commit ${oid.slice(0, 9)})`, "tell the operator — a release landed since this branch was checked; fix the version forward in a new flow, or tag by hand on their word");
|
|
365
|
+
state.releaseVersion = atMerge.version;
|
|
324
366
|
// gh#271: the tag publishes from the merge commit — wait for that commit's own CI before cutting it, so a
|
|
325
367
|
// playbook rule "test green on the merge commit before the tag" is something this gate can honour
|
|
326
368
|
if (oid && cfg.release.tagWait !== "none") {
|
|
327
|
-
const ci = await awaitCommitChecks(oid, root);
|
|
369
|
+
const ci = await awaitCommitChecks(oid, root, cfg.defaultBranch);
|
|
328
370
|
if (!("why" in ci)) steps.push(ci.note);
|
|
329
371
|
else if (ci.state === "running") return { ok: false, text: `publish waiting — ${ci.why}; the tag waits for it${steps.length ? `\ndone so far: ${steps.join(" · ")}` : ""}\n↪ next: re-run flow release to keep waiting — do not end the turn on a promise to watch` };
|
|
330
372
|
else if (ci.state === "red")
|
|
331
373
|
return stop(`${ci.why} — merged, but the tag was not cut: it would publish a red build`, `tell the operator. A flaky job: re-run it (gh run rerun --failed <run>), then re-run flow release, which tags on green. A real failure is fixed forward in a new flow, and the tag goes on the fix by the operator's word (or tagWait = none under ## release for a project whose tag publishes nothing)`);
|
|
332
374
|
else return stop(ci.why, "check gh auth status, or tag the merge commit yourself once its CI is green");
|
|
333
375
|
}
|
|
334
|
-
|
|
335
|
-
if (
|
|
336
|
-
if (!
|
|
376
|
+
const local = await sh(`git rev-parse -q --verify ${sq(`refs/tags/${tag}^{commit}`)}`, root);
|
|
377
|
+
if (local.ok && local.out.trim() !== oid) return stop(`a local tag ${tag} points at ${local.out.trim().slice(0, 9)}, not the merge commit ${oid.slice(0, 9)}`, `git tag -d ${tag} if it is a leftover`);
|
|
378
|
+
if (!local.ok) {
|
|
337
379
|
// the merge commit by sha, not origin/<default>: a parallel flow that landed after it stays out of the tag
|
|
338
380
|
const mk = await sh(`git tag -a ${sq(tag)} -m ${sq(tag)} ${sq(oid)}`, root);
|
|
339
381
|
if (!mk.ok) return stop(`creating tag ${tag} failed:\n${tail(mk.out, 5)}`, "fix what git reports");
|
package/src/runtime/ship.ts
CHANGED
|
@@ -1,26 +1,20 @@
|
|
|
1
1
|
/** dev-flow runtime — The gates that ship: verify, release, release-done, finish. Moved out of extensions/dev-flow.ts as is (exports added). */
|
|
2
2
|
import { existsSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
import { skipsChecks, applicableItems, changelogVersionsBetween, normalizeReleaseBody, pendingEntryLines, pickReleaseNotes, checklistHash, checklistPending, cmpVersions, freshenChecks, healthProbe, mergeShapeProof, preReleaseGate, reflectionNudges, conflictMarkerLines, isReleaseOnly, looksLikeShellError, needsOperator, newestTaggedVersion, nextHint, releaseGate, parseVersion, roadmapDoneForSlug, sq, tagNotesCommand, verifyGate, versionTagGate, servedBuildMatches, prepFiles, versionArg, playbookVersionChoice, describeVersionChoice, majorBump,
|
|
4
|
+
import { skipsChecks, applicableItems, changelogVersionsBetween, normalizeReleaseBody, pendingEntryLines, pickReleaseNotes, checklistHash, checklistPending, cmpVersions, freshenChecks, healthProbe, mergeShapeProof, preReleaseGate, reflectionNudges, conflictMarkerLines, isReleaseOnly, looksLikeShellError, needsOperator, newestTaggedVersion, nextHint, releaseGate, parseVersion, roadmapDoneForSlug, sq, tagNotesCommand, verifyGate, versionTagGate, servedBuildMatches, prepFiles, versionArg, playbookVersionChoice, describeVersionChoice, majorBump, releaseCallQuestion, releaseCallProof, cmpRelease, versionCore, resolvedDevEnv, reviewOwed, localDefaultAhead, failTail, operatorDirt } from "../core.ts";
|
|
5
5
|
import type { Config, FlowState } from "../core.ts";
|
|
6
6
|
import { AGENT_MARK } from "../present.ts";
|
|
7
|
-
import { refreshDocsCode, buildSkew, copyWarning, currentBranch, featDir, flagValue, forgeMergeStyle, forgeOf, gateCwd, mergeBase, needState, now, originUrl, readReflectionsText, readRoadmap, readState, releaseTags, roadmapFile, sh, tail, worktreeAbs, writeState } from "./base.ts";
|
|
7
|
+
import { manifestAt, recordReleaseCall, refreshDocsCode, buildSkew, copyWarning, currentBranch, featDir, flagValue, forgeMergeStyle, forgeOf, gateCwd, mergeBase, needState, now, originUrl, readReflectionsText, readRoadmap, readState, releaseTags, roadmapFile, sh, tail, worktreeAbs, writeState } from "./base.ts";
|
|
8
8
|
import { type RunResult, ago, releaseDevSlot, keepThroughPrep, branchState, catchUp, describeBranchState, devEnv, devPortOf, devSlotCheck, healthRerunsAfterDeploy, pendingChecks, probeHealth, readDevPorts, runChecks, slotKey, triedNote, unreleasedOnMain, worktreeFingerprint, writeDevPorts } from "./checks.ts";
|
|
9
9
|
import { type GateCtx, markPendingAsk } from "./gates.ts";
|
|
10
10
|
import { closeLinkedReflections } from "./reflect.ts";
|
|
11
11
|
import { gatePublishes, prBodyOwed, publishRelease } from "./publish.ts";
|
|
12
12
|
|
|
13
|
-
/**
|
|
14
|
-
*
|
|
13
|
+
/** The release call, asked with Verified? only for a flow approved before Approve? carried it — null when the
|
|
14
|
+
* playbook decides, the flow has no manifest to version, or the call is on record (the usual case). */
|
|
15
15
|
function versionQuestion(root: string, state: FlowState, cfg: Config): { ask: string; flags: string } | null {
|
|
16
16
|
if (!cfg.versioning.file || playbookVersionChoice(cfg) || state.versionChoice) return null;
|
|
17
|
-
|
|
18
|
-
const now = existsSync(file) ? parseVersion(cfg.versioning.file, readFileSync(file, "utf8")) : null;
|
|
19
|
-
const kinds = (["patch", "minor", "major"] as const).map((k) => `${k}${bumpVersion(now, k) ? ` (→ ${bumpVersion(now, k)})` : ""}`).join(", ");
|
|
20
|
-
return {
|
|
21
|
-
ask: `also ask the release call: a ${kinds} release — propose one by the playbook's versioning rule${now ? ` (${cfg.versioning.file} is at ${now})` : ""} — or merge unreleased (no bump, no tag)${state.docs ? "; a docs flow usually merges unreleased" : ""}`,
|
|
22
|
-
flags: "--version=patch|minor|major (or the exact version they named) or --no-version (merge unreleased)",
|
|
23
|
-
};
|
|
17
|
+
return releaseCallQuestion(manifestAt(gateCwd(root, state), cfg.versioning.file), cfg.versioning.file, state.docs);
|
|
24
18
|
}
|
|
25
19
|
|
|
26
20
|
export async function gateVerify(o: GateCtx): Promise<RunResult> {
|
|
@@ -28,7 +22,7 @@ export async function gateVerify(o: GateCtx): Promise<RunResult> {
|
|
|
28
22
|
const { state, err } = needState(root, sess, slugArg);
|
|
29
23
|
if (err) return err;
|
|
30
24
|
const items = applicableItems(cfg, state!, "implement");
|
|
31
|
-
//
|
|
25
|
+
// the release call is made at Approve?; a --version/--no-version on the Verified? answer changes it (or makes it, for an older flow)
|
|
32
26
|
const verArg = versionArg(flagValue(o.rest, "version"), flag("no-version"));
|
|
33
27
|
if ("error" in verArg) return { text: `verify gate FAILED:\n- ${verArg.error}`, isError: true };
|
|
34
28
|
// the operator reviews the tree that ships: catch up with the default branch before anything runs
|
|
@@ -194,19 +188,11 @@ export async function gateVerify(o: GateCtx): Promise<RunResult> {
|
|
|
194
188
|
const vHead = await sh("git rev-parse HEAD", gateCwd(root, state!));
|
|
195
189
|
if (vHead.ok && vHead.out.trim()) state!.verifiedHead = vHead.out.trim();
|
|
196
190
|
else delete state!.verifiedHead;
|
|
197
|
-
//
|
|
191
|
+
// the call made at Approve? stands; a --version/--no-version on this confirmed call is the operator changing it
|
|
192
|
+
const was = state!.versionChoice;
|
|
198
193
|
const choice = verArg.choice ?? state!.versionChoice ?? playbookVersionChoice(cfg);
|
|
199
|
-
if (choice)
|
|
200
|
-
|
|
201
|
-
const mf = cfg.versioning.file ? path.join(gateCwd(root, state!), cfg.versioning.file) : "";
|
|
202
|
-
const from = mf && existsSync(mf) ? parseVersion(cfg.versioning.file!, readFileSync(mf, "utf8")) : null;
|
|
203
|
-
if (from) state!.versionFrom = from;
|
|
204
|
-
}
|
|
205
|
-
state!.versionChoice = choice;
|
|
206
|
-
if (choice === "unreleased") state!.noVersion = true;
|
|
207
|
-
else delete state!.noVersion;
|
|
208
|
-
}
|
|
209
|
-
const choiceNote = choice ? `\nrelease call: ${describeVersionChoice(choice, state!.versionFrom)}` : "";
|
|
194
|
+
if (choice) recordReleaseCall(root, state!, cfg, choice);
|
|
195
|
+
const choiceNote = choice ? `\nrelease call: ${describeVersionChoice(choice, state!.versionFrom)}${was && was !== choice ? ` (changed from ${describeVersionChoice(was)})` : ""}` : "";
|
|
210
196
|
const before = state!.stage;
|
|
211
197
|
state!.stage = "pre-release";
|
|
212
198
|
// gh#254: what the operator says after this point is said over a tree they verified — the release gate reads it
|
|
@@ -236,17 +222,28 @@ export async function gateRelease(o: GateCtx): Promise<RunResult> {
|
|
|
236
222
|
if (err) return err;
|
|
237
223
|
// Release? was answered on an earlier call: this one resumes publishing where it stopped (CI still running,
|
|
238
224
|
// a red check fixed, a PR merged by hand) — nothing is asked again
|
|
225
|
+
// --version=<kind> / --no-version change the call made at Approve? (the operator changed their mind) — on any
|
|
226
|
+
// call before the tag, a resumed publish included
|
|
227
|
+
const relArg = versionArg(flagValue(o.rest, "version"), flag("no-version"));
|
|
228
|
+
if ("error" in relArg) return { text: `release gate FAILED:\n- ${relArg.error}`, isError: true };
|
|
239
229
|
if (state!.stage === "release" && state!.approvals["pre-release"]) {
|
|
240
230
|
if (state!.approvals.release) return { text: `release already recorded.\n${AGENT_MARK}next: ${nextHint(state!, cfg)}` };
|
|
231
|
+
let callNote = "";
|
|
232
|
+
if (relArg.choice && relArg.choice !== state!.versionChoice) {
|
|
233
|
+
if (state!.publish?.tag) return { text: `release gate FAILED:\n- ${state!.publish.tag} is already tagged — the release call cannot change after the tag`, isError: true };
|
|
234
|
+
if (!flag("confirmed")) return { text: needsOperator(`change the release call from ${state!.versionChoice ? describeVersionChoice(state!.versionChoice) : "none"} to ${describeVersionChoice(relArg.choice)}`, "Release call?", `this is the operator's word — on it, re-run flow release --confirmed ${relArg.choice === "unreleased" ? "--no-version" : `--version=${relArg.choice}`}`), isError: true };
|
|
235
|
+
if ((relArg.choice === "unreleased") !== !!state!.noVersion && state!.publish?.merged)
|
|
236
|
+
return { text: `release gate FAILED:\n- PR #${state!.publish.pr} already merged ${state!.noVersion ? "unversioned" : "with a version bump"} — switching between versioned and unreleased after the merge is a new flow's work`, isError: true };
|
|
237
|
+
recordReleaseCall(root, state!, cfg, relArg.choice);
|
|
238
|
+
writeState(root, state!);
|
|
239
|
+
callNote = `release call changed (confirmed by operator instruction): ${describeVersionChoice(relArg.choice)}`;
|
|
240
|
+
}
|
|
241
241
|
if (await gatePublishes(cfg, forgeOf(cfg, await originUrl(root)), root)) {
|
|
242
242
|
if (!state!.publish) state!.publish = {};
|
|
243
|
-
return publishAndRecord(o, state!,
|
|
243
|
+
return publishAndRecord(o, state!, callNote);
|
|
244
244
|
}
|
|
245
|
+
if (callNote) return { text: `${callNote}\n${AGENT_MARK}next: ${nextHint(state!, cfg)}` };
|
|
245
246
|
}
|
|
246
|
-
// operator's word at Release?: this flow ships without a version bump or tag — recorded only once Release? is answered.
|
|
247
|
-
// gh#198: --version=<v> / --no-version here re-make the call recorded with Verified? (the operator changed their mind)
|
|
248
|
-
const relArg = versionArg(flagValue(o.rest, "version"), flag("no-version"));
|
|
249
|
-
if ("error" in relArg) return { text: `release gate FAILED:\n- ${relArg.error}`, isError: true };
|
|
250
247
|
const choice = relArg.choice ?? state!.versionChoice ?? playbookVersionChoice(cfg);
|
|
251
248
|
const noVersion = choice === "unreleased" || (!relArg.choice && !!state!.noVersion);
|
|
252
249
|
// (versioned) items stand down on an unversioned flow — the set confirmed here is the one that applies to it
|
|
@@ -326,32 +323,18 @@ export async function gateRelease(o: GateCtx): Promise<RunResult> {
|
|
|
326
323
|
const staleNow = new Set(freshenChecks(state!, fpRelease));
|
|
327
324
|
if (staleNow.size || keptThroughPrep.length) writeState(root, state!);
|
|
328
325
|
const owedWhy = (n: string) => (staleNow.has(n) ? "the tree changed since it passed" : failedBefore.has(n) ? "its last run failed" : "no run on record");
|
|
329
|
-
//
|
|
330
|
-
//
|
|
331
|
-
//
|
|
332
|
-
const tagOf = (v: string) => cfg.versioning.pattern.replace("{version}", v);
|
|
326
|
+
// the branch must carry the call the operator made — the kind of step, counted from the newest tag now, so a
|
|
327
|
+
// flow that released first moves this one along. It runs before the generic proofs: when a parallel flow
|
|
328
|
+
// released first, "already tagged" alone would send the agent round a loop.
|
|
333
329
|
const newest = cfg.versioning.file && !noVersion ? newestTaggedVersion(cfg.versioning.pattern, remoteTags) : null;
|
|
334
|
-
if (cfg.versioning.file && choice
|
|
335
|
-
const re = "ask the operator, then re-run with --version=<their call> or --no-version and --confirmed on their answer";
|
|
330
|
+
if (cfg.versioning.file && choice) {
|
|
336
331
|
let baseVer: string | null = null;
|
|
337
332
|
if (markerBase) {
|
|
338
333
|
const was = await sh(`git show ${sq(`${markerBase}:${cfg.versioning.file}`)} 2>/dev/null`, wtCwd);
|
|
339
334
|
baseVer = was.ok && was.out.trim() ? parseVersion(cfg.versioning.file, was.out) : null;
|
|
340
335
|
}
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
const from = newest ?? baseVer ?? state!.versionFrom ?? null;
|
|
344
|
-
const want = bumpVersion(from, choice);
|
|
345
|
-
const moved = from && state!.versionFrom && from !== state!.versionFrom ? ` — ${tagOf(from)} was released since Verified? (the call was counted from ${state!.versionFrom} then)` : "";
|
|
346
|
-
if (want && manifestVer !== want)
|
|
347
|
-
return { text: `release gate FAILED:\n- the operator's call is a ${choice} release: bump ${cfg.versioning.file} to ${want} (${choice} past ${from})${moved}, and head its changelog entry ${want} — it says ${manifestVer ?? "no version"}`, isError: true };
|
|
348
|
-
} else if (choice !== "unreleased") {
|
|
349
|
-
if (remoteTags.includes(tagOf(choice)))
|
|
350
|
-
return { text: `release gate FAILED:\n- ${choice}, the operator's call at Verified?, is taken: ${tagOf(choice)} was released since (another flow got there first) — ${re}; propose the same kind of step past ${newest ?? choice}, never pick the number yourself`, isError: true };
|
|
351
|
-
if (manifestVer && manifestVer !== choice)
|
|
352
|
-
return { text: `release gate FAILED:\n- the operator's release call is ${choice}, but ${cfg.versioning.file} says ${manifestVer} — bump it to ${choice}, or, if the call changed, ${re}`, isError: true };
|
|
353
|
-
} else if (manifestVer && baseVer && baseVer !== manifestVer)
|
|
354
|
-
return { text: `release gate FAILED:\n- the operator's call is to merge unreleased, but the branch bumps ${cfg.versioning.file} ${baseVer} → ${manifestVer} — revert the bump (the entry goes under Unreleased), or, if the call changed, ${re}`, isError: true };
|
|
336
|
+
const bad = releaseCallProof(choice, manifestVer, newest ? cfg.versioning.pattern.replace("{version}", newest) : null, baseVer, cfg.versioning.file);
|
|
337
|
+
if (bad) return { text: `release gate FAILED:\n- ${bad.error}${bad.want && cfg.release.changelog ? `, and head its ${cfg.release.changelog} entry with that version` : ""}`, isError: true };
|
|
355
338
|
}
|
|
356
339
|
// tier-2 pre-release confirmation is recorded by this very command, so it is excluded here
|
|
357
340
|
// The checks this gate needs green are run by the gate, as verify does (#84) — after the cheap proofs, so a
|
|
@@ -471,7 +454,7 @@ export async function gateRelease(o: GateCtx): Promise<RunResult> {
|
|
|
471
454
|
: cfg.versioning.file && !choice
|
|
472
455
|
? "no release call on record — ask it with Release?: patch, minor, major, or merge unreleased"
|
|
473
456
|
: relArg.choice && relArg.choice !== state!.versionChoice
|
|
474
|
-
? `the release call
|
|
457
|
+
? `the release call changes (${state!.versionChoice ?? "none"} → ${relArg.choice}) — changing it is the operator's word`
|
|
475
458
|
: postVerify
|
|
476
459
|
? "commits beyond release prep landed after Verified?"
|
|
477
460
|
: stale
|
|
@@ -482,13 +465,13 @@ export async function gateRelease(o: GateCtx): Promise<RunResult> {
|
|
|
482
465
|
? `${newest} → ${manifestVer} is a major bump — the playbook's versioned call does not choose that`
|
|
483
466
|
: "";
|
|
484
467
|
const auto = onChange && !askWhy;
|
|
485
|
-
let audit = confirmed ? " (confirmed by operator instruction)" : auto ? ` (auto-answered: release.ask = on-change — ${describeVersionChoice(choice ?? "next", state!.versionFrom)}
|
|
468
|
+
let audit = confirmed ? " (confirmed by operator instruction)" : auto ? ` (auto-answered: release.ask = on-change — ${describeVersionChoice(choice ?? "next", state!.versionFrom)} is the call on record, and only release prep landed since Verified?)` : state!.yolo ? " (yolo: pre-confirmed)" : "";
|
|
486
469
|
const askPending = !auto && !confirmed && (!state!.yolo || !!yoloHeld);
|
|
487
470
|
if (askPending) {
|
|
488
471
|
markPendingAsk(root, state!, "Release?");
|
|
489
472
|
if (!ui.hasUI) {
|
|
490
473
|
const callAsk = cfg.versioning.file && !choice ? " — also ask the release call: a patch, minor or major release, or merge unreleased (no bump, no tag)?" : "";
|
|
491
|
-
return { text: needsOperator(`ready to publish${yoloHeld ? ` (${yoloHeld})` : ""}${askWhy ? ` (asked: ${askWhy})` : ""}${stale ? ` — also: ${staleAsk}` : ""}${postVerify ? ` — ${postVerify}` : ""}${callAsk}`, "Release?", `re-run with --confirmed once the operator answered 'Release?' in chat${stale ? " (and the stale-build question)" : ""}${callAsk ? " (add --version=patch|minor|major
|
|
474
|
+
return { text: needsOperator(`ready to publish${yoloHeld ? ` (${yoloHeld})` : ""}${askWhy ? ` (asked: ${askWhy})` : ""}${stale ? ` — also: ${staleAsk}` : ""}${postVerify ? ` — ${postVerify}` : ""}${callAsk}`, "Release?", `re-run with --confirmed once the operator answered 'Release?' in chat${stale ? " (and the stale-build question)" : ""}${callAsk ? " (add --version=patch|minor|major or --no-version for their release call)" : ""}`), isError: true };
|
|
492
475
|
}
|
|
493
476
|
const ok = await ui.confirm("Enter release", `Release ${state!.slug}${manifestVer ? ` v${manifestVer}` : ""}${noVersion ? " (unversioned — merge + changelog entry only: no bump, no tag for this flow)" : ""}? Publishing starts: PR, merge${noVersion ? "" : ", tag"} — release-done afterwards needs no further answer.${staleAsk ? `\n\n${staleAsk}` : ""}${postVerify ? `\n\n${postVerify}` : ""}${yoloHeld ? `\n\n(${yoloHeld})` : ""}`);
|
|
494
477
|
if (!ok) {
|
|
@@ -498,9 +481,9 @@ export async function gateRelease(o: GateCtx): Promise<RunResult> {
|
|
|
498
481
|
}
|
|
499
482
|
audit = " (confirmed in dialog)";
|
|
500
483
|
}
|
|
484
|
+
if (choice) recordReleaseCall(root, state!, cfg, choice);
|
|
501
485
|
if (noVersion) state!.noVersion = true;
|
|
502
486
|
else delete state!.noVersion;
|
|
503
|
-
if (choice) state!.versionChoice = choice;
|
|
504
487
|
if (unverifiedChange) state!.friction = (state!.friction ?? 0) + 1;
|
|
505
488
|
state!.confirmations = { ...state!.confirmations, "pre-release": { hash: checklistHash(items), at: now() } };
|
|
506
489
|
state!.approvals["pre-release"] = now();
|
|
@@ -513,9 +496,9 @@ export async function gateRelease(o: GateCtx): Promise<RunResult> {
|
|
|
513
496
|
: changelogBase.source === "none"
|
|
514
497
|
? " Warning: no tag or merge base to compare against, so the changelog fold was not proven — check the entry by hand."
|
|
515
498
|
: "";
|
|
516
|
-
// the version of record is
|
|
517
|
-
// re-
|
|
518
|
-
|
|
499
|
+
// no number is pinned here: the version of record is read when the tag is cut, from the tree that merged
|
|
500
|
+
// (a merge of the default branch after this point may re-bump it), and checked against the call again
|
|
501
|
+
delete state!.releaseVersion;
|
|
519
502
|
if (stale) state!.staleBuild = `${behind} (${selfBuild.label} ${selfBuild.version ?? "?"})`;
|
|
520
503
|
delete state!.pendingAsk;
|
|
521
504
|
// on GitHub the gate runs the release stage itself: the Release? answer (or its self-answer) is what authorizes
|
|
@@ -594,9 +577,13 @@ export async function gateReleaseDone(o: GateCtx): Promise<RunResult> {
|
|
|
594
577
|
const { state, err } = needState(root, sess, slugArg);
|
|
595
578
|
if (err) return err;
|
|
596
579
|
const errs = releaseGate(state!);
|
|
597
|
-
// the version of record is what
|
|
598
|
-
|
|
599
|
-
|
|
580
|
+
// the version of record is what shipped (#52) — never a re-read of a main checkout that may be behind: what the
|
|
581
|
+
// gate tagged, else the merge commit's own version file, else the feature branch's head (a hand-run publish)
|
|
582
|
+
const shippedAt = state!.publish?.merged || (state!.branch && (await sh(`git rev-parse -q --verify ${sq(`refs/heads/${state!.branch}`)}`, root)).ok ? state!.branch : "");
|
|
583
|
+
const shipped = !state!.releaseVersion && cfg.versioning.file && !state!.noVersion && shippedAt ? await sh(`git show ${sq(`${shippedAt}:${cfg.versioning.file}`)} 2>/dev/null`, root) : null;
|
|
584
|
+
const manifestVer: string | null = state!.releaseVersion ?? (shipped?.ok && shipped.out.trim() ? parseVersion(cfg.versioning.file!, shipped.out) : null);
|
|
585
|
+
if (manifestVer && !state!.noVersion) state!.releaseVersion = manifestVer;
|
|
586
|
+
if (cfg.versioning.file && !state!.noVersion && !manifestVer) errs.push(`no version to record: ${cfg.versioning.file} has none at ${shippedAt || "the feature branch"} — fix the playbook, or ship this flow unversioned`);
|
|
600
587
|
const expectedTag = manifestVer ? cfg.versioning.pattern.replace("{version}", manifestVer) : null;
|
|
601
588
|
const origin = await originUrl(root);
|
|
602
589
|
const hasOrigin = origin !== null;
|
|
@@ -615,7 +602,7 @@ export async function gateReleaseDone(o: GateCtx): Promise<RunResult> {
|
|
|
615
602
|
// never publish behind what the forge already has — that is how a stale manifest republished
|
|
616
603
|
// the previous version and its artifact probe passed (#52)
|
|
617
604
|
const newest = newestTaggedVersion(cfg.versioning.pattern, tags);
|
|
618
|
-
if (newest &&
|
|
605
|
+
if (newest && cmpRelease(newest, manifestVer) > 0) errs.push(`${cfg.versioning.pattern.replace("{version}", newest)} is already tagged — refusing to release ${expectedTag} behind it`);
|
|
619
606
|
if (!verrs.length) {
|
|
620
607
|
const reach = await sh(`git merge-base --is-ancestor ${sq(expectedTag)} origin/${cfg.defaultBranch} 2>/dev/null || git merge-base --is-ancestor ${sq(expectedTag)} ${cfg.defaultBranch}`, root);
|
|
621
608
|
if (!reach.ok) errs.push(`tag ${expectedTag} is not reachable from ${cfg.defaultBranch} — tag what actually shipped on ${cfg.defaultBranch}`);
|