@theholocron/cli 5.0.0-alpha.265 → 5.0.0-alpha.266
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 +1 -0
- package/dist/cli.mjs +118 -5
- package/dist/cli.mjs.map +1 -1
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -548,6 +548,7 @@ commands and the config are provider-neutral; Discord is the first provider.
|
|
|
548
548
|
| `holocron notifications sync-roles` | Makes who holds a role match a GitHub team, through the links file (`--keep` only adds; `--provider` picks one) |
|
|
549
549
|
| `holocron doctor notifications [--built-only] [--deliver]` | Step by step: does the server match the layout, do the secrets exist, and does a person (not the bot) own it. A full run also leaves one `🧪 test:` post in the layout's `testChannel`; `--built-only` posts nothing; `--deliver` posts to every channel and removes each post |
|
|
550
550
|
| `holocron doctor variables` | Do the Actions variables `repo.variables` declares exist, with those values (and, for the organization's, that visibility)? One row for the repository and one for the organization, each only when declared. Read-only. An undeclared variable counts only with `prune`; a scope that cannot be read (no provider, no org token) is a skip, not a failure |
|
|
551
|
+
| `holocron doctor --all` | Runs every deep check (`doctor notifications`, `doctor variables`, ...) and prints one row each, then `N ok, N fail, N skipped` counted in checks. Exits 1 when any check failed. A check that cannot run (no provider, no token) is a skip with the reason. Read-only: notifications runs as `--built-only`, so it posts nothing |
|
|
551
552
|
| `holocron probe [<provider> [<probe>]] [--dry-run] [--yes]` | Poke a live provider on purpose: list the probes, inspect something, or run a proof that cleans up after itself. Plugins offer the probes; nothing secret is printed; one that changes things asks first |
|
|
552
553
|
|
|
553
554
|
Channels fed by another service are declared with `feeds` on the channel: `{ name: "uptime", webhook: true, feeds: { monitoring: true } }` (the object form `{ name?, webhook?, avatar? }` overrides the alert channel's name, default `Message to #<channel>`, the dedicated webhook's name, default the provider's, and gives that webhook a picture, a file path or `https://` URL, or `{ url, image }` (the URL is tried first, the file in the repo is the fallback), else the provider's own icon (`Monitoring.icon`, a URL and an embedded `data:` image; Checkly provides one), else the layout's `webhookAvatar`, else the layout's `webhookAvatar`). `setup` gives the channel a dedicated webhook and hands its URL straight to the `monitoring` provider through `Monitoring.ensureAlertChannel({ name, format: "discord", url? })`, which finds an alert channel of that name or creates one and subscribes every check; the URL is never stored as a secret. It needs a `monitoring` provider that implements `ensureAlertChannel` (Checkly does). Two feeds may not share an alert channel name, and a feed's webhook may not share the channel's own webhook name (compared without regard to case).
|
package/dist/cli.mjs
CHANGED
|
@@ -214,6 +214,7 @@ const COMMAND_CONTEXTS = {
|
|
|
214
214
|
"notifications link": "workspace",
|
|
215
215
|
"notifications create-server": "workspace",
|
|
216
216
|
"notifications sync-roles": "workspace",
|
|
217
|
+
"doctor all": "workspace",
|
|
217
218
|
"doctor notifications": "workspace",
|
|
218
219
|
"doctor variables": "workspace",
|
|
219
220
|
probe: "workspace",
|
|
@@ -1405,6 +1406,15 @@ const doctorEntry = {
|
|
|
1405
1406
|
positionals: [],
|
|
1406
1407
|
supportsDryRun: true
|
|
1407
1408
|
};
|
|
1409
|
+
// src/commands/doctor/doctor-all.entry.ts
|
|
1410
|
+
const doctorAllEntry = {
|
|
1411
|
+
name: "doctor all",
|
|
1412
|
+
menuLabel: "doctor (everything)",
|
|
1413
|
+
description: "Run every deep check (doctor <capability>) and print one row each",
|
|
1414
|
+
positionals: [],
|
|
1415
|
+
supportsDryRun: false,
|
|
1416
|
+
spawnArgs: ["doctor", "--all"]
|
|
1417
|
+
};
|
|
1408
1418
|
// src/commands/doctor-notifications/doctor-notifications.entry.ts
|
|
1409
1419
|
const doctorNotificationsEntry = {
|
|
1410
1420
|
name: "doctor notifications",
|
|
@@ -1594,6 +1604,7 @@ const PUBLISH_OTP_OPTION = {
|
|
|
1594
1604
|
const COMMAND_REGISTRY = [
|
|
1595
1605
|
cloneEntry,
|
|
1596
1606
|
doctorEntry,
|
|
1607
|
+
doctorAllEntry,
|
|
1597
1608
|
probeEntry,
|
|
1598
1609
|
{
|
|
1599
1610
|
name: "repo setup",
|
|
@@ -1825,7 +1836,7 @@ function menuItems(entries, path = []) {
|
|
|
1825
1836
|
const self = family.find((e) => e.name === full);
|
|
1826
1837
|
const nested = family.filter((e) => e.name !== full);
|
|
1827
1838
|
if (nested.length === 0 && self) items.push({
|
|
1828
|
-
name: self.opensMenu ? `${word} ›` : word,
|
|
1839
|
+
name: self.menuLabel ?? (self.opensMenu ? `${word} ›` : word),
|
|
1829
1840
|
value: full,
|
|
1830
1841
|
description: self.description,
|
|
1831
1842
|
haystack: haystackOf([self])
|
|
@@ -5667,15 +5678,26 @@ const DEEP_CHECKS = [{
|
|
|
5667
5678
|
capability: "notifications",
|
|
5668
5679
|
command: doctorNotificationsCommand,
|
|
5669
5680
|
async run(input) {
|
|
5670
|
-
const report = await runDoctorNotifications(
|
|
5681
|
+
const report = await runDoctorNotifications({
|
|
5682
|
+
...input,
|
|
5683
|
+
builtOnly: true
|
|
5684
|
+
});
|
|
5685
|
+
if (report.message) return {
|
|
5686
|
+
status: "skip",
|
|
5687
|
+
summary: {
|
|
5688
|
+
ok: 0,
|
|
5689
|
+
fail: 0,
|
|
5690
|
+
skip: 1
|
|
5691
|
+
},
|
|
5692
|
+
reason: report.message
|
|
5693
|
+
};
|
|
5671
5694
|
return {
|
|
5672
5695
|
status: report.status,
|
|
5673
5696
|
summary: {
|
|
5674
5697
|
ok: report.summary.pass,
|
|
5675
5698
|
fail: report.summary.fail,
|
|
5676
5699
|
skip: report.summary.skip
|
|
5677
|
-
}
|
|
5678
|
-
...report.message ? { reason: report.message } : {}
|
|
5700
|
+
}
|
|
5679
5701
|
};
|
|
5680
5702
|
}
|
|
5681
5703
|
}, {
|
|
@@ -5708,9 +5730,88 @@ const DEEP_CHECKS = [{
|
|
|
5708
5730
|
};
|
|
5709
5731
|
}
|
|
5710
5732
|
}];
|
|
5733
|
+
// src/commands/doctor-all/doctor-all.ts
|
|
5734
|
+
/**
|
|
5735
|
+
* `holocron doctor --all` — run every deep check and print one row for each.
|
|
5736
|
+
*
|
|
5737
|
+
* A check's own steps are not printed (they are what `holocron doctor <name>` is for); a failing row says so.
|
|
5738
|
+
* A check that cannot run because a provider or token is missing is a skip with the reason. Any other error
|
|
5739
|
+
* fails that check alone, and the rest still run. The run fails when any check failed.
|
|
5740
|
+
*/
|
|
5741
|
+
async function runDoctorAll(input) {
|
|
5742
|
+
const print = input.print ?? ((line) => console.log(line));
|
|
5743
|
+
const logger = input.logger ?? getLogger();
|
|
5744
|
+
const checks = input.checks ?? DEEP_CHECKS;
|
|
5745
|
+
const rows = [];
|
|
5746
|
+
for (const check of checks) rows.push(toRow(check, await outcomeOf(check, input)));
|
|
5747
|
+
printCheckRows(rows, print);
|
|
5748
|
+
const summary = summariseChecks(rows);
|
|
5749
|
+
printCheckSummary(summary, print);
|
|
5750
|
+
const status = summary.fail > 0 ? "fail" : summary.ok === 0 ? "skip" : "ok";
|
|
5751
|
+
logger.info({
|
|
5752
|
+
...summary,
|
|
5753
|
+
status,
|
|
5754
|
+
checks: rows.map((r) => `${r.id}:${r.status}`)
|
|
5755
|
+
}, "doctor --all");
|
|
5756
|
+
return {
|
|
5757
|
+
status,
|
|
5758
|
+
rows,
|
|
5759
|
+
summary
|
|
5760
|
+
};
|
|
5761
|
+
}
|
|
5762
|
+
/** Runs one check silently. A missing token is a skip; any other error is that check's failure. */
|
|
5763
|
+
async function outcomeOf(check, input) {
|
|
5764
|
+
try {
|
|
5765
|
+
return await check.run({
|
|
5766
|
+
loaded: input.loaded,
|
|
5767
|
+
context: input.context,
|
|
5768
|
+
print: () => {},
|
|
5769
|
+
...input.logger ? { logger: input.logger } : {}
|
|
5770
|
+
});
|
|
5771
|
+
} catch (err) {
|
|
5772
|
+
if (err instanceof WorkspaceContextError) throw err;
|
|
5773
|
+
if (err instanceof MissingTokenError) return {
|
|
5774
|
+
status: "skip",
|
|
5775
|
+
summary: {
|
|
5776
|
+
ok: 0,
|
|
5777
|
+
fail: 0,
|
|
5778
|
+
skip: 1
|
|
5779
|
+
},
|
|
5780
|
+
reason: err.message
|
|
5781
|
+
};
|
|
5782
|
+
return {
|
|
5783
|
+
status: "fail",
|
|
5784
|
+
summary: {
|
|
5785
|
+
ok: 0,
|
|
5786
|
+
fail: 1,
|
|
5787
|
+
skip: 0
|
|
5788
|
+
},
|
|
5789
|
+
reason: errorMessage(err)
|
|
5790
|
+
};
|
|
5791
|
+
}
|
|
5792
|
+
}
|
|
5793
|
+
function toRow(check, outcome) {
|
|
5794
|
+
const { ok, fail, skip } = outcome.summary;
|
|
5795
|
+
const counts = [
|
|
5796
|
+
`${ok} ok`,
|
|
5797
|
+
...fail > 0 ? [`${fail} failed`] : [],
|
|
5798
|
+
...skip > 0 ? [`${skip} skipped`] : []
|
|
5799
|
+
].join(", ");
|
|
5800
|
+
return {
|
|
5801
|
+
id: check.name,
|
|
5802
|
+
title: check.name,
|
|
5803
|
+
status: outcome.status,
|
|
5804
|
+
detail: outcome.status === "ok" ? counts : outcome.reason ?? counts,
|
|
5805
|
+
problems: outcome.status === "fail" ? [`run \`holocron doctor ${check.name}\` for the steps`] : []
|
|
5806
|
+
};
|
|
5807
|
+
}
|
|
5711
5808
|
// src/commands/doctor/doctor.args.ts
|
|
5712
5809
|
const doctorArgs = (y) => {
|
|
5713
|
-
const withRepo = y.option("
|
|
5810
|
+
const withRepo = y.option("all", {
|
|
5811
|
+
type: "boolean",
|
|
5812
|
+
default: false,
|
|
5813
|
+
describe: "Run every deep check (doctor <capability>) and print one row each, instead of the smoke check"
|
|
5814
|
+
}).option("repo", {
|
|
5714
5815
|
type: "string",
|
|
5715
5816
|
describe: "Repo coords (\"owner/name\"). Defaults to plugin-specific resolution."
|
|
5716
5817
|
});
|
|
@@ -5921,6 +6022,18 @@ const doctorCommand = {
|
|
|
5921
6022
|
if (!tokens) return;
|
|
5922
6023
|
const loaded = await loadConfig(argv.cwd);
|
|
5923
6024
|
applyResolvedConfig(argv, loaded.resolved);
|
|
6025
|
+
if (argv.all) {
|
|
6026
|
+
if ((await runDoctorAll({
|
|
6027
|
+
loaded,
|
|
6028
|
+
context: {
|
|
6029
|
+
repoRoot: argv.cwd,
|
|
6030
|
+
...argv.repo ? { repo: argv.repo } : {},
|
|
6031
|
+
...tokens,
|
|
6032
|
+
org: resolveOrg(argv, loaded.resolved)
|
|
6033
|
+
}
|
|
6034
|
+
})).status === "fail") process.exitCode = 1;
|
|
6035
|
+
return;
|
|
6036
|
+
}
|
|
5924
6037
|
if ((await runDoctor({
|
|
5925
6038
|
loaded,
|
|
5926
6039
|
context: {
|