@theholocron/cli 5.0.0-alpha.264 → 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 CHANGED
@@ -539,15 +539,17 @@ A `notifications` provider can declare a whole server in `holocron.config.ts`
539
539
  pinned messages, onboarding, the bot application) and the CLI applies and checks it. The
540
540
  commands and the config are provider-neutral; Discord is the first provider.
541
541
 
542
- | Command | What it does |
543
- | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
544
- | `holocron notifications setup` | Applies the layout; looks everything up by name first, so a re-run changes nothing that matches |
545
- | `holocron notifications channel add <name>` | Creates one channel (optionally with a webhook whose URL is stored as a secret) |
546
- | `holocron notifications create-server --name <n> --owner <id>` | Creates the server the layout describes, writes its id into the config, applies the layout, invites the owner, waits for them to join and hands the server over (`--resume` finishes an interrupted hand-over; `--force` allows a second server) |
547
- | `holocron notifications link` | Links your account on the provider to your GitHub account by signing in with the provider (OAuth, nothing secret kept) |
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
- | `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
- | `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 |
542
+ | Command | What it does |
543
+ | -------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
544
+ | `holocron notifications setup` | Applies the layout; looks everything up by name first, so a re-run changes nothing that matches |
545
+ | `holocron notifications channel add <name>` | Creates one channel (optionally with a webhook whose URL is stored as a secret) |
546
+ | `holocron notifications create-server --name <n> --owner <id>` | Creates the server the layout describes, writes its id into the config, applies the layout, invites the owner, waits for them to join and hands the server over (`--resume` finishes an interrupted hand-over; `--force` allows a second server) |
547
+ | `holocron notifications link` | Links your account on the provider to your GitHub account by signing in with the provider (OAuth, nothing secret kept) |
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
+ | `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
+ | `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 |
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 |
551
553
 
552
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).
553
555
 
@@ -768,7 +770,7 @@ the local override exists to exempt.
768
770
  `package bump-versions`, `sync github`, `repo upgrade node`,
769
771
  `repo upgrade deps`, `new plugin`, `auth`, `notifications setup`,
770
772
  `notifications channel add`, `notifications link`,
771
- `notifications sync-roles`, `doctor notifications`
773
+ `notifications sync-roles`, `doctor notifications`, `doctor variables`
772
774
  - `src/commands/doctor-checks/` and `src/commands/deep-checks/` — the shared row
773
775
  renderer and `declaredVsActual` helper, and `DEEP_CHECKS`, the registry every
774
776
  `doctor <capability>` is listed in
package/dist/cli.mjs CHANGED
@@ -214,7 +214,9 @@ 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",
219
+ "doctor variables": "workspace",
218
220
  probe: "workspace",
219
221
  deploy: "workspace",
220
222
  "deploy cleanup-preview": "workspace",
@@ -1404,6 +1406,15 @@ const doctorEntry = {
1404
1406
  positionals: [],
1405
1407
  supportsDryRun: true
1406
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
+ };
1407
1418
  // src/commands/doctor-notifications/doctor-notifications.entry.ts
1408
1419
  const doctorNotificationsEntry = {
1409
1420
  name: "doctor notifications",
@@ -1418,6 +1429,13 @@ const doctorNotificationsEntry = {
1418
1429
  }],
1419
1430
  supportsDryRun: false
1420
1431
  };
1432
+ // src/commands/doctor-variables/doctor-variables.entry.ts
1433
+ const doctorVariablesEntry = {
1434
+ name: "doctor variables",
1435
+ description: "Check the Actions variables the config declares against the ones the provider holds (read-only)",
1436
+ positionals: [],
1437
+ supportsDryRun: false
1438
+ };
1421
1439
  // src/commands/monitoring-check/monitoring-check.entry.ts
