@theholocron/cli 5.0.0-alpha.576 → 5.0.0-alpha.578
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 +5 -0
- package/dist/cli.mjs +754 -449
- package/dist/cli.mjs.map +1 -1
- package/dist/{index-DuoivgJw.d.mts → index-Dlbdbi0a.d.mts} +8 -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 +6 -6
package/dist/cli.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import { ProviderApiError, ProviderApiError as ProviderApiError$1, createRestCli
|
|
|
8
8
|
import { addGlobalOptions, groupMenu as groupMenu$1, tokenContext as tokenContext$1 } from "@theholocron/kyber/flags";
|
|
9
9
|
import { DRY_RUN_NOOP_EXIT_CODE, createCommandRegistry, createMenu, dryRunPreviewEnvVar, numeric, spawnChild } from "@theholocron/kyber/menu";
|
|
10
10
|
import { checkForUpdates } from "@theholocron/kyber/notifier";
|
|
11
|
-
import { NonInteractiveError, commandFailureMessage, createProgress, createRetryNotice, declaredVsActual, describeError, logReason, openPath, pad as pad$1, printCheckRows, printCheckSummary, sanitizeDetail, setProgressListener, statusRow as statusRow$1, stripControl, style, summariseChecks, viewJson, withProgress, withSpinner } from "@theholocron/kyber/ui";
|
|
11
|
+
import { NonInteractiveError, commandFailureMessage, createProgress, createRetryNotice, declaredVsActual, describeError, logReason, openPath, pad as pad$1, printCheckRows, printCheckSummary, sanitizeDetail, setProgressListener, startCommandProgress, statusRow as statusRow$1, stopCommandSpinner, stripControl, style, summariseChecks, viewJson, withProgress, withSpinner } from "@theholocron/kyber/ui";
|
|
12
12
|
import { LOG_LEVELS } from "@theholocron/observability/core";
|
|
13
13
|
import yargs from "yargs";
|
|
14
14
|
import { hideBin } from "yargs/helpers";
|
|
@@ -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
|
}
|
|
@@ -20793,7 +20798,7 @@ async function variableRows(loader, config, org) {
|
|
|
20793
20798
|
if (!loader.has("source")) {
|
|
20794
20799
|
const why = whyMissing(loader, "source", "no `source` provider to read them with");
|
|
20795
20800
|
for (const check of checks) {
|
|
20796
|
-
rows.push(row$
|
|
20801
|
+
rows.push(row$22(check, { skip: why }));
|
|
20797
20802
|
observations.push({
|
|
20798
20803
|
scope: check.scope,
|
|
20799
20804
|
unread: why
|
|
@@ -20803,7 +20808,7 @@ async function variableRows(loader, config, org) {
|
|
|
20803
20808
|
const source = loader.get("source");
|
|
20804
20809
|
for (const check of checks) try {
|
|
20805
20810
|
const result = await check.run(source);
|
|
20806
|
-
rows.push(row$
|
|
20811
|
+
rows.push(row$22(check, result));
|
|
20807
20812
|
observations.push("skip" in result ? {
|
|
20808
20813
|
scope: check.scope,
|
|
20809
20814
|
unread: result.skip
|
|
@@ -20814,7 +20819,7 @@ async function variableRows(loader, config, org) {
|
|
|
20814
20819
|
} catch (err) {
|
|
20815
20820
|
const noToken = missingTokenReason(err);
|
|
20816
20821
|
if (noToken !== void 0) {
|
|
20817
|
-
rows.push(row$
|
|
20822
|
+
rows.push(row$22(check, { skip: noToken }));
|
|
20818
20823
|
observations.push({
|
|
20819
20824
|
scope: check.scope,
|
|
20820
20825
|
unread: noToken
|
|
@@ -20840,7 +20845,7 @@ async function variableRows(loader, config, org) {
|
|
|
20840
20845
|
observations
|
|
20841
20846
|
};
|
|
20842
20847
|
}
|
|
20843
|
-
function row$
|
|
20848
|
+
function row$22(check, result) {
|
|
20844
20849
|
const { id, title } = check;
|
|
20845
20850
|
if ("skip" in result) return {
|
|
20846
20851
|
id,
|
|
@@ -20930,7 +20935,7 @@ function describeExpiry(expiresAt, now) {
|
|
|
20930
20935
|
*
|
|
20931
20936
|
* What a token may do is not checked: GitHub does not return a fine-grained token's permissions.
|
|
20932
20937
|
*/
|
|
20933
|
-
function row$
|
|
20938
|
+
function row$21(id, status, detail) {
|
|
20934
20939
|
return {
|
|
20935
20940
|
id: `verify:${id}`,
|
|
20936
20941
|
title: `verify ${id}`,
|
|
@@ -20958,12 +20963,12 @@ async function verifyRows(input) {
|
|
|
20958
20963
|
try {
|
|
20959
20964
|
module = await importer(pkg);
|
|
20960
20965
|
} catch (err) {
|
|
20961
|
-
rows.push(row$
|
|
20966
|
+
rows.push(row$21(pkg, "skip", `cannot load the plugin: ${errorMessage(err)}`));
|
|
20962
20967
|
continue;
|
|
20963
20968
|
}
|
|
20964
20969
|
for (const token of module.tokens ?? []) rows.push(await checkToken(token, module, env, readToken, now()));
|
|
20965
20970
|
}
|
|
20966
|
-
if (rows.length === 0) rows.push(row$
|
|
20971
|
+
if (rows.length === 0) rows.push(row$21("tokens", "skip", "no configured plugin lists the tokens it takes"));
|
|
20967
20972
|
return rows;
|
|
20968
20973
|
}
|
|
20969
20974
|
/**
|
|
@@ -20976,30 +20981,30 @@ async function loadCredentials(input) {
|
|
|
20976
20981
|
try {
|
|
20977
20982
|
await input.loader.load();
|
|
20978
20983
|
} catch (err) {
|
|
20979
|
-
return [row$
|
|
20984
|
+
return [row$21("credentials", "skip", `could not load the credentials providers: ${errorMessage(err)}`)];
|
|
20980
20985
|
}
|
|
20981
|
-
return input.loader.loadFailures().filter((failure) => failure.key === "credentials").map((failure) => row$
|
|
20986
|
+
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
20987
|
}
|
|
20983
20988
|
async function checkToken(token, module, env, readToken, now) {
|
|
20984
20989
|
const { keyringKey, envName, vendorEnvName } = token;
|
|
20985
20990
|
const fromEnv = env.get(envName) ? envName : vendorEnvName && env.get(vendorEnvName) ? vendorEnvName : void 0;
|
|
20986
20991
|
const stored = fromEnv ? void 0 : findCredential(...vendorEnvName ? [envName, vendorEnvName] : [envName]);
|
|
20987
20992
|
const value = fromEnv ? env.get(fromEnv) : stored?.value ?? readToken(keyringKey);
|
|
20988
|
-
if (!value) return row$
|
|
20993
|
+
if (!value) return row$21(keyringKey, "skip", `not set (${vendorEnvName ? `${envName} / ${vendorEnvName}` : envName}, or \`holocron new token ${keyringKey}\`)`);
|
|
20989
20994
|
const verify = token.verify ?? (token.verifiable === false ? void 0 : module.verifyToken);
|
|
20990
|
-
if (!verify) return row$
|
|
20995
|
+
if (!verify) return row$21(keyringKey, "skip", "set, but its plugin cannot verify it");
|
|
20991
20996
|
const from = fromEnv ?? stored?.source ?? "keyring";
|
|
20992
20997
|
try {
|
|
20993
20998
|
const verified = await verify(value);
|
|
20994
|
-
if (!verified.ok) return row$
|
|
20999
|
+
if (!verified.ok) return row$21(keyringKey, "fail", `rejected (${from}): ${verified.message}`);
|
|
20995
21000
|
const expiry = verified.expiresAt ? describeExpiry(verified.expiresAt, now) : void 0;
|
|
20996
|
-
if (!expiry) return row$
|
|
21001
|
+
if (!expiry) return row$21(keyringKey, "ok", `${verified.subject} (${from})`);
|
|
20997
21002
|
return expiry.soon ? {
|
|
20998
|
-
...row$
|
|
21003
|
+
...row$21(keyringKey, "fail", `${verified.subject} (${from}), ${expiry.text}`),
|
|
20999
21004
|
problems: [`${expiry.text}: renew it`]
|
|
21000
|
-
} : row$
|
|
21005
|
+
} : row$21(keyringKey, "ok", `${verified.subject} (${from}), ${expiry.text}`);
|
|
21001
21006
|
} catch (err) {
|
|
21002
|
-
return row$
|
|
21007
|
+
return row$21(keyringKey, "fail", `could not be verified (${from}): ${errorMessage(err)}`);
|
|
21003
21008
|
}
|
|
21004
21009
|
}
|
|
21005
21010
|
// src/commands/doctor-secrets/doctor-secrets.ts
|
|
@@ -21490,7 +21495,7 @@ function summariseProbeRows(id, title, rows) {
|
|
|
21490
21495
|
* provider with no `token` probe, no declared layer, or one that cannot be read is a skip with the reason.
|
|
21491
21496
|
*/
|
|
21492
21497
|
const PROBE = "token";
|
|
21493
|
-
const row$
|
|
21498
|
+
const row$20 = (id, title, status, detail, problems = []) => ({
|
|
21494
21499
|
id,
|
|
21495
21500
|
title,
|
|
21496
21501
|
status,
|
|
@@ -21515,12 +21520,12 @@ async function runDoctorTokens(input) {
|
|
|
21515
21520
|
try {
|
|
21516
21521
|
tokens = await providerTokens(provider);
|
|
21517
21522
|
} catch (err) {
|
|
21518
|
-
rows.push(row$
|
|
21523
|
+
rows.push(row$20(`tokens:${provider}`, provider, "skip", `could not read its tokens: ${describeError(err)}`));
|
|
21519
21524
|
continue;
|
|
21520
21525
|
}
|
|
21521
21526
|
const expectations = tokenExpectations(tokens);
|
|
21522
|
-
if (expectations.length === 0) rows.push(row$
|
|
21523
|
-
else if (!usableProbe(probes.get(provider))) rows.push(row$
|
|
21527
|
+
if (expectations.length === 0) rows.push(row$20(`tokens:${provider}`, provider, "skip", "info: declares no token layers, nothing to check"));
|
|
21528
|
+
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
21529
|
else declared.push({
|
|
21525
21530
|
provider,
|
|
21526
21531
|
tokens,
|
|
@@ -21582,14 +21587,14 @@ async function checkLayer(c) {
|
|
|
21582
21587
|
tokens
|
|
21583
21588
|
});
|
|
21584
21589
|
} catch (err) {
|
|
21585
|
-
if (err instanceof HoldsNoTokenError) return c.wanted.map((e) => row$
|
|
21586
|
-
return c.wanted.map((e) => row$
|
|
21590
|
+
if (err instanceof HoldsNoTokenError) return c.wanted.map((e) => row$20(id(e), title(e), "fail", "not held in this layer", [err.message]));
|
|
21591
|
+
return c.wanted.map((e) => row$20(id(e), title(e), "skip", `could not read the Environment: ${describeError(err)}`));
|
|
21587
21592
|
}
|
|
21588
21593
|
const rows = [];
|
|
21589
21594
|
for (const e of c.wanted) {
|
|
21590
21595
|
const token = held.held.find((h) => h.envName === e.envName);
|
|
21591
21596
|
if (!token) {
|
|
21592
|
-
rows.push(row$
|
|
21597
|
+
rows.push(row$20(id(e), title(e), "fail", `not held in ${held.environment}`, [`${e.envName} is declared for ${c.layer}`]));
|
|
21593
21598
|
continue;
|
|
21594
21599
|
}
|
|
21595
21600
|
rows.push(summariseProbeRows(id(e), title(e), await probeToken(c, e, token.token, held.plain)));
|
|
@@ -21662,7 +21667,7 @@ const doctorTokensCommand = {
|
|
|
21662
21667
|
}
|
|
21663
21668
|
};
|
|
21664
21669
|
// src/commands/doctor-wiki/wiki-rows.ts
|
|
21665
|
-
const row$
|
|
21670
|
+
const row$19 = (id, title, status, detail, problems = []) => ({
|
|
21666
21671
|
id,
|
|
21667
21672
|
title,
|
|
21668
21673
|
status,
|
|
@@ -21678,11 +21683,11 @@ const names = (paths) => paths.length > LISTED ? `${paths.slice(0, LISTED).join(
|
|
|
21678
21683
|
* skip, since a machine with no network says nothing about the site.
|
|
21679
21684
|
*/
|
|
21680
21685
|
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$
|
|
21686
|
+
if (probe.status === void 0) return row$19(id, title, "skip", `${probe.url}: ${probe.error ?? "no answer"}`);
|
|
21687
|
+
if (probe.status < 400) return row$19(id, title, "ok", `${probe.url} answers ${probe.status}`);
|
|
21688
|
+
if (probe.status === 401 || probe.status === 403) return row$19(id, title, "ok", `${probe.url} answers ${probe.status} (access is restricted)`);
|
|
21684
21689
|
const problem = probe.status === 404 ? `${probe.url} answers 404; ${notFoundHint}` : `${probe.url} answers ${probe.status}, expected a page`;
|
|
21685
|
-
return row$
|
|
21690
|
+
return row$19(id, title, "fail", `${probe.url} answers ${probe.status}`, [problem]);
|
|
21686
21691
|
}
|
|
21687
21692
|
/**
|
|
21688
21693
|
* The rows `holocron doctor wiki` prints for one {@link WikiInspection}: organization, docs instance, the site and its
|
|
@@ -21694,42 +21699,42 @@ function wikiRows(found, providerName) {
|
|
|
21694
21699
|
const { declared, found: foundOrg } = found.organization;
|
|
21695
21700
|
if (foundOrg === null) {
|
|
21696
21701
|
const problem = `fern/fern.config.json has no organization; \`holocron setup\` writes it`;
|
|
21697
|
-
rows.push(row$
|
|
21702
|
+
rows.push(row$19("wiki:organization", "organization is set", "fail", problem, [problem]));
|
|
21698
21703
|
} else if (foundOrg !== declared) {
|
|
21699
21704
|
const problem = `fern/fern.config.json names ${foundOrg}, the config declares ${declared}; run \`holocron setup\``;
|
|
21700
|
-
rows.push(row$
|
|
21701
|
-
} else rows.push(row$
|
|
21705
|
+
rows.push(row$19("wiki:organization", "organization is set", "fail", `${foundOrg}, declared ${declared}`, [problem]));
|
|
21706
|
+
} else rows.push(row$19("wiki:organization", "organization is set", "ok", `${declared} in fern/fern.config.json`));
|
|
21702
21707
|
const instance = found.instance;
|
|
21703
21708
|
if (instance === null) {
|
|
21704
21709
|
const problem = "fern/docs.yml does not exist; `holocron setup` writes it";
|
|
21705
|
-
rows.push(row$
|
|
21710
|
+
rows.push(row$19("wiki:instance", "docs site is declared", "fail", problem, [problem]));
|
|
21706
21711
|
} else {
|
|
21707
21712
|
const problems = [];
|
|
21708
21713
|
if (instance.foundUrl !== instance.expectedUrl) problems.push(`instance url is ${instance.foundUrl ?? "not set"}, expected ${instance.expectedUrl}`);
|
|
21709
21714
|
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$
|
|
21715
|
+
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
21716
|
}
|
|
21712
21717
|
const [site, domain] = found.site;
|
|
21713
21718
|
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
21719
|
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$
|
|
21720
|
+
if (found.navigation === null) rows.push(row$19("wiki:navigation", "navigation pages exist", "skip", "no fern/docs.yml to read"));
|
|
21716
21721
|
else if (found.navigation.missing.length > 0) {
|
|
21717
21722
|
const problems = found.navigation.missing.map((p) => `${p} is listed in fern/docs.yml but is not on disk`);
|
|
21718
|
-
rows.push(row$
|
|
21723
|
+
rows.push(row$19("wiki:navigation", "navigation pages exist", "fail", `${found.navigation.missing.length} missing`, problems));
|
|
21719
21724
|
} else {
|
|
21720
|
-
rows.push(row$
|
|
21721
|
-
if (found.navigation.unlisted.length > 0) rows.push(row$
|
|
21725
|
+
rows.push(row$19("wiki:navigation", "navigation pages exist", "ok", `${found.navigation.listed} listed pages exist`));
|
|
21726
|
+
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
21727
|
}
|
|
21723
21728
|
const published = found.published;
|
|
21724
21729
|
const listed = found.navigation?.listed;
|
|
21725
|
-
if (!published) rows.push(row$
|
|
21730
|
+
if (!published) rows.push(row$19("wiki:published", "published pages", "skip", "the site's page index could not be asked"));
|
|
21726
21731
|
else if (published.pages === void 0) {
|
|
21727
21732
|
const why = published.status === void 0 ? published.error ?? "no answer" : `answered ${published.status}`;
|
|
21728
|
-
rows.push(row$
|
|
21733
|
+
rows.push(row$19("wiki:published", "published pages", "skip", `${published.url}: ${why}`));
|
|
21729
21734
|
} else if (listed !== void 0 && published.pages < listed) {
|
|
21730
21735
|
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$
|
|
21736
|
+
rows.push(row$19("wiki:published", "published pages", "fail", `${published.pages} of ${listed}`, [problem]));
|
|
21737
|
+
} 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
21738
|
return rows;
|
|
21734
21739
|
}
|
|
21735
21740
|
// src/commands/doctor-wiki/doctor-wiki.ts
|
|
@@ -21835,7 +21840,7 @@ function readFailureRow(id, title, err) {
|
|
|
21835
21840
|
};
|
|
21836
21841
|
}
|
|
21837
21842
|
// src/commands/doctor-workers/check-project.ts
|
|
21838
|
-
const row$
|
|
21843
|
+
const row$18 = (id, title, status, detail, problems = []) => ({
|
|
21839
21844
|
id,
|
|
21840
21845
|
title,
|
|
21841
21846
|
status,
|
|
@@ -21864,30 +21869,30 @@ async function checkProject(deploy, declared) {
|
|
|
21864
21869
|
let exists = false;
|
|
21865
21870
|
try {
|
|
21866
21871
|
exists = (await deploy.listProjects()).some((p) => same$1(p.name, project) || p.id === project);
|
|
21867
|
-
rows.push(exists ? row$
|
|
21872
|
+
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
21873
|
} catch (err) {
|
|
21869
21874
|
rows.push(readFailureRow(ids.exists, titles.exists, err));
|
|
21870
21875
|
}
|
|
21871
21876
|
const notChecked = (reason) => `not checked: ${reason}`;
|
|
21872
21877
|
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$
|
|
21878
|
+
if (declared.hostname === void 0) {} else if (gone) rows.push(row$18(ids.domain, titles.domain, "skip", notChecked(gone)));
|
|
21879
|
+
else if (!deploy.listDomains) rows.push(row$18(ids.domain, titles.domain, "skip", `the \`${deploy.providerName}\` provider cannot list domains`));
|
|
21875
21880
|
else try {
|
|
21876
21881
|
const attached = await deploy.listDomains(project);
|
|
21877
|
-
rows.push(attached.some((d) => same$1(d, declared.hostname)) ? row$
|
|
21882
|
+
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
21883
|
} catch (err) {
|
|
21879
21884
|
rows.push(readFailureRow(ids.domain, titles.domain, err));
|
|
21880
21885
|
}
|
|
21881
|
-
if (gone) rows.push(row$
|
|
21882
|
-
else if (!deploy.latestDeployment) rows.push(row$
|
|
21886
|
+
if (gone) rows.push(row$18(ids.deploy, titles.deploy, "skip", notChecked(gone)));
|
|
21887
|
+
else if (!deploy.latestDeployment) rows.push(row$18(ids.deploy, titles.deploy, "skip", `the \`${deploy.providerName}\` provider cannot list deployments`));
|
|
21883
21888
|
else try {
|
|
21884
21889
|
const latest = await deploy.latestDeployment(project);
|
|
21885
|
-
if (!latest) rows.push(row$
|
|
21886
|
-
else if (latest.status === "ready") rows.push(row$
|
|
21890
|
+
if (!latest) rows.push(row$18(ids.deploy, titles.deploy, "skip", "no production deployment yet"));
|
|
21891
|
+
else if (latest.status === "ready") rows.push(row$18(ids.deploy, titles.deploy, "ok", latest.createdAt ? `ready, ${latest.createdAt}` : "ready"));
|
|
21887
21892
|
else if (latest.status === "error") {
|
|
21888
21893
|
const why = latest.errorMessage ? `: ${latest.errorMessage}` : "";
|
|
21889
|
-
rows.push(row$
|
|
21890
|
-
} else rows.push(row$
|
|
21894
|
+
rows.push(row$18(ids.deploy, titles.deploy, "fail", "the newest deployment errored", [`the newest production deployment of ${project} failed${why}`]));
|
|
21895
|
+
} else rows.push(row$18(ids.deploy, titles.deploy, "skip", `info: the newest deployment is ${latest.status}`));
|
|
21891
21896
|
} catch (err) {
|
|
21892
21897
|
rows.push(readFailureRow(ids.deploy, titles.deploy, err));
|
|
21893
21898
|
}
|
|
@@ -21895,7 +21900,7 @@ async function checkProject(deploy, declared) {
|
|
|
21895
21900
|
}
|
|
21896
21901
|
// src/commands/doctor-workers/check-worker.ts
|
|
21897
21902
|
const same = (a, b) => a.toLowerCase() === b.toLowerCase();
|
|
21898
|
-
const row$
|
|
21903
|
+
const row$17 = (id, title, status, detail, problems = []) => ({
|
|
21899
21904
|
id,
|
|
21900
21905
|
title,
|
|
21901
21906
|
status,
|
|
@@ -21920,9 +21925,9 @@ async function checkWorker(workers, worker) {
|
|
|
21920
21925
|
deploy: `${name} Worker's latest deployment is healthy`
|
|
21921
21926
|
};
|
|
21922
21927
|
const skipAll = (reason) => [
|
|
21923
|
-
row$
|
|
21924
|
-
row$
|
|
21925
|
-
row$
|
|
21928
|
+
row$17(ids.deployed, titles.deployed, "skip", reason),
|
|
21929
|
+
row$17(ids.bindings, titles.bindings, "skip", reason),
|
|
21930
|
+
row$17(ids.deploy, titles.deploy, "skip", reason)
|
|
21926
21931
|
];
|
|
21927
21932
|
if (worker.script === void 0) return skipAll(`${workers.providerName} does not say how it names this Worker`);
|
|
21928
21933
|
const script = worker.script;
|
|
@@ -21935,29 +21940,29 @@ async function checkWorker(workers, worker) {
|
|
|
21935
21940
|
exists = state.exists;
|
|
21936
21941
|
if (!state.exists) {
|
|
21937
21942
|
const problem = `no Worker named ${script}; \`holocron setup\` deploys it`;
|
|
21938
|
-
rows.push(row$
|
|
21943
|
+
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
21944
|
} else {
|
|
21940
|
-
rows.push(state.routes.some((r) => same(r, route)) ? row$
|
|
21941
|
-
if (worker.bindings.length === 0) rows.push(row$
|
|
21945
|
+
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}`]));
|
|
21946
|
+
if (worker.bindings.length === 0) rows.push(row$17(ids.bindings, titles.bindings, "ok", "none declared"));
|
|
21942
21947
|
else {
|
|
21943
21948
|
const bound = new Set(state.bindingNames.map((n) => n.toUpperCase()));
|
|
21944
21949
|
const missing = worker.bindings.filter((n) => !bound.has(n.toUpperCase()));
|
|
21945
|
-
rows.push(missing.length === 0 ? row$
|
|
21950
|
+
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
21951
|
}
|
|
21947
21952
|
}
|
|
21948
21953
|
} catch (err) {
|
|
21949
21954
|
const failure = readFailureRow(ids.deployed, titles.deployed, err);
|
|
21950
|
-
rows.push(failure, row$
|
|
21955
|
+
rows.push(failure, row$17(ids.bindings, titles.bindings, "skip", "not checked: could not read the Worker"));
|
|
21951
21956
|
}
|
|
21952
|
-
if (!exists) rows.push(row$
|
|
21953
|
-
else if (!workers.latestDeployment) rows.push(row$
|
|
21957
|
+
if (!exists) rows.push(row$17(ids.deploy, titles.deploy, "skip", "not checked: the Worker is not readable or not there"));
|
|
21958
|
+
else if (!workers.latestDeployment) rows.push(row$17(ids.deploy, titles.deploy, "skip", `the \`${workers.providerName}\` provider cannot list deployments`));
|
|
21954
21959
|
else try {
|
|
21955
21960
|
const latest = await workers.latestDeployment(script);
|
|
21956
|
-
if (!latest) rows.push(row$
|
|
21961
|
+
if (!latest) rows.push(row$17(ids.deploy, titles.deploy, "skip", `${script} has no recorded deployment`));
|
|
21957
21962
|
else if (!latest.active) {
|
|
21958
21963
|
const problem = `the newest deployment of ${script} does not serve all traffic`;
|
|
21959
|
-
rows.push(row$
|
|
21960
|
-
} else rows.push(row$
|
|
21964
|
+
rows.push(row$17(ids.deploy, titles.deploy, "fail", "not serving all traffic", [problem]));
|
|
21965
|
+
} else rows.push(row$17(ids.deploy, titles.deploy, "ok", latest.createdAt ? `deployed ${latest.createdAt}` : "serving all traffic"));
|
|
21961
21966
|
} catch (err) {
|
|
21962
21967
|
rows.push(readFailureRow(ids.deploy, titles.deploy, err));
|
|
21963
21968
|
}
|
|
@@ -22021,7 +22026,7 @@ function declaredWorkers(input) {
|
|
|
22021
22026
|
* custom domain is attached, and the newest production deployment is ready. Only what the provider proves wrong
|
|
22022
22027
|
* fails; a missing token, a 401 or 403, or a provider that cannot read it is a skip with the reason.
|
|
22023
22028
|
*/
|
|
22024
|
-
const row$
|
|
22029
|
+
const row$16 = (id, title, status, detail) => ({
|
|
22025
22030
|
id,
|
|
22026
22031
|
title,
|
|
22027
22032
|
status,
|
|
@@ -22047,12 +22052,12 @@ async function runDoctorWorkers(input) {
|
|
|
22047
22052
|
...loader.has("wiki") ? { wiki: loader.get("wiki") } : {},
|
|
22048
22053
|
...workers ? { workers } : {}
|
|
22049
22054
|
});
|
|
22050
|
-
if (declared.length === 0) rows.push(row$
|
|
22055
|
+
if (declared.length === 0) rows.push(row$16("workers", "declared Workers", "ok", "none declared"));
|
|
22051
22056
|
else if (!workers) {
|
|
22052
22057
|
const why = whyNone(loader, "workers", "no `workers` provider is configured in holocron.config.ts");
|
|
22053
|
-
for (const worker of declared) rows.push(row$
|
|
22058
|
+
for (const worker of declared) rows.push(row$16(`workers:${worker.label}`, `${worker.label} Worker`, "skip", why));
|
|
22054
22059
|
} else for (const worker of declared) rows.push(...await checkWorker(workers, worker));
|
|
22055
|
-
if (!loader.has("deployment")) rows.push(row$
|
|
22060
|
+
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
22061
|
else {
|
|
22057
22062
|
const deploy = loader.get("deployment");
|
|
22058
22063
|
for (const project of declaredProjects(input.loaded.resolved, deploy)) rows.push(...await checkProject(deploy, project));
|
|
@@ -23049,7 +23054,7 @@ function resolveExportDir(input) {
|
|
|
23049
23054
|
* listed under the provider's row and does not fail the run. It writes files, so it asks first unless `--dry-run` (the
|
|
23050
23055
|
* files are converted and listed, nothing is written) or `--yes` (without a terminal it refuses instead).
|
|
23051
23056
|
*/
|
|
23052
|
-
const row$
|
|
23057
|
+
const row$15 = (id, status, detail, problems = []) => ({
|
|
23053
23058
|
id,
|
|
23054
23059
|
title: id,
|
|
23055
23060
|
status,
|
|
@@ -23091,9 +23096,9 @@ async function runRequestsExport(input) {
|
|
|
23091
23096
|
print("");
|
|
23092
23097
|
const entry = input.loaded.resolved.providers.tooling;
|
|
23093
23098
|
const tuples = entry?.cardinality === "many" ? entry.tuples : [];
|
|
23094
|
-
if (tuples.length === 0) return finish([row$
|
|
23099
|
+
if (tuples.length === 0) return finish([row$15("tooling", "fail", "the config has no `tooling` provider to export for")]);
|
|
23095
23100
|
const chosen = input.to === void 0 ? tuples : tuples.filter((t) => t.provider === input.to);
|
|
23096
|
-
if (chosen.length === 0) return finish([row$
|
|
23101
|
+
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
23102
|
/* v8 ignore start -- the real loader is only built outside tests, which always inject one */
|
|
23098
23103
|
const loader = input.loader ?? new PluginLoader({
|
|
23099
23104
|
...input.loaded.resolved,
|
|
@@ -23113,17 +23118,17 @@ async function runRequestsExport(input) {
|
|
|
23113
23118
|
const tool = loaded.find((t) => t.providerName === id);
|
|
23114
23119
|
if (!tool) {
|
|
23115
23120
|
const failure = loader.loadFailures().find((f) => f.key === "tooling" && f.provider === id);
|
|
23116
|
-
rows.push(row$
|
|
23121
|
+
rows.push(row$15(id, "fail", `the provider is not available${failure ? ` (${describeError(failure.error)})` : ""}`));
|
|
23117
23122
|
continue;
|
|
23118
23123
|
}
|
|
23119
23124
|
if (!tool.export) {
|
|
23120
|
-
rows.push(row$
|
|
23125
|
+
rows.push(row$15(id, "skip", "has no export: it reads the repo's files as they are"));
|
|
23121
23126
|
continue;
|
|
23122
23127
|
}
|
|
23123
23128
|
const collectionFiles = fileList$1(tuple.options.collectionFiles);
|
|
23124
23129
|
const envFiles = fileList$1(tuple.options.envFiles);
|
|
23125
23130
|
if (collectionFiles.length === 0) {
|
|
23126
|
-
rows.push(row$
|
|
23131
|
+
rows.push(row$15(id, "skip", "names no `collectionFiles`, so there is nothing to export"));
|
|
23127
23132
|
continue;
|
|
23128
23133
|
}
|
|
23129
23134
|
const groups = input.out === void 0 ? groupByFolder(collectionFiles) : [collectionFiles];
|
|
@@ -23137,7 +23142,7 @@ async function runRequestsExport(input) {
|
|
|
23137
23142
|
...input.out !== void 0 ? { out: input.out } : {}
|
|
23138
23143
|
});
|
|
23139
23144
|
if (!dir.ok) {
|
|
23140
|
-
rows.push(row$
|
|
23145
|
+
rows.push(row$15(label, "fail", dir.message));
|
|
23141
23146
|
continue;
|
|
23142
23147
|
}
|
|
23143
23148
|
targets.push({
|
|
@@ -23176,9 +23181,9 @@ async function runRequestsExport(input) {
|
|
|
23176
23181
|
const where = relative(repoRoot, outDir);
|
|
23177
23182
|
const files = result.files.length > 0 ? ` (${result.files.join(", ")})` : "";
|
|
23178
23183
|
paths.push(...result.files.map((file) => resolve(outDir, file)));
|
|
23179
|
-
rows.push(row$
|
|
23184
|
+
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
23185
|
} catch (err) {
|
|
23181
|
-
rows.push(row$
|
|
23186
|
+
rows.push(row$15(label, "fail", describeError(err)));
|
|
23182
23187
|
}
|
|
23183
23188
|
const report = finish(rows.sort((a, b) => a.id.localeCompare(b.id)));
|
|
23184
23189
|
if (paths.length > 0) {
|
|
@@ -27548,7 +27553,7 @@ function specName(title, name) {
|
|
|
27548
27553
|
*/
|
|
27549
27554
|
/** How many lines of the spec a dry run shows. */
|
|
27550
27555
|
const PREVIEW_LINES$1 = 12;
|
|
27551
|
-
const row$
|
|
27556
|
+
const row$14 = (id, status, detail) => ({
|
|
27552
27557
|
id,
|
|
27553
27558
|
title: id,
|
|
27554
27559
|
status,
|
|
@@ -27578,7 +27583,7 @@ async function runIdeasPromote(input) {
|
|
|
27578
27583
|
print(style.header(`Holocron new spec${dryRun ? " (dry-run)" : ""}`));
|
|
27579
27584
|
print("");
|
|
27580
27585
|
const entry = input.loaded.resolved.providers.issues;
|
|
27581
|
-
if (!entry) return finish([row$
|
|
27586
|
+
if (!entry) return finish([row$14(input.issue, "fail", "the config has no `issues` provider to read the issue with")]);
|
|
27582
27587
|
const credentials = input.loaded.resolved.providers.credentials;
|
|
27583
27588
|
/* v8 ignore start -- the real loader is only built outside tests, which always inject one */
|
|
27584
27589
|
const loader = input.loader ?? new PluginLoader({
|
|
@@ -27593,18 +27598,18 @@ async function runIdeasPromote(input) {
|
|
|
27593
27598
|
assertPluginsResolvable(loader, "new spec");
|
|
27594
27599
|
if (!loader.has("issues")) {
|
|
27595
27600
|
const failure = loader.loadFailures().find((f) => f.key === "issues");
|
|
27596
|
-
return finish([row$
|
|
27601
|
+
return finish([row$14(input.issue, "fail", `the \`issues\` provider is not available${failure ? ` (${describeError(failure.error)})` : ""}`)]);
|
|
27597
27602
|
}
|
|
27598
27603
|
let issue;
|
|
27599
27604
|
try {
|
|
27600
27605
|
issue = await loader.get("issues").get(input.issue);
|
|
27601
27606
|
} catch (err) {
|
|
27602
|
-
return finish([row$
|
|
27607
|
+
return finish([row$14(input.issue, "fail", `could not read the issue: ${describeError(err)}`)]);
|
|
27603
27608
|
}
|
|
27604
27609
|
const name = specName(issue.summary, input.name);
|
|
27605
|
-
if (!name) return finish([row$
|
|
27610
|
+
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
27611
|
const relative = join(".notes", `${name}.spec.md`);
|
|
27607
|
-
if (io.exists(join(input.context.repoRoot, relative))) return finish([row$
|
|
27612
|
+
if (io.exists(join(input.context.repoRoot, relative))) return finish([row$14(relative, "fail", "the spec already exists; it is never overwritten")], relative);
|
|
27608
27613
|
const { org, name: repoName } = input.loaded.resolved;
|
|
27609
27614
|
const ref = githubRef(issue.url) ?? (issue.key.startsWith("#") ? `${org}/${repoName}${issue.key}` : issue.key);
|
|
27610
27615
|
const { content, fromIdea } = buildSpec({
|
|
@@ -27617,7 +27622,7 @@ async function runIdeasPromote(input) {
|
|
|
27617
27622
|
print(` ${relative}`);
|
|
27618
27623
|
for (const line of content.split("\n").slice(0, PREVIEW_LINES$1)) print(` ${style.skip(line)}`);
|
|
27619
27624
|
print("");
|
|
27620
|
-
return finish([row$
|
|
27625
|
+
return finish([row$14(relative, "skip", `would write the spec ${origin}`)], relative);
|
|
27621
27626
|
}
|
|
27622
27627
|
if (!input.yes) {
|
|
27623
27628
|
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 +27641,9 @@ async function runIdeasPromote(input) {
|
|
|
27636
27641
|
try {
|
|
27637
27642
|
io.write(join(input.context.repoRoot, relative), content);
|
|
27638
27643
|
} catch (err) {
|
|
27639
|
-
return finish([row$
|
|
27644
|
+
return finish([row$14(relative, "fail", `could not write the spec: ${describeError(err)}`)], relative);
|
|
27640
27645
|
}
|
|
27641
|
-
return finish([row$
|
|
27646
|
+
return finish([row$14(relative, "ok", `wrote the spec ${origin}`)], relative);
|
|
27642
27647
|
}
|
|
27643
27648
|
// src/commands/ideas-promote/ideas-promote.command.ts
|
|
27644
27649
|
const ideasPromoteCommand = {
|
|
@@ -27714,7 +27719,7 @@ function readIssueBody(file, cwd, read = (p) => readFileSync(p, "utf8")) {
|
|
|
27714
27719
|
*/
|
|
27715
27720
|
/** How many lines of the body a dry run shows. */
|
|
27716
27721
|
const PREVIEW_LINES = 8;
|
|
27717
|
-
const row$
|
|
27722
|
+
const row$13 = (id, status, detail) => ({
|
|
27718
27723
|
id,
|
|
27719
27724
|
title: id,
|
|
27720
27725
|
status,
|
|
@@ -27738,11 +27743,11 @@ async function runIssueCreate(input) {
|
|
|
27738
27743
|
print(style.header(`Holocron new issue${dryRun ? " (dry-run)" : ""}`));
|
|
27739
27744
|
print("");
|
|
27740
27745
|
const title = input.title.trim();
|
|
27741
|
-
if (!title) return finish([row$
|
|
27746
|
+
if (!title) return finish([row$13("title", "fail", "the title is empty")]);
|
|
27742
27747
|
const prepared = prepareIssueFields(input, input.loaded.resolved.repo?.labels?.areas);
|
|
27743
|
-
if (!prepared.ok) return finish(prepared.problems.map((p) => row$
|
|
27748
|
+
if (!prepared.ok) return finish(prepared.problems.map((p) => row$13(title, "fail", p)));
|
|
27744
27749
|
const entry = input.loaded.resolved.providers.issues;
|
|
27745
|
-
if (!entry) return finish([row$
|
|
27750
|
+
if (!entry) return finish([row$13(title, "fail", "the config has no `issues` provider to file the issue with")]);
|
|
27746
27751
|
const credentials = input.loaded.resolved.providers.credentials;
|
|
27747
27752
|
const projects = prepared.project ? input.loaded.resolved.providers.projects : void 0;
|
|
27748
27753
|
/* v8 ignore start -- the real loader is only built outside tests, which always inject one */
|
|
@@ -27759,7 +27764,7 @@ async function runIssueCreate(input) {
|
|
|
27759
27764
|
assertPluginsResolvable(loader, "new issue");
|
|
27760
27765
|
if (!loader.has("issues")) {
|
|
27761
27766
|
const failure = loader.loadFailures().find((f) => f.key === "issues");
|
|
27762
|
-
return finish([row$
|
|
27767
|
+
return finish([row$13(title, "fail", `the \`issues\` provider is not available${failure ? ` (${describeError(failure.error)})` : ""}`)]);
|
|
27763
27768
|
}
|
|
27764
27769
|
const labels = [.../* @__PURE__ */ new Set([...(input.labels ?? []).map((l) => l.trim()).filter(Boolean), ...prepared.areaLabels])];
|
|
27765
27770
|
const body = input.body?.trim() ? input.body : void 0;
|
|
@@ -27776,7 +27781,7 @@ async function runIssueCreate(input) {
|
|
|
27776
27781
|
print(` ${title}`);
|
|
27777
27782
|
for (const line of body ? body.split("\n").slice(0, PREVIEW_LINES) : []) print(` ${style.skip(line)}`);
|
|
27778
27783
|
print("");
|
|
27779
|
-
return finish([row$
|
|
27784
|
+
return finish([row$13(title, "skip", `would file the issue${summary}`)]);
|
|
27780
27785
|
}
|
|
27781
27786
|
if (!input.yes) {
|
|
27782
27787
|
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 +27814,12 @@ async function runIssueCreate(input) {
|
|
|
27809
27814
|
...prepared.fields.priority ? { priority: prepared.fields.priority } : {}
|
|
27810
27815
|
}) : void 0;
|
|
27811
27816
|
return finish([
|
|
27812
|
-
row$
|
|
27813
|
-
...(dropped ?? []).map((line) => row$
|
|
27817
|
+
row$13(title, "ok", `filed ${key}`),
|
|
27818
|
+
...(dropped ?? []).map((line) => row$13("not carried across", "skip", line)),
|
|
27814
27819
|
...board ? [board] : []
|
|
27815
27820
|
], key);
|
|
27816
27821
|
} catch (err) {
|
|
27817
|
-
return finish([row$
|
|
27822
|
+
return finish([row$13(title, "fail", `could not file the issue: ${describeError(err)}`)]);
|
|
27818
27823
|
}
|
|
27819
27824
|
}
|
|
27820
27825
|
// src/commands/issue-create/issue-create.command.ts
|
|
@@ -30134,7 +30139,7 @@ function readGitConfig(cwd, key, run = runGit) {
|
|
|
30134
30139
|
* identity; Effort is asked on a terminal when it was not given (the CLI never chooses it). The issue's key is printed
|
|
30135
30140
|
* by the first row, before anything else is done, so a failed spec leaves the issue as the anchor to resume from.
|
|
30136
30141
|
*/
|
|
30137
|
-
const row$
|
|
30142
|
+
const row$12 = (id, status, detail) => ({
|
|
30138
30143
|
id,
|
|
30139
30144
|
title: id,
|
|
30140
30145
|
status,
|
|
@@ -30153,7 +30158,7 @@ async function runNewWork(input) {
|
|
|
30153
30158
|
const name = specName(input.title, input.specName);
|
|
30154
30159
|
if (!name) {
|
|
30155
30160
|
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$
|
|
30161
|
+
const rows = [row$12("spec", "fail", detail)];
|
|
30157
30162
|
printCheckRows(rows, print);
|
|
30158
30163
|
return {
|
|
30159
30164
|
status: "fail",
|
|
@@ -30162,7 +30167,7 @@ async function runNewWork(input) {
|
|
|
30162
30167
|
}
|
|
30163
30168
|
specPath = join(".notes", `${name}.spec.md`);
|
|
30164
30169
|
if (io.exists(join(root, specPath))) {
|
|
30165
|
-
const rows = [row$
|
|
30170
|
+
const rows = [row$12(specPath, "fail", "the spec already exists; it is never overwritten")];
|
|
30166
30171
|
printCheckRows(rows, print);
|
|
30167
30172
|
return {
|
|
30168
30173
|
status: "fail",
|
|
@@ -30172,7 +30177,7 @@ async function runNewWork(input) {
|
|
|
30172
30177
|
}
|
|
30173
30178
|
}
|
|
30174
30179
|
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$
|
|
30180
|
+
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
30181
|
let effort = input.effort;
|
|
30177
30182
|
const interactive = input.interactive ?? Boolean(process.stdin.isTTY);
|
|
30178
30183
|
if (!effort && !input.yes && !dryRun && interactive) effort = await (input.askEffort ?? promptEffort)();
|
|
@@ -33162,7 +33167,7 @@ const MARKER = "# written by `holocron open requests` for one session and remove
|
|
|
33162
33167
|
const SECRETS_FILE = `${PRIVATE_DIR}/requests.env`;
|
|
33163
33168
|
/** The lock a launch holds, in the private directory. */
|
|
33164
33169
|
const LOCK_FILE = `${PRIVATE_DIR}/open-requests.lock`;
|
|
33165
|
-
const row$
|
|
33170
|
+
const row$11 = (id, status, detail, problems = []) => ({
|
|
33166
33171
|
id,
|
|
33167
33172
|
title: id,
|
|
33168
33173
|
status,
|
|
@@ -33203,7 +33208,7 @@ async function runOpenRequests(input) {
|
|
|
33203
33208
|
const tuples = entry?.cardinality === "many" ? entry.tuples : [];
|
|
33204
33209
|
const chosen = input.to === void 0 ? tuples : tuples.filter((t) => t.provider === input.to);
|
|
33205
33210
|
if (chosen.length === 0) {
|
|
33206
|
-
say(row$
|
|
33211
|
+
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
33212
|
return finish();
|
|
33208
33213
|
}
|
|
33209
33214
|
/* v8 ignore start -- the real loader is only built outside tests, which always inject one */
|
|
@@ -33213,7 +33218,7 @@ async function runOpenRequests(input) {
|
|
|
33213
33218
|
assertPluginsResolvable(loader, "open requests");
|
|
33214
33219
|
const openable = (loader.has("tooling") ? loader.get("tooling") : []).filter((t) => chosen.some((tuple) => tuple.provider === t.providerName)).filter((t) => t.open !== void 0);
|
|
33215
33220
|
if (openable.length !== 1) {
|
|
33216
|
-
say(row$
|
|
33221
|
+
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
33222
|
return finish();
|
|
33218
33223
|
}
|
|
33219
33224
|
const tool = openable[0];
|
|
@@ -33227,34 +33232,34 @@ async function runOpenRequests(input) {
|
|
|
33227
33232
|
repoRoot
|
|
33228
33233
|
});
|
|
33229
33234
|
} catch (err) {
|
|
33230
|
-
say(row$
|
|
33235
|
+
say(row$11(tool.providerName, "fail", describeError(err)));
|
|
33231
33236
|
return finish();
|
|
33232
33237
|
}
|
|
33233
33238
|
const loaded = plan.wants.filter((want) => layers.includes(want.layer));
|
|
33234
33239
|
const notLoaded = plan.wants.filter((want) => !layers.includes(want.layer));
|
|
33235
33240
|
const names = [...new Set(loaded.map((want) => want.name))].sort();
|
|
33236
|
-
if (plan.unfilled.length > 0) say(row$
|
|
33237
|
-
say(row$
|
|
33241
|
+
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));
|
|
33242
|
+
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
33243
|
if (dryRun) {
|
|
33239
|
-
for (const want of loaded) say(row$
|
|
33240
|
-
if (names.length === 0) say(row$
|
|
33241
|
-
else say(row$
|
|
33242
|
-
say(row$
|
|
33244
|
+
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}`));
|
|
33245
|
+
if (names.length === 0) say(row$11("secrets", "ok", "nothing to fill: no variable refers to an entry"));
|
|
33246
|
+
else say(row$11("secrets", "ok", `would write ${names.length} value(s) to ${SECRETS_FILE} and link it from ${plan.targets.length} collection(s)`));
|
|
33247
|
+
say(row$11(plan.app, "ok", `would start ${plan.launch.command} in the foreground`));
|
|
33243
33248
|
return finish();
|
|
33244
33249
|
}
|
|
33245
33250
|
if (deps.platform === "win32" && names.length > 0) {
|
|
33246
|
-
say(row$
|
|
33251
|
+
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
33252
|
return finish();
|
|
33248
33253
|
}
|
|
33249
33254
|
let running;
|
|
33250
33255
|
try {
|
|
33251
33256
|
running = await deps.processes();
|
|
33252
33257
|
} catch (err) {
|
|
33253
|
-
say(row$
|
|
33258
|
+
say(row$11(plan.app, "fail", `could not tell whether ${plan.app} is running: ${describeError(err)}`));
|
|
33254
33259
|
return finish();
|
|
33255
33260
|
}
|
|
33256
33261
|
if (running.split("\n").some((line) => line.includes(plan.running))) {
|
|
33257
|
-
say(row$
|
|
33262
|
+
say(row$11(plan.app, "fail", `${plan.app} is already running; quit it and run this again (it would not see the values)`));
|
|
33258
33263
|
return finish();
|
|
33259
33264
|
}
|
|
33260
33265
|
if (!input.yes) {
|
|
@@ -33271,7 +33276,7 @@ async function runOpenRequests(input) {
|
|
|
33271
33276
|
if (names.length > 0) {
|
|
33272
33277
|
const vault = loader.has("vault") ? loader.get("vault") : void 0;
|
|
33273
33278
|
if (!vault?.readEnvironmentEntries) {
|
|
33274
|
-
say(row$
|
|
33279
|
+
say(row$11("vault", "fail", vault ? `${vault.providerName} cannot read an Environment's entries` : "needs a `vault` provider in holocron.config.ts (1password)"));
|
|
33275
33280
|
return finish();
|
|
33276
33281
|
}
|
|
33277
33282
|
let failed = false;
|
|
@@ -33288,17 +33293,17 @@ async function runOpenRequests(input) {
|
|
|
33288
33293
|
names: [...new Set(wanted.map((want) => want.entry))].sort()
|
|
33289
33294
|
});
|
|
33290
33295
|
} catch (err) {
|
|
33291
|
-
say(row$
|
|
33296
|
+
say(row$11(`vault ${layer}`, "fail", describeError(err)));
|
|
33292
33297
|
failed = true;
|
|
33293
33298
|
continue;
|
|
33294
33299
|
}
|
|
33295
33300
|
for (const entry of read.missing) {
|
|
33296
|
-
say(row$
|
|
33301
|
+
say(row$11(`${layer} ${entry}`, "fail", `${read.environmentId} holds no value for ${entry}`));
|
|
33297
33302
|
failed = true;
|
|
33298
33303
|
}
|
|
33299
33304
|
if (read.missing.length > 0) continue;
|
|
33300
33305
|
for (const want of wanted) values.set(want.name, read.values.get(want.entry));
|
|
33301
|
-
say(row$
|
|
33306
|
+
say(row$11(`vault ${read.environmentId}`, "ok", `${wanted.length} value(s) read: ${[...new Set(wanted.map((want) => want.name))].join(", ")}`));
|
|
33302
33307
|
}
|
|
33303
33308
|
if (failed) return finish();
|
|
33304
33309
|
}
|
|
@@ -33318,7 +33323,7 @@ async function runOpenRequests(input) {
|
|
|
33318
33323
|
};
|
|
33319
33324
|
deps.makeDir(dirname(secrets));
|
|
33320
33325
|
if (!deps.takeLock(lock, deps.pid)) {
|
|
33321
|
-
say(row$
|
|
33326
|
+
say(row$11(plan.app, "fail", `another \`open requests\` is starting ${plan.app} (${LOCK_FILE} is held); try again when it has`));
|
|
33322
33327
|
return finish();
|
|
33323
33328
|
}
|
|
33324
33329
|
const stop = deps.onTerminate(cleanup);
|
|
@@ -33326,18 +33331,18 @@ async function runOpenRequests(input) {
|
|
|
33326
33331
|
if (names.length > 0) {
|
|
33327
33332
|
const ignored = deps.isIgnored(secrets);
|
|
33328
33333
|
if (ignored === "tracked" || ignored === "unknown") {
|
|
33329
|
-
say(row$
|
|
33334
|
+
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
33335
|
return finish();
|
|
33331
33336
|
}
|
|
33332
33337
|
const stale = deps.inspect(secrets);
|
|
33333
33338
|
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$
|
|
33339
|
+
say(row$11("values file", "fail", `${SECRETS_FILE} is not this command's (no marker line); move it away`));
|
|
33335
33340
|
return finish();
|
|
33336
33341
|
}
|
|
33337
33342
|
for (const link of plan.targets) {
|
|
33338
33343
|
const state = deps.inspect(link);
|
|
33339
33344
|
if (state.kind !== "none" && !isOurs(state, link, secrets)) {
|
|
33340
|
-
say(row$
|
|
33345
|
+
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
33346
|
return finish();
|
|
33342
33347
|
}
|
|
33343
33348
|
}
|
|
@@ -33345,7 +33350,7 @@ async function runOpenRequests(input) {
|
|
|
33345
33350
|
for (const [name, value] of values) {
|
|
33346
33351
|
const line = dotenvLine(name, value);
|
|
33347
33352
|
if (line === null) {
|
|
33348
|
-
say(row$
|
|
33353
|
+
say(row$11(name, "fail", `the value of ${name} cannot be written to a .env file as it is; it was not written`));
|
|
33349
33354
|
return finish();
|
|
33350
33355
|
}
|
|
33351
33356
|
lines.push(line);
|
|
@@ -33358,7 +33363,7 @@ async function runOpenRequests(input) {
|
|
|
33358
33363
|
deps.symlink(relative(dirname(link), secrets), link);
|
|
33359
33364
|
created.push(link);
|
|
33360
33365
|
}
|
|
33361
|
-
say(row$
|
|
33366
|
+
say(row$11("values file", "ok", `${SECRETS_FILE} (mode 0600, git-ignored) linked from ${plan.targets.map((t) => relative(repoRoot, t)).join(", ")}`));
|
|
33362
33367
|
}
|
|
33363
33368
|
print("");
|
|
33364
33369
|
print(`starting ${plan.app}${names.length > 0 ? `; the values are removed when it quits (Ctrl-C ends it too)` : ""}`);
|
|
@@ -33366,10 +33371,10 @@ async function runOpenRequests(input) {
|
|
|
33366
33371
|
try {
|
|
33367
33372
|
exitCode = await deps.run(plan.launch);
|
|
33368
33373
|
} catch (err) {
|
|
33369
|
-
say(row$
|
|
33374
|
+
say(row$11(plan.app, "fail", describeError(err)));
|
|
33370
33375
|
return finish();
|
|
33371
33376
|
}
|
|
33372
|
-
say(row$
|
|
33377
|
+
say(row$11(plan.app, exitCode === 0 ? "ok" : "fail", `ended with ${exitCode}`));
|
|
33373
33378
|
return finish();
|
|
33374
33379
|
} finally {
|
|
33375
33380
|
stop();
|
|
@@ -35593,7 +35598,7 @@ const projectCommand = {
|
|
|
35593
35598
|
*/
|
|
35594
35599
|
/** A vendor's token id: letters, digits and `._:-`, so it is one path segment and nothing that could change a request. */
|
|
35595
35600
|
const TOKEN_ID = /^[A-Za-z0-9._:-]{1,128}$/;
|
|
35596
|
-
const row$
|
|
35601
|
+
const row$10 = (id, title, status, detail, problems = []) => ({
|
|
35597
35602
|
id: `provider-revoke:${id}`,
|
|
35598
35603
|
title,
|
|
35599
35604
|
status,
|
|
@@ -35626,7 +35631,7 @@ async function runProviderRevoke(input) {
|
|
|
35626
35631
|
};
|
|
35627
35632
|
};
|
|
35628
35633
|
print(`Holocron provider ${provider} revoke${dryRun ? " (dry-run)" : ""}`);
|
|
35629
|
-
if (!TOKEN_ID.test(id)) return finish("fail", [row$
|
|
35634
|
+
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
35635
|
/* v8 ignore next -- the real loader is only built outside tests, which always inject one */
|
|
35631
35636
|
const loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);
|
|
35632
35637
|
await loader.load();
|
|
@@ -35636,10 +35641,10 @@ async function runProviderRevoke(input) {
|
|
|
35636
35641
|
revoke = await loader.loadRevokeToken(provider, input.options ?? {});
|
|
35637
35642
|
} catch (err) {
|
|
35638
35643
|
if (err instanceof WorkspaceContextError) throw err;
|
|
35639
|
-
return finish("fail", [row$
|
|
35644
|
+
return finish("fail", [row$10("provider", provider, "fail", `\`${provider}\` did not load`, [describeError(err)])]);
|
|
35640
35645
|
}
|
|
35641
|
-
if (!revoke) return finish("fail", [row$
|
|
35642
|
-
if (dryRun) return finish("dry-run", [row$
|
|
35646
|
+
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"])]);
|
|
35647
|
+
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
35648
|
if (!input.yes) {
|
|
35644
35649
|
if (!input.confirm) throw new NonInteractiveError("pass --yes to revoke a token without a terminal");
|
|
35645
35650
|
if (!await input.confirm(`Delete token ${id} at ${provider}? This cannot be undone.`)) {
|
|
@@ -35654,9 +35659,9 @@ async function runProviderRevoke(input) {
|
|
|
35654
35659
|
try {
|
|
35655
35660
|
done = await revoke({ id });
|
|
35656
35661
|
} catch (err) {
|
|
35657
|
-
return finish("fail", [row$
|
|
35662
|
+
return finish("fail", [row$10("revoke", id, "fail", `${provider} did not delete the token`, [describeError(err)])]);
|
|
35658
35663
|
}
|
|
35659
|
-
return finish("ok", [row$
|
|
35664
|
+
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
35665
|
}
|
|
35661
35666
|
// src/commands/provider/provider-token/provider-token.ts
|
|
35662
35667
|
/**
|
|
@@ -35667,7 +35672,7 @@ async function runProviderRevoke(input) {
|
|
|
35667
35672
|
* once imported); no row, log or return value carries it, and the output is scrubbed of it as well. The old token is
|
|
35668
35673
|
* never revoked here.
|
|
35669
35674
|
*/
|
|
35670
|
-
const row$
|
|
35675
|
+
const row$9 = (id, title, status, detail, problems = []) => ({
|
|
35671
35676
|
id: `provider-token:${id}`,
|
|
35672
35677
|
title,
|
|
35673
35678
|
status,
|
|
@@ -35703,7 +35708,7 @@ async function runProviderToken(input) {
|
|
|
35703
35708
|
};
|
|
35704
35709
|
};
|
|
35705
35710
|
print(`Holocron provider ${provider} token (${layer})${dryRun ? " (dry-run)" : ""}`);
|
|
35706
|
-
if (!ENVIRONMENT_LAYERS.includes(layer)) return finish("fail", [row$
|
|
35711
|
+
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
35712
|
/* v8 ignore next -- the real loader is only built outside tests, which always inject one */
|
|
35708
35713
|
const loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);
|
|
35709
35714
|
await loader.load();
|
|
@@ -35713,12 +35718,12 @@ async function runProviderToken(input) {
|
|
|
35713
35718
|
mint = await loader.loadMintToken(provider, input.options ?? {});
|
|
35714
35719
|
} catch (err) {
|
|
35715
35720
|
if (err instanceof WorkspaceContextError) throw err;
|
|
35716
|
-
return finish("fail", [row$
|
|
35721
|
+
return finish("fail", [row$9("provider", `${provider}`, "fail", `\`${provider}\` did not load`, [describeError(err)])]);
|
|
35717
35722
|
}
|
|
35718
|
-
if (!mint) return finish("fail", [row$
|
|
35723
|
+
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
35724
|
const now = input.now ?? (() => /* @__PURE__ */ new Date());
|
|
35720
35725
|
const name = input.name ?? `holocron-${provider}-${layer}-${stamp(now())}`;
|
|
35721
|
-
if (dryRun) return finish("dry-run", [row$
|
|
35726
|
+
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
35727
|
if (!input.yes) {
|
|
35723
35728
|
if (!input.confirm) throw new NonInteractiveError("pass --yes to make a token without a terminal");
|
|
35724
35729
|
if (!await input.confirm(`Make a new ${layer} token named ${name} through ${provider}'s API?`)) {
|
|
@@ -35738,9 +35743,9 @@ async function runProviderToken(input) {
|
|
|
35738
35743
|
now
|
|
35739
35744
|
});
|
|
35740
35745
|
} catch (err) {
|
|
35741
|
-
return finish("fail", [row$
|
|
35746
|
+
return finish("fail", [row$9("mint", name, "fail", `${provider} did not make the token`, [describeError(err)])]);
|
|
35742
35747
|
}
|
|
35743
|
-
const rows = [row$
|
|
35748
|
+
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
35749
|
const environment = await (input.resolveEnvironment ?? ((l, repoRoot) => resolveEnvironmentId(l, { repoRoot })))(layer, input.context.repoRoot);
|
|
35745
35750
|
const handed = await (input.handOff ?? handOffSecret)({
|
|
35746
35751
|
name: made.envName,
|
|
@@ -35751,10 +35756,10 @@ async function runProviderToken(input) {
|
|
|
35751
35756
|
...input.interactive === void 0 ? {} : { interactive: input.interactive }
|
|
35752
35757
|
});
|
|
35753
35758
|
if (handed.status === "fail") {
|
|
35754
|
-
rows.push(row$
|
|
35759
|
+
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
35760
|
return finish("fail", rows, [made.value]);
|
|
35756
35761
|
}
|
|
35757
|
-
rows.push(row$
|
|
35762
|
+
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
35763
|
return finish("ok", rows, [made.value]);
|
|
35759
35764
|
}
|
|
35760
35765
|
// src/commands/provider/provider.ts
|
|
@@ -37556,7 +37561,7 @@ const projectReconcileCommand = {
|
|
|
37556
37561
|
* it would do and posts nothing.
|
|
37557
37562
|
*/
|
|
37558
37563
|
const DEFAULT_MAX_AGE_MINUTES = 10;
|
|
37559
|
-
const row$
|
|
37564
|
+
const row$8 = (id, status, detail) => ({
|
|
37560
37565
|
id,
|
|
37561
37566
|
title: id,
|
|
37562
37567
|
status,
|
|
@@ -37595,7 +37600,7 @@ async function runReconcileCi(input) {
|
|
|
37595
37600
|
};
|
|
37596
37601
|
};
|
|
37597
37602
|
const fail = (id, detail) => {
|
|
37598
|
-
rows.push(row$
|
|
37603
|
+
rows.push(row$8(id, "fail", detail));
|
|
37599
37604
|
return finish();
|
|
37600
37605
|
};
|
|
37601
37606
|
print(style.header(`Holocron reconcile ci${dryRun ? " (dry-run)" : ""}`));
|
|
@@ -37603,7 +37608,7 @@ async function runReconcileCi(input) {
|
|
|
37603
37608
|
if (input.maxAgeMinutes !== void 0 && !(input.maxAgeMinutes > 0)) return fail("max-age", "--max-age is a number of minutes above zero");
|
|
37604
37609
|
const poster = aggregatePoster({ ci: input.loaded.resolved.ci });
|
|
37605
37610
|
if (!input.shadow && poster !== "sentinel") {
|
|
37606
|
-
rows.push(row$
|
|
37611
|
+
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
37612
|
return finish();
|
|
37608
37613
|
}
|
|
37609
37614
|
const providers = input.loaded.resolved.providers;
|
|
@@ -37643,7 +37648,7 @@ async function runReconcileCi(input) {
|
|
|
37643
37648
|
return fail("pull requests", describeError(error));
|
|
37644
37649
|
}
|
|
37645
37650
|
if (pullRequests.length === 0) {
|
|
37646
|
-
rows.push(row$
|
|
37651
|
+
rows.push(row$8("pull requests", "skip", "no open pull requests"));
|
|
37647
37652
|
return finish();
|
|
37648
37653
|
}
|
|
37649
37654
|
const api = {
|
|
@@ -37656,7 +37661,7 @@ async function runReconcileCi(input) {
|
|
|
37656
37661
|
for (const pr of pullRequests) {
|
|
37657
37662
|
const id = `#${pr.number}`;
|
|
37658
37663
|
if (pr.headSha === void 0) {
|
|
37659
|
-
rows.push(row$
|
|
37664
|
+
rows.push(row$8(id, "skip", "the provider gave no head commit"));
|
|
37660
37665
|
continue;
|
|
37661
37666
|
}
|
|
37662
37667
|
try {
|
|
@@ -37671,17 +37676,17 @@ async function runReconcileCi(input) {
|
|
|
37671
37676
|
name: input.shadow ? AGGREGATE_SHADOW_CHECK_NAME : AGGREGATE_CHECK_NAME
|
|
37672
37677
|
});
|
|
37673
37678
|
const verdict = out.result.conclusion;
|
|
37674
|
-
if (out.action === "foreign") rows.push(row$
|
|
37675
|
-
else if (out.action === "unchanged") rows.push(row$
|
|
37679
|
+
if (out.action === "foreign") rows.push(row$8(id, "skip", "another app (the Actions job) already posts this check on the commit; left alone"));
|
|
37680
|
+
else if (out.action === "unchanged") rows.push(row$8(id, "ok", `up to date (${verdict})`));
|
|
37676
37681
|
else if (out.stale) {
|
|
37677
37682
|
const what = dryRun ? "would repair" : "repaired";
|
|
37678
|
-
rows.push(row$
|
|
37683
|
+
rows.push(row$8(id, "fail", `${what}: the check was missing or wrong (now ${verdict}); a delivery was missed`));
|
|
37679
37684
|
} else {
|
|
37680
37685
|
const what = dryRun ? "would post" : "posted";
|
|
37681
|
-
rows.push(row$
|
|
37686
|
+
rows.push(row$8(id, "ok", `${what} ${verdict} (still in flight)`));
|
|
37682
37687
|
}
|
|
37683
37688
|
} catch (error) {
|
|
37684
|
-
rows.push(row$
|
|
37689
|
+
rows.push(row$8(id, "fail", describeError(error)));
|
|
37685
37690
|
}
|
|
37686
37691
|
}
|
|
37687
37692
|
return finish();
|
|
@@ -37764,7 +37769,7 @@ const defaultApi = {
|
|
|
37764
37769
|
listAppDeliveries,
|
|
37765
37770
|
redeliverAppDelivery
|
|
37766
37771
|
};
|
|
37767
|
-
const row$
|
|
37772
|
+
const row$7 = (id, status, detail) => ({
|
|
37768
37773
|
id,
|
|
37769
37774
|
title: id,
|
|
37770
37775
|
status,
|
|
@@ -37795,7 +37800,7 @@ async function runRedeliverWebhooks(input) {
|
|
|
37795
37800
|
};
|
|
37796
37801
|
};
|
|
37797
37802
|
const fail = (id, detail) => {
|
|
37798
|
-
rows.push(row$
|
|
37803
|
+
rows.push(row$7(id, "fail", detail));
|
|
37799
37804
|
return finish();
|
|
37800
37805
|
};
|
|
37801
37806
|
print(style.header(`Holocron redeliver webhooks${dryRun ? " (dry-run)" : ""}`));
|
|
@@ -37808,7 +37813,7 @@ async function runRedeliverWebhooks(input) {
|
|
|
37808
37813
|
}
|
|
37809
37814
|
const all = input.loaded.resolved.githubApps ?? [];
|
|
37810
37815
|
if (all.length === 0) {
|
|
37811
|
-
rows.push(row$
|
|
37816
|
+
rows.push(row$7("github-app", "skip", "no `githubApps` are declared in holocron.config.ts"));
|
|
37812
37817
|
return finish();
|
|
37813
37818
|
}
|
|
37814
37819
|
const instances = input.app === void 0 ? all : all.filter((instance) => instance.name === input.app);
|
|
@@ -37822,19 +37827,19 @@ async function runRedeliverWebhooks(input) {
|
|
|
37822
37827
|
for (const instance of instances) {
|
|
37823
37828
|
const read = await readAppCredentials(instance, loader);
|
|
37824
37829
|
if ("reason" in read) {
|
|
37825
|
-
rows.push(row$
|
|
37830
|
+
rows.push(row$7(`${instance.name}`, "skip", read.reason));
|
|
37826
37831
|
continue;
|
|
37827
37832
|
}
|
|
37828
37833
|
try {
|
|
37829
37834
|
const failed = failedDeliveries(await api.listAppDeliveries(read.creds, { since }));
|
|
37830
|
-
if (failed.length === 0) rows.push(row$
|
|
37835
|
+
if (failed.length === 0) rows.push(row$7(instance.name, "ok", `no failed deliveries since ${since}`));
|
|
37831
37836
|
for (const delivery of failed) pending.push({
|
|
37832
37837
|
app: instance.name,
|
|
37833
37838
|
creds: read.creds,
|
|
37834
37839
|
delivery
|
|
37835
37840
|
});
|
|
37836
37841
|
} catch (error) {
|
|
37837
|
-
rows.push(row$
|
|
37842
|
+
rows.push(row$7(instance.name, "fail", `cannot read the delivery log: ${scrubbed$1(error, [read.creds.privateKey])}`));
|
|
37838
37843
|
}
|
|
37839
37844
|
}
|
|
37840
37845
|
if (pending.length === 0) return finish();
|
|
@@ -37846,7 +37851,7 @@ async function runRedeliverWebhooks(input) {
|
|
|
37846
37851
|
};
|
|
37847
37852
|
};
|
|
37848
37853
|
if (dryRun) {
|
|
37849
|
-
for (const item of pending) rows.push(row$
|
|
37854
|
+
for (const item of pending) rows.push(row$7(label(item).id, "skip", `would redeliver ${label(item).text}`));
|
|
37850
37855
|
return finish();
|
|
37851
37856
|
}
|
|
37852
37857
|
/* v8 ignore next -- the terminal is only asked outside tests, which inject `interactive` */
|
|
@@ -37858,16 +37863,16 @@ async function runRedeliverWebhooks(input) {
|
|
|
37858
37863
|
default: false
|
|
37859
37864
|
}));
|
|
37860
37865
|
if (!input.yes && !await ask(`Redeliver ${pending.length} failed webhook deliver${pending.length === 1 ? "y" : "ies"}?`)) {
|
|
37861
|
-
rows.push(row$
|
|
37866
|
+
rows.push(row$7("redeliver", "skip", "not confirmed; nothing was redelivered"));
|
|
37862
37867
|
return finish();
|
|
37863
37868
|
}
|
|
37864
37869
|
for (const item of pending) {
|
|
37865
37870
|
const { id, text } = label(item);
|
|
37866
37871
|
try {
|
|
37867
37872
|
await api.redeliverAppDelivery(item.creds, item.delivery.id);
|
|
37868
|
-
rows.push(row$
|
|
37873
|
+
rows.push(row$7(id, "ok", `redelivered ${text}`));
|
|
37869
37874
|
} catch (error) {
|
|
37870
|
-
rows.push(row$
|
|
37875
|
+
rows.push(row$7(id, "fail", scrubbed$1(error, [item.creds.privateKey])));
|
|
37871
37876
|
}
|
|
37872
37877
|
}
|
|
37873
37878
|
return finish();
|
|
@@ -38089,7 +38094,7 @@ async function readLayerTokenId(input) {
|
|
|
38089
38094
|
* order of what is left for each replaced token, naming the exact `provider <name> revoke <id>` when the id was read.
|
|
38090
38095
|
* No token value is printed, logged or returned.
|
|
38091
38096
|
*/
|
|
38092
|
-
const row$
|
|
38097
|
+
const row$6 = (id, title, status, detail, problems = []) => ({
|
|
38093
38098
|
id: `rotate:${id}`,
|
|
38094
38099
|
title,
|
|
38095
38100
|
status,
|
|
@@ -38126,7 +38131,7 @@ async function runRotateTokens(input) {
|
|
|
38126
38131
|
const layers = input.layers ?? [];
|
|
38127
38132
|
const unknown = layers.find((l) => !ENVIRONMENT_LAYERS.includes(l));
|
|
38128
38133
|
if (unknown !== void 0) {
|
|
38129
|
-
show([row$
|
|
38134
|
+
show([row$6("layer", "layer", "fail", `\`${unknown}\` is not a layer`, [`use one of: ${ENVIRONMENT_LAYERS.join(", ")}`])]);
|
|
38130
38135
|
return finish("fail");
|
|
38131
38136
|
}
|
|
38132
38137
|
const due = dueTokens((await (input.doctor ?? runDoctorTokens)({
|
|
@@ -38135,7 +38140,7 @@ async function runRotateTokens(input) {
|
|
|
38135
38140
|
print: () => {}
|
|
38136
38141
|
})).rows, layers);
|
|
38137
38142
|
if (due.length === 0) {
|
|
38138
|
-
show([row$
|
|
38143
|
+
show([row$6("none", "tokens", "ok", "no token is due")]);
|
|
38139
38144
|
return finish("ok");
|
|
38140
38145
|
}
|
|
38141
38146
|
/* v8 ignore next -- the real loader is only built outside tests, which always inject one */
|
|
@@ -38164,7 +38169,7 @@ async function runRotateTokens(input) {
|
|
|
38164
38169
|
layer: d.layer,
|
|
38165
38170
|
envName: d.envName
|
|
38166
38171
|
}));
|
|
38167
|
-
show(due.map((d, i) => canMint[i] ? row$
|
|
38172
|
+
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
38173
|
if (dryRun || replaceable.length === 0) return finish(dryRun ? "dry-run" : "ok");
|
|
38169
38174
|
if (!input.yes) {
|
|
38170
38175
|
if (!input.confirm) throw new NonInteractiveError("pass --yes to replace tokens without a terminal");
|
|
@@ -38190,8 +38195,8 @@ async function runRotateTokens(input) {
|
|
|
38190
38195
|
print
|
|
38191
38196
|
});
|
|
38192
38197
|
const id = `${d.layer}:${d.provider}:${d.envName}`;
|
|
38193
|
-
if (made.status === "ok") show([row$
|
|
38194
|
-
else show([row$
|
|
38198
|
+
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))}`)]);
|
|
38199
|
+
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
38200
|
}
|
|
38196
38201
|
return finish("ok");
|
|
38197
38202
|
}
|
|
@@ -38330,6 +38335,240 @@ const runCommand = {
|
|
|
38330
38335
|
if (report.status === "fail" || report.status === "unknown") process.exitCode = 1;
|
|
38331
38336
|
}
|
|
38332
38337
|
};
|
|
38338
|
+
// src/commands/ideas-sync/resolve-ideas-provider/resolve-ideas-provider.ts
|
|
38339
|
+
/**
|
|
38340
|
+
* The `ideas` provider `sync ideas` reads through: `providers.ideas` when the config names one. A config written
|
|
38341
|
+
* before the capability has only `ideas.dir` (#2004), so that, or `HOLOCRON_IDEAS_DIR` alone, reads as
|
|
38342
|
+
* `["obsidian", { dir }]`, the way a `HOLOCRON_` variable falls back to the bare name. `providers.ideas` wins over
|
|
38343
|
+
* `ideas.dir`. `undefined` when the config names no place for ideas at all.
|
|
38344
|
+
*/
|
|
38345
|
+
function resolveIdeasProvider(resolved, env) {
|
|
38346
|
+
const own = resolved.providers.ideas;
|
|
38347
|
+
if (own) return own;
|
|
38348
|
+
const dir = resolved.ideas?.dir;
|
|
38349
|
+
if (dir === void 0 && holocronEnv(env).get("IDEAS_DIR") === void 0) return void 0;
|
|
38350
|
+
return {
|
|
38351
|
+
cardinality: "single",
|
|
38352
|
+
tuple: {
|
|
38353
|
+
provider: "obsidian",
|
|
38354
|
+
packageName: resolvePluginPackage("obsidian"),
|
|
38355
|
+
options: dir === void 0 ? {} : { dir }
|
|
38356
|
+
}
|
|
38357
|
+
};
|
|
38358
|
+
}
|
|
38359
|
+
// src/commands/council-setup/real-council-io/real-council-io.ts
|
|
38360
|
+
/** {@link CouncilIo} over the real disk. */
|
|
38361
|
+
const realCouncilIo = {
|
|
38362
|
+
home: () => homedir(),
|
|
38363
|
+
isDirectory: (path) => {
|
|
38364
|
+
try {
|
|
38365
|
+
return statSync(path).isDirectory();
|
|
38366
|
+
} catch {
|
|
38367
|
+
return false;
|
|
38368
|
+
}
|
|
38369
|
+
},
|
|
38370
|
+
kind: (path) => {
|
|
38371
|
+
try {
|
|
38372
|
+
const stat = lstatSync(path);
|
|
38373
|
+
if (stat.isSymbolicLink()) return "link";
|
|
38374
|
+
return stat.isDirectory() ? "directory" : "file";
|
|
38375
|
+
} catch {
|
|
38376
|
+
return "missing";
|
|
38377
|
+
}
|
|
38378
|
+
},
|
|
38379
|
+
read: (path) => {
|
|
38380
|
+
try {
|
|
38381
|
+
return readFileSync(path);
|
|
38382
|
+
} catch {
|
|
38383
|
+
return;
|
|
38384
|
+
}
|
|
38385
|
+
},
|
|
38386
|
+
mkdir: (path) => void mkdirSync(path, { recursive: true }),
|
|
38387
|
+
write: (path, data) => writeFileSync(path, data)
|
|
38388
|
+
};
|
|
38389
|
+
// src/commands/council-setup/run-council-setup/run-council-setup.ts
|
|
38390
|
+
/**
|
|
38391
|
+
* `holocron setup council` — installs the Council Obsidian plugin into a vault.
|
|
38392
|
+
*
|
|
38393
|
+
* It copies the built `main.js` and `manifest.json` of `apps/council` into
|
|
38394
|
+
* `<vault>/.obsidian/plugins/holocron-council/`. The vault is `--vault <folder>`, else the folder the configured `ideas`
|
|
38395
|
+
* provider reads (`Ideas.notesDir()`). It never makes a vault (a folder with no `.obsidian` is refused), never deletes
|
|
38396
|
+
* anything, never writes through a symbolic link and never builds Council: a missing build is a failing row that names
|
|
38397
|
+
* the command. A second run updates the files, and when they already match it changes nothing and says so. It writes,
|
|
38398
|
+
* so it asks first unless `--dry-run` or `--yes` (without a terminal it refuses instead). Turning the plugin on is the
|
|
38399
|
+
* one step it cannot do, so the run ends by naming it.
|
|
38400
|
+
*/
|
|
38401
|
+
/** The folder name Obsidian keeps the plugin in; it is the `id` in Council's `manifest.json`. */
|
|
38402
|
+
const PLUGIN_ID = "holocron-council";
|
|
38403
|
+
/** The files the plugin needs: the name in the vault, and where the build leaves it under the Council folder. */
|
|
38404
|
+
const FILES = [{
|
|
38405
|
+
name: "main.js",
|
|
38406
|
+
source: "dist/main.js"
|
|
38407
|
+
}, {
|
|
38408
|
+
name: "manifest.json",
|
|
38409
|
+
source: "manifest.json"
|
|
38410
|
+
}];
|
|
38411
|
+
const BUILD_HINT = "run `pnpm --filter @theholocron/council build` first";
|
|
38412
|
+
const row$5 = (id, status, detail) => ({
|
|
38413
|
+
id,
|
|
38414
|
+
title: id,
|
|
38415
|
+
status,
|
|
38416
|
+
detail,
|
|
38417
|
+
problems: []
|
|
38418
|
+
});
|
|
38419
|
+
/** A vault path as the person typed it: `~` is the home folder, and a relative path is taken from `base`. */
|
|
38420
|
+
function expandVault(vault, home, base) {
|
|
38421
|
+
if (vault === "~") return home;
|
|
38422
|
+
return resolve(base, vault.startsWith("~/") ? join(home, vault.slice(2)) : vault);
|
|
38423
|
+
}
|
|
38424
|
+
/**
|
|
38425
|
+
* Installs or updates the Council plugin in a vault. Prints its own rows and returns them.
|
|
38426
|
+
*
|
|
38427
|
+
* @param input - The config, the Council folder, the vault and the seams.
|
|
38428
|
+
*/
|
|
38429
|
+
async function runCouncilSetup(input) {
|
|
38430
|
+
/* v8 ignore next -- the console is only used outside tests, which inject `print` */
|
|
38431
|
+
const print = input.print ?? ((line) => console.log(line));
|
|
38432
|
+
const io = input.io ?? realCouncilIo;
|
|
38433
|
+
const dryRun = Boolean(input.context.dryRun);
|
|
38434
|
+
const finish = (rows, enable = false) => {
|
|
38435
|
+
printCheckRows(rows, print);
|
|
38436
|
+
const summary = summariseChecks(rows);
|
|
38437
|
+
printCheckSummary(summary, print);
|
|
38438
|
+
if (enable && summary.fail === 0) {
|
|
38439
|
+
print("");
|
|
38440
|
+
print(` ${style.header("One step is yours:")} in Obsidian open Settings, Community plugins, reload the list and turn on "Holocron Council"`);
|
|
38441
|
+
}
|
|
38442
|
+
return {
|
|
38443
|
+
status: summary.fail > 0 ? "fail" : "ok",
|
|
38444
|
+
rows
|
|
38445
|
+
};
|
|
38446
|
+
};
|
|
38447
|
+
print(style.header(`Holocron setup council${dryRun ? " (dry-run)" : ""}`));
|
|
38448
|
+
print("");
|
|
38449
|
+
let vault;
|
|
38450
|
+
if (input.vault !== void 0) vault = expandVault(input.vault, io.home(), input.context.repoRoot);
|
|
38451
|
+
else {
|
|
38452
|
+
const entry = resolveIdeasProvider(input.loaded.resolved, input.env);
|
|
38453
|
+
if (!entry) return finish([row$5("vault", "fail", "no vault: pass `--vault <folder>`, or set `providers.ideas` (`[\"obsidian\", { vault }]`) or HOLOCRON_IDEAS_DIR")]);
|
|
38454
|
+
/* v8 ignore start -- the real loader is only built outside tests, which always inject one */
|
|
38455
|
+
const reader = input.ideasLoader ?? new PluginLoader({
|
|
38456
|
+
...input.loaded.resolved,
|
|
38457
|
+
providers: { ideas: entry }
|
|
38458
|
+
}, input.context);
|
|
38459
|
+
/* v8 ignore stop */
|
|
38460
|
+
await reader.load();
|
|
38461
|
+
assertPluginsResolvable(reader, "setup council");
|
|
38462
|
+
if (!reader.has("ideas")) {
|
|
38463
|
+
const failure = reader.loadFailures().find((f) => f.key === "ideas");
|
|
38464
|
+
return finish([row$5("vault", "fail", `the \`ideas\` provider is not available${failure ? ` (${describeError(failure.error)})` : ""}`)]);
|
|
38465
|
+
}
|
|
38466
|
+
vault = reader.get("ideas").notesDir?.();
|
|
38467
|
+
if (vault === void 0) return finish([row$5("vault", "fail", "the `ideas` provider names no folder: pass `--vault <folder>`")]);
|
|
38468
|
+
}
|
|
38469
|
+
const obsidian = join(vault, ".obsidian");
|
|
38470
|
+
if (!io.isDirectory(vault)) return finish([row$5("vault", "fail", `${vault} is not a folder`)]);
|
|
38471
|
+
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)`)]);
|
|
38472
|
+
const plugins = join(obsidian, "plugins");
|
|
38473
|
+
const target = join(plugins, PLUGIN_ID);
|
|
38474
|
+
const links = [plugins, target].filter((path) => io.kind(path) === "link");
|
|
38475
|
+
if (links.length > 0) return finish([row$5("vault", "fail", `${links[0]} is a symbolic link; it will not be written through`)]);
|
|
38476
|
+
const rows = [row$5("vault", "ok", vault)];
|
|
38477
|
+
const planned = [];
|
|
38478
|
+
for (const file of FILES) {
|
|
38479
|
+
const data = io.read(join(input.councilDir, file.source));
|
|
38480
|
+
if (!data) {
|
|
38481
|
+
rows.push(row$5(file.name, "fail", `${join(input.councilDir, file.source)} is missing: ${BUILD_HINT}`));
|
|
38482
|
+
continue;
|
|
38483
|
+
}
|
|
38484
|
+
const path = join(target, file.name);
|
|
38485
|
+
if (io.kind(path) === "link") {
|
|
38486
|
+
rows.push(row$5(file.name, "fail", `${path} is a symbolic link; it will not be written through`));
|
|
38487
|
+
continue;
|
|
38488
|
+
}
|
|
38489
|
+
const current = io.read(path);
|
|
38490
|
+
const same = current !== void 0 && Buffer.from(current).equals(Buffer.from(data));
|
|
38491
|
+
planned.push({
|
|
38492
|
+
name: file.name,
|
|
38493
|
+
data,
|
|
38494
|
+
state: current === void 0 ? "new" : same ? "unchanged" : "changed"
|
|
38495
|
+
});
|
|
38496
|
+
}
|
|
38497
|
+
if (rows.some((r) => r.status === "fail")) return finish(rows);
|
|
38498
|
+
const pending = planned.filter((p) => p.state !== "unchanged");
|
|
38499
|
+
if (pending.length === 0) {
|
|
38500
|
+
for (const p of planned) rows.push(row$5(p.name, "ok", "unchanged"));
|
|
38501
|
+
rows.push(row$5("council", "ok", `already up to date in ${target}; nothing was changed`));
|
|
38502
|
+
return finish(rows, true);
|
|
38503
|
+
}
|
|
38504
|
+
if (dryRun) {
|
|
38505
|
+
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})`));
|
|
38506
|
+
return finish(rows, true);
|
|
38507
|
+
}
|
|
38508
|
+
if (!input.yes) {
|
|
38509
|
+
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`);
|
|
38510
|
+
if (!await (input.confirm ?? ((message) => confirm({
|
|
38511
|
+
message,
|
|
38512
|
+
default: false
|
|
38513
|
+
})))(`Copy ${pending.map((p) => p.name).join(" and ")} into ${target}?`)) {
|
|
38514
|
+
print(` ${style.skip("cancelled; nothing was changed")}`);
|
|
38515
|
+
return {
|
|
38516
|
+
status: "cancelled",
|
|
38517
|
+
rows: []
|
|
38518
|
+
};
|
|
38519
|
+
}
|
|
38520
|
+
}
|
|
38521
|
+
try {
|
|
38522
|
+
io.mkdir(target);
|
|
38523
|
+
} catch (err) {
|
|
38524
|
+
rows.push(row$5("plugin folder", "fail", describeError(err)));
|
|
38525
|
+
return finish(rows);
|
|
38526
|
+
}
|
|
38527
|
+
for (const p of planned) {
|
|
38528
|
+
if (p.state === "unchanged") {
|
|
38529
|
+
rows.push(row$5(p.name, "ok", "unchanged"));
|
|
38530
|
+
continue;
|
|
38531
|
+
}
|
|
38532
|
+
try {
|
|
38533
|
+
io.write(join(target, p.name), p.data);
|
|
38534
|
+
rows.push(row$5(p.name, "ok", `${p.state === "new" ? "copied" : "updated"} in ${target}`));
|
|
38535
|
+
} catch (err) {
|
|
38536
|
+
rows.push(row$5(p.name, "fail", describeError(err)));
|
|
38537
|
+
}
|
|
38538
|
+
}
|
|
38539
|
+
return finish(rows, true);
|
|
38540
|
+
}
|
|
38541
|
+
// src/commands/council-setup/council-setup.command.ts
|
|
38542
|
+
const councilSetupCommand = {
|
|
38543
|
+
command: "council",
|
|
38544
|
+
describe: "Install or update the Council Obsidian plugin in a vault (its built files, copied; never deleted)",
|
|
38545
|
+
builder: (y) => y.option("vault", {
|
|
38546
|
+
type: "string",
|
|
38547
|
+
describe: "The Obsidian vault folder (default: the folder of the configured ideas provider)"
|
|
38548
|
+
}).option("yes", {
|
|
38549
|
+
type: "boolean",
|
|
38550
|
+
describe: "Copy without asking (required without a terminal)"
|
|
38551
|
+
}),
|
|
38552
|
+
handler: async (argv) => {
|
|
38553
|
+
const tokens = tokenContext(argv.token);
|
|
38554
|
+
if (!tokens) return;
|
|
38555
|
+
const loaded = await loadConfig(argv.cwd);
|
|
38556
|
+
applyResolvedConfig(argv, loaded.resolved);
|
|
38557
|
+
const root = findRootSync(argv.cwd, "pnpm-workspace.yaml", { fallback: "start" });
|
|
38558
|
+
if ((await runCouncilSetup({
|
|
38559
|
+
loaded,
|
|
38560
|
+
context: {
|
|
38561
|
+
repoRoot: argv.cwd,
|
|
38562
|
+
dryRun: argv.dryRun,
|
|
38563
|
+
...tokens,
|
|
38564
|
+
org: resolveOrg(argv, loaded.resolved)
|
|
38565
|
+
},
|
|
38566
|
+
councilDir: join(root, "apps", "council"),
|
|
38567
|
+
...argv.vault ? { vault: argv.vault } : {},
|
|
38568
|
+
...argv.yes ? { yes: true } : {}
|
|
38569
|
+
})).status === "fail") process.exitCode = 1;
|
|
38570
|
+
}
|
|
38571
|
+
};
|
|
38333
38572
|
// src/commands/notifications-setup/notifications-setup.args.ts
|
|
38334
38573
|
const notificationsSetupArgs = (y) => y.option("scope", {
|
|
38335
38574
|
type: "string",
|
|
@@ -38462,7 +38701,7 @@ const setupArgs = (y) => y.option("repo", {
|
|
|
38462
38701
|
const setupCommand = {
|
|
38463
38702
|
command: "setup",
|
|
38464
38703
|
describe: "Apply infra setup actions across every configured capability",
|
|
38465
|
-
builder: (y) => setupArgs(y).command(notificationsSetupCommand).command(projectSetupCommand),
|
|
38704
|
+
builder: (y) => setupArgs(y).command(notificationsSetupCommand).command(councilSetupCommand).command(projectSetupCommand),
|
|
38466
38705
|
handler: async (argv) => {
|
|
38467
38706
|
const tokens = tokenContext(argv.token);
|
|
38468
38707
|
if (!tokens) return;
|
|
@@ -38791,27 +39030,6 @@ const startCommand = {
|
|
|
38791
39030
|
builder: (y) => y.command(startWorkCommand).command(startAgentCommand).command(groupMenu("start")),
|
|
38792
39031
|
handler: () => {}
|
|
38793
39032
|
};
|
|
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
39033
|
// src/commands/ideas-sync/run-ideas-sync/oldest-issue-key/oldest-issue-key.ts
|
|
38816
39034
|
/**
|
|
38817
39035
|
* The key of the oldest issue among `keys`, which is the one that wins when overlapping runs filed the same idea.
|
|
@@ -42471,6 +42689,89 @@ const COMMAND_MODULES = [
|
|
|
42471
42689
|
rotateCommand,
|
|
42472
42690
|
projectCommand
|
|
42473
42691
|
];
|
|
42692
|
+
// src/cli/command-progress/command-progress.ts
|
|
42693
|
+
/**
|
|
42694
|
+
* The commands that get no start-up spinner, each with its reason. They hand the terminal to something else, a child
|
|
42695
|
+
* process or the person, whose output the CLI cannot see: a spinner would be drawn over it. Every other command gets one,
|
|
42696
|
+
* so a new command is covered with no wiring (see `startCommandProgress()` in `@theholocron/kyber/ui`).
|
|
42697
|
+
*/
|
|
42698
|
+
const PROGRESS_EXEMPT = [
|
|
42699
|
+
{
|
|
42700
|
+
command: "run",
|
|
42701
|
+
reason: "runs the repo's own tools, which write to the terminal themselves"
|
|
42702
|
+
},
|
|
42703
|
+
{
|
|
42704
|
+
command: "deploy",
|
|
42705
|
+
exact: true,
|
|
42706
|
+
reason: "builds the app and uploads it with child processes that write to the terminal"
|
|
42707
|
+
},
|
|
42708
|
+
{
|
|
42709
|
+
command: "deploy on-release",
|
|
42710
|
+
reason: "runs each package's deploy script, which writes to the terminal"
|
|
42711
|
+
},
|
|
42712
|
+
{
|
|
42713
|
+
command: "publish",
|
|
42714
|
+
reason: "runs npm and git, which write to the terminal and may ask for a one-time code"
|
|
42715
|
+
},
|
|
42716
|
+
{
|
|
42717
|
+
command: "upgrade",
|
|
42718
|
+
reason: "runs the package manager, which writes to the terminal"
|
|
42719
|
+
},
|
|
42720
|
+
{
|
|
42721
|
+
command: "dev",
|
|
42722
|
+
reason: "supervises the app and a tunnel for as long as they run"
|
|
42723
|
+
},
|
|
42724
|
+
{
|
|
42725
|
+
command: "new tunnel",
|
|
42726
|
+
reason: "runs cloudflared in the foreground for as long as it runs"
|
|
42727
|
+
},
|
|
42728
|
+
{
|
|
42729
|
+
command: "new repo",
|
|
42730
|
+
reason: "asks its own questions and runs the package manager"
|
|
42731
|
+
},
|
|
42732
|
+
{
|
|
42733
|
+
command: "new plugin",
|
|
42734
|
+
reason: "asks its own questions and runs the package manager"
|
|
42735
|
+
},
|
|
42736
|
+
{
|
|
42737
|
+
command: "clone",
|
|
42738
|
+
reason: "runs git, which writes its own progress"
|
|
42739
|
+
},
|
|
42740
|
+
{
|
|
42741
|
+
command: "install skills",
|
|
42742
|
+
reason: "runs the skills installer, which writes to the terminal"
|
|
42743
|
+
},
|
|
42744
|
+
{
|
|
42745
|
+
command: "update skills",
|
|
42746
|
+
reason: "runs the skills installer, which writes to the terminal"
|
|
42747
|
+
},
|
|
42748
|
+
{
|
|
42749
|
+
command: "open requests",
|
|
42750
|
+
reason: "holds the terminal for the request tool until it is closed"
|
|
42751
|
+
},
|
|
42752
|
+
{
|
|
42753
|
+
command: "start agent",
|
|
42754
|
+
reason: "hands the terminal to the agent"
|
|
42755
|
+
}
|
|
42756
|
+
];
|
|
42757
|
+
/** Whether `words` is `exemption`'s command, or one under it when it is not `exact`. */
|
|
42758
|
+
function matches(words, exemption) {
|
|
42759
|
+
const parts = exemption.command.split(" ");
|
|
42760
|
+
if (exemption.exact && words.length !== parts.length) return false;
|
|
42761
|
+
return parts.every((part, i) => words[i] === part);
|
|
42762
|
+
}
|
|
42763
|
+
/**
|
|
42764
|
+
* The spinner text for a command, `doctor secrets…`, or `undefined` when it gets none: no command words (the menu), or a
|
|
42765
|
+
* command in {@link PROGRESS_EXEMPT}.
|
|
42766
|
+
*
|
|
42767
|
+
* @param words - The command's words, `argv._`.
|
|
42768
|
+
*/
|
|
42769
|
+
function commandProgressLabel(words) {
|
|
42770
|
+
const named = words.slice(0, 3).map(String);
|
|
42771
|
+
if (named.length === 0) return void 0;
|
|
42772
|
+
if (PROGRESS_EXEMPT.some((exemption) => matches(named, exemption))) return void 0;
|
|
42773
|
+
return `${named.join(" ")}…`;
|
|
42774
|
+
}
|
|
42474
42775
|
// src/cli/own-package-json.ts
|
|
42475
42776
|
/**
|
|
42476
42777
|
* The `name` and `version` of the package that `moduleUrl` belongs to, from the nearest `package.json` above it.
|
|
@@ -42552,6 +42853,8 @@ try {
|
|
|
42552
42853
|
org: argv.org
|
|
42553
42854
|
});
|
|
42554
42855
|
finishCommand = startCommand$1(name);
|
|
42856
|
+
const label = commandProgressLabel(argv._);
|
|
42857
|
+
if (label) startCommandProgress(label);
|
|
42555
42858
|
}).command(COMMAND_MODULES).command(menuCommand(CLI_VERSION)).strict().help().epilogue(`Execution contexts:
|
|
42556
42859
|
global works from a bare 'npm i -g': ${commandsInContext("global").join(", ")}\n repo-aware needs ./holocron.config in cwd: ${commandsInContext("repo-aware").join(", ")}\n workspace also needs the plugin packages: ${commandsInContext("workspace").join(", ")}\n https://docs.theholocron.dev/holocron/execution-contexts`).fail((msg, err) => {
|
|
42557
42860
|
if (err instanceof Error && USER_FACING_ERRORS.has(err.name)) {
|
|
@@ -42570,6 +42873,8 @@ try {
|
|
|
42570
42873
|
captureException(err);
|
|
42571
42874
|
if (!errorReported) reportError(commandFailureMessage(err));
|
|
42572
42875
|
if (!process.exitCode) process.exitCode = 1;
|
|
42876
|
+
} finally {
|
|
42877
|
+
stopCommandSpinner();
|
|
42573
42878
|
}
|
|
42574
42879
|
finishCommand(!process.exitCode);
|
|
42575
42880
|
endSession();
|