@intentius/chant 0.124.79 → 0.124.81
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/ci-note-commands.d.ts +199 -0
- package/dist/ci-note-commands.d.ts.map +1 -0
- package/dist/ci-note-commands.js +372 -0
- package/dist/cli/handlers/build.d.ts.map +1 -1
- package/dist/cli/handlers/build.js +7 -1
- package/dist/cli/handlers/pr-notes.d.ts +13 -0
- package/dist/cli/handlers/pr-notes.d.ts.map +1 -0
- package/dist/cli/handlers/pr-notes.js +73 -0
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +10 -1
- package/dist/cli/mcp/product-tools.d.ts.map +1 -1
- package/dist/cli/mcp/product-tools.js +1 -2
- package/dist/cli/parse-args.d.ts.map +1 -1
- package/dist/cli/parse-args.js +10 -0
- package/dist/cli/registry.d.ts +4 -0
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/components/capability.d.ts +22 -0
- package/dist/components/capability.d.ts.map +1 -1
- package/dist/components/pr-pipeline.d.ts +22 -0
- package/dist/components/pr-pipeline.d.ts.map +1 -1
- package/dist/components/pr-pipeline.js +26 -0
- package/dist/components/product-pipeline.d.ts +12 -0
- package/dist/components/product-pipeline.d.ts.map +1 -1
- package/dist/components/product-pipeline.js +5 -1
- package/dist/lifecycle/release-version.d.ts.map +1 -1
- package/dist/lifecycle/release-version.js +1 -2
- package/dist/op/index.d.ts +3 -3
- package/dist/op/index.d.ts.map +1 -1
- package/dist/op/index.js +2 -2
- package/dist/op/op-waves-after-plan.d.ts +33 -0
- package/dist/op/op-waves-after-plan.d.ts.map +1 -1
- package/dist/op/op-waves-after-plan.js +41 -4
- package/dist/op/op-waves-capability.d.ts +13 -1
- package/dist/op/op-waves-capability.d.ts.map +1 -1
- package/dist/op/op-waves-capability.js +22 -14
- package/dist/op/op-waves-run-hooks.d.ts.map +1 -1
- package/dist/op/op-waves-run-hooks.js +1 -2
- package/dist/op/op-waves-run.d.ts.map +1 -1
- package/dist/op/op-waves-run.js +125 -20
- package/dist/op/op-waves.d.ts +9 -5
- package/dist/op/op-waves.d.ts.map +1 -1
- package/dist/parallelism.d.ts +9 -0
- package/dist/parallelism.d.ts.map +1 -1
- package/dist/parallelism.js +15 -0
- package/dist/pr-forge-reads.d.ts +151 -1
- package/dist/pr-forge-reads.d.ts.map +1 -1
- package/dist/pr-forge-reads.js +265 -1
- package/dist/release-floors.d.ts +15 -1
- package/dist/release-floors.d.ts.map +1 -1
- package/dist/release-floors.js +17 -3
- package/dist/wave-runtime.mjs +288 -288
- package/package.json +1 -1
- package/src/ci-note-commands.test.ts +377 -0
- package/src/ci-note-commands.ts +479 -0
- package/src/cli/handlers/build.ts +7 -1
- package/src/cli/handlers/pr-notes.ts +70 -0
- package/src/cli/main.ts +10 -1
- package/src/cli/mcp/product-tools.test.ts +1 -2
- package/src/cli/mcp/product-tools.ts +1 -2
- package/src/cli/parse-args.ts +8 -0
- package/src/cli/registry.ts +4 -0
- package/src/components/capability.ts +22 -0
- package/src/components/pr-pipeline.ts +35 -0
- package/src/components/product-pipeline.test.ts +14 -0
- package/src/components/product-pipeline.ts +13 -1
- package/src/lifecycle/release-version.ts +1 -2
- package/src/op/index.ts +3 -2
- package/src/op/op-waves-after-plan-wave.test.ts +2 -3
- package/src/op/op-waves-after-plan.ts +61 -4
- package/src/op/op-waves-capability.test.ts +3 -1
- package/src/op/op-waves-capability.ts +27 -18
- package/src/op/op-waves-gate-port.test.ts +231 -0
- package/src/op/op-waves-parallel-plans.test.ts +185 -0
- package/src/op/op-waves-parallelism.test.ts +5 -0
- package/src/op/op-waves-run-hooks.test.ts +2 -3
- package/src/op/op-waves-run-hooks.ts +1 -2
- package/src/op/op-waves-run.ts +123 -23
- package/src/op/op-waves-step-wave.test.ts +3 -4
- package/src/op/op-waves.ts +9 -5
- package/src/parallelism.ts +26 -0
- package/src/pr-forge-reads-compare.test.ts +145 -0
- package/src/pr-forge-reads.test.ts +203 -0
- package/src/pr-forge-reads.ts +398 -1
- package/src/release-floors.ts +24 -3
package/dist/pr-forge-reads.js
CHANGED
|
@@ -4,7 +4,11 @@
|
|
|
4
4
|
* state and merge commit, the pull requests from a branch (or a branch
|
|
5
5
|
* prefix) in any state, every note on a pull request, GitHub's check runs on
|
|
6
6
|
* a commit, a pull request's commits, a collaborator's permission level, and
|
|
7
|
-
* every open pull request in the repository
|
|
7
|
+
* every open pull request in the repository; and a head's workflow runs
|
|
8
|
+
* (GitLab's pipelines), a run, its jobs, and the artifacts it kept, by name in
|
|
9
|
+
* a run or across the repository, as a product's review agent reads them
|
|
10
|
+
* (#4846); the files a head changes since its merge base, a job by id, and
|
|
11
|
+
* a file of a GitLab job's artifacts (#4862).
|
|
8
12
|
*
|
|
9
13
|
* They take the same options as the clients in `./pr-forge.ts` and live in
|
|
10
14
|
* their own module, imported only by the products that call them, so the
|
|
@@ -35,6 +39,16 @@ function getter(base, headers, fetchImpl, pageSize, pageParams) {
|
|
|
35
39
|
}
|
|
36
40
|
return out.slice(0, max);
|
|
37
41
|
};
|
|
42
|
+
get.text = async (path) => {
|
|
43
|
+
const url = `${root}${path}`;
|
|
44
|
+
const res = await fetchImpl(url, { method: "GET", headers });
|
|
45
|
+
const text = await res.text();
|
|
46
|
+
if (res.status === 404)
|
|
47
|
+
return undefined;
|
|
48
|
+
if (!res.ok)
|
|
49
|
+
throw new ForgeApiError("GET", url, res.status, text);
|
|
50
|
+
return text;
|
|
51
|
+
};
|
|
38
52
|
return get;
|
|
39
53
|
}
|
|
40
54
|
const isObject = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
@@ -65,6 +79,22 @@ const orUndefined = async (read) => {
|
|
|
65
79
|
}
|
|
66
80
|
};
|
|
67
81
|
const DEFAULT_LIMIT = 500;
|
|
82
|
+
const RUN_LIMIT = 100;
|
|
83
|
+
const byIdDesc = (a, b) => b.id - a.id;
|
|
84
|
+
/** Forgejo's and GitLab's words for a run or job that is over. GitHub says `completed`. */
|
|
85
|
+
const OVER = new Set(["completed", "success", "failure", "failed", "cancelled", "canceled", "skipped"]);
|
|
86
|
+
/** Pages of a list the forge wraps in an object (`{ total_count, workflow_runs }`), or answers bare, until a page comes back short. */
|
|
87
|
+
async function listIn(get, path, field, pageSize, pageParams, max) {
|
|
88
|
+
const out = [];
|
|
89
|
+
for (let page = 1; page <= 50 && out.length < max; page++) {
|
|
90
|
+
const got = await get(`${path}${path.includes("?") ? "&" : "?"}${pageParams(page)}`);
|
|
91
|
+
const items = (Array.isArray(got) ? got : isObject(got) && Array.isArray(got[field]) ? got[field] : []).filter(isObject);
|
|
92
|
+
out.push(...items);
|
|
93
|
+
if (items.length < pageSize)
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
return out.slice(0, max);
|
|
97
|
+
}
|
|
68
98
|
function githubShapedReads(kind, opts) {
|
|
69
99
|
const headers = kind === "github"
|
|
70
100
|
? { ...(opts.token ? { Authorization: `Bearer ${opts.token}` } : {}), Accept: "application/vnd.github+json" }
|
|
@@ -100,6 +130,64 @@ function githubShapedReads(kind, opts) {
|
|
|
100
130
|
out[k] = val;
|
|
101
131
|
return out;
|
|
102
132
|
};
|
|
133
|
+
const pageParams = (page) => (kind === "github" ? `per_page=100&page=${page}` : `limit=50&page=${page}`);
|
|
134
|
+
const runOf = (v) => {
|
|
135
|
+
if (!isObject(v))
|
|
136
|
+
return undefined;
|
|
137
|
+
const id = num(v.id);
|
|
138
|
+
const headSha = str(v.head_sha) ?? str(v.commit_sha);
|
|
139
|
+
if (id === undefined || !headSha)
|
|
140
|
+
return undefined;
|
|
141
|
+
const listed = str(v.event) ?? "";
|
|
142
|
+
const event = str(v.trigger_event) ?? listed;
|
|
143
|
+
const path = str(v.path)?.replace(/@.*$/, "");
|
|
144
|
+
const workflow = str(v.workflow_id) ?? path?.split("/").pop();
|
|
145
|
+
const status = str(v.status) ?? "";
|
|
146
|
+
const conclusion = str(v.conclusion);
|
|
147
|
+
const headRepo = isObject(v.head_repository) ? str(v.head_repository.full_name) : undefined;
|
|
148
|
+
const pullRequests = [];
|
|
149
|
+
for (const p of Array.isArray(v.pull_requests) ? v.pull_requests.filter(isObject) : []) {
|
|
150
|
+
const number = num(p.number);
|
|
151
|
+
if (number === undefined)
|
|
152
|
+
continue;
|
|
153
|
+
const head = isObject(p.head) ? p.head : {};
|
|
154
|
+
const fields = { head: str(head.ref), headSha: str(head.sha), base: isObject(p.base) ? str(p.base.ref) : undefined };
|
|
155
|
+
pullRequests.push({ number, ...Object.fromEntries(Object.entries(fields).filter(([, x]) => x !== undefined)) });
|
|
156
|
+
}
|
|
157
|
+
// Forgejo names the event's pull request only in the payload it keeps as a string.
|
|
158
|
+
let payload = v.event_payload;
|
|
159
|
+
if (typeof payload === "string") {
|
|
160
|
+
try {
|
|
161
|
+
payload = JSON.parse(payload);
|
|
162
|
+
}
|
|
163
|
+
catch {
|
|
164
|
+
payload = undefined;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
const pull = isObject(payload) && isObject(payload.pull_request) ? payload.pull_request : undefined;
|
|
168
|
+
const number = pull ? num(pull.number) : undefined;
|
|
169
|
+
if (pull && number !== undefined && !pullRequests.some((p) => p.number === number)) {
|
|
170
|
+
const head = isObject(pull.head) ? pull.head : {};
|
|
171
|
+
const fields = { head: str(head.ref), headSha: str(head.sha), base: isObject(pull.base) ? str(pull.base.ref) : undefined };
|
|
172
|
+
pullRequests.push({ number, ...Object.fromEntries(Object.entries(fields).filter(([, x]) => x !== undefined)) });
|
|
173
|
+
}
|
|
174
|
+
const fields = { listedEvent: listed !== event ? listed : undefined, workflow, path, headBranch: str(v.head_branch), headRepo, conclusion, url: str(v.html_url) };
|
|
175
|
+
const out = { id, event, headSha, status, done: OVER.has(status), pullRequests };
|
|
176
|
+
for (const [k, val] of Object.entries(fields))
|
|
177
|
+
if (val !== undefined)
|
|
178
|
+
out[k] = val;
|
|
179
|
+
return out;
|
|
180
|
+
};
|
|
181
|
+
const artifactOf = (v, name) => {
|
|
182
|
+
const id = num(v.id);
|
|
183
|
+
if (id === undefined || str(v.name) !== name || v.expired === true)
|
|
184
|
+
return undefined;
|
|
185
|
+
const wr = isObject(v.workflow_run) ? v.workflow_run : {};
|
|
186
|
+
const run = num(wr.id) ?? num(v.run_id) ?? num(v.workflow_run_id);
|
|
187
|
+
const headSha = str(wr.head_sha);
|
|
188
|
+
const size = num(v.size_in_bytes) ?? num(v.size);
|
|
189
|
+
return { id, name, ...(run !== undefined ? { run } : {}), ...(headSha ? { headSha } : {}), ...(size !== undefined ? { size } : {}) };
|
|
190
|
+
};
|
|
103
191
|
/** Forgejo answers a pull request list with 404 while the repository is still empty; a missing repository 404s on its own read too. */
|
|
104
192
|
const pulls = async (query, max) => {
|
|
105
193
|
try {
|
|
@@ -209,6 +297,115 @@ function githubShapedReads(kind, opts) {
|
|
|
209
297
|
}
|
|
210
298
|
return out.sort((a, b) => a.number - b.number);
|
|
211
299
|
},
|
|
300
|
+
async headRuns(sha, o = {}) {
|
|
301
|
+
const query = `head_sha=${encodeURIComponent(sha)}${o.event ? `&event=${encodeURIComponent(o.event)}` : ""}`;
|
|
302
|
+
const listed = (await listIn(get, `${repo}/actions/runs?${query}`, "workflow_runs", pageSize, pageParams, o.limit ?? RUN_LIMIT)).map(runOf).filter(defined);
|
|
303
|
+
// Forgejo filters by the listed event, so a pull_request_target run comes back for `pull_request`: both words count.
|
|
304
|
+
return listed.filter((r) => r.headSha === sha && (!o.event || r.event === o.event || r.listedEvent === o.event)).sort(byIdDesc);
|
|
305
|
+
},
|
|
306
|
+
async branchRuns(branch, o = {}) {
|
|
307
|
+
const query = `branch=${encodeURIComponent(branch)}${o.event ? `&event=${encodeURIComponent(o.event)}` : ""}`;
|
|
308
|
+
const listed = (await listIn(get, `${repo}/actions/runs?${query}`, "workflow_runs", pageSize, pageParams, o.limit ?? RUN_LIMIT)).map(runOf).filter(defined);
|
|
309
|
+
return listed.filter((r) => r.headBranch === undefined || r.headBranch === branch).filter((r) => !o.event || r.event === o.event || r.listedEvent === o.event).sort(byIdDesc);
|
|
310
|
+
},
|
|
311
|
+
async pullRequestsUpdated(since, o = {}) {
|
|
312
|
+
const limit = o.limit ?? DEFAULT_LIMIT;
|
|
313
|
+
const from = Date.parse(since);
|
|
314
|
+
const out = [];
|
|
315
|
+
// Newest update first, so the first page item older than `since` ends the read.
|
|
316
|
+
const query = kind === "github" ? "state=all&sort=updated&direction=desc" : "state=all&sort=recentupdate";
|
|
317
|
+
for (let page = 1; page <= 50 && out.length < limit; page++) {
|
|
318
|
+
let items;
|
|
319
|
+
try {
|
|
320
|
+
items = await get(`${repo}/pulls?${query}&${pageParams(page)}`);
|
|
321
|
+
}
|
|
322
|
+
catch (err) {
|
|
323
|
+
if (kind !== "forgejo" || !notFound(err))
|
|
324
|
+
throw err;
|
|
325
|
+
await get(repo);
|
|
326
|
+
return [];
|
|
327
|
+
}
|
|
328
|
+
const list = Array.isArray(items) ? items : [];
|
|
329
|
+
let older = false;
|
|
330
|
+
for (const v of list) {
|
|
331
|
+
const d = detail(v);
|
|
332
|
+
if (!d)
|
|
333
|
+
continue;
|
|
334
|
+
if (d.updated !== undefined && Date.parse(d.updated) < from) {
|
|
335
|
+
older = true;
|
|
336
|
+
break;
|
|
337
|
+
}
|
|
338
|
+
out.push(d);
|
|
339
|
+
}
|
|
340
|
+
if (older || list.length < pageSize)
|
|
341
|
+
break;
|
|
342
|
+
}
|
|
343
|
+
return out.slice(0, limit);
|
|
344
|
+
},
|
|
345
|
+
run: async (id) => runOf(await orUndefined(get(`${repo}/actions/runs/${id}`))),
|
|
346
|
+
runJobs: async (run) => (await listIn(get, `${repo}/actions/runs/${run}/jobs`, "jobs", pageSize, pageParams, 1000)).map(jobOf).filter(defined),
|
|
347
|
+
async artifacts(name, o = {}) {
|
|
348
|
+
const where = o.run !== undefined ? `${repo}/actions/runs/${o.run}/artifacts` : `${repo}/actions/artifacts`;
|
|
349
|
+
const listed = await listIn(get, `${where}?name=${encodeURIComponent(name)}`, "artifacts", pageSize, pageParams, o.limit ?? RUN_LIMIT);
|
|
350
|
+
return listed.map((a) => artifactOf(a, name)).filter(defined).map((a) => (o.run !== undefined && a.run === undefined ? { ...a, run: o.run } : a)).sort(byIdDesc);
|
|
351
|
+
},
|
|
352
|
+
async compare(base, head) {
|
|
353
|
+
const got = await get(`${repo}/compare/${encodeURIComponent(base)}...${encodeURIComponent(head)}`);
|
|
354
|
+
const c = isObject(got) ? got : {};
|
|
355
|
+
if (kind === "github") {
|
|
356
|
+
const listed = Array.isArray(c.files) ? c.files.filter(isObject) : [];
|
|
357
|
+
const files = listed.map((f) => changed(f.filename, f.previous_filename)).filter(defined);
|
|
358
|
+
return { files, truncated: listed.length >= GITHUB_COMPARE_FILES };
|
|
359
|
+
}
|
|
360
|
+
// Forgejo names the files of each commit between the merge base and the head.
|
|
361
|
+
const commits = Array.isArray(c.commits) ? c.commits.filter(isObject) : [];
|
|
362
|
+
const seen = new Set();
|
|
363
|
+
const files = [];
|
|
364
|
+
for (const commit of commits) {
|
|
365
|
+
for (const f of Array.isArray(commit.files) ? commit.files.filter(isObject) : []) {
|
|
366
|
+
const file = changed(f.filename);
|
|
367
|
+
if (file && !seen.has(file.path)) {
|
|
368
|
+
seen.add(file.path);
|
|
369
|
+
files.push(file);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
const total = num(c.total_commits);
|
|
374
|
+
return { files, truncated: (total !== undefined && commits.length < total) || commits.some((commit) => !Array.isArray(commit.files)) };
|
|
375
|
+
},
|
|
376
|
+
job: async (id) => jobOf(await orUndefined(get(`${repo}/actions/jobs/${id}`))),
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
/** GitHub lists at most this many files of a comparison. */
|
|
380
|
+
const GITHUB_COMPARE_FILES = 300;
|
|
381
|
+
const changed = (path, previous) => {
|
|
382
|
+
const p = str(path);
|
|
383
|
+
const was = str(previous);
|
|
384
|
+
return p ? { path: p, ...(was && was !== p ? { previousPath: was } : {}) } : undefined;
|
|
385
|
+
};
|
|
386
|
+
/** A job as GitHub, Forgejo or GitLab answers it. */
|
|
387
|
+
function jobOf(j) {
|
|
388
|
+
if (!isObject(j))
|
|
389
|
+
return undefined;
|
|
390
|
+
const id = num(j.id);
|
|
391
|
+
const name = str(j.name);
|
|
392
|
+
if (id === undefined || !name)
|
|
393
|
+
return undefined;
|
|
394
|
+
const status = str(j.status) ?? "";
|
|
395
|
+
const conclusion = str(j.conclusion);
|
|
396
|
+
const run = num(j.run_id) ?? (isObject(j.pipeline) ? num(j.pipeline.id) : undefined);
|
|
397
|
+
const ref = str(j.head_branch) ?? str(j.ref);
|
|
398
|
+
const url = str(j.html_url) ?? str(j.web_url);
|
|
399
|
+
return {
|
|
400
|
+
id,
|
|
401
|
+
name,
|
|
402
|
+
status,
|
|
403
|
+
...(conclusion ? { conclusion } : {}),
|
|
404
|
+
done: OVER.has(status),
|
|
405
|
+
...(run !== undefined ? { run } : {}),
|
|
406
|
+
...(ref ? { ref } : {}),
|
|
407
|
+
...(typeof j.tag === "boolean" ? { tag: j.tag } : {}),
|
|
408
|
+
...(url ? { url } : {}),
|
|
212
409
|
};
|
|
213
410
|
}
|
|
214
411
|
/** GitLab's access levels, by the number its API answers. */
|
|
@@ -226,6 +423,43 @@ export function gitlabReads(opts) {
|
|
|
226
423
|
const get = getter(opts.apiBase, opts.token ? { [opts.tokenHeader ?? "PRIVATE-TOKEN"]: opts.token } : {}, opts.fetch ?? globalThis.fetch, 100, (page) => `per_page=100&page=${page}`);
|
|
227
424
|
const project = `/projects/${encodeURIComponent(decodeURIComponent(opts.project))}`;
|
|
228
425
|
const mrs = `${project}/merge_requests`;
|
|
426
|
+
const gitlabPage = (page) => `per_page=100&page=${page}`;
|
|
427
|
+
const MR_REF = /^refs\/merge-requests\/(\d+)\/(?:head|merge|train)$/;
|
|
428
|
+
const pipelineOf = (v) => {
|
|
429
|
+
if (!isObject(v))
|
|
430
|
+
return undefined;
|
|
431
|
+
const id = num(v.id);
|
|
432
|
+
const headSha = str(v.sha);
|
|
433
|
+
if (id === undefined || !headSha)
|
|
434
|
+
return undefined;
|
|
435
|
+
const status = str(v.status) ?? "";
|
|
436
|
+
const ref = str(v.ref);
|
|
437
|
+
const mr = ref ? MR_REF.exec(ref) : null;
|
|
438
|
+
const fields = { headBranch: ref, url: str(v.web_url) };
|
|
439
|
+
const out = { id, event: str(v.source) ?? "", headSha, status, done: OVER.has(status), pullRequests: mr ? [{ number: Number(mr[1]), headSha }] : [] };
|
|
440
|
+
for (const [k, val] of Object.entries(fields))
|
|
441
|
+
if (val !== undefined)
|
|
442
|
+
out[k] = val;
|
|
443
|
+
return out;
|
|
444
|
+
};
|
|
445
|
+
/** A job's artifacts archive, when it kept one. */
|
|
446
|
+
const archiveOf = (j, name) => {
|
|
447
|
+
const id = num(j.id);
|
|
448
|
+
if (id === undefined || str(j.name) !== name)
|
|
449
|
+
return undefined;
|
|
450
|
+
const files = Array.isArray(j.artifacts) ? j.artifacts.filter(isObject) : [];
|
|
451
|
+
const archive = files.find((f) => f.file_type === "archive") ?? (isObject(j.artifacts_file) ? j.artifacts_file : undefined);
|
|
452
|
+
if (!archive)
|
|
453
|
+
return undefined;
|
|
454
|
+
const expires = str(j.artifacts_expire_at);
|
|
455
|
+
if (expires && Date.parse(expires) <= Date.now())
|
|
456
|
+
return undefined;
|
|
457
|
+
const pipeline = isObject(j.pipeline) ? j.pipeline : {};
|
|
458
|
+
const run = num(pipeline.id);
|
|
459
|
+
const headSha = str(pipeline.sha);
|
|
460
|
+
const size = num(archive.size);
|
|
461
|
+
return { id, name, ...(run !== undefined ? { run } : {}), ...(headSha ? { headSha } : {}), ...(size !== undefined ? { size } : {}) };
|
|
462
|
+
};
|
|
229
463
|
const own = (v) => num(v.source_project_id) === undefined || num(v.source_project_id) === num(v.target_project_id);
|
|
230
464
|
const detail = (v) => {
|
|
231
465
|
if (!isObject(v))
|
|
@@ -309,6 +543,36 @@ export function gitlabReads(opts) {
|
|
|
309
543
|
}
|
|
310
544
|
return out.sort((a, b) => a.number - b.number);
|
|
311
545
|
},
|
|
546
|
+
async headRuns(sha, o = {}) {
|
|
547
|
+
const query = `sha=${encodeURIComponent(sha)}${o.event ? `&source=${encodeURIComponent(o.event)}` : ""}&order_by=id&sort=desc`;
|
|
548
|
+
const listed = (await listIn(get, `${project}/pipelines?${query}`, "", 100, gitlabPage, o.limit ?? RUN_LIMIT)).map(pipelineOf).filter(defined);
|
|
549
|
+
return listed.filter((r) => r.headSha === sha && (!o.event || r.event === o.event)).sort(byIdDesc);
|
|
550
|
+
},
|
|
551
|
+
async branchRuns(branch, o = {}) {
|
|
552
|
+
const query = `ref=${encodeURIComponent(branch)}${o.event ? `&source=${encodeURIComponent(o.event)}` : ""}&order_by=id&sort=desc`;
|
|
553
|
+
const listed = (await listIn(get, `${project}/pipelines?${query}`, "", 100, gitlabPage, o.limit ?? RUN_LIMIT)).map(pipelineOf).filter(defined);
|
|
554
|
+
return listed.filter((r) => r.headBranch === branch && (!o.event || r.event === o.event)).sort(byIdDesc);
|
|
555
|
+
},
|
|
556
|
+
async pullRequestsUpdated(since, o = {}) {
|
|
557
|
+
const listed = await get.list(`${mrs}?state=all&updated_after=${encodeURIComponent(since)}&order_by=updated_at&sort=desc`, o.limit ?? DEFAULT_LIMIT);
|
|
558
|
+
return listed.map(detail).filter(defined);
|
|
559
|
+
},
|
|
560
|
+
run: async (id) => pipelineOf(await orUndefined(get(`${project}/pipelines/${id}`))),
|
|
561
|
+
runJobs: async (run) => (await get.list(`${project}/pipelines/${run}/jobs?include_retried=false`)).map(jobOf).filter(defined),
|
|
562
|
+
async artifacts(name, o = {}) {
|
|
563
|
+
const limit = o.limit ?? RUN_LIMIT;
|
|
564
|
+
// GitLab keeps artifacts per job: a pipeline's jobs of that name, or the project's newest jobs, that kept an archive.
|
|
565
|
+
const jobs = o.run !== undefined ? await get.list(`${project}/pipelines/${o.run}/jobs`) : await get.list(`${project}/jobs`, 10 * limit);
|
|
566
|
+
return jobs.filter(isObject).map((j) => archiveOf(j, name)).filter(defined).sort(byIdDesc).slice(0, limit);
|
|
567
|
+
},
|
|
568
|
+
async compare(base, head) {
|
|
569
|
+
const got = await get(`${project}/repository/compare?from=${encodeURIComponent(base)}&to=${encodeURIComponent(head)}&straight=false`);
|
|
570
|
+
const c = isObject(got) ? got : {};
|
|
571
|
+
const files = (Array.isArray(c.diffs) ? c.diffs.filter(isObject) : []).map((d) => changed(d.new_path ?? d.old_path, d.old_path)).filter(defined);
|
|
572
|
+
return { files, truncated: c.compare_timeout === true };
|
|
573
|
+
},
|
|
574
|
+
job: async (id) => jobOf(await orUndefined(get(`${project}/jobs/${id}`))),
|
|
575
|
+
artifactFile: (job, path) => get.text(`${project}/jobs/${job}/artifacts/${path.split("/").map(encodeURIComponent).join("/")}`),
|
|
312
576
|
};
|
|
313
577
|
}
|
|
314
578
|
/** The reads for a {@link ForgeTarget}, the way `forgeClient` builds its client. */
|
package/dist/release-floors.d.ts
CHANGED
|
@@ -19,7 +19,15 @@
|
|
|
19
19
|
* this constant to the next patch (#4501). The check fails while a floor
|
|
20
20
|
* still names this constant after its version shipped.
|
|
21
21
|
*/
|
|
22
|
-
export declare const NEXT_RELEASE = "0.124.
|
|
22
|
+
export declare const NEXT_RELEASE = "0.124.81";
|
|
23
|
+
/** The first chant whose terraform lexicon's `terraform-apply` reads take `dir` and `workspace`, and read an upstream with `resolveRoot`'s binary and `readEnv` (terragucci issue 1303). */
|
|
24
|
+
export declare const TERRAFORM_APPLY_INSTANCE_READS_FLOOR = "0.124.80";
|
|
25
|
+
/** The first chant whose terraform lexicon's `terraform-apply` takes `binary`, and `terraformApplyCapabilityWith({ resolveRoot })` gives each root its own binary (terragucci issue 1303). */
|
|
26
|
+
export declare const TERRAFORM_APPLY_ROOT_BINARY_FLOOR = "0.124.80";
|
|
27
|
+
/** The first chant whose op wave hands a step's capability the wave's `cwd` (`DeployContext.cwd`), where `terraform-apply` looks for `chant.config.*` and `terragrunt-apply` runs when the step names neither (#4854). */
|
|
28
|
+
export declare const OP_WAVE_STEP_CWD_FLOOR = "0.124.80";
|
|
29
|
+
/** The first chant whose terraform lexicon's `terraform-apply` takes `workspace`: init in `default`, then `workspace select -or-create=true`, and plan, apply and output in it (#4854). */
|
|
30
|
+
export declare const TERRAFORM_APPLY_WORKSPACE_FLOOR = "0.124.80";
|
|
23
31
|
/** The first chant whose change-set member can carry `outputs`, the outputs its plan changes, and counts a member with any as a change (#4849). */
|
|
24
32
|
export declare const CHANGE_SET_OUTPUTS_FLOOR = "0.124.79";
|
|
25
33
|
/** The first chant whose terraform lexicon's `terragruntApplyCapability` takes `resolveUnit` and plans a wave as one `run --all` per pair of pinned releases (#4849). */
|
|
@@ -28,6 +36,12 @@ export declare const TERRAGRUNT_UNIT_PINS_FLOOR = "0.124.79";
|
|
|
28
36
|
export declare const YODEL_NEW_ENVS_FLOOR = "0.124.78";
|
|
29
37
|
/** The first chant whose sql lexicon's `yodelRefusalReply` reads yodel rebase's conflict refusal as yodel prints it, `<a> and the migrations after <p> up to <b>` or `<a> and the chain ending at <b>` (#4821). */
|
|
30
38
|
export declare const YODEL_CONFLICT_REPLY_FLOOR = "0.124.78";
|
|
39
|
+
/** The first chant with `@intentius/chant/ci-note-commands`, `chant components pr-notes` and the GitLab pipeline's `note-commands` job (`--note-commands`), and whose forge reads answer `branchRuns` and `pullRequestsUpdated` (#4785). */
|
|
40
|
+
export declare const NOTE_COMMANDS_FLOOR = "0.124.80";
|
|
41
|
+
/** The first chant whose forge reads answer `compare`, `job` and, on GitLab, `artifactFile`, and whose `RunJob` names its `run`, `ref`, `tag` and `url` (#4862). */
|
|
42
|
+
export declare const PR_FORGE_COMPARE_READS_FLOOR = "0.124.80";
|
|
43
|
+
/** The first chant whose forge reads answer `headRuns`, `run`, `runJobs` and `artifacts`: a head's workflow runs (GitLab's pipelines), a run, its jobs and its artifacts by name (#4846). */
|
|
44
|
+
export declare const PR_FORGE_RUN_READS_FLOOR = "0.124.80";
|
|
31
45
|
/** The first chant whose `@intentius/chant/pr-forge-reads` exports the forge reads beside the clients (#4809). */
|
|
32
46
|
export declare const PR_FORGE_READS_FLOOR = "0.124.78";
|
|
33
47
|
/** The first chant whose GitLab `scheduledRuns` takes `schedule`, the selector of an Op's `gitlab.scheduleRule` (#4813). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"release-floors.d.ts","sourceRoot":"","sources":["../src/release-floors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,YAAY,aAAa,CAAC;AAEvC,mJAAmJ;AACnJ,eAAO,MAAM,wBAAwB,
|
|
1
|
+
{"version":3,"file":"release-floors.d.ts","sourceRoot":"","sources":["../src/release-floors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,YAAY,aAAa,CAAC;AAEvC,4LAA4L;AAC5L,eAAO,MAAM,oCAAoC,aAAa,CAAC;AAE/D,8LAA8L;AAC9L,eAAO,MAAM,iCAAiC,aAAa,CAAC;AAE5D,0NAA0N;AAC1N,eAAO,MAAM,sBAAsB,aAAa,CAAC;AAEjD,2LAA2L;AAC3L,eAAO,MAAM,+BAA+B,aAAa,CAAC;AAE1D,mJAAmJ;AACnJ,eAAO,MAAM,wBAAwB,aAAa,CAAC;AAEnD,yKAAyK;AACzK,eAAO,MAAM,0BAA0B,aAAa,CAAC;AAErD,sJAAsJ;AACtJ,eAAO,MAAM,oBAAoB,aAAa,CAAC;AAE/C,mNAAmN;AACnN,eAAO,MAAM,0BAA0B,aAAa,CAAC;AAErD,4OAA4O;AAC5O,eAAO,MAAM,mBAAmB,aAAa,CAAC;AAE9C,oKAAoK;AACpK,eAAO,MAAM,4BAA4B,aAAa,CAAC;AAEvD,6LAA6L;AAC7L,eAAO,MAAM,wBAAwB,aAAa,CAAC;AAEnD,kHAAkH;AAClH,eAAO,MAAM,oBAAoB,aAAa,CAAC;AAE/C,4HAA4H;AAC5H,eAAO,MAAM,6BAA6B,aAAa,CAAC"}
|
package/dist/release-floors.js
CHANGED
|
@@ -19,15 +19,29 @@
|
|
|
19
19
|
* this constant to the next patch (#4501). The check fails while a floor
|
|
20
20
|
* still names this constant after its version shipped.
|
|
21
21
|
*/
|
|
22
|
-
export const NEXT_RELEASE = "0.124.
|
|
22
|
+
export const NEXT_RELEASE = "0.124.81";
|
|
23
|
+
/** The first chant whose terraform lexicon's `terraform-apply` reads take `dir` and `workspace`, and read an upstream with `resolveRoot`'s binary and `readEnv` (terragucci issue 1303). */
|
|
24
|
+
export const TERRAFORM_APPLY_INSTANCE_READS_FLOOR = "0.124.80";
|
|
25
|
+
/** The first chant whose terraform lexicon's `terraform-apply` takes `binary`, and `terraformApplyCapabilityWith({ resolveRoot })` gives each root its own binary (terragucci issue 1303). */
|
|
26
|
+
export const TERRAFORM_APPLY_ROOT_BINARY_FLOOR = "0.124.80";
|
|
27
|
+
/** The first chant whose op wave hands a step's capability the wave's `cwd` (`DeployContext.cwd`), where `terraform-apply` looks for `chant.config.*` and `terragrunt-apply` runs when the step names neither (#4854). */
|
|
28
|
+
export const OP_WAVE_STEP_CWD_FLOOR = "0.124.80";
|
|
29
|
+
/** The first chant whose terraform lexicon's `terraform-apply` takes `workspace`: init in `default`, then `workspace select -or-create=true`, and plan, apply and output in it (#4854). */
|
|
30
|
+
export const TERRAFORM_APPLY_WORKSPACE_FLOOR = "0.124.80";
|
|
23
31
|
/** The first chant whose change-set member can carry `outputs`, the outputs its plan changes, and counts a member with any as a change (#4849). */
|
|
24
|
-
export const CHANGE_SET_OUTPUTS_FLOOR =
|
|
32
|
+
export const CHANGE_SET_OUTPUTS_FLOOR = "0.124.79";
|
|
25
33
|
/** The first chant whose terraform lexicon's `terragruntApplyCapability` takes `resolveUnit` and plans a wave as one `run --all` per pair of pinned releases (#4849). */
|
|
26
|
-
export const TERRAGRUNT_UNIT_PINS_FLOOR =
|
|
34
|
+
export const TERRAGRUNT_UNIT_PINS_FLOOR = "0.124.79";
|
|
27
35
|
/** The first chant whose sql lexicon's `yodelCommitSpec("new", ...)` takes `envs`, so `--replace-own` reads those histories as the reader (#4815). */
|
|
28
36
|
export const YODEL_NEW_ENVS_FLOOR = "0.124.78";
|
|
29
37
|
/** The first chant whose sql lexicon's `yodelRefusalReply` reads yodel rebase's conflict refusal as yodel prints it, `<a> and the migrations after <p> up to <b>` or `<a> and the chain ending at <b>` (#4821). */
|
|
30
38
|
export const YODEL_CONFLICT_REPLY_FLOOR = "0.124.78";
|
|
39
|
+
/** The first chant with `@intentius/chant/ci-note-commands`, `chant components pr-notes` and the GitLab pipeline's `note-commands` job (`--note-commands`), and whose forge reads answer `branchRuns` and `pullRequestsUpdated` (#4785). */
|
|
40
|
+
export const NOTE_COMMANDS_FLOOR = "0.124.80";
|
|
41
|
+
/** The first chant whose forge reads answer `compare`, `job` and, on GitLab, `artifactFile`, and whose `RunJob` names its `run`, `ref`, `tag` and `url` (#4862). */
|
|
42
|
+
export const PR_FORGE_COMPARE_READS_FLOOR = "0.124.80";
|
|
43
|
+
/** The first chant whose forge reads answer `headRuns`, `run`, `runJobs` and `artifacts`: a head's workflow runs (GitLab's pipelines), a run, its jobs and its artifacts by name (#4846). */
|
|
44
|
+
export const PR_FORGE_RUN_READS_FLOOR = "0.124.80";
|
|
31
45
|
/** The first chant whose `@intentius/chant/pr-forge-reads` exports the forge reads beside the clients (#4809). */
|
|
32
46
|
export const PR_FORGE_READS_FLOOR = "0.124.78";
|
|
33
47
|
/** The first chant whose GitLab `scheduledRuns` takes `schedule`, the selector of an Op's `gitlab.scheduleRule` (#4813). */
|