package-registry-manager 0.22.8 → 0.22.10

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/src/cli.mjs CHANGED
@@ -1,548 +1,29 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { readFileSync } from "node:fs";
4
- import { stat } from "node:fs/promises";
5
- import path from "node:path";
6
- import process from "node:process";
7
- import { parseArgs } from "node:util";
8
-
9
- import { launchChannels } from "./browser-catalogue.mjs";
10
- import { parseBrowserOptions } from "./browser-options.mjs";
11
3
  import { isDirectExecution } from "./direct-execution.mjs";
12
- import { inspectReference } from "./bootstrap-reference.mjs";
13
- import { inspectRepository } from "./discovery.mjs";
14
- import { parseRegistry } from "./model.mjs";
15
- import { buildPlans } from "./plan.mjs";
16
- import { probeEnvironment, renderPrerequisites } from "./prerequisites.mjs";
17
- import { probeRegistryState } from "./registry-state.mjs";
18
- import {
19
- BROWSER_MODES,
20
- defaultBrowserProfile,
21
- executePlans,
22
- } from "./setup.mjs";
23
- import { importSources } from "./sign-in-import.mjs";
24
- import { accountCommand } from "./organization-setup.mjs";
4
+ import { supportsNode, nodeRequirement } from "./node-version.mjs";
25
5
 
26
6
  export { isDirectExecution };
27
7
 
28
- const HELP = `Usage: package-registry-manager-js [global options] <command>
29
-
30
- Commands:
31
- inspect Discover supported package manifests
32
- plan [--registry <registry>] Print ordered setup plans
33
- setup --registry <registry> Bootstrap or attach trusted publishing
34
- setup --all Set up every publishable package in one session
35
-
36
- Global options:
37
- -h, --help Print this help
38
- -V, --version Print the version
39
- --repository <path> Repository to inspect (default: .)
40
- --org <org> | --user <login> Scan repositories through gh-manager
41
- --secret-name <template> Secret name; supports {REGISTRY}, {REPO}, {ORG}
42
- --format <text|json> Output format (default: text)
43
- --offline Do not look up packages on registries
44
- --verbose Print command details and output, and
45
- list the manifests inspection skipped
46
-
47
- Plan and setup options:
48
- --verify-release Also watch the release workflow and confirm
49
- that the next version has provenance
50
- --workflow <file> Trusted-publisher workflow file in
51
- .github/workflows, when detection finds
52
- several or the wrong one
53
- --add-publish-job Propose missing publishing jobs in a draft PR;
54
- --workflow chooses its target file
55
- --environment <name> GitHub environment of the trusted publisher
56
- --ref <branch|pr> Bootstrap a pushed branch or PR head before merge
57
- --package <name> Plan only this package, or select it for
58
- setup when a registry has several
59
-
60
- Setup options:
61
- --dry-run Print the flow without running it (default)
62
- --execute Run the flow and open a visible browser
63
- --yes Confirm publishing, secret changes, and
64
- form submission in advance
65
- --no-browser Print the setup URL instead
66
- --open-with <app> Open sign-in and approval pages in this
67
- application instead of the default browser,
68
- such as "Google Chrome" (macOS) or firefox
69
- --manual crates.io: create, use, and revoke the
70
- first-publish token by hand instead of
71
- through the crates.io API
72
- --keep-session Stay signed in after setup: npm keeps its
73
- session token in npm's user configuration
74
- until npm logout; crates.io keeps only the
75
- automated profile's browser session
76
- --browser <default|automated> Open sign-in and approval pages in your
77
- default browser, or in the automated
78
- profile too (default: default)
79
- --browser-channel <channel> Installed browser channel (default: chrome):
80
- ${launchChannels().join(", ")}
81
- --browser-executable <path> Installed browser executable to launch
82
- instead of the channel's
83
- --browser-profile <path> Dedicated automation profile, used to fill
84
- forms (default: per-user state directory)
85
- --browser-import <browser>[:<profile>]|default|auto
86
- Copy data from your installed browser profile:
87
- ${importSources().join(", ")}
88
- into the automated profile; default takes the
89
- system default browser, auto the first
90
- browser signed in to the registry
91
- --browser-import-scope <full|domains>
92
- Import the whole profile, or only the
93
- registry's sign-in cookies (default: full
94
- for a named browser, domains otherwise)
95
- --browser-attach <mode> Fill forms in your own browser instead:
96
- snapshot[:<profile>] launches a temporary
97
- copy of your profile, extension drives your
98
- running browser through the Browser
99
- Commander extension
100
- --browser-pref <key=value> Browser preference for the automated
101
- profile, such as intl.accept_languages=en;
102
- may be repeated
103
- --browser-restriction <name> Launch restriction or preset, such as
104
- no-extensions; may be repeated
105
- `;
8
+ // Dynamic import keeps Node 22-only dependencies behind the runtime check.
9
+ const supported = supportsNode(process.versions.node);
10
+ const implementation = supported ? await import("./cli-main.mjs") : null;
106
11
 
