@theholocron/cli 5.0.0-alpha.564 → 5.0.0-alpha.566
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.mjs +698 -379
- package/dist/cli.mjs.map +1 -1
- package/dist/index.d.mts +26 -1
- package/dist/index.mjs +7 -1
- package/package.json +7 -7
package/dist/cli.mjs
CHANGED
|
@@ -107,6 +107,7 @@ const COMMAND_CONTEXTS = {
|
|
|
107
107
|
"reconcile ci": "workspace",
|
|
108
108
|
"reconcile project": "workspace",
|
|
109
109
|
"redeliver webhooks": "workspace",
|
|
110
|
+
"rotate tokens": "workspace",
|
|
110
111
|
"doctor all": "workspace",
|
|
111
112
|
"doctor notifications": "workspace",
|
|
112
113
|
"doctor environments": "workspace",
|
|
@@ -1602,7 +1603,7 @@ const projectReconcileEntry = {
|
|
|
1602
1603
|
// src/commands/provider/provider.entry.ts
|
|
1603
1604
|
const providerEntry = {
|
|
1604
1605
|
name: "provider",
|
|
1605
|
-
description: "List the providers that have their own setup, doctor, whoami or
|
|
1606
|
+
description: "List the providers that have their own setup, doctor, whoami, token or revoke (`provider <name> setup|doctor|whoami|token|revoke` runs one)",
|
|
1606
1607
|
positionals: [],
|
|
1607
1608
|
skipOptions: [
|
|
1608
1609
|
"yes",
|
|
@@ -1764,6 +1765,20 @@ const requestsExportEntry = {
|
|
|
1764
1765
|
],
|
|
1765
1766
|
supportsDryRun: true
|
|
1766
1767
|
};
|
|
1768
|
+
// src/commands/rotate-tokens/rotate-tokens.entry.ts
|
|
1769
|
+
const rotateTokensEntry = {
|
|
1770
|
+
name: "rotate tokens",
|
|
1771
|
+
description: "Replace the tokens `doctor tokens` reports as due, for the providers that can make one",
|
|
1772
|
+
positionals: [],
|
|
1773
|
+
options: [{
|
|
1774
|
+
key: "env",
|
|
1775
|
+
flag: "--env",
|
|
1776
|
+
type: "input",
|
|
1777
|
+
message: "Only this layer (local, dev, ci, prod or preview; blank for all):"
|
|
1778
|
+
}],
|
|
1779
|
+
skipOptions: ["yes"],
|
|
1780
|
+
supportsDryRun: true
|
|
1781
|
+
};
|
|
1767
1782
|
// src/commands/run/run-ci.entry.ts
|
|
1768
1783
|
/** The options of `run` that the menu does not offer; the entries it builds for each task share this (`run ci` also offers `--all`). */
|
|
1769
1784
|
const RUN_SKIP_OPTIONS = [
|
|
@@ -2459,7 +2474,8 @@ const registry = createCommandRegistry([
|
|
|
2459
2474
|
projectStatusEntry,
|
|
2460
2475
|
projectReconcileEntry,
|
|
2461
2476
|
reconcileCiEntry,
|
|
2462
|
-
redeliverWebhooksEntry
|
|
2477
|
+
redeliverWebhooksEntry,
|
|
2478
|
+
rotateTokensEntry
|
|
2463
2479
|
], "interactive-menu");
|
|
2464
2480
|
/** Every Holocron command, in menu order: what {@link launchMenu} lists and what a leaf handler's prompt reads. */
|
|
2465
2481
|
const COMMAND_REGISTRY = registry.entries;
|
|
@@ -4208,6 +4224,30 @@ var PluginLoader = class extends system.PluginLoader {
|
|
|
4208
4224
|
for (const [provider, plugin] of this.plugins()) if (plugin.mintToken) found.set(provider, plugin.mintToken);
|
|
4209
4225
|
return found;
|
|
4210
4226
|
}
|
|
4227
|
+
/** The `revokeToken` each loaded provider offers, by provider name. A provider that cannot delete a token is left out. */
|
|
4228
|
+
revokeTokens() {
|
|
4229
|
+
const found = /* @__PURE__ */ new Map();
|
|
4230
|
+
for (const [provider, plugin] of this.plugins()) if (plugin.revokeToken) found.set(provider, plugin.revokeToken);
|
|
4231
|
+
return found;
|
|
4232
|
+
}
|
|
4233
|
+
/**
|
|
4234
|
+
* Loads one provider by name with the given options, whether or not `holocron.config` names it under a capability,
|
|
4235
|
+
* and returns its `revokeToken` (`undefined` when it cannot delete one), leaving the capability registry alone.
|
|
4236
|
+
* Throws {@link WorkspaceContextError} when the provider's package cannot be imported here.
|
|
4237
|
+
*/
|
|
4238
|
+
async loadRevokeToken(provider, options) {
|
|
4239
|
+
const packageName = system.resolvePackage(provider);
|
|
4240
|
+
try {
|
|
4241
|
+
return (await this.loadProvider({
|
|
4242
|
+
provider,
|
|
4243
|
+
packageName,
|
|
4244
|
+
options
|
|
4245
|
+
})).revokeToken;
|
|
4246
|
+
} catch (err) {
|
|
4247
|
+
if (err instanceof LoaderError && err.message.startsWith("failed to import")) throw new WorkspaceContextError("provider", [packageName]);
|
|
4248
|
+
throw err;
|
|
4249
|
+
}
|
|
4250
|
+
}
|
|
4211
4251
|
/**
|
|
4212
4252
|
* Loads one provider by name with the given options, whether or not `holocron.config` names it under a capability,
|
|
4213
4253
|
* and returns its `mintToken` (`undefined` when it cannot make one), leaving the capability registry alone. Throws
|
|
@@ -4331,7 +4371,7 @@ function planIssueTypes(declared, existing, update) {
|
|
|
4331
4371
|
}
|
|
4332
4372
|
const WRITE_PERMISSION = "creating or changing issue Types needs an organization admin and the organization permission Issue types: write (HOLOCRON_ORG_TOKEN)";
|
|
4333
4373
|
const READ_PERMISSION = "reading the organization's issue Types needs the organization permission Issue types: read (HOLOCRON_ORG_TOKEN)";
|
|
4334
|
-
const row$
|
|
4374
|
+
const row$38 = (id, title, status, detail, problems = []) => ({
|
|
4335
4375
|
id: `issue-types:${id}`,
|
|
4336
4376
|
title,
|
|
4337
4377
|
status,
|
|
@@ -4351,7 +4391,7 @@ async function ensureIssueTypes(input) {
|
|
|
4351
4391
|
const refused = input.caller === "setup" ? "skip" : "fail";
|
|
4352
4392
|
const stop = (status, detail, problems = []) => ({
|
|
4353
4393
|
status,
|
|
4354
|
-
rows: [row$
|
|
4394
|
+
rows: [row$38("types", "issue types", status, detail, problems)],
|
|
4355
4395
|
created,
|
|
4356
4396
|
updated
|
|
4357
4397
|
});
|
|
@@ -4391,7 +4431,7 @@ async function ensureIssueTypes(input) {
|
|
|
4391
4431
|
default: false
|
|
4392
4432
|
})))(`Change the organization's issue Types?\n${todo.map((a) => ` ${describeAction(a).detail} ${a.declared.name}`).join("\n")}`)) return {
|
|
4393
4433
|
status: "cancelled",
|
|
4394
|
-
rows: [row$
|
|
4434
|
+
rows: [row$38("types", "issue types", "skip", "cancelled; nothing was changed")],
|
|
4395
4435
|
created,
|
|
4396
4436
|
updated
|
|
4397
4437
|
};
|
|
@@ -4406,34 +4446,34 @@ async function ensureIssueTypes(input) {
|
|
|
4406
4446
|
continue;
|
|
4407
4447
|
}
|
|
4408
4448
|
if (limited) {
|
|
4409
|
-
rows.push(row$
|
|
4449
|
+
rows.push(row$38(name, name, "skip", "left: stopped at a rate limit"));
|
|
4410
4450
|
continue;
|
|
4411
4451
|
}
|
|
4412
4452
|
if (refusedOnce) {
|
|
4413
|
-
rows.push(row$
|
|
4453
|
+
rows.push(row$38(name, name, refused, "not written: the token was refused"));
|
|
4414
4454
|
continue;
|
|
4415
4455
|
}
|
|
4416
4456
|
try {
|
|
4417
4457
|
if (action.kind === "create") {
|
|
4418
4458
|
await issues.createType(toDeclaration(action.declared));
|
|
4419
4459
|
created.push(name);
|
|
4420
|
-
rows.push(row$
|
|
4460
|
+
rows.push(row$38(name, name, "ok", "created"));
|
|
4421
4461
|
} else {
|
|
4422
4462
|
const patch = Object.fromEntries(action.changes.map((c) => [c.field, c.to]));
|
|
4423
4463
|
await issues.updateType?.(action.existing.id, patch);
|
|
4424
4464
|
updated.push(name);
|
|
4425
|
-
rows.push(row$
|
|
4465
|
+
rows.push(row$38(name, name, "ok", `updated ${action.changes.map((c) => c.field).join(", ")}`));
|
|
4426
4466
|
}
|
|
4427
4467
|
} catch (err) {
|
|
4428
4468
|
const kind = classifyTypeError(err);
|
|
4429
4469
|
if (kind === "rate-limit") {
|
|
4430
4470
|
limited = true;
|
|
4431
|
-
rows.push(row$
|
|
4471
|
+
rows.push(row$38(name, name, "fail", "rate limited: stopped; run it again to finish"));
|
|
4432
4472
|
} else if (kind === "refused") {
|
|
4433
4473
|
refusedOnce = true;
|
|
4434
|
-
rows.push(row$
|
|
4435
|
-
} else if (kind === "conflict" && action.kind === "create" && await nowExists(issues, name)) rows.push(row$
|
|
4436
|
-
else rows.push(row$
|
|
4474
|
+
rows.push(row$38(name, name, refused, WRITE_PERMISSION));
|
|
4475
|
+
} else if (kind === "conflict" && action.kind === "create" && await nowExists(issues, name)) rows.push(row$38(name, name, "ok", "exists (made in the meantime)"));
|
|
4476
|
+
else rows.push(row$38(name, name, "fail", describeError(err)));
|
|
4437
4477
|
}
|
|
4438
4478
|
}
|
|
4439
4479
|
return {
|
|
@@ -4454,12 +4494,12 @@ async function nowExists(issues, name) {
|
|
|
4454
4494
|
/** The row of an action that is not carried out (a dry run, or the list shown before asking), or that needs none. */
|
|
4455
4495
|
function describeAction(action) {
|
|
4456
4496
|
const name = action.declared.name;
|
|
4457
|
-
if (action.kind === "create") return row$
|
|
4497
|
+
if (action.kind === "create") return row$38(name, name, "skip", "would create");
|
|
4458
4498
|
if (action.kind === "update") {
|
|
4459
4499
|
const fields = action.changes.map((c) => c.field).join(", ");
|
|
4460
|
-
return row$
|
|
4500
|
+
return row$38(name, name, "skip", `would update ${fields}`, action.changes.map((c) => `${c.field}: was ${JSON.stringify(c.was)}, to ${JSON.stringify(c.to)}`));
|
|
4461
4501
|
}
|
|
4462
|
-
return row$
|
|
4502
|
+
return row$38(name, name, "ok", action.existing.enabled ? "exists" : "exists (turned off in the organization)");
|
|
4463
4503
|
}
|
|
4464
4504
|
// src/commands/notifications-channel-add/private-host.ts
|
|
4465
4505
|
/**
|
|
@@ -7207,7 +7247,7 @@ async function openBoardContext(input) {
|
|
|
7207
7247
|
};
|
|
7208
7248
|
}
|
|
7209
7249
|
// src/commands/issue-fields/add-issue-to-board/add-issue-to-board.ts
|
|
7210
|
-
const row$
|
|
7250
|
+
const row$37 = (board, status, detail) => ({
|
|
7211
7251
|
id: `board ${board}`,
|
|
7212
7252
|
title: `board ${board}`,
|
|
7213
7253
|
status,
|
|
@@ -7229,27 +7269,27 @@ async function addIssueToBoard(input) {
|
|
|
7229
7269
|
loader: input.loader,
|
|
7230
7270
|
...input.io ? { io: input.io } : {}
|
|
7231
7271
|
});
|
|
7232
|
-
if (!opened.ok) return row$
|
|
7272
|
+
if (!opened.ok) return row$37(board, opened.kind === "skip" ? "skip" : "fail", [opened.reason, ...opened.problems].join("; "));
|
|
7233
7273
|
const { projects, owner, boards, templates } = opened.context;
|
|
7234
|
-
if (!projects.addItems) return row$
|
|
7274
|
+
if (!projects.addItems) return row$37(board, "skip", `the \`${projects.providerName}\` provider cannot add items to a board`);
|
|
7235
7275
|
const declared = boards.find((b) => b.name.toLowerCase() === board.toLowerCase());
|
|
7236
7276
|
if (!declared) {
|
|
7237
7277
|
const names = boards.map((b) => b.name).join(", ");
|
|
7238
|
-
return row$
|
|
7278
|
+
return row$37(board, "fail", `no board named "${board}" is declared in providers.projects${names ? ` (declared: ${names})` : ""}`);
|
|
7239
7279
|
}
|
|
7240
7280
|
const template = templates[declared.template];
|
|
7241
|
-
if (!template) return row$
|
|
7281
|
+
if (!template) return row$37(board, "fail", `the template "${declared.template}" of "${declared.name}" is not available`);
|
|
7242
7282
|
const found = await projects.find(owner, declared.name);
|
|
7243
|
-
if (!found) return row$
|
|
7244
|
-
if (input.dryRun) return row$
|
|
7283
|
+
if (!found) return row$37(board, "fail", `the board "${declared.name}" does not exist yet; \`holocron setup project\` makes it`);
|
|
7284
|
+
if (input.dryRun) return row$37(board, "skip", `would add ${key} to "${declared.name}"`);
|
|
7245
7285
|
const [added] = await projects.addItems(owner, found, [{
|
|
7246
7286
|
key,
|
|
7247
7287
|
...input.priority ? { priority: input.priority } : {}
|
|
7248
7288
|
}], template);
|
|
7249
7289
|
const dropped = added?.dropped ?? [];
|
|
7250
|
-
return row$
|
|
7290
|
+
return row$37(board, dropped.length > 0 ? "skip" : "ok", `${added?.added ? "added" : "already on"} "${declared.name}"${dropped.length > 0 ? `; not set: ${dropped.join(", ")}` : ""}`);
|
|
7251
7291
|
} catch (err) {
|
|
7252
|
-
return row$
|
|
7292
|
+
return row$37(board, "fail", `could not add ${key} to the board: ${describeError(err)}`);
|
|
7253
7293
|
}
|
|
7254
7294
|
}
|
|
7255
7295
|
// src/commands/issue-fields/describe-issue-fields/describe-issue-fields.ts
|
|
@@ -7356,7 +7396,7 @@ function prepareIssueFields(input, areas) {
|
|
|
7356
7396
|
* asks first unless `--dry-run` or `--yes` (without a terminal it refuses instead). `update work` is another command,
|
|
7357
7397
|
* which spans the pull request and the board.
|
|
7358
7398
|
*/
|
|
7359
|
-
const row$
|
|
7399
|
+
const row$36 = (id, status, detail) => ({
|
|
7360
7400
|
id,
|
|
7361
7401
|
title: id,
|
|
7362
7402
|
status,
|
|
@@ -7382,7 +7422,7 @@ async function runIssueUpdate(input) {
|
|
|
7382
7422
|
print(style.header(`Holocron update issue${dryRun ? " (dry-run)" : ""}`));
|
|
7383
7423
|
print("");
|
|
7384
7424
|
const key = input.key.trim();
|
|
7385
|
-
if (!key) return finish([row$
|
|
7425
|
+
if (!key) return finish([row$36("key", "fail", "the issue key is empty")]);
|
|
7386
7426
|
const prepared = prepareIssueFields(input, input.loaded.resolved.repo?.labels?.areas);
|
|
7387
7427
|
const problems = prepared.ok ? [] : [...prepared.problems];
|
|
7388
7428
|
const clear = [...new Set(input.clear ?? [])];
|
|
@@ -7409,7 +7449,7 @@ async function runIssueUpdate(input) {
|
|
|
7409
7449
|
for (const label of addLabels) if (removeLabels.some((r) => r.toLowerCase() === label.toLowerCase())) problems.push(`the label "${label}" is both added and removed`);
|
|
7410
7450
|
const blockers = prepared.ok ? prepared.fields.blockedBy ?? [] : [];
|
|
7411
7451
|
for (const k of unblock) if (blockers.includes(k)) problems.push(`${k} is both added and removed as a blocker`);
|
|
7412
|
-
if (problems.length > 0 || !prepared.ok) return finish(problems.map((p) => row$
|
|
7452
|
+
if (problems.length > 0 || !prepared.ok) return finish(problems.map((p) => row$36(key, "fail", p)));
|
|
7413
7453
|
const patch = {
|
|
7414
7454
|
...prepared.fields,
|
|
7415
7455
|
...title ? { title } : {},
|
|
@@ -7435,10 +7475,10 @@ async function runIssueUpdate(input) {
|
|
|
7435
7475
|
...unblock.length > 0 ? [`unblock: ${unblock.join(", ")}`] : [],
|
|
7436
7476
|
...clear.length > 0 ? [`clear: ${clear.join(", ")}`] : []
|
|
7437
7477
|
];
|
|
7438
|
-
if (details.length === 0) return finish([row$
|
|
7478
|
+
if (details.length === 0) return finish([row$36(key, "fail", "nothing to change; name a field to set, or `--clear` one")]);
|
|
7439
7479
|
const summary = ` (${details.join("; ")})`;
|
|
7440
7480
|
const entry = input.loaded.resolved.providers.issues;
|
|
7441
|
-
if (!entry) return finish([row$
|
|
7481
|
+
if (!entry) return finish([row$36(key, "fail", "the config has no `issues` provider to update the issue with")]);
|
|
7442
7482
|
const credentials = input.loaded.resolved.providers.credentials;
|
|
7443
7483
|
const projects = prepared.project ? input.loaded.resolved.providers.projects : void 0;
|
|
7444
7484
|
/* v8 ignore start -- the real loader is only built outside tests, which always inject one */
|
|
@@ -7455,10 +7495,10 @@ async function runIssueUpdate(input) {
|
|
|
7455
7495
|
assertPluginsResolvable(loader, "update issue");
|
|
7456
7496
|
if (!loader.has("issues")) {
|
|
7457
7497
|
const failure = loader.loadFailures().find((f) => f.key === "issues");
|
|
7458
|
-
return finish([row$
|
|
7498
|
+
return finish([row$36(key, "fail", `the \`issues\` provider is not available${failure ? ` (${describeError(failure.error)})` : ""}`)]);
|
|
7459
7499
|
}
|
|
7460
7500
|
const issues = loader.get("issues");
|
|
7461
|
-
if (!issues.update) return finish([row$
|
|
7501
|
+
if (!issues.update) return finish([row$36(key, "fail", `the \`${issues.providerName}\` provider does not support \`update issue\``)]);
|
|
7462
7502
|
if (dryRun) {
|
|
7463
7503
|
const board = prepared.project ? await addIssueToBoard({
|
|
7464
7504
|
loaded: input.loaded,
|
|
@@ -7468,7 +7508,7 @@ async function runIssueUpdate(input) {
|
|
|
7468
7508
|
key,
|
|
7469
7509
|
dryRun: true
|
|
7470
7510
|
}) : void 0;
|
|
7471
|
-
return finish([row$
|
|
7511
|
+
return finish([row$36(key, "skip", `would update the issue${summary}`), ...board ? [board] : []]);
|
|
7472
7512
|
}
|
|
7473
7513
|
if (!input.yes) {
|
|
7474
7514
|
if (!(input.interactive ?? Boolean(process.stdin.isTTY))) throw new NonInteractiveError("`update issue` changes an issue; pass --yes to run it without asking, or --dry-run to preview");
|
|
@@ -7494,12 +7534,12 @@ async function runIssueUpdate(input) {
|
|
|
7494
7534
|
...prepared.fields.priority ? { priority: prepared.fields.priority } : {}
|
|
7495
7535
|
}) : void 0;
|
|
7496
7536
|
return finish([
|
|
7497
|
-
row$
|
|
7498
|
-
...(result.dropped ?? []).map((line) => row$
|
|
7537
|
+
row$36(result.key, "ok", result.changed.length > 0 ? `updated: ${result.changed.join("; ")}` : "already as asked; nothing changed"),
|
|
7538
|
+
...(result.dropped ?? []).map((line) => row$36("not carried across", "skip", line)),
|
|
7499
7539
|
...board ? [board] : []
|
|
7500
7540
|
], result.changed);
|
|
7501
7541
|
} catch (err) {
|
|
7502
|
-
return finish([row$
|
|
7542
|
+
return finish([row$36(key, "fail", `could not update the issue: ${describeError(err)}`)]);
|
|
7503
7543
|
}
|
|
7504
7544
|
}
|
|
7505
7545
|
// src/commands/start-work/find-worktree/find-worktree.ts
|
|
@@ -7539,7 +7579,7 @@ function unpushedCommits(git, cwd, branch) {
|
|
|
7539
7579
|
], cwd)) || 0;
|
|
7540
7580
|
}
|
|
7541
7581
|
// src/commands/close-work/clean-up-work/clean-up-work.ts
|
|
7542
|
-
const row$
|
|
7582
|
+
const row$35 = (id, status, detail) => ({
|
|
7543
7583
|
id,
|
|
7544
7584
|
title: id,
|
|
7545
7585
|
status,
|
|
@@ -7568,51 +7608,51 @@ function cleanUpWork(input) {
|
|
|
7568
7608
|
let keepBranch;
|
|
7569
7609
|
try {
|
|
7570
7610
|
const path = findWorktree(git, repoRoot, branch);
|
|
7571
|
-
if (!path) rows.push(row$
|
|
7611
|
+
if (!path) rows.push(row$35("worktree", "skip", `none holds ${branch}`));
|
|
7572
7612
|
else if (input.keepWorktree) {
|
|
7573
|
-
rows.push(row$
|
|
7613
|
+
rows.push(row$35("worktree", "skip", `kept at ${path} (--keep-worktree)`));
|
|
7574
7614
|
keepBranch = "its worktree is kept";
|
|
7575
7615
|
} else if (resolve(path) === mainWorktree(input)) {
|
|
7576
|
-
rows.push(row$
|
|
7616
|
+
rows.push(row$35("worktree", "skip", `${branch} is checked out in the main checkout; switch it to another branch first`));
|
|
7577
7617
|
keepBranch = "it is checked out in the main checkout";
|
|
7578
7618
|
} else if (resolve(repoRoot) === resolve(path) || resolve(repoRoot).startsWith(resolve(path) + sep)) {
|
|
7579
|
-
rows.push(row$
|
|
7619
|
+
rows.push(row$35("worktree", "skip", `${path} is where this command is running; run it from another checkout`));
|
|
7580
7620
|
keepBranch = "its worktree is where this command is running";
|
|
7581
7621
|
} else if (git(["status", "--porcelain"], path)) {
|
|
7582
|
-
rows.push(row$
|
|
7622
|
+
rows.push(row$35("worktree", "fail", `${path} has uncommitted changes; commit or discard them, nothing was removed`));
|
|
7583
7623
|
keepBranch = "its worktree has uncommitted changes";
|
|
7584
|
-
} else if (dryRun) rows.push(row$
|
|
7624
|
+
} else if (dryRun) rows.push(row$35("worktree", "skip", `would remove ${path}`));
|
|
7585
7625
|
else {
|
|
7586
7626
|
git([
|
|
7587
7627
|
"worktree",
|
|
7588
7628
|
"remove",
|
|
7589
7629
|
path
|
|
7590
7630
|
], repoRoot);
|
|
7591
|
-
rows.push(row$
|
|
7631
|
+
rows.push(row$35("worktree", "ok", `removed ${path}`));
|
|
7592
7632
|
}
|
|
7593
7633
|
} catch (err) {
|
|
7594
|
-
rows.push(row$
|
|
7634
|
+
rows.push(row$35("worktree", "fail", `could not remove the worktree: ${describeError(err)}`));
|
|
7595
7635
|
keepBranch = "its worktree could not be removed";
|
|
7596
7636
|
}
|
|
7597
7637
|
try {
|
|
7598
7638
|
const unpushed = unpushedCommits(git, repoRoot, branch);
|
|
7599
|
-
if (unpushed === void 0) rows.push(row$
|
|
7600
|
-
else if (keepBranch) rows.push(row$
|
|
7639
|
+
if (unpushed === void 0) rows.push(row$35("local branch", "skip", `${branch} is not in this checkout`));
|
|
7640
|
+
else if (keepBranch) rows.push(row$35("local branch", "skip", `${branch} stays: ${keepBranch}`));
|
|
7601
7641
|
else {
|
|
7602
7642
|
const tip = git(["rev-parse", `refs/heads/${branch}`], repoRoot);
|
|
7603
|
-
if (!(input.mode === "abandoned" || unpushed === 0 || input.headSha && tip === input.headSha)) rows.push(row$
|
|
7604
|
-
else if (dryRun) rows.push(row$
|
|
7643
|
+
if (!(input.mode === "abandoned" || unpushed === 0 || input.headSha && tip === input.headSha)) rows.push(row$35("local branch", "fail", `${branch} holds commits the pull request does not (tip ${tip.slice(0, 7)}); not deleted`));
|
|
7644
|
+
else if (dryRun) rows.push(row$35("local branch", "skip", `would delete ${branch}`));
|
|
7605
7645
|
else {
|
|
7606
7646
|
git([
|
|
7607
7647
|
"branch",
|
|
7608
7648
|
"-D",
|
|
7609
7649
|
branch
|
|
7610
7650
|
], repoRoot);
|
|
7611
|
-
rows.push(row$
|
|
7651
|
+
rows.push(row$35("local branch", "ok", `deleted ${branch}`));
|
|
7612
7652
|
}
|
|
7613
7653
|
}
|
|
7614
7654
|
} catch (err) {
|
|
7615
|
-
rows.push(row$
|
|
7655
|
+
rows.push(row$35("local branch", "fail", `could not delete ${branch}: ${describeError(err)}`));
|
|
7616
7656
|
}
|
|
7617
7657
|
try {
|
|
7618
7658
|
const remote = git([
|
|
@@ -7621,9 +7661,9 @@ function cleanUpWork(input) {
|
|
|
7621
7661
|
"origin",
|
|
7622
7662
|
`refs/heads/${branch}`
|
|
7623
7663
|
], repoRoot);
|
|
7624
|
-
rows.push(remote ? row$
|
|
7664
|
+
rows.push(remote ? row$35("remote branch", "skip", `${branch} is still on origin; GitHub deletes it on merge (the repo setting), or run: git push origin --delete ${branch}`) : row$35("remote branch", "ok", `${branch} is gone from origin`));
|
|
7625
7665
|
} catch (err) {
|
|
7626
|
-
rows.push(row$
|
|
7666
|
+
rows.push(row$35("remote branch", "skip", `could not ask origin: ${describeError(err)}`));
|
|
7627
7667
|
}
|
|
7628
7668
|
return rows;
|
|
7629
7669
|
}
|
|
@@ -7667,7 +7707,7 @@ function findWorkBranches(git, cwd, issue) {
|
|
|
7667
7707
|
});
|
|
7668
7708
|
}
|
|
7669
7709
|
// src/commands/close-work/abandon-work/abandon-work.ts
|
|
7670
|
-
const row$
|
|
7710
|
+
const row$34 = (id, status, detail) => ({
|
|
7671
7711
|
id,
|
|
7672
7712
|
title: id,
|
|
7673
7713
|
status,
|
|
@@ -7692,9 +7732,9 @@ async function abandonWork(a) {
|
|
|
7692
7732
|
try {
|
|
7693
7733
|
found = findWorkBranches(git, repoRoot, key);
|
|
7694
7734
|
} catch (err) {
|
|
7695
|
-
return { rows: [row$
|
|
7735
|
+
return { rows: [row$34("local branch", "fail", `could not list the branches: ${describeError(err)}`)] };
|
|
7696
7736
|
}
|
|
7697
|
-
if (found.length > 1) return { rows: [row$
|
|
7737
|
+
if (found.length > 1) return { rows: [row$34("local branch", "fail", `${found.length} branches are named for ${key} (${found.join(", ")}); --pr names the pull request whose branch to remove`)] };
|
|
7698
7738
|
branch = found[0];
|
|
7699
7739
|
}
|
|
7700
7740
|
if (branch) {
|
|
@@ -7702,9 +7742,9 @@ async function abandonWork(a) {
|
|
|
7702
7742
|
try {
|
|
7703
7743
|
unpushed = unpushedCommits(git, repoRoot, branch);
|
|
7704
7744
|
} catch (err) {
|
|
7705
|
-
return { rows: [row$
|
|
7745
|
+
return { rows: [row$34("unpushed commits", "fail", `could not read ${branch}: ${describeError(err)}`)] };
|
|
7706
7746
|
}
|
|
7707
|
-
if (unpushed !== void 0 && unpushed > 0) return { rows: [row$
|
|
7747
|
+
if (unpushed !== void 0 && unpushed > 0) return { rows: [row$34("unpushed commits", "fail", `${branch} holds ${unpushed} commit${unpushed === 1 ? "" : "s"} no remote branch has; push ${unpushed === 1 ? "it" : "them"} or delete the branch by hand. Nothing was changed`)] };
|
|
7708
7748
|
}
|
|
7709
7749
|
if (!dryRun && !input.yes) {
|
|
7710
7750
|
const what = [
|
|
@@ -7718,31 +7758,31 @@ async function abandonWork(a) {
|
|
|
7718
7758
|
};
|
|
7719
7759
|
}
|
|
7720
7760
|
let specFiles = [];
|
|
7721
|
-
if (!pr) rows.push(row$
|
|
7761
|
+
if (!pr) rows.push(row$34("pull request", "skip", `no open pull request for ${key}`));
|
|
7722
7762
|
else {
|
|
7723
7763
|
try {
|
|
7724
7764
|
specFiles = source.listPullRequestFiles ? findSpecFiles(await source.listPullRequestFiles(pr.number)) : [];
|
|
7725
7765
|
} catch (err) {
|
|
7726
|
-
rows.push(row$
|
|
7766
|
+
rows.push(row$34("spec", "fail", `could not read the pull request's files: ${describeError(err)}`));
|
|
7727
7767
|
}
|
|
7728
|
-
if (pr.state !== "open") rows.push(row$
|
|
7729
|
-
else if (!source.updatePullRequest) rows.push(row$
|
|
7730
|
-
else if (dryRun) rows.push(row$
|
|
7768
|
+
if (pr.state !== "open") rows.push(row$34("pull request", "skip", `#${pr.number} is already closed`));
|
|
7769
|
+
else if (!source.updatePullRequest) rows.push(row$34("pull request", "fail", `the \`${source.providerName}\` provider cannot close a pull request`));
|
|
7770
|
+
else if (dryRun) rows.push(row$34("pull request", "skip", `would close #${pr.number}`));
|
|
7731
7771
|
else try {
|
|
7732
7772
|
await source.updatePullRequest(pr.number, { state: "closed" });
|
|
7733
|
-
rows.push(row$
|
|
7773
|
+
rows.push(row$34("pull request", "ok", `closed #${pr.number}`));
|
|
7734
7774
|
} catch (err) {
|
|
7735
|
-
rows.push(row$
|
|
7775
|
+
rows.push(row$34("pull request", "fail", `could not close #${pr.number}: ${describeError(err)}`));
|
|
7736
7776
|
}
|
|
7737
7777
|
}
|
|
7738
7778
|
if (pr && !rows.some((r) => r.id === "spec")) {
|
|
7739
|
-
if (specFiles.length === 0) rows.push(row$
|
|
7740
|
-
else if (!input.withdrawSpecs) rows.push(row$
|
|
7779
|
+
if (specFiles.length === 0) rows.push(row$34("spec", "skip", "the pull request holds no spec or ADR, so no post to withdraw"));
|
|
7780
|
+
else if (!input.withdrawSpecs) rows.push(row$34("spec", "fail", "no way to withdraw the post was given"));
|
|
7741
7781
|
else try {
|
|
7742
7782
|
const result = await input.withdrawSpecs(specFiles);
|
|
7743
|
-
rows.push(row$
|
|
7783
|
+
rows.push(row$34("spec", result.ok ? "ok" : "fail", `${specFiles.join(", ")}: ${result.detail}`));
|
|
7744
7784
|
} catch (err) {
|
|
7745
|
-
rows.push(row$
|
|
7785
|
+
rows.push(row$34("spec", "fail", `could not withdraw the post: ${describeError(err)}`));
|
|
7746
7786
|
}
|
|
7747
7787
|
}
|
|
7748
7788
|
if (branch) rows.push(...cleanUpWork({
|
|
@@ -7753,9 +7793,9 @@ async function abandonWork(a) {
|
|
|
7753
7793
|
mode: "abandoned",
|
|
7754
7794
|
...input.keepWorktree ? { keepWorktree: true } : {}
|
|
7755
7795
|
}));
|
|
7756
|
-
else rows.push(row$
|
|
7757
|
-
if (dryRun) rows.push(row$
|
|
7758
|
-
else if (input.yes) rows.push(row$
|
|
7796
|
+
else rows.push(row$34("local branch", "skip", `no local branch is named for ${key}`));
|
|
7797
|
+
if (dryRun) rows.push(row$34("issue", "skip", `would ask whether to close ${key} as not planned`));
|
|
7798
|
+
else if (input.yes) rows.push(row$34("issue", "skip", `${key} left open: --yes does not close an issue; run \`holocron update issue ${key} --state closed --state-reason not_planned\` to close it as not planned`));
|
|
7759
7799
|
else if (await a.ask(`Close ${key} as not planned?`)) {
|
|
7760
7800
|
const close = await (input.updateIssue ?? runIssueUpdate)({
|
|
7761
7801
|
key,
|
|
@@ -7772,7 +7812,7 @@ async function abandonWork(a) {
|
|
|
7772
7812
|
id: `issue: ${r.id}`,
|
|
7773
7813
|
title: `issue: ${r.title}`
|
|
7774
7814
|
});
|
|
7775
|
-
} else rows.push(row$
|
|
7815
|
+
} else rows.push(row$34("issue", "skip", `${key} left open`));
|
|
7776
7816
|
return { rows };
|
|
7777
7817
|
}
|
|
7778
7818
|
// src/commands/update-work/find-work-pull-request/find-work-pull-request.ts
|
|
@@ -8257,7 +8297,7 @@ function workTitle(input) {
|
|
|
8257
8297
|
const MAX_TITLE = 100;
|
|
8258
8298
|
const DEFAULT_BASE = "alpha";
|
|
8259
8299
|
const WORKTREES = ".claude/worktrees";
|
|
8260
|
-
const row$
|
|
8300
|
+
const row$33 = (id, status, detail) => ({
|
|
8261
8301
|
id,
|
|
8262
8302
|
title: id,
|
|
8263
8303
|
status,
|
|
@@ -8293,7 +8333,7 @@ async function runStartWork(input) {
|
|
|
8293
8333
|
};
|
|
8294
8334
|
};
|
|
8295
8335
|
const fail = (id, detail) => {
|
|
8296
|
-
rows.push(row$
|
|
8336
|
+
rows.push(row$33(id, "fail", detail));
|
|
8297
8337
|
return finish();
|
|
8298
8338
|
};
|
|
8299
8339
|
print(style.header(`Holocron start work${dryRun ? " (dry-run)" : ""}`));
|
|
@@ -8349,7 +8389,7 @@ async function runStartWork(input) {
|
|
|
8349
8389
|
} catch (err) {
|
|
8350
8390
|
return fail(key, `could not read the issue: ${describeError(err)}`);
|
|
8351
8391
|
}
|
|
8352
|
-
rows.push(row$
|
|
8392
|
+
rows.push(row$33(key, "ok", `${issue.summary} (${issue.status})`));
|
|
8353
8393
|
const named = workTitle({
|
|
8354
8394
|
issueTitle: issue.summary,
|
|
8355
8395
|
...input.kind ? {
|
|
@@ -8392,14 +8432,14 @@ async function runStartWork(input) {
|
|
|
8392
8432
|
...source ? [`draft pull request "${title}" (${link.keyword} ${key})`] : ["no pull request"]
|
|
8393
8433
|
].join("; ");
|
|
8394
8434
|
if (dryRun) {
|
|
8395
|
-
rows.push(row$
|
|
8396
|
-
rows.push(row$
|
|
8397
|
-
rows.push(row$
|
|
8398
|
-
if (useWorktree) rows.push(row$
|
|
8399
|
-
rows.push(row$
|
|
8400
|
-
rows.push(row$
|
|
8401
|
-
if (source) rows.push(row$
|
|
8402
|
-
rows.push(row$
|
|
8435
|
+
rows.push(row$33("title", "skip", `${title} (${named.reason}${releaseNote})`));
|
|
8436
|
+
rows.push(row$33("start date", "skip", `would set the start date${input.effort ? ` and Effort ${input.effort}` : ""}${branchExists ? " (not again: the branch exists)" : ""}`));
|
|
8437
|
+
rows.push(row$33("branch", "skip", `would ${branchExists ? "reuse" : "make"} ${branch} from origin/${base}`));
|
|
8438
|
+
if (useWorktree) rows.push(row$33("worktree", "skip", `would use ${wtPath}`));
|
|
8439
|
+
rows.push(row$33("first commit", "skip", `would commit${spec ? ` ${spec.rel}` : " empty"} as "${commitSubject}"`));
|
|
8440
|
+
rows.push(row$33("push", "skip", `would push ${branch} to origin`));
|
|
8441
|
+
if (source) rows.push(row$33("pull request", "skip", `would open a draft pull request against ${base}, ${link.keyword} ${key}`));
|
|
8442
|
+
rows.push(row$33("board status", "skip", "the open pull request moves the issue to In Progress"));
|
|
8403
8443
|
return finish();
|
|
8404
8444
|
}
|
|
8405
8445
|
if (!input.yes) {
|
|
@@ -8415,18 +8455,18 @@ async function runStartWork(input) {
|
|
|
8415
8455
|
};
|
|
8416
8456
|
}
|
|
8417
8457
|
}
|
|
8418
|
-
rows.push(row$
|
|
8419
|
-
if (branchExists) rows.push(row$
|
|
8420
|
-
else if (!issues.update) rows.push(row$
|
|
8458
|
+
rows.push(row$33("title", "ok", `${title} (${named.reason}${releaseNote})`));
|
|
8459
|
+
if (branchExists) rows.push(row$33("start date", "skip", "the branch exists, so the work started before; the start date is left as it is"));
|
|
8460
|
+
else if (!issues.update) rows.push(row$33("start date", "skip", `the \`${issues.providerName}\` provider cannot update an issue`));
|
|
8421
8461
|
else try {
|
|
8422
8462
|
const result = await issues.update(key, {
|
|
8423
8463
|
startDate: io.today(),
|
|
8424
8464
|
...input.effort ? { effort: input.effort } : {}
|
|
8425
8465
|
});
|
|
8426
|
-
rows.push(row$
|
|
8427
|
-
for (const line of result.dropped ?? []) rows.push(row$
|
|
8466
|
+
rows.push(row$33("start date", "ok", result.changed.length > 0 ? result.changed.join(", ") : "already as asked"));
|
|
8467
|
+
for (const line of result.dropped ?? []) rows.push(row$33("not carried across", "skip", line));
|
|
8428
8468
|
} catch (err) {
|
|
8429
|
-
rows.push(row$
|
|
8469
|
+
rows.push(row$33("start date", "fail", `could not update the issue: ${describeError(err)}`));
|
|
8430
8470
|
}
|
|
8431
8471
|
let dir = root;
|
|
8432
8472
|
try {
|
|
@@ -8455,7 +8495,7 @@ async function runStartWork(input) {
|
|
|
8455
8495
|
"--abbrev-ref",
|
|
8456
8496
|
"HEAD"
|
|
8457
8497
|
], root) !== branch && dir === root) io.git(["switch", branch], root);
|
|
8458
|
-
rows.push(row$
|
|
8498
|
+
rows.push(row$33("branch", "ok", `${branch} already exists; reused`));
|
|
8459
8499
|
} else if (useWorktree) {
|
|
8460
8500
|
io.git([
|
|
8461
8501
|
"worktree",
|
|
@@ -8467,7 +8507,7 @@ async function runStartWork(input) {
|
|
|
8467
8507
|
start
|
|
8468
8508
|
], root);
|
|
8469
8509
|
dir = wtPath;
|
|
8470
|
-
rows.push(row$
|
|
8510
|
+
rows.push(row$33("branch", "ok", `made ${branch} from ${start}`));
|
|
8471
8511
|
} else {
|
|
8472
8512
|
io.git([
|
|
8473
8513
|
"switch",
|
|
@@ -8476,19 +8516,19 @@ async function runStartWork(input) {
|
|
|
8476
8516
|
branch,
|
|
8477
8517
|
start
|
|
8478
8518
|
], root);
|
|
8479
|
-
rows.push(row$
|
|
8519
|
+
rows.push(row$33("branch", "ok", `made ${branch} from ${start} and switched to it`));
|
|
8480
8520
|
}
|
|
8481
8521
|
report = {
|
|
8482
8522
|
...report,
|
|
8483
8523
|
directory: dir
|
|
8484
8524
|
};
|
|
8485
|
-
if (useWorktree) rows.push(row$
|
|
8525
|
+
if (useWorktree) rows.push(row$33("worktree", "ok", dir));
|
|
8486
8526
|
const ahead = Number(git([
|
|
8487
8527
|
"rev-list",
|
|
8488
8528
|
"--count",
|
|
8489
8529
|
`${start}..${branch}`
|
|
8490
8530
|
]) || "0");
|
|
8491
|
-
if (ahead > 0) rows.push(row$
|
|
8531
|
+
if (ahead > 0) rows.push(row$33("first commit", "skip", `${branch} already has ${ahead} commit${ahead === 1 ? "" : "s"}`));
|
|
8492
8532
|
else {
|
|
8493
8533
|
const trailer = `Refs ${workReference(key)}`;
|
|
8494
8534
|
if (spec) {
|
|
@@ -8499,7 +8539,7 @@ async function runStartWork(input) {
|
|
|
8499
8539
|
spec.rel
|
|
8500
8540
|
], dir);
|
|
8501
8541
|
const status = /^status:\s*(\S+)/m.exec(io.read(spec.abs))?.[1];
|
|
8502
|
-
if (status && status !== "draft") rows.push(row$
|
|
8542
|
+
if (status && status !== "draft") rows.push(row$33("spec", "skip", `the spec's status is ${status}, not draft`));
|
|
8503
8543
|
}
|
|
8504
8544
|
io.git([
|
|
8505
8545
|
"commit",
|
|
@@ -8510,7 +8550,7 @@ async function runStartWork(input) {
|
|
|
8510
8550
|
"-m",
|
|
8511
8551
|
trailer
|
|
8512
8552
|
], dir);
|
|
8513
|
-
rows.push(row$
|
|
8553
|
+
rows.push(row$33("first commit", "ok", `${io.git([
|
|
8514
8554
|
"rev-parse",
|
|
8515
8555
|
"--short",
|
|
8516
8556
|
"HEAD"
|
|
@@ -8522,9 +8562,9 @@ async function runStartWork(input) {
|
|
|
8522
8562
|
"origin",
|
|
8523
8563
|
branch
|
|
8524
8564
|
], dir);
|
|
8525
|
-
rows.push(row$
|
|
8565
|
+
rows.push(row$33("push", "ok", `${branch} is on origin`));
|
|
8526
8566
|
} catch (err) {
|
|
8527
|
-
rows.push(row$
|
|
8567
|
+
rows.push(row$33("git", "fail", `${describeError(err)}; nothing was deleted, run the command again to carry on`));
|
|
8528
8568
|
return finish();
|
|
8529
8569
|
}
|
|
8530
8570
|
if (source) try {
|
|
@@ -8540,7 +8580,7 @@ async function runStartWork(input) {
|
|
|
8540
8580
|
...input.templatesIo ? { templatesIo: input.templatesIo } : {}
|
|
8541
8581
|
});
|
|
8542
8582
|
issueBoards = read.boards;
|
|
8543
|
-
if (read.problem) rows.push(row$
|
|
8583
|
+
if (read.problem) rows.push(row$33("boards", "skip", `the pull request is not put on the issue's boards: ${read.problem}`));
|
|
8544
8584
|
}
|
|
8545
8585
|
const projects = [.../* @__PURE__ */ new Set([...issueBoards, ...input.project ? [input.project] : []])];
|
|
8546
8586
|
const mirrored = {
|
|
@@ -8572,12 +8612,12 @@ async function runStartWork(input) {
|
|
|
8572
8612
|
created: result.created
|
|
8573
8613
|
}
|
|
8574
8614
|
};
|
|
8575
|
-
rows.push(row$
|
|
8576
|
-
for (const line of result.dropped) rows.push(row$
|
|
8615
|
+
rows.push(row$33("pull request", "ok", `${result.created ? "opened" : "already open:"} #${pr.number}${result.draft ? " (draft)" : ""} ${pr.url}`));
|
|
8616
|
+
for (const line of result.dropped) rows.push(row$33("not carried across", "skip", line));
|
|
8577
8617
|
} catch (err) {
|
|
8578
|
-
rows.push(row$
|
|
8618
|
+
rows.push(row$33("pull request", "fail", `could not open the pull request: ${describeError(err)}; run the command again to open it`));
|
|
8579
8619
|
}
|
|
8580
|
-
rows.push(row$
|
|
8620
|
+
rows.push(row$33("board status", "skip", "not set: the open pull request moves the issue to In Progress; `update work --status` sets it by hand while the automation is down"));
|
|
8581
8621
|
return finish();
|
|
8582
8622
|
}
|
|
8583
8623
|
// src/commands/update-work/guard-work-status/guard-work-status.ts
|
|
@@ -8625,7 +8665,7 @@ function guardWorkStatus(status, force) {
|
|
|
8625
8665
|
* terminal it refuses). `--dry-run` runs the reads and writes nothing. A run with nothing to change still syncs the
|
|
8626
8666
|
* area labels.
|
|
8627
8667
|
*/
|
|
8628
|
-
const row$
|
|
8668
|
+
const row$32 = (id, status, detail) => ({
|
|
8629
8669
|
id,
|
|
8630
8670
|
title: id,
|
|
8631
8671
|
status,
|
|
@@ -8659,7 +8699,7 @@ async function runUpdateWork(input) {
|
|
|
8659
8699
|
};
|
|
8660
8700
|
};
|
|
8661
8701
|
const fail = (id, detail) => {
|
|
8662
|
-
rows.push(row$
|
|
8702
|
+
rows.push(row$32(id, "fail", detail));
|
|
8663
8703
|
return finish();
|
|
8664
8704
|
};
|
|
8665
8705
|
print(style.header(`Holocron update work${dryRun ? " (dry-run)" : ""}`));
|
|
@@ -8748,7 +8788,7 @@ async function runUpdateWork(input) {
|
|
|
8748
8788
|
title: `start: ${r.title}`
|
|
8749
8789
|
});
|
|
8750
8790
|
if (started.status === "fail") {
|
|
8751
|
-
rows.push(row$
|
|
8791
|
+
rows.push(row$32("update work", "skip", "start work failed, so nothing after it was run"));
|
|
8752
8792
|
return finish();
|
|
8753
8793
|
}
|
|
8754
8794
|
}
|
|
@@ -8760,10 +8800,10 @@ async function runUpdateWork(input) {
|
|
|
8760
8800
|
} else if (source.listPullRequests) {
|
|
8761
8801
|
const found = findWorkPullRequests(await source.listPullRequests("open"), key);
|
|
8762
8802
|
pr = found[0];
|
|
8763
|
-
if (found.length > 1) rows.push(row$
|
|
8803
|
+
if (found.length > 1) rows.push(row$32("pull request", "skip", `${found.length} open pull requests match ${key}; using #${pr?.number} (--pr names another)`));
|
|
8764
8804
|
}
|
|
8765
8805
|
} catch (err) {
|
|
8766
|
-
rows.push(row$
|
|
8806
|
+
rows.push(row$32("pull request", "fail", `could not find the pull request: ${describeError(err)}`));
|
|
8767
8807
|
return finish();
|
|
8768
8808
|
}
|
|
8769
8809
|
if (pr) {
|
|
@@ -8774,24 +8814,24 @@ async function runUpdateWork(input) {
|
|
|
8774
8814
|
url: pr.url
|
|
8775
8815
|
}
|
|
8776
8816
|
};
|
|
8777
|
-
rows.push(row$
|
|
8817
|
+
rows.push(row$32("pull request", "ok", `#${pr.number} ${pr.title}`));
|
|
8778
8818
|
} else {
|
|
8779
8819
|
const detail = `no open pull request for ${key} (its branch is <type>/<issue>-<slug>; --pr names one, --start makes one)`;
|
|
8780
|
-
rows.push(row$
|
|
8820
|
+
rows.push(row$32("pull request", title ? "fail" : "skip", title ? `${detail}; --title needs one` : detail));
|
|
8781
8821
|
}
|
|
8782
8822
|
let derived = [];
|
|
8783
|
-
if (!pr) rows.push(row$
|
|
8784
|
-
else if (!areas || Object.keys(areas).length === 0) rows.push(row$
|
|
8785
|
-
else if (!source.listPullRequestFiles) rows.push(row$
|
|
8823
|
+
if (!pr) rows.push(row$32("area labels", "skip", "no pull request to read the changed folders of"));
|
|
8824
|
+
else if (!areas || Object.keys(areas).length === 0) rows.push(row$32("area labels", "skip", "the repo declares no `repo.labels.areas`"));
|
|
8825
|
+
else if (!source.listPullRequestFiles) rows.push(row$32("area labels", "skip", `the \`${source.providerName}\` provider cannot list a pull request's files`));
|
|
8786
8826
|
else try {
|
|
8787
8827
|
derived = areaLabelsForFiles(await source.listPullRequestFiles(pr.number), areas);
|
|
8788
8828
|
report = {
|
|
8789
8829
|
...report,
|
|
8790
8830
|
areaLabels: derived
|
|
8791
8831
|
};
|
|
8792
|
-
rows.push(row$
|
|
8832
|
+
rows.push(row$32("area labels", derived.length > 0 ? "ok" : "skip", derived.length > 0 ? derived.join(", ") : "the changed folders are in no area"));
|
|
8793
8833
|
} catch (err) {
|
|
8794
|
-
rows.push(row$
|
|
8834
|
+
rows.push(row$32("area labels", "fail", `could not read the changed files: ${describeError(err)}`));
|
|
8795
8835
|
}
|
|
8796
8836
|
let missingOnIssue = derived;
|
|
8797
8837
|
if (derived.length > 0 && issues.export) try {
|
|
@@ -8828,7 +8868,7 @@ async function runUpdateWork(input) {
|
|
|
8828
8868
|
id: `issue: ${r.id}`,
|
|
8829
8869
|
title: `issue: ${r.title}`
|
|
8830
8870
|
});
|
|
8831
|
-
} else rows.push(row$
|
|
8871
|
+
} else rows.push(row$32("issue", "skip", "no issue field to change"));
|
|
8832
8872
|
if (pr) {
|
|
8833
8873
|
const prLabels = unique([...addLabels, ...derived]);
|
|
8834
8874
|
const patch = {
|
|
@@ -8847,15 +8887,15 @@ async function runUpdateWork(input) {
|
|
|
8847
8887
|
...milestone ? [`milestone ${milestone}`] : [],
|
|
8848
8888
|
...input.project ? [`board ${input.project}`] : []
|
|
8849
8889
|
];
|
|
8850
|
-
if (parts.length === 0) rows.push(row$
|
|
8851
|
-
else if (!source.updatePullRequest) rows.push(row$
|
|
8852
|
-
else if (dryRun) rows.push(row$
|
|
8890
|
+
if (parts.length === 0) rows.push(row$32(`pull request #${pr.number}`, "skip", "no field to change"));
|
|
8891
|
+
else if (!source.updatePullRequest) rows.push(row$32(`pull request #${pr.number}`, "fail", `the \`${source.providerName}\` provider cannot update a pull request`));
|
|
8892
|
+
else if (dryRun) rows.push(row$32(`pull request #${pr.number}`, "skip", `would update ${parts.join("; ")}`));
|
|
8853
8893
|
else try {
|
|
8854
8894
|
const result = await source.updatePullRequest(pr.number, patch);
|
|
8855
|
-
rows.push(row$
|
|
8856
|
-
for (const line of result.dropped) rows.push(row$
|
|
8895
|
+
rows.push(row$32(`pull request #${pr.number}`, "ok", `updated ${parts.join("; ")}`));
|
|
8896
|
+
for (const line of result.dropped) rows.push(row$32("not carried across", "skip", line));
|
|
8857
8897
|
} catch (err) {
|
|
8858
|
-
rows.push(row$
|
|
8898
|
+
rows.push(row$32(`pull request #${pr.number}`, "fail", `could not update the pull request: ${describeError(err)}`));
|
|
8859
8899
|
}
|
|
8860
8900
|
}
|
|
8861
8901
|
if (status) {
|
|
@@ -8871,11 +8911,11 @@ async function runUpdateWork(input) {
|
|
|
8871
8911
|
...input.board ? { board: input.board } : {}
|
|
8872
8912
|
});
|
|
8873
8913
|
const change = set.key && set.to ? `${set.key} ${set.from ?? "no status"} → ${set.to}` : `${key} → ${status}`;
|
|
8874
|
-
rows.push(set.status === "ok" ? row$
|
|
8914
|
+
rows.push(set.status === "ok" ? row$32("board status", dryRun ? "skip" : "ok", dryRun ? `would set ${change}` : change) : row$32("board status", "fail", sub.lines.map((l) => l.trim()).filter(Boolean).join("; ") || "could not set the status"));
|
|
8875
8915
|
} catch (err) {
|
|
8876
|
-
rows.push(row$
|
|
8916
|
+
rows.push(row$32("board status", "fail", describeError(err)));
|
|
8877
8917
|
}
|
|
8878
|
-
rows.push(row$
|
|
8918
|
+
rows.push(row$32("board status is temporary", "skip", guard?.ok && guard.forced ? "forced: the automation owns this status and overwrites it once it runs again (#2388)" : "the board's rules overwrite a hand-set status once the pull request moves it (#2388)"));
|
|
8879
8919
|
}
|
|
8880
8920
|
return finish();
|
|
8881
8921
|
}
|
|
@@ -8894,7 +8934,7 @@ function findClosedWorkPullRequests(prs, issue) {
|
|
|
8894
8934
|
return [...matching.filter((pr) => pr.merged), ...matching.filter((pr) => !pr.merged)];
|
|
8895
8935
|
}
|
|
8896
8936
|
// src/commands/close-work/release-closed-blockers/release-closed-blockers.ts
|
|
8897
|
-
const row$
|
|
8937
|
+
const row$31 = (id, status, detail) => ({
|
|
8898
8938
|
id,
|
|
8899
8939
|
title: id,
|
|
8900
8940
|
status,
|
|
@@ -8908,16 +8948,16 @@ const row$29 = (id, status, detail) => ({
|
|
|
8908
8948
|
*/
|
|
8909
8949
|
async function releaseClosedBlockers(input) {
|
|
8910
8950
|
const { issues, key } = input;
|
|
8911
|
-
if (!issues.export) return [row$
|
|
8951
|
+
if (!issues.export) return [row$31("relations", "skip", `the \`${issues.providerName}\` provider cannot read blockers`)];
|
|
8912
8952
|
try {
|
|
8913
8953
|
const blockers = (await issues.export({ keys: [key] }))[0]?.blockedBy ?? [];
|
|
8914
|
-
if (blockers.length === 0) return [row$
|
|
8954
|
+
if (blockers.length === 0) return [row$31("relations", "skip", `${key} has no blockers`)];
|
|
8915
8955
|
const closed = (await issues.export({ keys: blockers })).filter((r) => r.closed).map((r) => r.key);
|
|
8916
|
-
if (closed.length === 0) return [row$
|
|
8956
|
+
if (closed.length === 0) return [row$31("relations", "skip", `${blockers.length} blocker${blockers.length === 1 ? "" : "s"} still open: ${blockers.join(", ")}`)];
|
|
8917
8957
|
const done = await input.unblock(closed);
|
|
8918
|
-
return [row$
|
|
8958
|
+
return [row$31("relations", done.status === "fail" ? "fail" : "ok", `closed ${closed.length === 1 ? "blocker" : "blockers"} ${closed.join(", ")} taken off ${key}`), ...done.rows.filter((r) => r.status === "fail")];
|
|
8919
8959
|
} catch (err) {
|
|
8920
|
-
return [row$
|
|
8960
|
+
return [row$31("relations", "fail", `could not update the blockers: ${describeError(err)}`)];
|
|
8921
8961
|
}
|
|
8922
8962
|
}
|
|
8923
8963
|
// src/commands/close-work/wait-for-checks/wait-for-checks.ts
|
|
@@ -9455,7 +9495,7 @@ const DEFAULT_TIMEOUT_MINUTES = 30;
|
|
|
9455
9495
|
const DEFAULT_INTERVAL_MS = 3e4;
|
|
9456
9496
|
/** How many failing checks a row names. */
|
|
9457
9497
|
const MAX_NAMED$1 = 8;
|
|
9458
|
-
const row$
|
|
9498
|
+
const row$30 = (id, status, detail) => ({
|
|
9459
9499
|
id,
|
|
9460
9500
|
title: id,
|
|
9461
9501
|
status,
|
|
@@ -9480,7 +9520,7 @@ async function runCloseWork(input) {
|
|
|
9480
9520
|
};
|
|
9481
9521
|
};
|
|
9482
9522
|
const fail = (id, detail) => {
|
|
9483
|
-
rows.push(row$
|
|
9523
|
+
rows.push(row$30(id, "fail", detail));
|
|
9484
9524
|
return finish();
|
|
9485
9525
|
};
|
|
9486
9526
|
print(style.header(`Holocron close work${input.abandon ? " --abandon" : ""}${dryRun ? " (dry-run)" : ""}`));
|
|
@@ -9528,7 +9568,7 @@ async function runCloseWork(input) {
|
|
|
9528
9568
|
if (!source.listPullRequests) throw new Error(`the \`${source.providerName}\` provider cannot list pull requests`);
|
|
9529
9569
|
const open = findWorkPullRequests(await source.listPullRequests("open"), key);
|
|
9530
9570
|
pr = open[0];
|
|
9531
|
-
if (open.length > 1) rows.push(row$
|
|
9571
|
+
if (open.length > 1) rows.push(row$30("pull request", "skip", `${open.length} open pull requests match ${key}; using #${pr?.number} (--pr names another)`));
|
|
9532
9572
|
if (!pr && !input.abandon) pr = findClosedWorkPullRequests(await source.listPullRequests("closed"), key)[0];
|
|
9533
9573
|
}
|
|
9534
9574
|
} catch (err) {
|
|
@@ -9566,10 +9606,10 @@ async function runCloseWork(input) {
|
|
|
9566
9606
|
const repoRoot = input.context.repoRoot;
|
|
9567
9607
|
if (pr.state === "closed") {
|
|
9568
9608
|
if (!pr.merged) {
|
|
9569
|
-
rows.push(row$
|
|
9609
|
+
rows.push(row$30("pull request", "skip", `#${pr.number} was closed without merging; \`close work ${key} --abandon\` tidies its branch and spec`));
|
|
9570
9610
|
return finish();
|
|
9571
9611
|
}
|
|
9572
|
-
rows.push(row$
|
|
9612
|
+
rows.push(row$30("pull request", "ok", `#${pr.number} merged: ${pr.title}`));
|
|
9573
9613
|
if (!dryRun && !input.yes && !await ask(`Remove the worktree and local branch of ${pr.branch}?`)) {
|
|
9574
9614
|
print(` ${style.skip("cancelled; nothing was changed")}`);
|
|
9575
9615
|
return {
|
|
@@ -9588,7 +9628,7 @@ async function runCloseWork(input) {
|
|
|
9588
9628
|
}));
|
|
9589
9629
|
return finish();
|
|
9590
9630
|
}
|
|
9591
|
-
rows.push(row$
|
|
9631
|
+
rows.push(row$30("pull request", "ok", `#${pr.number} ${pr.title}`));
|
|
9592
9632
|
if (!source.getPullRequestChecks) return fail("ci / Required checks", `the \`${source.providerName}\` provider cannot read a pull request's checks`);
|
|
9593
9633
|
const readChecks = source.getPullRequestChecks.bind(source);
|
|
9594
9634
|
const number = pr.number;
|
|
@@ -9614,7 +9654,7 @@ async function runCloseWork(input) {
|
|
|
9614
9654
|
const named = failing.length > 0 ? `: ${failing.join(", ")}${more > 0 ? `, and ${more} more` : ""}` : "";
|
|
9615
9655
|
return fail("ci / Required checks", `${checks.state === "failure" ? `is red${named}` : result.timedOut ? `is still ${checks.state} after ${minutes} minute${minutes === 1 ? "" : "s"}` : `is ${checks.state === "none" ? "not posted yet" : "still running"}; --wait polls until it is green`}. #${number} was not marked ready; run \`close work ${key}\` again once it is green`);
|
|
9616
9656
|
}
|
|
9617
|
-
rows.push(row$
|
|
9657
|
+
rows.push(row$30("ci / Required checks", "ok", `green${checks.sha ? ` on ${checks.sha.slice(0, 7)}` : ""}`));
|
|
9618
9658
|
if (!dryRun && !input.yes) {
|
|
9619
9659
|
if (!await ask(`${key} is green. ${`Mark #${number} ready, update the area labels and take closed blockers off ${key}`}?`)) {
|
|
9620
9660
|
print(` ${style.skip("cancelled; nothing was changed")}`);
|
|
@@ -9624,13 +9664,13 @@ async function runCloseWork(input) {
|
|
|
9624
9664
|
};
|
|
9625
9665
|
}
|
|
9626
9666
|
}
|
|
9627
|
-
if (!source.markReady) rows.push(row$
|
|
9628
|
-
else if (dryRun) rows.push(row$
|
|
9667
|
+
if (!source.markReady) rows.push(row$30("ready", "fail", `the \`${source.providerName}\` provider cannot mark a pull request ready`));
|
|
9668
|
+
else if (dryRun) rows.push(row$30("ready", "skip", `would mark #${number} ready if it is a draft`));
|
|
9629
9669
|
else try {
|
|
9630
9670
|
const changed = await source.markReady(number);
|
|
9631
|
-
rows.push(row$
|
|
9671
|
+
rows.push(row$30("ready", "ok", changed ? `#${number} is ready for review; the board moves to In Review by itself. The maintainer merges, \`close work ${key}\` again after that clears the checkout` : `#${number} was already ready; the maintainer merges`));
|
|
9632
9672
|
} catch (err) {
|
|
9633
|
-
rows.push(row$
|
|
9673
|
+
rows.push(row$30("ready", "fail", `could not mark #${number} ready: ${describeError(err)}`));
|
|
9634
9674
|
}
|
|
9635
9675
|
try {
|
|
9636
9676
|
const updated = await (input.updateWork ?? runUpdateWork)({
|
|
@@ -9648,7 +9688,7 @@ async function runCloseWork(input) {
|
|
|
9648
9688
|
title: `labels: ${r.title}`
|
|
9649
9689
|
});
|
|
9650
9690
|
} catch (err) {
|
|
9651
|
-
rows.push(row$
|
|
9691
|
+
rows.push(row$30("labels", "fail", `could not update the area labels: ${describeError(err)}`));
|
|
9652
9692
|
}
|
|
9653
9693
|
rows.push(...await releaseClosedBlockers({
|
|
9654
9694
|
issues,
|
|
@@ -11259,7 +11299,7 @@ function installationSettingsUrl(account, id) {
|
|
|
11259
11299
|
return `https://github.com/settings/installations/${id}`;
|
|
11260
11300
|
}
|
|
11261
11301
|
// src/commands/doctor-github-app/app-rows.ts
|
|
11262
|
-
const row$
|
|
11302
|
+
const row$29 = (name, what, problems, ok) => ({
|
|
11263
11303
|
id: `${name}:${what}`,
|
|
11264
11304
|
title: `${name}: ${what}`,
|
|
11265
11305
|
status: problems.length > 0 ? "fail" : "ok",
|
|
@@ -11304,9 +11344,9 @@ function appRows(name, manifest, app, installations) {
|
|
|
11304
11344
|
return [`${who} has not accepted the current App: ${gaps.join("; ")}`, `fix: ${who} accepts the update at ${url}`];
|
|
11305
11345
|
});
|
|
11306
11346
|
return [
|
|
11307
|
-
row$
|
|
11308
|
-
row$
|
|
11309
|
-
row$
|
|
11347
|
+
row$29(name, "events", eventProblems.length > 0 ? [...eventProblems, fix] : [], `all ${manifest.events.length} subscribed${extrasNote("extra event(s)", extraEvents)}`),
|
|
11348
|
+
row$29(name, "permissions", permissionProblems.length > 0 ? [...permissionProblems, fix] : [], `all ${Object.keys(manifest.permissions).length} granted${extrasNote("extra permission(s)", extraPermissions)}`),
|
|
11349
|
+
row$29(name, "installations", installationProblems, `${installations.length} installation(s) up to date`),
|
|
11310
11350
|
statusRow(name, installations)
|
|
11311
11351
|
];
|
|
11312
11352
|
}
|
|
@@ -11472,7 +11512,7 @@ async function runDoctorGitHubApp(input) {
|
|
|
11472
11512
|
assertPluginsResolvable(loader, "doctor github-app");
|
|
11473
11513
|
}
|
|
11474
11514
|
const rows = [];
|
|
11475
|
-
if (instances.length === 0) rows.push(row$
|
|
11515
|
+
if (instances.length === 0) rows.push(row$28("github-app", "reachable", "skip", "no `githubApps` are declared in holocron.config.ts"));
|
|
11476
11516
|
const checked = [];
|
|
11477
11517
|
for (const instance of instances) {
|
|
11478
11518
|
const instanceRows = await checkInstance(instance, loader, input);
|
|
@@ -11519,7 +11559,7 @@ function printGrouped(checked, print) {
|
|
|
11519
11559
|
}
|
|
11520
11560
|
}
|
|
11521
11561
|
}
|
|
11522
|
-
function row$
|
|
11562
|
+
function row$28(name, what, status, detail) {
|
|
11523
11563
|
return {
|
|
11524
11564
|
id: `${name}:${what}`,
|
|
11525
11565
|
title: `${name}: ${what}`,
|
|
@@ -11535,10 +11575,10 @@ async function checkInstance(instance, loader, input) {
|
|
|
11535
11575
|
try {
|
|
11536
11576
|
manifest = parseManifest(readManifest(instance.manifest));
|
|
11537
11577
|
} catch (err) {
|
|
11538
|
-
return [row$
|
|
11578
|
+
return [row$28(name, "manifest", "fail", `cannot read ${instance.manifest}: ${errorMessage(err)}`)];
|
|
11539
11579
|
}
|
|
11540
11580
|
const read = await readAppCredentials(instance, loader);
|
|
11541
|
-
if ("reason" in read) return [row$
|
|
11581
|
+
if ("reason" in read) return [row$28(name, "reachable", "skip", read.reason)];
|
|
11542
11582
|
const api = input.api ?? defaultApi$1;
|
|
11543
11583
|
const secrets = [read.creds.privateKey];
|
|
11544
11584
|
try {
|
|
@@ -11546,12 +11586,12 @@ async function checkInstance(instance, loader, input) {
|
|
|
11546
11586
|
const installations = await api.listAppInstallations(read.creds);
|
|
11547
11587
|
const owner = app.owner ? `, owned by ${app.owner.login}` : "";
|
|
11548
11588
|
return [
|
|
11549
|
-
row$
|
|
11589
|
+
row$28(name, "reachable", "ok", `${app.slug}${owner}, settings: ${appSettingsUrl(app)}`),
|
|
11550
11590
|
...appRows(name, manifest, app, installations),
|
|
11551
11591
|
await deliveryRow(name, read.creds, api, (input.now ?? Date.now)(), secrets)
|
|
11552
11592
|
];
|
|
11553
11593
|
} catch (err) {
|
|
11554
|
-
return [row$
|
|
11594
|
+
return [row$28(name, "reachable", "fail", `cannot call GitHub as the App: ${scrubbed$1(err, secrets)}`)];
|
|
11555
11595
|
}
|
|
11556
11596
|
}
|
|
11557
11597
|
// src/commands/doctor-github-app/doctor-github-app.command.ts
|
|
@@ -12828,7 +12868,7 @@ async function runDoctorDns(input) {
|
|
|
12828
12868
|
});
|
|
12829
12869
|
else if (!loader.has("dns")) {
|
|
12830
12870
|
const why = whyMissing(loader, "dns", "no `dns` provider to check them with");
|
|
12831
|
-
for (const zone of zones) rows.push(row$
|
|
12871
|
+
for (const zone of zones) rows.push(row$27(zone, "skip", why));
|
|
12832
12872
|
for (const { hostname } of domains) rows.push(domainRow(hostname, "skip", why));
|
|
12833
12873
|
} else {
|
|
12834
12874
|
const dns = loader.get("dns");
|
|
@@ -12850,7 +12890,7 @@ async function runDoctorDns(input) {
|
|
|
12850
12890
|
...status === "skip" ? { reason: [...new Set(rows.map((r) => r.detail))].join("; ") } : {}
|
|
12851
12891
|
};
|
|
12852
12892
|
}
|
|
12853
|
-
function row$
|
|
12893
|
+
function row$27(zone, status, detail, problems = []) {
|
|
12854
12894
|
return {
|
|
12855
12895
|
id: `dns-${zone}`,
|
|
12856
12896
|
title: `${zone} records exist`,
|
|
@@ -12879,7 +12919,7 @@ async function checkDomain(dns, deploy, project, hostname) {
|
|
|
12879
12919
|
return noToken !== void 0 ? domainRow(hostname, "skip", noToken) : domainRow(hostname, "fail", errorMessage(err));
|
|
12880
12920
|
}
|
|
12881
12921
|
}
|
|
12882
|
-
async function checkZone(dns, zone, wanted, rowOf = (...args) => row$
|
|
12922
|
+
async function checkZone(dns, zone, wanted, rowOf = (...args) => row$27(zone, ...args)) {
|
|
12883
12923
|
try {
|
|
12884
12924
|
const have = await dns.listRecords(zone);
|
|
12885
12925
|
const problems = declaredVsActual(new Map(wanted.map((w) => [keyOf(w), w])), new Map(have.map((h) => [keyOf(h), h])), {
|
|
@@ -13046,7 +13086,7 @@ function declaredProjects$1(layouts) {
|
|
|
13046
13086
|
return [...new Set(layouts.flatMap((layout) => layout.relay?.errors?.projects ?? []))];
|
|
13047
13087
|
}
|
|
13048
13088
|
// src/commands/doctor-errors/errors-rows.ts
|
|
13049
|
-
const row$
|
|
13089
|
+
const row$26 = (id, title, status, detail, problems = []) => ({
|
|
13050
13090
|
id,
|
|
13051
13091
|
title,
|
|
13052
13092
|
status,
|
|
@@ -13063,27 +13103,27 @@ function errorsRows(found, providerName) {
|
|
|
13063
13103
|
const orgSlug = found.org.slug;
|
|
13064
13104
|
if (!found.org.exists) {
|
|
13065
13105
|
const problem = `${providerName} has no organization named ${orgSlug}; check the \`org\` option of the \`errors\` provider`;
|
|
13066
|
-
const rows = [row$
|
|
13067
|
-
for (const project of found.projects) rows.push(row$
|
|
13106
|
+
const rows = [row$26("errors:org", "organization exists", "fail", `${orgSlug} not found`, [problem])];
|
|
13107
|
+
for (const project of found.projects) rows.push(row$26(`errors:project:${project.slug}`, `project ${project.slug} exists`, "skip", "not checked: no organization"));
|
|
13068
13108
|
return rows;
|
|
13069
13109
|
}
|
|
13070
|
-
const rows = [row$
|
|
13110
|
+
const rows = [row$26("errors:org", "organization exists", "ok", `${orgSlug} (${found.org.name ?? orgSlug})`)];
|
|
13071
13111
|
if (found.projects.length === 0) {
|
|
13072
|
-
rows.push(row$
|
|
13112
|
+
rows.push(row$26("errors:projects", "declared projects", "skip", "none declared: no `relay.errors.projects` in a layout"));
|
|
13073
13113
|
return rows;
|
|
13074
13114
|
}
|
|
13075
13115
|
for (const project of found.projects) {
|
|
13076
13116
|
const slug = project.slug;
|
|
13077
13117
|
if (!project.exists) {
|
|
13078
13118
|
const problem = `no project ${slug} in ${found.org.slug}; create it in ${providerName}`;
|
|
13079
|
-
rows.push(row$
|
|
13119
|
+
rows.push(row$26(`errors:project:${slug}`, `project ${slug} exists`, "fail", "not found", [problem]), row$26(`errors:dsn:${slug}`, `project ${slug} has a key`, "skip", "not checked: no project"), row$26(`errors:alerts:${slug}`, `project ${slug} has an alert rule`, "skip", "not checked: no project"));
|
|
13080
13120
|
continue;
|
|
13081
13121
|
}
|
|
13082
|
-
rows.push(row$
|
|
13083
|
-
rows.push(project.hasDsn ? row$
|
|
13084
|
-
if (project.alertRules === void 0) rows.push(row$
|
|
13085
|
-
else if (project.alertRules === 0) rows.push(row$
|
|
13086
|
-
else rows.push(row$
|
|
13122
|
+
rows.push(row$26(`errors:project:${slug}`, `project ${slug} exists`, "ok", slug));
|
|
13123
|
+
rows.push(project.hasDsn ? row$26(`errors:dsn:${slug}`, `project ${slug} has a key`, "ok", "a client key (DSN) exists") : row$26(`errors:dsn:${slug}`, `project ${slug} has a key`, "fail", "no client key", [`${slug} has no client key, so an SDK has no DSN to send to; add one in ${providerName}`]));
|
|
13124
|
+
if (project.alertRules === void 0) rows.push(row$26(`errors:alerts:${slug}`, `project ${slug} has an alert rule`, "skip", found.alertsUnreadable ? `could not read the alert rules: ${found.alertsUnreadable}` : "not read"));
|
|
13125
|
+
else if (project.alertRules === 0) rows.push(row$26(`errors:alerts:${slug}`, `project ${slug} has an alert rule`, "fail", "no enabled rule", [`no enabled alert rule watches ${slug}, so its errors reach no one`]));
|
|
13126
|
+
else rows.push(row$26(`errors:alerts:${slug}`, `project ${slug} has an alert rule`, "ok", `${project.alertRules} enabled rule(s)`));
|
|
13087
13127
|
}
|
|
13088
13128
|
return rows;
|
|
13089
13129
|
}
|
|
@@ -13206,7 +13246,7 @@ function datasetTargets(config) {
|
|
|
13206
13246
|
* dataset, shared by every environment in it). Only a dataset the provider says is missing, or a token it refuses, fails;
|
|
13207
13247
|
* a dataset the token may not see (403), a name, a token or a response that cannot be read is a skip with the reason.
|
|
13208
13248
|
*/
|
|
13209
|
-
const row$
|
|
13249
|
+
const row$25 = (id, title, status, detail, problems = []) => ({
|
|
13210
13250
|
id,
|
|
13211
13251
|
title,
|
|
13212
13252
|
status,
|
|
@@ -13223,7 +13263,7 @@ async function runDoctorLogs(input) {
|
|
|
13223
13263
|
if (!loader.has("logs")) {
|
|
13224
13264
|
const failure = loader.loadFailures().find((f) => f.key === "logs");
|
|
13225
13265
|
const why = failure ? `\`${failure.provider}\` failed to load: ${describeError(failure.error)}` : "no `logs` provider is configured in holocron.config.ts";
|
|
13226
|
-
rows.push(row$
|
|
13266
|
+
rows.push(row$25("logs", "logs", "skip", why));
|
|
13227
13267
|
} else rows.push(...await checkLogs(loader.get("logs"), datasetTargets(input.loaded.resolved)));
|
|
13228
13268
|
printCheckRows(rows, print);
|
|
13229
13269
|
const summary = summariseChecks(rows);
|
|
@@ -13247,38 +13287,38 @@ async function checkLogs(logs, targets) {
|
|
|
13247
13287
|
for (const target of targets) {
|
|
13248
13288
|
const id = `logs:dataset:${target.id}`;
|
|
13249
13289
|
const title = `dataset for ${target.label}`;
|
|
13250
|
-
if (!target.name) rows.push(row$
|
|
13251
|
-
else if (!token.usable) rows.push(row$
|
|
13252
|
-
else if (!logs.readDataset) rows.push(row$
|
|
13290
|
+
if (!target.name) rows.push(row$25(id, title, "skip", `${target.variable} is not set here, so there is no name to look for`));
|
|
13291
|
+
else if (!token.usable) rows.push(row$25(id, title, "skip", `${target.name}: not checked, the token is not usable`));
|
|
13292
|
+
else if (!logs.readDataset) rows.push(row$25(id, title, "skip", `${logs.providerName} cannot read a dataset`));
|
|
13253
13293
|
else rows.push(...await checkDataset(logs, target, target.name, id, title));
|
|
13254
13294
|
}
|
|
13255
13295
|
const org = resolveValue$1(["AXIOM_ORG"], void 0, { prefix: PREFIX$1 });
|
|
13256
|
-
rows.push(org ? row$
|
|
13296
|
+
rows.push(org ? row$25("logs:org", "organization", "ok", `${PREFIX$1}_AXIOM_ORG (or AXIOM_ORG) is set`) : row$25("logs:org", "organization", "skip", `${PREFIX$1}_AXIOM_ORG (or AXIOM_ORG) is not set here; Sentinel's log links need it`));
|
|
13257
13297
|
return rows;
|
|
13258
13298
|
}
|
|
13259
13299
|
/** Whether the provider accepts the token. `usable` is false when it was refused or could not be tried. */
|
|
13260
13300
|
async function checkToken$1(logs, dataset) {
|
|
13261
13301
|
const title = "token is accepted";
|
|
13262
13302
|
if (!logs.checkToken) return {
|
|
13263
|
-
row: row$
|
|
13303
|
+
row: row$25("logs:token", title, "skip", `${logs.providerName} cannot check a token`),
|
|
13264
13304
|
usable: true
|
|
13265
13305
|
};
|
|
13266
13306
|
try {
|
|
13267
13307
|
const result = await logs.checkToken(dataset);
|
|
13268
13308
|
if (result.ok) return {
|
|
13269
|
-
row: row$
|
|
13309
|
+
row: row$25("logs:token", title, "ok", `${logs.providerName} accepts the token`),
|
|
13270
13310
|
usable: true
|
|
13271
13311
|
};
|
|
13272
13312
|
const reason = result.reason ?? `${logs.providerName} refused the token`;
|
|
13273
13313
|
return {
|
|
13274
|
-
row: row$
|
|
13314
|
+
row: row$25("logs:token", title, "fail", reason, [reason]),
|
|
13275
13315
|
usable: false
|
|
13276
13316
|
};
|
|
13277
13317
|
} catch (err) {
|
|
13278
13318
|
const noToken = missingTokenReason(err);
|
|
13279
13319
|
const detail = noToken ?? `could not check the token: ${describeError(err)}`;
|
|
13280
13320
|
return {
|
|
13281
|
-
row: row$
|
|
13321
|
+
row: row$25("logs:token", title, "skip", detail),
|
|
13282
13322
|
usable: noToken === void 0
|
|
13283
13323
|
};
|
|
13284
13324
|
}
|
|
@@ -13288,17 +13328,17 @@ async function checkDataset(logs, target, name, id, title) {
|
|
|
13288
13328
|
const found = await logs.readDataset(name);
|
|
13289
13329
|
if (found.forbidden) {
|
|
13290
13330
|
const why = `${name}: not visible to this token (${logs.providerName} refused the read; it may also not exist)`;
|
|
13291
|
-
return [row$
|
|
13331
|
+
return [row$25(id, title, "skip", why)];
|
|
13292
13332
|
}
|
|
13293
13333
|
if (!found.exists) {
|
|
13294
13334
|
const problem = `dataset ${name} does not exist (${target.variable}); ${target.fix}`;
|
|
13295
|
-
return [row$
|
|
13335
|
+
return [row$25(id, title, "fail", `${name} does not exist`, [problem])];
|
|
13296
13336
|
}
|
|
13297
13337
|
const retention = found.retentionDays === void 0 ? `retention: ${logs.providerName} did not report one for ${name}` : `retention: ${found.retentionDays} days for ${name}`;
|
|
13298
|
-
return [row$
|
|
13338
|
+
return [row$25(id, title, "ok", `${name} exists`), row$25(`logs:retention:${target.id}`, `retention of ${name}`, "skip", `info: ${retention}; one setting shared by every environment in the dataset (ADR-0019)`)];
|
|
13299
13339
|
} catch (err) {
|
|
13300
13340
|
const detail = missingTokenReason(err) ?? `could not read ${name}: ${describeError(err)}`;
|
|
13301
|
-
return [row$
|
|
13341
|
+
return [row$25(id, title, "skip", detail)];
|
|
13302
13342
|
}
|
|
13303
13343
|
}
|
|
13304
13344
|
// src/commands/doctor-logs/doctor-logs.command.ts
|
|
@@ -16893,7 +16933,7 @@ const info = (id, title, noun, extras) => ({
|
|
|
16893
16933
|
detail: `info: ${extras.length} ${noun} not in the template (never deleted)`,
|
|
16894
16934
|
problems: extras
|
|
16895
16935
|
});
|
|
16896
|
-
const row$
|
|
16936
|
+
const row$24 = (id, title, problems, ok) => ({
|
|
16897
16937
|
id,
|
|
16898
16938
|
title,
|
|
16899
16939
|
status: problems.length > 0 ? "fail" : "ok",
|
|
@@ -16929,19 +16969,19 @@ function viewProblems(want, found) {
|
|
|
16929
16969
|
function boardRows(boardName, template, state) {
|
|
16930
16970
|
const id = `project:${boardName}`;
|
|
16931
16971
|
const rows = [];
|
|
16932
|
-
rows.push(row$
|
|
16972
|
+
rows.push(row$24(`${id}:statuses`, `${boardName}: statuses`, listProblems("status", "statuses", template.statuses.map((s) => s.name), state.statuses), `${template.statuses.length} in order`));
|
|
16933
16973
|
const extraStatuses = state.statuses.filter((s) => !template.statuses.some((t) => t.name === s));
|
|
16934
16974
|
if (extraStatuses.length > 0) rows.push(info(`${id}:extra-statuses`, `${boardName}: extra statuses`, "status(es)", extraStatuses));
|
|
16935
|
-
for (const want of template.fields) rows.push(row$
|
|
16975
|
+
for (const want of template.fields) rows.push(row$24(`${id}:field:${want.name}`, `${boardName}: field ${want.name}`, fieldProblems(want, state.fields.find((f) => f.name === want.name)), want.options ? `${want.options.length} options in order` : want.type));
|
|
16936
16976
|
const extraFields = state.fields.filter((f) => !template.fields.some((t) => t.name === f.name));
|
|
16937
16977
|
if (extraFields.length > 0) rows.push(info(`${id}:extra-fields`, `${boardName}: extra fields`, "field(s)", extraFields.map((f) => f.name)));
|
|
16938
|
-
for (const want of template.views) rows.push(row$
|
|
16978
|
+
for (const want of template.views) rows.push(row$24(`${id}:view:${want.name}`, `${boardName}: view ${want.name}`, viewProblems(want, state.views.find((v) => v.name === want.name)), `${want.layout}${want.filter ? `, ${want.filter}` : ""}`));
|
|
16939
16979
|
const extraViews = state.views.filter((v) => !template.views.some((t) => t.name === v.name));
|
|
16940
16980
|
if (extraViews.length > 0) rows.push(info(`${id}:extra-views`, `${boardName}: extra views`, "view(s)", extraViews.map((v) => v.name)));
|
|
16941
16981
|
for (const name of template.rules ?? []) {
|
|
16942
16982
|
const found = state.rules.find((r) => r.name === name);
|
|
16943
16983
|
const problems = !found ? [`missing rule ${name}`] : found.enabled ? [] : [`rule ${name} is off`];
|
|
16944
|
-
rows.push(row$
|
|
16984
|
+
rows.push(row$24(`${id}:rule:${name}`, `${boardName}: rule ${name}`, problems, "on"));
|
|
16945
16985
|
}
|
|
16946
16986
|
return rows;
|
|
16947
16987
|
}
|
|
@@ -17001,7 +17041,7 @@ function itemRows(boardName, items) {
|
|
|
17001
17041
|
* never fail the run. A template file that does not read is a failure naming the file. `--post [channel]` shares the
|
|
17002
17042
|
* failing rows through the `notifications` provider's bot, like `doctor notifications --post`.
|
|
17003
17043
|
*/
|
|
17004
|
-
const row$
|
|
17044
|
+
const row$23 = (id, title, status, detail, problems = []) => ({
|
|
17005
17045
|
id,
|
|
17006
17046
|
title,
|
|
17007
17047
|
status,
|
|
@@ -17055,14 +17095,14 @@ async function checkBoards(input, loader) {
|
|
|
17055
17095
|
loader,
|
|
17056
17096
|
...input.io ? { io: input.io } : {}
|
|
17057
17097
|
});
|
|
17058
|
-
if (!opened.ok) return [row$
|
|
17098
|
+
if (!opened.ok) return [row$23("project", "project", opened.kind, opened.reason, opened.problems)];
|
|
17059
17099
|
const { projects, owner, boards, templates, templateProblems } = opened.context;
|
|
17060
17100
|
const rows = templateProblems.map((problem) => {
|
|
17061
17101
|
/* v8 ignore next -- split always returns at least one element; the fallback only satisfies noUncheckedIndexedAccess */
|
|
17062
17102
|
const file = problem.split(": ")[0] ?? problem;
|
|
17063
|
-
return row$
|
|
17103
|
+
return row$23(`project:template:${file}`, `template file ${file}`, "fail", problem);
|
|
17064
17104
|
});
|
|
17065
|
-
if (boards.length === 0) return [...rows, row$
|
|
17105
|
+
if (boards.length === 0) return [...rows, row$23("project", "project", "skip", "no boards are declared in `providers.projects.boards`")];
|
|
17066
17106
|
for (const declared of boards) {
|
|
17067
17107
|
const template = templates[declared.template];
|
|
17068
17108
|
const title = `${declared.name}: board exists and is open`;
|
|
@@ -17070,18 +17110,18 @@ async function checkBoards(input, loader) {
|
|
|
17070
17110
|
const board = await projects.find(owner, declared.name);
|
|
17071
17111
|
if (!board) {
|
|
17072
17112
|
const closed = (await projects.list(owner)).some((b) => b.name === declared.name && b.closed);
|
|
17073
|
-
rows.push(row$
|
|
17113
|
+
rows.push(row$23(`project:${declared.name}`, title, "fail", closed ? "the board is closed" : "no open board has this name", [closed ? "reopen it, or run `holocron setup project` to make a new one" : "run `holocron setup project`"]));
|
|
17074
17114
|
continue;
|
|
17075
17115
|
}
|
|
17076
|
-
rows.push(row$
|
|
17116
|
+
rows.push(row$23(`project:${declared.name}`, title, "ok", board.url));
|
|
17077
17117
|
if (!template) {
|
|
17078
|
-
rows.push(row$
|
|
17118
|
+
rows.push(row$23(`project:${declared.name}:template`, `${declared.name}: template ${declared.template}`, "fail", "no built-in or file template has this name"));
|
|
17079
17119
|
continue;
|
|
17080
17120
|
}
|
|
17081
17121
|
rows.push(...boardRows(declared.name, template, await projects.read(owner, board)));
|
|
17082
|
-
rows.push(...projects.items ? itemRows(declared.name, await projects.items(owner, board, template)) : [row$
|
|
17122
|
+
rows.push(...projects.items ? itemRows(declared.name, await projects.items(owner, board, template)) : [row$23(`project:${declared.name}:items`, `${declared.name}: items`, "skip", "the provider cannot list a board's items")]);
|
|
17083
17123
|
} catch (err) {
|
|
17084
|
-
rows.push(row$
|
|
17124
|
+
rows.push(row$23(`project:${declared.name}`, title, "fail", describeError(err)));
|
|
17085
17125
|
}
|
|
17086
17126
|
}
|
|
17087
17127
|
return rows;
|
|
@@ -18181,19 +18221,19 @@ async function runDoctorRepo(input) {
|
|
|
18181
18221
|
const rows = [];
|
|
18182
18222
|
if (!loader.has("source")) {
|
|
18183
18223
|
const why = whyMissing(loader, "source", "no `source` provider to read the repository with");
|
|
18184
|
-
for (const check of checks) rows.push(row$
|
|
18224
|
+
for (const check of checks) rows.push(row$22(check, { skip: why }));
|
|
18185
18225
|
} else {
|
|
18186
18226
|
const source = loader.get("source");
|
|
18187
18227
|
for (const check of checks) {
|
|
18188
18228
|
if (typeof source[check.needs] !== "function") {
|
|
18189
|
-
rows.push(row$
|
|
18229
|
+
rows.push(row$22(check, { skip: `provider does not implement ${check.needs}` }));
|
|
18190
18230
|
continue;
|
|
18191
18231
|
}
|
|
18192
18232
|
try {
|
|
18193
|
-
rows.push(row$
|
|
18233
|
+
rows.push(row$22(check, await check.run(source)));
|
|
18194
18234
|
} catch (err) {
|
|
18195
18235
|
const noToken = missingTokenReason(err);
|
|
18196
|
-
if (noToken !== void 0) rows.push(row$
|
|
18236
|
+
if (noToken !== void 0) rows.push(row$22(check, { skip: noToken }));
|
|
18197
18237
|
else rows.push({
|
|
18198
18238
|
id: check.id,
|
|
18199
18239
|
title: check.title,
|
|
@@ -18220,7 +18260,7 @@ async function runDoctorRepo(input) {
|
|
|
18220
18260
|
...status === "skip" ? { reason: rows.map((r) => r.detail).join("; ") } : {}
|
|
18221
18261
|
};
|
|
18222
18262
|
}
|
|
18223
|
-
function row$
|
|
18263
|
+
function row$22(check, result) {
|
|
18224
18264
|
const { id, title } = check;
|
|
18225
18265
|
if ("skip" in result) return {
|
|
18226
18266
|
id,
|
|
@@ -18744,7 +18784,7 @@ function providerGroup(providerName) {
|
|
|
18744
18784
|
}
|
|
18745
18785
|
// src/commands/doctor-secrets/credentials-rows.ts
|
|
18746
18786
|
/** A row for the provider as a whole, or for one of its variables when `name` is given. */
|
|
18747
|
-
function row$
|
|
18787
|
+
function row$21(provider, status, detail, name) {
|
|
18748
18788
|
return name === void 0 ? {
|
|
18749
18789
|
id: provider,
|
|
18750
18790
|
title: provider,
|
|
@@ -18769,10 +18809,10 @@ async function credentialsRows(input) {
|
|
|
18769
18809
|
const { loader } = input;
|
|
18770
18810
|
const { resolved } = input.loaded;
|
|
18771
18811
|
if (!resolved.providers.credentials) return {
|
|
18772
|
-
rows: input.asked ? [row$
|
|
18812
|
+
rows: input.asked ? [row$21("credentials", "skip", "no `credentials` provider is configured")] : [],
|
|
18773
18813
|
places: []
|
|
18774
18814
|
};
|
|
18775
|
-
const rows = loader.loadFailures().filter((f) => f.key === "credentials").map((f) => row$
|
|
18815
|
+
const rows = loader.loadFailures().filter((f) => f.key === "credentials").map((f) => row$21(f.provider, "fail", `failed to load: ${errorMessage(f.error)}`));
|
|
18776
18816
|
const places = [];
|
|
18777
18817
|
if (!loader.has("credentials")) return {
|
|
18778
18818
|
rows,
|
|
@@ -18784,7 +18824,7 @@ async function credentialsRows(input) {
|
|
|
18784
18824
|
const tuple = tuples.find((t) => t.provider === impl.providerName);
|
|
18785
18825
|
const explicit = tuple && credentialsEnvironment(tuple, resolved);
|
|
18786
18826
|
if (!explicit && !derivesEnvironment(impl.providerName)) {
|
|
18787
|
-
rows.push(row$
|
|
18827
|
+
rows.push(row$21(impl.providerName, "skip", "no `environment` option and `credentials.environment` is not set"));
|
|
18788
18828
|
continue;
|
|
18789
18829
|
}
|
|
18790
18830
|
try {
|
|
@@ -18796,7 +18836,7 @@ async function credentialsRows(input) {
|
|
|
18796
18836
|
rows.push(...checked.rows);
|
|
18797
18837
|
places.push(...checked.places);
|
|
18798
18838
|
} catch (err) {
|
|
18799
|
-
rows.push(row$
|
|
18839
|
+
rows.push(row$21(impl.providerName, "fail", errorMessage(err)));
|
|
18800
18840
|
}
|
|
18801
18841
|
}
|
|
18802
18842
|
return {
|
|
@@ -18812,17 +18852,17 @@ async function credentialsRows(input) {
|
|
|
18812
18852
|
async function checkProvider(impl, candidates, expected, synced) {
|
|
18813
18853
|
const provider = impl.providerName;
|
|
18814
18854
|
if (!impl.inspect) return {
|
|
18815
|
-
rows: [row$
|
|
18855
|
+
rows: [row$21(provider, "skip", "cannot list the variables without reading their values")],
|
|
18816
18856
|
places: []
|
|
18817
18857
|
};
|
|
18818
18858
|
if (expected.length === 0) return {
|
|
18819
|
-
rows: [row$
|
|
18859
|
+
rows: [row$21(provider, "skip", "no configured plugin lists the tokens it takes")],
|
|
18820
18860
|
places: []
|
|
18821
18861
|
};
|
|
18822
18862
|
const inspect = impl.inspect.bind(impl);
|
|
18823
18863
|
try {
|
|
18824
18864
|
const { found, missing } = await tryEnvironments(candidates, inspect);
|
|
18825
|
-
const rows = missing.map((name) => row$
|
|
18865
|
+
const rows = missing.map((name) => row$21(provider, "fail", `${provider} has no Environment named "${name}"`));
|
|
18826
18866
|
const group = providerGroup(provider);
|
|
18827
18867
|
const unreadPlaces = missing.map((name) => ({
|
|
18828
18868
|
column: {
|
|
@@ -18845,9 +18885,9 @@ async function checkProvider(impl, candidates, expected, synced) {
|
|
|
18845
18885
|
const have = (name) => found.some((f) => f.result.names.includes(name));
|
|
18846
18886
|
let present = 0;
|
|
18847
18887
|
for (const { name, optional } of expected) if (have(name)) present++;
|
|
18848
|
-
else if (optional) rows.push(row$
|
|
18849
|
-
else rows.push(row$
|
|
18850
|
-
if (present > 0) rows.push(row$
|
|
18888
|
+
else if (optional) rows.push(row$21(provider, "skip", `optional, not set in ${where}`, name));
|
|
18889
|
+
else rows.push(row$21(provider, "fail", `missing from ${where}`, name));
|
|
18890
|
+
if (present > 0) rows.push(row$21(provider, "ok", `${present} of ${expected.length} tokens present in ${where}`, "tokens"));
|
|
18851
18891
|
const names = new Set(expected.map((e) => e.name));
|
|
18852
18892
|
const places = [];
|
|
18853
18893
|
const missingRequired = expected.filter((e) => !e.optional && !have(e.name)).map((e) => e.name);
|
|
@@ -18886,7 +18926,7 @@ async function checkProvider(impl, candidates, expected, synced) {
|
|
|
18886
18926
|
};
|
|
18887
18927
|
} catch (err) {
|
|
18888
18928
|
return {
|
|
18889
|
-
rows: [row$
|
|
18929
|
+
rows: [row$21(provider, "fail", errorMessage(err))],
|
|
18890
18930
|
places: []
|
|
18891
18931
|
};
|
|
18892
18932
|
}
|
|
@@ -19760,7 +19800,7 @@ async function variableRows(loader, config, org) {
|
|
|
19760
19800
|
if (!loader.has("source")) {
|
|
19761
19801
|
const why = whyMissing(loader, "source", "no `source` provider to read them with");
|
|
19762
19802
|
for (const check of checks) {
|
|
19763
|
-
rows.push(row$
|
|
19803
|
+
rows.push(row$20(check, { skip: why }));
|
|
19764
19804
|
observations.push({
|
|
19765
19805
|
scope: check.scope,
|
|
19766
19806
|
unread: why
|
|
@@ -19770,7 +19810,7 @@ async function variableRows(loader, config, org) {
|
|
|
19770
19810
|
const source = loader.get("source");
|
|
19771
19811
|
for (const check of checks) try {
|
|
19772
19812
|
const result = await check.run(source);
|
|
19773
|
-
rows.push(row$
|
|
19813
|
+
rows.push(row$20(check, result));
|
|
19774
19814
|
observations.push("skip" in result ? {
|
|
19775
19815
|
scope: check.scope,
|
|
19776
19816
|
unread: result.skip
|
|
@@ -19781,7 +19821,7 @@ async function variableRows(loader, config, org) {
|
|
|
19781
19821
|
} catch (err) {
|
|
19782
19822
|
const noToken = missingTokenReason(err);
|
|
19783
19823
|
if (noToken !== void 0) {
|
|
19784
|
-
rows.push(row$
|
|
19824
|
+
rows.push(row$20(check, { skip: noToken }));
|
|
19785
19825
|
observations.push({
|
|
19786
19826
|
scope: check.scope,
|
|
19787
19827
|
unread: noToken
|
|
@@ -19807,7 +19847,7 @@ async function variableRows(loader, config, org) {
|
|
|
19807
19847
|
observations
|
|
19808
19848
|
};
|
|
19809
19849
|
}
|
|
19810
|
-
function row$
|
|
19850
|
+
function row$20(check, result) {
|
|
19811
19851
|
const { id, title } = check;
|
|
19812
19852
|
if ("skip" in result) return {
|
|
19813
19853
|
id,
|
|
@@ -19897,7 +19937,7 @@ function describeExpiry(expiresAt, now) {
|
|
|
19897
19937
|
*
|
|
19898
19938
|
* What a token may do is not checked: GitHub does not return a fine-grained token's permissions.
|
|
19899
19939
|
*/
|
|
19900
|
-
function row$
|
|
19940
|
+
function row$19(id, status, detail) {
|
|
19901
19941
|
return {
|
|
19902
19942
|
id: `verify:${id}`,
|
|
19903
19943
|
title: `verify ${id}`,
|
|
@@ -19925,12 +19965,12 @@ async function verifyRows(input) {
|
|
|
19925
19965
|
try {
|
|
19926
19966
|
module = await importer(pkg);
|
|
19927
19967
|
} catch (err) {
|
|
19928
|
-
rows.push(row$
|
|
19968
|
+
rows.push(row$19(pkg, "skip", `cannot load the plugin: ${errorMessage(err)}`));
|
|
19929
19969
|
continue;
|
|
19930
19970
|
}
|
|
19931
19971
|
for (const token of module.tokens ?? []) rows.push(await checkToken(token, module, env, readToken, now()));
|
|
19932
19972
|
}
|
|
19933
|
-
if (rows.length === 0) rows.push(row$
|
|
19973
|
+
if (rows.length === 0) rows.push(row$19("tokens", "skip", "no configured plugin lists the tokens it takes"));
|
|
19934
19974
|
return rows;
|
|
19935
19975
|
}
|
|
19936
19976
|
/**
|
|
@@ -19943,30 +19983,30 @@ async function loadCredentials(input) {
|
|
|
19943
19983
|
try {
|
|
19944
19984
|
await input.loader.load();
|
|
19945
19985
|
} catch (err) {
|
|
19946
|
-
return [row$
|
|
19986
|
+
return [row$19("credentials", "skip", `could not load the credentials providers: ${errorMessage(err)}`)];
|
|
19947
19987
|
}
|
|
19948
|
-
return input.loader.loadFailures().filter((failure) => failure.key === "credentials").map((failure) => row$
|
|
19988
|
+
return input.loader.loadFailures().filter((failure) => failure.key === "credentials").map((failure) => row$19(`credentials ${failure.provider}`, "fail", `could not be read: ${errorMessage(failure.error)}`));
|
|
19949
19989
|
}
|
|
19950
19990
|
async function checkToken(token, module, env, readToken, now) {
|
|
19951
19991
|
const { keyringKey, envName, vendorEnvName } = token;
|
|
19952
19992
|
const fromEnv = env.get(envName) ? envName : vendorEnvName && env.get(vendorEnvName) ? vendorEnvName : void 0;
|
|
19953
19993
|
const stored = fromEnv ? void 0 : findCredential(...vendorEnvName ? [envName, vendorEnvName] : [envName]);
|
|
19954
19994
|
const value = fromEnv ? env.get(fromEnv) : stored?.value ?? readToken(keyringKey);
|
|
19955
|
-
if (!value) return row$
|
|
19995
|
+
if (!value) return row$19(keyringKey, "skip", `not set (${vendorEnvName ? `${envName} / ${vendorEnvName}` : envName}, or \`holocron new token ${keyringKey}\`)`);
|
|
19956
19996
|
const verify = token.verify ?? (token.verifiable === false ? void 0 : module.verifyToken);
|
|
19957
|
-
if (!verify) return row$
|
|
19997
|
+
if (!verify) return row$19(keyringKey, "skip", "set, but its plugin cannot verify it");
|
|
19958
19998
|
const from = fromEnv ?? stored?.source ?? "keyring";
|
|
19959
19999
|
try {
|
|
19960
20000
|
const verified = await verify(value);
|
|
19961
|
-
if (!verified.ok) return row$
|
|
20001
|
+
if (!verified.ok) return row$19(keyringKey, "fail", `rejected (${from}): ${verified.message}`);
|
|
19962
20002
|
const expiry = verified.expiresAt ? describeExpiry(verified.expiresAt, now) : void 0;
|
|
19963
|
-
if (!expiry) return row$
|
|
20003
|
+
if (!expiry) return row$19(keyringKey, "ok", `${verified.subject} (${from})`);
|
|
19964
20004
|
return expiry.soon ? {
|
|
19965
|
-
...row$
|
|
20005
|
+
...row$19(keyringKey, "fail", `${verified.subject} (${from}), ${expiry.text}`),
|
|
19966
20006
|
problems: [`${expiry.text}: renew it`]
|
|
19967
|
-
} : row$
|
|
20007
|
+
} : row$19(keyringKey, "ok", `${verified.subject} (${from}), ${expiry.text}`);
|
|
19968
20008
|
} catch (err) {
|
|
19969
|
-
return row$
|
|
20009
|
+
return row$19(keyringKey, "fail", `could not be verified (${from}): ${errorMessage(err)}`);
|
|
19970
20010
|
}
|
|
19971
20011
|
}
|
|
19972
20012
|
// src/commands/doctor-secrets/doctor-secrets.ts
|
|
@@ -20564,6 +20604,12 @@ const DEFAULT_TOKEN_ROTATION = {
|
|
|
20564
20604
|
maxAgeDays: 90,
|
|
20565
20605
|
warnDays: 14
|
|
20566
20606
|
};
|
|
20607
|
+
/**
|
|
20608
|
+
* The labels of the rows that fail for a token that is due (`expired on ...`, `expires on ... (N days left)` inside the
|
|
20609
|
+
* warning window, `N days old`): what `rotate tokens` looks for in a `doctor tokens` problem to tell a token that is due
|
|
20610
|
+
* from one that only lacks a permission.
|
|
20611
|
+
*/
|
|
20612
|
+
const ROTATION_LABELS = ["expiry", "age"];
|
|
20567
20613
|
// src/commands/token-expectations/token-expectations.ts
|
|
20568
20614
|
/**
|
|
20569
20615
|
* Reads what a plugin's tokens declare (`PluginToken.expect`) as one entry per token and layer that holds it, in the
|
|
@@ -20648,7 +20694,7 @@ function summariseProbeRows(id, title, rows) {
|
|
|
20648
20694
|
* provider with no `token` probe, no declared layer, or one that cannot be read is a skip with the reason.
|
|
20649
20695
|
*/
|
|
20650
20696
|
const PROBE = "token";
|
|
20651
|
-
const row$
|
|
20697
|
+
const row$18 = (id, title, status, detail, problems = []) => ({
|
|
20652
20698
|
id,
|
|
20653
20699
|
title,
|
|
20654
20700
|
status,
|
|
@@ -20673,12 +20719,12 @@ async function runDoctorTokens(input) {
|
|
|
20673
20719
|
try {
|
|
20674
20720
|
tokens = await providerTokens(provider);
|
|
20675
20721
|
} catch (err) {
|
|
20676
|
-
rows.push(row$
|
|
20722
|
+
rows.push(row$18(`tokens:${provider}`, provider, "skip", `could not read its tokens: ${describeError(err)}`));
|
|
20677
20723
|
continue;
|
|
20678
20724
|
}
|
|
20679
20725
|
const expectations = tokenExpectations(tokens);
|
|
20680
|
-
if (expectations.length === 0) rows.push(row$
|
|
20681
|
-
else if (!usableProbe(probes.get(provider))) rows.push(row$
|
|
20726
|
+
if (expectations.length === 0) rows.push(row$18(`tokens:${provider}`, provider, "skip", "info: declares no token layers, nothing to check"));
|
|
20727
|
+
else if (!usableProbe(probes.get(provider))) rows.push(row$18(`tokens:${provider}`, provider, "skip", `info: has no \`${PROBE}\` probe loaded, so its tokens are not checked`));
|
|
20682
20728
|
else declared.push({
|
|
20683
20729
|
provider,
|
|
20684
20730
|
tokens,
|
|
@@ -20740,14 +20786,14 @@ async function checkLayer(c) {
|
|
|
20740
20786
|
tokens
|
|
20741
20787
|
});
|
|
20742
20788
|
} catch (err) {
|
|
20743
|
-
if (err instanceof HoldsNoTokenError) return c.wanted.map((e) => row$
|
|
20744
|
-
return c.wanted.map((e) => row$
|
|
20789
|
+
if (err instanceof HoldsNoTokenError) return c.wanted.map((e) => row$18(id(e), title(e), "fail", "not held in this layer", [err.message]));
|
|
20790
|
+
return c.wanted.map((e) => row$18(id(e), title(e), "skip", `could not read the Environment: ${describeError(err)}`));
|
|
20745
20791
|
}
|
|
20746
20792
|
const rows = [];
|
|
20747
20793
|
for (const e of c.wanted) {
|
|
20748
20794
|
const token = held.held.find((h) => h.envName === e.envName);
|
|
20749
20795
|
if (!token) {
|
|
20750
|
-
rows.push(row$
|
|
20796
|
+
rows.push(row$18(id(e), title(e), "fail", `not held in ${held.environment}`, [`${e.envName} is declared for ${c.layer}`]));
|
|
20751
20797
|
continue;
|
|
20752
20798
|
}
|
|
20753
20799
|
rows.push(summariseProbeRows(id(e), title(e), await probeToken(c, e, token.token, held.plain)));
|
|
@@ -20820,7 +20866,7 @@ const doctorTokensCommand = {
|
|
|
20820
20866
|
}
|
|
20821
20867
|
};
|
|
20822
20868
|
// src/commands/doctor-wiki/wiki-rows.ts
|
|
20823
|
-
const row$
|
|
20869
|
+
const row$17 = (id, title, status, detail, problems = []) => ({
|
|
20824
20870
|
id,
|
|
20825
20871
|
title,
|
|
20826
20872
|
status,
|
|
@@ -20836,11 +20882,11 @@ const names = (paths) => paths.length > LISTED ? `${paths.slice(0, LISTED).join(
|
|
|
20836
20882
|
* skip, since a machine with no network says nothing about the site.
|
|
20837
20883
|
*/
|
|
20838
20884
|
function siteRow(id, title, probe, notFoundHint) {
|
|
20839
|
-
if (probe.status === void 0) return row$
|
|
20840
|
-
if (probe.status < 400) return row$
|
|
20841
|
-
if (probe.status === 401 || probe.status === 403) return row$
|
|
20885
|
+
if (probe.status === void 0) return row$17(id, title, "skip", `${probe.url}: ${probe.error ?? "no answer"}`);
|
|
20886
|
+
if (probe.status < 400) return row$17(id, title, "ok", `${probe.url} answers ${probe.status}`);
|
|
20887
|
+
if (probe.status === 401 || probe.status === 403) return row$17(id, title, "ok", `${probe.url} answers ${probe.status} (access is restricted)`);
|
|
20842
20888
|
const problem = probe.status === 404 ? `${probe.url} answers 404; ${notFoundHint}` : `${probe.url} answers ${probe.status}, expected a page`;
|
|
20843
|
-
return row$
|
|
20889
|
+
return row$17(id, title, "fail", `${probe.url} answers ${probe.status}`, [problem]);
|
|
20844
20890
|
}
|
|
20845
20891
|
/**
|
|
20846
20892
|
* The rows `holocron doctor wiki` prints for one {@link WikiInspection}: organization, docs instance, the site and its
|
|
@@ -20852,42 +20898,42 @@ function wikiRows(found, providerName) {
|
|
|
20852
20898
|
const { declared, found: foundOrg } = found.organization;
|
|
20853
20899
|
if (foundOrg === null) {
|
|
20854
20900
|
const problem = `fern/fern.config.json has no organization; \`holocron setup\` writes it`;
|
|
20855
|
-
rows.push(row$
|
|
20901
|
+
rows.push(row$17("wiki:organization", "organization is set", "fail", problem, [problem]));
|
|
20856
20902
|
} else if (foundOrg !== declared) {
|
|
20857
20903
|
const problem = `fern/fern.config.json names ${foundOrg}, the config declares ${declared}; run \`holocron setup\``;
|
|
20858
|
-
rows.push(row$
|
|
20859
|
-
} else rows.push(row$
|
|
20904
|
+
rows.push(row$17("wiki:organization", "organization is set", "fail", `${foundOrg}, declared ${declared}`, [problem]));
|
|
20905
|
+
} else rows.push(row$17("wiki:organization", "organization is set", "ok", `${declared} in fern/fern.config.json`));
|
|
20860
20906
|
const instance = found.instance;
|
|
20861
20907
|
if (instance === null) {
|
|
20862
20908
|
const problem = "fern/docs.yml does not exist; `holocron setup` writes it";
|
|
20863
|
-
rows.push(row$
|
|
20909
|
+
rows.push(row$17("wiki:instance", "docs site is declared", "fail", problem, [problem]));
|
|
20864
20910
|
} else {
|
|
20865
20911
|
const problems = [];
|
|
20866
20912
|
if (instance.foundUrl !== instance.expectedUrl) problems.push(`instance url is ${instance.foundUrl ?? "not set"}, expected ${instance.expectedUrl}`);
|
|
20867
20913
|
if (instance.expectedDomain !== void 0 && instance.foundDomain !== instance.expectedDomain) problems.push(`custom-domain is ${instance.foundDomain ?? "not set"}, expected ${instance.expectedDomain}`);
|
|
20868
|
-
rows.push(problems.length > 0 ? row$
|
|
20914
|
+
rows.push(problems.length > 0 ? row$17("wiki:instance", "docs site is declared", "fail", `${problems.length} problem(s)`, [...problems.map((p) => `fern/docs.yml: ${p}`)]) : row$17("wiki:instance", "docs site is declared", "ok", `${instance.expectedUrl} in fern/docs.yml`));
|
|
20869
20915
|
}
|
|
20870
20916
|
const [site, domain] = found.site;
|
|
20871
20917
|
if (site) rows.push(siteRow("wiki:site", "docs site answers", site, `the organization or its docs are not published; run the wiki workflow (\`fern generate --docs\`)`));
|
|
20872
20918
|
if (domain) rows.push(siteRow("wiki:domain", "custom domain answers", domain, `check the ${providerName} dashboard for the domain and \`holocron doctor dns\` for its record`));
|
|
20873
|
-
if (found.navigation === null) rows.push(row$
|
|
20919
|
+
if (found.navigation === null) rows.push(row$17("wiki:navigation", "navigation pages exist", "skip", "no fern/docs.yml to read"));
|
|
20874
20920
|
else if (found.navigation.missing.length > 0) {
|
|
20875
20921
|
const problems = found.navigation.missing.map((p) => `${p} is listed in fern/docs.yml but is not on disk`);
|
|
20876
|
-
rows.push(row$
|
|
20922
|
+
rows.push(row$17("wiki:navigation", "navigation pages exist", "fail", `${found.navigation.missing.length} missing`, problems));
|
|
20877
20923
|
} else {
|
|
20878
|
-
rows.push(row$
|
|
20879
|
-
if (found.navigation.unlisted.length > 0) rows.push(row$
|
|
20924
|
+
rows.push(row$17("wiki:navigation", "navigation pages exist", "ok", `${found.navigation.listed} listed pages exist`));
|
|
20925
|
+
if (found.navigation.unlisted.length > 0) rows.push(row$17("wiki:unlisted", "pages under docs/wiki are listed", "skip", `info: ${found.navigation.unlisted.length} not in the navigation (${names(found.navigation.unlisted)}); they are not published`));
|
|
20880
20926
|
}
|
|
20881
20927
|
const published = found.published;
|
|
20882
20928
|
const listed = found.navigation?.listed;
|
|
20883
|
-
if (!published) rows.push(row$
|
|
20929
|
+
if (!published) rows.push(row$17("wiki:published", "published pages", "skip", "the site's page index could not be asked"));
|
|
20884
20930
|
else if (published.pages === void 0) {
|
|
20885
20931
|
const why = published.status === void 0 ? published.error ?? "no answer" : `answered ${published.status}`;
|
|
20886
|
-
rows.push(row$
|
|
20932
|
+
rows.push(row$17("wiki:published", "published pages", "skip", `${published.url}: ${why}`));
|
|
20887
20933
|
} else if (listed !== void 0 && published.pages < listed) {
|
|
20888
20934
|
const problem = `${published.url} lists ${published.pages} page(s), the navigation lists ${listed}; the last publish is behind (run the wiki workflow)`;
|
|
20889
|
-
rows.push(row$
|
|
20890
|
-
} else rows.push(row$
|
|
20935
|
+
rows.push(row$17("wiki:published", "published pages", "fail", `${published.pages} of ${listed}`, [problem]));
|
|
20936
|
+
} else rows.push(row$17("wiki:published", "published pages", "ok", listed === void 0 ? `${published.pages} page(s) in ${published.url}` : `${published.pages} page(s) published for ${listed} listed`));
|
|
20891
20937
|
return rows;
|
|
20892
20938
|
}
|
|
20893
20939
|
// src/commands/doctor-wiki/doctor-wiki.ts
|
|
@@ -20993,7 +21039,7 @@ function readFailureRow(id, title, err) {
|
|
|
20993
21039
|
};
|
|
20994
21040
|
}
|
|
20995
21041
|
// src/commands/doctor-workers/check-project.ts
|
|
20996
|
-
const row$
|
|
21042
|
+
const row$16 = (id, title, status, detail, problems = []) => ({
|
|
20997
21043
|
id,
|
|
20998
21044
|
title,
|
|
20999
21045
|
status,
|
|
@@ -21022,30 +21068,30 @@ async function checkProject(deploy, declared) {
|
|
|
21022
21068
|
let exists = false;
|
|
21023
21069
|
try {
|
|
21024
21070
|
exists = (await deploy.listProjects()).some((p) => same$1(p.name, project) || p.id === project);
|
|
21025
|
-
rows.push(exists ? row$
|
|
21071
|
+
rows.push(exists ? row$16(ids.exists, titles.exists, "ok", `${project} on ${deploy.providerName}`) : row$16(ids.exists, titles.exists, "fail", "not found", [`no project ${project} on ${deploy.providerName}; \`holocron setup\` makes it`]));
|
|
21026
21072
|
} catch (err) {
|
|
21027
21073
|
rows.push(readFailureRow(ids.exists, titles.exists, err));
|
|
21028
21074
|
}
|
|
21029
21075
|
const notChecked = (reason) => `not checked: ${reason}`;
|
|
21030
21076
|
const gone = exists ? void 0 : "the project is not readable or not there";
|
|
21031
|
-
if (declared.hostname === void 0) {} else if (gone) rows.push(row$
|
|
21032
|
-
else if (!deploy.listDomains) rows.push(row$
|
|
21077
|
+
if (declared.hostname === void 0) {} else if (gone) rows.push(row$16(ids.domain, titles.domain, "skip", notChecked(gone)));
|
|
21078
|
+
else if (!deploy.listDomains) rows.push(row$16(ids.domain, titles.domain, "skip", `the \`${deploy.providerName}\` provider cannot list domains`));
|
|
21033
21079
|
else try {
|
|
21034
21080
|
const attached = await deploy.listDomains(project);
|
|
21035
|
-
rows.push(attached.some((d) => same$1(d, declared.hostname)) ? row$
|
|
21081
|
+
rows.push(attached.some((d) => same$1(d, declared.hostname)) ? row$16(ids.domain, titles.domain, "ok", `${declared.hostname} attached`) : row$16(ids.domain, titles.domain, "fail", `${declared.hostname} not attached`, [`${declared.hostname} is not a domain of ${project}; \`holocron setup\` attaches it`]));
|
|
21036
21082
|
} catch (err) {
|
|
21037
21083
|
rows.push(readFailureRow(ids.domain, titles.domain, err));
|
|
21038
21084
|
}
|
|
21039
|
-
if (gone) rows.push(row$
|
|
21040
|
-
else if (!deploy.latestDeployment) rows.push(row$
|
|
21085
|
+
if (gone) rows.push(row$16(ids.deploy, titles.deploy, "skip", notChecked(gone)));
|
|
21086
|
+
else if (!deploy.latestDeployment) rows.push(row$16(ids.deploy, titles.deploy, "skip", `the \`${deploy.providerName}\` provider cannot list deployments`));
|
|
21041
21087
|
else try {
|
|
21042
21088
|
const latest = await deploy.latestDeployment(project);
|
|
21043
|
-
if (!latest) rows.push(row$
|
|
21044
|
-
else if (latest.status === "ready") rows.push(row$
|
|
21089
|
+
if (!latest) rows.push(row$16(ids.deploy, titles.deploy, "skip", "no production deployment yet"));
|
|
21090
|
+
else if (latest.status === "ready") rows.push(row$16(ids.deploy, titles.deploy, "ok", latest.createdAt ? `ready, ${latest.createdAt}` : "ready"));
|
|
21045
21091
|
else if (latest.status === "error") {
|
|
21046
21092
|
const why = latest.errorMessage ? `: ${latest.errorMessage}` : "";
|
|
21047
|
-
rows.push(row$
|
|
21048
|
-
} else rows.push(row$
|
|
21093
|
+
rows.push(row$16(ids.deploy, titles.deploy, "fail", "the newest deployment errored", [`the newest production deployment of ${project} failed${why}`]));
|
|
21094
|
+
} else rows.push(row$16(ids.deploy, titles.deploy, "skip", `info: the newest deployment is ${latest.status}`));
|
|
21049
21095
|
} catch (err) {
|
|
21050
21096
|
rows.push(readFailureRow(ids.deploy, titles.deploy, err));
|
|
21051
21097
|
}
|
|
@@ -21053,7 +21099,7 @@ async function checkProject(deploy, declared) {
|
|
|
21053
21099
|
}
|
|
21054
21100
|
// src/commands/doctor-workers/check-worker.ts
|
|
21055
21101
|
const same = (a, b) => a.toLowerCase() === b.toLowerCase();
|
|
21056
|
-
const row$
|
|
21102
|
+
const row$15 = (id, title, status, detail, problems = []) => ({
|
|
21057
21103
|
id,
|
|
21058
21104
|
title,
|
|
21059
21105
|
status,
|
|
@@ -21078,9 +21124,9 @@ async function checkWorker(workers, worker) {
|
|
|
21078
21124
|
deploy: `${name} Worker's latest deployment is healthy`
|
|
21079
21125
|
};
|
|
21080
21126
|
const skipAll = (reason) => [
|
|
21081
|
-
row$
|
|
21082
|
-
row$
|
|
21083
|
-
row$
|
|
21127
|
+
row$15(ids.deployed, titles.deployed, "skip", reason),
|
|
21128
|
+
row$15(ids.bindings, titles.bindings, "skip", reason),
|
|
21129
|
+
row$15(ids.deploy, titles.deploy, "skip", reason)
|
|
21084
21130
|
];
|
|
21085
21131
|
if (worker.script === void 0) return skipAll(`${workers.providerName} does not say how it names this Worker`);
|
|
21086
21132
|
const script = worker.script;
|
|
@@ -21093,29 +21139,29 @@ async function checkWorker(workers, worker) {
|
|
|
21093
21139
|
exists = state.exists;
|
|
21094
21140
|
if (!state.exists) {
|
|
21095
21141
|
const problem = `no Worker named ${script}; \`holocron setup\` deploys it`;
|
|
21096
|
-
rows.push(row$
|
|
21142
|
+
rows.push(row$15(ids.deployed, titles.deployed, "fail", `${script} not deployed`, [problem]), row$15(ids.bindings, titles.bindings, "skip", `not checked: no Worker named ${script}`));
|
|
21097
21143
|
} else {
|
|
21098
|
-
rows.push(state.routes.some((r) => same(r, route)) ? row$
|
|
21099
|
-
if (worker.bindings.length === 0) rows.push(row$
|
|
21144
|
+
rows.push(state.routes.some((r) => same(r, route)) ? row$15(ids.deployed, titles.deployed, "ok", `${script} serves ${route}`) : row$15(ids.deployed, titles.deployed, "fail", `no route ${route}`, [`${script} has no route ${route}`]));
|
|
21145
|
+
if (worker.bindings.length === 0) rows.push(row$15(ids.bindings, titles.bindings, "ok", "none declared"));
|
|
21100
21146
|
else {
|
|
21101
21147
|
const bound = new Set(state.bindingNames.map((n) => n.toUpperCase()));
|
|
21102
21148
|
const missing = worker.bindings.filter((n) => !bound.has(n.toUpperCase()));
|
|
21103
|
-
rows.push(missing.length === 0 ? row$
|
|
21149
|
+
rows.push(missing.length === 0 ? row$15(ids.bindings, titles.bindings, "ok", `${worker.bindings.length} of ${worker.bindings.length} bound`) : row$15(ids.bindings, titles.bindings, "fail", `${missing.length} not bound`, missing.map((n) => `${n}: not bound`)));
|
|
21104
21150
|
}
|
|
21105
21151
|
}
|
|
21106
21152
|
} catch (err) {
|
|
21107
21153
|
const failure = readFailureRow(ids.deployed, titles.deployed, err);
|
|
21108
|
-
rows.push(failure, row$
|
|
21154
|
+
rows.push(failure, row$15(ids.bindings, titles.bindings, "skip", "not checked: could not read the Worker"));
|
|
21109
21155
|
}
|
|
21110
|
-
if (!exists) rows.push(row$
|
|
21111
|
-
else if (!workers.latestDeployment) rows.push(row$
|
|
21156
|
+
if (!exists) rows.push(row$15(ids.deploy, titles.deploy, "skip", "not checked: the Worker is not readable or not there"));
|
|
21157
|
+
else if (!workers.latestDeployment) rows.push(row$15(ids.deploy, titles.deploy, "skip", `the \`${workers.providerName}\` provider cannot list deployments`));
|
|
21112
21158
|
else try {
|
|
21113
21159
|
const latest = await workers.latestDeployment(script);
|
|
21114
|
-
if (!latest) rows.push(row$
|
|
21160
|
+
if (!latest) rows.push(row$15(ids.deploy, titles.deploy, "skip", `${script} has no recorded deployment`));
|
|
21115
21161
|
else if (!latest.active) {
|
|
21116
21162
|
const problem = `the newest deployment of ${script} does not serve all traffic`;
|
|
21117
|
-
rows.push(row$
|
|
21118
|
-
} else rows.push(row$
|
|
21163
|
+
rows.push(row$15(ids.deploy, titles.deploy, "fail", "not serving all traffic", [problem]));
|
|
21164
|
+
} else rows.push(row$15(ids.deploy, titles.deploy, "ok", latest.createdAt ? `deployed ${latest.createdAt}` : "serving all traffic"));
|
|
21119
21165
|
} catch (err) {
|
|
21120
21166
|
rows.push(readFailureRow(ids.deploy, titles.deploy, err));
|
|
21121
21167
|
}
|
|
@@ -21179,7 +21225,7 @@ function declaredWorkers(input) {
|
|
|
21179
21225
|
* custom domain is attached, and the newest production deployment is ready. Only what the provider proves wrong
|
|
21180
21226
|
* fails; a missing token, a 401 or 403, or a provider that cannot read it is a skip with the reason.
|
|
21181
21227
|
*/
|
|
21182
|
-
const row$
|
|
21228
|
+
const row$14 = (id, title, status, detail) => ({
|
|
21183
21229
|
id,
|
|
21184
21230
|
title,
|
|
21185
21231
|
status,
|
|
@@ -21205,12 +21251,12 @@ async function runDoctorWorkers(input) {
|
|
|
21205
21251
|
...loader.has("wiki") ? { wiki: loader.get("wiki") } : {},
|
|
21206
21252
|
...workers ? { workers } : {}
|
|
21207
21253
|
});
|
|
21208
|
-
if (declared.length === 0) rows.push(row$
|
|
21254
|
+
if (declared.length === 0) rows.push(row$14("workers", "declared Workers", "ok", "none declared"));
|
|
21209
21255
|
else if (!workers) {
|
|
21210
21256
|
const why = whyNone(loader, "workers", "no `workers` provider is configured in holocron.config.ts");
|
|
21211
|
-
for (const worker of declared) rows.push(row$
|
|
21257
|
+
for (const worker of declared) rows.push(row$14(`workers:${worker.label}`, `${worker.label} Worker`, "skip", why));
|
|
21212
21258
|
} else for (const worker of declared) rows.push(...await checkWorker(workers, worker));
|
|
21213
|
-
if (!loader.has("deployment")) rows.push(row$
|
|
21259
|
+
if (!loader.has("deployment")) rows.push(row$14("deployment", "deployment project", "skip", whyNone(loader, "deployment", "no `deployment` provider is configured in holocron.config.ts")));
|
|
21214
21260
|
else {
|
|
21215
21261
|
const deploy = loader.get("deployment");
|
|
21216
21262
|
for (const project of declaredProjects(input.loaded.resolved, deploy)) rows.push(...await checkProject(deploy, project));
|
|
@@ -22194,7 +22240,7 @@ function resolveExportDir(input) {
|
|
|
22194
22240
|
* listed under the provider's row and does not fail the run. It writes files, so it asks first unless `--dry-run` (the
|
|
22195
22241
|
* files are converted and listed, nothing is written) or `--yes` (without a terminal it refuses instead).
|
|
22196
22242
|
*/
|
|
22197
|
-
const row$
|
|
22243
|
+
const row$13 = (id, status, detail, problems = []) => ({
|
|
22198
22244
|
id,
|
|
22199
22245
|
title: id,
|
|
22200
22246
|
status,
|
|
@@ -22236,9 +22282,9 @@ async function runRequestsExport(input) {
|
|
|
22236
22282
|
print("");
|
|
22237
22283
|
const entry = input.loaded.resolved.providers.tooling;
|
|
22238
22284
|
const tuples = entry?.cardinality === "many" ? entry.tuples : [];
|
|
22239
|
-
if (tuples.length === 0) return finish([row$
|
|
22285
|
+
if (tuples.length === 0) return finish([row$13("tooling", "fail", "the config has no `tooling` provider to export for")]);
|
|
22240
22286
|
const chosen = input.to === void 0 ? tuples : tuples.filter((t) => t.provider === input.to);
|
|
22241
|
-
if (chosen.length === 0) return finish([row$
|
|
22287
|
+
if (chosen.length === 0) return finish([row$13(input.to, "fail", `not a \`tooling\` provider of this config (${tuples.map((t) => t.provider).join(", ")})`)]);
|
|
22242
22288
|
/* v8 ignore start -- the real loader is only built outside tests, which always inject one */
|
|
22243
22289
|
const loader = input.loader ?? new PluginLoader({
|
|
22244
22290
|
...input.loaded.resolved,
|
|
@@ -22258,17 +22304,17 @@ async function runRequestsExport(input) {
|
|
|
22258
22304
|
const tool = loaded.find((t) => t.providerName === id);
|
|
22259
22305
|
if (!tool) {
|
|
22260
22306
|
const failure = loader.loadFailures().find((f) => f.key === "tooling" && f.provider === id);
|
|
22261
|
-
rows.push(row$
|
|
22307
|
+
rows.push(row$13(id, "fail", `the provider is not available${failure ? ` (${describeError(failure.error)})` : ""}`));
|
|
22262
22308
|
continue;
|
|
22263
22309
|
}
|
|
22264
22310
|
if (!tool.export) {
|
|
22265
|
-
rows.push(row$
|
|
22311
|
+
rows.push(row$13(id, "skip", "has no export: it reads the repo's files as they are"));
|
|
22266
22312
|
continue;
|
|
22267
22313
|
}
|
|
22268
22314
|
const collectionFiles = fileList$1(tuple.options.collectionFiles);
|
|
22269
22315
|
const envFiles = fileList$1(tuple.options.envFiles);
|
|
22270
22316
|
if (collectionFiles.length === 0) {
|
|
22271
|
-
rows.push(row$
|
|
22317
|
+
rows.push(row$13(id, "skip", "names no `collectionFiles`, so there is nothing to export"));
|
|
22272
22318
|
continue;
|
|
22273
22319
|
}
|
|
22274
22320
|
const groups = input.out === void 0 ? groupByFolder(collectionFiles) : [collectionFiles];
|
|
@@ -22282,7 +22328,7 @@ async function runRequestsExport(input) {
|
|
|
22282
22328
|
...input.out !== void 0 ? { out: input.out } : {}
|
|
22283
22329
|
});
|
|
22284
22330
|
if (!dir.ok) {
|
|
22285
|
-
rows.push(row$
|
|
22331
|
+
rows.push(row$13(label, "fail", dir.message));
|
|
22286
22332
|
continue;
|
|
22287
22333
|
}
|
|
22288
22334
|
targets.push({
|
|
@@ -22321,9 +22367,9 @@ async function runRequestsExport(input) {
|
|
|
22321
22367
|
const where = relative(repoRoot, outDir);
|
|
22322
22368
|
const files = result.files.length > 0 ? ` (${result.files.join(", ")})` : "";
|
|
22323
22369
|
paths.push(...result.files.map((file) => resolve(outDir, file)));
|
|
22324
|
-
rows.push(row$
|
|
22370
|
+
rows.push(row$13(label, "ok", `${dryRun ? "would write" : "wrote"} ${result.files.length} file(s) to ${where}${files}`, result.issues.map((issue) => `issue in ${issue.file}: ${issue.message}`)));
|
|
22325
22371
|
} catch (err) {
|
|
22326
|
-
rows.push(row$
|
|
22372
|
+
rows.push(row$13(label, "fail", describeError(err)));
|
|
22327
22373
|
}
|
|
22328
22374
|
const report = finish(rows.sort((a, b) => a.id.localeCompare(b.id)));
|
|
22329
22375
|
if (paths.length > 0) {
|
|
@@ -26619,7 +26665,7 @@ function specName(title, name) {
|
|
|
26619
26665
|
*/
|
|
26620
26666
|
/** How many lines of the spec a dry run shows. */
|
|
26621
26667
|
const PREVIEW_LINES$1 = 12;
|
|
26622
|
-
const row$
|
|
26668
|
+
const row$12 = (id, status, detail) => ({
|
|
26623
26669
|
id,
|
|
26624
26670
|
title: id,
|
|
26625
26671
|
status,
|
|
@@ -26649,7 +26695,7 @@ async function runIdeasPromote(input) {
|
|
|
26649
26695
|
print(style.header(`Holocron new spec${dryRun ? " (dry-run)" : ""}`));
|
|
26650
26696
|
print("");
|
|
26651
26697
|
const entry = input.loaded.resolved.providers.issues;
|
|
26652
|
-
if (!entry) return finish([row$
|
|
26698
|
+
if (!entry) return finish([row$12(input.issue, "fail", "the config has no `issues` provider to read the issue with")]);
|
|
26653
26699
|
const credentials = input.loaded.resolved.providers.credentials;
|
|
26654
26700
|
/* v8 ignore start -- the real loader is only built outside tests, which always inject one */
|
|
26655
26701
|
const loader = input.loader ?? new PluginLoader({
|
|
@@ -26664,18 +26710,18 @@ async function runIdeasPromote(input) {
|
|
|
26664
26710
|
assertPluginsResolvable(loader, "new spec");
|
|
26665
26711
|
if (!loader.has("issues")) {
|
|
26666
26712
|
const failure = loader.loadFailures().find((f) => f.key === "issues");
|
|
26667
|
-
return finish([row$
|
|
26713
|
+
return finish([row$12(input.issue, "fail", `the \`issues\` provider is not available${failure ? ` (${describeError(failure.error)})` : ""}`)]);
|
|
26668
26714
|
}
|
|
26669
26715
|
let issue;
|
|
26670
26716
|
try {
|
|
26671
26717
|
issue = await loader.get("issues").get(input.issue);
|
|
26672
26718
|
} catch (err) {
|
|
26673
|
-
return finish([row$
|
|
26719
|
+
return finish([row$12(input.issue, "fail", `could not read the issue: ${describeError(err)}`)]);
|
|
26674
26720
|
}
|
|
26675
26721
|
const name = specName(issue.summary, input.name);
|
|
26676
|
-
if (!name) return finish([row$
|
|
26722
|
+
if (!name) return finish([row$12(issue.key, "fail", input.name === void 0 ? "no spec name can be made from the title; pass --name" : `"${input.name}" is not a spec name: use lower-case words joined by hyphens, such as tech-my-topic`)]);
|
|
26677
26723
|
const relative = join(".notes", `${name}.spec.md`);
|
|
26678
|
-
if (io.exists(join(input.context.repoRoot, relative))) return finish([row$
|
|
26724
|
+
if (io.exists(join(input.context.repoRoot, relative))) return finish([row$12(relative, "fail", "the spec already exists; it is never overwritten")], relative);
|
|
26679
26725
|
const { org, name: repoName } = input.loaded.resolved;
|
|
26680
26726
|
const ref = githubRef(issue.url) ?? (issue.key.startsWith("#") ? `${org}/${repoName}${issue.key}` : issue.key);
|
|
26681
26727
|
const { content, fromIdea } = buildSpec({
|
|
@@ -26688,7 +26734,7 @@ async function runIdeasPromote(input) {
|
|
|
26688
26734
|
print(` ${relative}`);
|
|
26689
26735
|
for (const line of content.split("\n").slice(0, PREVIEW_LINES$1)) print(` ${style.skip(line)}`);
|
|
26690
26736
|
print("");
|
|
26691
|
-
return finish([row$
|
|
26737
|
+
return finish([row$12(relative, "skip", `would write the spec ${origin}`)], relative);
|
|
26692
26738
|
}
|
|
26693
26739
|
if (!input.yes) {
|
|
26694
26740
|
if (!(input.interactive ?? Boolean(process.stdin.isTTY))) throw new NonInteractiveError(`\`new spec\` writes ${relative}; pass --yes to run it without asking, or --dry-run to preview`);
|
|
@@ -26707,9 +26753,9 @@ async function runIdeasPromote(input) {
|
|
|
26707
26753
|
try {
|
|
26708
26754
|
io.write(join(input.context.repoRoot, relative), content);
|
|
26709
26755
|
} catch (err) {
|
|
26710
|
-
return finish([row$
|
|
26756
|
+
return finish([row$12(relative, "fail", `could not write the spec: ${describeError(err)}`)], relative);
|
|
26711
26757
|
}
|
|
26712
|
-
return finish([row$
|
|
26758
|
+
return finish([row$12(relative, "ok", `wrote the spec ${origin}`)], relative);
|
|
26713
26759
|
}
|
|
26714
26760
|
// src/commands/ideas-promote/ideas-promote.command.ts
|
|
26715
26761
|
const ideasPromoteCommand = {
|
|
@@ -26785,7 +26831,7 @@ function readIssueBody(file, cwd, read = (p) => readFileSync(p, "utf8")) {
|
|
|
26785
26831
|
*/
|
|
26786
26832
|
/** How many lines of the body a dry run shows. */
|
|
26787
26833
|
const PREVIEW_LINES = 8;
|
|
26788
|
-
const row$
|
|
26834
|
+
const row$11 = (id, status, detail) => ({
|
|
26789
26835
|
id,
|
|
26790
26836
|
title: id,
|
|
26791
26837
|
status,
|
|
@@ -26809,11 +26855,11 @@ async function runIssueCreate(input) {
|
|
|
26809
26855
|
print(style.header(`Holocron new issue${dryRun ? " (dry-run)" : ""}`));
|
|
26810
26856
|
print("");
|
|
26811
26857
|
const title = input.title.trim();
|
|
26812
|
-
if (!title) return finish([row$
|
|
26858
|
+
if (!title) return finish([row$11("title", "fail", "the title is empty")]);
|
|
26813
26859
|
const prepared = prepareIssueFields(input, input.loaded.resolved.repo?.labels?.areas);
|
|
26814
|
-
if (!prepared.ok) return finish(prepared.problems.map((p) => row$
|
|
26860
|
+
if (!prepared.ok) return finish(prepared.problems.map((p) => row$11(title, "fail", p)));
|
|
26815
26861
|
const entry = input.loaded.resolved.providers.issues;
|
|
26816
|
-
if (!entry) return finish([row$
|
|
26862
|
+
if (!entry) return finish([row$11(title, "fail", "the config has no `issues` provider to file the issue with")]);
|
|
26817
26863
|
const credentials = input.loaded.resolved.providers.credentials;
|
|
26818
26864
|
const projects = prepared.project ? input.loaded.resolved.providers.projects : void 0;
|
|
26819
26865
|
/* v8 ignore start -- the real loader is only built outside tests, which always inject one */
|
|
@@ -26830,7 +26876,7 @@ async function runIssueCreate(input) {
|
|
|
26830
26876
|
assertPluginsResolvable(loader, "new issue");
|
|
26831
26877
|
if (!loader.has("issues")) {
|
|
26832
26878
|
const failure = loader.loadFailures().find((f) => f.key === "issues");
|
|
26833
|
-
return finish([row$
|
|
26879
|
+
return finish([row$11(title, "fail", `the \`issues\` provider is not available${failure ? ` (${describeError(failure.error)})` : ""}`)]);
|
|
26834
26880
|
}
|
|
26835
26881
|
const labels = [.../* @__PURE__ */ new Set([...(input.labels ?? []).map((l) => l.trim()).filter(Boolean), ...prepared.areaLabels])];
|
|
26836
26882
|
const body = input.body?.trim() ? input.body : void 0;
|
|
@@ -26847,7 +26893,7 @@ async function runIssueCreate(input) {
|
|
|
26847
26893
|
print(` ${title}`);
|
|
26848
26894
|
for (const line of body ? body.split("\n").slice(0, PREVIEW_LINES) : []) print(` ${style.skip(line)}`);
|
|
26849
26895
|
print("");
|
|
26850
|
-
return finish([row$
|
|
26896
|
+
return finish([row$11(title, "skip", `would file the issue${summary}`)]);
|
|
26851
26897
|
}
|
|
26852
26898
|
if (!input.yes) {
|
|
26853
26899
|
if (!(input.interactive ?? Boolean(process.stdin.isTTY))) throw new NonInteractiveError("`new issue` files an issue; pass --yes to run it without asking, or --dry-run to preview");
|
|
@@ -26880,12 +26926,12 @@ async function runIssueCreate(input) {
|
|
|
26880
26926
|
...prepared.fields.priority ? { priority: prepared.fields.priority } : {}
|
|
26881
26927
|
}) : void 0;
|
|
26882
26928
|
return finish([
|
|
26883
|
-
row$
|
|
26884
|
-
...(dropped ?? []).map((line) => row$
|
|
26929
|
+
row$11(title, "ok", `filed ${key}`),
|
|
26930
|
+
...(dropped ?? []).map((line) => row$11("not carried across", "skip", line)),
|
|
26885
26931
|
...board ? [board] : []
|
|
26886
26932
|
], key);
|
|
26887
26933
|
} catch (err) {
|
|
26888
|
-
return finish([row$
|
|
26934
|
+
return finish([row$11(title, "fail", `could not file the issue: ${describeError(err)}`)]);
|
|
26889
26935
|
}
|
|
26890
26936
|
}
|
|
26891
26937
|
// src/commands/issue-create/issue-create.command.ts
|
|
@@ -29251,7 +29297,7 @@ function readGitConfig(cwd, key, run = runGit) {
|
|
|
29251
29297
|
* identity; Effort is asked on a terminal when it was not given (the CLI never chooses it). The issue's key is printed
|
|
29252
29298
|
* by the first row, before anything else is done, so a failed spec leaves the issue as the anchor to resume from.
|
|
29253
29299
|
*/
|
|
29254
|
-
const row$
|
|
29300
|
+
const row$10 = (id, status, detail) => ({
|
|
29255
29301
|
id,
|
|
29256
29302
|
title: id,
|
|
29257
29303
|
status,
|
|
@@ -29270,7 +29316,7 @@ async function runNewWork(input) {
|
|
|
29270
29316
|
const name = specName(input.title, input.specName);
|
|
29271
29317
|
if (!name) {
|
|
29272
29318
|
const detail = input.specName === void 0 ? "no spec name can be made from the title; pass --spec <name>" : `"${input.specName}" is not a spec name: use lower-case words joined by hyphens, such as tech-my-topic`;
|
|
29273
|
-
const rows = [row$
|
|
29319
|
+
const rows = [row$10("spec", "fail", detail)];
|
|
29274
29320
|
printCheckRows(rows, print);
|
|
29275
29321
|
return {
|
|
29276
29322
|
status: "fail",
|
|
@@ -29279,7 +29325,7 @@ async function runNewWork(input) {
|
|
|
29279
29325
|
}
|
|
29280
29326
|
specPath = join(".notes", `${name}.spec.md`);
|
|
29281
29327
|
if (io.exists(join(root, specPath))) {
|
|
29282
|
-
const rows = [row$
|
|
29328
|
+
const rows = [row$10(specPath, "fail", "the spec already exists; it is never overwritten")];
|
|
29283
29329
|
printCheckRows(rows, print);
|
|
29284
29330
|
return {
|
|
29285
29331
|
status: "fail",
|
|
@@ -29289,7 +29335,7 @@ async function runNewWork(input) {
|
|
|
29289
29335
|
}
|
|
29290
29336
|
}
|
|
29291
29337
|
const assignees = input.assignees && input.assignees.length > 0 ? input.assignees : [gitAssignee(input.gitConfig ?? ((key) => readGitConfig(root, key)))].filter((a) => Boolean(a));
|
|
29292
|
-
if (!input.assignees?.length && assignees.length === 0) extra.push(row$
|
|
29338
|
+
if (!input.assignees?.length && assignees.length === 0) extra.push(row$10("assignee", "skip", "git config has no GitHub login (`github.user`); pass --assignee to assign the issue"));
|
|
29293
29339
|
let effort = input.effort;
|
|
29294
29340
|
const interactive = input.interactive ?? Boolean(process.stdin.isTTY);
|
|
29295
29341
|
if (!effort && !input.yes && !dryRun && interactive) effort = await (input.askEffort ?? promptEffort)();
|
|
@@ -32279,7 +32325,7 @@ const MARKER = "# written by `holocron open requests` for one session and remove
|
|
|
32279
32325
|
const SECRETS_FILE = `${PRIVATE_DIR}/requests.env`;
|
|
32280
32326
|
/** The lock a launch holds, in the private directory. */
|
|
32281
32327
|
const LOCK_FILE = `${PRIVATE_DIR}/open-requests.lock`;
|
|
32282
|
-
const row$
|
|
32328
|
+
const row$9 = (id, status, detail, problems = []) => ({
|
|
32283
32329
|
id,
|
|
32284
32330
|
title: id,
|
|
32285
32331
|
status,
|
|
@@ -32320,7 +32366,7 @@ async function runOpenRequests(input) {
|
|
|
32320
32366
|
const tuples = entry?.cardinality === "many" ? entry.tuples : [];
|
|
32321
32367
|
const chosen = input.to === void 0 ? tuples : tuples.filter((t) => t.provider === input.to);
|
|
32322
32368
|
if (chosen.length === 0) {
|
|
32323
|
-
say(row$
|
|
32369
|
+
say(row$9(input.to ?? "tooling", "fail", input.to === void 0 ? "the config has no `tooling` provider to open" : `not a \`tooling\` provider of this config (${tuples.map((t) => t.provider).join(", ")})`));
|
|
32324
32370
|
return finish();
|
|
32325
32371
|
}
|
|
32326
32372
|
/* v8 ignore start -- the real loader is only built outside tests, which always inject one */
|
|
@@ -32330,7 +32376,7 @@ async function runOpenRequests(input) {
|
|
|
32330
32376
|
assertPluginsResolvable(loader, "open requests");
|
|
32331
32377
|
const openable = (loader.has("tooling") ? loader.get("tooling") : []).filter((t) => chosen.some((tuple) => tuple.provider === t.providerName)).filter((t) => t.open !== void 0);
|
|
32332
32378
|
if (openable.length !== 1) {
|
|
32333
|
-
say(row$
|
|
32379
|
+
say(row$9("tooling", "fail", openable.length === 0 ? "no `tooling` provider can open its workspace" : `more than one \`tooling\` provider can open its workspace (${openable.map((t) => t.providerName).join(", ")}); name one with --to`));
|
|
32334
32380
|
return finish();
|
|
32335
32381
|
}
|
|
32336
32382
|
const tool = openable[0];
|
|
@@ -32344,34 +32390,34 @@ async function runOpenRequests(input) {
|
|
|
32344
32390
|
repoRoot
|
|
32345
32391
|
});
|
|
32346
32392
|
} catch (err) {
|
|
32347
|
-
say(row$
|
|
32393
|
+
say(row$9(tool.providerName, "fail", describeError(err)));
|
|
32348
32394
|
return finish();
|
|
32349
32395
|
}
|
|
32350
32396
|
const loaded = plan.wants.filter((want) => layers.includes(want.layer));
|
|
32351
32397
|
const notLoaded = plan.wants.filter((want) => !layers.includes(want.layer));
|
|
32352
32398
|
const names = [...new Set(loaded.map((want) => want.name))].sort();
|
|
32353
|
-
if (plan.unfilled.length > 0) say(row$
|
|
32354
|
-
say(row$
|
|
32399
|
+
if (plan.unfilled.length > 0) say(row$9("unfilled", "skip", `${plan.unfilled.length} secret variable(s) refer to no entry, so nobody fills them`, plan.unfilled));
|
|
32400
|
+
say(row$9("layers", notLoaded.length > 0 ? "skip" : "ok", `loaded: ${layers.join(", ")}; not loaded: ${OPEN_LAYERS.filter((layer) => !layers.includes(layer)).join(", ") || "none"}`, notLoaded.map((want) => `${want.collection}: ${want.variable} is a ${want.layer} secret (${want.name}); start with --environment ${want.layer} to load it`)));
|
|
32355
32401
|
if (dryRun) {
|
|
32356
|
-
for (const want of loaded) say(row$
|
|
32357
|
-
if (names.length === 0) say(row$
|
|
32358
|
-
else say(row$
|
|
32359
|
-
say(row$
|
|
32402
|
+
for (const want of loaded) say(row$9(want.variable, "ok", `would fill ${want.collection}'s ${want.variable} from ${want.entry} of ${want.layer} as ${want.name}`));
|
|
32403
|
+
if (names.length === 0) say(row$9("secrets", "ok", "nothing to fill: no variable refers to an entry"));
|
|
32404
|
+
else say(row$9("secrets", "ok", `would write ${names.length} value(s) to ${SECRETS_FILE} and link it from ${plan.targets.length} collection(s)`));
|
|
32405
|
+
say(row$9(plan.app, "ok", `would start ${plan.launch.command} in the foreground`));
|
|
32360
32406
|
return finish();
|
|
32361
32407
|
}
|
|
32362
32408
|
if (deps.platform === "win32" && names.length > 0) {
|
|
32363
|
-
say(row$
|
|
32409
|
+
say(row$9(plan.app, "fail", "cannot make the values file private on Windows: its mode bits are not enforced, and a link needs rights it may lack"));
|
|
32364
32410
|
return finish();
|
|
32365
32411
|
}
|
|
32366
32412
|
let running;
|
|
32367
32413
|
try {
|
|
32368
32414
|
running = await deps.processes();
|
|
32369
32415
|
} catch (err) {
|
|
32370
|
-
say(row$
|
|
32416
|
+
say(row$9(plan.app, "fail", `could not tell whether ${plan.app} is running: ${describeError(err)}`));
|
|
32371
32417
|
return finish();
|
|
32372
32418
|
}
|
|
32373
32419
|
if (running.split("\n").some((line) => line.includes(plan.running))) {
|
|
32374
|
-
say(row$
|
|
32420
|
+
say(row$9(plan.app, "fail", `${plan.app} is already running; quit it and run this again (it would not see the values)`));
|
|
32375
32421
|
return finish();
|
|
32376
32422
|
}
|
|
32377
32423
|
if (!input.yes) {
|
|
@@ -32388,7 +32434,7 @@ async function runOpenRequests(input) {
|
|
|
32388
32434
|
if (names.length > 0) {
|
|
32389
32435
|
const vault = loader.has("vault") ? loader.get("vault") : void 0;
|
|
32390
32436
|
if (!vault?.readEnvironmentEntries) {
|
|
32391
|
-
say(row$
|
|
32437
|
+
say(row$9("vault", "fail", vault ? `${vault.providerName} cannot read an Environment's entries` : "needs a `vault` provider in holocron.config.ts (1password)"));
|
|
32392
32438
|
return finish();
|
|
32393
32439
|
}
|
|
32394
32440
|
let failed = false;
|
|
@@ -32405,17 +32451,17 @@ async function runOpenRequests(input) {
|
|
|
32405
32451
|
names: [...new Set(wanted.map((want) => want.entry))].sort()
|
|
32406
32452
|
});
|
|
32407
32453
|
} catch (err) {
|
|
32408
|
-
say(row$
|
|
32454
|
+
say(row$9(`vault ${layer}`, "fail", describeError(err)));
|
|
32409
32455
|
failed = true;
|
|
32410
32456
|
continue;
|
|
32411
32457
|
}
|
|
32412
32458
|
for (const entry of read.missing) {
|
|
32413
|
-
say(row$
|
|
32459
|
+
say(row$9(`${layer} ${entry}`, "fail", `${read.environmentId} holds no value for ${entry}`));
|
|
32414
32460
|
failed = true;
|
|
32415
32461
|
}
|
|
32416
32462
|
if (read.missing.length > 0) continue;
|
|
32417
32463
|
for (const want of wanted) values.set(want.name, read.values.get(want.entry));
|
|
32418
|
-
say(row$
|
|
32464
|
+
say(row$9(`vault ${read.environmentId}`, "ok", `${wanted.length} value(s) read: ${[...new Set(wanted.map((want) => want.name))].join(", ")}`));
|
|
32419
32465
|
}
|
|
32420
32466
|
if (failed) return finish();
|
|
32421
32467
|
}
|
|
@@ -32435,7 +32481,7 @@ async function runOpenRequests(input) {
|
|
|
32435
32481
|
};
|
|
32436
32482
|
deps.makeDir(dirname(secrets));
|
|
32437
32483
|
if (!deps.takeLock(lock, deps.pid)) {
|
|
32438
|
-
say(row$
|
|
32484
|
+
say(row$9(plan.app, "fail", `another \`open requests\` is starting ${plan.app} (${LOCK_FILE} is held); try again when it has`));
|
|
32439
32485
|
return finish();
|
|
32440
32486
|
}
|
|
32441
32487
|
const stop = deps.onTerminate(cleanup);
|
|
@@ -32443,18 +32489,18 @@ async function runOpenRequests(input) {
|
|
|
32443
32489
|
if (names.length > 0) {
|
|
32444
32490
|
const ignored = deps.isIgnored(secrets);
|
|
32445
32491
|
if (ignored === "tracked" || ignored === "unknown") {
|
|
32446
|
-
say(row$
|
|
32492
|
+
say(row$9("values file", "fail", `refusing to write ${SECRETS_FILE}: git ${ignored === "tracked" ? "does not ignore it, so it could be committed" : "could not say whether it ignores it"}`, [ignoreAdvice(true, "")]));
|
|
32447
32493
|
return finish();
|
|
32448
32494
|
}
|
|
32449
32495
|
const stale = deps.inspect(secrets);
|
|
32450
32496
|
if (stale.kind !== "none" && !(stale.kind === "file" && stale.firstLine === "# written by `holocron open requests` for one session and removed when it ends")) {
|
|
32451
|
-
say(row$
|
|
32497
|
+
say(row$9("values file", "fail", `${SECRETS_FILE} is not this command's (no marker line); move it away`));
|
|
32452
32498
|
return finish();
|
|
32453
32499
|
}
|
|
32454
32500
|
for (const link of plan.targets) {
|
|
32455
32501
|
const state = deps.inspect(link);
|
|
32456
32502
|
if (state.kind !== "none" && !isOurs(state, link, secrets)) {
|
|
32457
|
-
say(row$
|
|
32503
|
+
say(row$9("link", "fail", `${relative(repoRoot, link)} exists and is not this command's (it is not a link to ${SECRETS_FILE}, and has no marker line); move it away`));
|
|
32458
32504
|
return finish();
|
|
32459
32505
|
}
|
|
32460
32506
|
}
|
|
@@ -32462,7 +32508,7 @@ async function runOpenRequests(input) {
|
|
|
32462
32508
|
for (const [name, value] of values) {
|
|
32463
32509
|
const line = dotenvLine(name, value);
|
|
32464
32510
|
if (line === null) {
|
|
32465
|
-
say(row$
|
|
32511
|
+
say(row$9(name, "fail", `the value of ${name} cannot be written to a .env file as it is; it was not written`));
|
|
32466
32512
|
return finish();
|
|
32467
32513
|
}
|
|
32468
32514
|
lines.push(line);
|
|
@@ -32475,7 +32521,7 @@ async function runOpenRequests(input) {
|
|
|
32475
32521
|
deps.symlink(relative(dirname(link), secrets), link);
|
|
32476
32522
|
created.push(link);
|
|
32477
32523
|
}
|
|
32478
|
-
say(row$
|
|
32524
|
+
say(row$9("values file", "ok", `${SECRETS_FILE} (mode 0600, git-ignored) linked from ${plan.targets.map((t) => relative(repoRoot, t)).join(", ")}`));
|
|
32479
32525
|
}
|
|
32480
32526
|
print("");
|
|
32481
32527
|
print(`starting ${plan.app}${names.length > 0 ? `; the values are removed when it quits (Ctrl-C ends it too)` : ""}`);
|
|
@@ -32483,10 +32529,10 @@ async function runOpenRequests(input) {
|
|
|
32483
32529
|
try {
|
|
32484
32530
|
exitCode = await deps.run(plan.launch);
|
|
32485
32531
|
} catch (err) {
|
|
32486
|
-
say(row$
|
|
32532
|
+
say(row$9(plan.app, "fail", describeError(err)));
|
|
32487
32533
|
return finish();
|
|
32488
32534
|
}
|
|
32489
|
-
say(row$
|
|
32535
|
+
say(row$9(plan.app, exitCode === 0 ? "ok" : "fail", `ended with ${exitCode}`));
|
|
32490
32536
|
return finish();
|
|
32491
32537
|
} finally {
|
|
32492
32538
|
stop();
|
|
@@ -34699,6 +34745,82 @@ const projectCommand = {
|
|
|
34699
34745
|
builder: (y) => y.command(projectStatusCommand).command(groupMenu("project")),
|
|
34700
34746
|
handler: () => {}
|
|
34701
34747
|
};
|
|
34748
|
+
// src/commands/provider/provider-revoke/provider-revoke.ts
|
|
34749
|
+
/**
|
|
34750
|
+
* `holocron provider <name> revoke <id>`: delete a token through the provider's own API, the step after minting and
|
|
34751
|
+
* importing its replacement (#2682, spec `tech-token-minting`). It takes the vendor's id for the token (what minting and
|
|
34752
|
+
* `whoami` print), never a value, and refuses anything that is not a plain id before a provider is loaded, so an id can
|
|
34753
|
+
* never reach a request path as anything but one segment. Deleting is irreversible, so it always asks (`--yes` skips the
|
|
34754
|
+
* question, `--dry-run` calls nothing, no terminal without `--yes` is a `NonInteractiveError`). A token the vendor no
|
|
34755
|
+
* longer has is a success that says so, and a plugin refuses the token the call itself is made with.
|
|
34756
|
+
*/
|
|
34757
|
+
/** A vendor's token id: letters, digits and `._:-`, so it is one path segment and nothing that could change a request. */
|
|
34758
|
+
const TOKEN_ID = /^[A-Za-z0-9._:-]{1,128}$/;
|
|
34759
|
+
const row$8 = (id, title, status, detail, problems = []) => ({
|
|
34760
|
+
id: `provider-revoke:${id}`,
|
|
34761
|
+
title,
|
|
34762
|
+
status,
|
|
34763
|
+
detail,
|
|
34764
|
+
problems
|
|
34765
|
+
});
|
|
34766
|
+
async function runProviderRevoke(input) {
|
|
34767
|
+
const print = input.print ?? ((line) => console.log(line));
|
|
34768
|
+
const dryRun = input.context.dryRun ?? false;
|
|
34769
|
+
const { provider, id } = input;
|
|
34770
|
+
const scrub = createScrubber([input.context.cliToken, ...Object.values(input.context.cliTokens ?? {})].filter((t) => typeof t === "string"));
|
|
34771
|
+
const finish = (status, rows) => {
|
|
34772
|
+
const clean = rows.map((r) => ({
|
|
34773
|
+
...r,
|
|
34774
|
+
title: scrub(r.title),
|
|
34775
|
+
detail: scrub(r.detail),
|
|
34776
|
+
problems: r.problems.map(scrub)
|
|
34777
|
+
}));
|
|
34778
|
+
printCheckRows(clean, print);
|
|
34779
|
+
const summary = summariseChecks(clean);
|
|
34780
|
+
printCheckSummary(summary, print);
|
|
34781
|
+
getLogger().info({
|
|
34782
|
+
...summary,
|
|
34783
|
+
provider,
|
|
34784
|
+
status
|
|
34785
|
+
}, `provider ${provider} revoke`);
|
|
34786
|
+
return {
|
|
34787
|
+
status,
|
|
34788
|
+
rows: clean
|
|
34789
|
+
};
|
|
34790
|
+
};
|
|
34791
|
+
print(`Holocron provider ${provider} revoke${dryRun ? " (dry-run)" : ""}`);
|
|
34792
|
+
if (!TOKEN_ID.test(id)) return finish("fail", [row$8("id", "token id", "fail", "that is not a token id", ["give the id minting or `whoami` printed (letters, digits and . _ : -), never the token's value"])]);
|
|
34793
|
+
/* v8 ignore next -- the real loader is only built outside tests, which always inject one */
|
|
34794
|
+
const loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);
|
|
34795
|
+
await loader.load();
|
|
34796
|
+
assertPluginsResolvable(loader, "provider");
|
|
34797
|
+
let revoke = loader.revokeTokens().get(provider);
|
|
34798
|
+
if (!revoke) try {
|
|
34799
|
+
revoke = await loader.loadRevokeToken(provider, input.options ?? {});
|
|
34800
|
+
} catch (err) {
|
|
34801
|
+
if (err instanceof WorkspaceContextError) throw err;
|
|
34802
|
+
return finish("fail", [row$8("provider", provider, "fail", `\`${provider}\` did not load`, [describeError(err)])]);
|
|
34803
|
+
}
|
|
34804
|
+
if (!revoke) return finish("fail", [row$8("provider", provider, "fail", `\`${provider}\` cannot delete a token through its API`, ["delete it in the vendor's dashboard"])]);
|
|
34805
|
+
if (dryRun) return finish("dry-run", [row$8("plan", id, "ok", `would delete token ${id} at ${provider} through its API; it cannot be undone; nothing was called`)]);
|
|
34806
|
+
if (!input.yes) {
|
|
34807
|
+
if (!input.confirm) throw new NonInteractiveError("pass --yes to revoke a token without a terminal");
|
|
34808
|
+
if (!await input.confirm(`Delete token ${id} at ${provider}? This cannot be undone.`)) {
|
|
34809
|
+
print(" cancelled; nothing was deleted");
|
|
34810
|
+
return {
|
|
34811
|
+
status: "cancelled",
|
|
34812
|
+
rows: []
|
|
34813
|
+
};
|
|
34814
|
+
}
|
|
34815
|
+
}
|
|
34816
|
+
let done;
|
|
34817
|
+
try {
|
|
34818
|
+
done = await revoke({ id });
|
|
34819
|
+
} catch (err) {
|
|
34820
|
+
return finish("fail", [row$8("revoke", id, "fail", `${provider} did not delete the token`, [describeError(err)])]);
|
|
34821
|
+
}
|
|
34822
|
+
return finish("ok", [row$8("revoked", id, "ok", done.revoked ? `deleted at ${provider}` : `${provider} no longer has it; nothing to delete`), ...done.notes.map((note, i) => row$8(`note-${i + 1}`, "note", "skip", note))]);
|
|
34823
|
+
}
|
|
34702
34824
|
// src/commands/provider/provider-token/provider-token.ts
|
|
34703
34825
|
/**
|
|
34704
34826
|
* `holocron provider <name> token --env <layer>`: make a token through the provider's own API and hand it to the
|
|
@@ -34708,7 +34830,7 @@ const projectCommand = {
|
|
|
34708
34830
|
* once imported); no row, log or return value carries it, and the output is scrubbed of it as well. The old token is
|
|
34709
34831
|
* never revoked here.
|
|
34710
34832
|
*/
|
|
34711
|
-
const row$
|
|
34833
|
+
const row$7 = (id, title, status, detail, problems = []) => ({
|
|
34712
34834
|
id: `provider-token:${id}`,
|
|
34713
34835
|
title,
|
|
34714
34836
|
status,
|
|
@@ -34744,7 +34866,7 @@ async function runProviderToken(input) {
|
|
|
34744
34866
|
};
|
|
34745
34867
|
};
|
|
34746
34868
|
print(`Holocron provider ${provider} token (${layer})${dryRun ? " (dry-run)" : ""}`);
|
|
34747
|
-
if (!ENVIRONMENT_LAYERS.includes(layer)) return finish("fail", [row$
|
|
34869
|
+
if (!ENVIRONMENT_LAYERS.includes(layer)) return finish("fail", [row$7("layer", "layer", "fail", `\`${layer}\` is not a layer`, [`use one of: ${ENVIRONMENT_LAYERS.join(", ")}`])]);
|
|
34748
34870
|
/* v8 ignore next -- the real loader is only built outside tests, which always inject one */
|
|
34749
34871
|
const loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);
|
|
34750
34872
|
await loader.load();
|
|
@@ -34754,12 +34876,12 @@ async function runProviderToken(input) {
|
|
|
34754
34876
|
mint = await loader.loadMintToken(provider, input.options ?? {});
|
|
34755
34877
|
} catch (err) {
|
|
34756
34878
|
if (err instanceof WorkspaceContextError) throw err;
|
|
34757
|
-
return finish("fail", [row$
|
|
34879
|
+
return finish("fail", [row$7("provider", `${provider}`, "fail", `\`${provider}\` did not load`, [describeError(err)])]);
|
|
34758
34880
|
}
|
|
34759
|
-
if (!mint) return finish("fail", [row$
|
|
34881
|
+
if (!mint) return finish("fail", [row$7("provider", provider, "fail", `\`${provider}\` cannot make a token through its API`, [`make one by hand, then store it with \`holocron new token ${provider} <token>\``])]);
|
|
34760
34882
|
const now = input.now ?? (() => /* @__PURE__ */ new Date());
|
|
34761
34883
|
const name = input.name ?? `holocron-${provider}-${layer}-${stamp(now())}`;
|
|
34762
|
-
if (dryRun) return finish("dry-run", [row$
|
|
34884
|
+
if (dryRun) return finish("dry-run", [row$7("plan", name, "ok", `would make a ${layer} token named ${name} through ${provider}'s API and hand it to the private import file; nothing was called`)]);
|
|
34763
34885
|
if (!input.yes) {
|
|
34764
34886
|
if (!input.confirm) throw new NonInteractiveError("pass --yes to make a token without a terminal");
|
|
34765
34887
|
if (!await input.confirm(`Make a new ${layer} token named ${name} through ${provider}'s API?`)) {
|
|
@@ -34779,9 +34901,9 @@ async function runProviderToken(input) {
|
|
|
34779
34901
|
now
|
|
34780
34902
|
});
|
|
34781
34903
|
} catch (err) {
|
|
34782
|
-
return finish("fail", [row$
|
|
34904
|
+
return finish("fail", [row$7("mint", name, "fail", `${provider} did not make the token`, [describeError(err)])]);
|
|
34783
34905
|
}
|
|
34784
|
-
const rows = [row$
|
|
34906
|
+
const rows = [row$7("minted", name, "ok", [made.id ? `id ${made.id}` : "", made.expiresAt ? `expires ${made.expiresAt.slice(0, 10)}` : "no expiry"].filter(Boolean).join(", ")), ...made.notes.map((note, i) => row$7(`note-${i + 1}`, "note", "skip", note))];
|
|
34785
34907
|
const environment = await (input.resolveEnvironment ?? ((l, repoRoot) => resolveEnvironmentId(l, { repoRoot })))(layer, input.context.repoRoot);
|
|
34786
34908
|
const handed = await (input.handOff ?? handOffSecret)({
|
|
34787
34909
|
name: made.envName,
|
|
@@ -34792,10 +34914,10 @@ async function runProviderToken(input) {
|
|
|
34792
34914
|
...input.interactive === void 0 ? {} : { interactive: input.interactive }
|
|
34793
34915
|
});
|
|
34794
34916
|
if (handed.status === "fail") {
|
|
34795
|
-
rows.push(row$
|
|
34917
|
+
rows.push(row$7("hand-off", made.envName, "fail", `the value of ${made.envName} could not be handed over (${handed.reason ?? "failed"})`, [`the token exists at ${provider}${made.id ? ` (id ${made.id})` : ""} and its value cannot be shown again: delete it there and run the command again`]));
|
|
34796
34918
|
return finish("fail", rows, [made.value]);
|
|
34797
34919
|
}
|
|
34798
|
-
rows.push(row$
|
|
34920
|
+
rows.push(row$7("hand-off", made.envName, "ok", `handed to the private import file for the \`${environment}\` Environment`), row$7("next", "next", "skip", `send it where it runs with \`holocron sync secrets --env ${layer}\` (or \`holocron sync <app> --env ${layer}\`), then revoke the token it replaces at ${provider}`));
|
|
34799
34921
|
return finish("ok", rows, [made.value]);
|
|
34800
34922
|
}
|
|
34801
34923
|
// src/commands/provider/provider.ts
|
|
@@ -34807,7 +34929,7 @@ async function runProviderToken(input) {
|
|
|
34807
34929
|
* change, and without `--dry-run` or `--yes` it asks first (and refuses to run without a terminal). A step that fails is
|
|
34808
34930
|
* a row, not the end of the run. Whatever the provider prints is scrubbed of the tokens the run was given.
|
|
34809
34931
|
*/
|
|
34810
|
-
/** What a plugin returns from `createPlugin`; `token`
|
|
34932
|
+
/** What a plugin returns from `createPlugin`; `token` and `revoke` are its `mintToken` and `revokeToken`, which `runProviderToken()` and `runProviderRevoke()` run. */
|
|
34811
34933
|
const ACTIONS = [
|
|
34812
34934
|
"setup",
|
|
34813
34935
|
"doctor",
|
|
@@ -34820,10 +34942,10 @@ const fail = (print, ...text) => {
|
|
|
34820
34942
|
rows: []
|
|
34821
34943
|
};
|
|
34822
34944
|
};
|
|
34823
|
-
/** `linear: setup, doctor` lines for the providers given, sorted by name; `
|
|
34824
|
-
function listing(groups,
|
|
34945
|
+
/** `linear: setup, doctor` lines for the providers given, sorted by name; `extras` adds `token` and `revoke` where offered. */
|
|
34946
|
+
function listing(groups, extras) {
|
|
34825
34947
|
const width = Math.max(0, ...[...groups.keys()].map((name) => name.length));
|
|
34826
|
-
return [...groups].sort(([a], [b]) => a.localeCompare(b)).map(([name, actions]) => ` ${name.padEnd(width)} ${[...ACTIONS.filter((a) => actions[a]), ...
|
|
34948
|
+
return [...groups].sort(([a], [b]) => a.localeCompare(b)).map(([name, actions]) => ` ${name.padEnd(width)} ${[...ACTIONS.filter((a) => actions[a]), ...extras.get(name) ?? []].join(", ")}`);
|
|
34827
34949
|
}
|
|
34828
34950
|
/** The options of the first config entry that names `provider`, whichever capability it sits under. */
|
|
34829
34951
|
function configOptions(providers, provider) {
|
|
@@ -34857,7 +34979,9 @@ async function runProvider(input) {
|
|
|
34857
34979
|
await loader.load();
|
|
34858
34980
|
assertPluginsResolvable(loader, "provider");
|
|
34859
34981
|
const groups = new Map(loader.providerActions());
|
|
34860
|
-
const
|
|
34982
|
+
const extras = /* @__PURE__ */ new Map();
|
|
34983
|
+
for (const name of loader.mintTokens().keys()) extras.set(name, ["token"]);
|
|
34984
|
+
for (const name of loader.revokeTokens().keys()) extras.set(name, [...extras.get(name) ?? [], "revoke"]);
|
|
34861
34985
|
/* v8 ignore start -- reads the workspace's package configs from disk, which tests replace with `workspaceProviders` */
|
|
34862
34986
|
const workspaceTuples = async () => input.workspaceProviders ?? await workspaceProviders(input.context.repoRoot, input.loaded.resolved);
|
|
34863
34987
|
/* v8 ignore stop */
|
|
@@ -34867,7 +34991,7 @@ async function runProvider(input) {
|
|
|
34867
34991
|
if (groups.size === 0) print(" no configured provider offers `setup`, `doctor` or `whoami`");
|
|
34868
34992
|
else {
|
|
34869
34993
|
print(style.header("Providers with their own setup and doctor"));
|
|
34870
|
-
for (const line of listing(groups,
|
|
34994
|
+
for (const line of listing(groups, extras)) print(line);
|
|
34871
34995
|
}
|
|
34872
34996
|
return {
|
|
34873
34997
|
status: "listed",
|
|
@@ -34902,6 +35026,31 @@ async function runProvider(input) {
|
|
|
34902
35026
|
rows: report.rows
|
|
34903
35027
|
};
|
|
34904
35028
|
}
|
|
35029
|
+
if (input.action === "revoke") {
|
|
35030
|
+
if (!input.tokenId) return fail(print, `\`provider ${input.provider} revoke\` needs the token's id`, "the id minting or `whoami` printed, never the token's value");
|
|
35031
|
+
const interactive = input.interactive ?? Boolean(process.stdin.isTTY);
|
|
35032
|
+
const report = await runProviderRevoke({
|
|
35033
|
+
loaded: input.loaded,
|
|
35034
|
+
context: input.context,
|
|
35035
|
+
provider: input.provider,
|
|
35036
|
+
id: input.tokenId,
|
|
35037
|
+
options: {
|
|
35038
|
+
...configOptions(input.loaded.resolved.providers, input.provider),
|
|
35039
|
+
...input.options
|
|
35040
|
+
},
|
|
35041
|
+
...input.yes === void 0 ? {} : { yes: input.yes },
|
|
35042
|
+
loader,
|
|
35043
|
+
print,
|
|
35044
|
+
...interactive ? { confirm: input.confirm ?? ((message) => confirm({
|
|
35045
|
+
message,
|
|
35046
|
+
default: false
|
|
35047
|
+
})) } : {}
|
|
35048
|
+
});
|
|
35049
|
+
return {
|
|
35050
|
+
status: report.status === "dry-run" ? "ok" : report.status,
|
|
35051
|
+
rows: report.rows
|
|
35052
|
+
};
|
|
35053
|
+
}
|
|
34905
35054
|
let actions;
|
|
34906
35055
|
if (input.options) {
|
|
34907
35056
|
try {
|
|
@@ -34920,7 +35069,7 @@ async function runProvider(input) {
|
|
|
34920
35069
|
}
|
|
34921
35070
|
if (!actions) return fail(print, `no configured provider \`${input.provider}\` offers \`setup\`, \`doctor\` or \`whoami\``, groups.size > 0 ? `try: ${[...groups.keys()].sort().join(", ")}` : "none does");
|
|
34922
35071
|
if (!input.action) {
|
|
34923
|
-
for (const line of listing(/* @__PURE__ */ new Map([[input.provider, actions]]),
|
|
35072
|
+
for (const line of listing(/* @__PURE__ */ new Map([[input.provider, actions]]), extras)) print(line);
|
|
34924
35073
|
return {
|
|
34925
35074
|
status: "listed",
|
|
34926
35075
|
rows: []
|
|
@@ -34928,7 +35077,7 @@ async function runProvider(input) {
|
|
|
34928
35077
|
}
|
|
34929
35078
|
const name = ACTIONS.find((a) => a === input.action);
|
|
34930
35079
|
const run = name && actions[name];
|
|
34931
|
-
if (!name || !run) return fail(print, `\`${input.provider}\` has no \`${input.action}\``, `try: ${[...ACTIONS.filter((a) => actions[a]), ...
|
|
35080
|
+
if (!name || !run) return fail(print, `\`${input.provider}\` has no \`${input.action}\``, `try: ${[...ACTIONS.filter((a) => actions[a]), ...extras.get(input.provider) ?? []].join(", ")}`);
|
|
34932
35081
|
const dryRun = input.context.dryRun ?? false;
|
|
34933
35082
|
if (name === "setup" && !dryRun && !input.yes) {
|
|
34934
35083
|
if (!(input.interactive ?? Boolean(process.stdin.isTTY))) throw new NonInteractiveError(`\`provider ${input.provider} setup\` changes things on ${input.provider}; pass --yes to run it without asking, or --dry-run to preview`);
|
|
@@ -35026,7 +35175,10 @@ const providerArgs = (y) => y.positional("provider", {
|
|
|
35026
35175
|
describe: "Which provider (omit to list the ones that offer setup, doctor or whoami)"
|
|
35027
35176
|
}).positional("action", {
|
|
35028
35177
|
type: "string",
|
|
35029
|
-
describe: "`setup`, `doctor`, `whoami` or `
|
|
35178
|
+
describe: "`setup`, `doctor`, `whoami`, `token` or `revoke` (omit to list the provider's)"
|
|
35179
|
+
}).positional("id", {
|
|
35180
|
+
type: "string",
|
|
35181
|
+
describe: "`revoke`: the vendor's id for the token to delete (what minting and `whoami` print), never its value"
|
|
35030
35182
|
}).option("with", {
|
|
35031
35183
|
type: "string",
|
|
35032
35184
|
array: true,
|
|
@@ -35043,10 +35195,10 @@ const providerArgs = (y) => y.positional("provider", {
|
|
|
35043
35195
|
}).option("yes", {
|
|
35044
35196
|
type: "boolean",
|
|
35045
35197
|
default: false,
|
|
35046
|
-
describe: "Run `setup` or `
|
|
35198
|
+
describe: "Run `setup`, `token` or `revoke` without asking first (required without a terminal)"
|
|
35047
35199
|
});
|
|
35048
35200
|
const providerCommand = {
|
|
35049
|
-
command: "provider [provider] [action]",
|
|
35201
|
+
command: "provider [provider] [action] [id]",
|
|
35050
35202
|
describe: "Set up or check what only one provider has, from its block of holocron.config or --with",
|
|
35051
35203
|
builder: providerArgs,
|
|
35052
35204
|
handler: async (argv) => {
|
|
@@ -35065,6 +35217,7 @@ const providerCommand = {
|
|
|
35065
35217
|
},
|
|
35066
35218
|
...argv.provider ? { provider: argv.provider } : {},
|
|
35067
35219
|
...argv.action ? { action: argv.action } : {},
|
|
35220
|
+
...argv.id ? { tokenId: argv.id } : {},
|
|
35068
35221
|
...options ? { options } : {},
|
|
35069
35222
|
...argv.env ? { env: argv.env } : {},
|
|
35070
35223
|
...argv.name ? { name: argv.name } : {},
|
|
@@ -36556,7 +36709,7 @@ const projectReconcileCommand = {
|
|
|
36556
36709
|
* it would do and posts nothing.
|
|
36557
36710
|
*/
|
|
36558
36711
|
const DEFAULT_MAX_AGE_MINUTES = 10;
|
|
36559
|
-
const row$
|
|
36712
|
+
const row$6 = (id, status, detail) => ({
|
|
36560
36713
|
id,
|
|
36561
36714
|
title: id,
|
|
36562
36715
|
status,
|
|
@@ -36595,7 +36748,7 @@ async function runReconcileCi(input) {
|
|
|
36595
36748
|
};
|
|
36596
36749
|
};
|
|
36597
36750
|
const fail = (id, detail) => {
|
|
36598
|
-
rows.push(row$
|
|
36751
|
+
rows.push(row$6(id, "fail", detail));
|
|
36599
36752
|
return finish();
|
|
36600
36753
|
};
|
|
36601
36754
|
print(style.header(`Holocron reconcile ci${dryRun ? " (dry-run)" : ""}`));
|
|
@@ -36603,7 +36756,7 @@ async function runReconcileCi(input) {
|
|
|
36603
36756
|
if (input.maxAgeMinutes !== void 0 && !(input.maxAgeMinutes > 0)) return fail("max-age", "--max-age is a number of minutes above zero");
|
|
36604
36757
|
const poster = aggregatePoster({ ci: input.loaded.resolved.ci });
|
|
36605
36758
|
if (!input.shadow && poster !== "sentinel") {
|
|
36606
|
-
rows.push(row$
|
|
36759
|
+
rows.push(row$6("ci.aggregate", "skip", poster === "none" ? `ci.aggregate is none here, so there is no ${AGGREGATE_CHECK_NAME} to post; --shadow repairs Sentinel's shadow check` : `ci.aggregate is actions here, so the Actions job posts ${AGGREGATE_CHECK_NAME} and nothing is posted; --shadow repairs Sentinel's shadow check`));
|
|
36607
36760
|
return finish();
|
|
36608
36761
|
}
|
|
36609
36762
|
const providers = input.loaded.resolved.providers;
|
|
@@ -36643,7 +36796,7 @@ async function runReconcileCi(input) {
|
|
|
36643
36796
|
return fail("pull requests", describeError(error));
|
|
36644
36797
|
}
|
|
36645
36798
|
if (pullRequests.length === 0) {
|
|
36646
|
-
rows.push(row$
|
|
36799
|
+
rows.push(row$6("pull requests", "skip", "no open pull requests"));
|
|
36647
36800
|
return finish();
|
|
36648
36801
|
}
|
|
36649
36802
|
const api = {
|
|
@@ -36656,7 +36809,7 @@ async function runReconcileCi(input) {
|
|
|
36656
36809
|
for (const pr of pullRequests) {
|
|
36657
36810
|
const id = `#${pr.number}`;
|
|
36658
36811
|
if (pr.headSha === void 0) {
|
|
36659
|
-
rows.push(row$
|
|
36812
|
+
rows.push(row$6(id, "skip", "the provider gave no head commit"));
|
|
36660
36813
|
continue;
|
|
36661
36814
|
}
|
|
36662
36815
|
try {
|
|
@@ -36671,17 +36824,17 @@ async function runReconcileCi(input) {
|
|
|
36671
36824
|
name: input.shadow ? AGGREGATE_SHADOW_CHECK_NAME : AGGREGATE_CHECK_NAME
|
|
36672
36825
|
});
|
|
36673
36826
|
const verdict = out.result.conclusion;
|
|
36674
|
-
if (out.action === "foreign") rows.push(row$
|
|
36675
|
-
else if (out.action === "unchanged") rows.push(row$
|
|
36827
|
+
if (out.action === "foreign") rows.push(row$6(id, "skip", "another app (the Actions job) already posts this check on the commit; left alone"));
|
|
36828
|
+
else if (out.action === "unchanged") rows.push(row$6(id, "ok", `up to date (${verdict})`));
|
|
36676
36829
|
else if (out.stale) {
|
|
36677
36830
|
const what = dryRun ? "would repair" : "repaired";
|
|
36678
|
-
rows.push(row$
|
|
36831
|
+
rows.push(row$6(id, "fail", `${what}: the check was missing or wrong (now ${verdict}); a delivery was missed`));
|
|
36679
36832
|
} else {
|
|
36680
36833
|
const what = dryRun ? "would post" : "posted";
|
|
36681
|
-
rows.push(row$
|
|
36834
|
+
rows.push(row$6(id, "ok", `${what} ${verdict} (still in flight)`));
|
|
36682
36835
|
}
|
|
36683
36836
|
} catch (error) {
|
|
36684
|
-
rows.push(row$
|
|
36837
|
+
rows.push(row$6(id, "fail", describeError(error)));
|
|
36685
36838
|
}
|
|
36686
36839
|
}
|
|
36687
36840
|
return finish();
|
|
@@ -36764,7 +36917,7 @@ const defaultApi = {
|
|
|
36764
36917
|
listAppDeliveries,
|
|
36765
36918
|
redeliverAppDelivery
|
|
36766
36919
|
};
|
|
36767
|
-
const row$
|
|
36920
|
+
const row$5 = (id, status, detail) => ({
|
|
36768
36921
|
id,
|
|
36769
36922
|
title: id,
|
|
36770
36923
|
status,
|
|
@@ -36795,7 +36948,7 @@ async function runRedeliverWebhooks(input) {
|
|
|
36795
36948
|
};
|
|
36796
36949
|
};
|
|
36797
36950
|
const fail = (id, detail) => {
|
|
36798
|
-
rows.push(row$
|
|
36951
|
+
rows.push(row$5(id, "fail", detail));
|
|
36799
36952
|
return finish();
|
|
36800
36953
|
};
|
|
36801
36954
|
print(style.header(`Holocron redeliver webhooks${dryRun ? " (dry-run)" : ""}`));
|
|
@@ -36808,7 +36961,7 @@ async function runRedeliverWebhooks(input) {
|
|
|
36808
36961
|
}
|
|
36809
36962
|
const all = input.loaded.resolved.githubApps ?? [];
|
|
36810
36963
|
if (all.length === 0) {
|
|
36811
|
-
rows.push(row$
|
|
36964
|
+
rows.push(row$5("github-app", "skip", "no `githubApps` are declared in holocron.config.ts"));
|
|
36812
36965
|
return finish();
|
|
36813
36966
|
}
|
|
36814
36967
|
const instances = input.app === void 0 ? all : all.filter((instance) => instance.name === input.app);
|
|
@@ -36822,19 +36975,19 @@ async function runRedeliverWebhooks(input) {
|
|
|
36822
36975
|
for (const instance of instances) {
|
|
36823
36976
|
const read = await readAppCredentials(instance, loader);
|
|
36824
36977
|
if ("reason" in read) {
|
|
36825
|
-
rows.push(row$
|
|
36978
|
+
rows.push(row$5(`${instance.name}`, "skip", read.reason));
|
|
36826
36979
|
continue;
|
|
36827
36980
|
}
|
|
36828
36981
|
try {
|
|
36829
36982
|
const failed = failedDeliveries(await api.listAppDeliveries(read.creds, { since }));
|
|
36830
|
-
if (failed.length === 0) rows.push(row$
|
|
36983
|
+
if (failed.length === 0) rows.push(row$5(instance.name, "ok", `no failed deliveries since ${since}`));
|
|
36831
36984
|
for (const delivery of failed) pending.push({
|
|
36832
36985
|
app: instance.name,
|
|
36833
36986
|
creds: read.creds,
|
|
36834
36987
|
delivery
|
|
36835
36988
|
});
|
|
36836
36989
|
} catch (error) {
|
|
36837
|
-
rows.push(row$
|
|
36990
|
+
rows.push(row$5(instance.name, "fail", `cannot read the delivery log: ${scrubbed$1(error, [read.creds.privateKey])}`));
|
|
36838
36991
|
}
|
|
36839
36992
|
}
|
|
36840
36993
|
if (pending.length === 0) return finish();
|
|
@@ -36846,7 +36999,7 @@ async function runRedeliverWebhooks(input) {
|
|
|
36846
36999
|
};
|
|
36847
37000
|
};
|
|
36848
37001
|
if (dryRun) {
|
|
36849
|
-
for (const item of pending) rows.push(row$
|
|
37002
|
+
for (const item of pending) rows.push(row$5(label(item).id, "skip", `would redeliver ${label(item).text}`));
|
|
36850
37003
|
return finish();
|
|
36851
37004
|
}
|
|
36852
37005
|
/* v8 ignore next -- the terminal is only asked outside tests, which inject `interactive` */
|
|
@@ -36858,16 +37011,16 @@ async function runRedeliverWebhooks(input) {
|
|
|
36858
37011
|
default: false
|
|
36859
37012
|
}));
|
|
36860
37013
|
if (!input.yes && !await ask(`Redeliver ${pending.length} failed webhook deliver${pending.length === 1 ? "y" : "ies"}?`)) {
|
|
36861
|
-
rows.push(row$
|
|
37014
|
+
rows.push(row$5("redeliver", "skip", "not confirmed; nothing was redelivered"));
|
|
36862
37015
|
return finish();
|
|
36863
37016
|
}
|
|
36864
37017
|
for (const item of pending) {
|
|
36865
37018
|
const { id, text } = label(item);
|
|
36866
37019
|
try {
|
|
36867
37020
|
await api.redeliverAppDelivery(item.creds, item.delivery.id);
|
|
36868
|
-
rows.push(row$
|
|
37021
|
+
rows.push(row$5(id, "ok", `redelivered ${text}`));
|
|
36869
37022
|
} catch (error) {
|
|
36870
|
-
rows.push(row$
|
|
37023
|
+
rows.push(row$5(id, "fail", scrubbed$1(error, [item.creds.privateKey])));
|
|
36871
37024
|
}
|
|
36872
37025
|
}
|
|
36873
37026
|
return finish();
|
|
@@ -36989,6 +37142,171 @@ const resolveCommand = {
|
|
|
36989
37142
|
builder: (y) => y.command(monitoringResolveChecksCommand).command(groupMenu("resolve")),
|
|
36990
37143
|
handler: () => {}
|
|
36991
37144
|
};
|
|
37145
|
+
// src/commands/due-tokens/due-tokens.ts
|
|
37146
|
+
/** `tokens:<layer>:<provider>:<envName>`, the id `doctor tokens` gives each token's row. */
|
|
37147
|
+
const ROW_ID = /^tokens:([^:]+):([^:]+):(.+)$/;
|
|
37148
|
+
/**
|
|
37149
|
+
* The tokens `holocron doctor tokens` reports as due, found from its rows: a failing row with a problem that starts
|
|
37150
|
+
* with a rotation label (`expiry:` or `age:`, the labels `tokenRotationRows()` writes). A token that fails only for a
|
|
37151
|
+
* permission it must not have, or lacks, is not due, and a token the layer does not hold has no rotation problem.
|
|
37152
|
+
*
|
|
37153
|
+
* @param rows - The rows `runDoctorTokens()` returned.
|
|
37154
|
+
* @param layers - Only the tokens held in these layers; left out, every layer.
|
|
37155
|
+
*/
|
|
37156
|
+
function dueTokens(rows, layers) {
|
|
37157
|
+
const due = [];
|
|
37158
|
+
for (const row of rows) {
|
|
37159
|
+
const match = ROW_ID.exec(row.id);
|
|
37160
|
+
if (row.status !== "fail" || !match) continue;
|
|
37161
|
+
const [, layer, provider, envName] = match;
|
|
37162
|
+
if (layers && layers.length > 0 && !layers.includes(layer)) continue;
|
|
37163
|
+
const problems = row.problems.filter((p) => ROTATION_LABELS.some((label) => p.startsWith(`${label}:`)));
|
|
37164
|
+
if (problems.length > 0) due.push({
|
|
37165
|
+
layer,
|
|
37166
|
+
provider,
|
|
37167
|
+
envName,
|
|
37168
|
+
problems
|
|
37169
|
+
});
|
|
37170
|
+
}
|
|
37171
|
+
return due;
|
|
37172
|
+
}
|
|
37173
|
+
// src/commands/rotate-tokens/rotate-tokens.ts
|
|
37174
|
+
/**
|
|
37175
|
+
* `holocron rotate tokens`: replace the tokens `holocron doctor tokens` reports as due (#2717, spec
|
|
37176
|
+
* `tech-token-rotation`). It reads the same rows the doctor does, so the two cannot disagree, lists each token that is
|
|
37177
|
+
* past its declared rotation or near its expiry, and for a provider that can make a token runs `provider <name> token`
|
|
37178
|
+
* once per token after one question. It revokes nothing and syncs nothing: the CLI cannot write a 1Password Environment,
|
|
37179
|
+
* so it cannot know the import and the sync happened. It ends with the order of what is left for each replaced token.
|
|
37180
|
+
* No token value is printed, logged or returned.
|
|
37181
|
+
*/
|
|
37182
|
+
const row$4 = (id, title, status, detail, problems = []) => ({
|
|
37183
|
+
id: `rotate:${id}`,
|
|
37184
|
+
title,
|
|
37185
|
+
status,
|
|
37186
|
+
detail,
|
|
37187
|
+
problems
|
|
37188
|
+
});
|
|
37189
|
+
const label = (d) => `${d.provider} ${d.envName} (${d.layer})`;
|
|
37190
|
+
async function runRotateTokens(input) {
|
|
37191
|
+
const print = input.print ?? ((line) => console.log(line));
|
|
37192
|
+
const dryRun = input.context.dryRun ?? false;
|
|
37193
|
+
const shown = [];
|
|
37194
|
+
const show = (rows) => {
|
|
37195
|
+
shown.push(...rows);
|
|
37196
|
+
printCheckRows(rows, print);
|
|
37197
|
+
};
|
|
37198
|
+
const finish = (base) => {
|
|
37199
|
+
const summary = summariseChecks(shown);
|
|
37200
|
+
printCheckSummary(summary, print);
|
|
37201
|
+
const status = summary.fail > 0 ? "fail" : base;
|
|
37202
|
+
getLogger().info({
|
|
37203
|
+
...summary,
|
|
37204
|
+
status
|
|
37205
|
+
}, "rotate tokens");
|
|
37206
|
+
return {
|
|
37207
|
+
status,
|
|
37208
|
+
rows: shown
|
|
37209
|
+
};
|
|
37210
|
+
};
|
|
37211
|
+
print(`Holocron rotate tokens${dryRun ? " (dry-run)" : ""}`);
|
|
37212
|
+
const layers = input.layers ?? [];
|
|
37213
|
+
const unknown = layers.find((l) => !ENVIRONMENT_LAYERS.includes(l));
|
|
37214
|
+
if (unknown !== void 0) {
|
|
37215
|
+
show([row$4("layer", "layer", "fail", `\`${unknown}\` is not a layer`, [`use one of: ${ENVIRONMENT_LAYERS.join(", ")}`])]);
|
|
37216
|
+
return finish("fail");
|
|
37217
|
+
}
|
|
37218
|
+
const due = dueTokens((await (input.doctor ?? runDoctorTokens)({
|
|
37219
|
+
loaded: input.loaded,
|
|
37220
|
+
context: input.context,
|
|
37221
|
+
print: () => {}
|
|
37222
|
+
})).rows, layers);
|
|
37223
|
+
if (due.length === 0) {
|
|
37224
|
+
show([row$4("none", "tokens", "ok", "no token is due")]);
|
|
37225
|
+
return finish("ok");
|
|
37226
|
+
}
|
|
37227
|
+
/* v8 ignore next -- the real loader is only built outside tests, which always inject one */
|
|
37228
|
+
const loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);
|
|
37229
|
+
await loader.load();
|
|
37230
|
+
assertPluginsResolvable(loader, "rotate tokens");
|
|
37231
|
+
const canMint = [];
|
|
37232
|
+
for (const d of due) {
|
|
37233
|
+
const mint = loader.mintTokens().get(d.provider) ?? await loader.loadMintToken(d.provider, {}).catch(() => void 0);
|
|
37234
|
+
canMint.push(mint !== void 0);
|
|
37235
|
+
}
|
|
37236
|
+
const replaceable = due.filter((_, i) => canMint[i]);
|
|
37237
|
+
show(due.map((d, i) => canMint[i] ? row$4(`${d.layer}:${d.provider}:${d.envName}`, label(d), "ok", `due (${d.problems.join("; ")}); will be replaced through ${d.provider}'s API`) : row$4(`${d.layer}:${d.provider}:${d.envName}`, label(d), "fail", `due (${d.problems.join("; ")})`, [`${d.provider} cannot make a token through its API: make one in its dashboard and store it with \`holocron new token ${d.provider} <token>\``])));
|
|
37238
|
+
if (dryRun || replaceable.length === 0) return finish(dryRun ? "dry-run" : "ok");
|
|
37239
|
+
if (!input.yes) {
|
|
37240
|
+
if (!input.confirm) throw new NonInteractiveError("pass --yes to replace tokens without a terminal");
|
|
37241
|
+
const names = replaceable.map(label).join(", ");
|
|
37242
|
+
if (!await input.confirm(`Replace ${replaceable.length} token${replaceable.length === 1 ? "" : "s"}: ${names}?`)) {
|
|
37243
|
+
print(" cancelled; nothing was replaced");
|
|
37244
|
+
return {
|
|
37245
|
+
status: "cancelled",
|
|
37246
|
+
rows: []
|
|
37247
|
+
};
|
|
37248
|
+
}
|
|
37249
|
+
}
|
|
37250
|
+
/* v8 ignore next -- the real mint calls a provider's API, which tests replace with `mint` */
|
|
37251
|
+
const mint = input.mint ?? runProviderToken;
|
|
37252
|
+
for (const d of replaceable) {
|
|
37253
|
+
const made = await mint({
|
|
37254
|
+
loaded: input.loaded,
|
|
37255
|
+
context: input.context,
|
|
37256
|
+
provider: d.provider,
|
|
37257
|
+
layer: d.layer,
|
|
37258
|
+
yes: true,
|
|
37259
|
+
loader,
|
|
37260
|
+
print
|
|
37261
|
+
});
|
|
37262
|
+
const id = `${d.layer}:${d.provider}:${d.envName}`;
|
|
37263
|
+
if (made.status === "ok") show([row$4(id, label(d), "ok", "a new token was made and handed to the private import file; the old one still works"), row$4(`next:${id}`, "next", "skip", `after the import: \`holocron sync secrets --env ${d.layer}\`, then delete the one it replaces with \`holocron provider ${d.provider} revoke <old-id>\` (the id is on ${d.provider}'s token page)`)]);
|
|
37264
|
+
else show([row$4(id, label(d), "fail", "the replacement was not made", made.rows.filter((r) => r.status === "fail").map((r) => r.detail))]);
|
|
37265
|
+
}
|
|
37266
|
+
return finish("ok");
|
|
37267
|
+
}
|
|
37268
|
+
// src/commands/rotate-tokens/rotate-tokens.command.ts
|
|
37269
|
+
const rotateTokensCommand = {
|
|
37270
|
+
command: "tokens",
|
|
37271
|
+
describe: "Replace the tokens `doctor tokens` reports as due, for the providers that can make one",
|
|
37272
|
+
builder: (y) => y.option("env", {
|
|
37273
|
+
type: "string",
|
|
37274
|
+
array: true,
|
|
37275
|
+
describe: "Only the tokens held in this layer (local, dev, ci, prod, preview); repeat for more"
|
|
37276
|
+
}).option("yes", {
|
|
37277
|
+
type: "boolean",
|
|
37278
|
+
default: false,
|
|
37279
|
+
describe: "Replace without asking (required without a terminal)"
|
|
37280
|
+
}),
|
|
37281
|
+
handler: async (argv) => {
|
|
37282
|
+
const tokens = tokenContext(argv.token);
|
|
37283
|
+
if (!tokens) return;
|
|
37284
|
+
const loaded = await loadConfig(argv.cwd);
|
|
37285
|
+
applyResolvedConfig(argv, loaded.resolved);
|
|
37286
|
+
if ((await runRotateTokens({
|
|
37287
|
+
loaded,
|
|
37288
|
+
context: {
|
|
37289
|
+
repoRoot: argv.cwd,
|
|
37290
|
+
dryRun: argv.dryRun,
|
|
37291
|
+
...tokens,
|
|
37292
|
+
org: resolveOrg(argv, loaded.resolved)
|
|
37293
|
+
},
|
|
37294
|
+
...argv.env && argv.env.length > 0 ? { layers: argv.env } : {},
|
|
37295
|
+
yes: argv.yes,
|
|
37296
|
+
...process.stdin.isTTY === true ? { confirm: (message) => confirm({
|
|
37297
|
+
message,
|
|
37298
|
+
default: false
|
|
37299
|
+
}) } : {}
|
|
37300
|
+
})).status === "fail") process.exitCode = 1;
|
|
37301
|
+
}
|
|
37302
|
+
};
|
|
37303
|
+
// src/commands/rotate/rotate.command.ts
|
|
37304
|
+
const rotateCommand = {
|
|
37305
|
+
command: "rotate",
|
|
37306
|
+
describe: "Replace what is due: the tokens `doctor tokens` reports as past their rotation",
|
|
37307
|
+
builder: (y) => y.command(rotateTokensCommand).command(groupMenu("rotate")),
|
|
37308
|
+
handler: () => {}
|
|
37309
|
+
};
|
|
36992
37310
|
// src/commands/run/run.args.ts
|
|
36993
37311
|
const runArgs = (y) => y.positional("task", {
|
|
36994
37312
|
type: "string",
|
|
@@ -41038,6 +41356,7 @@ const COMMAND_MODULES = [
|
|
|
41038
41356
|
resolveCommand,
|
|
41039
41357
|
reconcileCommand,
|
|
41040
41358
|
redeliverCommand,
|
|
41359
|
+
rotateCommand,
|
|
41041
41360
|
projectCommand
|
|
41042
41361
|
];
|
|
41043
41362
|
// src/cli/own-package-json.ts
|