@theholocron/cli 5.0.0-alpha.480 → 5.0.0-alpha.481

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
@@ -106,6 +106,7 @@ const COMMAND_CONTEXTS = {
106
106
  "doctor environments": "workspace",
107
107
  "doctor project": "workspace",
108
108
  "doctor logs": "workspace",
109
+ "doctor wiki": "workspace",
109
110
  "doctor github-app": "workspace",
110
111
  "move issues": "workspace",
111
112
  "apply properties": "workspace",
@@ -521,6 +522,14 @@ const doctorTokensEntry = {
521
522
  skipOptions: ["all", "repo"],
522
523
  supportsDryRun: false
523
524
  };
525
+ // src/commands/doctor-wiki/doctor-wiki.entry.ts
526
+ const doctorWikiEntry = {
527
+ name: "doctor wiki",
528
+ description: "Check the wiki's organization, docs site, domain and published pages (read-only)",
529
+ positionals: [],
530
+ skipOptions: ["all", "repo"],
531
+ supportsDryRun: false
532
+ };
524
533
  // src/commands/github-app-create/github-app-create.entry.ts
525
534
  const githubAppCreateEntry = {
526
535
  name: "new github-app",
@@ -1324,6 +1333,7 @@ const registry = createCommandRegistry([
1324
1333
  doctorProjectEntry,
1325
1334
  doctorGitHubAppEntry,
1326
1335
  doctorLogsEntry,
1336
+ doctorWikiEntry,
1327
1337
  projectMoveEntry,
1328
1338
  repoPropertiesApplyEntry,
1329
1339
  migrateIssueEntry,
@@ -2451,7 +2461,7 @@ function mergeSync(a, b) {
2451
2461
  } : rest);
2452
2462
  }
2453
2463
  // src/config/compose/merge-repo/merge-repo.ts
2454
- const names$1 = union();
2464
+ const names$2 = union();
2455
2465
  const properties = shallowMerge();
2456
2466
  const teamsByKey = mergeByKey((t) => typeof t === "string" ? t : t.slug);
2457
2467
  /**
@@ -2481,16 +2491,16 @@ function mergeRepo(prev, next) {
2481
2491
  };
2482
2492
  if (secrets) {
2483
2493
  const environments = { ...repo.secrets?.environments };
2484
- for (const [env, list] of Object.entries(secrets.environments ?? {})) environments[env] = names$1.merge(environments[env] ?? [], list);
2494
+ for (const [env, list] of Object.entries(secrets.environments ?? {})) environments[env] = names$2.merge(environments[env] ?? [], list);
2485
2495
  repo.secrets = {
2486
- ...repo.secrets?.repo || secrets.repo ? { repo: names$1.merge(repo.secrets?.repo ?? [], secrets.repo ?? []) } : {},
2487
- ...repo.secrets?.org || secrets.org ? { org: names$1.merge(repo.secrets?.org ?? [], secrets.org ?? []) } : {},
2496
+ ...repo.secrets?.repo || secrets.repo ? { repo: names$2.merge(repo.secrets?.repo ?? [], secrets.repo ?? []) } : {},
2497
+ ...repo.secrets?.org || secrets.org ? { org: names$2.merge(repo.secrets?.org ?? [], secrets.org ?? []) } : {},
2488
2498
  ...Object.keys(environments).length > 0 ? { environments } : {},
2489
2499
  ...repo.secrets?.sync || secrets.sync ? { sync: mergeSync(repo.secrets?.sync, secrets.sync) } : {},
2490
2500
  ...repo.secrets?.deploy || secrets.deploy ? { deploy: [...repo.secrets?.deploy ?? [], ...secrets.deploy ?? []] } : {}
2491
2501
  };
2492
2502
  }
2493
- if (topics) repo.topics = names$1.merge(repo.topics ?? [], topics);
2503
+ if (topics) repo.topics = names$2.merge(repo.topics ?? [], topics);
2494
2504
  if (teams) repo.teams = teamsByKey.merge(repo.teams ?? [], teams);
2495
2505
  return repo;
2496
2506
  }
@@ -3437,10 +3447,10 @@ function pickProvider(providers, wanted, can, verb) {
3437
3447
  if (capable.length === 0) throw new Error(`no \`notifications\` provider can ${verb.infinitive} — add one that implements it (for example discord) to holocron.config.ts`);
3438
3448
  if (wanted) {
3439
3449
  const match = capable.find((p) => p.providerName === wanted);
3440
- if (!match) throw new Error(`no ${verb.gerund} \`notifications\` provider named \`${wanted}\` (have: ${names(capable)})`);
3450
+ if (!match) throw new Error(`no ${verb.gerund} \`notifications\` provider named \`${wanted}\` (have: ${names$1(capable)})`);
3441
3451
  return match;
3442
3452
  }
3443
- if (capable.length > 1) throw new Error(`several \`notifications\` providers can ${verb.infinitive} (${names(capable)}) — pass --provider <name>`);
3453
+ if (capable.length > 1) throw new Error(`several \`notifications\` providers can ${verb.infinitive} (${names$1(capable)}) — pass --provider <name>`);
3444
3454
  return capable[0];
3445
3455
  }
3446
3456
  /** Pick the provider that can provision. Any ensure* method counts: a role-only layout needs no channel support. */
@@ -3450,7 +3460,7 @@ function pickProvisioner(providers, wanted) {
3450
3460
  gerund: "provisioning"
3451
3461
  });
3452
3462
  }
