@theholocron/cli 5.0.0-alpha.577 → 5.0.0-alpha.579
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/README.md +7 -1
- package/dist/cli.mjs +920 -483
- package/dist/cli.mjs.map +1 -1
- package/dist/{index-DuoivgJw.d.mts → index-D8o6BRQO.d.mts} +14 -0
- package/dist/index.d.mts +15 -3
- package/dist/index.mjs +38 -2
- package/dist/plugin/capabilities.d.mts +1 -1
- package/dist/presets.d.mts +1 -1
- package/package.json +5 -5
package/dist/cli.mjs
CHANGED
|
@@ -99,6 +99,7 @@ const COMMAND_CONTEXTS = {
|
|
|
99
99
|
"dev serve": "repo-aware",
|
|
100
100
|
"new channel": "workspace",
|
|
101
101
|
"setup notifications": "workspace",
|
|
102
|
+
"setup council": "workspace",
|
|
102
103
|
"link account": "workspace",
|
|
103
104
|
"new server": "workspace",
|
|
104
105
|
"sync roles": "workspace",
|
|
@@ -392,6 +393,20 @@ const configShowEntry = {
|
|
|
392
393
|
positionals: [],
|
|
393
394
|
skipOptions: ["depth", "interactive"]
|
|
394
395
|
};
|
|
396
|
+
// src/commands/council-setup/council-setup.entry.ts
|
|
397
|
+
const councilSetupEntry = {
|
|
398
|
+
name: "setup council",
|
|
399
|
+
description: "Install or update the Council Obsidian plugin in a vault",
|
|
400
|
+
positionals: [],
|
|
401
|
+
options: [{
|
|
402
|
+
key: "vault",
|
|
403
|
+
flag: "--vault",
|
|
404
|
+
type: "input",
|
|
405
|
+
message: "Vault folder (leave out to use the configured ideas vault):"
|
|
406
|
+
}],
|
|
407
|
+
skipOptions: ["yes"],
|
|
408
|
+
supportsDryRun: true
|
|
409
|
+
};
|
|
395
410
|
// src/commands/deploy/deploy.entry.ts
|
|
396
411
|
const deployEntry = {
|
|
397
412
|
name: "deploy",
|
|
@@ -2399,6 +2414,7 @@ const registry = createCommandRegistry([
|
|
|
2399
2414
|
doctorCiEntry,
|
|
2400
2415
|
doctorReleasesEntry,
|
|
2401
2416
|
notificationsSetupEntry,
|
|
2417
|
+
councilSetupEntry,
|
|
2402
2418
|
notificationsCreateServerEntry,
|
|
2403
2419
|
notificationsLinkEntry,
|
|
2404
2420
|
notificationsSyncRolesEntry,
|
|
@@ -4510,7 +4526,7 @@ function planIssueTypes(declared, existing, update) {
|
|
|
4510
4526
|
}
|
|
4511
4527
|
const WRITE_PERMISSION = "creating or changing issue Types needs an organization admin and the organization permission Issue types: write (HOLOCRON_ORG_TOKEN)";
|
|
4512
4528
|
const READ_PERMISSION = "reading the organization's issue Types needs the organization permission Issue types: read (HOLOCRON_ORG_TOKEN)";
|
|
4513
|
-
const row$
|
|
4529
|
+
const row$41 = (id, title, status, detail, problems = []) => ({
|
|
4514
4530
|
id: `issue-types:${id}`,
|
|
4515
4531
|
title,
|
|
4516
4532
|
status,
|
|
@@ -4530,7 +4546,7 @@ async function ensureIssueTypes(input) {
|
|
|
4530
4546
|
const refused = input.caller === "setup" ? "skip" : "fail";
|
|
4531
4547
|
const stop = (status, detail, problems = []) => ({
|
|
4532
4548
|
status,
|
|
4533
|
-
rows: [row$
|
|
4549
|
+
rows: [row$41("types", "issue types", status, detail, problems)],
|
|
4534
4550
|
created,
|
|
4535
4551
|
updated
|
|
4536
4552
|
});
|
|
@@ -4570,7 +4586,7 @@ async function ensureIssueTypes(input) {
|
|
|
4570
4586
|
default: false
|
|
4571
4587
|
})))(`Change the organization's issue Types?\n${todo.map((a) => ` ${describeAction(a).detail} ${a.declared.name}`).join("\n")}`)) return {
|
|
4572
4588
|
status: "cancelled",
|
|
4573
|
-
rows: [row$
|
|
4589
|
+
rows: [row$41("types", "issue types", "skip", "cancelled; nothing was changed")],
|
|
4574
4590
|
created,
|
|
4575
4591
|
updated
|
|
4576
4592
|
};
|
|
@@ -4585,34 +4601,34 @@ async function ensureIssueTypes(input) {
|
|
|
4585
4601
|
continue;
|
|
4586
4602
|
}
|
|
4587
4603
|
if (limited) {
|
|
4588
|
-
rows.push(row$
|
|
4604
|
+
rows.push(row$41(name, name, "skip", "left: stopped at a rate limit"));
|
|
4589
4605
|
continue;
|
|
4590
4606
|
}
|
|
4591
4607
|
if (refusedOnce) {
|
|
4592
|
-
rows.push(row$
|
|
4608
|
+
rows.push(row$41(name, name, refused, "not written: the token was refused"));
|
|
4593
4609
|
continue;
|
|
4594
4610
|
}
|
|
4595
4611
|
try {
|
|
4596
4612
|
if (action.kind === "create") {
|
|
4597
4613
|
await issues.createType(toDeclaration(action.declared));
|
|
4598
4614
|
created.push(name);
|
|
4599
|
-
rows.push(row$
|
|
4615
|
+
rows.push(row$41(name, name, "ok", "created"));
|
|
4600
4616
|
} else {
|
|
4601
4617
|
const patch = Object.fromEntries(action.changes.map((c) => [c.field, c.to]));
|
|
4602
4618
|
await issues.updateType?.(action.existing.id, patch);
|
|
4603
4619
|
updated.push(name);
|
|
4604
|
-
rows.push(row$
|
|
4620
|
+
rows.push(row$41(name, name, "ok", `updated ${action.changes.map((c) => c.field).join(", ")}`));
|
|
4605
4621
|
}
|
|
4606
4622
|
} catch (err) {
|
|
4607
4623
|
const kind = classifyTypeError(err);
|
|
4608
4624
|
if (kind === "rate-limit") {
|
|
4609
4625
|
limited = true;
|
|
4610
|
-
rows.push(row$
|
|
4626
|
+
rows.push(row$41(name, name, "fail", "rate limited: stopped; run it again to finish"));
|
|
4611
4627
|
} else if (kind === "refused") {
|
|
4612
4628
|
refusedOnce = true;
|
|
4613
|
-
rows.push(row$
|
|
4614
|
-
} else if (kind === "conflict" && action.kind === "create" && await nowExists(issues, name)) rows.push(row$
|
|
4615
|
-
else rows.push(row$
|
|
4629
|
+
rows.push(row$41(name, name, refused, WRITE_PERMISSION));
|
|
4630
|
+
} else if (kind === "conflict" && action.kind === "create" && await nowExists(issues, name)) rows.push(row$41(name, name, "ok", "exists (made in the meantime)"));
|
|
4631
|
+
else rows.push(row$41(name, name, "fail", describeError(err)));
|
|
4616
4632
|
}
|
|
4617
4633
|
}
|
|
4618
4634
|
return {
|
|
@@ -4633,12 +4649,12 @@ async function nowExists(issues, name) {
|
|
|
4633
4649
|
/** The row of an action that is not carried out (a dry run, or the list shown before asking), or that needs none. */
|
|
4634
4650
|
function describeAction(action) {
|
|
4635
4651
|
const name = action.declared.name;
|
|
4636
|
-
if (action.kind === "create") return row$
|
|
4652
|
+
if (action.kind === "create") return row$41(name, name, "skip", "would create");
|
|
4637
4653
|
if (action.kind === "update") {
|
|
4638
4654
|
const fields = action.changes.map((c) => c.field).join(", ");
|
|
4639
|
-
return row$
|
|
4655
|
+
return row$41(name, name, "skip", `would update ${fields}`, action.changes.map((c) => `${c.field}: was ${JSON.stringify(c.was)}, to ${JSON.stringify(c.to)}`));
|
|
4640
4656
|
}
|
|
4641
|
-
return row$
|
|
4657
|
+
return row$41(name, name, "ok", action.existing.enabled ? "exists" : "exists (turned off in the organization)");
|
|
4642
4658
|
}
|
|
4643
4659
|
// src/commands/notifications-channel-add/private-host.ts
|
|
4644
4660
|
/**
|
|
@@ -7437,7 +7453,7 @@ async function openBoardContext(input) {
|
|
|
7437
7453
|
};
|
|
7438
7454
|
}
|
|
7439
7455
|
// src/commands/issue-fields/add-issue-to-board/add-issue-to-board.ts
|
|
7440
|
-
const row$
|
|
7456
|
+
const row$40 = (board, status, detail) => ({
|
|
7441
7457
|
id: `board ${board}`,
|
|
7442
7458
|
title: `board ${board}`,
|
|
7443
7459
|
status,
|
|
@@ -7459,27 +7475,27 @@ async function addIssueToBoard(input) {
|
|
|
7459
7475
|
loader: input.loader,
|
|
7460
7476
|
...input.io ? { io: input.io } : {}
|
|
7461
7477
|
});
|
|
7462
|
-
if (!opened.ok) return row$
|
|
7478
|
+
if (!opened.ok) return row$40(board, opened.kind === "skip" ? "skip" : "fail", [opened.reason, ...opened.problems].join("; "));
|
|
7463
7479
|
const { projects, owner, boards, templates } = opened.context;
|
|
7464
|
-
if (!projects.addItems) return row$
|
|
7480
|
+
if (!projects.addItems) return row$40(board, "skip", `the \`${projects.providerName}\` provider cannot add items to a board`);
|
|
7465
7481
|
const declared = boards.find((b) => b.name.toLowerCase() === board.toLowerCase());
|
|
7466
7482
|
if (!declared) {
|
|
7467
7483
|
const names = boards.map((b) => b.name).join(", ");
|
|
7468
|
-
return row$
|
|
7484
|
+
return row$40(board, "fail", `no board named "${board}" is declared in providers.projects${names ? ` (declared: ${names})` : ""}`);
|
|
7469
7485
|
}
|
|
7470
7486
|
const template = templates[declared.template];
|
|
7471
|
-
if (!template) return row$
|
|
7487
|
+
if (!template) return row$40(board, "fail", `the template "${declared.template}" of "${declared.name}" is not available`);
|
|
7472
7488
|
const found = await projects.find(owner, declared.name);
|
|
7473
|
-
if (!found) return row$
|
|
7474
|
-
if (input.dryRun) return row$
|
|
7489
|
+
if (!found) return row$40(board, "fail", `the board "${declared.name}" does not exist yet; \`holocron setup project\` makes it`);
|
|
7490
|
+
if (input.dryRun) return row$40(board, "skip", `would add ${key} to "${declared.name}"`);
|
|
7475
7491
|
const [added] = await projects.addItems(owner, found, [{
|
|
7476
7492
|
key,
|
|
7477
7493
|
...input.priority ? { priority: input.priority } : {}
|
|
7478
7494
|
}], template);
|
|
7479
7495
|
const dropped = added?.dropped ?? [];
|
|
7480
|
-
return row$
|
|
7496
|
+
return row$40(board, dropped.length > 0 ? "skip" : "ok", `${added?.added ? "added" : "already on"} "${declared.name}"${dropped.length > 0 ? `; not set: ${dropped.join(", ")}` : ""}`);
|
|
7481
7497
|
} catch (err) {
|
|
7482
|
-
return row$
|
|
7498
|
+
return row$40(board, "fail", `could not add ${key} to the board: ${describeError(err)}`);
|
|
7483
7499
|
}
|
|
7484
7500
|
}
|
|
7485
7501
|
// src/commands/issue-fields/describe-issue-fields/describe-issue-fields.ts
|
|
@@ -7586,7 +7602,7 @@ function prepareIssueFields(input, areas) {
|
|
|
7586
7602
|
* asks first unless `--dry-run` or `--yes` (without a terminal it refuses instead). `update work` is another command,
|
|
7587
7603
|
* which spans the pull request and the board.
|
|
7588
7604
|
*/
|
|
7589
|
-
const row$
|
|
7605
|
+
const row$39 = (id, status, detail) => ({
|
|
7590
7606
|
id,
|
|
7591
7607
|
title: id,
|
|
7592
7608
|
status,
|
|
@@ -7612,7 +7628,7 @@ async function runIssueUpdate(input) {
|
|
|
7612
7628
|
print(style.header(`Holocron update issue${dryRun ? " (dry-run)" : ""}`));
|
|
7613
7629
|
print("");
|
|
7614
7630
|
const key = input.key.trim();
|
|
7615
|
-
if (!key) return finish([row$
|
|
7631
|
+
if (!key) return finish([row$39("key", "fail", "the issue key is empty")]);
|
|
7616
7632
|
const prepared = prepareIssueFields(input, input.loaded.resolved.repo?.labels?.areas);
|
|
7617
7633
|
const problems = prepared.ok ? [] : [...prepared.problems];
|
|
7618
7634
|
const clear = [...new Set(input.clear ?? [])];
|
|
@@ -7639,7 +7655,7 @@ async function runIssueUpdate(input) {
|
|
|
7639
7655
|
for (const label of addLabels) if (removeLabels.some((r) => r.toLowerCase() === label.toLowerCase())) problems.push(`the label "${label}" is both added and removed`);
|
|
7640
7656
|
const blockers = prepared.ok ? prepared.fields.blockedBy ?? [] : [];
|
|
7641
7657
|
for (const k of unblock) if (blockers.includes(k)) problems.push(`${k} is both added and removed as a blocker`);
|
|
7642
|
-
if (problems.length > 0 || !prepared.ok) return finish(problems.map((p) => row$
|
|
7658
|
+
if (problems.length > 0 || !prepared.ok) return finish(problems.map((p) => row$39(key, "fail", p)));
|
|
7643
7659
|
const patch = {
|
|
7644
7660
|
...prepared.fields,
|
|
7645
7661
|
...title ? { title } : {},
|
|
@@ -7665,10 +7681,10 @@ async function runIssueUpdate(input) {
|
|
|
7665
7681
|
...unblock.length > 0 ? [`unblock: ${unblock.join(", ")}`] : [],
|
|
7666
7682
|
...clear.length > 0 ? [`clear: ${clear.join(", ")}`] : []
|
|
7667
7683
|
];
|
|
7668
|
-
if (details.length === 0) return finish([row$
|
|
7684
|
+
if (details.length === 0) return finish([row$39(key, "fail", "nothing to change; name a field to set, or `--clear` one")]);
|
|
7669
7685
|
const summary = ` (${details.join("; ")})`;
|
|
7670
7686
|
const entry = input.loaded.resolved.providers.issues;
|
|
7671
|
-
if (!entry) return finish([row$
|
|
7687
|
+
if (!entry) return finish([row$39(key, "fail", "the config has no `issues` provider to update the issue with")]);
|
|
7672
7688
|
const credentials = input.loaded.resolved.providers.credentials;
|
|
7673
7689
|
const projects = prepared.project ? input.loaded.resolved.providers.projects : void 0;
|
|
7674
7690
|
/* v8 ignore start -- the real loader is only built outside tests, which always inject one */
|
|
@@ -7685,10 +7701,10 @@ async function runIssueUpdate(input) {
|
|
|
7685
7701
|
assertPluginsResolvable(loader, "update issue");
|
|
7686
7702
|
if (!loader.has("issues")) {
|
|
7687
7703
|
const failure = loader.loadFailures().find((f) => f.key === "issues");
|
|
7688
|
-
return finish([row$
|
|
7704
|
+
return finish([row$39(key, "fail", `the \`issues\` provider is not available${failure ? ` (${describeError(failure.error)})` : ""}`)]);
|
|
7689
7705
|
}
|
|
7690
7706
|
const issues = loader.get("issues");
|
|
7691
|
-
if (!issues.update) return finish([row$
|
|
7707
|
+
if (!issues.update) return finish([row$39(key, "fail", `the \`${issues.providerName}\` provider does not support \`update issue\``)]);
|
|
7692
7708
|
if (dryRun) {
|
|
7693
7709
|
const board = prepared.project ? await addIssueToBoard({
|
|
7694
7710
|
loaded: input.loaded,
|
|
@@ -7698,7 +7714,7 @@ async function runIssueUpdate(input) {
|
|
|
7698
7714
|
key,
|
|
7699
7715
|
dryRun: true
|
|
7700
7716
|
}) : void 0;
|
|
7701
|
-
return finish([row$
|
|
7717
|
+
return finish([row$39(key, "skip", `would update the issue${summary}`), ...board ? [board] : []]);
|
|
7702
7718
|
}
|
|
7703
7719
|
if (!input.yes) {
|
|
7704
7720
|
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");
|
|
@@ -7724,12 +7740,12 @@ async function runIssueUpdate(input) {
|
|
|
7724
7740
|
...prepared.fields.priority ? { priority: prepared.fields.priority } : {}
|
|
7725
7741
|
}) : void 0;
|
|
7726
7742
|
return finish([
|
|
7727
|
-
row$
|
|
7728
|
-
...(result.dropped ?? []).map((line) => row$
|
|
7743
|
+
row$39(result.key, "ok", result.changed.length > 0 ? `updated: ${result.changed.join("; ")}` : "already as asked; nothing changed"),
|
|
7744
|
+
...(result.dropped ?? []).map((line) => row$39("not carried across", "skip", line)),
|
|
7729
7745
|
...board ? [board] : []
|
|
7730
7746
|
], result.changed);
|
|
7731
7747
|
} catch (err) {
|
|
7732
|
-
return finish([row$
|
|
7748
|
+
return finish([row$39(key, "fail", `could not update the issue: ${describeError(err)}`)]);
|
|
7733
7749
|
}
|
|
7734
7750
|
}
|
|
7735
7751
|
// src/commands/start-work/find-worktree/find-worktree.ts
|
|
@@ -7769,7 +7785,7 @@ function unpushedCommits(git, cwd, branch) {
|
|
|
7769
7785
|
], cwd)) || 0;
|
|
7770
7786
|
}
|
|
7771
7787
|
// src/commands/close-work/clean-up-work/clean-up-work.ts
|
|
7772
|
-
const row$
|
|
7788
|
+
const row$38 = (id, status, detail) => ({
|
|
7773
7789
|
id,
|
|
7774
7790
|
title: id,
|
|
7775
7791
|
status,
|
|
@@ -7798,51 +7814,51 @@ function cleanUpWork(input) {
|
|
|
7798
7814
|
let keepBranch;
|
|
7799
7815
|
try {
|
|
7800
7816
|
const path = findWorktree(git, repoRoot, branch);
|
|
7801
|
-
if (!path) rows.push(row$
|
|
7817
|
+
if (!path) rows.push(row$38("worktree", "skip", `none holds ${branch}`));
|
|
7802
7818
|
else if (input.keepWorktree) {
|
|
7803
|
-
rows.push(row$
|
|
7819
|
+
rows.push(row$38("worktree", "skip", `kept at ${path} (--keep-worktree)`));
|
|
7804
7820
|
keepBranch = "its worktree is kept";
|
|
7805
7821
|
} else if (resolve(path) === mainWorktree(input)) {
|
|
7806
|
-
rows.push(row$
|
|
7822
|
+
rows.push(row$38("worktree", "skip", `${branch} is checked out in the main checkout; switch it to another branch first`));
|
|
7807
7823
|
keepBranch = "it is checked out in the main checkout";
|
|
7808
7824
|
} else if (resolve(repoRoot) === resolve(path) || resolve(repoRoot).startsWith(resolve(path) + sep)) {
|
|
7809
|
-
rows.push(row$
|
|
7825
|
+
rows.push(row$38("worktree", "skip", `${path} is where this command is running; run it from another checkout`));
|
|
7810
7826
|
keepBranch = "its worktree is where this command is running";
|
|
7811
7827
|
} else if (git(["status", "--porcelain"], path)) {
|
|
7812
|
-
rows.push(row$
|
|
7828
|
+
rows.push(row$38("worktree", "fail", `${path} has uncommitted changes; commit or discard them, nothing was removed`));
|
|
7813
7829
|
keepBranch = "its worktree has uncommitted changes";
|
|
7814
|
-
} else if (dryRun) rows.push(row$
|
|
7830
|
+
} else if (dryRun) rows.push(row$38("worktree", "skip", `would remove ${path}`));
|
|
7815
7831
|
else {
|
|
7816
7832
|
git([
|
|
7817
7833
|
"worktree",
|
|
7818
7834
|
"remove",
|
|
7819
7835
|
path
|
|
7820
7836
|
], repoRoot);
|
|
7821
|
-
rows.push(row$
|
|
7837
|
+
rows.push(row$38("worktree", "ok", `removed ${path}`));
|
|
7822
7838
|
}
|
|
7823
7839
|
} catch (err) {
|
|
7824
|
-
rows.push(row$
|
|
7840
|
+
rows.push(row$38("worktree", "fail", `could not remove the worktree: ${describeError(err)}`));
|
|
7825
7841
|
keepBranch = "its worktree could not be removed";
|
|
7826
7842
|
}
|
|
7827
7843
|
try {
|
|
7828
7844
|
const unpushed = unpushedCommits(git, repoRoot, branch);
|
|
7829
|
-
if (unpushed === void 0) rows.push(row$
|
|
7830
|
-
else if (keepBranch) rows.push(row$
|
|
7845
|
+
if (unpushed === void 0) rows.push(row$38("local branch", "skip", `${branch} is not in this checkout`));
|
|
7846
|
+
else if (keepBranch) rows.push(row$38("local branch", "skip", `${branch} stays: ${keepBranch}`));
|
|
7831
7847
|
else {
|
|
7832
7848
|
const tip = git(["rev-parse", `refs/heads/${branch}`], repoRoot);
|
|
7833
|
-
if (!(input.mode === "abandoned" || unpushed === 0 || input.headSha && tip === input.headSha)) rows.push(row$
|
|
7834
|
-
else if (dryRun) rows.push(row$
|
|
7849
|
+
if (!(input.mode === "abandoned" || unpushed === 0 || input.headSha && tip === input.headSha)) rows.push(row$38("local branch", "fail", `${branch} holds commits the pull request does not (tip ${tip.slice(0, 7)}); not deleted`));
|
|
7850
|
+
else if (dryRun) rows.push(row$38("local branch", "skip", `would delete ${branch}`));
|
|
7835
7851
|
else {
|
|
7836
7852
|
git([
|
|
7837
7853
|
"branch",
|
|
7838
7854
|
"-D",
|
|
7839
7855
|
branch
|
|
7840
7856
|
], repoRoot);
|
|
7841
|
-
rows.push(row$
|
|
7857
|
+
rows.push(row$38("local branch", "ok", `deleted ${branch}`));
|
|
7842
7858
|
}
|
|
7843
7859
|
}
|
|
7844
7860
|
} catch (err) {
|
|
7845
|
-
rows.push(row$
|
|
7861
|
+
rows.push(row$38("local branch", "fail", `could not delete ${branch}: ${describeError(err)}`));
|
|
7846
7862
|
}
|
|
7847
7863
|
try {
|
|
7848
7864
|
const remote = git([
|
|
@@ -7851,9 +7867,9 @@ function cleanUpWork(input) {
|
|
|
7851
7867
|
"origin",
|
|
7852
7868
|
`refs/heads/${branch}`
|
|
7853
7869
|
], repoRoot);
|
|
7854
|
-
rows.push(remote ? row$
|
|
7870
|
+
rows.push(remote ? row$38("remote branch", "skip", `${branch} is still on origin; GitHub deletes it on merge (the repo setting), or run: git push origin --delete ${branch}`) : row$38("remote branch", "ok", `${branch} is gone from origin`));
|
|
7855
7871
|
} catch (err) {
|
|
7856
|
-
rows.push(row$
|
|
7872
|
+
rows.push(row$38("remote branch", "skip", `could not ask origin: ${describeError(err)}`));
|
|
7857
7873
|
}
|
|
7858
7874
|
return rows;
|
|
7859
7875
|
}
|
|
@@ -7897,7 +7913,7 @@ function findWorkBranches(git, cwd, issue) {
|
|
|
7897
7913
|
});
|
|
7898
7914
|
}
|
|
7899
7915
|
// src/commands/close-work/abandon-work/abandon-work.ts
|
|
7900
|
-
const row$
|
|
7916
|
+
const row$37 = (id, status, detail) => ({
|
|
7901
7917
|
id,
|
|
7902
7918
|
title: id,
|
|
7903
7919
|
status,
|
|
@@ -7922,9 +7938,9 @@ async function abandonWork(a) {
|
|
|
7922
7938
|
try {
|
|
7923
7939
|
found = findWorkBranches(git, repoRoot, key);
|
|
7924
7940
|
} catch (err) {
|
|
7925
|
-
return { rows: [row$
|
|
7941
|
+
return { rows: [row$37("local branch", "fail", `could not list the branches: ${describeError(err)}`)] };
|
|
7926
7942
|
}
|
|
7927
|
-
if (found.length > 1) return { rows: [row$
|
|
7943
|
+
if (found.length > 1) return { rows: [row$37("local branch", "fail", `${found.length} branches are named for ${key} (${found.join(", ")}); --pr names the pull request whose branch to remove`)] };
|
|
7928
7944
|
branch = found[0];
|
|
7929
7945
|
}
|
|
7930
7946
|
if (branch) {
|
|
@@ -7932,9 +7948,9 @@ async function abandonWork(a) {
|
|
|
7932
7948
|
try {
|
|
7933
7949
|
unpushed = unpushedCommits(git, repoRoot, branch);
|
|
7934
7950
|
} catch (err) {
|
|
7935
|
-
return { rows: [row$
|
|
7951
|
+
return { rows: [row$37("unpushed commits", "fail", `could not read ${branch}: ${describeError(err)}`)] };
|
|
7936
7952
|
}
|
|
7937
|
-
if (unpushed !== void 0 && unpushed > 0) return { rows: [row$
|
|
7953
|
+
if (unpushed !== void 0 && unpushed > 0) return { rows: [row$37("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`)] };
|
|
7938
7954
|
}
|
|
7939
7955
|
if (!dryRun && !input.yes) {
|
|
7940
7956
|
const what = [
|
|
@@ -7948,31 +7964,31 @@ async function abandonWork(a) {
|
|
|
7948
7964
|
};
|
|
7949
7965
|
}
|
|
7950
7966
|
let specFiles = [];
|
|
7951
|
-
if (!pr) rows.push(row$
|
|
7967
|
+
if (!pr) rows.push(row$37("pull request", "skip", `no open pull request for ${key}`));
|
|
7952
7968
|
else {
|
|
7953
7969
|
try {
|
|
7954
7970
|
specFiles = source.listPullRequestFiles ? findSpecFiles(await source.listPullRequestFiles(pr.number)) : [];
|
|
7955
7971
|
} catch (err) {
|
|
7956
|
-
rows.push(row$
|
|
7972
|
+
rows.push(row$37("spec", "fail", `could not read the pull request's files: ${describeError(err)}`));
|
|
7957
7973
|
}
|
|
7958
|
-
if (pr.state !== "open") rows.push(row$
|
|
7959
|
-
else if (!source.updatePullRequest) rows.push(row$
|
|
7960
|
-
else if (dryRun) rows.push(row$
|
|
7974
|
+
if (pr.state !== "open") rows.push(row$37("pull request", "skip", `#${pr.number} is already closed`));
|
|
7975
|
+
else if (!source.updatePullRequest) rows.push(row$37("pull request", "fail", `the \`${source.providerName}\` provider cannot close a pull request`));
|
|
7976
|
+
else if (dryRun) rows.push(row$37("pull request", "skip", `would close #${pr.number}`));
|
|
7961
7977
|
else try {
|
|
7962
7978
|
await source.updatePullRequest(pr.number, { state: "closed" });
|
|
7963
|
-
rows.push(row$
|
|
7979
|
+
rows.push(row$37("pull request", "ok", `closed #${pr.number}`));
|
|
7964
7980
|
} catch (err) {
|
|
7965
|
-
rows.push(row$
|
|
7981
|
+
rows.push(row$37("pull request", "fail", `could not close #${pr.number}: ${describeError(err)}`));
|
|
7966
7982
|
}
|
|
7967
7983
|
}
|
|
7968
7984
|
if (pr && !rows.some((r) => r.id === "spec")) {
|
|
7969
|
-
if (specFiles.length === 0) rows.push(row$
|
|
7970
|
-
else if (!input.withdrawSpecs) rows.push(row$
|
|
7985
|
+
if (specFiles.length === 0) rows.push(row$37("spec", "skip", "the pull request holds no spec or ADR, so no post to withdraw"));
|
|
7986
|
+
else if (!input.withdrawSpecs) rows.push(row$37("spec", "fail", "no way to withdraw the post was given"));
|
|
7971
7987
|
else try {
|
|
7972
7988
|
const result = await input.withdrawSpecs(specFiles);
|
|
7973
|
-
rows.push(row$
|
|
7989
|
+
rows.push(row$37("spec", result.ok ? "ok" : "fail", `${specFiles.join(", ")}: ${result.detail}`));
|
|
7974
7990
|
} catch (err) {
|
|
7975
|
-
rows.push(row$
|
|
7991
|
+
rows.push(row$37("spec", "fail", `could not withdraw the post: ${describeError(err)}`));
|
|
7976
7992
|
}
|
|
7977
7993
|
}
|
|
7978
7994
|
if (branch) rows.push(...cleanUpWork({
|
|
@@ -7983,9 +7999,9 @@ async function abandonWork(a) {
|
|
|
7983
7999
|
mode: "abandoned",
|
|
7984
8000
|
...input.keepWorktree ? { keepWorktree: true } : {}
|
|
7985
8001
|
}));
|
|
7986
|
-
else rows.push(row$
|
|
7987
|
-
if (dryRun) rows.push(row$
|
|
7988
|
-
else if (input.yes) rows.push(row$
|
|
8002
|
+
else rows.push(row$37("local branch", "skip", `no local branch is named for ${key}`));
|
|
8003
|
+
if (dryRun) rows.push(row$37("issue", "skip", `would ask whether to close ${key} as not planned`));
|
|
8004
|
+
else if (input.yes) rows.push(row$37("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`));
|
|
7989
8005
|
else if (await a.ask(`Close ${key} as not planned?`)) {
|
|
7990
8006
|
const close = await (input.updateIssue ?? runIssueUpdate)({
|
|
7991
8007
|
key,
|
|
@@ -8002,22 +8018,29 @@ async function abandonWork(a) {
|
|
|
8002
8018
|
id: `issue: ${r.id}`,
|
|
8003
8019
|
title: `issue: ${r.title}`
|
|
8004
8020
|
});
|
|
8005
|
-
} else rows.push(row$
|
|
8021
|
+
} else rows.push(row$37("issue", "skip", `${key} left open`));
|
|
8006
8022
|
return { rows };
|
|
8007
8023
|
}
|
|
8024
|
+
// src/commands/declared-required-checks/declared-required-checks.ts
|
|
8025
|
+
/** `repo.requiredChecks` de-duplicated, whole (nothing is added to it), or `undefined` when `setup` derives the list. */
|
|
8026
|
+
function declaredRequiredChecks(repo) {
|
|
8027
|
+
const declared = repo?.requiredChecks;
|
|
8028
|
+
return declared === void 0 ? void 0 : [...new Set(declared)];
|
|
8029
|
+
}
|
|
8030
|
+
// src/required-checks/config-required-contexts/config-required-contexts.ts
|
|
8031
|
+
/** A config's required contexts: `repo.requiredChecks` when declared, else what `setup` writes to the ruleset. */
|
|
8032
|
+
function configRequiredContexts(config) {
|
|
8033
|
+
const declared = declaredRequiredChecks(config.repo);
|
|
8034
|
+
if (declared !== void 0) return declared;
|
|
8035
|
+
const tasks = { tasks: config.tasks };
|
|
8036
|
+
if (config.extraRequiredChecks) tasks.extraRequiredChecks = config.extraRequiredChecks;
|
|
8037
|
+
if (config.ci) tasks.ci = config.ci;
|
|
8038
|
+
return requiredChecks(tasks, false);
|
|
8039
|
+
}
|
|
8008
8040
|
// src/required-checks/required-from-contexts/required-from-contexts.ts
|
|
8009
8041
|
/** What GitHub puts between a caller job's name and the called job's name in a check run's name. */
|
|
8010
8042
|
const SEPARATOR = " / ";
|
|
8011
|
-
/**
|
|
8012
|
-
* Turns required status-check contexts (a ruleset's `requiredChecks`, or `requiredChecks()` from astromech) into the
|
|
8013
|
-
* `{ expected, statuses }` form the aggregate and `requiredChecksVerdict()` read.
|
|
8014
|
-
*
|
|
8015
|
-
* A context with ` / ` in it names a check run (`test:unit / Conclusion`): its id is the part before the first ` / `,
|
|
8016
|
-
* and `evaluateAggregate()` matches any run named `<id> / ...`, which is how `aggregateChecks()` derives `expected`
|
|
8017
|
-
* from the same contexts. A context with none (`codecov/patch`, `codecov/patch/documentation`) is a `statuses` entry:
|
|
8018
|
-
* the verdict then accepts a check run named like it, else a commit status of that context. Order is kept and
|
|
8019
|
-
* duplicates dropped (two contexts of one caller are one id).
|
|
8020
|
-
*/
|
|
8043
|
+
/** Contexts to `{ expected, statuses }`: the part before ` / ` is a check id, a context without one is a status. */
|
|
8021
8044
|
function requiredFromContexts(contexts) {
|
|
8022
8045
|
const expected = /* @__PURE__ */ new Set();
|
|
8023
8046
|
const statuses = /* @__PURE__ */ new Set();
|
|
@@ -8031,18 +8054,8 @@ function requiredFromContexts(contexts) {
|
|
|
8031
8054
|
statuses: [...statuses]
|
|
8032
8055
|
};
|
|
8033
8056
|
}
|
|
8034
|
-
// src/commands/declared-required-checks/declared-required-checks.ts
|
|
8035
|
-
/**
|
|
8036
|
-
* The status-check contexts the repo writes down in `repo.requiredChecks` (`.holocron/repo.ts`), de-duplicated and in the
|
|
8037
|
-
* order given, or `undefined` when it leaves the list out and `holocron setup` derives it from the task manifest
|
|
8038
|
-
* (`astromech.requiredChecks()`). A declared list is the whole list: nothing is added to it (not the DCO check, not a
|
|
8039
|
-
* task's context), so what the ruleset requires is what the file says. `setup` writes it and `doctor repo` compares it.
|
|
8040
|
-
*/
|
|
8041
|
-
function declaredRequiredChecks(repo) {
|
|
8042
|
-
const declared = repo?.requiredChecks;
|
|
8043
|
-
return declared === void 0 ? void 0 : [...new Set(declared)];
|
|
8044
|
-
}
|
|
8045
8057
|
// src/commands/setup/branch-protection.ts
|
|
8058
|
+
/** The name of the ruleset `holocron setup` makes for the default branch. */
|
|
8046
8059
|
const RULESET_NAME = "holocron-default-branch";
|
|
8047
8060
|
function buildClassicProtectionPayload(requiredChecks = []) {
|
|
8048
8061
|
return {
|
|
@@ -8165,15 +8178,6 @@ async function upsertBranchProtection(source, dryRun, requiredChecks, pins = {})
|
|
|
8165
8178
|
}
|
|
8166
8179
|
}
|
|
8167
8180
|
// src/required-checks/resolve-required-checks/resolve-required-checks.ts
|
|
8168
|
-
/** The contexts of the repo's own list: what `holocron setup` writes to the ruleset when there is no aggregate. */
|
|
8169
|
-
function configContexts(config) {
|
|
8170
|
-
const declared = declaredRequiredChecks(config.repo);
|
|
8171
|
-
if (declared !== void 0) return declared;
|
|
8172
|
-
const tasks = { tasks: config.tasks };
|
|
8173
|
-
if (config.extraRequiredChecks) tasks.extraRequiredChecks = config.extraRequiredChecks;
|
|
8174
|
-
if (config.ci) tasks.ci = config.ci;
|
|
8175
|
-
return requiredChecks(tasks, false);
|
|
8176
|
-
}
|
|
8177
8181
|
/**
|
|
8178
8182
|
* The checks that must be green before a pull request may merge, for a repo whose `ci.aggregate` is `none` (spec
|
|
8179
8183
|
* `tech-checks-without-aggregate`, decision 2): the live ruleset's required contexts first, read through the `source`
|
|
@@ -8188,7 +8192,7 @@ function configContexts(config) {
|
|
|
8188
8192
|
async function resolveRequiredChecks(input) {
|
|
8189
8193
|
const { source, config } = input;
|
|
8190
8194
|
const fallback = (why) => ({
|
|
8191
|
-
required: requiredFromContexts(
|
|
8195
|
+
required: requiredFromContexts(configRequiredContexts(config)),
|
|
8192
8196
|
from: "config",
|
|
8193
8197
|
why
|
|
8194
8198
|
});
|
|
@@ -8688,7 +8692,7 @@ function workTitle(input) {
|
|
|
8688
8692
|
const MAX_TITLE = 100;
|
|
8689
8693
|
const DEFAULT_BASE = "alpha";
|
|
8690
8694
|
const WORKTREES = ".claude/worktrees";
|
|
8691
|
-
const row$
|
|
8695
|
+
const row$36 = (id, status, detail) => ({
|
|
8692
8696
|
id,
|
|
8693
8697
|
title: id,
|
|
8694
8698
|
status,
|
|
@@ -8724,7 +8728,7 @@ async function runStartWork(input) {
|
|
|
8724
8728
|
};
|
|
8725
8729
|
};
|
|
8726
8730
|
const fail = (id, detail) => {
|
|
8727
|
-
rows.push(row$
|
|
8731
|
+
rows.push(row$36(id, "fail", detail));
|
|
8728
8732
|
return finish();
|
|
8729
8733
|
};
|
|
8730
8734
|
print(style.header(`Holocron start work${dryRun ? " (dry-run)" : ""}`));
|
|
@@ -8780,7 +8784,7 @@ async function runStartWork(input) {
|
|
|
8780
8784
|
} catch (err) {
|
|
8781
8785
|
return fail(key, `could not read the issue: ${describeError(err)}`);
|
|
8782
8786
|
}
|
|
8783
|
-
rows.push(row$
|
|
8787
|
+
rows.push(row$36(key, "ok", `${issue.summary} (${issue.status})`));
|
|
8784
8788
|
const named = workTitle({
|
|
8785
8789
|
issueTitle: issue.summary,
|
|
8786
8790
|
...input.kind ? {
|
|
@@ -8823,14 +8827,14 @@ async function runStartWork(input) {
|
|
|
8823
8827
|
...source ? [`draft pull request "${title}" (${link.keyword} ${key})`] : ["no pull request"]
|
|
8824
8828
|
].join("; ");
|
|
8825
8829
|
if (dryRun) {
|
|
8826
|
-
rows.push(row$
|
|
8827
|
-
rows.push(row$
|
|
8828
|
-
rows.push(row$
|
|
8829
|
-
if (useWorktree) rows.push(row$
|
|
8830
|
-
rows.push(row$
|
|
8831
|
-
rows.push(row$
|
|
8832
|
-
if (source) rows.push(row$
|
|
8833
|
-
rows.push(row$
|
|
8830
|
+
rows.push(row$36("title", "skip", `${title} (${named.reason}${releaseNote})`));
|
|
8831
|
+
rows.push(row$36("start date", "skip", `would set the start date${input.effort ? ` and Effort ${input.effort}` : ""}${branchExists ? " (not again: the branch exists)" : ""}`));
|
|
8832
|
+
rows.push(row$36("branch", "skip", `would ${branchExists ? "reuse" : "make"} ${branch} from origin/${base}`));
|
|
8833
|
+
if (useWorktree) rows.push(row$36("worktree", "skip", `would use ${wtPath}`));
|
|
8834
|
+
rows.push(row$36("first commit", "skip", `would commit${spec ? ` ${spec.rel}` : " empty"} as "${commitSubject}"`));
|
|
8835
|
+
rows.push(row$36("push", "skip", `would push ${branch} to origin`));
|
|
8836
|
+
if (source) rows.push(row$36("pull request", "skip", `would open a draft pull request against ${base}, ${link.keyword} ${key}`));
|
|
8837
|
+
rows.push(row$36("board status", "skip", "the open pull request moves the issue to In Progress"));
|
|
8834
8838
|
return finish();
|
|
8835
8839
|
}
|
|
8836
8840
|
if (!input.yes) {
|
|
@@ -8846,18 +8850,18 @@ async function runStartWork(input) {
|
|
|
8846
8850
|
};
|
|
8847
8851
|
}
|
|
8848
8852
|
}
|
|
8849
|
-
rows.push(row$
|
|
8850
|
-
if (branchExists) rows.push(row$
|
|
8851
|
-
else if (!issues.update) rows.push(row$
|
|
8853
|
+
rows.push(row$36("title", "ok", `${title} (${named.reason}${releaseNote})`));
|
|
8854
|
+
if (branchExists) rows.push(row$36("start date", "skip", "the branch exists, so the work started before; the start date is left as it is"));
|
|
8855
|
+
else if (!issues.update) rows.push(row$36("start date", "skip", `the \`${issues.providerName}\` provider cannot update an issue`));
|
|
8852
8856
|
else try {
|
|
8853
8857
|
const result = await issues.update(key, {
|
|
8854
8858
|
startDate: io.today(),
|
|
8855
8859
|
...input.effort ? { effort: input.effort } : {}
|
|
8856
8860
|
});
|
|
8857
|
-
rows.push(row$
|
|
8858
|
-
for (const line of result.dropped ?? []) rows.push(row$
|
|
8861
|
+
rows.push(row$36("start date", "ok", result.changed.length > 0 ? result.changed.join(", ") : "already as asked"));
|
|
8862
|
+
for (const line of result.dropped ?? []) rows.push(row$36("not carried across", "skip", line));
|
|
8859
8863
|
} catch (err) {
|
|
8860
|
-
rows.push(row$
|
|
8864
|
+
rows.push(row$36("start date", "fail", `could not update the issue: ${describeError(err)}`));
|
|
8861
8865
|
}
|
|
8862
8866
|
let dir = root;
|
|
8863
8867
|
try {
|
|
@@ -8886,7 +8890,7 @@ async function runStartWork(input) {
|
|
|
8886
8890
|
"--abbrev-ref",
|
|
8887
8891
|
"HEAD"
|
|
8888
8892
|
], root) !== branch && dir === root) io.git(["switch", branch], root);
|
|
8889
|
-
rows.push(row$
|
|
8893
|
+
rows.push(row$36("branch", "ok", `${branch} already exists; reused`));
|
|
8890
8894
|
} else if (useWorktree) {
|
|
8891
8895
|
io.git([
|
|
8892
8896
|
"worktree",
|
|
@@ -8898,7 +8902,7 @@ async function runStartWork(input) {
|
|
|
8898
8902
|
start
|
|
8899
8903
|
], root);
|
|
8900
8904
|
dir = wtPath;
|
|
8901
|
-
rows.push(row$
|
|
8905
|
+
rows.push(row$36("branch", "ok", `made ${branch} from ${start}`));
|
|
8902
8906
|
} else {
|
|
8903
8907
|
io.git([
|
|
8904
8908
|
"switch",
|
|
@@ -8907,19 +8911,19 @@ async function runStartWork(input) {
|
|
|
8907
8911
|
branch,
|
|
8908
8912
|
start
|
|
8909
8913
|
], root);
|
|
8910
|
-
rows.push(row$
|
|
8914
|
+
rows.push(row$36("branch", "ok", `made ${branch} from ${start} and switched to it`));
|
|
8911
8915
|
}
|
|
8912
8916
|
report = {
|
|
8913
8917
|
...report,
|
|
8914
8918
|
directory: dir
|
|
8915
8919
|
};
|
|
8916
|
-
if (useWorktree) rows.push(row$
|
|
8920
|
+
if (useWorktree) rows.push(row$36("worktree", "ok", dir));
|
|
8917
8921
|
const ahead = Number(git([
|
|
8918
8922
|
"rev-list",
|
|
8919
8923
|
"--count",
|
|
8920
8924
|
`${start}..${branch}`
|
|
8921
8925
|
]) || "0");
|
|
8922
|
-
if (ahead > 0) rows.push(row$
|
|
8926
|
+
if (ahead > 0) rows.push(row$36("first commit", "skip", `${branch} already has ${ahead} commit${ahead === 1 ? "" : "s"}`));
|
|
8923
8927
|
else {
|
|
8924
8928
|
const trailer = `Refs ${workReference(key)}`;
|
|
8925
8929
|
if (spec) {
|
|
@@ -8930,7 +8934,7 @@ async function runStartWork(input) {
|
|
|
8930
8934
|
spec.rel
|
|
8931
8935
|
], dir);
|
|
8932
8936
|
const status = /^status:\s*(\S+)/m.exec(io.read(spec.abs))?.[1];
|
|
8933
|
-
if (status && status !== "draft") rows.push(row$
|
|
8937
|
+
if (status && status !== "draft") rows.push(row$36("spec", "skip", `the spec's status is ${status}, not draft`));
|
|
8934
8938
|
}
|
|
8935
8939
|
io.git([
|
|
8936
8940
|
"commit",
|
|
@@ -8941,7 +8945,7 @@ async function runStartWork(input) {
|
|
|
8941
8945
|
"-m",
|
|
8942
8946
|
trailer
|
|
8943
8947
|
], dir);
|
|
8944
|
-
rows.push(row$
|
|
8948
|
+
rows.push(row$36("first commit", "ok", `${io.git([
|
|
8945
8949
|
"rev-parse",
|
|
8946
8950
|
"--short",
|
|
8947
8951
|
"HEAD"
|
|
@@ -8953,9 +8957,9 @@ async function runStartWork(input) {
|
|
|
8953
8957
|
"origin",
|
|
8954
8958
|
branch
|
|
8955
8959
|
], dir);
|
|
8956
|
-
rows.push(row$
|
|
8960
|
+
rows.push(row$36("push", "ok", `${branch} is on origin`));
|
|
8957
8961
|
} catch (err) {
|
|
8958
|
-
rows.push(row$
|
|
8962
|
+
rows.push(row$36("git", "fail", `${describeError(err)}; nothing was deleted, run the command again to carry on`));
|
|
8959
8963
|
return finish();
|
|
8960
8964
|
}
|
|
8961
8965
|
if (source) try {
|
|
@@ -8971,7 +8975,7 @@ async function runStartWork(input) {
|
|
|
8971
8975
|
...input.templatesIo ? { templatesIo: input.templatesIo } : {}
|
|
8972
8976
|
});
|
|
8973
8977
|
issueBoards = read.boards;
|
|
8974
|
-
if (read.problem) rows.push(row$
|
|
8978
|
+
if (read.problem) rows.push(row$36("boards", "skip", `the pull request is not put on the issue's boards: ${read.problem}`));
|
|
8975
8979
|
}
|
|
8976
8980
|
const projects = [.../* @__PURE__ */ new Set([...issueBoards, ...input.project ? [input.project] : []])];
|
|
8977
8981
|
const mirrored = {
|
|
@@ -9003,12 +9007,12 @@ async function runStartWork(input) {
|
|
|
9003
9007
|
created: result.created
|
|
9004
9008
|
}
|
|
9005
9009
|
};
|
|
9006
|
-
rows.push(row$
|
|
9007
|
-
for (const line of result.dropped) rows.push(row$
|
|
9010
|
+
rows.push(row$36("pull request", "ok", `${result.created ? "opened" : "already open:"} #${pr.number}${result.draft ? " (draft)" : ""} ${pr.url}`));
|
|
9011
|
+
for (const line of result.dropped) rows.push(row$36("not carried across", "skip", line));
|
|
9008
9012
|
} catch (err) {
|
|
9009
|
-
rows.push(row$
|
|
9013
|
+
rows.push(row$36("pull request", "fail", `could not open the pull request: ${describeError(err)}; run the command again to open it`));
|
|
9010
9014
|
}
|
|
9011
|
-
rows.push(row$
|
|
9015
|
+
rows.push(row$36("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"));
|
|
9012
9016
|
return finish();
|
|
9013
9017
|
}
|
|
9014
9018
|
// src/commands/update-work/guard-work-status/guard-work-status.ts
|
|
@@ -9056,7 +9060,7 @@ function guardWorkStatus(status, force) {
|
|
|
9056
9060
|
* terminal it refuses). `--dry-run` runs the reads and writes nothing. A run with nothing to change still syncs the
|
|
9057
9061
|
* area labels.
|
|
9058
9062
|
*/
|
|
9059
|
-
const row$
|
|
9063
|
+
const row$35 = (id, status, detail) => ({
|
|
9060
9064
|
id,
|
|
9061
9065
|
title: id,
|
|
9062
9066
|
status,
|
|
@@ -9090,7 +9094,7 @@ async function runUpdateWork(input) {
|
|
|
9090
9094
|
};
|
|
9091
9095
|
};
|
|
9092
9096
|
const fail = (id, detail) => {
|
|
9093
|
-
rows.push(row$
|
|
9097
|
+
rows.push(row$35(id, "fail", detail));
|
|
9094
9098
|
return finish();
|
|
9095
9099
|
};
|
|
9096
9100
|
print(style.header(`Holocron update work${dryRun ? " (dry-run)" : ""}`));
|
|
@@ -9179,7 +9183,7 @@ async function runUpdateWork(input) {
|
|
|
9179
9183
|
title: `start: ${r.title}`
|
|
9180
9184
|
});
|
|
9181
9185
|
if (started.status === "fail") {
|
|
9182
|
-
rows.push(row$
|
|
9186
|
+
rows.push(row$35("update work", "skip", "start work failed, so nothing after it was run"));
|
|
9183
9187
|
return finish();
|
|
9184
9188
|
}
|
|
9185
9189
|
}
|
|
@@ -9191,10 +9195,10 @@ async function runUpdateWork(input) {
|
|
|
9191
9195
|
} else if (source.listPullRequests) {
|
|
9192
9196
|
const found = findWorkPullRequests(await source.listPullRequests("open"), key);
|
|
9193
9197
|
pr = found[0];
|
|
9194
|
-
if (found.length > 1) rows.push(row$
|
|
9198
|
+
if (found.length > 1) rows.push(row$35("pull request", "skip", `${found.length} open pull requests match ${key}; using #${pr?.number} (--pr names another)`));
|
|
9195
9199
|
}
|
|
9196
9200
|
} catch (err) {
|
|
9197
|
-
rows.push(row$
|
|
9201
|
+
rows.push(row$35("pull request", "fail", `could not find the pull request: ${describeError(err)}`));
|
|
9198
9202
|
return finish();
|
|
9199
9203
|
}
|
|
9200
9204
|
if (pr) {
|
|
@@ -9205,24 +9209,24 @@ async function runUpdateWork(input) {
|
|
|
9205
9209
|
url: pr.url
|
|
9206
9210
|
}
|
|
9207
9211
|
};
|
|
9208
|
-
rows.push(row$
|
|
9212
|
+
rows.push(row$35("pull request", "ok", `#${pr.number} ${pr.title}`));
|
|
9209
9213
|
} else {
|
|
9210
9214
|
const detail = `no open pull request for ${key} (its branch is <type>/<issue>-<slug>; --pr names one, --start makes one)`;
|
|
9211
|
-
rows.push(row$
|
|
9215
|
+
rows.push(row$35("pull request", title ? "fail" : "skip", title ? `${detail}; --title needs one` : detail));
|
|
9212
9216
|
}
|
|
9213
9217
|
let derived = [];
|
|
9214
|
-
if (!pr) rows.push(row$
|
|
9215
|
-
else if (!areas || Object.keys(areas).length === 0) rows.push(row$
|
|
9216
|
-
else if (!source.listPullRequestFiles) rows.push(row$
|
|
9218
|
+
if (!pr) rows.push(row$35("area labels", "skip", "no pull request to read the changed folders of"));
|
|
9219
|
+
else if (!areas || Object.keys(areas).length === 0) rows.push(row$35("area labels", "skip", "the repo declares no `repo.labels.areas`"));
|
|
9220
|
+
else if (!source.listPullRequestFiles) rows.push(row$35("area labels", "skip", `the \`${source.providerName}\` provider cannot list a pull request's files`));
|
|
9217
9221
|
else try {
|
|
9218
9222
|
derived = areaLabelsForFiles(await source.listPullRequestFiles(pr.number), areas);
|
|
9219
9223
|
report = {
|
|
9220
9224
|
...report,
|
|
9221
9225
|
areaLabels: derived
|
|
9222
9226
|
};
|
|
9223
|
-
rows.push(row$
|
|
9227
|
+
rows.push(row$35("area labels", derived.length > 0 ? "ok" : "skip", derived.length > 0 ? derived.join(", ") : "the changed folders are in no area"));
|
|
9224
9228
|
} catch (err) {
|
|
9225
|
-
rows.push(row$
|
|
9229
|
+
rows.push(row$35("area labels", "fail", `could not read the changed files: ${describeError(err)}`));
|
|
9226
9230
|
}
|
|
9227
9231
|
let missingOnIssue = derived;
|
|
9228
9232
|
if (derived.length > 0 && issues.export) try {
|
|
@@ -9259,7 +9263,7 @@ async function runUpdateWork(input) {
|
|
|
9259
9263
|
id: `issue: ${r.id}`,
|
|
9260
9264
|
title: `issue: ${r.title}`
|
|
9261
9265
|
});
|
|
9262
|
-
} else rows.push(row$
|
|
9266
|
+
} else rows.push(row$35("issue", "skip", "no issue field to change"));
|
|
9263
9267
|
if (pr) {
|
|
9264
9268
|
const prLabels = unique([...addLabels, ...derived]);
|
|
9265
9269
|
const patch = {
|
|
@@ -9278,15 +9282,15 @@ async function runUpdateWork(input) {
|
|
|
9278
9282
|
...milestone ? [`milestone ${milestone}`] : [],
|
|
9279
9283
|
...input.project ? [`board ${input.project}`] : []
|
|
9280
9284
|
];
|
|
9281
|
-
if (parts.length === 0) rows.push(row$
|
|
9282
|
-
else if (!source.updatePullRequest) rows.push(row$
|
|
9283
|
-
else if (dryRun) rows.push(row$
|
|
9285
|
+
if (parts.length === 0) rows.push(row$35(`pull request #${pr.number}`, "skip", "no field to change"));
|
|
9286
|
+
else if (!source.updatePullRequest) rows.push(row$35(`pull request #${pr.number}`, "fail", `the \`${source.providerName}\` provider cannot update a pull request`));
|
|
9287
|
+
else if (dryRun) rows.push(row$35(`pull request #${pr.number}`, "skip", `would update ${parts.join("; ")}`));
|
|
9284
9288
|
else try {
|
|
9285
9289
|
const result = await source.updatePullRequest(pr.number, patch);
|
|
9286
|
-
rows.push(row$
|
|
9287
|
-
for (const line of result.dropped) rows.push(row$
|
|
9290
|
+
rows.push(row$35(`pull request #${pr.number}`, "ok", `updated ${parts.join("; ")}`));
|
|
9291
|
+
for (const line of result.dropped) rows.push(row$35("not carried across", "skip", line));
|
|
9288
9292
|
} catch (err) {
|
|
9289
|
-
rows.push(row$
|
|
9293
|
+
rows.push(row$35(`pull request #${pr.number}`, "fail", `could not update the pull request: ${describeError(err)}`));
|
|
9290
9294
|
}
|
|
9291
9295
|
}
|
|
9292
9296
|
if (status) {
|
|
@@ -9302,11 +9306,11 @@ async function runUpdateWork(input) {
|
|
|
9302
9306
|
...input.board ? { board: input.board } : {}
|
|
9303
9307
|
});
|
|
9304
9308
|
const change = set.key && set.to ? `${set.key} ${set.from ?? "no status"} → ${set.to}` : `${key} → ${status}`;
|
|
9305
|
-
rows.push(set.status === "ok" ? row$
|
|
9309
|
+
rows.push(set.status === "ok" ? row$35("board status", dryRun ? "skip" : "ok", dryRun ? `would set ${change}` : change) : row$35("board status", "fail", sub.lines.map((l) => l.trim()).filter(Boolean).join("; ") || "could not set the status"));
|
|
9306
9310
|
} catch (err) {
|
|
9307
|
-
rows.push(row$
|
|
9311
|
+
rows.push(row$35("board status", "fail", describeError(err)));
|
|
9308
9312
|
}
|
|
9309
|
-
rows.push(row$
|
|
9313
|
+
rows.push(row$35("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)"));
|
|
9310
9314
|
}
|
|
9311
9315
|
return finish();
|
|
9312
9316
|
}
|
|
@@ -9347,7 +9351,7 @@ function findClosedWorkPullRequests(prs, issue) {
|
|
|
9347
9351
|
return [...matching.filter((pr) => pr.merged), ...matching.filter((pr) => !pr.merged)];
|
|
9348
9352
|
}
|
|
9349
9353
|
// src/commands/close-work/release-closed-blockers/release-closed-blockers.ts
|
|
9350
|
-
const row$
|
|
9354
|
+
const row$34 = (id, status, detail) => ({
|
|
9351
9355
|
id,
|
|
9352
9356
|
title: id,
|
|
9353
9357
|
status,
|
|
@@ -9361,16 +9365,16 @@ const row$33 = (id, status, detail) => ({
|
|
|
9361
9365
|
*/
|
|
9362
9366
|
async function releaseClosedBlockers(input) {
|
|
9363
9367
|
const { issues, key } = input;
|
|
9364
|
-
if (!issues.export) return [row$
|
|
9368
|
+
if (!issues.export) return [row$34("relations", "skip", `the \`${issues.providerName}\` provider cannot read blockers`)];
|
|
9365
9369
|
try {
|
|
9366
9370
|
const blockers = (await issues.export({ keys: [key] }))[0]?.blockedBy ?? [];
|
|
9367
|
-
if (blockers.length === 0) return [row$
|
|
9371
|
+
if (blockers.length === 0) return [row$34("relations", "skip", `${key} has no blockers`)];
|
|
9368
9372
|
const closed = (await issues.export({ keys: blockers })).filter((r) => r.closed).map((r) => r.key);
|
|
9369
|
-
if (closed.length === 0) return [row$
|
|
9373
|
+
if (closed.length === 0) return [row$34("relations", "skip", `${blockers.length} blocker${blockers.length === 1 ? "" : "s"} still open: ${blockers.join(", ")}`)];
|
|
9370
9374
|
const done = await input.unblock(closed);
|
|
9371
|
-
return [row$
|
|
9375
|
+
return [row$34("relations", done.status === "fail" ? "fail" : "ok", `closed ${closed.length === 1 ? "blocker" : "blockers"} ${closed.join(", ")} taken off ${key}`), ...done.rows.filter((r) => r.status === "fail")];
|
|
9372
9376
|
} catch (err) {
|
|
9373
|
-
return [row$
|
|
9377
|
+
return [row$34("relations", "fail", `could not update the blockers: ${describeError(err)}`)];
|
|
9374
9378
|
}
|
|
9375
9379
|
}
|
|
9376
9380
|
// src/commands/close-work/wait-for-checks/wait-for-checks.ts
|
|
@@ -9910,7 +9914,7 @@ const DEFAULT_TIMEOUT_MINUTES = 30;
|
|
|
9910
9914
|
const DEFAULT_INTERVAL_MS = 3e4;
|
|
9911
9915
|
/** How many failing checks a row names. */
|
|
9912
9916
|
const MAX_NAMED$1 = 8;
|
|
9913
|
-
const row$
|
|
9917
|
+
const row$33 = (id, status, detail) => ({
|
|
9914
9918
|
id,
|
|
9915
9919
|
title: id,
|
|
9916
9920
|
status,
|
|
@@ -9937,7 +9941,7 @@ async function runCloseWork(input) {
|
|
|
9937
9941
|
};
|
|
9938
9942
|
};
|
|
9939
9943
|
const fail = (id, detail) => {
|
|
9940
|
-
rows.push(row$
|
|
9944
|
+
rows.push(row$33(id, "fail", detail));
|
|
9941
9945
|
return finish();
|
|
9942
9946
|
};
|
|
9943
9947
|
print(style.header(`Holocron close work${input.abandon ? " --abandon" : ""}${dryRun ? " (dry-run)" : ""}`));
|
|
@@ -9985,7 +9989,7 @@ async function runCloseWork(input) {
|
|
|
9985
9989
|
if (!source.listPullRequests) throw new Error(`the \`${source.providerName}\` provider cannot list pull requests`);
|
|
9986
9990
|
const open = findWorkPullRequests(await source.listPullRequests("open"), key);
|
|
9987
9991
|
pr = open[0];
|
|
9988
|
-
if (open.length > 1) rows.push(row$
|
|
9992
|
+
if (open.length > 1) rows.push(row$33("pull request", "skip", `${open.length} open pull requests match ${key}; using #${pr?.number} (--pr names another)`));
|
|
9989
9993
|
if (!pr && !input.abandon) pr = findClosedWorkPullRequests(await source.listPullRequests("closed"), key)[0];
|
|
9990
9994
|
}
|
|
9991
9995
|
} catch (err) {
|
|
@@ -10023,10 +10027,10 @@ async function runCloseWork(input) {
|
|
|
10023
10027
|
const repoRoot = input.context.repoRoot;
|
|
10024
10028
|
if (pr.state === "closed") {
|
|
10025
10029
|
if (!pr.merged) {
|
|
10026
|
-
rows.push(row$
|
|
10030
|
+
rows.push(row$33("pull request", "skip", `#${pr.number} was closed without merging; \`close work ${key} --abandon\` tidies its branch and spec`));
|
|
10027
10031
|
return finish();
|
|
10028
10032
|
}
|
|
10029
|
-
rows.push(row$
|
|
10033
|
+
rows.push(row$33("pull request", "ok", `#${pr.number} merged: ${pr.title}`));
|
|
10030
10034
|
if (!dryRun && !input.yes && !await ask(`Remove the worktree and local branch of ${pr.branch}?`)) {
|
|
10031
10035
|
print(` ${style.skip("cancelled; nothing was changed")}`);
|
|
10032
10036
|
return {
|
|
@@ -10047,7 +10051,7 @@ async function runCloseWork(input) {
|
|
|
10047
10051
|
}
|
|
10048
10052
|
const noAggregate = aggregatePoster({ ci: input.loaded.resolved.ci }) === "none";
|
|
10049
10053
|
const words = checksWording(noAggregate);
|
|
10050
|
-
rows.push(row$
|
|
10054
|
+
rows.push(row$33("pull request", "ok", `#${pr.number} ${pr.title}`));
|
|
10051
10055
|
if (!source.getPullRequestChecks) return fail(words.id, `the \`${source.providerName}\` provider cannot read a pull request's checks`);
|
|
10052
10056
|
const readChecks = source.getPullRequestChecks.bind(source);
|
|
10053
10057
|
const number = pr.number;
|
|
@@ -10059,7 +10063,7 @@ async function runCloseWork(input) {
|
|
|
10059
10063
|
});
|
|
10060
10064
|
required = resolved.required;
|
|
10061
10065
|
const list = [...required.expected, ...required.statuses].join(", ") || "none";
|
|
10062
|
-
rows.push(row$
|
|
10066
|
+
rows.push(row$33("required checks list", "skip", resolved.from === "ruleset" ? `from the live ruleset: ${list}` : `from the config (${resolved.why}): ${list}`));
|
|
10063
10067
|
}
|
|
10064
10068
|
const minutes = input.timeoutMinutes ?? DEFAULT_TIMEOUT_MINUTES;
|
|
10065
10069
|
let result;
|
|
@@ -10081,11 +10085,12 @@ async function runCloseWork(input) {
|
|
|
10081
10085
|
const failing = checks.failing.slice(0, MAX_NAMED$1).map(nameOf);
|
|
10082
10086
|
const more = checks.failing.length - failing.length;
|
|
10083
10087
|
const named = failing.length > 0 ? `: ${failing.join(", ")}${more > 0 ? `, and ${more} more` : ""}` : "";
|
|
10084
|
-
const
|
|
10088
|
+
const waiting = checks.pending?.length ? `: ${checks.pending.join(", ")}` : "";
|
|
10089
|
+
const why = checks.state === "failure" ? `${words.are} red${named}` : result.timedOut ? `${words.are} still ${checks.state} after ${minutes} minute${minutes === 1 ? "" : "s"}${waiting}` : `${words.are} ${checks.state === "none" ? words.unknown : `still running${waiting}`}; --wait polls until ${words.they} green`;
|
|
10085
10090
|
return fail(words.id, `${why}. #${number} was not marked ready; run \`close work ${key}\` again once ${words.they} green`);
|
|
10086
10091
|
}
|
|
10087
10092
|
const optional = checks.failing.filter((c) => c.required === false);
|
|
10088
|
-
rows.push(row$
|
|
10093
|
+
rows.push(row$33(words.id, "ok", `green${checks.sha ? ` on ${checks.sha.slice(0, 7)}` : ""}${optional.length > 0 ? `; optional checks failing: ${optional.slice(0, MAX_NAMED$1).map(nameOf).join(", ")}` : ""}`));
|
|
10089
10094
|
if (!dryRun && !input.yes) {
|
|
10090
10095
|
if (!await ask(`${key} is green. ${`Mark #${number} ready, update the area labels and take closed blockers off ${key}`}?`)) {
|
|
10091
10096
|
print(` ${style.skip("cancelled; nothing was changed")}`);
|
|
@@ -10095,13 +10100,13 @@ async function runCloseWork(input) {
|
|
|
10095
10100
|
};
|
|
10096
10101
|
}
|
|
10097
10102
|
}
|
|
10098
|
-
if (!source.markReady) rows.push(row$
|
|
10099
|
-
else if (dryRun) rows.push(row$
|
|
10103
|
+
if (!source.markReady) rows.push(row$33("ready", "fail", `the \`${source.providerName}\` provider cannot mark a pull request ready`));
|
|
10104
|
+
else if (dryRun) rows.push(row$33("ready", "skip", `would mark #${number} ready if it is a draft`));
|
|
10100
10105
|
else try {
|
|
10101
10106
|
const changed = await source.markReady(number);
|
|
10102
|
-
rows.push(row$
|
|
10107
|
+
rows.push(row$33("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`));
|
|
10103
10108
|
} catch (err) {
|
|
10104
|
-
rows.push(row$
|
|
10109
|
+
rows.push(row$33("ready", "fail", `could not mark #${number} ready: ${describeError(err)}`));
|
|
10105
10110
|
}
|
|
10106
10111
|
try {
|
|
10107
10112
|
const updated = await (input.updateWork ?? runUpdateWork)({
|
|
@@ -10119,7 +10124,7 @@ async function runCloseWork(input) {
|
|
|
10119
10124
|
title: `labels: ${r.title}`
|
|
10120
10125
|
});
|
|
10121
10126
|
} catch (err) {
|
|
10122
|
-
rows.push(row$
|
|
10127
|
+
rows.push(row$33("labels", "fail", `could not update the area labels: ${describeError(err)}`));
|
|
10123
10128
|
}
|
|
10124
10129
|
rows.push(...await releaseClosedBlockers({
|
|
10125
10130
|
issues,
|
|
@@ -11730,7 +11735,7 @@ function installationSettingsUrl(account, id) {
|
|
|
11730
11735
|
return `https://github.com/settings/installations/${id}`;
|
|
11731
11736
|
}
|
|
11732
11737
|
// src/commands/doctor-github-app/app-rows.ts
|
|
11733
|
-
const row$
|
|
11738
|
+
const row$32 = (name, what, problems, ok) => ({
|
|
11734
11739
|
id: `${name}:${what}`,
|
|
11735
11740
|
title: `${name}: ${what}`,
|
|
11736
11741
|
status: problems.length > 0 ? "fail" : "ok",
|
|
@@ -11775,9 +11780,9 @@ function appRows(name, manifest, app, installations) {
|
|
|
11775
11780
|
return [`${who} has not accepted the current App: ${gaps.join("; ")}`, `fix: ${who} accepts the update at ${url}`];
|
|
11776
11781
|
});
|
|
11777
11782
|
return [
|
|
11778
|
-
row$
|
|
11779
|
-
row$
|
|
11780
|
-
row$
|
|
11783
|
+
row$32(name, "events", eventProblems.length > 0 ? [...eventProblems, fix] : [], `all ${manifest.events.length} subscribed${extrasNote("extra event(s)", extraEvents)}`),
|
|
11784
|
+
row$32(name, "permissions", permissionProblems.length > 0 ? [...permissionProblems, fix] : [], `all ${Object.keys(manifest.permissions).length} granted${extrasNote("extra permission(s)", extraPermissions)}`),
|
|
11785
|
+
row$32(name, "installations", installationProblems, `${installations.length} installation(s) up to date`),
|
|
11781
11786
|
statusRow(name, installations)
|
|
11782
11787
|
];
|
|
11783
11788
|
}
|
|
@@ -11943,7 +11948,7 @@ async function runDoctorGitHubApp(input) {
|
|
|
11943
11948
|
assertPluginsResolvable(loader, "doctor github-app");
|
|
11944
11949
|
}
|
|
11945
11950
|
const rows = [];
|
|
11946
|
-
if (instances.length === 0) rows.push(row$
|
|
11951
|
+
if (instances.length === 0) rows.push(row$31("github-app", "reachable", "skip", "no `githubApps` are declared in holocron.config.ts"));
|
|
11947
11952
|
const checked = [];
|
|
11948
11953
|
for (const instance of instances) {
|
|
11949
11954
|
const instanceRows = await checkInstance(instance, loader, input);
|
|
@@ -11990,7 +11995,7 @@ function printGrouped(checked, print) {
|
|
|
11990
11995
|
}
|
|
11991
11996
|
}
|
|
11992
11997
|
}
|
|
11993
|
-
function row$
|
|
11998
|
+
function row$31(name, what, status, detail) {
|
|
11994
11999
|
return {
|
|
11995
12000
|
id: `${name}:${what}`,
|
|
11996
12001
|
title: `${name}: ${what}`,
|
|
@@ -12006,10 +12011,10 @@ async function checkInstance(instance, loader, input) {
|
|
|
12006
12011
|
try {
|
|
12007
12012
|
manifest = parseManifest(readManifest(instance.manifest));
|
|
12008
12013
|
} catch (err) {
|
|
12009
|
-
return [row$
|
|
12014
|
+
return [row$31(name, "manifest", "fail", `cannot read ${instance.manifest}: ${errorMessage(err)}`)];
|
|
12010
12015
|
}
|
|
12011
12016
|
const read = await readAppCredentials(instance, loader);
|
|
12012
|
-
if ("reason" in read) return [row$
|
|
12017
|
+
if ("reason" in read) return [row$31(name, "reachable", "skip", read.reason)];
|
|
12013
12018
|
const api = input.api ?? defaultApi$1;
|
|
12014
12019
|
const secrets = [read.creds.privateKey];
|
|
12015
12020
|
try {
|
|
@@ -12017,12 +12022,12 @@ async function checkInstance(instance, loader, input) {
|
|
|
12017
12022
|
const installations = await api.listAppInstallations(read.creds);
|
|
12018
12023
|
const owner = app.owner ? `, owned by ${app.owner.login}` : "";
|
|
12019
12024
|
return [
|
|
12020
|
-
row$
|
|
12025
|
+
row$31(name, "reachable", "ok", `${app.slug}${owner}, settings: ${appSettingsUrl(app)}`),
|
|
12021
12026
|
...appRows(name, manifest, app, installations),
|
|
12022
12027
|
await deliveryRow(name, read.creds, api, (input.now ?? Date.now)(), secrets)
|
|
12023
12028
|
];
|
|
12024
12029
|
} catch (err) {
|
|
12025
|
-
return [row$
|
|
12030
|
+
return [row$31(name, "reachable", "fail", `cannot call GitHub as the App: ${scrubbed$1(err, secrets)}`)];
|
|
12026
12031
|
}
|
|
12027
12032
|
}
|
|
12028
12033
|
// src/commands/doctor-github-app/doctor-github-app.command.ts
|
|
@@ -12960,7 +12965,7 @@ function createDoctorAgentPorts(input) {
|
|
|
12960
12965
|
};
|
|
12961
12966
|
}
|
|
12962
12967
|
// src/commands/doctor-agent/doctor-agent.ts
|
|
12963
|
-
const row$
|
|
12968
|
+
const row$30 = (id, title, status, detail, problems = []) => ({
|
|
12964
12969
|
id,
|
|
12965
12970
|
title,
|
|
12966
12971
|
status,
|
|
@@ -13005,31 +13010,31 @@ async function runDoctorAgent(input) {
|
|
|
13005
13010
|
const path = agentTokenPath(ports.env, ports.home);
|
|
13006
13011
|
const file = readAgentToken(path, ports.fs);
|
|
13007
13012
|
if (file.status === "fail") {
|
|
13008
|
-
rows.push(row$
|
|
13013
|
+
rows.push(row$30("agent-token-file", "the Service Account's token file", file.missing ? "skip" : "fail", file.missing ? `${path}: not there, so this machine has no agent set up (${file.reason})` : `${path}: ${file.reason}`));
|
|
13009
13014
|
return finish();
|
|
13010
13015
|
}
|
|
13011
|
-
rows.push(row$
|
|
13016
|
+
rows.push(row$30("agent-token-file", "the Service Account's token file", "ok", `${path} (mode 600, in a private directory)`));
|
|
13012
13017
|
if (!ports.opInstalled()) {
|
|
13013
|
-
rows.push(row$
|
|
13018
|
+
rows.push(row$30("agent-op", "the 1Password CLI", "fail", "`op` is not installed: brew install 1password-cli"));
|
|
13014
13019
|
return finish();
|
|
13015
13020
|
}
|
|
13016
|
-
rows.push(row$
|
|
13021
|
+
rows.push(row$30("agent-op", "the 1Password CLI", "ok", "`op` is installed"));
|
|
13017
13022
|
const scrub = (err) => errorMessage(err).split(file.token).join("[redacted]");
|
|
13018
13023
|
let environment;
|
|
13019
13024
|
try {
|
|
13020
13025
|
environment = await ports.environmentName();
|
|
13021
13026
|
} catch (err) {
|
|
13022
|
-
rows.push(row$
|
|
13027
|
+
rows.push(row$30("agent-environment", "the agent Environment", "fail", `cannot name it: ${scrub(err)}`));
|
|
13023
13028
|
return finish();
|
|
13024
13029
|
}
|
|
13025
13030
|
let entries;
|
|
13026
13031
|
try {
|
|
13027
13032
|
entries = await ports.readEntries(environment, file.token);
|
|
13028
13033
|
} catch (err) {
|
|
13029
|
-
rows.push(row$
|
|
13034
|
+
rows.push(row$30("agent-environment", "the agent Environment", "fail", `could not read "${environment}": ${scrub(err)}`));
|
|
13030
13035
|
return finish();
|
|
13031
13036
|
}
|
|
13032
|
-
rows.push(row$
|
|
13037
|
+
rows.push(row$30("agent-environment", "the agent Environment", "ok", `"${environment}" is readable: ${entries.length} variable(s)`));
|
|
13033
13038
|
const others = ENVIRONMENT_LAYERS.filter((layer) => layer !== "agent");
|
|
13034
13039
|
const readable = [];
|
|
13035
13040
|
for (const layer of others) {
|
|
@@ -13039,20 +13044,20 @@ async function runDoctorAgent(input) {
|
|
|
13039
13044
|
readable.push(name);
|
|
13040
13045
|
} catch {}
|
|
13041
13046
|
}
|
|
13042
|
-
rows.push(readable.length > 0 ? row$
|
|
13047
|
+
rows.push(readable.length > 0 ? row$30("agent-narrow", "the Service Account reaches only the agent Environment", "fail", `it can read ${readable.length} other Environment(s): remove its access to them, or make a new Service Account`, readable.map((name) => `can read "${name}"`)) : row$30("agent-narrow", "the Service Account reaches only the agent Environment", "ok", `it cannot read ${others.join(", ")} (refused or not there)`));
|
|
13043
13048
|
let tokens;
|
|
13044
13049
|
try {
|
|
13045
13050
|
tokens = await ports.declaredTokens();
|
|
13046
13051
|
} catch (err) {
|
|
13047
|
-
rows.push(row$
|
|
13052
|
+
rows.push(row$30("agent-tokens", "the agent tokens", "skip", `could not read the plugins' declared tokens: ${scrub(err)}`));
|
|
13048
13053
|
return finish();
|
|
13049
13054
|
}
|
|
13050
13055
|
const expected = tokenExpectations(tokens, { layer: "agent" }).map((e) => e.envName);
|
|
13051
13056
|
const held = new Set(entries.filter((e) => e.value !== "").map((e) => e.name));
|
|
13052
13057
|
const missing = expected.filter((name) => !held.has(name));
|
|
13053
|
-
rows.push(missing.length > 0 ? row$
|
|
13058
|
+
rows.push(missing.length > 0 ? row$30("agent-tokens", "the agent tokens", "skip", `${missing.length} of ${expected.length} agent token(s) still to make`, instanceTokenGuide(missing, tokens, "agent").map(tokenProblem)) : row$30("agent-tokens", "the agent tokens", "ok", `all ${expected.length} declared agent token(s) are there`));
|
|
13054
13059
|
const others2 = entries.map((e) => e.name).filter((name) => !expected.includes(name));
|
|
13055
|
-
if (others2.length > 0) rows.push(row$
|
|
13060
|
+
if (others2.length > 0) rows.push(row$30("agent-extras", "other variables the agent is given", "skip", `info: ${others2.length} variable(s) the plugins do not declare for the agent layer: ${others2.join(", ")}`));
|
|
13056
13061
|
return finish();
|
|
13057
13062
|
}
|
|
13058
13063
|
// src/commands/doctor-agent/doctor-agent.command.ts
|
|
@@ -13331,8 +13336,8 @@ function shadowVerdict(runs, name) {
|
|
|
13331
13336
|
return newest.conclusion === "success" ? "success" : "failure";
|
|
13332
13337
|
}
|
|
13333
13338
|
// src/commands/doctor-ci/read-shadow-samples.ts
|
|
13334
|
-
/** The name Sentinel's shadow posts under
|
|
13335
|
-
const SHADOW_CHECK_NAME =
|
|
13339
|
+
/** The name Sentinel's shadow posts under: astromech's {@link AGGREGATE_SHADOW_CHECK_NAME}, which Sentinel's `SENTINEL_CI_AGGREGATE_SHADOW_NAME` also is. */
|
|
13340
|
+
const SHADOW_CHECK_NAME = AGGREGATE_SHADOW_CHECK_NAME;
|
|
13336
13341
|
/**
|
|
13337
13342
|
* The two aggregate verdicts of the newest pull requests, newest first: the open ones and the merged ones (a pull
|
|
13338
13343
|
* request closed without merging has no verdict worth comparing), at most `limit` of them. Each is read from the check
|
|
@@ -13906,7 +13911,7 @@ async function runDoctorDns(input) {
|
|
|
13906
13911
|
});
|
|
13907
13912
|
else if (!loader.has("dns")) {
|
|
13908
13913
|
const why = whyMissing(loader, "dns", "no `dns` provider to check them with");
|
|
13909
|
-
for (const zone of zones) rows.push(row$
|
|
13914
|
+
for (const zone of zones) rows.push(row$29(zone, "skip", why));
|
|
13910
13915
|
for (const { hostname } of domains) rows.push(domainRow(hostname, "skip", why));
|
|
13911
13916
|
} else {
|
|
13912
13917
|
const dns = loader.get("dns");
|
|
@@ -13928,7 +13933,7 @@ async function runDoctorDns(input) {
|
|
|
13928
13933
|
...status === "skip" ? { reason: [...new Set(rows.map((r) => r.detail))].join("; ") } : {}
|
|
13929
13934
|
};
|
|
13930
13935
|
}
|
|
13931
|
-
function row$
|
|
13936
|
+
function row$29(zone, status, detail, problems = []) {
|
|
13932
13937
|
return {
|
|
13933
13938
|
id: `dns-${zone}`,
|
|
13934
13939
|
title: `${zone} records exist`,
|
|
@@ -13957,7 +13962,7 @@ async function checkDomain(dns, deploy, project, hostname) {
|
|
|
13957
13962
|
return noToken !== void 0 ? domainRow(hostname, "skip", noToken) : domainRow(hostname, "fail", errorMessage(err));
|
|
13958
13963
|
}
|
|
13959
13964
|
}
|
|
13960
|
-
async function checkZone(dns, zone, wanted, rowOf = (...args) => row$
|
|
13965
|
+
async function checkZone(dns, zone, wanted, rowOf = (...args) => row$29(zone, ...args)) {
|
|
13961
13966
|
try {
|
|
13962
13967
|
const have = await dns.listRecords(zone);
|
|
13963
13968
|
const problems = declaredVsActual(new Map(wanted.map((w) => [keyOf(w), w])), new Map(have.map((h) => [keyOf(h), h])), {
|
|
@@ -14124,7 +14129,7 @@ function declaredProjects$1(layouts) {
|
|
|
14124
14129
|
return [...new Set(layouts.flatMap((layout) => layout.relay?.errors?.projects ?? []))];
|
|
14125
14130
|
}
|
|
14126
14131
|
// src/commands/doctor-errors/errors-rows.ts
|
|
14127
|
-
const row$
|
|
14132
|
+
const row$28 = (id, title, status, detail, problems = []) => ({
|
|
14128
14133
|
id,
|
|
14129
14134
|
title,
|
|
14130
14135
|
status,
|
|
@@ -14141,27 +14146,27 @@ function errorsRows(found, providerName) {
|
|
|
14141
14146
|
const orgSlug = found.org.slug;
|
|
14142
14147
|
if (!found.org.exists) {
|
|
14143
14148
|
const problem = `${providerName} has no organization named ${orgSlug}; check the \`org\` option of the \`errors\` provider`;
|
|
14144
|
-
const rows = [row$
|
|
14145
|
-
for (const project of found.projects) rows.push(row$
|
|
14149
|
+
const rows = [row$28("errors:org", "organization exists", "fail", `${orgSlug} not found`, [problem])];
|
|
14150
|
+
for (const project of found.projects) rows.push(row$28(`errors:project:${project.slug}`, `project ${project.slug} exists`, "skip", "not checked: no organization"));
|
|
14146
14151
|
return rows;
|
|
14147
14152
|
}
|
|
14148
|
-
const rows = [row$
|
|
14153
|
+
const rows = [row$28("errors:org", "organization exists", "ok", `${orgSlug} (${found.org.name ?? orgSlug})`)];
|
|
14149
14154
|
if (found.projects.length === 0) {
|
|
14150
|
-
rows.push(row$
|
|
14155
|
+
rows.push(row$28("errors:projects", "declared projects", "skip", "none declared: no `relay.errors.projects` in a layout"));
|
|
14151
14156
|
return rows;
|
|
14152
14157
|
}
|
|
14153
14158
|
for (const project of found.projects) {
|
|
14154
14159
|
const slug = project.slug;
|
|
14155
14160
|
if (!project.exists) {
|
|
14156
14161
|
const problem = `no project ${slug} in ${found.org.slug}; create it in ${providerName}`;
|
|
14157
|
-
rows.push(row$
|
|
14162
|
+
rows.push(row$28(`errors:project:${slug}`, `project ${slug} exists`, "fail", "not found", [problem]), row$28(`errors:dsn:${slug}`, `project ${slug} has a key`, "skip", "not checked: no project"), row$28(`errors:alerts:${slug}`, `project ${slug} has an alert rule`, "skip", "not checked: no project"));
|
|
14158
14163
|
continue;
|
|
14159
14164
|
}
|
|
14160
|
-
rows.push(row$
|
|
14161
|
-
rows.push(project.hasDsn ? row$
|
|
14162
|
-
if (project.alertRules === void 0) rows.push(row$
|
|
14163
|
-
else if (project.alertRules === 0) rows.push(row$
|
|
14164
|
-
else rows.push(row$
|
|
14165
|
+
rows.push(row$28(`errors:project:${slug}`, `project ${slug} exists`, "ok", slug));
|
|
14166
|
+
rows.push(project.hasDsn ? row$28(`errors:dsn:${slug}`, `project ${slug} has a key`, "ok", "a client key (DSN) exists") : row$28(`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}`]));
|
|
14167
|
+
if (project.alertRules === void 0) rows.push(row$28(`errors:alerts:${slug}`, `project ${slug} has an alert rule`, "skip", found.alertsUnreadable ? `could not read the alert rules: ${found.alertsUnreadable}` : "not read"));
|
|
14168
|
+
else if (project.alertRules === 0) rows.push(row$28(`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`]));
|
|
14169
|
+
else rows.push(row$28(`errors:alerts:${slug}`, `project ${slug} has an alert rule`, "ok", `${project.alertRules} enabled rule(s)`));
|
|
14165
14170
|
}
|
|
14166
14171
|
return rows;
|
|
14167
14172
|
}
|
|
@@ -14284,7 +14289,7 @@ function datasetTargets(config) {
|
|
|
14284
14289
|
* dataset, shared by every environment in it). Only a dataset the provider says is missing, or a token it refuses, fails;
|
|
14285
14290
|
* 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.
|
|
14286
14291
|
*/
|
|
14287
|
-
const row$
|
|
14292
|
+
const row$27 = (id, title, status, detail, problems = []) => ({
|
|
14288
14293
|
id,
|
|
14289
14294
|
title,
|
|
14290
14295
|
status,
|
|
@@ -14301,7 +14306,7 @@ async function runDoctorLogs(input) {
|
|
|
14301
14306
|
if (!loader.has("logs")) {
|
|
14302
14307
|
const failure = loader.loadFailures().find((f) => f.key === "logs");
|
|
14303
14308
|
const why = failure ? `\`${failure.provider}\` failed to load: ${describeError(failure.error)}` : "no `logs` provider is configured in holocron.config.ts";
|
|
14304
|
-
rows.push(row$
|
|
14309
|
+
rows.push(row$27("logs", "logs", "skip", why));
|
|
14305
14310
|
} else rows.push(...await checkLogs(loader.get("logs"), datasetTargets(input.loaded.resolved)));
|
|
14306
14311
|
printCheckRows(rows, print);
|
|
14307
14312
|
const summary = summariseChecks(rows);
|
|
@@ -14325,38 +14330,38 @@ async function checkLogs(logs, targets) {
|
|
|
14325
14330
|
for (const target of targets) {
|
|
14326
14331
|
const id = `logs:dataset:${target.id}`;
|
|
14327
14332
|
const title = `dataset for ${target.label}`;
|
|
14328
|
-
if (!target.name) rows.push(row$
|
|
14329
|
-
else if (!token.usable) rows.push(row$
|
|
14330
|
-
else if (!logs.readDataset) rows.push(row$
|
|
14333
|
+
if (!target.name) rows.push(row$27(id, title, "skip", `${target.variable} is not set here, so there is no name to look for`));
|
|
14334
|
+
else if (!token.usable) rows.push(row$27(id, title, "skip", `${target.name}: not checked, the token is not usable`));
|
|
14335
|
+
else if (!logs.readDataset) rows.push(row$27(id, title, "skip", `${logs.providerName} cannot read a dataset`));
|
|
14331
14336
|
else rows.push(...await checkDataset(logs, target, target.name, id, title));
|
|
14332
14337
|
}
|
|
14333
14338
|
const org = resolveValue$1(["AXIOM_ORG"], void 0, { prefix: PREFIX$1 });
|
|
14334
|
-
rows.push(org ? row$
|
|
14339
|
+
rows.push(org ? row$27("logs:org", "organization", "ok", `${PREFIX$1}_AXIOM_ORG (or AXIOM_ORG) is set`) : row$27("logs:org", "organization", "skip", `${PREFIX$1}_AXIOM_ORG (or AXIOM_ORG) is not set here; Sentinel's log links need it`));
|
|
14335
14340
|
return rows;
|
|
14336
14341
|
}
|
|
14337
14342
|
/** Whether the provider accepts the token. `usable` is false when it was refused or could not be tried. */
|
|
14338
14343
|
async function checkToken$1(logs, dataset) {
|
|
14339
14344
|
const title = "token is accepted";
|
|
14340
14345
|
if (!logs.checkToken) return {
|
|
14341
|
-
row: row$
|
|
14346
|
+
row: row$27("logs:token", title, "skip", `${logs.providerName} cannot check a token`),
|
|
14342
14347
|
usable: true
|
|
14343
14348
|
};
|
|
14344
14349
|
try {
|
|
14345
14350
|
const result = await logs.checkToken(dataset);
|
|
14346
14351
|
if (result.ok) return {
|
|
14347
|
-
row: row$
|
|
14352
|
+
row: row$27("logs:token", title, "ok", `${logs.providerName} accepts the token`),
|
|
14348
14353
|
usable: true
|
|
14349
14354
|
};
|
|
14350
14355
|
const reason = result.reason ?? `${logs.providerName} refused the token`;
|
|
14351
14356
|
return {
|
|
14352
|
-
row: row$
|
|
14357
|
+
row: row$27("logs:token", title, "fail", reason, [reason]),
|
|
14353
14358
|
usable: false
|
|
14354
14359
|
};
|
|
14355
14360
|
} catch (err) {
|
|
14356
14361
|
const noToken = missingTokenReason(err);
|
|
14357
14362
|
const detail = noToken ?? `could not check the token: ${describeError(err)}`;
|
|
14358
14363
|
return {
|
|
14359
|
-
row: row$
|
|
14364
|
+
row: row$27("logs:token", title, "skip", detail),
|
|
14360
14365
|
usable: noToken === void 0
|
|
14361
14366
|
};
|
|
14362
14367
|
}
|
|
@@ -14366,17 +14371,17 @@ async function checkDataset(logs, target, name, id, title) {
|
|
|
14366
14371
|
const found = await logs.readDataset(name);
|
|
14367
14372
|
if (found.forbidden) {
|
|
14368
14373
|
const why = `${name}: not visible to this token (${logs.providerName} refused the read; it may also not exist)`;
|
|
14369
|
-
return [row$
|
|
14374
|
+
return [row$27(id, title, "skip", why)];
|
|
14370
14375
|
}
|
|
14371
14376
|
if (!found.exists) {
|
|
14372
14377
|
const problem = `dataset ${name} does not exist (${target.variable}); ${target.fix}`;
|
|
14373
|
-
return [row$
|
|
14378
|
+
return [row$27(id, title, "fail", `${name} does not exist`, [problem])];
|
|
14374
14379
|
}
|
|
14375
14380
|
const retention = found.retentionDays === void 0 ? `retention: ${logs.providerName} did not report one for ${name}` : `retention: ${found.retentionDays} days for ${name}`;
|
|
14376
|
-
return [row$
|
|
14381
|
+
return [row$27(id, title, "ok", `${name} exists`), row$27(`logs:retention:${target.id}`, `retention of ${name}`, "skip", `info: ${retention}; one setting shared by every environment in the dataset (ADR-0019)`)];
|
|
14377
14382
|
} catch (err) {
|
|
14378
14383
|
const detail = missingTokenReason(err) ?? `could not read ${name}: ${describeError(err)}`;
|
|
14379
|
-
return [row$
|
|
14384
|
+
return [row$27(id, title, "skip", detail)];
|
|
14380
14385
|
}
|
|
14381
14386
|
}
|
|
14382
14387
|
// src/commands/doctor-logs/doctor-logs.command.ts
|
|
@@ -17966,7 +17971,7 @@ const info = (id, title, noun, extras) => ({
|
|
|
17966
17971
|
detail: `info: ${extras.length} ${noun} not in the template (never deleted)`,
|
|
17967
17972
|
problems: extras
|
|
17968
17973
|
});
|
|
17969
|
-
const row$
|
|
17974
|
+
const row$26 = (id, title, problems, ok) => ({
|
|
17970
17975
|
id,
|
|
17971
17976
|
title,
|
|
17972
17977
|
status: problems.length > 0 ? "fail" : "ok",
|
|
@@ -18002,19 +18007,19 @@ function viewProblems(want, found) {
|
|
|
18002
18007
|
function boardRows(boardName, template, state) {
|
|
18003
18008
|
const id = `project:${boardName}`;
|
|
18004
18009
|
const rows = [];
|
|
18005
|
-
rows.push(row$
|
|
18010
|
+
rows.push(row$26(`${id}:statuses`, `${boardName}: statuses`, listProblems("status", "statuses", template.statuses.map((s) => s.name), state.statuses), `${template.statuses.length} in order`));
|
|
18006
18011
|
const extraStatuses = state.statuses.filter((s) => !template.statuses.some((t) => t.name === s));
|
|
18007
18012
|
if (extraStatuses.length > 0) rows.push(info(`${id}:extra-statuses`, `${boardName}: extra statuses`, "status(es)", extraStatuses));
|
|
18008
|
-
for (const want of template.fields) rows.push(row$
|
|
18013
|
+
for (const want of template.fields) rows.push(row$26(`${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));
|
|
18009
18014
|
const extraFields = state.fields.filter((f) => !template.fields.some((t) => t.name === f.name));
|
|
18010
18015
|
if (extraFields.length > 0) rows.push(info(`${id}:extra-fields`, `${boardName}: extra fields`, "field(s)", extraFields.map((f) => f.name)));
|
|
18011
|
-
for (const want of template.views) rows.push(row$
|
|
18016
|
+
for (const want of template.views) rows.push(row$26(`${id}:view:${want.name}`, `${boardName}: view ${want.name}`, viewProblems(want, state.views.find((v) => v.name === want.name)), `${want.layout}${want.filter ? `, ${want.filter}` : ""}`));
|
|
18012
18017
|
const extraViews = state.views.filter((v) => !template.views.some((t) => t.name === v.name));
|
|
18013
18018
|
if (extraViews.length > 0) rows.push(info(`${id}:extra-views`, `${boardName}: extra views`, "view(s)", extraViews.map((v) => v.name)));
|
|
18014
18019
|
for (const name of template.rules ?? []) {
|
|
18015
18020
|
const found = state.rules.find((r) => r.name === name);
|
|
18016
18021
|
const problems = !found ? [`missing rule ${name}`] : found.enabled ? [] : [`rule ${name} is off`];
|
|
18017
|
-
rows.push(row$
|
|
18022
|
+
rows.push(row$26(`${id}:rule:${name}`, `${boardName}: rule ${name}`, problems, "on"));
|
|
18018
18023
|
}
|
|
18019
18024
|
return rows;
|
|
18020
18025
|
}
|
|
@@ -18074,7 +18079,7 @@ function itemRows(boardName, items) {
|
|
|
18074
18079
|
* never fail the run. A template file that does not read is a failure naming the file. `--post [channel]` shares the
|
|
18075
18080
|
* failing rows through the `notifications` provider's bot, like `doctor notifications --post`.
|
|
18076
18081
|
*/
|
|
18077
|
-
const row$
|
|
18082
|
+
const row$25 = (id, title, status, detail, problems = []) => ({
|
|
18078
18083
|
id,
|
|
18079
18084
|
title,
|
|
18080
18085
|
status,
|
|
@@ -18128,14 +18133,14 @@ async function checkBoards(input, loader) {
|
|
|
18128
18133
|
loader,
|
|
18129
18134
|
...input.io ? { io: input.io } : {}
|
|
18130
18135
|
});
|
|
18131
|
-
if (!opened.ok) return [row$
|
|
18136
|
+
if (!opened.ok) return [row$25("project", "project", opened.kind, opened.reason, opened.problems)];
|
|
18132
18137
|
const { projects, owner, boards, templates, templateProblems } = opened.context;
|
|
18133
18138
|
const rows = templateProblems.map((problem) => {
|
|
18134
18139
|
/* v8 ignore next -- split always returns at least one element; the fallback only satisfies noUncheckedIndexedAccess */
|
|
18135
18140
|
const file = problem.split(": ")[0] ?? problem;
|
|
18136
|
-
return row$
|
|
18141
|
+
return row$25(`project:template:${file}`, `template file ${file}`, "fail", problem);
|
|
18137
18142
|
});
|
|
18138
|
-
if (boards.length === 0) return [...rows, row$
|
|
18143
|
+
if (boards.length === 0) return [...rows, row$25("project", "project", "skip", "no boards are declared in `providers.projects.boards`")];
|
|
18139
18144
|
for (const declared of boards) {
|
|
18140
18145
|
const template = templates[declared.template];
|
|
18141
18146
|
const title = `${declared.name}: board exists and is open`;
|
|
@@ -18143,18 +18148,18 @@ async function checkBoards(input, loader) {
|
|
|
18143
18148
|
const board = await projects.find(owner, declared.name);
|
|
18144
18149
|
if (!board) {
|
|
18145
18150
|
const closed = (await projects.list(owner)).some((b) => b.name === declared.name && b.closed);
|
|
18146
|
-
rows.push(row$
|
|
18151
|
+
rows.push(row$25(`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`"]));
|
|
18147
18152
|
continue;
|
|
18148
18153
|
}
|
|
18149
|
-
rows.push(row$
|
|
18154
|
+
rows.push(row$25(`project:${declared.name}`, title, "ok", board.url));
|
|
18150
18155
|
if (!template) {
|
|
18151
|
-
rows.push(row$
|
|
18156
|
+
rows.push(row$25(`project:${declared.name}:template`, `${declared.name}: template ${declared.template}`, "fail", "no built-in or file template has this name"));
|
|
18152
18157
|
continue;
|
|
18153
18158
|
}
|
|
18154
18159
|
rows.push(...boardRows(declared.name, template, await projects.read(owner, board)));
|
|
18155
|
-
rows.push(...projects.items ? itemRows(declared.name, await projects.items(owner, board, template)) : [row$
|
|
18160
|
+
rows.push(...projects.items ? itemRows(declared.name, await projects.items(owner, board, template)) : [row$25(`project:${declared.name}:items`, `${declared.name}: items`, "skip", "the provider cannot list a board's items")]);
|
|
18156
18161
|
} catch (err) {
|
|
18157
|
-
rows.push(row$
|
|
18162
|
+
rows.push(row$25(`project:${declared.name}`, title, "fail", describeError(err)));
|
|
18158
18163
|
}
|
|
18159
18164
|
}
|
|
18160
18165
|
return rows;
|
|
@@ -19193,19 +19198,19 @@ async function runDoctorRepo(input) {
|
|
|
19193
19198
|
const rows = [];
|
|
19194
19199
|
if (!loader.has("source")) {
|
|
19195
19200
|
const why = whyMissing(loader, "source", "no `source` provider to read the repository with");
|
|
19196
|
-
for (const check of checks) rows.push(row$
|
|
19201
|
+
for (const check of checks) rows.push(row$24(check, { skip: why }));
|
|
19197
19202
|
} else {
|
|
19198
19203
|
const source = loader.get("source");
|
|
19199
19204
|
for (const check of checks) {
|
|
19200
19205
|
if (typeof source[check.needs] !== "function") {
|
|
19201
|
-
rows.push(row$
|
|
19206
|
+
rows.push(row$24(check, { skip: `provider does not implement ${check.needs}` }));
|
|
19202
19207
|
continue;
|
|
19203
19208
|
}
|
|
19204
19209
|
try {
|
|
19205
|
-
rows.push(row$
|
|
19210
|
+
rows.push(row$24(check, await check.run(source)));
|
|
19206
19211
|
} catch (err) {
|
|
19207
19212
|
const noToken = missingTokenReason(err);
|
|
19208
|
-
if (noToken !== void 0) rows.push(row$
|
|
19213
|
+
if (noToken !== void 0) rows.push(row$24(check, { skip: noToken }));
|
|
19209
19214
|
else rows.push({
|
|
19210
19215
|
id: check.id,
|
|
19211
19216
|
title: check.title,
|
|
@@ -19232,7 +19237,7 @@ async function runDoctorRepo(input) {
|
|
|
19232
19237
|
...status === "skip" ? { reason: rows.map((r) => r.detail).join("; ") } : {}
|
|
19233
19238
|
};
|
|
19234
19239
|
}
|
|
19235
|
-
function row$
|
|
19240
|
+
function row$24(check, result) {
|
|
19236
19241
|
const { id, title } = check;
|
|
19237
19242
|
if ("skip" in result) return {
|
|
19238
19243
|
id,
|
|
@@ -19761,7 +19766,7 @@ function providerGroup(providerName) {
|
|
|
19761
19766
|
}
|
|
19762
19767
|
// src/commands/doctor-secrets/credentials-rows.ts
|
|
19763
19768
|
/** A row for the provider as a whole, or for one of its variables when `name` is given. */
|
|
19764
|
-
function row$
|
|
19769
|
+
function row$23(provider, status, detail, name) {
|
|
19765
19770
|
return name === void 0 ? {
|
|
19766
19771
|
id: provider,
|
|
19767
19772
|
title: provider,
|
|
@@ -19786,10 +19791,10 @@ async function credentialsRows(input) {
|
|
|
19786
19791
|
const { loader } = input;
|
|
19787
19792
|
const { resolved } = input.loaded;
|
|
19788
19793
|
if (!resolved.providers.credentials) return {
|
|
19789
|
-
rows: input.asked ? [row$
|
|
19794
|
+
rows: input.asked ? [row$23("credentials", "skip", "no `credentials` provider is configured")] : [],
|
|
19790
19795
|
places: []
|
|
19791
19796
|
};
|
|
19792
|
-
const rows = loader.loadFailures().filter((f) => f.key === "credentials").map((f) => row$
|
|
19797
|
+
const rows = loader.loadFailures().filter((f) => f.key === "credentials").map((f) => row$23(f.provider, "fail", `failed to load: ${errorMessage(f.error)}`));
|
|
19793
19798
|
const places = [];
|
|
19794
19799
|
if (!loader.has("credentials")) return {
|
|
19795
19800
|
rows,
|
|
@@ -19801,7 +19806,7 @@ async function credentialsRows(input) {
|
|
|
19801
19806
|
const tuple = tuples.find((t) => t.provider === impl.providerName);
|
|
19802
19807
|
const explicit = tuple && credentialsEnvironment(tuple, resolved);
|
|
19803
19808
|
if (!explicit && !derivesEnvironment(impl.providerName)) {
|
|
19804
|
-
rows.push(row$
|
|
19809
|
+
rows.push(row$23(impl.providerName, "skip", "no `environment` option and `credentials.environment` is not set"));
|
|
19805
19810
|
continue;
|
|
19806
19811
|
}
|
|
19807
19812
|
try {
|
|
@@ -19813,7 +19818,7 @@ async function credentialsRows(input) {
|
|
|
19813
19818
|
rows.push(...checked.rows);
|
|
19814
19819
|
places.push(...checked.places);
|
|
19815
19820
|
} catch (err) {
|
|
19816
|
-
rows.push(row$
|
|
19821
|
+
rows.push(row$23(impl.providerName, "fail", errorMessage(err)));
|
|
19817
19822
|
}
|
|
19818
19823
|
}
|
|
19819
19824
|
return {
|
|
@@ -19829,17 +19834,17 @@ async function credentialsRows(input) {
|
|
|
19829
19834
|
async function checkProvider(impl, candidates, expected, synced) {
|
|
19830
19835
|
const provider = impl.providerName;
|
|
19831
19836
|
if (!impl.inspect) return {
|
|
19832
|
-
rows: [row$
|
|
19837
|
+
rows: [row$23(provider, "skip", "cannot list the variables without reading their values")],
|
|
19833
19838
|
places: []
|
|
19834
19839
|
};
|
|
19835
19840
|
if (expected.length === 0) return {
|
|
19836
|
-
rows: [row$
|
|
19841
|
+
rows: [row$23(provider, "skip", "no configured plugin lists the tokens it takes")],
|
|
19837
19842
|
places: []
|
|
19838
19843
|
};
|
|
19839
19844
|
const inspect = impl.inspect.bind(impl);
|
|
19840
19845
|
try {
|
|
19841
19846
|
const { found, missing } = await tryEnvironments(candidates, inspect);
|
|
19842
|
-
const rows = missing.map((name) => row$
|
|
19847
|
+
const rows = missing.map((name) => row$23(provider, "fail", `${provider} has no Environment named "${name}"`));
|
|
19843
19848
|
const group = providerGroup(provider);
|
|
19844
19849
|
const unreadPlaces = missing.map((name) => ({
|
|
19845
19850
|
column: {
|
|
@@ -19862,9 +19867,9 @@ async function checkProvider(impl, candidates, expected, synced) {
|
|
|
19862
19867
|
const have = (name) => found.some((f) => f.result.names.includes(name));
|
|
19863
19868
|
let present = 0;
|
|
19864
19869
|
for (const { name, optional } of expected) if (have(name)) present++;
|
|
19865
|
-
else if (optional) rows.push(row$
|
|
19866
|
-
else rows.push(row$
|
|
19867
|
-
if (present > 0) rows.push(row$
|
|
19870
|
+
else if (optional) rows.push(row$23(provider, "skip", `optional, not set in ${where}`, name));
|
|
19871
|
+
else rows.push(row$23(provider, "fail", `missing from ${where}`, name));
|
|
19872
|
+
if (present > 0) rows.push(row$23(provider, "ok", `${present} of ${expected.length} tokens present in ${where}`, "tokens"));
|
|
19868
19873
|
const names = new Set(expected.map((e) => e.name));
|
|
19869
19874
|
const places = [];
|
|
19870
19875
|
const missingRequired = expected.filter((e) => !e.optional && !have(e.name)).map((e) => e.name);
|
|
@@ -19903,7 +19908,7 @@ async function checkProvider(impl, candidates, expected, synced) {
|
|
|
19903
19908
|
};
|
|
19904
19909
|
} catch (err) {
|
|
19905
19910
|
return {
|
|
19906
|
-
rows: [row$
|
|
19911
|
+
rows: [row$23(provider, "fail", errorMessage(err))],
|
|
19907
19912
|
places: []
|
|
19908
19913
|
};
|
|
19909
19914
|
}
|
|
@@ -20145,8 +20150,9 @@ async function matrixPlaces(input) {
|
|
|
20145
20150
|
const syncEntries = config.repo?.secrets?.sync ?? [];
|
|
20146
20151
|
const deployEntries = config.repo?.secrets?.deploy ?? [];
|
|
20147
20152
|
const variableEntries = config.repo?.variables?.sync ?? [];
|
|
20153
|
+
const feeders = [...deployEntries, ...input.workspaceDeploy ?? []];
|
|
20148
20154
|
const sentTo = (environment, present) => {
|
|
20149
|
-
const filter = deployFilter(
|
|
20155
|
+
const filter = deployFilter(feeders, environment);
|
|
20150
20156
|
return filter ? splitDeployKeys(present, filter).send : [];
|
|
20151
20157
|
};
|
|
20152
20158
|
const names = /* @__PURE__ */ new Map();
|
|
@@ -20231,7 +20237,7 @@ async function matrixPlaces(input) {
|
|
|
20231
20237
|
environment
|
|
20232
20238
|
});
|
|
20233
20239
|
}
|
|
20234
|
-
for (const entry of
|
|
20240
|
+
for (const entry of feeders) {
|
|
20235
20241
|
const environment = resolvedEnvironment(entry);
|
|
20236
20242
|
envs.set(`secret:${environment}`, {
|
|
20237
20243
|
kind: "secret",
|
|
@@ -20306,6 +20312,64 @@ async function matrixPlaces(input) {
|
|
|
20306
20312
|
}
|
|
20307
20313
|
return places;
|
|
20308
20314
|
}
|
|
20315
|
+
// src/commands/doctor-secrets/matrix-headings.ts
|
|
20316
|
+
const SHORT_GROUPS = {
|
|
20317
|
+
"1Password": "1P",
|
|
20318
|
+
GitHub: "GH"
|
|
20319
|
+
};
|
|
20320
|
+
const ENV_PREFIX = "env ";
|
|
20321
|
+
/**
|
|
20322
|
+
* A column's full heading: its group and its label, such as `GitHub env sentinel-production`.
|
|
20323
|
+
*
|
|
20324
|
+
* @param column - The column.
|
|
20325
|
+
*/
|
|
20326
|
+
function fullHeading(column) {
|
|
20327
|
+
return `${column.group} ${column.label}`;
|
|
20328
|
+
}
|
|
20329
|
+
function isEnvironment(column) {
|
|
20330
|
+
return column.group === "GitHub" && column.label.startsWith(ENV_PREFIX);
|
|
20331
|
+
}
|
|
20332
|
+
function shortHeading(column) {
|
|
20333
|
+
if (isEnvironment(column)) return column.label.slice(4);
|
|
20334
|
+
return `${SHORT_GROUPS[column.group] ?? column.group} ${column.label}`;
|
|
20335
|
+
}
|
|
20336
|
+
/**
|
|
20337
|
+
* The short headings of a block's columns, with the legend lines that define every abbreviation or bare name used:
|
|
20338
|
+
* `1Password` is `1P`, `GitHub` is `GH`, and a GitHub environment's column is headed by the environment's name alone.
|
|
20339
|
+
* Any other group keeps its full heading. Returns nothing when two short headings would be the same, because a heading
|
|
20340
|
+
* must name exactly one place.
|
|
20341
|
+
*
|
|
20342
|
+
* @param columns - The block's columns.
|
|
20343
|
+
*/
|
|
20344
|
+
function shortHeadings(columns) {
|
|
20345
|
+
const headings = columns.map(shortHeading);
|
|
20346
|
+
if (new Set(headings).size !== headings.length) return void 0;
|
|
20347
|
+
const legend = /* @__PURE__ */ new Set();
|
|
20348
|
+
for (const column of columns) if (isEnvironment(column)) legend.add(`${shortHeading(column)} GitHub environment ${shortHeading(column)}`);
|
|
20349
|
+
else if (column.group in SHORT_GROUPS) legend.add(`${SHORT_GROUPS[column.group]} ${column.group}`);
|
|
20350
|
+
return {
|
|
20351
|
+
headings,
|
|
20352
|
+
legend: [...legend]
|
|
20353
|
+
};
|
|
20354
|
+
}
|
|
20355
|
+
// src/commands/doctor-secrets/matrix-trim.ts
|
|
20356
|
+
/**
|
|
20357
|
+
* Leaves out of one block what says nothing: a place column whose every cell is `n/a` and a row whose every cell is
|
|
20358
|
+
* `n/a`. Nothing is hidden that a failing or `extra` cell could show, because only `n/a` is left out.
|
|
20359
|
+
*
|
|
20360
|
+
* @param rows - The block's rows.
|
|
20361
|
+
* @param columns - The block's columns.
|
|
20362
|
+
*/
|
|
20363
|
+
function trimBlock(rows, columns) {
|
|
20364
|
+
const keptColumns = columns.filter((column) => rows.some((row) => row.cells[column.id] !== "n/a"));
|
|
20365
|
+
const keptRows = rows.filter((row) => columns.some((column) => row.cells[column.id] !== "n/a"));
|
|
20366
|
+
return {
|
|
20367
|
+
rows: keptRows,
|
|
20368
|
+
columns: keptColumns,
|
|
20369
|
+
leftOutNames: rows.length - keptRows.length,
|
|
20370
|
+
leftOutColumns: columns.filter((column) => !keptColumns.includes(column))
|
|
20371
|
+
};
|
|
20372
|
+
}
|
|
20309
20373
|
// src/commands/doctor-secrets/matrix-render.ts
|
|
20310
20374
|
/** What each cell word means. Printed under the matrix every time, one meaning per line. */
|
|
20311
20375
|
const MATRIX_LEGEND = [
|
|
@@ -20315,30 +20379,80 @@ const MATRIX_LEGEND = [
|
|
|
20315
20379
|
"extra found here, but nothing feeds it",
|
|
20316
20380
|
"? could not read this place"
|
|
20317
20381
|
];
|
|
20318
|
-
const heading = (column) => `${column.group} ${column.label}`;
|
|
20319
20382
|
function pad(text, width) {
|
|
20320
20383
|
return text + " ".repeat(Math.max(0, width - text.length));
|
|
20321
20384
|
}
|
|
20322
|
-
/** The block as a table: one line per name, one column per place
|
|
20323
|
-
function table(name, rows, columns) {
|
|
20385
|
+
/** The block as a table: one line per name, one column per place, headed by `headings`. */
|
|
20386
|
+
function table(name, rows, columns, headings) {
|
|
20324
20387
|
const nameWidth = Math.max(name.length, ...rows.map((row) => row.name.length));
|
|
20325
|
-
const widths = columns.map((column) => Math.max(
|
|
20388
|
+
const widths = columns.map((column, i) => Math.max(headings[i].length, ...rows.map((row) => row.cells[column.id].length)));
|
|
20326
20389
|
const line = (first, cells) => [pad(first, nameWidth), ...cells.map((cell, i) => pad(cell, widths[i]))].join(" ").trimEnd();
|
|
20327
|
-
return [line(name,
|
|
20390
|
+
return [line(name, headings), ...rows.map((row) => line(row.name, columns.map((column) => row.cells[column.id])))];
|
|
20328
20391
|
}
|
|
20329
20392
|
/** The block turned on its side: one short paragraph per name, for a terminal too narrow for the table. */
|
|
20330
20393
|
function stacked(rows, columns) {
|
|
20331
|
-
return rows.flatMap((row) => [row.name, ...columns.map((column) => ` ${
|
|
20394
|
+
return rows.flatMap((row) => [row.name, ...columns.map((column) => ` ${fullHeading(column)}: ${row.cells[column.id]}`)]);
|
|
20395
|
+
}
|
|
20396
|
+
const widest = (lines) => Math.max(...lines.map((l) => l.length));
|
|
20397
|
+
/** The closing line of a block that left rows or columns out, saying how to find them again. */
|
|
20398
|
+
function leftOutLine(trimmed) {
|
|
20399
|
+
const parts = [];
|
|
20400
|
+
if (trimmed.leftOutNames > 0) parts.push(`${trimmed.leftOutNames} ${trimmed.leftOutNames === 1 ? "name" : "names"}`);
|
|
20401
|
+
if (trimmed.leftOutColumns.length > 0) parts.push(`${trimmed.leftOutColumns.length === 1 ? "1 place" : `${trimmed.leftOutColumns.length} places`} (${trimmed.leftOutColumns.map(fullHeading).join(", ")})`);
|
|
20402
|
+
return ` (left out, n/a everywhere: ${parts.join(" and ")}; --name <name> says how each place stands)`;
|
|
20332
20403
|
}
|
|
20333
|
-
|
|
20334
|
-
|
|
20335
|
-
|
|
20336
|
-
|
|
20404
|
+
/**
|
|
20405
|
+
* One block: the full-heading table when it fits, else the table with short headings (whose legend lines come back for
|
|
20406
|
+
* the legend), else the block on its side.
|
|
20407
|
+
*/
|
|
20408
|
+
function block(title, noun, allRows, allColumns, width) {
|
|
20409
|
+
if (allRows.length === 0) return {
|
|
20410
|
+
lines: [title, ` (no ${noun} declared or found)`],
|
|
20411
|
+
legend: []
|
|
20412
|
+
};
|
|
20413
|
+
const trimmed = trimBlock(allRows, allColumns);
|
|
20414
|
+
const { rows, columns } = trimmed;
|
|
20415
|
+
const closing = trimmed.leftOutNames + trimmed.leftOutColumns.length > 0 ? [leftOutLine(trimmed)] : [];
|
|
20416
|
+
if (rows.length === 0) return {
|
|
20417
|
+
lines: [title, ...closing],
|
|
20418
|
+
legend: []
|
|
20419
|
+
};
|
|
20420
|
+
const full = table("name", rows, columns, columns.map(fullHeading));
|
|
20421
|
+
if (widest(full) <= width) return {
|
|
20422
|
+
lines: [
|
|
20423
|
+
title,
|
|
20424
|
+
...full,
|
|
20425
|
+
...closing
|
|
20426
|
+
],
|
|
20427
|
+
legend: []
|
|
20428
|
+
};
|
|
20429
|
+
const short = shortHeadings(columns);
|
|
20430
|
+
if (short !== void 0) {
|
|
20431
|
+
const compact = table("name", rows, columns, short.headings);
|
|
20432
|
+
if (widest(compact) <= width) return {
|
|
20433
|
+
lines: [
|
|
20434
|
+
title,
|
|
20435
|
+
...compact,
|
|
20436
|
+
...closing
|
|
20437
|
+
],
|
|
20438
|
+
legend: short.legend
|
|
20439
|
+
};
|
|
20440
|
+
}
|
|
20441
|
+
return {
|
|
20442
|
+
lines: [
|
|
20443
|
+
title,
|
|
20444
|
+
...stacked(rows, columns),
|
|
20445
|
+
...closing
|
|
20446
|
+
],
|
|
20447
|
+
legend: []
|
|
20448
|
+
};
|
|
20337
20449
|
}
|
|
20338
20450
|
/**
|
|
20339
20451
|
* Lays the matrix out as text: a heading and a block for the secrets, the same for the variables, then the legend.
|
|
20340
20452
|
* The cells are words, not symbols or colour, so a pipe or a log reads the same. When the table would pass `width`
|
|
20341
|
-
* columns
|
|
20453
|
+
* columns the headings are shortened (the legend then defines them), and when it still does not fit it is turned on its
|
|
20454
|
+
* side (one paragraph per name) instead of wrapping mid-row. Rows and columns that are `n/a` everywhere are left out
|
|
20455
|
+
* and counted in a closing line.
|
|
20342
20456
|
*
|
|
20343
20457
|
* @param matrix - The matrix.
|
|
20344
20458
|
* @param width - The terminal's width in columns.
|
|
@@ -20346,9 +20460,20 @@ function block(title, noun, rows, columns, width) {
|
|
|
20346
20460
|
*/
|
|
20347
20461
|
function renderMatrix(matrix, width, only) {
|
|
20348
20462
|
const out = [];
|
|
20349
|
-
|
|
20350
|
-
if (only !== "
|
|
20463
|
+
const legend = [];
|
|
20464
|
+
if (only !== "variables") {
|
|
20465
|
+
const secrets = block("Secrets", "secrets", matrix.secrets, matrix.columns.secret, width);
|
|
20466
|
+
out.push(...secrets.lines, "");
|
|
20467
|
+
legend.push(...secrets.legend);
|
|
20468
|
+
}
|
|
20469
|
+
if (only !== "secrets") {
|
|
20470
|
+
const variables = block("Variables", "variables", matrix.variables, matrix.columns.variable, width);
|
|
20471
|
+
out.push(...variables.lines, "");
|
|
20472
|
+
legend.push(...variables.legend);
|
|
20473
|
+
}
|
|
20351
20474
|
out.push("Legend", ...MATRIX_LEGEND.map((line) => ` ${line}`));
|
|
20475
|
+
const headings = [...new Set(legend)];
|
|
20476
|
+
if (headings.length > 0) out.push("", "Headings", ...headings.map((line) => ` ${line}`));
|
|
20352
20477
|
return out;
|
|
20353
20478
|
}
|
|
20354
20479
|
// src/commands/doctor-secrets/matrix-rows.ts
|
|
@@ -20793,7 +20918,7 @@ async function variableRows(loader, config, org) {
|
|
|
20793
20918
|
if (!loader.has("source")) {
|
|
20794
20919
|
const why = whyMissing(loader, "source", "no `source` provider to read them with");
|
|
20795
20920
|
for (const check of checks) {
|
|
20796
|
-
rows.push(row$
|
|
20921
|
+
rows.push(row$22(check, { skip: why }));
|
|
20797
20922
|
observations.push({
|
|
20798
20923
|
scope: check.scope,
|
|
20799
20924
|
unread: why
|
|
@@ -20803,7 +20928,7 @@ async function variableRows(loader, config, org) {
|
|
|
20803
20928
|
const source = loader.get("source");
|
|
20804
20929
|
for (const check of checks) try {
|
|
20805
20930
|
const result = await check.run(source);
|
|
20806
|
-
rows.push(row$
|
|
20931
|
+
rows.push(row$22(check, result));
|
|
20807
20932
|
observations.push("skip" in result ? {
|
|
20808
20933
|
scope: check.scope,
|
|
20809
20934
|
unread: result.skip
|
|
@@ -20814,7 +20939,7 @@ async function variableRows(loader, config, org) {
|
|
|
20814
20939
|
} catch (err) {
|
|
20815
20940
|
const noToken = missingTokenReason(err);
|
|
20816
20941
|
if (noToken !== void 0) {
|
|
20817
|
-
rows.push(row$
|
|
20942
|
+
rows.push(row$22(check, { skip: noToken }));
|
|
20818
20943
|
observations.push({
|
|
20819
20944
|
scope: check.scope,
|
|
20820
20945
|
unread: noToken
|
|
@@ -20840,7 +20965,7 @@ async function variableRows(loader, config, org) {
|
|
|
20840
20965
|
observations
|
|
20841
20966
|
};
|
|
20842
20967
|
}
|
|
20843
|
-
function row$
|
|
20968
|
+
function row$22(check, result) {
|
|
20844
20969
|
const { id, title } = check;
|
|
20845
20970
|
if ("skip" in result) return {
|
|
20846
20971
|
id,
|
|
@@ -20930,7 +21055,7 @@ function describeExpiry(expiresAt, now) {
|
|
|
20930
21055
|
*
|
|
20931
21056
|
* What a token may do is not checked: GitHub does not return a fine-grained token's permissions.
|
|
20932
21057
|
*/
|
|
20933
|
-
function row$
|
|
21058
|
+
function row$21(id, status, detail) {
|
|
20934
21059
|
return {
|
|
20935
21060
|
id: `verify:${id}`,
|
|
20936
21061
|
title: `verify ${id}`,
|
|
@@ -20958,12 +21083,12 @@ async function verifyRows(input) {
|
|
|
20958
21083
|
try {
|
|
20959
21084
|
module = await importer(pkg);
|
|
20960
21085
|
} catch (err) {
|
|
20961
|
-
rows.push(row$
|
|
21086
|
+
rows.push(row$21(pkg, "skip", `cannot load the plugin: ${errorMessage(err)}`));
|
|
20962
21087
|
continue;
|
|
20963
21088
|
}
|
|
20964
21089
|
for (const token of module.tokens ?? []) rows.push(await checkToken(token, module, env, readToken, now()));
|
|
20965
21090
|
}
|
|
20966
|
-
if (rows.length === 0) rows.push(row$
|
|
21091
|
+
if (rows.length === 0) rows.push(row$21("tokens", "skip", "no configured plugin lists the tokens it takes"));
|
|
20967
21092
|
return rows;
|
|
20968
21093
|
}
|
|
20969
21094
|
/**
|
|
@@ -20976,32 +21101,56 @@ async function loadCredentials(input) {
|
|
|
20976
21101
|
try {
|
|
20977
21102
|
await input.loader.load();
|
|
20978
21103
|
} catch (err) {
|
|
20979
|
-
return [row$
|
|
21104
|
+
return [row$21("credentials", "skip", `could not load the credentials providers: ${errorMessage(err)}`)];
|
|
20980
21105
|
}
|
|
20981
|
-
return input.loader.loadFailures().filter((failure) => failure.key === "credentials").map((failure) => row$
|
|
21106
|
+
return input.loader.loadFailures().filter((failure) => failure.key === "credentials").map((failure) => row$21(`credentials ${failure.provider}`, "fail", `could not be read: ${errorMessage(failure.error)}`));
|
|
20982
21107
|
}
|
|
20983
21108
|
async function checkToken(token, module, env, readToken, now) {
|
|
20984
21109
|
const { keyringKey, envName, vendorEnvName } = token;
|
|
20985
21110
|
const fromEnv = env.get(envName) ? envName : vendorEnvName && env.get(vendorEnvName) ? vendorEnvName : void 0;
|
|
20986
21111
|
const stored = fromEnv ? void 0 : findCredential(...vendorEnvName ? [envName, vendorEnvName] : [envName]);
|
|
20987
21112
|
const value = fromEnv ? env.get(fromEnv) : stored?.value ?? readToken(keyringKey);
|
|
20988
|
-
if (!value) return row$
|
|
21113
|
+
if (!value) return row$21(keyringKey, "skip", `not set (${vendorEnvName ? `${envName} / ${vendorEnvName}` : envName}, or \`holocron new token ${keyringKey}\`)`);
|
|
20989
21114
|
const verify = token.verify ?? (token.verifiable === false ? void 0 : module.verifyToken);
|
|
20990
|
-
if (!verify) return row$
|
|
21115
|
+
if (!verify) return row$21(keyringKey, "skip", "set, but its plugin cannot verify it");
|
|
20991
21116
|
const from = fromEnv ?? stored?.source ?? "keyring";
|
|
20992
21117
|
try {
|
|
20993
21118
|
const verified = await verify(value);
|
|
20994
|
-
if (!verified.ok) return row$
|
|
21119
|
+
if (!verified.ok) return row$21(keyringKey, "fail", `rejected (${from}): ${verified.message}`);
|
|
20995
21120
|
const expiry = verified.expiresAt ? describeExpiry(verified.expiresAt, now) : void 0;
|
|
20996
|
-
if (!expiry) return row$
|
|
21121
|
+
if (!expiry) return row$21(keyringKey, "ok", `${verified.subject} (${from})`);
|
|
20997
21122
|
return expiry.soon ? {
|
|
20998
|
-
...row$
|
|
21123
|
+
...row$21(keyringKey, "fail", `${verified.subject} (${from}), ${expiry.text}`),
|
|
20999
21124
|
problems: [`${expiry.text}: renew it`]
|
|
21000
|
-
} : row$
|
|
21125
|
+
} : row$21(keyringKey, "ok", `${verified.subject} (${from}), ${expiry.text}`);
|
|
21001
21126
|
} catch (err) {
|
|
21002
|
-
return row$
|
|
21127
|
+
return row$21(keyringKey, "fail", `could not be verified (${from}): ${errorMessage(err)}`);
|
|
21003
21128
|
}
|
|
21004
21129
|
}
|
|
21130
|
+
// src/commands/doctor-secrets/workspace-deploy-entries.ts
|
|
21131
|
+
/**
|
|
21132
|
+
* The `repo.secrets.deploy` entries of every workspace package, which feed names the root config does not list (Sentinel's
|
|
21133
|
+
* and Comlink's lists for `prod` and `preview`). A package whose config cannot be read is one skipped row naming it, never
|
|
21134
|
+
* a failure. Names only; nothing is written.
|
|
21135
|
+
*
|
|
21136
|
+
* @param repoRoot - The repository root.
|
|
21137
|
+
* @param read - Reads the packages' configs. Defaults to `readWorkspaceConfigs()`; tests pass a fake.
|
|
21138
|
+
*/
|
|
21139
|
+
async function workspaceDeployEntries(repoRoot, read = readWorkspaceConfigs) {
|
|
21140
|
+
const result = {
|
|
21141
|
+
entries: [],
|
|
21142
|
+
rows: []
|
|
21143
|
+
};
|
|
21144
|
+
for (const pkg of await read(repoRoot)) if ("error" in pkg) result.rows.push({
|
|
21145
|
+
id: `workspace-deploy:${pkg.path}`,
|
|
21146
|
+
title: `${pkg.path} deploy list`,
|
|
21147
|
+
status: "skip",
|
|
21148
|
+
detail: `could not read its config, so the names its repo.secrets.deploy feeds are not counted: ${pkg.error}`,
|
|
21149
|
+
problems: []
|
|
21150
|
+
});
|
|
21151
|
+
else result.entries.push(...pkg.resolved.repo?.secrets?.deploy ?? []);
|
|
21152
|
+
return result;
|
|
21153
|
+
}
|
|
21005
21154
|
// src/commands/doctor-secrets/doctor-secrets.ts
|
|
21006
21155
|
/**
|
|
21007
21156
|
* `holocron doctor secrets` — do the secrets the config says must exist, exist?
|
|
@@ -21077,14 +21226,19 @@ async function runDoctorSecrets(input) {
|
|
|
21077
21226
|
detail: "none declared",
|
|
21078
21227
|
problems: []
|
|
21079
21228
|
});
|
|
21080
|
-
|
|
21229
|
+
const workspace = withSecrets && (wants("prod") || wants("preview")) ? await workspaceDeployEntries(input.context.repoRoot, input.workspaceConfigs) : {
|
|
21230
|
+
entries: [],
|
|
21231
|
+
rows: []
|
|
21232
|
+
};
|
|
21233
|
+
rows.push(...ci.rows, ...variables.rows, ...skipRow("test"), ...deployRows, ...workspace.rows);
|
|
21081
21234
|
places.push(...await matrixPlaces({
|
|
21082
21235
|
config,
|
|
21083
21236
|
vault,
|
|
21084
21237
|
secrets: ci.observations,
|
|
21085
21238
|
variables: variables.observations,
|
|
21086
21239
|
org,
|
|
21087
|
-
wants
|
|
21240
|
+
wants,
|
|
21241
|
+
workspaceDeploy: workspace.entries
|
|
21088
21242
|
}));
|
|
21089
21243
|
} else rows.push(...skipRow("test"));
|
|
21090
21244
|
if (!input.shared) rows.push(...skipRow("preview"), ...skipRow("agent"));
|
|
@@ -21490,7 +21644,7 @@ function summariseProbeRows(id, title, rows) {
|
|
|
21490
21644
|
* provider with no `token` probe, no declared layer, or one that cannot be read is a skip with the reason.
|
|
21491
21645
|
*/
|
|
21492
21646
|
const PROBE = "token";
|
|
21493
|
-
const row$
|
|
21647
|
+
const row$20 = (id, title, status, detail, problems = []) => ({
|
|
21494
21648
|
id,
|
|
21495
21649
|
title,
|
|
21496
21650
|
status,
|
|
@@ -21515,12 +21669,12 @@ async function runDoctorTokens(input) {
|
|
|
21515
21669
|
try {
|
|
21516
21670
|
tokens = await providerTokens(provider);
|
|
21517
21671
|
} catch (err) {
|
|
21518
|
-
rows.push(row$
|
|
21672
|
+
rows.push(row$20(`tokens:${provider}`, provider, "skip", `could not read its tokens: ${describeError(err)}`));
|
|
21519
21673
|
continue;
|
|
21520
21674
|
}
|
|
21521
21675
|
const expectations = tokenExpectations(tokens);
|
|
21522
|
-
if (expectations.length === 0) rows.push(row$
|
|
21523
|
-
else if (!usableProbe(probes.get(provider))) rows.push(row$
|
|
21676
|
+
if (expectations.length === 0) rows.push(row$20(`tokens:${provider}`, provider, "skip", "info: declares no token layers, nothing to check"));
|
|
21677
|
+
else if (!usableProbe(probes.get(provider))) rows.push(row$20(`tokens:${provider}`, provider, "skip", `info: has no \`${PROBE}\` probe loaded, so its tokens are not checked`));
|
|
21524
21678
|
else declared.push({
|
|
21525
21679
|
provider,
|
|
21526
21680
|
tokens,
|
|
@@ -21582,14 +21736,14 @@ async function checkLayer(c) {
|
|
|
21582
21736
|
tokens
|
|
21583
21737
|
});
|
|
21584
21738
|
} catch (err) {
|
|
21585
|
-
if (err instanceof HoldsNoTokenError) return c.wanted.map((e) => row$
|
|
21586
|
-
return c.wanted.map((e) => row$
|
|
21739
|
+
if (err instanceof HoldsNoTokenError) return c.wanted.map((e) => row$20(id(e), title(e), "fail", "not held in this layer", [err.message]));
|
|
21740
|
+
return c.wanted.map((e) => row$20(id(e), title(e), "skip", `could not read the Environment: ${describeError(err)}`));
|
|
21587
21741
|
}
|
|
21588
21742
|
const rows = [];
|
|
21589
21743
|
for (const e of c.wanted) {
|
|
21590
21744
|
const token = held.held.find((h) => h.envName === e.envName);
|
|
21591
21745
|
if (!token) {
|
|
21592
|
-
rows.push(row$
|
|
21746
|
+
rows.push(row$20(id(e), title(e), "fail", `not held in ${held.environment}`, [`${e.envName} is declared for ${c.layer}`]));
|
|
21593
21747
|
continue;
|
|
21594
21748
|
}
|
|
21595
21749
|
rows.push(summariseProbeRows(id(e), title(e), await probeToken(c, e, token.token, held.plain)));
|
|
@@ -21662,7 +21816,7 @@ const doctorTokensCommand = {
|
|
|
21662
21816
|
}
|
|
21663
21817
|
};
|
|
21664
21818
|
// src/commands/doctor-wiki/wiki-rows.ts
|
|
21665
|
-
const row$
|
|
21819
|
+
const row$19 = (id, title, status, detail, problems = []) => ({
|
|
21666
21820
|
id,
|
|
21667
21821
|
title,
|
|
21668
21822
|
status,
|
|
@@ -21678,11 +21832,11 @@ const names = (paths) => paths.length > LISTED ? `${paths.slice(0, LISTED).join(
|
|
|
21678
21832
|
* skip, since a machine with no network says nothing about the site.
|
|
21679
21833
|
*/
|
|
21680
21834
|
function siteRow(id, title, probe, notFoundHint) {
|
|
21681
|
-
if (probe.status === void 0) return row$
|
|
21682
|
-
if (probe.status < 400) return row$
|
|
21683
|
-
if (probe.status === 401 || probe.status === 403) return row$
|
|
21835
|
+
if (probe.status === void 0) return row$19(id, title, "skip", `${probe.url}: ${probe.error ?? "no answer"}`);
|
|
21836
|
+
if (probe.status < 400) return row$19(id, title, "ok", `${probe.url} answers ${probe.status}`);
|
|
21837
|
+
if (probe.status === 401 || probe.status === 403) return row$19(id, title, "ok", `${probe.url} answers ${probe.status} (access is restricted)`);
|
|
21684
21838
|
const problem = probe.status === 404 ? `${probe.url} answers 404; ${notFoundHint}` : `${probe.url} answers ${probe.status}, expected a page`;
|
|
21685
|
-
return row$
|
|
21839
|
+
return row$19(id, title, "fail", `${probe.url} answers ${probe.status}`, [problem]);
|
|
21686
21840
|
}
|
|
21687
21841
|
/**
|
|
21688
21842
|
* The rows `holocron doctor wiki` prints for one {@link WikiInspection}: organization, docs instance, the site and its
|
|
@@ -21694,42 +21848,42 @@ function wikiRows(found, providerName) {
|
|
|
21694
21848
|
const { declared, found: foundOrg } = found.organization;
|
|
21695
21849
|
if (foundOrg === null) {
|
|
21696
21850
|
const problem = `fern/fern.config.json has no organization; \`holocron setup\` writes it`;
|
|
21697
|
-
rows.push(row$
|
|
21851
|
+
rows.push(row$19("wiki:organization", "organization is set", "fail", problem, [problem]));
|
|
21698
21852
|
} else if (foundOrg !== declared) {
|
|
21699
21853
|
const problem = `fern/fern.config.json names ${foundOrg}, the config declares ${declared}; run \`holocron setup\``;
|
|
21700
|
-
rows.push(row$
|
|
21701
|
-
} else rows.push(row$
|
|
21854
|
+
rows.push(row$19("wiki:organization", "organization is set", "fail", `${foundOrg}, declared ${declared}`, [problem]));
|
|
21855
|
+
} else rows.push(row$19("wiki:organization", "organization is set", "ok", `${declared} in fern/fern.config.json`));
|
|
21702
21856
|
const instance = found.instance;
|
|
21703
21857
|
if (instance === null) {
|
|
21704
21858
|
const problem = "fern/docs.yml does not exist; `holocron setup` writes it";
|
|
21705
|
-
rows.push(row$
|
|
21859
|
+
rows.push(row$19("wiki:instance", "docs site is declared", "fail", problem, [problem]));
|
|
21706
21860
|
} else {
|
|
21707
21861
|
const problems = [];
|
|
21708
21862
|
if (instance.foundUrl !== instance.expectedUrl) problems.push(`instance url is ${instance.foundUrl ?? "not set"}, expected ${instance.expectedUrl}`);
|
|
21709
21863
|
if (instance.expectedDomain !== void 0 && instance.foundDomain !== instance.expectedDomain) problems.push(`custom-domain is ${instance.foundDomain ?? "not set"}, expected ${instance.expectedDomain}`);
|
|
21710
|
-
rows.push(problems.length > 0 ? row$
|
|
21864
|
+
rows.push(problems.length > 0 ? row$19("wiki:instance", "docs site is declared", "fail", `${problems.length} problem(s)`, [...problems.map((p) => `fern/docs.yml: ${p}`)]) : row$19("wiki:instance", "docs site is declared", "ok", `${instance.expectedUrl} in fern/docs.yml`));
|
|
21711
21865
|
}
|
|
21712
21866
|
const [site, domain] = found.site;
|
|
21713
21867
|
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\`)`));
|
|
21714
21868
|
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`));
|
|
21715
|
-
if (found.navigation === null) rows.push(row$
|
|
21869
|
+
if (found.navigation === null) rows.push(row$19("wiki:navigation", "navigation pages exist", "skip", "no fern/docs.yml to read"));
|
|
21716
21870
|
else if (found.navigation.missing.length > 0) {
|
|
21717
21871
|
const problems = found.navigation.missing.map((p) => `${p} is listed in fern/docs.yml but is not on disk`);
|
|
21718
|
-
rows.push(row$
|
|
21872
|
+
rows.push(row$19("wiki:navigation", "navigation pages exist", "fail", `${found.navigation.missing.length} missing`, problems));
|
|
21719
21873
|
} else {
|
|
21720
|
-
rows.push(row$
|
|
21721
|
-
if (found.navigation.unlisted.length > 0) rows.push(row$
|
|
21874
|
+
rows.push(row$19("wiki:navigation", "navigation pages exist", "ok", `${found.navigation.listed} listed pages exist`));
|
|
21875
|
+
if (found.navigation.unlisted.length > 0) rows.push(row$19("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`));
|
|
21722
21876
|
}
|
|
21723
21877
|
const published = found.published;
|
|
21724
21878
|
const listed = found.navigation?.listed;
|
|
21725
|
-
if (!published) rows.push(row$
|
|
21879
|
+
if (!published) rows.push(row$19("wiki:published", "published pages", "skip", "the site's page index could not be asked"));
|
|
21726
21880
|
else if (published.pages === void 0) {
|
|
21727
21881
|
const why = published.status === void 0 ? published.error ?? "no answer" : `answered ${published.status}`;
|
|
21728
|
-
rows.push(row$
|
|
21882
|
+
rows.push(row$19("wiki:published", "published pages", "skip", `${published.url}: ${why}`));
|
|
21729
21883
|
} else if (listed !== void 0 && published.pages < listed) {
|
|
21730
21884
|
const problem = `${published.url} lists ${published.pages} page(s), the navigation lists ${listed}; the last publish is behind (run the wiki workflow)`;
|
|
21731
|
-
rows.push(row$
|
|
21732
|
-
} else rows.push(row$
|
|
21885
|
+
rows.push(row$19("wiki:published", "published pages", "fail", `${published.pages} of ${listed}`, [problem]));
|
|
21886
|
+
} else rows.push(row$19("wiki:published", "published pages", "ok", listed === void 0 ? `${published.pages} page(s) in ${published.url}` : `${published.pages} page(s) published for ${listed} listed`));
|
|
21733
21887
|
return rows;
|
|
21734
21888
|
}
|
|
21735
21889
|
// src/commands/doctor-wiki/doctor-wiki.ts
|
|
@@ -21835,7 +21989,7 @@ function readFailureRow(id, title, err) {
|
|
|
21835
21989
|
};
|
|
21836
21990
|
}
|
|
21837
21991
|
// src/commands/doctor-workers/check-project.ts
|
|
21838
|
-
const row$
|
|
21992
|
+
const row$18 = (id, title, status, detail, problems = []) => ({
|
|
21839
21993
|
id,
|
|
21840
21994
|
title,
|
|
21841
21995
|
status,
|
|
@@ -21864,30 +22018,30 @@ async function checkProject(deploy, declared) {
|
|
|
21864
22018
|
let exists = false;
|
|
21865
22019
|
try {
|
|
21866
22020
|
exists = (await deploy.listProjects()).some((p) => same$1(p.name, project) || p.id === project);
|
|
21867
|
-
rows.push(exists ? row$
|
|
22021
|
+
rows.push(exists ? row$18(ids.exists, titles.exists, "ok", `${project} on ${deploy.providerName}`) : row$18(ids.exists, titles.exists, "fail", "not found", [`no project ${project} on ${deploy.providerName}; \`holocron setup\` makes it`]));
|
|
21868
22022
|
} catch (err) {
|
|
21869
22023
|
rows.push(readFailureRow(ids.exists, titles.exists, err));
|
|
21870
22024
|
}
|
|
21871
22025
|
const notChecked = (reason) => `not checked: ${reason}`;
|
|
21872
22026
|
const gone = exists ? void 0 : "the project is not readable or not there";
|
|
21873
|
-
if (declared.hostname === void 0) {} else if (gone) rows.push(row$
|
|
21874
|
-
else if (!deploy.listDomains) rows.push(row$
|
|
22027
|
+
if (declared.hostname === void 0) {} else if (gone) rows.push(row$18(ids.domain, titles.domain, "skip", notChecked(gone)));
|
|
22028
|
+
else if (!deploy.listDomains) rows.push(row$18(ids.domain, titles.domain, "skip", `the \`${deploy.providerName}\` provider cannot list domains`));
|
|
21875
22029
|
else try {
|
|
21876
22030
|
const attached = await deploy.listDomains(project);
|
|
21877
|
-
rows.push(attached.some((d) => same$1(d, declared.hostname)) ? row$
|
|
22031
|
+
rows.push(attached.some((d) => same$1(d, declared.hostname)) ? row$18(ids.domain, titles.domain, "ok", `${declared.hostname} attached`) : row$18(ids.domain, titles.domain, "fail", `${declared.hostname} not attached`, [`${declared.hostname} is not a domain of ${project}; \`holocron setup\` attaches it`]));
|
|
21878
22032
|
} catch (err) {
|
|
21879
22033
|
rows.push(readFailureRow(ids.domain, titles.domain, err));
|
|
21880
22034
|
}
|
|
21881
|
-
if (gone) rows.push(row$
|
|
21882
|
-
else if (!deploy.latestDeployment) rows.push(row$
|
|
22035
|
+
if (gone) rows.push(row$18(ids.deploy, titles.deploy, "skip", notChecked(gone)));
|
|
22036
|
+
else if (!deploy.latestDeployment) rows.push(row$18(ids.deploy, titles.deploy, "skip", `the \`${deploy.providerName}\` provider cannot list deployments`));
|
|
21883
22037
|
else try {
|
|
21884
22038
|
const latest = await deploy.latestDeployment(project);
|
|
21885
|
-
if (!latest) rows.push(row$
|
|
21886
|
-
else if (latest.status === "ready") rows.push(row$
|
|
22039
|
+
if (!latest) rows.push(row$18(ids.deploy, titles.deploy, "skip", "no production deployment yet"));
|
|
22040
|
+
else if (latest.status === "ready") rows.push(row$18(ids.deploy, titles.deploy, "ok", latest.createdAt ? `ready, ${latest.createdAt}` : "ready"));
|
|
21887
22041
|
else if (latest.status === "error") {
|
|
21888
22042
|
const why = latest.errorMessage ? `: ${latest.errorMessage}` : "";
|
|
21889
|
-
rows.push(row$
|
|
21890
|
-
} else rows.push(row$
|
|
22043
|
+
rows.push(row$18(ids.deploy, titles.deploy, "fail", "the newest deployment errored", [`the newest production deployment of ${project} failed${why}`]));
|
|
22044
|
+
} else rows.push(row$18(ids.deploy, titles.deploy, "skip", `info: the newest deployment is ${latest.status}`));
|
|
21891
22045
|
} catch (err) {
|
|
21892
22046
|
rows.push(readFailureRow(ids.deploy, titles.deploy, err));
|
|
21893
22047
|
}
|
|
@@ -21895,7 +22049,7 @@ async function checkProject(deploy, declared) {
|
|
|
21895
22049
|
}
|
|
21896
22050
|
// src/commands/doctor-workers/check-worker.ts
|
|
21897
22051
|
const same = (a, b) => a.toLowerCase() === b.toLowerCase();
|
|
21898
|
-
const row$
|
|
22052
|
+
const row$17 = (id, title, status, detail, problems = []) => ({
|
|
21899
22053
|
id,
|
|
21900
22054
|
title,
|
|
21901
22055
|
status,
|
|
@@ -21920,9 +22074,9 @@ async function checkWorker(workers, worker) {
|
|
|
21920
22074
|
deploy: `${name} Worker's latest deployment is healthy`
|
|
21921
22075
|
};
|
|
21922
22076
|
const skipAll = (reason) => [
|
|
21923
|
-
row$
|
|
21924
|
-
row$
|
|
21925
|
-
row$
|
|
22077
|
+
row$17(ids.deployed, titles.deployed, "skip", reason),
|
|
22078
|
+
row$17(ids.bindings, titles.bindings, "skip", reason),
|
|
22079
|
+
row$17(ids.deploy, titles.deploy, "skip", reason)
|
|
21926
22080
|
];
|
|
21927
22081
|
if (worker.script === void 0) return skipAll(`${workers.providerName} does not say how it names this Worker`);
|
|
21928
22082
|
const script = worker.script;
|
|
@@ -21935,29 +22089,29 @@ async function checkWorker(workers, worker) {
|
|
|
21935
22089
|
exists = state.exists;
|
|
21936
22090
|
if (!state.exists) {
|
|
21937
22091
|
const problem = `no Worker named ${script}; \`holocron setup\` deploys it`;
|
|
21938
|
-
rows.push(row$
|
|
22092
|
+
rows.push(row$17(ids.deployed, titles.deployed, "fail", `${script} not deployed`, [problem]), row$17(ids.bindings, titles.bindings, "skip", `not checked: no Worker named ${script}`));
|
|
21939
22093
|
} else {
|
|
21940
|
-
rows.push(state.routes.some((r) => same(r, route)) ? row$
|
|
21941
|
-
if (worker.bindings.length === 0) rows.push(row$
|
|
22094
|
+
rows.push(state.routes.some((r) => same(r, route)) ? row$17(ids.deployed, titles.deployed, "ok", `${script} serves ${route}`) : row$17(ids.deployed, titles.deployed, "fail", `no route ${route}`, [`${script} has no route ${route}`]));
|
|
22095
|
+
if (worker.bindings.length === 0) rows.push(row$17(ids.bindings, titles.bindings, "ok", "none declared"));
|
|
21942
22096
|
else {
|
|
21943
22097
|
const bound = new Set(state.bindingNames.map((n) => n.toUpperCase()));
|
|
21944
22098
|
const missing = worker.bindings.filter((n) => !bound.has(n.toUpperCase()));
|
|
21945
|
-
rows.push(missing.length === 0 ? row$
|
|
22099
|
+
rows.push(missing.length === 0 ? row$17(ids.bindings, titles.bindings, "ok", `${worker.bindings.length} of ${worker.bindings.length} bound`) : row$17(ids.bindings, titles.bindings, "fail", `${missing.length} not bound`, missing.map((n) => `${n}: not bound`)));
|
|
21946
22100
|
}
|
|
21947
22101
|
}
|
|
21948
22102
|
} catch (err) {
|
|
21949
22103
|
const failure = readFailureRow(ids.deployed, titles.deployed, err);
|
|
21950
|
-
rows.push(failure, row$
|
|
22104
|
+
rows.push(failure, row$17(ids.bindings, titles.bindings, "skip", "not checked: could not read the Worker"));
|
|
21951
22105
|
}
|
|
21952
|
-
if (!exists) rows.push(row$
|
|
21953
|
-
else if (!workers.latestDeployment) rows.push(row$
|
|
22106
|
+
if (!exists) rows.push(row$17(ids.deploy, titles.deploy, "skip", "not checked: the Worker is not readable or not there"));
|
|
22107
|
+
else if (!workers.latestDeployment) rows.push(row$17(ids.deploy, titles.deploy, "skip", `the \`${workers.providerName}\` provider cannot list deployments`));
|
|
21954
22108
|
else try {
|
|
21955
22109
|
const latest = await workers.latestDeployment(script);
|
|
21956
|
-
if (!latest) rows.push(row$
|
|
22110
|
+
if (!latest) rows.push(row$17(ids.deploy, titles.deploy, "skip", `${script} has no recorded deployment`));
|
|
21957
22111
|
else if (!latest.active) {
|
|
21958
22112
|
const problem = `the newest deployment of ${script} does not serve all traffic`;
|
|
21959
|
-
rows.push(row$
|
|
21960
|
-
} else rows.push(row$
|
|
22113
|
+
rows.push(row$17(ids.deploy, titles.deploy, "fail", "not serving all traffic", [problem]));
|
|
22114
|
+
} else rows.push(row$17(ids.deploy, titles.deploy, "ok", latest.createdAt ? `deployed ${latest.createdAt}` : "serving all traffic"));
|
|
21961
22115
|
} catch (err) {
|
|
21962
22116
|
rows.push(readFailureRow(ids.deploy, titles.deploy, err));
|
|
21963
22117
|
}
|
|
@@ -22021,7 +22175,7 @@ function declaredWorkers(input) {
|
|
|
22021
22175
|
* custom domain is attached, and the newest production deployment is ready. Only what the provider proves wrong
|
|
22022
22176
|
* fails; a missing token, a 401 or 403, or a provider that cannot read it is a skip with the reason.
|
|
22023
22177
|
*/
|
|
22024
|
-
const row$
|
|
22178
|
+
const row$16 = (id, title, status, detail) => ({
|
|
22025
22179
|
id,
|
|
22026
22180
|
title,
|
|
22027
22181
|
status,
|
|
@@ -22047,12 +22201,12 @@ async function runDoctorWorkers(input) {
|
|
|
22047
22201
|
...loader.has("wiki") ? { wiki: loader.get("wiki") } : {},
|
|
22048
22202
|
...workers ? { workers } : {}
|
|
22049
22203
|
});
|
|
22050
|
-
if (declared.length === 0) rows.push(row$
|
|
22204
|
+
if (declared.length === 0) rows.push(row$16("workers", "declared Workers", "ok", "none declared"));
|
|
22051
22205
|
else if (!workers) {
|
|
22052
22206
|
const why = whyNone(loader, "workers", "no `workers` provider is configured in holocron.config.ts");
|
|
22053
|
-
for (const worker of declared) rows.push(row$
|
|
22207
|
+
for (const worker of declared) rows.push(row$16(`workers:${worker.label}`, `${worker.label} Worker`, "skip", why));
|
|
22054
22208
|
} else for (const worker of declared) rows.push(...await checkWorker(workers, worker));
|
|
22055
|
-
if (!loader.has("deployment")) rows.push(row$
|
|
22209
|
+
if (!loader.has("deployment")) rows.push(row$16("deployment", "deployment project", "skip", whyNone(loader, "deployment", "no `deployment` provider is configured in holocron.config.ts")));
|
|
22056
22210
|
else {
|
|
22057
22211
|
const deploy = loader.get("deployment");
|
|
22058
22212
|
for (const project of declaredProjects(input.loaded.resolved, deploy)) rows.push(...await checkProject(deploy, project));
|
|
@@ -23049,7 +23203,7 @@ function resolveExportDir(input) {
|
|
|
23049
23203
|
* listed under the provider's row and does not fail the run. It writes files, so it asks first unless `--dry-run` (the
|
|
23050
23204
|
* files are converted and listed, nothing is written) or `--yes` (without a terminal it refuses instead).
|
|
23051
23205
|
*/
|
|
23052
|
-
const row$
|
|
23206
|
+
const row$15 = (id, status, detail, problems = []) => ({
|
|
23053
23207
|
id,
|
|
23054
23208
|
title: id,
|
|
23055
23209
|
status,
|
|
@@ -23091,9 +23245,9 @@ async function runRequestsExport(input) {
|
|
|
23091
23245
|
print("");
|
|
23092
23246
|
const entry = input.loaded.resolved.providers.tooling;
|
|
23093
23247
|
const tuples = entry?.cardinality === "many" ? entry.tuples : [];
|
|
23094
|
-
if (tuples.length === 0) return finish([row$
|
|
23248
|
+
if (tuples.length === 0) return finish([row$15("tooling", "fail", "the config has no `tooling` provider to export for")]);
|
|
23095
23249
|
const chosen = input.to === void 0 ? tuples : tuples.filter((t) => t.provider === input.to);
|
|
23096
|
-
if (chosen.length === 0) return finish([row$
|
|
23250
|
+
if (chosen.length === 0) return finish([row$15(input.to, "fail", `not a \`tooling\` provider of this config (${tuples.map((t) => t.provider).join(", ")})`)]);
|
|
23097
23251
|
/* v8 ignore start -- the real loader is only built outside tests, which always inject one */
|
|
23098
23252
|
const loader = input.loader ?? new PluginLoader({
|
|
23099
23253
|
...input.loaded.resolved,
|
|
@@ -23113,17 +23267,17 @@ async function runRequestsExport(input) {
|
|
|
23113
23267
|
const tool = loaded.find((t) => t.providerName === id);
|
|
23114
23268
|
if (!tool) {
|
|
23115
23269
|
const failure = loader.loadFailures().find((f) => f.key === "tooling" && f.provider === id);
|
|
23116
|
-
rows.push(row$
|
|
23270
|
+
rows.push(row$15(id, "fail", `the provider is not available${failure ? ` (${describeError(failure.error)})` : ""}`));
|
|
23117
23271
|
continue;
|
|
23118
23272
|
}
|
|
23119
23273
|
if (!tool.export) {
|
|
23120
|
-
rows.push(row$
|
|
23274
|
+
rows.push(row$15(id, "skip", "has no export: it reads the repo's files as they are"));
|
|
23121
23275
|
continue;
|
|
23122
23276
|
}
|
|
23123
23277
|
const collectionFiles = fileList$1(tuple.options.collectionFiles);
|
|
23124
23278
|
const envFiles = fileList$1(tuple.options.envFiles);
|
|
23125
23279
|
if (collectionFiles.length === 0) {
|
|
23126
|
-
rows.push(row$
|
|
23280
|
+
rows.push(row$15(id, "skip", "names no `collectionFiles`, so there is nothing to export"));
|
|
23127
23281
|
continue;
|
|
23128
23282
|
}
|
|
23129
23283
|
const groups = input.out === void 0 ? groupByFolder(collectionFiles) : [collectionFiles];
|
|
@@ -23137,7 +23291,7 @@ async function runRequestsExport(input) {
|
|
|
23137
23291
|
...input.out !== void 0 ? { out: input.out } : {}
|
|
23138
23292
|
});
|
|
23139
23293
|
if (!dir.ok) {
|
|
23140
|
-
rows.push(row$
|
|
23294
|
+
rows.push(row$15(label, "fail", dir.message));
|
|
23141
23295
|
continue;
|
|
23142
23296
|
}
|
|
23143
23297
|
targets.push({
|
|
@@ -23176,9 +23330,9 @@ async function runRequestsExport(input) {
|
|
|
23176
23330
|
const where = relative(repoRoot, outDir);
|
|
23177
23331
|
const files = result.files.length > 0 ? ` (${result.files.join(", ")})` : "";
|
|
23178
23332
|
paths.push(...result.files.map((file) => resolve(outDir, file)));
|
|
23179
|
-
rows.push(row$
|
|
23333
|
+
rows.push(row$15(label, "ok", `${dryRun ? "would write" : "wrote"} ${result.files.length} file(s) to ${where}${files}`, result.issues.map((issue) => `issue in ${issue.file}: ${issue.message}`)));
|
|
23180
23334
|
} catch (err) {
|
|
23181
|
-
rows.push(row$
|
|
23335
|
+
rows.push(row$15(label, "fail", describeError(err)));
|
|
23182
23336
|
}
|
|
23183
23337
|
const report = finish(rows.sort((a, b) => a.id.localeCompare(b.id)));
|
|
23184
23338
|
if (paths.length > 0) {
|
|
@@ -27548,7 +27702,7 @@ function specName(title, name) {
|
|
|
27548
27702
|
*/
|
|
27549
27703
|
/** How many lines of the spec a dry run shows. */
|
|
27550
27704
|
const PREVIEW_LINES$1 = 12;
|
|
27551
|
-
const row$
|
|
27705
|
+
const row$14 = (id, status, detail) => ({
|
|
27552
27706
|
id,
|
|
27553
27707
|
title: id,
|
|
27554
27708
|
status,
|
|
@@ -27578,7 +27732,7 @@ async function runIdeasPromote(input) {
|
|
|
27578
27732
|
print(style.header(`Holocron new spec${dryRun ? " (dry-run)" : ""}`));
|
|
27579
27733
|
print("");
|
|
27580
27734
|
const entry = input.loaded.resolved.providers.issues;
|
|
27581
|
-
if (!entry) return finish([row$
|
|
27735
|
+
if (!entry) return finish([row$14(input.issue, "fail", "the config has no `issues` provider to read the issue with")]);
|
|
27582
27736
|
const credentials = input.loaded.resolved.providers.credentials;
|
|
27583
27737
|
/* v8 ignore start -- the real loader is only built outside tests, which always inject one */
|
|
27584
27738
|
const loader = input.loader ?? new PluginLoader({
|
|
@@ -27593,18 +27747,18 @@ async function runIdeasPromote(input) {
|
|
|
27593
27747
|
assertPluginsResolvable(loader, "new spec");
|
|
27594
27748
|
if (!loader.has("issues")) {
|
|
27595
27749
|
const failure = loader.loadFailures().find((f) => f.key === "issues");
|
|
27596
|
-
return finish([row$
|
|
27750
|
+
return finish([row$14(input.issue, "fail", `the \`issues\` provider is not available${failure ? ` (${describeError(failure.error)})` : ""}`)]);
|
|
27597
27751
|
}
|
|
27598
27752
|
let issue;
|
|
27599
27753
|
try {
|
|
27600
27754
|
issue = await loader.get("issues").get(input.issue);
|
|
27601
27755
|
} catch (err) {
|
|
27602
|
-
return finish([row$
|
|
27756
|
+
return finish([row$14(input.issue, "fail", `could not read the issue: ${describeError(err)}`)]);
|
|
27603
27757
|
}
|
|
27604
27758
|
const name = specName(issue.summary, input.name);
|
|
27605
|
-
if (!name) return finish([row$
|
|
27759
|
+
if (!name) return finish([row$14(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`)]);
|
|
27606
27760
|
const relative = join(".notes", `${name}.spec.md`);
|
|
27607
|
-
if (io.exists(join(input.context.repoRoot, relative))) return finish([row$
|
|
27761
|
+
if (io.exists(join(input.context.repoRoot, relative))) return finish([row$14(relative, "fail", "the spec already exists; it is never overwritten")], relative);
|
|
27608
27762
|
const { org, name: repoName } = input.loaded.resolved;
|
|
27609
27763
|
const ref = githubRef(issue.url) ?? (issue.key.startsWith("#") ? `${org}/${repoName}${issue.key}` : issue.key);
|
|
27610
27764
|
const { content, fromIdea } = buildSpec({
|
|
@@ -27617,7 +27771,7 @@ async function runIdeasPromote(input) {
|
|
|
27617
27771
|
print(` ${relative}`);
|
|
27618
27772
|
for (const line of content.split("\n").slice(0, PREVIEW_LINES$1)) print(` ${style.skip(line)}`);
|
|
27619
27773
|
print("");
|
|
27620
|
-
return finish([row$
|
|
27774
|
+
return finish([row$14(relative, "skip", `would write the spec ${origin}`)], relative);
|
|
27621
27775
|
}
|
|
27622
27776
|
if (!input.yes) {
|
|
27623
27777
|
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`);
|
|
@@ -27636,9 +27790,9 @@ async function runIdeasPromote(input) {
|
|
|
27636
27790
|
try {
|
|
27637
27791
|
io.write(join(input.context.repoRoot, relative), content);
|
|
27638
27792
|
} catch (err) {
|
|
27639
|
-
return finish([row$
|
|
27793
|
+
return finish([row$14(relative, "fail", `could not write the spec: ${describeError(err)}`)], relative);
|
|
27640
27794
|
}
|
|
27641
|
-
return finish([row$
|
|
27795
|
+
return finish([row$14(relative, "ok", `wrote the spec ${origin}`)], relative);
|
|
27642
27796
|
}
|
|
27643
27797
|
// src/commands/ideas-promote/ideas-promote.command.ts
|
|
27644
27798
|
const ideasPromoteCommand = {
|
|
@@ -27714,7 +27868,7 @@ function readIssueBody(file, cwd, read = (p) => readFileSync(p, "utf8")) {
|
|
|
27714
27868
|
*/
|
|
27715
27869
|
/** How many lines of the body a dry run shows. */
|
|
27716
27870
|
const PREVIEW_LINES = 8;
|
|
27717
|
-
const row$
|
|
27871
|
+
const row$13 = (id, status, detail) => ({
|
|
27718
27872
|
id,
|
|
27719
27873
|
title: id,
|
|
27720
27874
|
status,
|
|
@@ -27738,11 +27892,11 @@ async function runIssueCreate(input) {
|
|
|
27738
27892
|
print(style.header(`Holocron new issue${dryRun ? " (dry-run)" : ""}`));
|
|
27739
27893
|
print("");
|
|
27740
27894
|
const title = input.title.trim();
|
|
27741
|
-
if (!title) return finish([row$
|
|
27895
|
+
if (!title) return finish([row$13("title", "fail", "the title is empty")]);
|
|
27742
27896
|
const prepared = prepareIssueFields(input, input.loaded.resolved.repo?.labels?.areas);
|
|
27743
|
-
if (!prepared.ok) return finish(prepared.problems.map((p) => row$
|
|
27897
|
+
if (!prepared.ok) return finish(prepared.problems.map((p) => row$13(title, "fail", p)));
|
|
27744
27898
|
const entry = input.loaded.resolved.providers.issues;
|
|
27745
|
-
if (!entry) return finish([row$
|
|
27899
|
+
if (!entry) return finish([row$13(title, "fail", "the config has no `issues` provider to file the issue with")]);
|
|
27746
27900
|
const credentials = input.loaded.resolved.providers.credentials;
|
|
27747
27901
|
const projects = prepared.project ? input.loaded.resolved.providers.projects : void 0;
|
|
27748
27902
|
/* v8 ignore start -- the real loader is only built outside tests, which always inject one */
|
|
@@ -27759,7 +27913,7 @@ async function runIssueCreate(input) {
|
|
|
27759
27913
|
assertPluginsResolvable(loader, "new issue");
|
|
27760
27914
|
if (!loader.has("issues")) {
|
|
27761
27915
|
const failure = loader.loadFailures().find((f) => f.key === "issues");
|
|
27762
|
-
return finish([row$
|
|
27916
|
+
return finish([row$13(title, "fail", `the \`issues\` provider is not available${failure ? ` (${describeError(failure.error)})` : ""}`)]);
|
|
27763
27917
|
}
|
|
27764
27918
|
const labels = [.../* @__PURE__ */ new Set([...(input.labels ?? []).map((l) => l.trim()).filter(Boolean), ...prepared.areaLabels])];
|
|
27765
27919
|
const body = input.body?.trim() ? input.body : void 0;
|
|
@@ -27776,7 +27930,7 @@ async function runIssueCreate(input) {
|
|
|
27776
27930
|
print(` ${title}`);
|
|
27777
27931
|
for (const line of body ? body.split("\n").slice(0, PREVIEW_LINES) : []) print(` ${style.skip(line)}`);
|
|
27778
27932
|
print("");
|
|
27779
|
-
return finish([row$
|
|
27933
|
+
return finish([row$13(title, "skip", `would file the issue${summary}`)]);
|
|
27780
27934
|
}
|
|
27781
27935
|
if (!input.yes) {
|
|
27782
27936
|
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");
|
|
@@ -27809,12 +27963,12 @@ async function runIssueCreate(input) {
|
|
|
27809
27963
|
...prepared.fields.priority ? { priority: prepared.fields.priority } : {}
|
|
27810
27964
|
}) : void 0;
|
|
27811
27965
|
return finish([
|
|
27812
|
-
row$
|
|
27813
|
-
...(dropped ?? []).map((line) => row$
|
|
27966
|
+
row$13(title, "ok", `filed ${key}`),
|
|
27967
|
+
...(dropped ?? []).map((line) => row$13("not carried across", "skip", line)),
|
|
27814
27968
|
...board ? [board] : []
|
|
27815
27969
|
], key);
|
|
27816
27970
|
} catch (err) {
|
|
27817
|
-
return finish([row$
|
|
27971
|
+
return finish([row$13(title, "fail", `could not file the issue: ${describeError(err)}`)]);
|
|
27818
27972
|
}
|
|
27819
27973
|
}
|
|
27820
27974
|
// src/commands/issue-create/issue-create.command.ts
|
|
@@ -30134,7 +30288,7 @@ function readGitConfig(cwd, key, run = runGit) {
|
|
|
30134
30288
|
* identity; Effort is asked on a terminal when it was not given (the CLI never chooses it). The issue's key is printed
|
|
30135
30289
|
* by the first row, before anything else is done, so a failed spec leaves the issue as the anchor to resume from.
|
|
30136
30290
|
*/
|
|
30137
|
-
const row$
|
|
30291
|
+
const row$12 = (id, status, detail) => ({
|
|
30138
30292
|
id,
|
|
30139
30293
|
title: id,
|
|
30140
30294
|
status,
|
|
@@ -30153,7 +30307,7 @@ async function runNewWork(input) {
|
|
|
30153
30307
|
const name = specName(input.title, input.specName);
|
|
30154
30308
|
if (!name) {
|
|
30155
30309
|
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`;
|
|
30156
|
-
const rows = [row$
|
|
30310
|
+
const rows = [row$12("spec", "fail", detail)];
|
|
30157
30311
|
printCheckRows(rows, print);
|
|
30158
30312
|
return {
|
|
30159
30313
|
status: "fail",
|
|
@@ -30162,7 +30316,7 @@ async function runNewWork(input) {
|
|
|
30162
30316
|
}
|
|
30163
30317
|
specPath = join(".notes", `${name}.spec.md`);
|
|
30164
30318
|
if (io.exists(join(root, specPath))) {
|
|
30165
|
-
const rows = [row$
|
|
30319
|
+
const rows = [row$12(specPath, "fail", "the spec already exists; it is never overwritten")];
|
|
30166
30320
|
printCheckRows(rows, print);
|
|
30167
30321
|
return {
|
|
30168
30322
|
status: "fail",
|
|
@@ -30172,7 +30326,7 @@ async function runNewWork(input) {
|
|
|
30172
30326
|
}
|
|
30173
30327
|
}
|
|
30174
30328
|
const assignees = input.assignees && input.assignees.length > 0 ? input.assignees : [gitAssignee(input.gitConfig ?? ((key) => readGitConfig(root, key)))].filter((a) => Boolean(a));
|
|
30175
|
-
if (!input.assignees?.length && assignees.length === 0) extra.push(row$
|
|
30329
|
+
if (!input.assignees?.length && assignees.length === 0) extra.push(row$12("assignee", "skip", "git config has no GitHub login (`github.user`); pass --assignee to assign the issue"));
|
|
30176
30330
|
let effort = input.effort;
|
|
30177
30331
|
const interactive = input.interactive ?? Boolean(process.stdin.isTTY);
|
|
30178
30332
|
if (!effort && !input.yes && !dryRun && interactive) effort = await (input.askEffort ?? promptEffort)();
|
|
@@ -33162,7 +33316,7 @@ const MARKER = "# written by `holocron open requests` for one session and remove
|
|
|
33162
33316
|
const SECRETS_FILE = `${PRIVATE_DIR}/requests.env`;
|
|
33163
33317
|
/** The lock a launch holds, in the private directory. */
|
|
33164
33318
|
const LOCK_FILE = `${PRIVATE_DIR}/open-requests.lock`;
|
|
33165
|
-
const row$
|
|
33319
|
+
const row$11 = (id, status, detail, problems = []) => ({
|
|
33166
33320
|
id,
|
|
33167
33321
|
title: id,
|
|
33168
33322
|
status,
|
|
@@ -33203,7 +33357,7 @@ async function runOpenRequests(input) {
|
|
|
33203
33357
|
const tuples = entry?.cardinality === "many" ? entry.tuples : [];
|
|
33204
33358
|
const chosen = input.to === void 0 ? tuples : tuples.filter((t) => t.provider === input.to);
|
|
33205
33359
|
if (chosen.length === 0) {
|
|
33206
|
-
say(row$
|
|
33360
|
+
say(row$11(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(", ")})`));
|
|
33207
33361
|
return finish();
|
|
33208
33362
|
}
|
|
33209
33363
|
/* v8 ignore start -- the real loader is only built outside tests, which always inject one */
|
|
@@ -33213,7 +33367,7 @@ async function runOpenRequests(input) {
|
|
|
33213
33367
|
assertPluginsResolvable(loader, "open requests");
|
|
33214
33368
|
const openable = (loader.has("tooling") ? loader.get("tooling") : []).filter((t) => chosen.some((tuple) => tuple.provider === t.providerName)).filter((t) => t.open !== void 0);
|
|
33215
33369
|
if (openable.length !== 1) {
|
|
33216
|
-
say(row$
|
|
33370
|
+
say(row$11("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`));
|
|
33217
33371
|
return finish();
|
|
33218
33372
|
}
|
|
33219
33373
|
const tool = openable[0];
|
|
@@ -33227,34 +33381,34 @@ async function runOpenRequests(input) {
|
|
|
33227
33381
|
repoRoot
|
|
33228
33382
|
});
|
|
33229
33383
|
} catch (err) {
|
|
33230
|
-
say(row$
|
|
33384
|
+
say(row$11(tool.providerName, "fail", describeError(err)));
|
|
33231
33385
|
return finish();
|
|
33232
33386
|
}
|
|
33233
33387
|
const loaded = plan.wants.filter((want) => layers.includes(want.layer));
|
|
33234
33388
|
const notLoaded = plan.wants.filter((want) => !layers.includes(want.layer));
|
|
33235
33389
|
const names = [...new Set(loaded.map((want) => want.name))].sort();
|
|
33236
|
-
if (plan.unfilled.length > 0) say(row$
|
|
33237
|
-
say(row$
|
|
33390
|
+
if (plan.unfilled.length > 0) say(row$11("unfilled", "skip", `${plan.unfilled.length} secret variable(s) refer to no entry, so nobody fills them`, plan.unfilled));
|
|
33391
|
+
say(row$11("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`)));
|
|
33238
33392
|
if (dryRun) {
|
|
33239
|
-
for (const want of loaded) say(row$
|
|
33240
|
-
if (names.length === 0) say(row$
|
|
33241
|
-
else say(row$
|
|
33242
|
-
say(row$
|
|
33393
|
+
for (const want of loaded) say(row$11(want.variable, "ok", `would fill ${want.collection}'s ${want.variable} from ${want.entry} of ${want.layer} as ${want.name}`));
|
|
33394
|
+
if (names.length === 0) say(row$11("secrets", "ok", "nothing to fill: no variable refers to an entry"));
|
|
33395
|
+
else say(row$11("secrets", "ok", `would write ${names.length} value(s) to ${SECRETS_FILE} and link it from ${plan.targets.length} collection(s)`));
|
|
33396
|
+
say(row$11(plan.app, "ok", `would start ${plan.launch.command} in the foreground`));
|
|
33243
33397
|
return finish();
|
|
33244
33398
|
}
|
|
33245
33399
|
if (deps.platform === "win32" && names.length > 0) {
|
|
33246
|
-
say(row$
|
|
33400
|
+
say(row$11(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"));
|
|
33247
33401
|
return finish();
|
|
33248
33402
|
}
|
|
33249
33403
|
let running;
|
|
33250
33404
|
try {
|
|
33251
33405
|
running = await deps.processes();
|
|
33252
33406
|
} catch (err) {
|
|
33253
|
-
say(row$
|
|
33407
|
+
say(row$11(plan.app, "fail", `could not tell whether ${plan.app} is running: ${describeError(err)}`));
|
|
33254
33408
|
return finish();
|
|
33255
33409
|
}
|
|
33256
33410
|
if (running.split("\n").some((line) => line.includes(plan.running))) {
|
|
33257
|
-
say(row$
|
|
33411
|
+
say(row$11(plan.app, "fail", `${plan.app} is already running; quit it and run this again (it would not see the values)`));
|
|
33258
33412
|
return finish();
|
|
33259
33413
|
}
|
|
33260
33414
|
if (!input.yes) {
|
|
@@ -33271,7 +33425,7 @@ async function runOpenRequests(input) {
|
|
|
33271
33425
|
if (names.length > 0) {
|
|
33272
33426
|
const vault = loader.has("vault") ? loader.get("vault") : void 0;
|
|
33273
33427
|
if (!vault?.readEnvironmentEntries) {
|
|
33274
|
-
say(row$
|
|
33428
|
+
say(row$11("vault", "fail", vault ? `${vault.providerName} cannot read an Environment's entries` : "needs a `vault` provider in holocron.config.ts (1password)"));
|
|
33275
33429
|
return finish();
|
|
33276
33430
|
}
|
|
33277
33431
|
let failed = false;
|
|
@@ -33288,17 +33442,17 @@ async function runOpenRequests(input) {
|
|
|
33288
33442
|
names: [...new Set(wanted.map((want) => want.entry))].sort()
|
|
33289
33443
|
});
|
|
33290
33444
|
} catch (err) {
|
|
33291
|
-
say(row$
|
|
33445
|
+
say(row$11(`vault ${layer}`, "fail", describeError(err)));
|
|
33292
33446
|
failed = true;
|
|
33293
33447
|
continue;
|
|
33294
33448
|
}
|
|
33295
33449
|
for (const entry of read.missing) {
|
|
33296
|
-
say(row$
|
|
33450
|
+
say(row$11(`${layer} ${entry}`, "fail", `${read.environmentId} holds no value for ${entry}`));
|
|
33297
33451
|
failed = true;
|
|
33298
33452
|
}
|
|
33299
33453
|
if (read.missing.length > 0) continue;
|
|
33300
33454
|
for (const want of wanted) values.set(want.name, read.values.get(want.entry));
|
|
33301
|
-
say(row$
|
|
33455
|
+
say(row$11(`vault ${read.environmentId}`, "ok", `${wanted.length} value(s) read: ${[...new Set(wanted.map((want) => want.name))].join(", ")}`));
|
|
33302
33456
|
}
|
|
33303
33457
|
if (failed) return finish();
|
|
33304
33458
|
}
|
|
@@ -33318,7 +33472,7 @@ async function runOpenRequests(input) {
|
|
|
33318
33472
|
};
|
|
33319
33473
|
deps.makeDir(dirname(secrets));
|
|
33320
33474
|
if (!deps.takeLock(lock, deps.pid)) {
|
|
33321
|
-
say(row$
|
|
33475
|
+
say(row$11(plan.app, "fail", `another \`open requests\` is starting ${plan.app} (${LOCK_FILE} is held); try again when it has`));
|
|
33322
33476
|
return finish();
|
|
33323
33477
|
}
|
|
33324
33478
|
const stop = deps.onTerminate(cleanup);
|
|
@@ -33326,18 +33480,18 @@ async function runOpenRequests(input) {
|
|
|
33326
33480
|
if (names.length > 0) {
|
|
33327
33481
|
const ignored = deps.isIgnored(secrets);
|
|
33328
33482
|
if (ignored === "tracked" || ignored === "unknown") {
|
|
33329
|
-
say(row$
|
|
33483
|
+
say(row$11("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, "")]));
|
|
33330
33484
|
return finish();
|
|
33331
33485
|
}
|
|
33332
33486
|
const stale = deps.inspect(secrets);
|
|
33333
33487
|
if (stale.kind !== "none" && !(stale.kind === "file" && stale.firstLine === "# written by `holocron open requests` for one session and removed when it ends")) {
|
|
33334
|
-
say(row$
|
|
33488
|
+
say(row$11("values file", "fail", `${SECRETS_FILE} is not this command's (no marker line); move it away`));
|
|
33335
33489
|
return finish();
|
|
33336
33490
|
}
|
|
33337
33491
|
for (const link of plan.targets) {
|
|
33338
33492
|
const state = deps.inspect(link);
|
|
33339
33493
|
if (state.kind !== "none" && !isOurs(state, link, secrets)) {
|
|
33340
|
-
say(row$
|
|
33494
|
+
say(row$11("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`));
|
|
33341
33495
|
return finish();
|
|
33342
33496
|
}
|
|
33343
33497
|
}
|
|
@@ -33345,7 +33499,7 @@ async function runOpenRequests(input) {
|
|
|
33345
33499
|
for (const [name, value] of values) {
|
|
33346
33500
|
const line = dotenvLine(name, value);
|
|
33347
33501
|
if (line === null) {
|
|
33348
|
-
say(row$
|
|
33502
|
+
say(row$11(name, "fail", `the value of ${name} cannot be written to a .env file as it is; it was not written`));
|
|
33349
33503
|
return finish();
|
|
33350
33504
|
}
|
|
33351
33505
|
lines.push(line);
|
|
@@ -33358,7 +33512,7 @@ async function runOpenRequests(input) {
|
|
|
33358
33512
|
deps.symlink(relative(dirname(link), secrets), link);
|
|
33359
33513
|
created.push(link);
|
|
33360
33514
|
}
|
|
33361
|
-
say(row$
|
|
33515
|
+
say(row$11("values file", "ok", `${SECRETS_FILE} (mode 0600, git-ignored) linked from ${plan.targets.map((t) => relative(repoRoot, t)).join(", ")}`));
|
|
33362
33516
|
}
|
|
33363
33517
|
print("");
|
|
33364
33518
|
print(`starting ${plan.app}${names.length > 0 ? `; the values are removed when it quits (Ctrl-C ends it too)` : ""}`);
|
|
@@ -33366,10 +33520,10 @@ async function runOpenRequests(input) {
|
|
|
33366
33520
|
try {
|
|
33367
33521
|
exitCode = await deps.run(plan.launch);
|
|
33368
33522
|
} catch (err) {
|
|
33369
|
-
say(row$
|
|
33523
|
+
say(row$11(plan.app, "fail", describeError(err)));
|
|
33370
33524
|
return finish();
|
|
33371
33525
|
}
|
|
33372
|
-
say(row$
|
|
33526
|
+
say(row$11(plan.app, exitCode === 0 ? "ok" : "fail", `ended with ${exitCode}`));
|
|
33373
33527
|
return finish();
|
|
33374
33528
|
} finally {
|
|
33375
33529
|
stop();
|
|
@@ -33721,7 +33875,7 @@ const CATALOG_SECTIONS = [
|
|
|
33721
33875
|
/** Catalogs that are not a group's own dependencies. */
|
|
33722
33876
|
const SPECIAL_CATALOGS = ["peers"];
|
|
33723
33877
|
/** The scope of this org's own packages. */
|
|
33724
|
-
const SCOPE = "@theholocron/";
|
|
33878
|
+
const SCOPE$1 = "@theholocron/";
|
|
33725
33879
|
// src/commands/probe/deps/group-of.ts
|
|
33726
33880
|
/** The group of a workspace folder: its top-level directory, or `root`. */
|
|
33727
33881
|
function groupOf(dir) {
|
|
@@ -33864,7 +34018,7 @@ function planDeps(root) {
|
|
|
33864
34018
|
const wanted = {};
|
|
33865
34019
|
const rows = [];
|
|
33866
34020
|
for (const entry of [...byName.values()].sort((a, b) => a.name.localeCompare(b.name))) {
|
|
33867
|
-
const isScoped = entry.name.startsWith(SCOPE);
|
|
34021
|
+
const isScoped = entry.name.startsWith(SCOPE$1);
|
|
33868
34022
|
const nonPeer = entry.edges.filter((e) => e.section !== "peerDependencies");
|
|
33869
34023
|
const peers = entry.edges.filter((e) => e.section === "peerDependencies");
|
|
33870
34024
|
let target;
|
|
@@ -33927,7 +34081,7 @@ function detail(p, filter) {
|
|
|
33927
34081
|
const rows = p.rows.filter((r) => r.name.includes(filter));
|
|
33928
34082
|
if (rows.length === 0) return `No dependency matches "${filter}".\n`;
|
|
33929
34083
|
const lines = [];
|
|
33930
|
-
const short = (pkg) => pkg.replace(SCOPE, "");
|
|
34084
|
+
const short = (pkg) => pkg.replace(SCOPE$1, "");
|
|
33931
34085
|
for (const r of rows) {
|
|
33932
34086
|
const where = r.catalog === null ? "peer ranges only (not in a catalog)" : r.catalog === "default" ? "catalog: (default)" : `catalog:${r.catalog}`;
|
|
33933
34087
|
lines.push(`### ${r.name}${r.range ? ` ${r.range}` : ""} (${where})`, "");
|
|
@@ -35593,7 +35747,7 @@ const projectCommand = {
|
|
|
35593
35747
|
*/
|
|
35594
35748
|
/** A vendor's token id: letters, digits and `._:-`, so it is one path segment and nothing that could change a request. */
|
|
35595
35749
|
const TOKEN_ID = /^[A-Za-z0-9._:-]{1,128}$/;
|
|
35596
|
-
const row$
|
|
35750
|
+
const row$10 = (id, title, status, detail, problems = []) => ({
|
|
35597
35751
|
id: `provider-revoke:${id}`,
|
|
35598
35752
|
title,
|
|
35599
35753
|
status,
|
|
@@ -35626,7 +35780,7 @@ async function runProviderRevoke(input) {
|
|
|
35626
35780
|
};
|
|
35627
35781
|
};
|
|
35628
35782
|
print(`Holocron provider ${provider} revoke${dryRun ? " (dry-run)" : ""}`);
|
|
35629
|
-
if (!TOKEN_ID.test(id)) return finish("fail", [row$
|
|
35783
|
+
if (!TOKEN_ID.test(id)) return finish("fail", [row$10("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"])]);
|
|
35630
35784
|
/* v8 ignore next -- the real loader is only built outside tests, which always inject one */
|
|
35631
35785
|
const loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);
|
|
35632
35786
|
await loader.load();
|
|
@@ -35636,10 +35790,10 @@ async function runProviderRevoke(input) {
|
|
|
35636
35790
|
revoke = await loader.loadRevokeToken(provider, input.options ?? {});
|
|
35637
35791
|
} catch (err) {
|
|
35638
35792
|
if (err instanceof WorkspaceContextError) throw err;
|
|
35639
|
-
return finish("fail", [row$
|
|
35793
|
+
return finish("fail", [row$10("provider", provider, "fail", `\`${provider}\` did not load`, [describeError(err)])]);
|
|
35640
35794
|
}
|
|
35641
|
-
if (!revoke) return finish("fail", [row$
|
|
35642
|
-
if (dryRun) return finish("dry-run", [row$
|
|
35795
|
+
if (!revoke) return finish("fail", [row$10("provider", provider, "fail", `\`${provider}\` cannot delete a token through its API`, ["delete it in the vendor's dashboard"])]);
|
|
35796
|
+
if (dryRun) return finish("dry-run", [row$10("plan", id, "ok", `would delete token ${id} at ${provider} through its API; it cannot be undone; nothing was called`)]);
|
|
35643
35797
|
if (!input.yes) {
|
|
35644
35798
|
if (!input.confirm) throw new NonInteractiveError("pass --yes to revoke a token without a terminal");
|
|
35645
35799
|
if (!await input.confirm(`Delete token ${id} at ${provider}? This cannot be undone.`)) {
|
|
@@ -35654,9 +35808,9 @@ async function runProviderRevoke(input) {
|
|
|
35654
35808
|
try {
|
|
35655
35809
|
done = await revoke({ id });
|
|
35656
35810
|
} catch (err) {
|
|
35657
|
-
return finish("fail", [row$
|
|
35811
|
+
return finish("fail", [row$10("revoke", id, "fail", `${provider} did not delete the token`, [describeError(err)])]);
|
|
35658
35812
|
}
|
|
35659
|
-
return finish("ok", [row$
|
|
35813
|
+
return finish("ok", [row$10("revoked", id, "ok", done.revoked ? `deleted at ${provider}` : `${provider} no longer has it; nothing to delete`), ...done.notes.map((note, i) => row$10(`note-${i + 1}`, "note", "skip", note))]);
|
|
35660
35814
|
}
|
|
35661
35815
|
// src/commands/provider/provider-token/provider-token.ts
|
|
35662
35816
|
/**
|
|
@@ -35667,7 +35821,7 @@ async function runProviderRevoke(input) {
|
|
|
35667
35821
|
* once imported); no row, log or return value carries it, and the output is scrubbed of it as well. The old token is
|
|
35668
35822
|
* never revoked here.
|
|
35669
35823
|
*/
|
|
35670
|
-
const row$
|
|
35824
|
+
const row$9 = (id, title, status, detail, problems = []) => ({
|
|
35671
35825
|
id: `provider-token:${id}`,
|
|
35672
35826
|
title,
|
|
35673
35827
|
status,
|
|
@@ -35703,7 +35857,7 @@ async function runProviderToken(input) {
|
|
|
35703
35857
|
};
|
|
35704
35858
|
};
|
|
35705
35859
|
print(`Holocron provider ${provider} token (${layer})${dryRun ? " (dry-run)" : ""}`);
|
|
35706
|
-
if (!ENVIRONMENT_LAYERS.includes(layer)) return finish("fail", [row$
|
|
35860
|
+
if (!ENVIRONMENT_LAYERS.includes(layer)) return finish("fail", [row$9("layer", "layer", "fail", `\`${layer}\` is not a layer`, [`use one of: ${ENVIRONMENT_LAYERS.join(", ")}`])]);
|
|
35707
35861
|
/* v8 ignore next -- the real loader is only built outside tests, which always inject one */
|
|
35708
35862
|
const loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);
|
|
35709
35863
|
await loader.load();
|
|
@@ -35713,12 +35867,12 @@ async function runProviderToken(input) {
|
|
|
35713
35867
|
mint = await loader.loadMintToken(provider, input.options ?? {});
|
|
35714
35868
|
} catch (err) {
|
|
35715
35869
|
if (err instanceof WorkspaceContextError) throw err;
|
|
35716
|
-
return finish("fail", [row$
|
|
35870
|
+
return finish("fail", [row$9("provider", `${provider}`, "fail", `\`${provider}\` did not load`, [describeError(err)])]);
|
|
35717
35871
|
}
|
|
35718
|
-
if (!mint) return finish("fail", [row$
|
|
35872
|
+
if (!mint) return finish("fail", [row$9("provider", provider, "fail", `\`${provider}\` cannot make a token through its API`, [`make one by hand, then store it with \`holocron new token ${provider} <token>\``])]);
|
|
35719
35873
|
const now = input.now ?? (() => /* @__PURE__ */ new Date());
|
|
35720
35874
|
const name = input.name ?? `holocron-${provider}-${layer}-${stamp(now())}`;
|
|
35721
|
-
if (dryRun) return finish("dry-run", [row$
|
|
35875
|
+
if (dryRun) return finish("dry-run", [row$9("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`)]);
|
|
35722
35876
|
if (!input.yes) {
|
|
35723
35877
|
if (!input.confirm) throw new NonInteractiveError("pass --yes to make a token without a terminal");
|
|
35724
35878
|
if (!await input.confirm(`Make a new ${layer} token named ${name} through ${provider}'s API?`)) {
|
|
@@ -35738,9 +35892,9 @@ async function runProviderToken(input) {
|
|
|
35738
35892
|
now
|
|
35739
35893
|
});
|
|
35740
35894
|
} catch (err) {
|
|
35741
|
-
return finish("fail", [row$
|
|
35895
|
+
return finish("fail", [row$9("mint", name, "fail", `${provider} did not make the token`, [describeError(err)])]);
|
|
35742
35896
|
}
|
|
35743
|
-
const rows = [row$
|
|
35897
|
+
const rows = [row$9("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$9(`note-${i + 1}`, "note", "skip", note))];
|
|
35744
35898
|
const environment = await (input.resolveEnvironment ?? ((l, repoRoot) => resolveEnvironmentId(l, { repoRoot })))(layer, input.context.repoRoot);
|
|
35745
35899
|
const handed = await (input.handOff ?? handOffSecret)({
|
|
35746
35900
|
name: made.envName,
|
|
@@ -35751,10 +35905,10 @@ async function runProviderToken(input) {
|
|
|
35751
35905
|
...input.interactive === void 0 ? {} : { interactive: input.interactive }
|
|
35752
35906
|
});
|
|
35753
35907
|
if (handed.status === "fail") {
|
|
35754
|
-
rows.push(row$
|
|
35908
|
+
rows.push(row$9("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`]));
|
|
35755
35909
|
return finish("fail", rows, [made.value]);
|
|
35756
35910
|
}
|
|
35757
|
-
rows.push(row$
|
|
35911
|
+
rows.push(row$9("hand-off", made.envName, "ok", `handed to the private import file for the \`${environment}\` Environment`), row$9("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}`));
|
|
35758
35912
|
return finish("ok", rows, [made.value]);
|
|
35759
35913
|
}
|
|
35760
35914
|
// src/commands/provider/provider.ts
|
|
@@ -37556,7 +37710,7 @@ const projectReconcileCommand = {
|
|
|
37556
37710
|
* it would do and posts nothing.
|
|
37557
37711
|
*/
|
|
37558
37712
|
const DEFAULT_MAX_AGE_MINUTES = 10;
|
|
37559
|
-
const row$
|
|
37713
|
+
const row$8 = (id, status, detail) => ({
|
|
37560
37714
|
id,
|
|
37561
37715
|
title: id,
|
|
37562
37716
|
status,
|
|
@@ -37595,7 +37749,7 @@ async function runReconcileCi(input) {
|
|
|
37595
37749
|
};
|
|
37596
37750
|
};
|
|
37597
37751
|
const fail = (id, detail) => {
|
|
37598
|
-
rows.push(row$
|
|
37752
|
+
rows.push(row$8(id, "fail", detail));
|
|
37599
37753
|
return finish();
|
|
37600
37754
|
};
|
|
37601
37755
|
print(style.header(`Holocron reconcile ci${dryRun ? " (dry-run)" : ""}`));
|
|
@@ -37603,7 +37757,7 @@ async function runReconcileCi(input) {
|
|
|
37603
37757
|
if (input.maxAgeMinutes !== void 0 && !(input.maxAgeMinutes > 0)) return fail("max-age", "--max-age is a number of minutes above zero");
|
|
37604
37758
|
const poster = aggregatePoster({ ci: input.loaded.resolved.ci });
|
|
37605
37759
|
if (!input.shadow && poster !== "sentinel") {
|
|
37606
|
-
rows.push(row$
|
|
37760
|
+
rows.push(row$8("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`));
|
|
37607
37761
|
return finish();
|
|
37608
37762
|
}
|
|
37609
37763
|
const providers = input.loaded.resolved.providers;
|
|
@@ -37643,7 +37797,7 @@ async function runReconcileCi(input) {
|
|
|
37643
37797
|
return fail("pull requests", describeError(error));
|
|
37644
37798
|
}
|
|
37645
37799
|
if (pullRequests.length === 0) {
|
|
37646
|
-
rows.push(row$
|
|
37800
|
+
rows.push(row$8("pull requests", "skip", "no open pull requests"));
|
|
37647
37801
|
return finish();
|
|
37648
37802
|
}
|
|
37649
37803
|
const api = {
|
|
@@ -37656,7 +37810,7 @@ async function runReconcileCi(input) {
|
|
|
37656
37810
|
for (const pr of pullRequests) {
|
|
37657
37811
|
const id = `#${pr.number}`;
|
|
37658
37812
|
if (pr.headSha === void 0) {
|
|
37659
|
-
rows.push(row$
|
|
37813
|
+
rows.push(row$8(id, "skip", "the provider gave no head commit"));
|
|
37660
37814
|
continue;
|
|
37661
37815
|
}
|
|
37662
37816
|
try {
|
|
@@ -37671,17 +37825,17 @@ async function runReconcileCi(input) {
|
|
|
37671
37825
|
name: input.shadow ? AGGREGATE_SHADOW_CHECK_NAME : AGGREGATE_CHECK_NAME
|
|
37672
37826
|
});
|
|
37673
37827
|
const verdict = out.result.conclusion;
|
|
37674
|
-
if (out.action === "foreign") rows.push(row$
|
|
37675
|
-
else if (out.action === "unchanged") rows.push(row$
|
|
37828
|
+
if (out.action === "foreign") rows.push(row$8(id, "skip", "another app (the Actions job) already posts this check on the commit; left alone"));
|
|
37829
|
+
else if (out.action === "unchanged") rows.push(row$8(id, "ok", `up to date (${verdict})`));
|
|
37676
37830
|
else if (out.stale) {
|
|
37677
37831
|
const what = dryRun ? "would repair" : "repaired";
|
|
37678
|
-
rows.push(row$
|
|
37832
|
+
rows.push(row$8(id, "fail", `${what}: the check was missing or wrong (now ${verdict}); a delivery was missed`));
|
|
37679
37833
|
} else {
|
|
37680
37834
|
const what = dryRun ? "would post" : "posted";
|
|
37681
|
-
rows.push(row$
|
|
37835
|
+
rows.push(row$8(id, "ok", `${what} ${verdict} (still in flight)`));
|
|
37682
37836
|
}
|
|
37683
37837
|
} catch (error) {
|
|
37684
|
-
rows.push(row$
|
|
37838
|
+
rows.push(row$8(id, "fail", describeError(error)));
|
|
37685
37839
|
}
|
|
37686
37840
|
}
|
|
37687
37841
|
return finish();
|
|
@@ -37764,7 +37918,7 @@ const defaultApi = {
|
|
|
37764
37918
|
listAppDeliveries,
|
|
37765
37919
|
redeliverAppDelivery
|
|
37766
37920
|
};
|
|
37767
|
-
const row$
|
|
37921
|
+
const row$7 = (id, status, detail) => ({
|
|
37768
37922
|
id,
|
|
37769
37923
|
title: id,
|
|
37770
37924
|
status,
|
|
@@ -37795,7 +37949,7 @@ async function runRedeliverWebhooks(input) {
|
|
|
37795
37949
|
};
|
|
37796
37950
|
};
|
|
37797
37951
|
const fail = (id, detail) => {
|
|
37798
|
-
rows.push(row$
|
|
37952
|
+
rows.push(row$7(id, "fail", detail));
|
|
37799
37953
|
return finish();
|
|
37800
37954
|
};
|
|
37801
37955
|
print(style.header(`Holocron redeliver webhooks${dryRun ? " (dry-run)" : ""}`));
|
|
@@ -37808,7 +37962,7 @@ async function runRedeliverWebhooks(input) {
|
|
|
37808
37962
|
}
|
|
37809
37963
|
const all = input.loaded.resolved.githubApps ?? [];
|
|
37810
37964
|
if (all.length === 0) {
|
|
37811
|
-
rows.push(row$
|
|
37965
|
+
rows.push(row$7("github-app", "skip", "no `githubApps` are declared in holocron.config.ts"));
|
|
37812
37966
|
return finish();
|
|
37813
37967
|
}
|
|
37814
37968
|
const instances = input.app === void 0 ? all : all.filter((instance) => instance.name === input.app);
|
|
@@ -37822,19 +37976,19 @@ async function runRedeliverWebhooks(input) {
|
|
|
37822
37976
|
for (const instance of instances) {
|
|
37823
37977
|
const read = await readAppCredentials(instance, loader);
|
|
37824
37978
|
if ("reason" in read) {
|
|
37825
|
-
rows.push(row$
|
|
37979
|
+
rows.push(row$7(`${instance.name}`, "skip", read.reason));
|
|
37826
37980
|
continue;
|
|
37827
37981
|
}
|
|
37828
37982
|
try {
|
|
37829
37983
|
const failed = failedDeliveries(await api.listAppDeliveries(read.creds, { since }));
|
|
37830
|
-
if (failed.length === 0) rows.push(row$
|
|
37984
|
+
if (failed.length === 0) rows.push(row$7(instance.name, "ok", `no failed deliveries since ${since}`));
|
|
37831
37985
|
for (const delivery of failed) pending.push({
|
|
37832
37986
|
app: instance.name,
|
|
37833
37987
|
creds: read.creds,
|
|
37834
37988
|
delivery
|
|
37835
37989
|
});
|
|
37836
37990
|
} catch (error) {
|
|
37837
|
-
rows.push(row$
|
|
37991
|
+
rows.push(row$7(instance.name, "fail", `cannot read the delivery log: ${scrubbed$1(error, [read.creds.privateKey])}`));
|
|
37838
37992
|
}
|
|
37839
37993
|
}
|
|
37840
37994
|
if (pending.length === 0) return finish();
|
|
@@ -37846,7 +38000,7 @@ async function runRedeliverWebhooks(input) {
|
|
|
37846
38000
|
};
|
|
37847
38001
|
};
|
|
37848
38002
|
if (dryRun) {
|
|
37849
|
-
for (const item of pending) rows.push(row$
|
|
38003
|
+
for (const item of pending) rows.push(row$7(label(item).id, "skip", `would redeliver ${label(item).text}`));
|
|
37850
38004
|
return finish();
|
|
37851
38005
|
}
|
|
37852
38006
|
/* v8 ignore next -- the terminal is only asked outside tests, which inject `interactive` */
|
|
@@ -37858,16 +38012,16 @@ async function runRedeliverWebhooks(input) {
|
|
|
37858
38012
|
default: false
|
|
37859
38013
|
}));
|
|
37860
38014
|
if (!input.yes && !await ask(`Redeliver ${pending.length} failed webhook deliver${pending.length === 1 ? "y" : "ies"}?`)) {
|
|
37861
|
-
rows.push(row$
|
|
38015
|
+
rows.push(row$7("redeliver", "skip", "not confirmed; nothing was redelivered"));
|
|
37862
38016
|
return finish();
|
|
37863
38017
|
}
|
|
37864
38018
|
for (const item of pending) {
|
|
37865
38019
|
const { id, text } = label(item);
|
|
37866
38020
|
try {
|
|
37867
38021
|
await api.redeliverAppDelivery(item.creds, item.delivery.id);
|
|
37868
|
-
rows.push(row$
|
|
38022
|
+
rows.push(row$7(id, "ok", `redelivered ${text}`));
|
|
37869
38023
|
} catch (error) {
|
|
37870
|
-
rows.push(row$
|
|
38024
|
+
rows.push(row$7(id, "fail", scrubbed$1(error, [item.creds.privateKey])));
|
|
37871
38025
|
}
|
|
37872
38026
|
}
|
|
37873
38027
|
return finish();
|
|
@@ -38089,7 +38243,7 @@ async function readLayerTokenId(input) {
|
|
|
38089
38243
|
* order of what is left for each replaced token, naming the exact `provider <name> revoke <id>` when the id was read.
|
|
38090
38244
|
* No token value is printed, logged or returned.
|
|
38091
38245
|
*/
|
|
38092
|
-
const row$
|
|
38246
|
+
const row$6 = (id, title, status, detail, problems = []) => ({
|
|
38093
38247
|
id: `rotate:${id}`,
|
|
38094
38248
|
title,
|
|
38095
38249
|
status,
|
|
@@ -38126,7 +38280,7 @@ async function runRotateTokens(input) {
|
|
|
38126
38280
|
const layers = input.layers ?? [];
|
|
38127
38281
|
const unknown = layers.find((l) => !ENVIRONMENT_LAYERS.includes(l));
|
|
38128
38282
|
if (unknown !== void 0) {
|
|
38129
|
-
show([row$
|
|
38283
|
+
show([row$6("layer", "layer", "fail", `\`${unknown}\` is not a layer`, [`use one of: ${ENVIRONMENT_LAYERS.join(", ")}`])]);
|
|
38130
38284
|
return finish("fail");
|
|
38131
38285
|
}
|
|
38132
38286
|
const due = dueTokens((await (input.doctor ?? runDoctorTokens)({
|
|
@@ -38135,7 +38289,7 @@ async function runRotateTokens(input) {
|
|
|
38135
38289
|
print: () => {}
|
|
38136
38290
|
})).rows, layers);
|
|
38137
38291
|
if (due.length === 0) {
|
|
38138
|
-
show([row$
|
|
38292
|
+
show([row$6("none", "tokens", "ok", "no token is due")]);
|
|
38139
38293
|
return finish("ok");
|
|
38140
38294
|
}
|
|
38141
38295
|
/* v8 ignore next -- the real loader is only built outside tests, which always inject one */
|
|
@@ -38164,7 +38318,7 @@ async function runRotateTokens(input) {
|
|
|
38164
38318
|
layer: d.layer,
|
|
38165
38319
|
envName: d.envName
|
|
38166
38320
|
}));
|
|
38167
|
-
show(due.map((d, i) => canMint[i] ? row$
|
|
38321
|
+
show(due.map((d, i) => canMint[i] ? row$6(`${d.layer}:${d.provider}:${d.envName}`, label(d), "ok", `due (${d.problems.join("; ")}); will be replaced through ${d.provider}'s API`) : row$6(`${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>\``, `the token it holds now: ${idNote(ids.get(d))}`])));
|
|
38168
38322
|
if (dryRun || replaceable.length === 0) return finish(dryRun ? "dry-run" : "ok");
|
|
38169
38323
|
if (!input.yes) {
|
|
38170
38324
|
if (!input.confirm) throw new NonInteractiveError("pass --yes to replace tokens without a terminal");
|
|
@@ -38190,8 +38344,8 @@ async function runRotateTokens(input) {
|
|
|
38190
38344
|
print
|
|
38191
38345
|
});
|
|
38192
38346
|
const id = `${d.layer}:${d.provider}:${d.envName}`;
|
|
38193
|
-
if (made.status === "ok") show([row$
|
|
38194
|
-
else show([row$
|
|
38347
|
+
if (made.status === "ok") show([row$6(id, label(d), "ok", "a new token was made and handed to the private import file; the old one still works"), row$6(`next:${id}`, "next", "skip", `after the import: \`holocron sync secrets --env ${d.layer}\`, then ${revokeStep(d, ids.get(d))}`)]);
|
|
38348
|
+
else show([row$6(id, label(d), "fail", "the replacement was not made", made.rows.filter((r) => r.status === "fail").map((r) => r.detail))]);
|
|
38195
38349
|
}
|
|
38196
38350
|
return finish("ok");
|
|
38197
38351
|
}
|
|
@@ -38330,6 +38484,240 @@ const runCommand = {
|
|
|
38330
38484
|
if (report.status === "fail" || report.status === "unknown") process.exitCode = 1;
|
|
38331
38485
|
}
|
|
38332
38486
|
};
|
|
38487
|
+
// src/commands/ideas-sync/resolve-ideas-provider/resolve-ideas-provider.ts
|
|
38488
|
+
/**
|
|
38489
|
+
* The `ideas` provider `sync ideas` reads through: `providers.ideas` when the config names one. A config written
|
|
38490
|
+
* before the capability has only `ideas.dir` (#2004), so that, or `HOLOCRON_IDEAS_DIR` alone, reads as
|
|
38491
|
+
* `["obsidian", { dir }]`, the way a `HOLOCRON_` variable falls back to the bare name. `providers.ideas` wins over
|
|
38492
|
+
* `ideas.dir`. `undefined` when the config names no place for ideas at all.
|
|
38493
|
+
*/
|
|
38494
|
+
function resolveIdeasProvider(resolved, env) {
|
|
38495
|
+
const own = resolved.providers.ideas;
|
|
38496
|
+
if (own) return own;
|
|
38497
|
+
const dir = resolved.ideas?.dir;
|
|
38498
|
+
if (dir === void 0 && holocronEnv(env).get("IDEAS_DIR") === void 0) return void 0;
|
|
38499
|
+
return {
|
|
38500
|
+
cardinality: "single",
|
|
38501
|
+
tuple: {
|
|
38502
|
+
provider: "obsidian",
|
|
38503
|
+
packageName: resolvePluginPackage("obsidian"),
|
|
38504
|
+
options: dir === void 0 ? {} : { dir }
|
|
38505
|
+
}
|
|
38506
|
+
};
|
|
38507
|
+
}
|
|
38508
|
+
// src/commands/council-setup/real-council-io/real-council-io.ts
|
|
38509
|
+
/** {@link CouncilIo} over the real disk. */
|
|
38510
|
+
const realCouncilIo = {
|
|
38511
|
+
home: () => homedir(),
|
|
38512
|
+
isDirectory: (path) => {
|
|
38513
|
+
try {
|
|
38514
|
+
return statSync(path).isDirectory();
|
|
38515
|
+
} catch {
|
|
38516
|
+
return false;
|
|
38517
|
+
}
|
|
38518
|
+
},
|
|
38519
|
+
kind: (path) => {
|
|
38520
|
+
try {
|
|
38521
|
+
const stat = lstatSync(path);
|
|
38522
|
+
if (stat.isSymbolicLink()) return "link";
|
|
38523
|
+
return stat.isDirectory() ? "directory" : "file";
|
|
38524
|
+
} catch {
|
|
38525
|
+
return "missing";
|
|
38526
|
+
}
|
|
38527
|
+
},
|
|
38528
|
+
read: (path) => {
|
|
38529
|
+
try {
|
|
38530
|
+
return readFileSync(path);
|
|
38531
|
+
} catch {
|
|
38532
|
+
return;
|
|
38533
|
+
}
|
|
38534
|
+
},
|
|
38535
|
+
mkdir: (path) => void mkdirSync(path, { recursive: true }),
|
|
38536
|
+
write: (path, data) => writeFileSync(path, data)
|
|
38537
|
+
};
|
|
38538
|
+
// src/commands/council-setup/run-council-setup/run-council-setup.ts
|
|
38539
|
+
/**
|
|
38540
|
+
* `holocron setup council` — installs the Council Obsidian plugin into a vault.
|
|
38541
|
+
*
|
|
38542
|
+
* It copies the built `main.js` and `manifest.json` of `apps/council` into
|
|
38543
|
+
* `<vault>/.obsidian/plugins/holocron-council/`. The vault is `--vault <folder>`, else the folder the configured `ideas`
|
|
38544
|
+
* provider reads (`Ideas.notesDir()`). It never makes a vault (a folder with no `.obsidian` is refused), never deletes
|
|
38545
|
+
* anything, never writes through a symbolic link and never builds Council: a missing build is a failing row that names
|
|
38546
|
+
* the command. A second run updates the files, and when they already match it changes nothing and says so. It writes,
|
|
38547
|
+
* so it asks first unless `--dry-run` or `--yes` (without a terminal it refuses instead). Turning the plugin on is the
|
|
38548
|
+
* one step it cannot do, so the run ends by naming it.
|
|
38549
|
+
*/
|
|
38550
|
+
/** The folder name Obsidian keeps the plugin in; it is the `id` in Council's `manifest.json`. */
|
|
38551
|
+
const PLUGIN_ID = "holocron-council";
|
|
38552
|
+
/** The files the plugin needs: the name in the vault, and where the build leaves it under the Council folder. */
|
|
38553
|
+
const FILES = [{
|
|
38554
|
+
name: "main.js",
|
|
38555
|
+
source: "dist/main.js"
|
|
38556
|
+
}, {
|
|
38557
|
+
name: "manifest.json",
|
|
38558
|
+
source: "manifest.json"
|
|
38559
|
+
}];
|
|
38560
|
+
const BUILD_HINT = "run `pnpm --filter @theholocron/council build` first";
|
|
38561
|
+
const row$5 = (id, status, detail) => ({
|
|
38562
|
+
id,
|
|
38563
|
+
title: id,
|
|
38564
|
+
status,
|
|
38565
|
+
detail,
|
|
38566
|
+
problems: []
|
|
38567
|
+
});
|
|
38568
|
+
/** A vault path as the person typed it: `~` is the home folder, and a relative path is taken from `base`. */
|
|
38569
|
+
function expandVault(vault, home, base) {
|
|
38570
|
+
if (vault === "~") return home;
|
|
38571
|
+
return resolve(base, vault.startsWith("~/") ? join(home, vault.slice(2)) : vault);
|
|
38572
|
+
}
|
|
38573
|
+
/**
|
|
38574
|
+
* Installs or updates the Council plugin in a vault. Prints its own rows and returns them.
|
|
38575
|
+
*
|
|
38576
|
+
* @param input - The config, the Council folder, the vault and the seams.
|
|
38577
|
+
*/
|
|
38578
|
+
async function runCouncilSetup(input) {
|
|
38579
|
+
/* v8 ignore next -- the console is only used outside tests, which inject `print` */
|
|
38580
|
+
const print = input.print ?? ((line) => console.log(line));
|
|
38581
|
+
const io = input.io ?? realCouncilIo;
|
|
38582
|
+
const dryRun = Boolean(input.context.dryRun);
|
|
38583
|
+
const finish = (rows, enable = false) => {
|
|
38584
|
+
printCheckRows(rows, print);
|
|
38585
|
+
const summary = summariseChecks(rows);
|
|
38586
|
+
printCheckSummary(summary, print);
|
|
38587
|
+
if (enable && summary.fail === 0) {
|
|
38588
|
+
print("");
|
|
38589
|
+
print(` ${style.header("One step is yours:")} in Obsidian open Settings, Community plugins, reload the list and turn on "Holocron Council"`);
|
|
38590
|
+
}
|
|
38591
|
+
return {
|
|
38592
|
+
status: summary.fail > 0 ? "fail" : "ok",
|
|
38593
|
+
rows
|
|
38594
|
+
};
|
|
38595
|
+
};
|
|
38596
|
+
print(style.header(`Holocron setup council${dryRun ? " (dry-run)" : ""}`));
|
|
38597
|
+
print("");
|
|
38598
|
+
let vault;
|
|
38599
|
+
if (input.vault !== void 0) vault = expandVault(input.vault, io.home(), input.context.repoRoot);
|
|
38600
|
+
else {
|
|
38601
|
+
const entry = resolveIdeasProvider(input.loaded.resolved, input.env);
|
|
38602
|
+
if (!entry) return finish([row$5("vault", "fail", "no vault: pass `--vault <folder>`, or set `providers.ideas` (`[\"obsidian\", { vault }]`) or HOLOCRON_IDEAS_DIR")]);
|
|
38603
|
+
/* v8 ignore start -- the real loader is only built outside tests, which always inject one */
|
|
38604
|
+
const reader = input.ideasLoader ?? new PluginLoader({
|
|
38605
|
+
...input.loaded.resolved,
|
|
38606
|
+
providers: { ideas: entry }
|
|
38607
|
+
}, input.context);
|
|
38608
|
+
/* v8 ignore stop */
|
|
38609
|
+
await reader.load();
|
|
38610
|
+
assertPluginsResolvable(reader, "setup council");
|
|
38611
|
+
if (!reader.has("ideas")) {
|
|
38612
|
+
const failure = reader.loadFailures().find((f) => f.key === "ideas");
|
|
38613
|
+
return finish([row$5("vault", "fail", `the \`ideas\` provider is not available${failure ? ` (${describeError(failure.error)})` : ""}`)]);
|
|
38614
|
+
}
|
|
38615
|
+
vault = reader.get("ideas").notesDir?.();
|
|
38616
|
+
if (vault === void 0) return finish([row$5("vault", "fail", "the `ideas` provider names no folder: pass `--vault <folder>`")]);
|
|
38617
|
+
}
|
|
38618
|
+
const obsidian = join(vault, ".obsidian");
|
|
38619
|
+
if (!io.isDirectory(vault)) return finish([row$5("vault", "fail", `${vault} is not a folder`)]);
|
|
38620
|
+
if (!io.isDirectory(obsidian)) return finish([row$5("vault", "fail", `${vault} has no .obsidian folder, so it is not an Obsidian vault (open it in Obsidian once)`)]);
|
|
38621
|
+
const plugins = join(obsidian, "plugins");
|
|
38622
|
+
const target = join(plugins, PLUGIN_ID);
|
|
38623
|
+
const links = [plugins, target].filter((path) => io.kind(path) === "link");
|
|
38624
|
+
if (links.length > 0) return finish([row$5("vault", "fail", `${links[0]} is a symbolic link; it will not be written through`)]);
|
|
38625
|
+
const rows = [row$5("vault", "ok", vault)];
|
|
38626
|
+
const planned = [];
|
|
38627
|
+
for (const file of FILES) {
|
|
38628
|
+
const data = io.read(join(input.councilDir, file.source));
|
|
38629
|
+
if (!data) {
|
|
38630
|
+
rows.push(row$5(file.name, "fail", `${join(input.councilDir, file.source)} is missing: ${BUILD_HINT}`));
|
|
38631
|
+
continue;
|
|
38632
|
+
}
|
|
38633
|
+
const path = join(target, file.name);
|
|
38634
|
+
if (io.kind(path) === "link") {
|
|
38635
|
+
rows.push(row$5(file.name, "fail", `${path} is a symbolic link; it will not be written through`));
|
|
38636
|
+
continue;
|
|
38637
|
+
}
|
|
38638
|
+
const current = io.read(path);
|
|
38639
|
+
const same = current !== void 0 && Buffer.from(current).equals(Buffer.from(data));
|
|
38640
|
+
planned.push({
|
|
38641
|
+
name: file.name,
|
|
38642
|
+
data,
|
|
38643
|
+
state: current === void 0 ? "new" : same ? "unchanged" : "changed"
|
|
38644
|
+
});
|
|
38645
|
+
}
|
|
38646
|
+
if (rows.some((r) => r.status === "fail")) return finish(rows);
|
|
38647
|
+
const pending = planned.filter((p) => p.state !== "unchanged");
|
|
38648
|
+
if (pending.length === 0) {
|
|
38649
|
+
for (const p of planned) rows.push(row$5(p.name, "ok", "unchanged"));
|
|
38650
|
+
rows.push(row$5("council", "ok", `already up to date in ${target}; nothing was changed`));
|
|
38651
|
+
return finish(rows, true);
|
|
38652
|
+
}
|
|
38653
|
+
if (dryRun) {
|
|
38654
|
+
for (const p of planned) rows.push(row$5(p.name, "skip", p.state === "unchanged" ? "unchanged" : `would copy to ${join(target, p.name)} (${p.state})`));
|
|
38655
|
+
return finish(rows, true);
|
|
38656
|
+
}
|
|
38657
|
+
if (!input.yes) {
|
|
38658
|
+
if (!(input.interactive ?? Boolean(process.stdin.isTTY))) throw new NonInteractiveError(`\`setup council\` copies ${pending.length} file(s) into ${target}; pass --yes to run it without asking, or --dry-run to preview`);
|
|
38659
|
+
if (!await (input.confirm ?? ((message) => confirm({
|
|
38660
|
+
message,
|
|
38661
|
+
default: false
|
|
38662
|
+
})))(`Copy ${pending.map((p) => p.name).join(" and ")} into ${target}?`)) {
|
|
38663
|
+
print(` ${style.skip("cancelled; nothing was changed")}`);
|
|
38664
|
+
return {
|
|
38665
|
+
status: "cancelled",
|
|
38666
|
+
rows: []
|
|
38667
|
+
};
|
|
38668
|
+
}
|
|
38669
|
+
}
|
|
38670
|
+
try {
|
|
38671
|
+
io.mkdir(target);
|
|
38672
|
+
} catch (err) {
|
|
38673
|
+
rows.push(row$5("plugin folder", "fail", describeError(err)));
|
|
38674
|
+
return finish(rows);
|
|
38675
|
+
}
|
|
38676
|
+
for (const p of planned) {
|
|
38677
|
+
if (p.state === "unchanged") {
|
|
38678
|
+
rows.push(row$5(p.name, "ok", "unchanged"));
|
|
38679
|
+
continue;
|
|
38680
|
+
}
|
|
38681
|
+
try {
|
|
38682
|
+
io.write(join(target, p.name), p.data);
|
|
38683
|
+
rows.push(row$5(p.name, "ok", `${p.state === "new" ? "copied" : "updated"} in ${target}`));
|
|
38684
|
+
} catch (err) {
|
|
38685
|
+
rows.push(row$5(p.name, "fail", describeError(err)));
|
|
38686
|
+
}
|
|
38687
|
+
}
|
|
38688
|
+
return finish(rows, true);
|
|
38689
|
+
}
|
|
38690
|
+
// src/commands/council-setup/council-setup.command.ts
|
|
38691
|
+
const councilSetupCommand = {
|
|
38692
|
+
command: "council",
|
|
38693
|
+
describe: "Install or update the Council Obsidian plugin in a vault (its built files, copied; never deleted)",
|
|
38694
|
+
builder: (y) => y.option("vault", {
|
|
38695
|
+
type: "string",
|
|
38696
|
+
describe: "The Obsidian vault folder (default: the folder of the configured ideas provider)"
|
|
38697
|
+
}).option("yes", {
|
|
38698
|
+
type: "boolean",
|
|
38699
|
+
describe: "Copy without asking (required without a terminal)"
|
|
38700
|
+
}),
|
|
38701
|
+
handler: async (argv) => {
|
|
38702
|
+
const tokens = tokenContext(argv.token);
|
|
38703
|
+
if (!tokens) return;
|
|
38704
|
+
const loaded = await loadConfig(argv.cwd);
|
|
38705
|
+
applyResolvedConfig(argv, loaded.resolved);
|
|
38706
|
+
const root = findRootSync(argv.cwd, "pnpm-workspace.yaml", { fallback: "start" });
|
|
38707
|
+
if ((await runCouncilSetup({
|
|
38708
|
+
loaded,
|
|
38709
|
+
context: {
|
|
38710
|
+
repoRoot: argv.cwd,
|
|
38711
|
+
dryRun: argv.dryRun,
|
|
38712
|
+
...tokens,
|
|
38713
|
+
org: resolveOrg(argv, loaded.resolved)
|
|
38714
|
+
},
|
|
38715
|
+
councilDir: join(root, "apps", "council"),
|
|
38716
|
+
...argv.vault ? { vault: argv.vault } : {},
|
|
38717
|
+
...argv.yes ? { yes: true } : {}
|
|
38718
|
+
})).status === "fail") process.exitCode = 1;
|
|
38719
|
+
}
|
|
38720
|
+
};
|
|
38333
38721
|
// src/commands/notifications-setup/notifications-setup.args.ts
|
|
38334
38722
|
const notificationsSetupArgs = (y) => y.option("scope", {
|
|
38335
38723
|
type: "string",
|
|
@@ -38462,7 +38850,7 @@ const setupArgs = (y) => y.option("repo", {
|
|
|
38462
38850
|
const setupCommand = {
|
|
38463
38851
|
command: "setup",
|
|
38464
38852
|
describe: "Apply infra setup actions across every configured capability",
|
|
38465
|
-
builder: (y) => setupArgs(y).command(notificationsSetupCommand).command(projectSetupCommand),
|
|
38853
|
+
builder: (y) => setupArgs(y).command(notificationsSetupCommand).command(councilSetupCommand).command(projectSetupCommand),
|
|
38466
38854
|
handler: async (argv) => {
|
|
38467
38855
|
const tokens = tokenContext(argv.token);
|
|
38468
38856
|
if (!tokens) return;
|
|
@@ -38791,27 +39179,6 @@ const startCommand = {
|
|
|
38791
39179
|
builder: (y) => y.command(startWorkCommand).command(startAgentCommand).command(groupMenu("start")),
|
|
38792
39180
|
handler: () => {}
|
|
38793
39181
|
};
|
|
38794
|
-
// src/commands/ideas-sync/resolve-ideas-provider/resolve-ideas-provider.ts
|
|
38795
|
-
/**
|
|
38796
|
-
* The `ideas` provider `sync ideas` reads through: `providers.ideas` when the config names one. A config written
|
|
38797
|
-
* before the capability has only `ideas.dir` (#2004), so that, or `HOLOCRON_IDEAS_DIR` alone, reads as
|
|
38798
|
-
* `["obsidian", { dir }]`, the way a `HOLOCRON_` variable falls back to the bare name. `providers.ideas` wins over
|
|
38799
|
-
* `ideas.dir`. `undefined` when the config names no place for ideas at all.
|
|
38800
|
-
*/
|
|
38801
|
-
function resolveIdeasProvider(resolved, env) {
|
|
38802
|
-
const own = resolved.providers.ideas;
|
|
38803
|
-
if (own) return own;
|
|
38804
|
-
const dir = resolved.ideas?.dir;
|
|
38805
|
-
if (dir === void 0 && holocronEnv(env).get("IDEAS_DIR") === void 0) return void 0;
|
|
38806
|
-
return {
|
|
38807
|
-
cardinality: "single",
|
|
38808
|
-
tuple: {
|
|
38809
|
-
provider: "obsidian",
|
|
38810
|
-
packageName: resolvePluginPackage("obsidian"),
|
|
38811
|
-
options: dir === void 0 ? {} : { dir }
|
|
38812
|
-
}
|
|
38813
|
-
};
|
|
38814
|
-
}
|
|
38815
39182
|
// src/commands/ideas-sync/run-ideas-sync/oldest-issue-key/oldest-issue-key.ts
|
|
38816
39183
|
/**
|
|
38817
39184
|
* The key of the oldest issue among `keys`, which is the one that wins when overlapping runs filed the same idea.
|
|
@@ -38905,6 +39272,73 @@ async function convergeCreatedIssue(issues, marker, created) {
|
|
|
38905
39272
|
detail: `filed as ${winner} (closed duplicate ${created} from an overlapping run)`
|
|
38906
39273
|
};
|
|
38907
39274
|
}
|
|
39275
|
+
// src/commands/ideas-sync/run-ideas-sync/issue-body/issue-body.ts
|
|
39276
|
+
/**
|
|
39277
|
+
* The hidden line that ties an issue to its note. A later run looks for it before it creates an issue, so a note whose
|
|
39278
|
+
* `issue:` could not be written is not filed twice.
|
|
39279
|
+
*/
|
|
39280
|
+
const ideaMarker = (key) => `<!-- holocron:idea ${key} -->`;
|
|
39281
|
+
/**
|
|
39282
|
+
* The issue's body: the idea's text, a footer saying it came from Obsidian (the vault's name when the provider knows
|
|
39283
|
+
* it, the note's path inside the ideas folder and the day it was filed, never a folder's own path), the line that
|
|
39284
|
+
* traces the issue to its idea, and the hidden marker, which stays last.
|
|
39285
|
+
*/
|
|
39286
|
+
function issueBody(idea, filedOn) {
|
|
39287
|
+
const vault = idea.vault === void 0 ? "" : `vault \`${idea.vault}\`, `;
|
|
39288
|
+
return [
|
|
39289
|
+
idea.body.trim(),
|
|
39290
|
+
"",
|
|
39291
|
+
"---",
|
|
39292
|
+
`Filed from Obsidian: ${vault}note \`${idea.key}\`, ${filedOn}`,
|
|
39293
|
+
"",
|
|
39294
|
+
`Filed from idea: ${idea.title}`,
|
|
39295
|
+
ideaMarker(idea.key)
|
|
39296
|
+
].join("\n");
|
|
39297
|
+
}
|
|
39298
|
+
// src/commands/ideas-sync/run-ideas-sync/issue-title/issue-title.ts
|
|
39299
|
+
/** The Conventional Commits types a note's `type:` may name. */
|
|
39300
|
+
const CONVENTIONAL_TYPES = [
|
|
39301
|
+
"feat",
|
|
39302
|
+
"fix",
|
|
39303
|
+
"docs",
|
|
39304
|
+
"style",
|
|
39305
|
+
"refactor",
|
|
39306
|
+
"perf",
|
|
39307
|
+
"test",
|
|
39308
|
+
"build",
|
|
39309
|
+
"ci",
|
|
39310
|
+
"chore",
|
|
39311
|
+
"revert"
|
|
39312
|
+
];
|
|
39313
|
+
/** The type used when a note names none. */
|
|
39314
|
+
const DEFAULT_TYPE = "feat";
|
|
39315
|
+
const PREFIXED = new RegExp(`^(${CONVENTIONAL_TYPES.join("|")})(\\([^()\\s]+\\))?!?:\\s`);
|
|
39316
|
+
const SCOPE = /^[a-z0-9][a-z0-9._/-]*$/i;
|
|
39317
|
+
/**
|
|
39318
|
+
* The issue title for an idea: its heading as a Conventional Commits title, `type(scope): text`. The type and scope are
|
|
39319
|
+
* the note's `type:` and `scope:` properties (default type `feat`, no scope). A heading that already starts with a
|
|
39320
|
+
* conventional prefix is left as it is. An unknown `type:` (or a `scope:` with characters a scope cannot hold) is a
|
|
39321
|
+
* problem, so the note is not filed.
|
|
39322
|
+
*/
|
|
39323
|
+
function issueTitle(idea) {
|
|
39324
|
+
const type = idea.type ?? DEFAULT_TYPE;
|
|
39325
|
+
if (!CONVENTIONAL_TYPES.includes(type)) return {
|
|
39326
|
+
ok: false,
|
|
39327
|
+
problem: `unknown \`type: ${type}\`; use one of ${CONVENTIONAL_TYPES.join(", ")}. Nothing was filed`
|
|
39328
|
+
};
|
|
39329
|
+
if (idea.scope !== void 0 && !SCOPE.test(idea.scope)) return {
|
|
39330
|
+
ok: false,
|
|
39331
|
+
problem: `\`scope: ${idea.scope}\` is not a scope (letters, digits, \`.\`, \`_\`, \`/\` and \`-\`). Nothing was filed`
|
|
39332
|
+
};
|
|
39333
|
+
if (PREFIXED.test(idea.title)) return {
|
|
39334
|
+
ok: true,
|
|
39335
|
+
title: idea.title
|
|
39336
|
+
};
|
|
39337
|
+
return {
|
|
39338
|
+
ok: true,
|
|
39339
|
+
title: `${type}${idea.scope === void 0 ? "" : `(${idea.scope})`}: ${idea.title}`
|
|
39340
|
+
};
|
|
39341
|
+
}
|
|
38908
39342
|
// src/commands/ideas-sync/run-ideas-sync/run-ideas-sync.ts
|
|
38909
39343
|
/**
|
|
38910
39344
|
* `holocron sync ideas` — files the idea notes that are ready.
|
|
@@ -38913,7 +39347,9 @@ async function convergeCreatedIssue(issues, marker, created) {
|
|
|
38913
39347
|
* Obsidian plugin skips folders whose name starts with `_` or `.`). An idea whose status is the filing state (default
|
|
38914
39348
|
* `in-progress`) and that has no issue becomes an issue through the repo's `issues` provider, and the issue is then
|
|
38915
39349
|
* recorded with `Ideas.markFiled` (for Obsidian, an `issue:` property in the tracker's own syntax), which is what makes
|
|
38916
|
-
* the step run once.
|
|
39350
|
+
* the step run once. The issue's title is the note's heading as a Conventional Commits title (`type(scope): text`, from the
|
|
39351
|
+
* note's `type:` and `scope:` properties, default `feat`; a heading with a prefix is kept, an unknown `type:` is a failing
|
|
39352
|
+
* row), and its body ends with a footer naming the note's path and the day it was filed. An idea with attachments is reported and skipped, since an issue body cannot carry them. Only
|
|
38917
39353
|
* ideas to be filed, and ideas that need the person's attention, get a row; the rest are counted. The issue body ends
|
|
38918
39354
|
* with a hidden `<!-- holocron:idea <key> -->` line, and an issue that carries it is reused instead of making a second
|
|
38919
39355
|
* one (found with one `Issues.search({ text })` per note about to be filed, confirmed by the exact marker in the body;
|
|
@@ -38932,13 +39368,6 @@ const row$3 = (id, status, detail) => ({
|
|
|
38932
39368
|
detail,
|
|
38933
39369
|
problems: []
|
|
38934
39370
|
});
|
|
38935
|
-
/**
|
|
38936
|
-
* The hidden line that ties an issue to its note. A later run looks for it before it creates an issue, so a note whose
|
|
38937
|
-
* `issue:` could not be written is not filed twice.
|
|
38938
|
-
*/
|
|
38939
|
-
const marker = (key) => `<!-- holocron:idea ${key} -->`;
|
|
38940
|
-
/** The issue's body: the idea's text, the line that traces the issue to its idea, and the hidden marker. */
|
|
38941
|
-
const issueBody = (idea) => `${idea.body.trim()}\n\nFiled from idea: ${idea.title}\n${marker(idea.key)}`;
|
|
38942
39371
|
async function runIdeasSync(input) {
|
|
38943
39372
|
/* v8 ignore next -- the console is only used outside tests, which inject `print` */
|
|
38944
39373
|
const print = input.print ?? ((line) => console.log(line));
|
|
@@ -38980,13 +39409,20 @@ async function runIdeasSync(input) {
|
|
|
38980
39409
|
const fileState = input.loaded.resolved.ideas?.states?.file ?? DEFAULT_FILING_STATE;
|
|
38981
39410
|
const rows = [];
|
|
38982
39411
|
const ready = [];
|
|
39412
|
+
const titles = /* @__PURE__ */ new Map();
|
|
38983
39413
|
for (const idea of records) if (idea.error !== void 0) rows.push(row$3(idea.key, "fail", idea.error));
|
|
38984
39414
|
else if (idea.status !== fileState || idea.issue !== void 0) notReady++;
|
|
38985
39415
|
else if (idea.attachments.length > 0) rows.push(row$3(idea.key, "skip", `has embedded files an issue cannot carry (${idea.attachments.join(", ")}); not filed`));
|
|
38986
|
-
else
|
|
39416
|
+
else {
|
|
39417
|
+
const title = issueTitle(idea);
|
|
39418
|
+
if (title.ok) {
|
|
39419
|
+
titles.set(idea.key, title.title);
|
|
39420
|
+
ready.push(idea);
|
|
39421
|
+
} else rows.push(row$3(idea.key, "fail", title.problem));
|
|
39422
|
+
}
|
|
38987
39423
|
if (ready.length === 0) return finish(rows);
|
|
38988
39424
|
if (dryRun) {
|
|
38989
|
-
for (const idea of ready) rows.push(row$3(idea.key, "skip", `would file "${idea.
|
|
39425
|
+
for (const idea of ready) rows.push(row$3(idea.key, "skip", `would file "${titles.get(idea.key)}"`));
|
|
38990
39426
|
return finish(rows.sort((a, b) => a.id.localeCompare(b.id)));
|
|
38991
39427
|
}
|
|
38992
39428
|
if (!input.yes) {
|
|
@@ -39007,6 +39443,7 @@ async function runIdeasSync(input) {
|
|
|
39007
39443
|
await loader.load();
|
|
39008
39444
|
assertPluginsResolvable(loader, "sync ideas");
|
|
39009
39445
|
const issues = loader.has("issues") ? loader.get("issues") : void 0;
|
|
39446
|
+
const filedOn = (input.now?.() ?? /* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
39010
39447
|
for (const idea of ready) {
|
|
39011
39448
|
const path = idea.key;
|
|
39012
39449
|
if (!issues) {
|
|
@@ -39016,9 +39453,9 @@ async function runIdeasSync(input) {
|
|
|
39016
39453
|
let existing;
|
|
39017
39454
|
try {
|
|
39018
39455
|
existing = pickCanonicalIssue((await issues.search({
|
|
39019
|
-
text:
|
|
39456
|
+
text: ideaMarker(path),
|
|
39020
39457
|
limit: 100
|
|
39021
|
-
})).filter((issue) => issue.body?.includes(
|
|
39458
|
+
})).filter((issue) => issue.body?.includes(ideaMarker(path))));
|
|
39022
39459
|
} catch (err) {
|
|
39023
39460
|
rows.push(row$3(path, "fail", `could not check for an existing issue, so none was created: ${describeError(err)}`));
|
|
39024
39461
|
continue;
|
|
@@ -39031,14 +39468,14 @@ async function runIdeasSync(input) {
|
|
|
39031
39468
|
let created;
|
|
39032
39469
|
try {
|
|
39033
39470
|
({key: created} = await issues.create({
|
|
39034
|
-
summary:
|
|
39035
|
-
body: issueBody(idea)
|
|
39471
|
+
summary: titles.get(path),
|
|
39472
|
+
body: issueBody(idea, filedOn)
|
|
39036
39473
|
}));
|
|
39037
39474
|
} catch (err) {
|
|
39038
39475
|
rows.push(row$3(path, "fail", `could not create the issue: ${describeError(err)}`));
|
|
39039
39476
|
continue;
|
|
39040
39477
|
}
|
|
39041
|
-
({key, detail, warning} = await convergeCreatedIssue(issues,
|
|
39478
|
+
({key, detail, warning} = await convergeCreatedIssue(issues, ideaMarker(path), created));
|
|
39042
39479
|
}
|
|
39043
39480
|
try {
|
|
39044
39481
|
await ideas.markFiled(path, key);
|