@nodii/dev 0.6.77 → 0.6.79
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/dist/cli.js +35 -3
- package/dist/closeout.js +238 -0
- package/dist/core.js +2 -2
- package/dist/devops-openapi.json +1 -1
- package/dist/figma-scope.js +71 -2
- package/dist/figma.js +32 -0
- package/dist/flags.js +8 -3
- package/dist/governor.js +15 -6
- package/dist/lanes.js +172 -10
- package/dist/review.js +20 -13
- package/dist/safety.js +28 -1
- package/dist/surface.js +34 -5
- package/dist/watchdog.js +15 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -34,6 +34,8 @@ import { governorCommand, laneClose } from "./governor.js";
|
|
|
34
34
|
import { freezeCommand } from "./freeze.js";
|
|
35
35
|
import {
|
|
36
36
|
figmaChangeSetShow,
|
|
37
|
+
figmaChangeSetList,
|
|
38
|
+
figmaChangeSetListText,
|
|
37
39
|
figmaChangeSetText,
|
|
38
40
|
figmaFileKey,
|
|
39
41
|
figmaFilePublished,
|
|
@@ -96,6 +98,7 @@ import {
|
|
|
96
98
|
deltaGatherFlags,
|
|
97
99
|
laneCommand,
|
|
98
100
|
laneCapCommand,
|
|
101
|
+
laneRepoCommand,
|
|
99
102
|
machineCommand,
|
|
100
103
|
nextCommand,
|
|
101
104
|
peopleCommand,
|
|
@@ -203,6 +206,9 @@ Usage: nodii-dev <command> [options] [--json]
|
|
|
203
206
|
# holder re-submits every rejected item: applying -> in_review, round + 1;
|
|
204
207
|
# each item needs context, each variant name and context; writeUp optional
|
|
205
208
|
figma changeset show CHANGE_SET # write-up, items, context, variants, round, decision and comment (with the previous round's)
|
|
209
|
+
figma changeset list [--file KEY] [--actionable] [--all]
|
|
210
|
+
# change sets in dependency order (hub-260): each file's sets are actioned
|
|
211
|
+
# in order; NEXT marks the ones an operator can act on now
|
|
206
212
|
figma file add FILE_KEY --name TEXT --kind design-system|surfaces|prototype [--module M]
|
|
207
213
|
# register a Figma file in Dev so it can be locked
|
|
208
214
|
hook claude-figma-pre|claude-figma-post|safety-pre|safety-post|nudge-pre|nudge-stop|surface-gen-pre|session-start|session-kind|managed-dispatch|claude-managed-dispatch|print-settings
|
|
@@ -320,6 +326,10 @@ Usage: nodii-dev <command> [options] [--json]
|
|
|
320
326
|
lane heartbeat <key> --note "BLOCKED: ..."|"WAITING: ..."
|
|
321
327
|
# a note starting BLOCKED or WAITING: (capitals) marks the lane blocked:
|
|
322
328
|
# an exit then ends its run blocked and never counts as a death
|
|
329
|
+
lane heartbeat <key> --waiting-on LANE|owner/repo#n|Q-nnn|DEC-nnnn|release:PKG|launch-day [...]
|
|
330
|
+
# repeatable; replaces the lane's waits (a WAITING note's lane keys and
|
|
331
|
+
# repo#n count too; a note that is no wait clears them). A wait on another
|
|
332
|
+
# lane raises its priority by one and notifies the machine coordinator
|
|
323
333
|
lane resume <key> --override --reason TEXT
|
|
324
334
|
# coordinator: resume past the two-identical-deaths stop; Dev refuses
|
|
325
335
|
# it (RESUME_OVERRIDE_NEEDS_CHANGE) unless the lane was amended since
|
|
@@ -358,7 +368,21 @@ Usage: nodii-dev <command> [options] [--json]
|
|
|
358
368
|
lane freeze drop <key> --section SECTION --item ID --reason TEXT
|
|
359
369
|
lane freeze swap <key> --section SECTION [--item ID] --file VALUE.json --reason TEXT
|
|
360
370
|
lane freeze show|history <key> # durable compact-safe contract and all versions
|
|
361
|
-
lane
|
|
371
|
+
lane stop <key> --reason TEXT [--sweeper LANE] [--no-closeout]
|
|
372
|
+
# hub-244: Dev ends the lane and releases its holds in one step
|
|
373
|
+
# (issue claims; editing and all-rejected change sets with their scopes;
|
|
374
|
+
# sets holding operator decisions move to --sweeper or are listed on the
|
|
375
|
+
# issue and to the coordinator). Then, on this machine, each repository's
|
|
376
|
+
# unlanded commits are pushed, a PR is opened or reused and CLOSED with the
|
|
377
|
+
# Stopped label, the lane's test stacks go down and the worktree is removed
|
|
378
|
+
# (only after the push, clean, and with no process in it). Recorded on the issue
|
|
379
|
+
lane closeout <key> --reason TEXT # re-run that machine half for an ended lane (a worktree kept earlier)
|
|
380
|
+
lane repo add <key> --repo NAME --branch BRANCH --worktree PATH [--read-only] --reason TEXT
|
|
381
|
+
# coordinator or staff: add a repository to a running lane (or change its
|
|
382
|
+
# branch, worktree or read-only mark). Dev changes the lane's repositories
|
|
383
|
+
# and its Freeze boundaries together; this also repairs a lane where they
|
|
384
|
+
# diverged (GATHER_SHORTLIST_MISMATCH). REPO_NOT_GRANTED without a grant
|
|
385
|
+
lane close <key> [--delivered-by <PR URL|lane key|issue key>] --reason TEXT [--sweeper LANE] [--no-closeout]
|
|
362
386
|
# hub-232. The machine's coordinator closes a lane that marked itself
|
|
363
387
|
# finished with a reason and evidence (MW1-28.2); LANE_NOT_FINISHED
|
|
364
388
|
# otherwise. --delivered-by adds proof on dev (a merged PR verified on
|
|
@@ -379,7 +403,10 @@ Usage: nodii-dev <command> [options] [--json]
|
|
|
379
403
|
lane non-issue <key> --reason TEXT --evidence TEXT --reroute KEY[,KEY]|none
|
|
380
404
|
--branch carried:KEY|dropped[:REASON] [--commits SHA[,SHA]]
|
|
381
405
|
# DEC-0011: terminal non_issue; issue -> wont_do; slot frees
|
|
382
|
-
lane list [--kind KIND] [--status STATUS] [--mine] [--cursor CURSOR]
|
|
406
|
+
lane list [--kind KIND] [--status STATUS] [--mine] [--sort created|priority] [--cursor CURSOR]
|
|
407
|
+
# --sort priority: live lanes by effective priority (own + lanes waiting)
|
|
408
|
+
lane waits [--machine ID] # the wait graph: lanes others wait on, chains through stuck or orphaned
|
|
409
|
+
# lanes, and lanes held per operator question, decision and launch day
|
|
383
410
|
lane show <key> | next <key> [--paths A,B] [--components K,L] [--role R]
|
|
384
411
|
# next step, plus the rules Dev serves for it (DEC-0020)
|
|
385
412
|
lane gather [key] [--delta] [--paths A,B] [--components K,L]
|
|
@@ -872,6 +899,7 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
872
899
|
if (command === "coordinator") return emitCommand(await coordinatorCommand(action, f, { installWatchdog }));
|
|
873
900
|
if (command === "steward") return emitCommand(await stewardCommand(action, rest, f));
|
|
874
901
|
if (command === "lane" && action === "launch") return emitCommand(await launchLaneCommand(rest[0], f));
|
|
902
|
+
if (command === "lane" && action === "repo") return emitCommand(await laneRepoCommand(rest[0], rest.slice(1), f));
|
|
875
903
|
if (command === "lane" && action === "cap") return emitCommand(await laneCapCommand(rest, f));
|
|
876
904
|
if (command === "lane" && action === "close") {
|
|
877
905
|
const result = await laneClose(rest[0], f);
|
|
@@ -1299,7 +1327,11 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
1299
1327
|
return emit(await figmaResubmit(rest[0], rest[1], { sync: submitMode(f) }), json, (p) =>
|
|
1300
1328
|
[`Re-submitted ${rest[0]}; it is ${p.data.state}.`, figmaChangeSetText(p.data), ...conformanceLines({ warnings: p.warnings })].join("\n"));
|
|
1301
1329
|
if (action === "changeset") {
|
|
1302
|
-
if (rest[0]
|
|
1330
|
+
if (rest[0] === "list") {
|
|
1331
|
+
if (rest.length > 1) throw new CliError("USAGE", "figma changeset list [--file KEY] [--actionable] [--all]", 2);
|
|
1332
|
+
return emit(await figmaChangeSetList(f), json, (p) => figmaChangeSetListText(p.data, p.total));
|
|
1333
|
+
}
|
|
1334
|
+
if (rest[0] !== "show" || !rest[1] || rest.length > 2) throw new CliError("USAGE", "figma changeset show CHANGE_SET | figma changeset list [--file KEY] [--actionable] [--all]", 2);
|
|
1303
1335
|
return emit(await figmaChangeSetShow(rest[1]), json, (p) => figmaChangeSetText(p.data));
|
|
1304
1336
|
}
|
|
1305
1337
|
if (action === "release")
|
package/dist/closeout.js
ADDED
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
// hub-244: the machine half of a lane's end. Dev releases what it
|
|
2
|
+
// holds (change sets, scopes, claims) in the stop itself; Dev cannot reach this
|
|
3
|
+
// machine, so `lane stop`, `lane close`, `lane closeout` and the watchdog's
|
|
4
|
+
// final Orphan run this here, for each of the lane's repositories:
|
|
5
|
+
//
|
|
6
|
+
// 1. Commits not on the base are pushed, and read back from the remote.
|
|
7
|
+
// 2. A PR for the branch is opened if none is open ("Stopped: <reason>",
|
|
8
|
+
// lane key, issues), labelled Stopped, commented and CLOSED, so the work
|
|
9
|
+
// is recorded as stopped and recoverable from the branch. An open PR is
|
|
10
|
+
// closed the same way.
|
|
11
|
+
// 3. The lane's Docker test stacks (compose projects started from inside the
|
|
12
|
+
// worktree) are taken down: the lane created them, nobody else (MW2-49).
|
|
13
|
+
// 4. The worktree is removed, only after the push was read back, only when
|
|
14
|
+
// it is clean, and never while a process has it as its directory (MW1-49).
|
|
15
|
+
//
|
|
16
|
+
// Each step's outcome is reported; a step that cannot run says why, and later
|
|
17
|
+
// steps that depend on it are skipped, never forced.
|
|
18
|
+
import { execFile } from "node:child_process";
|
|
19
|
+
import { existsSync } from "node:fs";
|
|
20
|
+
import { dirname, resolve, sep } from "node:path";
|
|
21
|
+
import { promisify } from "node:util";
|
|
22
|
+
import { encode } from "./core.js";
|
|
23
|
+
|
|
24
|
+
const execFileAsync = promisify(execFile);
|
|
25
|
+
export const STOPPED_LABEL = "Stopped";
|
|
26
|
+
const MAX_BUFFER = 16 * 1024 * 1024;
|
|
27
|
+
|
|
28
|
+
const defaultExec = async (command, args, options = {}) => {
|
|
29
|
+
const { stdout } = await execFileAsync(command, args, { encoding: "utf8", maxBuffer: MAX_BUFFER, ...options });
|
|
30
|
+
return stdout;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/** The repositories a lane worked in, with branch and worktree. */
|
|
34
|
+
export function laneRepositories(lane) {
|
|
35
|
+
if (!lane) return [];
|
|
36
|
+
if (lane.repositories?.length) return lane.repositories;
|
|
37
|
+
if (lane.worktree && lane.branch) return [{ repo: lane.repos?.[0], branch: lane.branch, worktree: lane.worktree, baseRef: "origin/main" }];
|
|
38
|
+
return [];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const inside = (path, root) => {
|
|
42
|
+
const a = resolve(path);
|
|
43
|
+
const b = resolve(root);
|
|
44
|
+
return a === b || a.startsWith(b + sep);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/** PIDs whose current directory is inside the worktree (MW1-49). */
|
|
48
|
+
async function processesIn(worktree, exec, selfCwd) {
|
|
49
|
+
const found = [];
|
|
50
|
+
if (inside(selfCwd, worktree)) found.push({ pid: process.pid, cwd: selfCwd });
|
|
51
|
+
let out = "";
|
|
52
|
+
try { out = await exec("lsof", ["-a", "-d", "cwd", "-F", "pn"]); }
|
|
53
|
+
catch (error) { out = error?.stdout ?? ""; }
|
|
54
|
+
let pid = null;
|
|
55
|
+
for (const line of out.split("\n")) {
|
|
56
|
+
if (line.startsWith("p")) pid = Number(line.slice(1));
|
|
57
|
+
else if (line.startsWith("n") && pid && pid !== process.pid && inside(line.slice(1), worktree)) found.push({ pid, cwd: line.slice(1) });
|
|
58
|
+
}
|
|
59
|
+
return found;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** Compose projects whose working directory is inside the worktree. */
|
|
63
|
+
async function laneStacks(worktree, exec) {
|
|
64
|
+
let out = "";
|
|
65
|
+
try {
|
|
66
|
+
out = await exec("docker", ["ps", "-a", "--filter", "label=com.docker.compose.project", "--format", '{{.Label "com.docker.compose.project"}}\t{{.Label "com.docker.compose.project.working_dir"}}']);
|
|
67
|
+
} catch (error) {
|
|
68
|
+
return { error: error?.code === "ENOENT" ? "docker not installed" : "docker not reachable", projects: [] };
|
|
69
|
+
}
|
|
70
|
+
const projects = new Set();
|
|
71
|
+
for (const line of out.split("\n")) {
|
|
72
|
+
const [project, dir] = line.split("\t");
|
|
73
|
+
if (project && dir && inside(dir, worktree)) projects.add(project);
|
|
74
|
+
}
|
|
75
|
+
return { projects: [...projects].sort() };
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function prBody(lane, reason, issueKeys) {
|
|
79
|
+
return [
|
|
80
|
+
`Stopped: ${reason}`,
|
|
81
|
+
"",
|
|
82
|
+
`Lane: ${lane.key}`,
|
|
83
|
+
`Issue: ${issueKeys.length ? issueKeys.join(", ") : "none linked"}`,
|
|
84
|
+
"",
|
|
85
|
+
"This lane was stopped before its work landed. The branch keeps its commits, so the work can be picked up again from it.",
|
|
86
|
+
].join("\n");
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
async function closeStoppedPr({ lane, repository, reason, issueKeys, gh }) {
|
|
90
|
+
const branch = repository.branch;
|
|
91
|
+
const open = JSON.parse((await gh("pr", "list", "--head", branch, "--state", "open", "--json", "number,url")) || "[]");
|
|
92
|
+
let pr = open[0] ?? null;
|
|
93
|
+
let opened = false;
|
|
94
|
+
if (!pr) {
|
|
95
|
+
const title = `Stopped: ${lane.title ?? lane.key}`.slice(0, 250);
|
|
96
|
+
const url = (await gh("pr", "create", "--head", branch, "--base", (repository.baseRef ?? "origin/main").replace(/^origin\//, ""), "--title", title, "--body", prBody(lane, reason, issueKeys))).trim().split("\n").pop();
|
|
97
|
+
const number = Number(url.match(/\/pull\/(\d+)/)?.[1]);
|
|
98
|
+
if (!number) throw Object.assign(new Error(`gh pr create returned no PR URL: ${url}`), { code: "PR_CREATE_FAILED" });
|
|
99
|
+
pr = { number, url };
|
|
100
|
+
opened = true;
|
|
101
|
+
}
|
|
102
|
+
// The label may not exist yet in this repository; --force leaves it as it is if it does.
|
|
103
|
+
try { await gh("label", "create", STOPPED_LABEL, "--color", "B60205", "--description", "Lane stopped before its work landed", "--force"); }
|
|
104
|
+
catch { /* labelling still runs; a missing label shows in the read-back */ }
|
|
105
|
+
await gh("pr", "edit", String(pr.number), "--add-label", STOPPED_LABEL);
|
|
106
|
+
await gh("pr", "close", String(pr.number), "--comment", `Stopped: ${reason}\n\nLane ${lane.key} was stopped; its branch ${branch} keeps the work.`);
|
|
107
|
+
// K03-16: read the PR back.
|
|
108
|
+
const after = JSON.parse(await gh("pr", "view", String(pr.number), "--json", "state,labels,url"));
|
|
109
|
+
const labelled = (after.labels ?? []).some((label) => label.name === STOPPED_LABEL);
|
|
110
|
+
return { number: pr.number, url: after.url ?? pr.url, opened, state: after.state, labelled };
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Close out one repository of a stopped lane. Returns what happened at each
|
|
115
|
+
* step; never throws for a step's failure.
|
|
116
|
+
*/
|
|
117
|
+
export async function closeoutRepository(lane, repository, { reason, issueKeys = [], exec = defaultExec, cwd = process.cwd() } = {}) {
|
|
118
|
+
const { worktree, branch } = repository;
|
|
119
|
+
const out = { repo: repository.repo, branch, worktree, pushed: null, pr: null, stacks: [], worktreeRemoved: false, notes: [] };
|
|
120
|
+
if (!worktree || !existsSync(worktree)) {
|
|
121
|
+
out.notes.push("worktree is not on this machine; nothing to close out here");
|
|
122
|
+
return out;
|
|
123
|
+
}
|
|
124
|
+
const git = (...args) => exec("git", ["-C", worktree, ...args]);
|
|
125
|
+
const gh = (...args) => exec("gh", args, { cwd: worktree });
|
|
126
|
+
const base = repository.baseRef ?? "origin/main";
|
|
127
|
+
let pushedOk = false;
|
|
128
|
+
// A read-only repository (hub-257) holds no work of the lane's:
|
|
129
|
+
// nothing to push and no PR to record.
|
|
130
|
+
if (repository.readOnly) {
|
|
131
|
+
out.pushed = { ahead: 0, head: null, needed: false };
|
|
132
|
+
out.notes.push("read-only for this lane: not pushed, no PR");
|
|
133
|
+
pushedOk = true;
|
|
134
|
+
} else try {
|
|
135
|
+
try { await git("fetch", "--quiet", "origin"); } catch { out.notes.push("git fetch failed; compared against the last fetched base"); }
|
|
136
|
+
const head = (await git("rev-parse", "HEAD")).trim();
|
|
137
|
+
const ahead = Number((await git("rev-list", "--count", `${base}..HEAD`)).trim());
|
|
138
|
+
// MW1-30.1: content already on the base has landed; no PR to record.
|
|
139
|
+
const landed = ahead === 0 || (await git("diff", "--name-only", base, "HEAD")).trim() === "";
|
|
140
|
+
if (landed) {
|
|
141
|
+
out.pushed = { ahead, head, needed: false };
|
|
142
|
+
pushedOk = true;
|
|
143
|
+
} else {
|
|
144
|
+
await git("push", "--quiet", "-u", "origin", `HEAD:refs/heads/${branch}`);
|
|
145
|
+
const remote = (await git("ls-remote", "origin", `refs/heads/${branch}`)).trim().split(/\s+/)[0] ?? "";
|
|
146
|
+
pushedOk = remote === head;
|
|
147
|
+
out.pushed = { ahead, head, remote, needed: true, readBack: pushedOk };
|
|
148
|
+
if (!pushedOk) out.notes.push(`push read-back failed: remote ${branch} is ${remote || "missing"}, HEAD is ${head}`);
|
|
149
|
+
}
|
|
150
|
+
} catch (error) {
|
|
151
|
+
out.notes.push(`push failed: ${String(error?.stderr || error?.message || error).trim().slice(0, 300)}`);
|
|
152
|
+
}
|
|
153
|
+
// An open PR is closed as Stopped even when nothing new needed a push.
|
|
154
|
+
if (pushedOk && !repository.readOnly) {
|
|
155
|
+
try {
|
|
156
|
+
if (out.pushed.needed) out.pr = await closeStoppedPr({ lane, repository, reason, issueKeys, gh });
|
|
157
|
+
else {
|
|
158
|
+
const open = JSON.parse((await gh("pr", "list", "--head", branch, "--state", "open", "--json", "number,url")) || "[]");
|
|
159
|
+
if (open.length) out.pr = await closeStoppedPr({ lane, repository, reason, issueKeys, gh });
|
|
160
|
+
}
|
|
161
|
+
} catch (error) {
|
|
162
|
+
out.notes.push(`PR close-out failed: ${String(error?.stderr || error?.message || error).trim().slice(0, 300)}`);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
const stacks = await laneStacks(worktree, exec);
|
|
166
|
+
if (stacks.error) out.notes.push(`test stacks not checked: ${stacks.error}`);
|
|
167
|
+
for (const project of stacks.projects) {
|
|
168
|
+
try {
|
|
169
|
+
await exec("docker", ["compose", "-p", project, "down", "--volumes", "--remove-orphans"]);
|
|
170
|
+
out.stacks.push({ project, down: true });
|
|
171
|
+
} catch (error) {
|
|
172
|
+
out.stacks.push({ project, down: false, error: String(error?.stderr || error?.message || error).trim().slice(0, 200) });
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
if (!pushedOk) {
|
|
176
|
+
out.notes.push("worktree kept: the push did not succeed");
|
|
177
|
+
return out;
|
|
178
|
+
}
|
|
179
|
+
const dirty = (await git("status", "--porcelain")).trim();
|
|
180
|
+
if (dirty) {
|
|
181
|
+
out.notes.push("worktree kept: it has uncommitted changes, which removal would lose");
|
|
182
|
+
return out;
|
|
183
|
+
}
|
|
184
|
+
const busy = await processesIn(worktree, exec, cwd);
|
|
185
|
+
if (busy.length) {
|
|
186
|
+
out.notes.push(`worktree kept: a process is in it (PID ${busy.map((x) => x.pid).join(", ")}); run nodii-dev lane closeout ${lane.key} once it ends (MW1-49)`);
|
|
187
|
+
return out;
|
|
188
|
+
}
|
|
189
|
+
try {
|
|
190
|
+
const common = resolve(worktree, (await git("rev-parse", "--git-common-dir")).trim());
|
|
191
|
+
await exec("git", ["-C", dirname(common), "worktree", "remove", worktree]);
|
|
192
|
+
out.worktreeRemoved = !existsSync(worktree);
|
|
193
|
+
if (!out.worktreeRemoved) out.notes.push("git worktree remove returned but the directory is still there");
|
|
194
|
+
} catch (error) {
|
|
195
|
+
out.notes.push(`worktree removal failed: ${String(error?.stderr || error?.message || error).trim().slice(0, 300)}`);
|
|
196
|
+
}
|
|
197
|
+
return out;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/** One line per repository, as a person reads it on the issue. */
|
|
201
|
+
export function describeCloseout(lane, repositories) {
|
|
202
|
+
const lines = [`Lane ${lane.key} close-out on this machine:`];
|
|
203
|
+
for (const r of repositories) {
|
|
204
|
+
const parts = [];
|
|
205
|
+
if (r.pushed?.needed) parts.push(r.pushed.readBack ? `pushed ${r.pushed.ahead} commit(s) to ${r.branch}` : "push not confirmed");
|
|
206
|
+
else if (r.pushed) parts.push("nothing unlanded to push");
|
|
207
|
+
if (r.pr) parts.push(`PR ${r.pr.url} ${r.pr.opened ? "opened and " : ""}closed${r.pr.labelled ? ` with the ${STOPPED_LABEL} label` : ` (the ${STOPPED_LABEL} label did not stick)`}`);
|
|
208
|
+
for (const s of r.stacks) parts.push(s.down ? `test stack ${s.project} taken down` : `test stack ${s.project} NOT taken down (${s.error})`);
|
|
209
|
+
parts.push(r.worktreeRemoved ? "worktree removed" : "worktree kept");
|
|
210
|
+
lines.push(`- ${r.repo ?? r.worktree}: ${parts.join("; ")}.${r.notes.length ? ` ${r.notes.join("; ")}.` : ""}`);
|
|
211
|
+
}
|
|
212
|
+
return lines.join("\n");
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Close out every repository of the lane on this machine and record the result
|
|
217
|
+
* on its issues. The lane must already have ended in Dev (or be a final
|
|
218
|
+
* Orphan): Dev's refusal of the stop comes first, so nothing local runs for a
|
|
219
|
+
* stop Dev did not allow.
|
|
220
|
+
*/
|
|
221
|
+
export async function closeoutLane(lane, { reason, request, onBehalfOf, exec = defaultExec, cwd = process.cwd() } = {}) {
|
|
222
|
+
const issueKeys = (lane?.issues ?? []).map((issue) => issue.key).filter(Boolean);
|
|
223
|
+
const repositories = [];
|
|
224
|
+
for (const repository of laneRepositories(lane))
|
|
225
|
+
repositories.push(await closeoutRepository(lane, repository, { reason, issueKeys, exec, cwd }));
|
|
226
|
+
const text = describeCloseout(lane, repositories);
|
|
227
|
+
const recorded = [];
|
|
228
|
+
if (request && repositories.length)
|
|
229
|
+
for (const key of issueKeys) {
|
|
230
|
+
try {
|
|
231
|
+
await request("POST", `/api/v1/issues/${encode(key)}/comment`, { body: text.slice(0, 10_000), ...(onBehalfOf ? { onBehalfOf } : {}) });
|
|
232
|
+
recorded.push(key);
|
|
233
|
+
} catch (error) {
|
|
234
|
+
recorded.push(`${key} (not recorded: ${error?.code ?? "error"})`);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
return { repositories, recorded, text };
|
|
238
|
+
}
|
package/dist/core.js
CHANGED
|
@@ -4,7 +4,7 @@ import { chmod, mkdir, readFile, rm, writeFile } from "node:fs/promises";
|
|
|
4
4
|
import { homedir, platform } from "node:os";
|
|
5
5
|
import { dirname, join } from "node:path";
|
|
6
6
|
|
|
7
|
-
export const VERSION = "0.6.
|
|
7
|
+
export const VERSION = "0.6.79";
|
|
8
8
|
export const configPath = () =>
|
|
9
9
|
process.env.NODII_DEV_CONFIG_PATH ??
|
|
10
10
|
join(homedir(), ".config/nodii-dev/config.json");
|
|
@@ -225,7 +225,7 @@ export async function checkLogin() {
|
|
|
225
225
|
export const encode = (value) => encodeURIComponent(value);
|
|
226
226
|
// Switches never take the next token as their value, so
|
|
227
227
|
// `docs upload --wait rulebook/` keeps rulebook/ as a path.
|
|
228
|
-
const SWITCHES = new Set(["confirm-raise", "json", "wait", "pending", "dry-run", "check", "all", "fleet", "help", "yes", "mine", "no-browser", "include-drafts", "drafted", "library", "async", "sync", "force", "system", "delta", "probe", "no-probe", "not-required", "override", "critical", "no-embed", "behind", "write", "fetch"]);
|
|
228
|
+
const SWITCHES = new Set(["confirm-raise", "actionable", "json", "wait", "pending", "dry-run", "check", "all", "fleet", "help", "yes", "mine", "no-browser", "include-drafts", "drafted", "library", "async", "sync", "force", "system", "delta", "probe", "no-probe", "not-required", "override", "critical", "no-embed", "behind", "write", "fetch"]);
|
|
229
229
|
export function parseArgs(argv) {
|
|
230
230
|
const flags = {};
|
|
231
231
|
const args = [];
|