3453
- const names = (ps) => ps.map((p) => p.providerName).join(", ");
3463
+ const names$1 = (ps) => ps.map((p) => p.providerName).join(", ");
3454
3464
  /**
3455
3465
  * The first reason the layout's secret names cannot work, or undefined. Two things
3456
3466
  * cannot share one secret: the second write would overwrite the first and callers
@@ -7410,7 +7420,7 @@ async function runDoctorDns(input) {
7410
7420
  });
7411
7421
  else if (!loader.has("dns")) {
7412
7422
  const why = whyMissing(loader, "dns", "no `dns` provider to check them with");
7413
- for (const zone of zones) rows.push(row$17(zone, "skip", why));
7423
+ for (const zone of zones) rows.push(row$18(zone, "skip", why));
7414
7424
  for (const { hostname } of domains) rows.push(domainRow(hostname, "skip", why));
7415
7425
  } else {
7416
7426
  const dns = loader.get("dns");
@@ -7432,7 +7442,7 @@ async function runDoctorDns(input) {
7432
7442
  ...status === "skip" ? { reason: [...new Set(rows.map((r) => r.detail))].join("; ") } : {}
7433
7443
  };
7434
7444
  }
7435
- function row$17(zone, status, detail, problems = []) {
7445
+ function row$18(zone, status, detail, problems = []) {
7436
7446
  return {
7437
7447
  id: `dns-${zone}`,
7438
7448
  title: `${zone} records exist`,
@@ -7461,7 +7471,7 @@ async function checkDomain(dns, deploy, project, hostname) {
7461
7471
  return noToken !== void 0 ? domainRow(hostname, "skip", noToken) : domainRow(hostname, "fail", errorMessage(err));
7462
7472
  }
7463
7473
  }
7464
- async function checkZone(dns, zone, wanted, rowOf = (...args) => row$17(zone, ...args)) {
7474
+ async function checkZone(dns, zone, wanted, rowOf = (...args) => row$18(zone, ...args)) {
7465
7475
  try {
7466
7476
  const have = await dns.listRecords(zone);
7467
7477
  const problems = declaredVsActual(new Map(wanted.map((w) => [keyOf(w), w])), new Map(have.map((h) => [keyOf(h), h])), {
@@ -7596,7 +7606,7 @@ function installationSettingsUrl(account, id) {
7596
7606
  return `https://github.com/settings/installations/${id}`;
7597
7607
  }
7598
7608
  // src/commands/doctor-github-app/app-rows.ts
7599
- const row$16 = (name, what, problems, ok) => ({
7609
+ const row$17 = (name, what, problems, ok) => ({
7600
7610
  id: `${name}:${what}`,
7601
7611
  title: `${name}: ${what}`,
7602
7612
  status: problems.length > 0 ? "fail" : "ok",
@@ -7623,9 +7633,9 @@ function appRows(name, manifest, app, installations) {
7623
7633
  return [`${who} has not accepted the current App: ${gaps.join("; ")}`, `fix: ${who} accepts the update at ${url}`];
7624
7634
  });
7625
7635
  return [
7626
- row$16(name, "events", eventProblems.length > 0 ? [...eventProblems, fix] : [], `all ${manifest.events.length} subscribed${extrasNote("extra event(s)", extraEvents)}`),
7627
- row$16(name, "permissions", permissionProblems.length > 0 ? [...permissionProblems, fix] : [], `all ${Object.keys(manifest.permissions).length} granted${extrasNote("extra permission(s)", extraPermissions)}`),
7628
- row$16(name, "installations", installationProblems, `${installations.length} installation(s) up to date`)
7636
+ row$17(name, "events", eventProblems.length > 0 ? [...eventProblems, fix] : [], `all ${manifest.events.length} subscribed${extrasNote("extra event(s)", extraEvents)}`),
7637
+ row$17(name, "permissions", permissionProblems.length > 0 ? [...permissionProblems, fix] : [], `all ${Object.keys(manifest.permissions).length} granted${extrasNote("extra permission(s)", extraPermissions)}`),
7638
+ row$17(name, "installations", installationProblems, `${installations.length} installation(s) up to date`)
7629
7639
  ];
7630
7640
  }
7631
7641
  // src/commands/doctor-github-app/parse-manifest.ts
@@ -7683,7 +7693,7 @@ async function runDoctorGitHubApp(input) {
7683
7693
  assertPluginsResolvable(loader, "doctor github-app");
7684
7694
  }
7685
7695
  const rows = [];
7686
- if (instances.length === 0) rows.push(row$15("github-app", "reachable", "skip", "no `githubApps` are declared in holocron.config.ts"));
7696
+ if (instances.length === 0) rows.push(row$16("github-app", "reachable", "skip", "no `githubApps` are declared in holocron.config.ts"));
7687
7697
  for (const instance of instances) rows.push(...await checkInstance(instance, loader, input));
7688
7698
  printCheckRows(rows, print);
7689
7699
  const summary = summariseChecks(rows);
@@ -7700,7 +7710,7 @@ async function runDoctorGitHubApp(input) {
7700
7710
  ...status === "skip" ? { reason: [...new Set(rows.map((r) => r.detail))].join("; ") } : {}
7701
7711
  };
7702
7712
  }
7703
- function row$15(name, what, status, detail) {
7713
+ function row$16(name, what, status, detail) {
7704
7714
  return {
7705
7715
  id: `${name}:${what}`,
7706
7716
  title: `${name}: ${what}`,
@@ -7741,19 +7751,19 @@ async function checkInstance(instance, loader, input) {
7741
7751
  try {
7742
7752
  manifest = parseManifest(readManifest(instance.manifest));
7743
7753
  } catch (err) {
7744
- return [row$15(name, "manifest", "fail", `cannot read ${instance.manifest}: ${errorMessage(err)}`)];
7754
+ return [row$16(name, "manifest", "fail", `cannot read ${instance.manifest}: ${errorMessage(err)}`)];
7745
7755
  }
7746
7756
  const read = await readCredentials(instance, loader);
7747
- if ("reason" in read) return [row$15(name, "reachable", "skip", read.reason)];
7757
+ if ("reason" in read) return [row$16(name, "reachable", "skip", read.reason)];
7748
7758
  const api = input.api ?? defaultApi;
7749
7759
  const secrets = [read.creds.privateKey];
7750
7760
  try {
7751
7761
  const app = await api.getApp(read.creds);
7752
7762
  const installations = await api.listAppInstallations(read.creds);
7753
7763
  const owner = app.owner ? `, owned by ${app.owner.login}` : "";
7754
- return [row$15(name, "reachable", "ok", `${app.slug}${owner}, settings: ${appSettingsUrl(app)}`), ...appRows(name, manifest, app, installations)];
7764
+ return [row$16(name, "reachable", "ok", `${app.slug}${owner}, settings: ${appSettingsUrl(app)}`), ...appRows(name, manifest, app, installations)];
7755
7765
  } catch (err) {
7756
- return [row$15(name, "reachable", "fail", `cannot call GitHub as the App: ${scrubbed$1(err, secrets)}`)];
7766
+ return [row$16(name, "reachable", "fail", `cannot call GitHub as the App: ${scrubbed$1(err, secrets)}`)];
7757
7767
  }
7758
7768
  }
7759
7769
  // src/commands/doctor-github-app/doctor-github-app.command.ts
@@ -7820,7 +7830,7 @@ function datasetTargets(config) {
7820
7830
  * dataset, shared by every environment in it). Only a dataset the provider says is missing, or a token it refuses, fails;
7821
7831
  * 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.
7822
7832
  */