1422
1440
  const monitoringCheckEntry = {
1423
1441
  name: "monitoring check",
@@ -1586,6 +1604,7 @@ const PUBLISH_OTP_OPTION = {
1586
1604
  const COMMAND_REGISTRY = [
1587
1605
  cloneEntry,
1588
1606
  doctorEntry,
1607
+ doctorAllEntry,
1589
1608
  probeEntry,
1590
1609
  {
1591
1610
  name: "repo setup",
@@ -1621,6 +1640,7 @@ const COMMAND_REGISTRY = [
1621
1640
  },
1622
1641
  notificationsChannelAddEntry,
1623
1642
  doctorNotificationsEntry,
1643
+ doctorVariablesEntry,
1624
1644
  notificationsSetupEntry,
1625
1645
  notificationsCreateServerEntry,
1626
1646
  notificationsLinkEntry,
@@ -1816,7 +1836,7 @@ function menuItems(entries, path = []) {
1816
1836
  const self = family.find((e) => e.name === full);
1817
1837
  const nested = family.filter((e) => e.name !== full);
1818
1838
  if (nested.length === 0 && self) items.push({
1819
- name: self.opensMenu ? `${word} ›` : word,
1839
+ name: self.menuLabel ?? (self.opensMenu ? `${word} ›` : word),
1820
1840
  value: full,
1821
1841
  description: self.description,
1822
1842
  haystack: haystackOf([self])
@@ -2178,6 +2198,14 @@ var ElevationRequiredError = class extends Error {
2178
2198
  this.elevation = elevation;
2179
2199
  }
2180
2200
  };
2201
+ /**
2202
+ * A provider cannot do a read because it has no token for it. A check that meets this skips with the message instead
2203
+ * of failing: the token is missing, not wrong.
2204
+ */
2205
+ var MissingTokenError = class extends Error {
2206
+ /** Lets a caller tell this error from any other by name, across package copies. */
2207
+ name = "MissingTokenError";
2208
+ };
2181
2209
  // src/config/config/config.ts
2182
2210
  var ConfigError = class extends Error {
2183
2211
  name = "ConfigError";
@@ -3889,6 +3917,29 @@ function logReason(err) {
3889
3917
  const root = err instanceof Error && err.cause !== void 0 ? err.cause : err;
3890
3918
  return errorMessage(root);
3891
3919
  }
3920
+ // src/commands/doctor-checks/declared-vs-actual.ts
3921
+ /**
3922
+ * Compares what the config declares with what exists, both as maps by key, and returns one problem line per
3923
+ * difference: a declared key that is missing, a key found but not declared, a key whose values disagree.
3924
+ * An empty list means they match. A deep check is then a list of these comparisons, not a renderer of its own.
3925
+ */
3926
+ function declaredVsActual(declared, actual, options) {
3927
+ const equal = options.equal ?? ((a, b) => a === b);
3928
+ const show = options.show ?? ((value) => String(value));
3929
+ const problems = [];
3930
+ for (const [key, want] of declared) {
3931
+ if (!actual.has(key)) {
3932
+ problems.push(`missing ${options.noun} ${key}`);
3933
+ continue;
3934
+ }
3935
+ const found = actual.get(key);
3936
+ if (!equal(want, found)) problems.push(`${options.noun} ${key}: declared ${show(want)}, found ${show(found)}`);
3937
+ }
3938
+ if (options.flagExtra !== false) {
3939
+ for (const key of actual.keys()) if (!declared.has(key)) problems.push(`unexpected ${options.noun} ${key}`);
3940
+ }
3941
+ return problems;
3942
+ }
3892
3943
  // src/commands/doctor-checks/print-check-rows.ts
3893
3944
  /** One row per step, titles padded to the widest, each problem on its own indented line. */
3894
3945
  function printCheckRows(rows, print) {
@@ -3904,6 +3955,15 @@ function printCheckSummary(summary, print) {
3904
3955
  print("");
3905
3956
  print(style.header(`${summary.ok} ok, ${summary.fail} fail, ${summary.skip} skipped`));
3906
3957
  }
3958
+ // src/commands/doctor-checks/summarise-checks.ts
3959
+ /** How many rows ended each way. */
3960
+ function summariseChecks(rows) {
3961
+ return {
3962
+ ok: rows.filter((r) => r.status === "ok").length,
3963
+ fail: rows.filter((r) => r.status === "fail").length,
3964
+ skip: rows.filter((r) => r.status === "skip").length
3965
+ };
3966
+ }
3907
3967
  // src/commands/notifications-channel-add/avatar.ts
3908
3968
  /**
3909
3969
  * Read a webhook avatar named in a layout: a file path (from the directory the CLI runs in) or an
@@ -5439,6 +5499,175 @@ async function runDoctorNotifications(input) {
5439
5499
  }, print);
5440
5500
  return finish();
5441
5501
  }
5502
+ // src/commands/doctor-notifications/doctor-notifications.command.ts
5503
+ const doctorNotificationsCommand = {
5504
+ command: "notifications",
5505
+ describe: "Check the layout against the server and the secrets store, step by step (a full run leaves one test post in the test channel; --built-only posts nothing unless --deliver)",
5506
+ builder: doctorNotificationsArgs,
5507
+ handler: async (argv) => {
5508
+ const tokens = tokenContext(argv.token);
5509
+ if (!tokens) return;
5510
+ const loaded = await loadConfig(argv.cwd);
5511
+ applyResolvedConfig(argv, loaded.resolved);
5512
+ if ((await runDoctorNotifications({
5513
+ loaded,
5514
+ context: {
5515
+ repoRoot: argv.cwd,
5516
+ ...tokens,
5517
+ org: resolveOrg(argv, loaded.resolved)
5518
+ },
5519
+ ...argv.scope ? { scope: parseScope(argv.scope) } : {},
5520
+ ...argv.provider ? { provider: argv.provider } : {},
5521
+ ...argv.builtOnly ? { builtOnly: true } : {},
5522
+ ...argv.deliver ? { deliver: true } : {}
5523
+ })).status === "fail") process.exitCode = 1;
5524
+ }
5525
+ };
5526
+ // src/commands/doctor-variables/doctor-variables.ts
5527
+ /**
5528
+ * `holocron doctor variables` — do the Actions variables `repo.variables` declares exist, with those values?
5529
+ *
5530
+ * Read-only. One row for the repository's variables and one for the organization's, each only when the config
5531
+ * declares that scope. A variable that exists but is not declared is a problem only with `repo.variables.prune`,
5532
+ * since without it `repo setup` leaves it alone. A scope that cannot be read because there is no provider, the
5533
+ * provider cannot list variables, or the token is missing is a skip with the reason, not a failure.
5534
+ */
5535
+ const REPO_TITLE = "repository variables match";
5536
+ const ORG_TITLE = "organization variables match";
5537
+ async function runDoctorVariables(input) {
5538
+ const print = input.print ?? ((line) => console.log(line));
5539
+ const logger = input.logger ?? getLogger();
5540
+ const loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);
5541
+ await loader.load();
5542
+ assertPluginsResolvable(loader, "doctor variables");
5543
+ const config = input.loaded.resolved;
5544
+ const variables = config.repo?.variables;
5545
+ const prune = variables?.prune === true;
5546
+ const declares = (scope) => scope !== void 0 && (Object.keys(scope).length > 0 || prune);
5547
+ const checks = [];
5548
+ if (declares(variables?.repo)) checks.push({
5549
+ id: "repo-variables",
5550
+ title: REPO_TITLE,
5551
+ async run(source) {
5552
+ if (!source.listVariables) return { skip: "provider does not implement listVariables" };
5553
+ const declared = variables.repo;
5554
+ return {
5555
+ problems: compareRepo(declared, await source.listVariables(), prune),
5556
+ checked: Object.keys(declared).length
5557
+ };
5558
+ }
5559
+ });
5560
+ if (declares(variables?.org)) checks.push({
5561
+ id: "org-variables",
5562
+ title: ORG_TITLE,
5563
+ async run(source) {
5564
+ if (!source.listOrgVariables) return { skip: "provider does not implement listOrgVariables" };
5565
+ const org = input.context.org ?? (input.context.repo ?? config.repo?.name ?? "").split("/")[0];
5566
+ if (!org) return {
5567
+ problems: ["no organization: set `org` in the config or run inside a repository"],
5568
+ checked: 0
5569
+ };
5570
+ const declared = variables.org;
5571
+ return {
5572
+ problems: compareOrg(declared, await source.listOrgVariables(org), prune),
5573
+ checked: Object.keys(declared).length
5574
+ };
5575
+ }
5576
+ });
5577
+ const rows = [];
5578
+ if (checks.length === 0) rows.push({
5579
+ id: "variables",
5580
+ title: "variables",
5581
+ status: "ok",
5582
+ detail: "none declared",
5583
+ problems: []
5584
+ });
5585
+ else if (!loader.has("source")) {
5586
+ const why = whyMissing(loader, "source", "no `source` provider to read them with");
5587
+ for (const check of checks) rows.push(row(check, { skip: why }));
5588
+ } else {
5589
+ const source = loader.get("source");
5590
+ for (const check of checks) try {
5591
+ rows.push(row(check, await check.run(source)));
5592
+ } catch (err) {
5593
+ if (err instanceof MissingTokenError) rows.push(row(check, { skip: err.message }));
5594
+ else rows.push({
5595
+ id: check.id,
5596
+ title: check.title,
5597
+ status: "fail",
5598
+ detail: errorMessage(err),
5599
+ problems: []
5600
+ });
5601
+ }
5602
+ }
5603
+ printCheckRows(rows, print);
5604
+ const summary = summariseChecks(rows);
5605
+ printCheckSummary(summary, print);
5606
+ const status = summary.fail > 0 ? "fail" : summary.ok === 0 ? "skip" : "ok";
5607
+ logger.info({
5608
+ ...summary,
5609
+ status
5610
+ }, "doctor variables");
5611
+ return {
5612
+ status,
5613
+ rows,
5614
+ summary,
5615
+ ...status === "skip" ? { reason: rows.map((r) => r.detail).join("; ") } : {}
5616
+ };
5617
+ }
5618
+ function row(check, result) {
5619
+ const { id, title } = check;
5620
+ if ("skip" in result) return {
5621
+ id,
5622
+ title,
5623
+ status: "skip",
5624
+ detail: result.skip,
5625
+ problems: []
5626
+ };
5627
+ if (result.problems.length > 0) return {
5628
+ id,
5629
+ title,
5630
+ status: "fail",
5631
+ detail: `${result.problems.length} problem(s)`,
5632
+ problems: result.problems
5633
+ };
5634
+ return {
5635
+ id,
5636
+ title,
5637
+ status: "ok",
5638
+ detail: `${result.checked} of ${result.checked} match`,
5639
+ problems: []
5640
+ };
5641
+ }
5642
+ /** Re-keys what GitHub holds by the spelling the config declares, since GitHub treats names as case-insensitive. */
5643
+ function bySpelling(declared, have) {
5644
+ const spelled = new Map(declared.map((name) => [name.toUpperCase(), name]));
5645
+ return new Map(Object.entries(have).map(([name, value]) => [spelled.get(name.toUpperCase()) ?? name, value]));
5646
+ }
5647
+ function compareRepo(declared, have, prune) {
5648
+ return declaredVsActual(new Map(Object.entries(declared)), bySpelling(Object.keys(declared), have), {
5649
+ noun: "variable",
5650
+ flagExtra: prune,
5651
+ show: (value) => JSON.stringify(value)
5652
+ });
5653
+ }
5654
+ function compareOrg(declared, have, prune) {
5655
+ const wanted = new Map(Object.entries(declared).map(([name, v]) => [name, typeof v === "string" ? {
5656
+ value: v,
5657
+ visibility: "all"
5658
+ } : {
5659
+ value: v.value,
5660
+ visibility: v.visibility ?? "all"
5661
+ }]));
5662
+ const found = bySpelling(Object.keys(declared), have);
5663
+ for (const [name, v] of found) if (!wanted.has(name) && v.visibility === "selected") found.delete(name);
5664
+ return declaredVsActual(wanted, found, {
5665
+ noun: "organization variable",
5666
+ flagExtra: prune,
5667
+ equal: (a, b) => a.value === b.value && a.visibility === b.visibility,
5668
+ show: (v) => `${JSON.stringify(v.value)} (${v.visibility})`
5669
+ });
5670
+ }
5442
5671
  // src/commands/deep-checks/deep-checks.ts
5443
5672
  /**
5444
5673
  * Every `doctor <capability>` deep check, in the order `doctor --all` runs them. Adding one is an entry here
@@ -5447,45 +5676,142 @@ async function runDoctorNotifications(input) {
5447
5676
  const DEEP_CHECKS = [{
5448
5677
  name: "notifications",
5449
5678
  capability: "notifications",
5679
+ command: doctorNotificationsCommand,
5680
+ async run(input) {
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
+ };
5694
+ return {
5695
+ status: report.status,
5696
+ summary: {
5697
+ ok: report.summary.pass,
5698
+ fail: report.summary.fail,
5699
+ skip: report.summary.skip
5700
+ }
5701
+ };
5702
+ }
5703
+ }, {
5704
+ name: "variables",
5705
+ capability: "source",
5450
5706
  command: {
5451
- command: "notifications",
5452
- describe: "Check the layout against the server and the secrets store, step by step (a full run leaves one test post in the test channel; --built-only posts nothing unless --deliver)",
5453
- builder: doctorNotificationsArgs,
5707
+ command: "variables",
5708
+ describe: "Check the Actions variables the config declares against the ones the provider holds (read-only)",
5454
5709
  handler: async (argv) => {
5455
5710
  const tokens = tokenContext(argv.token);
5456
5711
  if (!tokens) return;
5457
5712
  const loaded = await loadConfig(argv.cwd);
5458
5713
  applyResolvedConfig(argv, loaded.resolved);
5459
- if ((await runDoctorNotifications({
5714
+ if ((await runDoctorVariables({
5460
5715
  loaded,
5461
5716
  context: {
5462
5717
  repoRoot: argv.cwd,
5463
5718
  ...tokens,
5464
5719
  org: resolveOrg(argv, loaded.resolved)
5465
- },
5466
- ...argv.scope ? { scope: parseScope(argv.scope) } : {},
5467
- ...argv.provider ? { provider: argv.provider } : {},
5468
- ...argv.builtOnly ? { builtOnly: true } : {},
5469
- ...argv.deliver ? { deliver: true } : {}
5720
+ }
5470
5721
  })).status === "fail") process.exitCode = 1;
5471
5722
  }
5472
5723
  },
5473
5724
  async run(input) {
5474
- const report = await runDoctorNotifications(input);
5725
+ const report = await runDoctorVariables(input);
5475
5726
  return {
5476
5727
  status: report.status,
5728
+ summary: report.summary,
5729
+ ...report.reason ? { reason: report.reason } : {}
5730
+ };
5731
+ }
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",
5477
5775
  summary: {
5478
- ok: report.summary.pass,
5479
- fail: report.summary.fail,
5480
- skip: report.summary.skip
5776
+ ok: 0,
5777
+ fail: 0,
5778
+ skip: 1
5481
5779
  },
5482
- ...report.message ? { reason: report.message } : {}
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)
5483
5790
  };
5484
5791
  }
5485
- }];
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
+ }
5486
5808
  // src/commands/doctor/doctor.args.ts
5487
5809
  const doctorArgs = (y) => {
5488
- const withRepo = y.option("repo", {
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", {
5489
5815
  type: "string",
5490
5816
  describe: "Repo coords (\"owner/name\"). Defaults to plugin-specific resolution."
5491
5817
  });
@@ -5696,6 +6022,18 @@ const doctorCommand = {
5696
6022
  if (!tokens) return;
5697
6023
  const loaded = await loadConfig(argv.cwd);
5698
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
+ }
5699
6037
  if ((await runDoctor({
5700
6038
  loaded,
5701
6039
  context: {