@theholocron/cli 5.0.0-alpha.530 → 5.0.0-alpha.532

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.mjs CHANGED
@@ -3101,6 +3101,10 @@ function validateGitHubApps(apps) {
3101
3101
  const value = app?.[key];
3102
3102
  if (typeof value !== "string" || value.trim() === "") throw new ConfigError(`\`githubApps[${idx}].${key}\` must be a non-empty string`);
3103
3103
  }
3104
+ for (const key of ["app", "label"]) {
3105
+ const value = app?.[key];
3106
+ if (value !== void 0 && (typeof value !== "string" || value.trim() === "")) throw new ConfigError(`\`githubApps[${idx}].${key}\` must be a non-empty string`);
3107
+ }
3104
3108
  validateEnvironmentChoice(app, `\`githubApps[${idx}]\``);
3105
3109
  });
3106
3110
  }
@@ -10590,8 +10594,17 @@ async function runDoctorGitHubApp(input) {
10590
10594
  }
10591
10595
  const rows = [];
10592
10596
  if (instances.length === 0) rows.push(row$25("github-app", "reachable", "skip", "no `githubApps` are declared in holocron.config.ts"));
10593
- for (const instance of instances) rows.push(...await checkInstance(instance, loader, input));
10594
- printCheckRows(rows, print);
10597
+ const checked = [];
10598
+ for (const instance of instances) {
10599
+ const instanceRows = await checkInstance(instance, loader, input);
10600
+ checked.push({
10601
+ instance,
10602
+ rows: instanceRows
10603
+ });
10604
+ rows.push(...instanceRows);
10605
+ }
10606
+ if (instances.length === 0) printCheckRows(rows, print);
10607
+ else printGrouped(checked, print);
10595
10608
  const summary = summariseChecks(rows);
10596
10609
  printCheckSummary(summary, print);
10597
10610
  const status = summary.fail > 0 ? "fail" : summary.ok === 0 ? "skip" : "ok";
@@ -10606,6 +10619,27 @@ async function runDoctorGitHubApp(input) {
10606
10619
  ...status === "skip" ? { reason: [...new Set(rows.map((r) => r.detail))].join("; ") } : {}
10607
10620
  };
10608
10621
  }
10622
+ /**
10623
+ * Prints the instances under their `app` heading (first appearance first) and, when an instance has a `label`, under
10624
+ * that subheading. An instance with neither is printed flat with its full row titles, as before.
10625
+ */
10626
+ function printGrouped(checked, print) {
10627
+ const headings = [...new Set(checked.map(({ instance }) => instance.app).filter((a) => !!a))];
10628
+ const flat = checked.filter(({ instance }) => !instance.app);
10629
+ for (const { rows } of flat) printCheckRows(rows, print);
10630
+ for (const heading of headings) {
10631
+ print(heading);
10632
+ for (const { instance, rows } of checked.filter((c) => c.instance.app === heading)) {
10633
+ const indent = instance.label ? " " : " ";
10634
+ if (instance.label) print(` ${instance.label}`);
10635
+ const shown = rows.map((r) => ({
10636
+ ...r,
10637
+ title: r.title.slice(instance.name.length + 2)
10638
+ }));
10639
+ printCheckRows(shown, (line) => print(`${indent}${line}`));
10640
+ }
10641
+ }
10642
+ }
10609
10643
  function row$25(name, what, status, detail) {
10610
10644
  return {
10611
10645
  id: `${name}:${what}`,