107
12
  export async function main(args = process.argv.slice(2)) {
108
- const { values, positionals } = parseArgs({
109
- args,
110
- allowPositionals: true,
111
- strict: true,
112
- options: {
113
- ref: { type: "string" },
114
- repository: { type: "string", default: "." },
115
- org: { type: "string" },
116
- user: { type: "string" },
117
- "secret-name": { type: "string" },
118
- format: { type: "string", default: "text" },
119
- verbose: { type: "boolean", default: false },
120
- offline: { type: "boolean", default: false },
121
- "verify-release": { type: "boolean", default: false },
122
- workflow: { type: "string" },
123
- "add-publish-job": { type: "boolean", default: false },
124
- environment: { type: "string" },
125
- "dry-run": { type: "boolean", default: false },
126
- registry: { type: "string", multiple: true },
127
- package: { type: "string" },
128
- execute: { type: "boolean", default: false },
129
- all: { type: "boolean", default: false },
130
- yes: { type: "boolean", default: false },
131
- "no-browser": { type: "boolean", default: false },
132
- "open-with": { type: "string" },
133
- "keep-session": { type: "boolean", default: false },
134
- manual: { type: "boolean", default: false },
135
- browser: { type: "string", default: "default" },
136
- "browser-channel": { type: "string", default: "chrome" },
137
- "browser-profile": { type: "string" },
138
- "browser-executable": { type: "string" },
139
- "browser-import": { type: "string" },
140
- "browser-import-scope": { type: "string" },
141
- "browser-attach": { type: "string" },
142
- "browser-pref": { type: "string", multiple: true },
143
- "browser-restriction": { type: "string", multiple: true },
144
- help: { type: "boolean", short: "h", default: false },
145
- version: { type: "boolean", short: "V", default: false },
146
- },
147
- });
148
- if (values.help) {
149
- process.stdout.write(HELP);
150
- return;
151
- }
152
- if (values.version) {
153
- process.stdout.write(`package-registry-manager ${packageVersion()}\n`);
154
- return;
155
- }
156
- if (positionals.length !== 1) {
157
- throw new Error("expected exactly one command: inspect, plan, or setup");
158
- }
159
- if (!["text", "json"].includes(values.format)) {
160
- throw new Error("--format must be 'text' or 'json'");
161
- }
162
- if (!BROWSER_MODES.includes(values.browser)) {
163
- throw new Error("--browser must be 'default' or 'automated'");
164
- }
165
- const browserOptions = parseBrowserOptions({
166
- channel: values["browser-channel"],
167
- executable: values["browser-executable"],
168
- importFrom: values["browser-import"],
169
- importScope: values["browser-import-scope"],
170
- attach: values["browser-attach"],
171
- preferences: values["browser-pref"],
172
- restrictions: values["browser-restriction"],
173
- profileGiven: values["browser-profile"] !== undefined,
174
- });
175
-
176
- const repository = path.resolve(values.repository);
177
- const command = positionals[0];
178
- if (values.org || values.user) {
179
- if (values.org && values.user) {
180
- throw new Error("--org and --user are mutually exclusive");
181
- }
182
- if (values.repository !== "." || values.ref) {
183
- throw new Error("account scans cannot use --repository or --ref");
184
- }
185
- if (!["inspect", "plan", "setup"].includes(command)) {
186
- throw new Error(`unknown command '${command}'`);
187
- }
188
- if (command === "setup" && (!values.all || values.package)) {
189
- throw new Error("account setup requires --all without --package");
190
- }
191
- if (values["dry-run"] && values.execute) {
192
- throw new Error("--dry-run and --execute are mutually exclusive");
193
- }
194
- if (values.yes && !values.execute) {
195
- throw new Error("--yes requires --execute");
196
- }
197
- if (values["no-browser"] && !values.execute) {
198
- throw new Error("--no-browser requires --execute");
199
- }
200
- if (values["open-with"] !== undefined && values["no-browser"]) {
201
- throw new Error("--open-with and --no-browser are mutually exclusive");
202
- }
203
- if (!browserOptions.attach) {
204
- browserOptions.import ??= { browser: "auto", profile: null };
205
- }
206
- return accountCommand(
207
- command,
208
- {
209
- org: values.org,
210
- user: values.user,
211
- format: values.format,
212
- offline: values.offline,
213
- verbose: values.verbose,
214
- registries: (values.registry ?? []).map(parseRegistry),
215
- execute: values.execute,
216
- yes: values.yes,
217
- noBrowser: values["no-browser"],
218
- secretName: values["secret-name"],
219
- package: values.package,
220
- browser: values.browser,
221
- browserOptions,
222
- browserProfile: path.resolve(
223
- values["browser-profile"] ??
224
- defaultBrowserProfile({ channel: browserOptions.channel }),
225
- ),
226
- openWith: nonEmpty(values["open-with"], "--open-with"),
227
- keepSession: values["keep-session"],
228
- planOptions: {
229
- workflow: values.workflow,
230
- publisherEnvironment: values.environment,
231
- addPublishJob: values["add-publish-job"],
232
- manual: values.manual,
233
- verifyRelease: values["verify-release"],
234
- },
235
- },
236
- outputPlans,
237
- );
238
- }
239
- const discovered = values.ref
240
- ? await inspectReference(repository, values.ref, {
241
- includeSkipped: values.verbose,
242
- })
243
- : await inspectRepository(repository, { includeSkipped: values.verbose });
244
- const inspection = values.offline
245
- ? discovered
246
- : await probeRegistryState(discovered, { verbose: values.verbose });
247
- if (command === "inspect") {
248
- outputInspection(inspection, values.format);
249
- return;
250
- }
251
-
252
- const registries = (values.registry ?? []).map(parseRegistry);
253
- if (!["plan", "setup"].includes(command)) {
254
- throw new Error(`unknown command '${command}'`);
255
- }
256
- const environment = await probeEnvironment({
257
- offline: values.offline,
258
- verbose: values.verbose,
259
- python: inspection.packages.some(
260
- (item) =>
261
- item.registry === "pypi" &&
262
- item.publishable &&
263
- (registries.length === 0 || registries.includes("pypi")),
264
- ),
265
- npm: inspection.packages.some(
266
- (item) =>
267
- item.registry === "npm" &&
268
- item.publishable &&
269
- (registries.length === 0 || registries.includes("npm")),
270
- ),
271
- });
272
- const planOptions = {
273
- ref: values.ref,
274
- verifyRelease: values["verify-release"],
275
- manual: values.manual,
276
- workflow: await workflowOverride(
277
- repository,
278
- values.workflow,
279
- values["add-publish-job"],
280
- ),
281
- addPublishJob: values["add-publish-job"],
282
- publisherEnvironment: nonEmpty(values.environment, "--environment"),
283
- environment,
284
- browser: browserSummary(command, values, browserOptions),
285
- };
286
- if (command === "plan") {
287
- const plans = filterPlans(
288
- buildPlans(inspection, registries, planOptions),
289
- values.package,
290
- );
291
- outputPlans(plans, values.format);
292
- return;
293
- }
294
- if (values.all && values.package) {
295
- throw new Error("--all and --package are mutually exclusive");
13
+ if (!supported) {
14
+ throw new Error(nodeRequirement(process.versions.node));
296
15
  }
297
- if (!values.all && registries.length !== 1) {
298
- throw new Error("setup requires exactly one --registry <registry>");
299
- }
300
- if (values["dry-run"] && values.execute) {
301
- throw new Error("--dry-run and --execute are mutually exclusive");
302
- }
303
- if (values.yes && !values.execute) {
304
- throw new Error("--yes requires --execute");
305
- }
306
- if (values["no-browser"] && !values.execute) {
307
- throw new Error("--no-browser requires --execute");
308
- }
309
- if (values["open-with"] !== undefined && values["no-browser"]) {
310
- throw new Error("--open-with and --no-browser are mutually exclusive");
311
- }
312
-
313
- const plans = buildPlans(inspection, registries, planOptions);
314
- const selected = values.all
315
- ? plans.filter((plan) => plan.package.publishable)
316
- : [selectPlan(plans, values.package)];
317
- outputPlans(selected, values.format);
318
- await executePlans(
319
- selected,
320
- {
321
- inspection,
322
- workflow: planOptions.workflow,
323
- publisherEnvironment: planOptions.publisherEnvironment,
324
- repository,
325
- execute: values.execute,
326
- yes: values.yes,
327
- noBrowser: values["no-browser"],
328
- openWith: nonEmpty(values["open-with"], "--open-with"),
329
- keepSession: values["keep-session"],
330
- secretName: values["secret-name"],
331
- quietBrowser: selected.some((plan) =>
332
- plan.steps.some((step) => step.id === "manage-registry-token"),
333
- ),
334
- browser: values.browser,
335
- browserOptions,
336
- browserProfile: path.resolve(
337
- values["browser-profile"] ??
338
- defaultBrowserProfile({ channel: browserOptions.channel }),
339
- ),
340
- verbose: values.verbose,
341
- verifyRelease: values["verify-release"],
342
- },
343
- values.all,
344
- );
345
- }
346
-
347
- async function workflowOverride(repository, workflow, adding = false) {
348
- if (workflow === undefined) {
349
- return undefined;
350
- }
351
- if (!/^[\w.-]+\.ya?ml$/.test(workflow)) {
352
- throw new Error(
353
- "--workflow must be a workflow file name in .github/workflows, such as release.yml",
354
- );
355
- }
356
- const file = path.join(repository, ".github/workflows", workflow);
357
- const found = await stat(file).then(
358
- (metadata) => metadata.isFile(),
359
- () => false,
360
- );
361
- if (!found && !adding) {
362
- throw new Error(`--workflow: .github/workflows/${workflow} does not exist`);
363
- }
364
- return workflow;
365
- }
366
-
367
- function nonEmpty(value, option) {
368
- if (value !== undefined && !value.trim()) {
369
- throw new Error(`${option} must not be empty`);
370
- }
371
- return value?.trim();
372
- }
373
-
374
- function browserSummary(command, values, browserOptions) {
375
- if (command === "setup" && values["no-browser"]) {
376
- return { mode: "none" };
377
- }
378
- if (command !== "setup") {
379
- return { mode: "default", channel: values["browser-channel"] };
380
- }
381
- return {
382
- mode: values.browser,
383
- channel: browserOptions.channel,
384
- profile:
385
- values.browser === "automated" && !browserOptions.attach
386
- ? path.resolve(
387
- values["browser-profile"] ??
388
- defaultBrowserProfile({ channel: browserOptions.channel }),
389
- )
390
- : undefined,
391
- import: browserOptions.import ?? undefined,
392
- attach: browserOptions.attach ?? undefined,
393
- };
394
- }
395
-
396
- /** Keeps the plans of `packageName`, or every plan without one. */
397
- function filterPlans(plans, packageName) {
398
- if (plans.length === 0) {
399
- throw new Error("no matching package manifests were found");
400
- }
401
- if (!packageName) {
402
- return plans;
403
- }
404
- const named = plans.filter((plan) => plan.package.name === packageName);
405
- if (named.length === 0) {
406
- throw new Error(`package '${packageName}' was not found`);
407
- }
408
- return named;
409
- }
410
-
411
- function selectPlan(plans, packageName) {
412
- if (packageName) {
413
- const plan = plans.find(
414
- (candidate) => candidate.package.name === packageName,
415
- );
416
- if (!plan) {
417
- throw new Error(
418
- `package '${packageName}' was not found for this registry`,
419
- );
420
- }
421
- return plan;
422
- }
423
- if (plans.length === 0) {
424
- throw new Error("no matching package manifests were found");
425
- }
426
- const publishable = plans.filter((plan) => plan.package.publishable);
427
- const candidates = publishable.length > 0 ? publishable : plans;
428
- if (candidates.length > 1) {
429
- throw new Error(
430
- "multiple packages use this registry; select one with --package <name>",
431
- );
432
- }
433
- return candidates[0];
434
- }
435
-
436
- function outputInspection(inspection, format) {
437
- if (format === "json") {
438
- process.stdout.write(`${JSON.stringify(inspection, null, 2)}\n`);
439
- return;
440
- }
441
- process.stdout.write(`Repository: ${inspection.repository.root}\n`);
442
- if (inspection.packages.length === 0) {
443
- process.stdout.write("No supported package manifests found.\n");
444
- }
445
- for (const packageInfo of inspection.packages) {
446
- const details = [
447
- packageInfo.manifest,
448
- packageInfo.publishable ? "publishable" : "not publishable",
449
- ];
450
- if (packageInfo.exists_on_registry !== undefined) {
451
- details.push(
452
- packageInfo.exists_on_registry ? "published" : "not published yet",
453
- );
454
- }
455
- if (packageInfo.trusted_publishing) {
456
- details.push("trusted publishing");
457
- }
458
- process.stdout.write(
459
- `- ${packageInfo.registry}: ${packageInfo.name} (${details.join(", ")})\n`,
460
- );
461
- if (packageInfo.workflow && packageInfo.publishable) {
462
- process.stdout.write(` workflow: ${publisherSummary(packageInfo)}\n`);
463
- }
464
- for (const warning of packageInfo.warnings ?? []) {
465
- process.stdout.write(` warning: ${warning}\n`);
466
- }
467
- }
468
- for (const item of inspection.skipped ?? []) {
469
- process.stdout.write(`skipped ${item.manifest}: ${item.reason}\n`);
470
- }
471
- }
472
-
473
- function publisherSummary({ workflow, workflow_jobs, environment }) {
474
- const details = [];
475
- if (workflow_jobs?.length) {
476
- details.push(
477
- `${workflow_jobs.length > 1 ? "jobs" : "job"} ${workflow_jobs.join(", ")}`,
478
- );
479
- }
480
- if (environment) {
481
- details.push(`environment ${environment}`);
482
- }
483
- return details.length > 0 ? `${workflow} (${details.join("; ")})` : workflow;
484
- }
485
-
486
- function outputPlans(plans, format) {
487
- if (format === "json") {
488
- process.stdout.write(`${JSON.stringify(plans, null, 2)}\n`);
489
- return;
490
- }
491
- for (const plan of plans) {
492
- const mode = plan.mode ? ` (${plan.mode})` : "";
493
- process.stdout.write(`${plan.registry}: ${plan.package.name}${mode}\n`);
494
- process.stdout.write(
495
- ` credentials: ${plan.credential_policy.description}\n`,
496
- );
497
- if (plan.mode === "complete") {
498
- process.stdout.write(" trusted publishing is already in use\n");
499
- }
500
- if (plan.skipped_reason) {
501
- process.stdout.write(` skipped: ${plan.skipped_reason}\n`);
502
- }
503
- if (plan.trusted_publisher) {
504
- process.stdout.write(
505
- ` trusted publisher: ${publisherSummary({
506
- ...plan.package,
507
- workflow: plan.trusted_publisher.workflow,
508
- environment: plan.trusted_publisher.environment,
509
- workflow_jobs:
510
- plan.trusted_publisher.workflow === plan.package.workflow
511
- ? plan.package.workflow_jobs
512
- : undefined,
513
- })}\n`,
514
- );
515
- }
516
- for (const warning of plan.package.warnings ?? []) {
517
- process.stdout.write(` warning: ${warning}\n`);
518
- }
519
- for (const line of renderPrerequisites(plan.prerequisites ?? [])) {
520
- process.stdout.write(`${line}\n`);
521
- }
522
- plan.steps.forEach((step, index) => {
523
- const when = step.when ? ` [when ${step.when}]` : "";
524
- process.stdout.write(` ${index + 1}. ${step.title}${when}\n`);
525
- if (step.command) {
526
- const cwd = step.cwd && step.cwd !== "." ? `(in ${step.cwd}) ` : "";
527
- process.stdout.write(
528
- ` $ ${cwd}${step.command.program} ${step.command.args.join(" ")}\n`,
529
- );
530
- }
531
- if (step.url) {
532
- process.stdout.write(` ${step.url}\n`);
533
- }
534
- });
535
- }
536
- }
537
-
538
- function packageVersion() {
539
- const manifest = new URL("../package.json", import.meta.url);
540
- return JSON.parse(readFileSync(manifest, "utf8")).version;
16
+ return implementation.main(args);
541
17
  }
542
18
 
543
19
  if (isDirectExecution(import.meta.url, process.argv[1])) {
544
- main().catch((error) => {
545
- process.stderr.write(`error: ${error.message}\n`);
20
+ if (!supported) {
21
+ process.stderr.write(`${nodeRequirement(process.versions.node)}\n`);
546
22
  process.exitCode = 1;
547
- });
23
+ } else {
24
+ main().catch((error) => {
25
+ process.stderr.write(`error: ${error.message}\n`);
26
+ process.exitCode = 1;
27
+ });
28
+ }
548
29
  }
@@ -0,0 +1,53 @@
1
+ import { exec } from "command-stream";
2
+
3
+ async function github(args) {
4
+ try {
5
+ const result = await exec("gh", args, {
6
+ capture: true,
7
+ mirror: false,
8
+ stdin: "ignore",
9
+ });
10
+ if (result.code !== 0) {
11
+ return undefined;
12
+ }
13
+ const output = String(result.stdout ?? "").trim();
14
+ return args[0] === "api" ? JSON.parse(output) : output;
15
+ } catch {
16
+ return undefined;
17
+ }
18
+ }
19
+
20
+ /** Prefer the checkout's organization or a sole membership, then the signed-in user. */
21
+ export async function defaultScope(options = {}) {
22
+ if (options.repository !== undefined || options.ref || options.offline) {
23
+ return {};
24
+ }
25
+ const run = options.run ?? github;
26
+ const slug = await run([
27
+ "repo",
28
+ "view",
29
+ "--json",
30
+ "nameWithOwner",
31
+ "--jq",
32
+ ".nameWithOwner",
33
+ ]);
34
+ if (typeof slug === "string" && /^[\w.-]+\/[\w.-]+$/.test(slug)) {
35
+ const repository = await run(["api", `repos/${slug}`]);
36
+ if (repository?.owner?.type === "Organization") {
37
+ return { org: repository.owner.login };
38
+ }
39
+ }
40
+ const orgs = await run([
41
+ "api",
42
+ "user/orgs",
43
+ "--paginate",
44
+ "--slurp",
45
+ "--jq",
46
+ "flatten",
47
+ ]);
48
+ if (Array.isArray(orgs) && orgs.length === 1) {
49
+ return { org: orgs[0].login };
50
+ }
51
+ const user = await run(["api", "user"]);
52
+ return user?.login ? { user: user.login } : {};
53
+ }
package/src/discovery.mjs CHANGED
@@ -92,7 +92,15 @@ export async function inspectRepository(repository, options = {}) {
92
92
  return await parseManifest(manifestPath, manifest);
93
93
  } catch (error) {
94
94
  if (testDirectory(manifest) === null) {
95
- throw error;
95
+ if (!options.onError) {
96
+ throw error;
97
+ }
98
+ options.onError({
99
+ stage: "manifest",
100
+ manifest,
101
+ message: error.message,
102
+ });
103
+ return null;
96
104
  }
97
105
  return { manifest, publishable: false, invalid: true };
98
106
  }
package/src/flows.mjs CHANGED
@@ -1,3 +1,4 @@
1
+ import { RELEASE_RUN_FIELDS } from "./release-runs.mjs";
1
2
  import { credentialSteps } from "./credential-cycle.mjs";
2
3
  import { DEFAULT_TRUST_NPM, NPM_TFA_URL } from "./prerequisites.mjs";
3
4
  import {
@@ -186,9 +187,9 @@ function releaseRunSteps(context) {
186
187
  return [
187
188
  step(
188
189
  "inspect-release-run",
189
- "Read the latest release run",
190
+ "Read the failed default-branch release run",
190
191
  "check",
191
- "Look up the newest run of the release workflow; a run that npm rejected can be re-run once trust is attached.",
192
+ "Check push and workflow_dispatch runs on the default branch and prefer the newest failed publish or preflight job.",
192
193
  {
193
194
  command: command("gh", [
194
195
  "run",
@@ -196,10 +197,14 @@ function releaseRunSteps(context) {
196
197
  ...repo,
197
198
  "--workflow",
198
199
  context.workflow,
200
+ "--branch",
201
+ "{default_branch}",
202
+ "--event",
203
+ "push",
199
204
  "--limit",
200
- "1",
205
+ "100",
201
206
  "--json",
202
- "databaseId,conclusion,status,url",
207
+ RELEASE_RUN_FIELDS,
203
208
  ]),
204
209
  when: "trust-missing",
205
210
  cwd: ".",
@@ -209,7 +214,7 @@ function releaseRunSteps(context) {
209
214
  "read-release-failure",
210
215
  "Read why the release run failed",
211
216
  "check",
212
- "Search the failed jobs' log for npm's E404 or invalid-publisher rejection.",
217
+ "Read the selected run's failed jobs for trusted-publishing or OIDC exchange rejection.",
213
218
  {
214
219
  command: command("gh", [
215
220
  "run",
@@ -0,0 +1,14 @@
1
+ /** Minimum runtime for the CLI and its GitHub dependencies. */
2
+ export const NODE_ENGINES = ">=22.12.0";
3
+
4
+ export function supportsNode(version) {
5
+ const [major, minor] = String(version)
6
+ .replace(/^v/, "")
7
+ .split(".")
8
+ .map(Number);
9
+ return major > 22 || (major === 22 && minor >= 12);
10
+ }
11
+
12
+ export function nodeRequirement(version) {
13
+ return `package-registry-manager needs Node.js 22.12 or newer (found ${version})`;
14
+ }