7823
- const row$14 = (id, title, status, detail, problems = []) => ({
7833
+ const row$15 = (id, title, status, detail, problems = []) => ({
7824
7834
  id,
7825
7835
  title,
7826
7836
  status,
@@ -7837,7 +7847,7 @@ async function runDoctorLogs(input) {
7837
7847
  if (!loader.has("logs")) {
7838
7848
  const failure = loader.loadFailures().find((f) => f.key === "logs");
7839
7849
  const why = failure ? `\`${failure.provider}\` failed to load: ${describeError(failure.error)}` : "no `logs` provider is configured in holocron.config.ts";
7840
- rows.push(row$14("logs", "logs", "skip", why));
7850
+ rows.push(row$15("logs", "logs", "skip", why));
7841
7851
  } else rows.push(...await checkLogs(loader.get("logs"), datasetTargets(input.loaded.resolved)));
7842
7852
  printCheckRows(rows, print);
7843
7853
  const summary = summariseChecks(rows);
@@ -7861,38 +7871,38 @@ async function checkLogs(logs, targets) {
7861
7871
  for (const target of targets) {
7862
7872
  const id = `logs:dataset:${target.id}`;
7863
7873
  const title = `dataset for ${target.label}`;
7864
- if (!target.name) rows.push(row$14(id, title, "skip", `${target.variable} is not set here, so there is no name to look for`));
7865
- else if (!token.usable) rows.push(row$14(id, title, "skip", `${target.name}: not checked, the token is not usable`));
7866
- else if (!logs.readDataset) rows.push(row$14(id, title, "skip", `${logs.providerName} cannot read a dataset`));
7874
+ if (!target.name) rows.push(row$15(id, title, "skip", `${target.variable} is not set here, so there is no name to look for`));
7875
+ else if (!token.usable) rows.push(row$15(id, title, "skip", `${target.name}: not checked, the token is not usable`));
7876
+ else if (!logs.readDataset) rows.push(row$15(id, title, "skip", `${logs.providerName} cannot read a dataset`));
7867
7877
  else rows.push(...await checkDataset(logs, target, target.name, id, title));
7868
7878
  }
7869
7879
  const org = resolveValue$1(["AXIOM_ORG"], void 0, { prefix: PREFIX$1 });
7870
- rows.push(org ? row$14("logs:org", "organization", "ok", `${PREFIX$1}_AXIOM_ORG (or AXIOM_ORG) is set`) : row$14("logs:org", "organization", "skip", `${PREFIX$1}_AXIOM_ORG (or AXIOM_ORG) is not set here; Sentinel's log links need it`));
7880
+ rows.push(org ? row$15("logs:org", "organization", "ok", `${PREFIX$1}_AXIOM_ORG (or AXIOM_ORG) is set`) : row$15("logs:org", "organization", "skip", `${PREFIX$1}_AXIOM_ORG (or AXIOM_ORG) is not set here; Sentinel's log links need it`));
7871
7881
  return rows;
7872
7882
  }
7873
7883
  /** Whether the provider accepts the token. `usable` is false when it was refused or could not be tried. */
7874
7884
  async function checkToken$1(logs, dataset) {
7875
7885
  const title = "token is accepted";
7876
7886
  if (!logs.checkToken) return {
7877
- row: row$14("logs:token", title, "skip", `${logs.providerName} cannot check a token`),
7887
+ row: row$15("logs:token", title, "skip", `${logs.providerName} cannot check a token`),
7878
7888
  usable: true
7879
7889
  };
7880
7890
  try {
7881
7891
  const result = await logs.checkToken(dataset);
7882
7892
  if (result.ok) return {
7883
- row: row$14("logs:token", title, "ok", `${logs.providerName} accepts the token`),
7893
+ row: row$15("logs:token", title, "ok", `${logs.providerName} accepts the token`),
7884
7894
  usable: true
7885
7895
  };
7886
7896
  const reason = result.reason ?? `${logs.providerName} refused the token`;
7887
7897
  return {
7888
- row: row$14("logs:token", title, "fail", reason, [reason]),
7898
+ row: row$15("logs:token", title, "fail", reason, [reason]),
7889
7899
  usable: false
7890
7900
  };
7891
7901
  } catch (err) {
7892
7902
  const noToken = missingTokenReason(err);
7893
7903
  const detail = noToken ?? `could not check the token: ${describeError(err)}`;
7894
7904
  return {
7895
- row: row$14("logs:token", title, "skip", detail),
7905
+ row: row$15("logs:token", title, "skip", detail),
7896
7906
  usable: noToken === void 0
7897
7907
  };
7898
7908
  }
@@ -7902,17 +7912,17 @@ async function checkDataset(logs, target, name, id, title) {
7902
7912
  const found = await logs.readDataset(name);
7903
7913
  if (found.forbidden) {
7904
7914
  const why = `${name}: not visible to this token (${logs.providerName} refused the read; it may also not exist)`;
7905
- return [row$14(id, title, "skip", why)];
7915
+ return [row$15(id, title, "skip", why)];
7906
7916
  }
7907
7917
  if (!found.exists) {
7908
7918
  const problem = `dataset ${name} does not exist (${target.variable}); ${target.fix}`;
7909
- return [row$14(id, title, "fail", `${name} does not exist`, [problem])];
7919
+ return [row$15(id, title, "fail", `${name} does not exist`, [problem])];
7910
7920
  }
7911
7921
  const retention = found.retentionDays === void 0 ? `retention: ${logs.providerName} did not report one for ${name}` : `retention: ${found.retentionDays} days for ${name}`;
7912
- return [row$14(id, title, "ok", `${name} exists`), row$14(`logs:retention:${target.id}`, `retention of ${name}`, "skip", `info: ${retention}; one setting shared by every environment in the dataset (ADR-0019)`)];
7922
+ return [row$15(id, title, "ok", `${name} exists`), row$15(`logs:retention:${target.id}`, `retention of ${name}`, "skip", `info: ${retention}; one setting shared by every environment in the dataset (ADR-0019)`)];
7913
7923
  } catch (err) {
7914
7924
  const detail = missingTokenReason(err) ?? `could not read ${name}: ${describeError(err)}`;
7915
- return [row$14(id, title, "skip", detail)];
7925
+ return [row$15(id, title, "skip", detail)];
7916
7926
  }
7917
7927
  }
7918
7928
  // src/commands/doctor-logs/doctor-logs.command.ts
@@ -11116,7 +11126,7 @@ const info = (id, title, noun, extras) => ({
11116
11126
  detail: `info: ${extras.length} ${noun} not in the template (never deleted)`,
11117
11127
  problems: extras
11118
11128
  });
11119
- const row$13 = (id, title, problems, ok) => ({
11129
+ const row$14 = (id, title, problems, ok) => ({
11120
11130
  id,
11121
11131
  title,
11122
11132
  status: problems.length > 0 ? "fail" : "ok",
@@ -11152,19 +11162,19 @@ function viewProblems(want, found) {
11152
11162
  function boardRows(boardName, template, state) {
11153
11163
  const id = `project:${boardName}`;
11154
11164
  const rows = [];
11155
- rows.push(row$13(`${id}:statuses`, `${boardName}: statuses`, listProblems("status", "statuses", template.statuses.map((s) => s.name), state.statuses), `${template.statuses.length} in order`));
11165
+ rows.push(row$14(`${id}:statuses`, `${boardName}: statuses`, listProblems("status", "statuses", template.statuses.map((s) => s.name), state.statuses), `${template.statuses.length} in order`));
11156
11166
  const extraStatuses = state.statuses.filter((s) => !template.statuses.some((t) => t.name === s));
11157
11167
  if (extraStatuses.length > 0) rows.push(info(`${id}:extra-statuses`, `${boardName}: extra statuses`, "status(es)", extraStatuses));
11158
- for (const want of template.fields) rows.push(row$13(`${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));
11168
+ for (const want of template.fields) rows.push(row$14(`${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));
11159
11169
  const extraFields = state.fields.filter((f) => !template.fields.some((t) => t.name === f.name));
11160
11170
  if (extraFields.length > 0) rows.push(info(`${id}:extra-fields`, `${boardName}: extra fields`, "field(s)", extraFields.map((f) => f.name)));
11161
- for (const want of template.views) rows.push(row$13(`${id}:view:${want.name}`, `${boardName}: view ${want.name}`, viewProblems(want, state.views.find((v) => v.name === want.name)), `${want.layout}${want.filter ? `, ${want.filter}` : ""}`));
11171
+ for (const want of template.views) rows.push(row$14(`${id}:view:${want.name}`, `${boardName}: view ${want.name}`, viewProblems(want, state.views.find((v) => v.name === want.name)), `${want.layout}${want.filter ? `, ${want.filter}` : ""}`));
11162
11172
  const extraViews = state.views.filter((v) => !template.views.some((t) => t.name === v.name));
11163
11173
  if (extraViews.length > 0) rows.push(info(`${id}:extra-views`, `${boardName}: extra views`, "view(s)", extraViews.map((v) => v.name)));
11164
11174
  for (const name of template.rules ?? []) {
11165
11175
  const found = state.rules.find((r) => r.name === name);
11166
11176
  const problems = !found ? [`missing rule ${name}`] : found.enabled ? [] : [`rule ${name} is off`];
11167
- rows.push(row$13(`${id}:rule:${name}`, `${boardName}: rule ${name}`, problems, "on"));
11177
+ rows.push(row$14(`${id}:rule:${name}`, `${boardName}: rule ${name}`, problems, "on"));
11168
11178
  }
11169
11179
  return rows;
11170
11180
  }
@@ -11224,7 +11234,7 @@ function itemRows(boardName, items) {
11224
11234
  * never fail the run. A template file that does not read is a failure naming the file. `--post [channel]` shares the
11225
11235
  * failing rows through the `notifications` provider's bot, like `doctor notifications --post`.
11226
11236
  */
11227
- const row$12 = (id, title, status, detail, problems = []) => ({
11237
+ const row$13 = (id, title, status, detail, problems = []) => ({
11228
11238
  id,
11229
11239
  title,
11230
11240
  status,
@@ -11278,14 +11288,14 @@ async function checkBoards(input, loader) {
11278
11288
  loader,
11279
11289
  ...input.io ? { io: input.io } : {}
11280
11290
  });
11281
- if (!opened.ok) return [row$12("project", "project", opened.kind, opened.reason, opened.problems)];
11291
+ if (!opened.ok) return [row$13("project", "project", opened.kind, opened.reason, opened.problems)];
11282
11292
  const { projects, owner, boards, templates, templateProblems } = opened.context;
11283
11293
  const rows = templateProblems.map((problem) => {
11284
11294
  /* v8 ignore next -- split always returns at least one element; the fallback only satisfies noUncheckedIndexedAccess */
11285
11295
  const file = problem.split(": ")[0] ?? problem;
11286
- return row$12(`project:template:${file}`, `template file ${file}`, "fail", problem);
11296
+ return row$13(`project:template:${file}`, `template file ${file}`, "fail", problem);
11287
11297
  });
11288
- if (boards.length === 0) return [...rows, row$12("project", "project", "skip", "no boards are declared in `providers.projects.boards`")];
11298
+ if (boards.length === 0) return [...rows, row$13("project", "project", "skip", "no boards are declared in `providers.projects.boards`")];
11289
11299
  for (const declared of boards) {
11290
11300
  const template = templates[declared.template];
11291
11301
  const title = `${declared.name}: board exists and is open`;
@@ -11293,18 +11303,18 @@ async function checkBoards(input, loader) {
11293
11303
  const board = await projects.find(owner, declared.name);
11294
11304
  if (!board) {
11295
11305
  const closed = (await projects.list(owner)).some((b) => b.name === declared.name && b.closed);
11296
- rows.push(row$12(`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`"]));
11306
+ rows.push(row$13(`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`"]));
11297
11307
  continue;
11298
11308
  }
11299
- rows.push(row$12(`project:${declared.name}`, title, "ok", board.url));
11309
+ rows.push(row$13(`project:${declared.name}`, title, "ok", board.url));
11300
11310
  if (!template) {
11301
- rows.push(row$12(`project:${declared.name}:template`, `${declared.name}: template ${declared.template}`, "fail", "no built-in or file template has this name"));
11311
+ rows.push(row$13(`project:${declared.name}:template`, `${declared.name}: template ${declared.template}`, "fail", "no built-in or file template has this name"));
11302
11312
  continue;
11303
11313
  }
11304
11314
  rows.push(...boardRows(declared.name, template, await projects.read(owner, board)));
11305
- rows.push(...projects.items ? itemRows(declared.name, await projects.items(owner, board, template)) : [row$12(`project:${declared.name}:items`, `${declared.name}: items`, "skip", "the provider cannot list a board's items")]);
11315
+ rows.push(...projects.items ? itemRows(declared.name, await projects.items(owner, board, template)) : [row$13(`project:${declared.name}:items`, `${declared.name}: items`, "skip", "the provider cannot list a board's items")]);
11306
11316
  } catch (err) {
11307
- rows.push(row$12(`project:${declared.name}`, title, "fail", describeError(err)));
11317
+ rows.push(row$13(`project:${declared.name}`, title, "fail", describeError(err)));
11308
11318
  }
11309
11319
  }
11310
11320
  return rows;
@@ -12224,19 +12234,19 @@ async function runDoctorRepo(input) {
12224
12234
  const rows = [];
12225
12235
  if (!loader.has("source")) {
12226
12236
  const why = whyMissing(loader, "source", "no `source` provider to read the repository with");
12227
- for (const check of checks) rows.push(row$11(check, { skip: why }));
12237
+ for (const check of checks) rows.push(row$12(check, { skip: why }));
12228
12238
  } else {
12229
12239
  const source = loader.get("source");
12230
12240
  for (const check of checks) {
12231
12241
  if (typeof source[check.needs] !== "function") {
12232
- rows.push(row$11(check, { skip: `provider does not implement ${check.needs}` }));
12242
+ rows.push(row$12(check, { skip: `provider does not implement ${check.needs}` }));
12233
12243
  continue;
12234
12244
  }
12235
12245
  try {
12236
- rows.push(row$11(check, await check.run(source)));
12246
+ rows.push(row$12(check, await check.run(source)));
12237
12247
  } catch (err) {
12238
12248
  const noToken = missingTokenReason(err);
12239
- if (noToken !== void 0) rows.push(row$11(check, { skip: noToken }));
12249
+ if (noToken !== void 0) rows.push(row$12(check, { skip: noToken }));
12240
12250
  else rows.push({
12241
12251
  id: check.id,
12242
12252
  title: check.title,
@@ -12262,7 +12272,7 @@ async function runDoctorRepo(input) {
12262
12272
  ...status === "skip" ? { reason: rows.map((r) => r.detail).join("; ") } : {}
12263
12273
  };
12264
12274
  }
12265
- function row$11(check, result) {
12275
+ function row$12(check, result) {
12266
12276
  const { id, title } = check;
12267
12277
  if ("skip" in result) return {
12268
12278
  id,
@@ -12785,7 +12795,7 @@ function providerGroup(providerName) {
12785
12795
  }
12786
12796
  // src/commands/doctor-secrets/credentials-rows.ts
12787
12797
  /** A row for the provider as a whole, or for one of its variables when `name` is given. */
12788
- function row$10(provider, status, detail, name) {
12798
+ function row$11(provider, status, detail, name) {
12789
12799
  return name === void 0 ? {
12790
12800
  id: provider,
12791
12801
  title: provider,
@@ -12810,10 +12820,10 @@ async function credentialsRows(input) {
12810
12820
  const { loader } = input;
12811
12821
  const { resolved } = input.loaded;
12812
12822
  if (!resolved.providers.credentials) return {
12813
- rows: input.asked ? [row$10("credentials", "skip", "no `credentials` provider is configured")] : [],
12823
+ rows: input.asked ? [row$11("credentials", "skip", "no `credentials` provider is configured")] : [],
12814
12824
  places: []
12815
12825
  };
12816
- const rows = loader.loadFailures().filter((f) => f.key === "credentials").map((f) => row$10(f.provider, "fail", `failed to load: ${errorMessage(f.error)}`));
12826
+ const rows = loader.loadFailures().filter((f) => f.key === "credentials").map((f) => row$11(f.provider, "fail", `failed to load: ${errorMessage(f.error)}`));
12817
12827
  const places = [];
12818
12828
  if (!loader.has("credentials")) return {
12819
12829
  rows,
@@ -12825,7 +12835,7 @@ async function credentialsRows(input) {
12825
12835
  const tuple = tuples.find((t) => t.provider === impl.providerName);
12826
12836
  const explicit = tuple && credentialsEnvironment(tuple, resolved);
12827
12837
  if (!explicit && !derivesEnvironment(impl.providerName)) {
12828
- rows.push(row$10(impl.providerName, "skip", "no `environment` option and `credentials.environment` is not set"));
12838
+ rows.push(row$11(impl.providerName, "skip", "no `environment` option and `credentials.environment` is not set"));
12829
12839
  continue;
12830
12840
  }
12831
12841
  try {
@@ -12837,7 +12847,7 @@ async function credentialsRows(input) {
12837
12847
  rows.push(...checked.rows);
12838
12848
  places.push(...checked.places);
12839
12849
  } catch (err) {
12840
- rows.push(row$10(impl.providerName, "fail", errorMessage(err)));
12850
+ rows.push(row$11(impl.providerName, "fail", errorMessage(err)));
12841
12851
  }
12842
12852
  }
12843
12853
  return {
@@ -12853,17 +12863,17 @@ async function credentialsRows(input) {
12853
12863
  async function checkProvider(impl, candidates, expected, synced) {
12854
12864
  const provider = impl.providerName;
12855
12865
  if (!impl.inspect) return {
12856
- rows: [row$10(provider, "skip", "cannot list the variables without reading their values")],
12866
+ rows: [row$11(provider, "skip", "cannot list the variables without reading their values")],
12857
12867
  places: []
12858
12868
  };
12859
12869
  if (expected.length === 0) return {
12860
- rows: [row$10(provider, "skip", "no configured plugin lists the tokens it takes")],
12870
+ rows: [row$11(provider, "skip", "no configured plugin lists the tokens it takes")],
12861
12871
  places: []
12862
12872
  };
12863
12873
  const inspect = impl.inspect.bind(impl);
12864
12874
  try {
12865
12875
  const { found, missing } = await tryEnvironments(candidates, inspect);
12866
- const rows = missing.map((name) => row$10(provider, "fail", `${provider} has no Environment named "${name}"`));
12876
+ const rows = missing.map((name) => row$11(provider, "fail", `${provider} has no Environment named "${name}"`));
12867
12877
  const group = providerGroup(provider);
12868
12878
  const unreadPlaces = missing.map((name) => ({
12869
12879
  column: {
@@ -12886,9 +12896,9 @@ async function checkProvider(impl, candidates, expected, synced) {
12886
12896
  const have = (name) => found.some((f) => f.result.names.includes(name));
12887
12897
  let present = 0;
12888
12898
  for (const { name, optional } of expected) if (have(name)) present++;
12889
- else if (optional) rows.push(row$10(provider, "skip", `optional, not set in ${where}`, name));
12890
- else rows.push(row$10(provider, "fail", `missing from ${where}`, name));
12891
- if (present > 0) rows.push(row$10(provider, "ok", `${present} of ${expected.length} tokens present in ${where}`, "tokens"));
12899
+ else if (optional) rows.push(row$11(provider, "skip", `optional, not set in ${where}`, name));
12900
+ else rows.push(row$11(provider, "fail", `missing from ${where}`, name));
12901
+ if (present > 0) rows.push(row$11(provider, "ok", `${present} of ${expected.length} tokens present in ${where}`, "tokens"));
12892
12902
  const names = new Set(expected.map((e) => e.name));
12893
12903
  const places = [];
12894
12904
  const missingRequired = expected.filter((e) => !e.optional && !have(e.name)).map((e) => e.name);
@@ -12927,7 +12937,7 @@ async function checkProvider(impl, candidates, expected, synced) {
12927
12937
  };
12928
12938
  } catch (err) {
12929
12939
  return {
12930
- rows: [row$10(provider, "fail", errorMessage(err))],
12940
+ rows: [row$11(provider, "fail", errorMessage(err))],
12931
12941
  places: []
12932
12942
  };
12933
12943
  }
@@ -13801,7 +13811,7 @@ async function variableRows(loader, config, org) {
13801
13811
  if (!loader.has("source")) {
13802
13812
  const why = whyMissing(loader, "source", "no `source` provider to read them with");
13803
13813
  for (const check of checks) {
13804
- rows.push(row$9(check, { skip: why }));
13814
+ rows.push(row$10(check, { skip: why }));
13805
13815
  observations.push({
13806
13816
  scope: check.scope,
13807
13817
  unread: why
@@ -13811,7 +13821,7 @@ async function variableRows(loader, config, org) {
13811
13821
  const source = loader.get("source");
13812
13822
  for (const check of checks) try {
13813
13823
  const result = await check.run(source);
13814
- rows.push(row$9(check, result));
13824
+ rows.push(row$10(check, result));
13815
13825
  observations.push("skip" in result ? {
13816
13826
  scope: check.scope,
13817
13827
  unread: result.skip
@@ -13822,7 +13832,7 @@ async function variableRows(loader, config, org) {
13822
13832
  } catch (err) {
13823
13833
  const noToken = missingTokenReason(err);
13824
13834
  if (noToken !== void 0) {
13825
- rows.push(row$9(check, { skip: noToken }));
13835
+ rows.push(row$10(check, { skip: noToken }));
13826
13836
  observations.push({
13827
13837
  scope: check.scope,
13828
13838
  unread: noToken
@@ -13848,7 +13858,7 @@ async function variableRows(loader, config, org) {
13848
13858
  observations
13849
13859
  };
13850
13860
  }
13851
- function row$9(check, result) {
13861
+ function row$10(check, result) {
13852
13862
  const { id, title } = check;
13853
13863
  if ("skip" in result) return {
13854
13864
  id,
@@ -13938,7 +13948,7 @@ function describeExpiry(expiresAt, now) {
13938
13948
  *
13939
13949
  * What a token may do is not checked: GitHub does not return a fine-grained token's permissions.
13940
13950
  */
13941
- function row$8(id, status, detail) {
13951
+ function row$9(id, status, detail) {
13942
13952
  return {
13943
13953
  id: `verify:${id}`,
13944
13954
  title: `verify ${id}`,
@@ -13966,12 +13976,12 @@ async function verifyRows(input) {
13966
13976
  try {
13967
13977
  module = await importer(pkg);
13968
13978
  } catch (err) {
13969
- rows.push(row$8(pkg, "skip", `cannot load the plugin: ${errorMessage(err)}`));
13979
+ rows.push(row$9(pkg, "skip", `cannot load the plugin: ${errorMessage(err)}`));
13970
13980
  continue;
13971
13981
  }
13972
13982
  for (const token of module.tokens ?? []) rows.push(await checkToken(token, module, env, readToken, now()));
13973
13983
  }
13974
- if (rows.length === 0) rows.push(row$8("tokens", "skip", "no configured plugin lists the tokens it takes"));
13984
+ if (rows.length === 0) rows.push(row$9("tokens", "skip", "no configured plugin lists the tokens it takes"));
13975
13985
  return rows;
13976
13986
  }
13977
13987
  /**
@@ -13984,30 +13994,30 @@ async function loadCredentials(input) {
13984
13994
  try {
13985
13995
  await input.loader.load();
13986
13996
  } catch (err) {
13987
- return [row$8("credentials", "skip", `could not load the credentials providers: ${errorMessage(err)}`)];
13997
+ return [row$9("credentials", "skip", `could not load the credentials providers: ${errorMessage(err)}`)];
13988
13998
  }
13989
- return input.loader.loadFailures().filter((failure) => failure.key === "credentials").map((failure) => row$8(`credentials ${failure.provider}`, "fail", `could not be read: ${errorMessage(failure.error)}`));
13999
+ return input.loader.loadFailures().filter((failure) => failure.key === "credentials").map((failure) => row$9(`credentials ${failure.provider}`, "fail", `could not be read: ${errorMessage(failure.error)}`));
13990
14000
  }
13991
14001
  async function checkToken(token, module, env, readToken, now) {
13992
14002
  const { keyringKey, envName, vendorEnvName } = token;
13993
14003
  const fromEnv = env.get(envName) ? envName : vendorEnvName && env.get(vendorEnvName) ? vendorEnvName : void 0;
13994
14004
  const stored = fromEnv ? void 0 : findCredential(...vendorEnvName ? [envName, vendorEnvName] : [envName]);
13995
14005
  const value = fromEnv ? env.get(fromEnv) : stored?.value ?? readToken(keyringKey);
13996
- if (!value) return row$8(keyringKey, "skip", `not set (${vendorEnvName ? `${envName} / ${vendorEnvName}` : envName}, or \`holocron new token ${keyringKey}\`)`);
14006
+ if (!value) return row$9(keyringKey, "skip", `not set (${vendorEnvName ? `${envName} / ${vendorEnvName}` : envName}, or \`holocron new token ${keyringKey}\`)`);
13997
14007
  const verify = token.verify ?? (token.verifiable === false ? void 0 : module.verifyToken);
13998
- if (!verify) return row$8(keyringKey, "skip", "set, but its plugin cannot verify it");
14008
+ if (!verify) return row$9(keyringKey, "skip", "set, but its plugin cannot verify it");
13999
14009
  const from = fromEnv ?? stored?.source ?? "keyring";
14000
14010
  try {
14001
14011
  const verified = await verify(value);
14002
- if (!verified.ok) return row$8(keyringKey, "fail", `rejected (${from}): ${verified.message}`);
14012
+ if (!verified.ok) return row$9(keyringKey, "fail", `rejected (${from}): ${verified.message}`);
14003
14013
  const expiry = verified.expiresAt ? describeExpiry(verified.expiresAt, now) : void 0;
14004
- if (!expiry) return row$8(keyringKey, "ok", `${verified.subject} (${from})`);
14014
+ if (!expiry) return row$9(keyringKey, "ok", `${verified.subject} (${from})`);
14005
14015
  return expiry.soon ? {
14006
- ...row$8(keyringKey, "fail", `${verified.subject} (${from}), ${expiry.text}`),
14016
+ ...row$9(keyringKey, "fail", `${verified.subject} (${from}), ${expiry.text}`),
14007
14017
  problems: [`${expiry.text}: renew it`]
14008
- } : row$8(keyringKey, "ok", `${verified.subject} (${from}), ${expiry.text}`);
14018
+ } : row$9(keyringKey, "ok", `${verified.subject} (${from}), ${expiry.text}`);
14009
14019
  } catch (err) {
14010
- return row$8(keyringKey, "fail", `could not be verified (${from}): ${errorMessage(err)}`);
14020
+ return row$9(keyringKey, "fail", `could not be verified (${from}): ${errorMessage(err)}`);
14011
14021
  }
14012
14022
  }
14013
14023
  // src/commands/doctor-secrets/doctor-secrets.ts
@@ -14734,7 +14744,7 @@ function summariseProbeRows(id, title, rows) {
14734
14744
  * provider with no `token` probe, no declared layer, or one that cannot be read is a skip with the reason.
14735
14745
  */
14736
14746
  const PROBE = "token";
14737
- const row$7 = (id, title, status, detail, problems = []) => ({
14747
+ const row$8 = (id, title, status, detail, problems = []) => ({
14738
14748
  id,
14739
14749
  title,
14740
14750
  status,
@@ -14759,12 +14769,12 @@ async function runDoctorTokens(input) {
14759
14769
  try {
14760
14770
  tokens = await providerTokens(provider);
14761
14771
  } catch (err) {
14762
- rows.push(row$7(`tokens:${provider}`, provider, "skip", `could not read its tokens: ${describeError(err)}`));
14772
+ rows.push(row$8(`tokens:${provider}`, provider, "skip", `could not read its tokens: ${describeError(err)}`));
14763
14773
  continue;
14764
14774
  }
14765
14775
  const expectations = tokenExpectations(tokens);
14766
- if (expectations.length === 0) rows.push(row$7(`tokens:${provider}`, provider, "skip", "info: declares no token layers, nothing to check"));
14767
- else if (!usableProbe(probes.get(provider))) rows.push(row$7(`tokens:${provider}`, provider, "skip", `info: has no \`${PROBE}\` probe loaded, so its tokens are not checked`));
14776
+ if (expectations.length === 0) rows.push(row$8(`tokens:${provider}`, provider, "skip", "info: declares no token layers, nothing to check"));
14777
+ else if (!usableProbe(probes.get(provider))) rows.push(row$8(`tokens:${provider}`, provider, "skip", `info: has no \`${PROBE}\` probe loaded, so its tokens are not checked`));
14768
14778
  else declared.push({
14769
14779
  provider,
14770
14780
  tokens,
@@ -14826,14 +14836,14 @@ async function checkLayer(c) {
14826
14836
  tokens
14827
14837
  });
14828
14838
  } catch (err) {
14829
- if (err instanceof HoldsNoTokenError) return c.wanted.map((e) => row$7(id(e), title(e), "fail", "not held in this layer", [err.message]));
14830
- return c.wanted.map((e) => row$7(id(e), title(e), "skip", `could not read the Environment: ${describeError(err)}`));
14839
+ if (err instanceof HoldsNoTokenError) return c.wanted.map((e) => row$8(id(e), title(e), "fail", "not held in this layer", [err.message]));
14840
+ return c.wanted.map((e) => row$8(id(e), title(e), "skip", `could not read the Environment: ${describeError(err)}`));
14831
14841
  }
14832
14842
  const rows = [];
14833
14843
  for (const e of c.wanted) {
14834
14844
  const token = held.held.find((h) => h.envName === e.envName);
14835
14845
  if (!token) {
14836
- rows.push(row$7(id(e), title(e), "fail", `not held in ${held.environment}`, [`${e.envName} is declared for ${c.layer}`]));
14846
+ rows.push(row$8(id(e), title(e), "fail", `not held in ${held.environment}`, [`${e.envName} is declared for ${c.layer}`]));
14837
14847
  continue;
14838
14848
  }
14839
14849
  rows.push(summariseProbeRows(id(e), title(e), await probeToken(c, e, token.token, held.plain)));
@@ -14886,6 +14896,147 @@ async function runWith(c, e, token, context) {
14886
14896
  })).rows;
14887
14897
  }
14888
14898
  }
14899
+ // src/commands/doctor-tokens/doctor-tokens.command.ts
14900
+ const doctorTokensCommand = {
14901
+ command: "tokens",
14902
+ describe: "Check every token the plugins declare for a layer has the permissions it should, no more, and is not due for rotation (read-only, goes online)",
14903
+ handler: async (argv) => {
14904
+ const tokens = tokenContext(argv.token);
14905
+ if (!tokens) return;
14906
+ const loaded = await loadConfig(argv.cwd);
14907
+ applyResolvedConfig(argv, loaded.resolved);
14908
+ if ((await runDoctorTokens({
14909
+ loaded,
14910
+ context: {
14911
+ repoRoot: argv.cwd,
14912
+ ...tokens,
14913
+ org: resolveOrg(argv, loaded.resolved)
14914
+ }
14915
+ })).status === "fail") process.exitCode = 1;
14916
+ }
14917
+ };
14918
+ // src/commands/doctor-wiki/wiki-rows.ts
14919
+ const row$7 = (id, title, status, detail, problems = []) => ({
14920
+ id,
14921
+ title,
14922
+ status,
14923
+ detail,
14924
+ problems
14925
+ });
14926
+ /** How many names a row lists before it says how many more there are. */
14927
+ const LISTED = 5;
14928
+ const names = (paths) => paths.length > LISTED ? `${paths.slice(0, LISTED).join(", ")} and ${paths.length - LISTED} more` : paths.join(", ");
14929
+ /**
14930
+ * One address: an answer below 400 passes, a 401 or 403 passes too (the site is there and restricts who reads it:
14931
+ * password protection is set in the provider's dashboard), a 404 or any other status fails, and no answer at all is a
14932
+ * skip, since a machine with no network says nothing about the site.
14933
+ */
14934
+ function siteRow(id, title, probe, notFoundHint) {
14935
+ if (probe.status === void 0) return row$7(id, title, "skip", `${probe.url}: ${probe.error ?? "no answer"}`);
14936
+ if (probe.status < 400) return row$7(id, title, "ok", `${probe.url} answers ${probe.status}`);
14937
+ if (probe.status === 401 || probe.status === 403) return row$7(id, title, "ok", `${probe.url} answers ${probe.status} (access is restricted)`);
14938
+ const problem = probe.status === 404 ? `${probe.url} answers 404; ${notFoundHint}` : `${probe.url} answers ${probe.status}, expected a page`;
14939
+ return row$7(id, title, "fail", `${probe.url} answers ${probe.status}`, [problem]);
14940
+ }
14941
+ /**
14942
+ * The rows `holocron doctor wiki` prints for one {@link WikiInspection}: organization, docs instance, the site and its
14943
+ * custom domain, the navigation against the sources, pages the navigation leaves out (information only) and the
14944
+ * published page index. Pure; a thing that could not be read is a skip with the reason, never a failure.
14945
+ */
14946
+ function wikiRows(found, providerName) {
14947
+ const rows = [];
14948
+ const { declared, found: foundOrg } = found.organization;
14949
+ if (foundOrg === null) {
14950
+ const problem = `fern/fern.config.json has no organization; \`holocron setup\` writes it`;
14951
+ rows.push(row$7("wiki:organization", "organization is set", "fail", problem, [problem]));
14952
+ } else if (foundOrg !== declared) {
14953
+ const problem = `fern/fern.config.json names ${foundOrg}, the config declares ${declared}; run \`holocron setup\``;
14954
+ rows.push(row$7("wiki:organization", "organization is set", "fail", `${foundOrg}, declared ${declared}`, [problem]));
14955
+ } else rows.push(row$7("wiki:organization", "organization is set", "ok", `${declared} in fern/fern.config.json`));
14956
+ const instance = found.instance;
14957
+ if (instance === null) {
14958
+ const problem = "fern/docs.yml does not exist; `holocron setup` writes it";
14959
+ rows.push(row$7("wiki:instance", "docs site is declared", "fail", problem, [problem]));
14960
+ } else {
14961
+ const problems = [];
14962
+ if (instance.foundUrl !== instance.expectedUrl) problems.push(`instance url is ${instance.foundUrl ?? "not set"}, expected ${instance.expectedUrl}`);
14963
+ if (instance.expectedDomain !== void 0 && instance.foundDomain !== instance.expectedDomain) problems.push(`custom-domain is ${instance.foundDomain ?? "not set"}, expected ${instance.expectedDomain}`);
14964
+ rows.push(problems.length > 0 ? row$7("wiki:instance", "docs site is declared", "fail", `${problems.length} problem(s)`, [...problems.map((p) => `fern/docs.yml: ${p}`)]) : row$7("wiki:instance", "docs site is declared", "ok", `${instance.expectedUrl} in fern/docs.yml`));
14965
+ }
14966
+ const [site, domain] = found.site;
14967
+ 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\`)`));
14968
+ 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`));
14969
+ if (found.navigation === null) rows.push(row$7("wiki:navigation", "navigation pages exist", "skip", "no fern/docs.yml to read"));
14970
+ else if (found.navigation.missing.length > 0) {
14971
+ const problems = found.navigation.missing.map((p) => `${p} is listed in fern/docs.yml but is not on disk`);
14972
+ rows.push(row$7("wiki:navigation", "navigation pages exist", "fail", `${found.navigation.missing.length} missing`, problems));
14973
+ } else {
14974
+ rows.push(row$7("wiki:navigation", "navigation pages exist", "ok", `${found.navigation.listed} listed pages exist`));
14975
+ if (found.navigation.unlisted.length > 0) rows.push(row$7("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`));
14976
+ }
14977
+ const published = found.published;
14978
+ const listed = found.navigation?.listed;
14979
+ if (!published) rows.push(row$7("wiki:published", "published pages", "skip", "the site's page index could not be asked"));
14980
+ else if (published.pages === void 0) {
14981
+ const why = published.status === void 0 ? published.error ?? "no answer" : `answered ${published.status}`;
14982
+ rows.push(row$7("wiki:published", "published pages", "skip", `${published.url}: ${why}`));
14983
+ } else if (listed !== void 0 && published.pages < listed) {
14984
+ const problem = `${published.url} lists ${published.pages} page(s), the navigation lists ${listed}; the last publish is behind (run the wiki workflow)`;
14985
+ rows.push(row$7("wiki:published", "published pages", "fail", `${published.pages} of ${listed}`, [problem]));
14986
+ } else rows.push(row$7("wiki:published", "published pages", "ok", listed === void 0 ? `${published.pages} page(s) in ${published.url}` : `${published.pages} page(s) published for ${listed} listed`));
14987
+ return rows;
14988
+ }
14989
+ // src/commands/doctor-wiki/doctor-wiki.ts
14990
+ /**
14991
+ * `holocron doctor wiki` — does the wiki the config declares exist, and is it what the sources say?
14992
+ *
14993
+ * Read-only: it never provisions, publishes or writes, sends no token, and prints names, addresses and counts only. The
14994
+ * rows (`wikiRows()`): the provider's organization and docs instance against the config, the site and its custom
14995
+ * domain answering, the navigation's pages existing on disk, the pages the navigation leaves out (an `info` row) and
14996
+ * the published page index against the navigation. Only a mismatch the files or the site prove fails; a site that
14997
+ * cannot be reached, an index that is not served, or a provider that cannot read its wiki is a skip with the reason.
14998
+ */
14999
+ const skip = (detail) => ({
15000
+ id: "wiki",
15001
+ title: "wiki",
15002
+ status: "skip",
15003
+ detail,
15004
+ problems: []
15005
+ });
15006
+ async function runDoctorWiki(input) {
15007
+ const print = input.print ?? ((line) => console.log(line));
15008
+ const logger = input.logger ?? getLogger();
15009
+ const loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);
15010
+ await loader.load();
15011
+ assertPluginsResolvable(loader, "doctor wiki");
15012
+ let rows;
15013
+ if (!loader.has("wiki")) {
15014
+ const failure = loader.loadFailures().find((f) => f.key === "wiki");
15015
+ rows = [skip(failure ? `\`${failure.provider}\` failed to load: ${describeError(failure.error)}` : "no `wiki` provider is configured in holocron.config.ts")];
15016
+ } else {
15017
+ const wiki = loader.get("wiki");
15018
+ if (!wiki.inspect) rows = [skip(`${wiki.providerName} cannot read its wiki`)];
15019
+ else try {
15020
+ rows = wikiRows(await wiki.inspect(), wiki.providerName);
15021
+ } catch (err) {
15022
+ rows = [skip(missingTokenReason(err) ?? `could not read the wiki: ${describeError(err)}`)];
15023
+ }
15024
+ }
15025
+ printCheckRows(rows, print);
15026
+ const summary = summariseChecks(rows);
15027
+ printCheckSummary(summary, print);
15028
+ const status = summary.fail > 0 ? "fail" : summary.ok === 0 ? "skip" : "ok";
15029
+ logger.info({
15030
+ ...summary,
15031
+ status
15032
+ }, "doctor wiki");
15033
+ return {
15034
+ status,
15035
+ rows,
15036
+ summary,
15037
+ ...status === "skip" ? { reason: rows.map((r) => r.detail).join("; ") } : {}
15038
+ };
15039
+ }
14889
15040
  // src/commands/deep-checks/deep-checks.ts
14890
15041
  /**
14891
15042
  * Every `doctor <capability>` deep check, in the order `doctor --all` runs them. Adding one is an entry here
@@ -14988,24 +15139,7 @@ const DEEP_CHECKS = [
14988
15139
  {
14989
15140
  name: "tokens",
14990
15141
  capability: "vault",
14991
- command: {
14992
- command: "tokens",
14993
- describe: "Check every token the plugins declare for a layer has the permissions it should, no more, and is not due for rotation (read-only, goes online)",
14994
- handler: async (argv) => {
14995
- const tokens = tokenContext(argv.token);
14996
- if (!tokens) return;
14997
- const loaded = await loadConfig(argv.cwd);
14998
- applyResolvedConfig(argv, loaded.resolved);
14999
- if ((await runDoctorTokens({
15000
- loaded,
15001
- context: {
15002
- repoRoot: argv.cwd,
15003
- ...tokens,
15004
- org: resolveOrg(argv, loaded.resolved)
15005
- }
15006
- })).status === "fail") process.exitCode = 1;
15007
- }
15008
- },
15142
+ command: doctorTokensCommand,
15009
15143
  async run(input) {
15010
15144
  const report = await runDoctorTokens(input);
15011
15145
  return {
@@ -15078,6 +15212,36 @@ const DEEP_CHECKS = [
15078
15212
  ...report.reason ? { reason: report.reason } : {}
15079
15213
  };
15080
15214
  }
15215
+ },
15216
+ {
15217
+ name: "wiki",
15218
+ capability: "wiki",
15219
+ command: {
15220
+ command: "wiki",
15221
+ describe: "Check the wiki's organization, docs site, domain and published pages (read-only)",
15222
+ handler: async (argv) => {
15223
+ const tokens = tokenContext(argv.token);
15224
+ if (!tokens) return;
15225
+ const loaded = await loadConfig(argv.cwd);
15226
+ applyResolvedConfig(argv, loaded.resolved);
15227
+ if ((await runDoctorWiki({
15228
+ loaded,
15229
+ context: {
15230
+ repoRoot: argv.cwd,
15231
+ ...tokens,
15232
+ org: resolveOrg(argv, loaded.resolved)
15233
+ }
15234
+ })).status === "fail") process.exitCode = 1;
15235
+ }
15236
+ },
15237
+ async run(input) {
15238
+ const report = await runDoctorWiki(input);
15239
+ return {
15240
+ status: report.status,
15241
+ summary: report.summary,
15242
+ ...report.reason ? { reason: report.reason } : {}
15243
+ };
15244
+ }
15081
15245
  }
15082
15246
  ];
15083
15247
  // src/commands/doctor-all/doctor-all.ts