@theholocron/cli 5.0.0-alpha.520 → 5.0.0-alpha.522

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
@@ -14,7 +14,7 @@ import { appendFileSync, closeSync, copyFileSync, existsSync, fstatSync, lstatSy
14
14
  import { DRY_RUN_NOOP_EXIT_CODE, createCommandRegistry, createMenu, numeric } from "@theholocron/kyber/menu";
15
15
  import { Entry, findCredentials } from "@napi-rs/keyring";
16
16
  import { AuthError, DOTENV_FILE, copyToClipboard, createFeatureResolver as createFeatureResolver$1, createKeyring, createPrivateFile, dotenvLine, findCredential, finishCredentialsFile, hasCredentials, isGitIgnored, readDotenvFile, resolveValue as resolveValue$1, resolveValue as resolveValue$2, setCredentials, writeCredentialsFile } from "@theholocron/kyber/secrets";
17
- import { DEFAULT_ORG, DOCUMENTATION_FLAG, DOT_GITHUB_REPO, HOLOCRON_REPO, KNOWN_TASKS, KNOWN_WORKFLOWS, LEGACY_NAMES, PNPM_BUILTIN_COMMANDS, PRERELEASE_CHANNEL, RELEASE_BRANCHES, RESERVED_SCRIPT_NAMES, SUITES, TASKS, aggregateChecks, checkPackageScripts, checkReleaseLines, codecovFlagNames, createAstromech, createCommitMsg, createDependabot, createDevmoji, createEditorconfig, createEditorconfigChecker, createHeader, createLabeler, createPreCommit, createPrePush, createPrepareCommitMsg, createYamlignore, createYamllint, defaultListDirs, defaultPaths, defaultReadJson, deployOnRelease, describeTasks, extractPreviewConfig, formatJson, frozenReusablePaths, generateThinCallerContent, hostedReusableWorkflows, isDeprecated, isTask, legacyCaller, legacyCallerFile, legacyGate, legacyWorkflowKey, localize, localizeActions, mergeScripts, packageLocation, readWorkspacePackages, recordDeploys, resolveTaskName, reusableTemplates, scriptName, stampDeprecated, wedgeFix, workflowFile, workflowKey, workflowKeys, workspacePackages as workspacePackages$1 } from "@theholocron/astromech";
17
+ import { AGGREGATE_CHECK, AGGREGATE_CHECK_NAME, AGGREGATE_SHADOW_CHECK_NAME, DEFAULT_ORG, DOCUMENTATION_FLAG, DOT_GITHUB_REPO, HOLOCRON_REPO, KNOWN_TASKS, KNOWN_WORKFLOWS, LEGACY_NAMES, PNPM_BUILTIN_COMMANDS, PRERELEASE_CHANNEL, RELEASE_BRANCHES, RESERVED_SCRIPT_NAMES, SUITES, TASKS, aggregateChecks, aggregatePoster, checkPackageScripts, checkReleaseLines, codecovFlagNames, createAstromech, createCommitMsg, createDependabot, createDevmoji, createEditorconfig, createEditorconfigChecker, createHeader, createLabeler, createPreCommit, createPrePush, createPrepareCommitMsg, createYamlignore, createYamllint, defaultListDirs, defaultPaths, defaultReadJson, deployOnRelease, describeTasks, extractPreviewConfig, formatJson, frozenReusablePaths, generateThinCallerContent, hostedReusableWorkflows, isDeprecated, isTask, legacyCaller, legacyCallerFile, legacyGate, legacyWorkflowKey, localize, localizeActions, mergeScripts, packageLocation, postAggregate, readWorkspacePackages, recordDeploys, resolveTaskName, reusableTemplates, scriptName, stampDeprecated, wedgeFix, workflowFile, workflowKey, workflowKeys, workspacePackages as workspacePackages$1 } from "@theholocron/astromech";
18
18
  import { loadTasksConfig, releaseGroups } from "@theholocron/astromech/config";
19
19
  import { createCliLogger, createCliTelemetry } from "@theholocron/kyber/observability";
20
20
  import { resolveAxiomFromEnv } from "@theholocron/observability/logger";
@@ -35,7 +35,7 @@ import { ADR_DIR, ADR_STATUSES, CLOSED_STATUSES, SPEC_DIRS, SPEC_STATUSES, WITHD
35
35
  import { stringifyJson } from "@theholocron/json-utils";
36
36
  import { findRootSync, isWorkspaceRoot, walkFilesSync } from "@theholocron/fs-utils";
37
37
  import { appManifestPage, buildAppManifest, convertAppManifest, serveAppManifest, serveHandler, superviseProcesses } from "@theholocron/dagobah";
38
- import { createGitHubClient, getApp, listAppInstallations } from "@theholocron/github-client";
38
+ import { createGitHubClient, getApp, listAppDeliveries, listAppInstallations, redeliverAppDelivery } from "@theholocron/github-client";
39
39
  import { createServer } from "node:http";
40
40
  import { promisify } from "node:util";
41
41
  import { loadConfigPath } from "@theholocron/datapad";
@@ -103,7 +103,9 @@ const COMMAND_CONTEXTS = {
103
103
  "sync roles": "workspace",
104
104
  "cleanup posts": "workspace",
105
105
  "sync specs": "workspace",
106
+ "reconcile ci": "workspace",
106
107
  "reconcile project": "workspace",
108
+ "redeliver webhooks": "workspace",
107
109
  "doctor all": "workspace",
108
110
  "doctor notifications": "workspace",
109
111
  "doctor environments": "workspace",
@@ -426,7 +428,17 @@ const doctorCiEntry = {
426
428
  name: "doctor ci",
427
429
  description: "Check the repo against the flat task vocabulary: aliases, caller names, the ci aggregate, home (read-only)",
428
430
  positionals: [],
429
- skipOptions: ["all", "repo"],
431
+ options: [{
432
+ key: "shadow",
433
+ flag: "--shadow",
434
+ type: "confirm",
435
+ message: "Also compare Sentinel's shadow aggregate with the Actions one?"
436
+ }],
437
+ skipOptions: [
438
+ "all",
439
+ "repo",
440
+ "limit"
441
+ ],
430
442
  supportsDryRun: false
431
443
  };
432
444
  // src/commands/doctor-dns/doctor-dns.entry.ts
@@ -1595,6 +1607,38 @@ const publishEntry = {
1595
1607
  }
1596
1608
  ]
1597
1609
  };
1610
+ // src/commands/reconcile-ci/reconcile-ci.entry.ts
1611
+ const reconcileCiEntry = {
1612
+ name: "reconcile ci",
1613
+ description: "Make the ci / Required checks check say what the checks on each open pull request call for (the manual path and the sweep)",
1614
+ positionals: [{
1615
+ key: "pullRequest",
1616
+ message: "Pull request number (empty for every open one):",
1617
+ type: "input"
1618
+ }],
1619
+ options: [{
1620
+ key: "shadow",
1621
+ flag: "--shadow",
1622
+ type: "confirm",
1623
+ message: "Repair Sentinel's shadow check instead of the real one?"
1624
+ }],
1625
+ skipOptions: ["max-age"],
1626
+ supportsDryRun: true
1627
+ };
1628
+ // src/commands/redeliver-webhooks/redeliver-webhooks.entry.ts
1629
+ const redeliverWebhooksEntry = {
1630
+ name: "redeliver webhooks",
1631
+ description: "Ask GitHub to deliver again the webhooks each registered App's endpoint did not accept (the recovery step after a Sentinel outage)",
1632
+ positionals: [],
1633
+ options: [{
1634
+ key: "since",
1635
+ flag: "--since",
1636
+ type: "input",
1637
+ message: "How far back (30m, 12h, 7d; default 1d):"
1638
+ }],
1639
+ skipOptions: ["app", "yes"],
1640
+ supportsDryRun: true
1641
+ };
1598
1642
  // src/commands/repo-cleanup-branches/repo-cleanup-branches.entry.ts
1599
1643
  const repoCleanupBranchesEntry = {
1600
1644
  name: "cleanup branches",
@@ -2247,7 +2291,9 @@ const registry = createCommandRegistry([
2247
2291
  projectCloseEntry,
2248
2292
  projectSetupEntry,
2249
2293
  projectStatusEntry,
2250
- projectReconcileEntry
2294
+ projectReconcileEntry,
2295
+ reconcileCiEntry,
2296
+ redeliverWebhooksEntry
2251
2297
  ], "interactive-menu");
2252
2298
  /** Every Holocron command, in menu order: what {@link launchMenu} lists and what a leaf handler's prompt reads. */
2253
2299
  const COMMAND_REGISTRY = registry.entries;
@@ -3082,6 +3128,8 @@ const DOCS_COVERAGE_MODES = [
3082
3128
  "warn",
3083
3129
  "required"
3084
3130
  ];
3131
+ /** The values `ci.aggregate` accepts. */
3132
+ const CI_AGGREGATE_POSTERS = ["actions", "sentinel"];
3085
3133
  /**
3086
3134
  * The environment a `credentials` provider reads: its own `environment` option when it has one, else the shared
3087
3135
  * `credentials.environment`, else `undefined`. The option lets each of several providers name its own (a 1Password
@@ -3108,6 +3156,10 @@ function resolveConfig(raw) {
3108
3156
  }
3109
3157
  const docsCoverage = raw.repoValidation?.docsCoverage;
3110
3158
  if (docsCoverage !== void 0 && !DOCS_COVERAGE_MODES.includes(docsCoverage)) throw new ConfigError(`\`repoValidation.docsCoverage\` must be one of ${DOCS_COVERAGE_MODES.map((m) => `"${m}"`).join(", ")}, got ${JSON.stringify(docsCoverage)}`);
3159
+ const aggregate = raw.ci?.aggregate;
3160
+ if (aggregate !== void 0 && !CI_AGGREGATE_POSTERS.includes(aggregate)) throw new ConfigError(`\`ci.aggregate\` must be one of ${CI_AGGREGATE_POSTERS.map((m) => `"${m}"`).join(", ")}, got ${JSON.stringify(aggregate)}`);
3161
+ const pin = raw.ci?.pin;
3162
+ if (pin !== void 0 && (typeof pin !== "object" || pin === null || !Number.isSafeInteger(pin.integrationId) || pin.integrationId <= 0)) throw new ConfigError(`\`ci.pin.integrationId\` must be a positive integer (the GitHub App's id), got ${JSON.stringify(pin)}`);
3111
3163
  if (raw.credentials !== void 0) {
3112
3164
  const environment = raw.credentials.environment;
3113
3165
  if (typeof environment !== "string" || environment.trim() === "") throw new ConfigError("`credentials.environment` must be the name of an environment, got an empty value");
@@ -3142,6 +3194,7 @@ function resolveConfig(raw) {
3142
3194
  syncScripts: raw.syncScripts,
3143
3195
  holocronScript: raw.holocronScript,
3144
3196
  extraRequiredChecks: raw.extraRequiredChecks,
3197
+ ci: raw.ci,
3145
3198
  hooks: raw.hooks,
3146
3199
  providers,
3147
3200
  apps: raw.apps ?? [],
@@ -3284,6 +3337,7 @@ async function deriveDefaults$1(found) {
3284
3337
  if (manifest.syncScripts !== void 0) result.syncScripts = manifest.syncScripts;
3285
3338
  if (manifest.holocronScript !== void 0) result.holocronScript = manifest.holocronScript;
3286
3339
  if (manifest.hooks !== void 0) result.hooks = manifest.hooks;
3340
+ if (manifest.ci !== void 0) result.ci = manifest.ci;
3287
3341
  if (manifest.extraRequiredChecks) result.extraRequiredChecks = [...result.extraRequiredChecks ?? [], ...manifest.extraRequiredChecks];
3288
3342
  return result;
3289
3343
  }
@@ -3996,7 +4050,7 @@ function planIssueTypes(declared, existing, update) {
3996
4050
  }
3997
4051
  const WRITE_PERMISSION = "creating or changing issue Types needs an organization admin and the organization permission Issue types: write (HOLOCRON_ORG_TOKEN)";
3998
4052
  const READ_PERMISSION = "reading the organization's issue Types needs the organization permission Issue types: read (HOLOCRON_ORG_TOKEN)";
3999
- const row$33 = (id, title, status, detail, problems = []) => ({
4053
+ const row$35 = (id, title, status, detail, problems = []) => ({
4000
4054
  id: `issue-types:${id}`,
4001
4055
  title,
4002
4056
  status,
@@ -4016,7 +4070,7 @@ async function ensureIssueTypes(input) {
4016
4070
  const refused = input.caller === "setup" ? "skip" : "fail";
4017
4071
  const stop = (status, detail, problems = []) => ({
4018
4072
  status,
4019
- rows: [row$33("types", "issue types", status, detail, problems)],
4073
+ rows: [row$35("types", "issue types", status, detail, problems)],
4020
4074
  created,
4021
4075
  updated
4022
4076
  });
@@ -4056,7 +4110,7 @@ async function ensureIssueTypes(input) {
4056
4110
  default: false
4057
4111
  })))(`Change the organization's issue Types?\n${todo.map((a) => ` ${describeAction(a).detail} ${a.declared.name}`).join("\n")}`)) return {
4058
4112
  status: "cancelled",
4059
- rows: [row$33("types", "issue types", "skip", "cancelled; nothing was changed")],
4113
+ rows: [row$35("types", "issue types", "skip", "cancelled; nothing was changed")],
4060
4114
  created,
4061
4115
  updated
4062
4116
  };
@@ -4071,34 +4125,34 @@ async function ensureIssueTypes(input) {
4071
4125
  continue;
4072
4126
  }
4073
4127
  if (limited) {
4074
- rows.push(row$33(name, name, "skip", "left: stopped at a rate limit"));
4128
+ rows.push(row$35(name, name, "skip", "left: stopped at a rate limit"));
4075
4129
  continue;
4076
4130
  }
4077
4131
  if (refusedOnce) {
4078
- rows.push(row$33(name, name, refused, "not written: the token was refused"));
4132
+ rows.push(row$35(name, name, refused, "not written: the token was refused"));
4079
4133
  continue;
4080
4134
  }
4081
4135
  try {
4082
4136
  if (action.kind === "create") {
4083
4137
  await issues.createType(toDeclaration(action.declared));
4084
4138
  created.push(name);
4085
- rows.push(row$33(name, name, "ok", "created"));
4139
+ rows.push(row$35(name, name, "ok", "created"));
4086
4140
  } else {
4087
4141
  const patch = Object.fromEntries(action.changes.map((c) => [c.field, c.to]));
4088
4142
  await issues.updateType?.(action.existing.id, patch);
4089
4143
  updated.push(name);
4090
- rows.push(row$33(name, name, "ok", `updated ${action.changes.map((c) => c.field).join(", ")}`));
4144
+ rows.push(row$35(name, name, "ok", `updated ${action.changes.map((c) => c.field).join(", ")}`));
4091
4145
  }
4092
4146
  } catch (err) {
4093
4147
  const kind = classifyTypeError(err);
4094
4148
  if (kind === "rate-limit") {
4095
4149
  limited = true;
4096
- rows.push(row$33(name, name, "fail", "rate limited: stopped; run it again to finish"));
4150
+ rows.push(row$35(name, name, "fail", "rate limited: stopped; run it again to finish"));
4097
4151
  } else if (kind === "refused") {
4098
4152
  refusedOnce = true;
4099
- rows.push(row$33(name, name, refused, WRITE_PERMISSION));
4100
- } else if (kind === "conflict" && action.kind === "create" && await nowExists(issues, name)) rows.push(row$33(name, name, "ok", "exists (made in the meantime)"));
4101
- else rows.push(row$33(name, name, "fail", describeError(err)));
4153
+ rows.push(row$35(name, name, refused, WRITE_PERMISSION));
4154
+ } else if (kind === "conflict" && action.kind === "create" && await nowExists(issues, name)) rows.push(row$35(name, name, "ok", "exists (made in the meantime)"));
4155
+ else rows.push(row$35(name, name, "fail", describeError(err)));
4102
4156
  }
4103
4157
  }
4104
4158
  return {
@@ -4119,12 +4173,12 @@ async function nowExists(issues, name) {
4119
4173
  /** The row of an action that is not carried out (a dry run, or the list shown before asking), or that needs none. */
4120
4174
  function describeAction(action) {
4121
4175
  const name = action.declared.name;
4122
- if (action.kind === "create") return row$33(name, name, "skip", "would create");
4176
+ if (action.kind === "create") return row$35(name, name, "skip", "would create");
4123
4177
  if (action.kind === "update") {
4124
4178
  const fields = action.changes.map((c) => c.field).join(", ");
4125
- return row$33(name, name, "skip", `would update ${fields}`, action.changes.map((c) => `${c.field}: was ${JSON.stringify(c.was)}, to ${JSON.stringify(c.to)}`));
4179
+ return row$35(name, name, "skip", `would update ${fields}`, action.changes.map((c) => `${c.field}: was ${JSON.stringify(c.was)}, to ${JSON.stringify(c.to)}`));
4126
4180
  }
4127
- return row$33(name, name, "ok", action.existing.enabled ? "exists" : "exists (turned off in the organization)");
4181
+ return row$35(name, name, "ok", action.existing.enabled ? "exists" : "exists (turned off in the organization)");
4128
4182
  }
4129
4183
  // src/commands/notifications-channel-add/private-host.ts
4130
4184
  /**
@@ -6711,7 +6765,7 @@ async function openBoardContext(input) {
6711
6765
  };
6712
6766
  }
6713
6767
  // src/commands/issue-fields/add-issue-to-board/add-issue-to-board.ts
6714
- const row$32 = (board, status, detail) => ({
6768
+ const row$34 = (board, status, detail) => ({
6715
6769
  id: `board ${board}`,
6716
6770
  title: `board ${board}`,
6717
6771
  status,
@@ -6733,27 +6787,27 @@ async function addIssueToBoard(input) {
6733
6787
  loader: input.loader,
6734
6788
  ...input.io ? { io: input.io } : {}
6735
6789
  });
6736
- if (!opened.ok) return row$32(board, opened.kind === "skip" ? "skip" : "fail", [opened.reason, ...opened.problems].join("; "));
6790
+ if (!opened.ok) return row$34(board, opened.kind === "skip" ? "skip" : "fail", [opened.reason, ...opened.problems].join("; "));
6737
6791
  const { projects, owner, boards, templates } = opened.context;
6738
- if (!projects.addItems) return row$32(board, "skip", `the \`${projects.providerName}\` provider cannot add items to a board`);
6792
+ if (!projects.addItems) return row$34(board, "skip", `the \`${projects.providerName}\` provider cannot add items to a board`);
6739
6793
  const declared = boards.find((b) => b.name.toLowerCase() === board.toLowerCase());
6740
6794
  if (!declared) {
6741
6795
  const names = boards.map((b) => b.name).join(", ");
6742
- return row$32(board, "fail", `no board named "${board}" is declared in providers.projects${names ? ` (declared: ${names})` : ""}`);
6796
+ return row$34(board, "fail", `no board named "${board}" is declared in providers.projects${names ? ` (declared: ${names})` : ""}`);
6743
6797
  }
6744
6798
  const template = templates[declared.template];
6745
- if (!template) return row$32(board, "fail", `the template "${declared.template}" of "${declared.name}" is not available`);
6799
+ if (!template) return row$34(board, "fail", `the template "${declared.template}" of "${declared.name}" is not available`);
6746
6800
  const found = await projects.find(owner, declared.name);
6747
- if (!found) return row$32(board, "fail", `the board "${declared.name}" does not exist yet; \`holocron setup project\` makes it`);
6748
- if (input.dryRun) return row$32(board, "skip", `would add ${key} to "${declared.name}"`);
6801
+ if (!found) return row$34(board, "fail", `the board "${declared.name}" does not exist yet; \`holocron setup project\` makes it`);
6802
+ if (input.dryRun) return row$34(board, "skip", `would add ${key} to "${declared.name}"`);
6749
6803
  const [added] = await projects.addItems(owner, found, [{
6750
6804
  key,
6751
6805
  ...input.priority ? { priority: input.priority } : {}
6752
6806
  }], template);
6753
6807
  const dropped = added?.dropped ?? [];
6754
- return row$32(board, dropped.length > 0 ? "skip" : "ok", `${added?.added ? "added" : "already on"} "${declared.name}"${dropped.length > 0 ? `; not set: ${dropped.join(", ")}` : ""}`);
6808
+ return row$34(board, dropped.length > 0 ? "skip" : "ok", `${added?.added ? "added" : "already on"} "${declared.name}"${dropped.length > 0 ? `; not set: ${dropped.join(", ")}` : ""}`);
6755
6809
  } catch (err) {
6756
- return row$32(board, "fail", `could not add ${key} to the board: ${describeError(err)}`);
6810
+ return row$34(board, "fail", `could not add ${key} to the board: ${describeError(err)}`);
6757
6811
  }
6758
6812
  }
6759
6813
  // src/commands/issue-fields/describe-issue-fields/describe-issue-fields.ts
@@ -6860,7 +6914,7 @@ function prepareIssueFields(input, areas) {
6860
6914
  * asks first unless `--dry-run` or `--yes` (without a terminal it refuses instead). `update work` is another command,
6861
6915
  * which spans the pull request and the board.
6862
6916
  */
6863
- const row$31 = (id, status, detail) => ({
6917
+ const row$33 = (id, status, detail) => ({
6864
6918
  id,
6865
6919
  title: id,
6866
6920
  status,
@@ -6886,7 +6940,7 @@ async function runIssueUpdate(input) {
6886
6940
  print(style.header(`Holocron update issue${dryRun ? " (dry-run)" : ""}`));
6887
6941
  print("");
6888
6942
  const key = input.key.trim();
6889
- if (!key) return finish([row$31("key", "fail", "the issue key is empty")]);
6943
+ if (!key) return finish([row$33("key", "fail", "the issue key is empty")]);
6890
6944
  const prepared = prepareIssueFields(input, input.loaded.resolved.repo?.labels?.areas);
6891
6945
  const problems = prepared.ok ? [] : [...prepared.problems];
6892
6946
  const clear = [...new Set(input.clear ?? [])];
@@ -6913,7 +6967,7 @@ async function runIssueUpdate(input) {
6913
6967
  for (const label of addLabels) if (removeLabels.some((r) => r.toLowerCase() === label.toLowerCase())) problems.push(`the label "${label}" is both added and removed`);
6914
6968
  const blockers = prepared.ok ? prepared.fields.blockedBy ?? [] : [];
6915
6969
  for (const k of unblock) if (blockers.includes(k)) problems.push(`${k} is both added and removed as a blocker`);
6916
- if (problems.length > 0 || !prepared.ok) return finish(problems.map((p) => row$31(key, "fail", p)));
6970
+ if (problems.length > 0 || !prepared.ok) return finish(problems.map((p) => row$33(key, "fail", p)));
6917
6971
  const patch = {
6918
6972
  ...prepared.fields,
6919
6973
  ...title ? { title } : {},
@@ -6939,10 +6993,10 @@ async function runIssueUpdate(input) {
6939
6993
  ...unblock.length > 0 ? [`unblock: ${unblock.join(", ")}`] : [],
6940
6994
  ...clear.length > 0 ? [`clear: ${clear.join(", ")}`] : []
6941
6995
  ];
6942
- if (details.length === 0) return finish([row$31(key, "fail", "nothing to change; name a field to set, or `--clear` one")]);
6996
+ if (details.length === 0) return finish([row$33(key, "fail", "nothing to change; name a field to set, or `--clear` one")]);
6943
6997
  const summary = ` (${details.join("; ")})`;
6944
6998
  const entry = input.loaded.resolved.providers.issues;
6945
- if (!entry) return finish([row$31(key, "fail", "the config has no `issues` provider to update the issue with")]);
6999
+ if (!entry) return finish([row$33(key, "fail", "the config has no `issues` provider to update the issue with")]);
6946
7000
  const credentials = input.loaded.resolved.providers.credentials;
6947
7001
  const projects = prepared.project ? input.loaded.resolved.providers.projects : void 0;
6948
7002
  /* v8 ignore start -- the real loader is only built outside tests, which always inject one */
@@ -6959,10 +7013,10 @@ async function runIssueUpdate(input) {
6959
7013
  assertPluginsResolvable(loader, "update issue");
6960
7014
  if (!loader.has("issues")) {
6961
7015
  const failure = loader.loadFailures().find((f) => f.key === "issues");
6962
- return finish([row$31(key, "fail", `the \`issues\` provider is not available${failure ? ` (${describeError(failure.error)})` : ""}`)]);
7016
+ return finish([row$33(key, "fail", `the \`issues\` provider is not available${failure ? ` (${describeError(failure.error)})` : ""}`)]);
6963
7017
  }
6964
7018
  const issues = loader.get("issues");
6965
- if (!issues.update) return finish([row$31(key, "fail", `the \`${issues.providerName}\` provider does not support \`update issue\``)]);
7019
+ if (!issues.update) return finish([row$33(key, "fail", `the \`${issues.providerName}\` provider does not support \`update issue\``)]);
6966
7020
  if (dryRun) {
6967
7021
  const board = prepared.project ? await addIssueToBoard({
6968
7022
  loaded: input.loaded,
@@ -6972,7 +7026,7 @@ async function runIssueUpdate(input) {
6972
7026
  key,
6973
7027
  dryRun: true
6974
7028
  }) : void 0;
6975
- return finish([row$31(key, "skip", `would update the issue${summary}`), ...board ? [board] : []]);
7029
+ return finish([row$33(key, "skip", `would update the issue${summary}`), ...board ? [board] : []]);
6976
7030
  }
6977
7031
  if (!input.yes) {
6978
7032
  if (!(input.interactive ?? Boolean(process.stdin.isTTY))) throw new NonInteractiveError("`update issue` changes an issue; pass --yes to run it without asking, or --dry-run to preview");
@@ -6998,12 +7052,12 @@ async function runIssueUpdate(input) {
6998
7052
  ...prepared.fields.priority ? { priority: prepared.fields.priority } : {}
6999
7053
  }) : void 0;
7000
7054
  return finish([
7001
- row$31(result.key, "ok", result.changed.length > 0 ? `updated: ${result.changed.join("; ")}` : "already as asked; nothing changed"),
7002
- ...(result.dropped ?? []).map((line) => row$31("not carried across", "skip", line)),
7055
+ row$33(result.key, "ok", result.changed.length > 0 ? `updated: ${result.changed.join("; ")}` : "already as asked; nothing changed"),
7056
+ ...(result.dropped ?? []).map((line) => row$33("not carried across", "skip", line)),
7003
7057
  ...board ? [board] : []
7004
7058
  ], result.changed);
7005
7059
  } catch (err) {
7006
- return finish([row$31(key, "fail", `could not update the issue: ${describeError(err)}`)]);
7060
+ return finish([row$33(key, "fail", `could not update the issue: ${describeError(err)}`)]);
7007
7061
  }
7008
7062
  }
7009
7063
  // src/commands/start-work/find-worktree/find-worktree.ts
@@ -7043,7 +7097,7 @@ function unpushedCommits(git, cwd, branch) {
7043
7097
  ], cwd)) || 0;
7044
7098
  }
7045
7099
  // src/commands/close-work/clean-up-work/clean-up-work.ts
7046
- const row$30 = (id, status, detail) => ({
7100
+ const row$32 = (id, status, detail) => ({
7047
7101
  id,
7048
7102
  title: id,
7049
7103
  status,
@@ -7072,51 +7126,51 @@ function cleanUpWork(input) {
7072
7126
  let keepBranch;
7073
7127
  try {
7074
7128
  const path = findWorktree(git, repoRoot, branch);
7075
- if (!path) rows.push(row$30("worktree", "skip", `none holds ${branch}`));
7129
+ if (!path) rows.push(row$32("worktree", "skip", `none holds ${branch}`));
7076
7130
  else if (input.keepWorktree) {
7077
- rows.push(row$30("worktree", "skip", `kept at ${path} (--keep-worktree)`));
7131
+ rows.push(row$32("worktree", "skip", `kept at ${path} (--keep-worktree)`));
7078
7132
  keepBranch = "its worktree is kept";
7079
7133
  } else if (resolve(path) === mainWorktree(input)) {
7080
- rows.push(row$30("worktree", "skip", `${branch} is checked out in the main checkout; switch it to another branch first`));
7134
+ rows.push(row$32("worktree", "skip", `${branch} is checked out in the main checkout; switch it to another branch first`));
7081
7135
  keepBranch = "it is checked out in the main checkout";
7082
7136
  } else if (resolve(repoRoot) === resolve(path) || resolve(repoRoot).startsWith(resolve(path) + sep)) {
7083
- rows.push(row$30("worktree", "skip", `${path} is where this command is running; run it from another checkout`));
7137
+ rows.push(row$32("worktree", "skip", `${path} is where this command is running; run it from another checkout`));
7084
7138
  keepBranch = "its worktree is where this command is running";
7085
7139
  } else if (git(["status", "--porcelain"], path)) {
7086
- rows.push(row$30("worktree", "fail", `${path} has uncommitted changes; commit or discard them, nothing was removed`));
7140
+ rows.push(row$32("worktree", "fail", `${path} has uncommitted changes; commit or discard them, nothing was removed`));
7087
7141
  keepBranch = "its worktree has uncommitted changes";
7088
- } else if (dryRun) rows.push(row$30("worktree", "skip", `would remove ${path}`));
7142
+ } else if (dryRun) rows.push(row$32("worktree", "skip", `would remove ${path}`));
7089
7143
  else {
7090
7144
  git([
7091
7145
  "worktree",
7092
7146
  "remove",
7093
7147
  path
7094
7148
  ], repoRoot);
7095
- rows.push(row$30("worktree", "ok", `removed ${path}`));
7149
+ rows.push(row$32("worktree", "ok", `removed ${path}`));
7096
7150
  }
7097
7151
  } catch (err) {
7098
- rows.push(row$30("worktree", "fail", `could not remove the worktree: ${describeError(err)}`));
7152
+ rows.push(row$32("worktree", "fail", `could not remove the worktree: ${describeError(err)}`));
7099
7153
  keepBranch = "its worktree could not be removed";
7100
7154
  }
7101
7155
  try {
7102
7156
  const unpushed = unpushedCommits(git, repoRoot, branch);
7103
- if (unpushed === void 0) rows.push(row$30("local branch", "skip", `${branch} is not in this checkout`));
7104
- else if (keepBranch) rows.push(row$30("local branch", "skip", `${branch} stays: ${keepBranch}`));
7157
+ if (unpushed === void 0) rows.push(row$32("local branch", "skip", `${branch} is not in this checkout`));
7158
+ else if (keepBranch) rows.push(row$32("local branch", "skip", `${branch} stays: ${keepBranch}`));
7105
7159
  else {
7106
7160
  const tip = git(["rev-parse", `refs/heads/${branch}`], repoRoot);
7107
- if (!(input.mode === "abandoned" || unpushed === 0 || input.headSha && tip === input.headSha)) rows.push(row$30("local branch", "fail", `${branch} holds commits the pull request does not (tip ${tip.slice(0, 7)}); not deleted`));
7108
- else if (dryRun) rows.push(row$30("local branch", "skip", `would delete ${branch}`));
7161
+ if (!(input.mode === "abandoned" || unpushed === 0 || input.headSha && tip === input.headSha)) rows.push(row$32("local branch", "fail", `${branch} holds commits the pull request does not (tip ${tip.slice(0, 7)}); not deleted`));
7162
+ else if (dryRun) rows.push(row$32("local branch", "skip", `would delete ${branch}`));
7109
7163
  else {
7110
7164
  git([
7111
7165
  "branch",
7112
7166
  "-D",
7113
7167
  branch
7114
7168
  ], repoRoot);
7115
- rows.push(row$30("local branch", "ok", `deleted ${branch}`));
7169
+ rows.push(row$32("local branch", "ok", `deleted ${branch}`));
7116
7170
  }
7117
7171
  }
7118
7172
  } catch (err) {
7119
- rows.push(row$30("local branch", "fail", `could not delete ${branch}: ${describeError(err)}`));
7173
+ rows.push(row$32("local branch", "fail", `could not delete ${branch}: ${describeError(err)}`));
7120
7174
  }
7121
7175
  try {
7122
7176
  const remote = git([
@@ -7125,9 +7179,9 @@ function cleanUpWork(input) {
7125
7179
  "origin",
7126
7180
  `refs/heads/${branch}`
7127
7181
  ], repoRoot);
7128
- rows.push(remote ? row$30("remote branch", "skip", `${branch} is still on origin; GitHub deletes it on merge (the repo setting), or run: git push origin --delete ${branch}`) : row$30("remote branch", "ok", `${branch} is gone from origin`));
7182
+ rows.push(remote ? row$32("remote branch", "skip", `${branch} is still on origin; GitHub deletes it on merge (the repo setting), or run: git push origin --delete ${branch}`) : row$32("remote branch", "ok", `${branch} is gone from origin`));
7129
7183
  } catch (err) {
7130
- rows.push(row$30("remote branch", "skip", `could not ask origin: ${describeError(err)}`));
7184
+ rows.push(row$32("remote branch", "skip", `could not ask origin: ${describeError(err)}`));
7131
7185
  }
7132
7186
  return rows;
7133
7187
  }
@@ -7171,7 +7225,7 @@ function findWorkBranches(git, cwd, issue) {
7171
7225
  });
7172
7226
  }
7173
7227
  // src/commands/close-work/abandon-work/abandon-work.ts
7174
- const row$29 = (id, status, detail) => ({
7228
+ const row$31 = (id, status, detail) => ({
7175
7229
  id,
7176
7230
  title: id,
7177
7231
  status,
@@ -7196,9 +7250,9 @@ async function abandonWork(a) {
7196
7250
  try {
7197
7251
  found = findWorkBranches(git, repoRoot, key);
7198
7252
  } catch (err) {
7199
- return { rows: [row$29("local branch", "fail", `could not list the branches: ${describeError(err)}`)] };
7253
+ return { rows: [row$31("local branch", "fail", `could not list the branches: ${describeError(err)}`)] };
7200
7254
  }
7201
- if (found.length > 1) return { rows: [row$29("local branch", "fail", `${found.length} branches are named for ${key} (${found.join(", ")}); --pr names the pull request whose branch to remove`)] };
7255
+ if (found.length > 1) return { rows: [row$31("local branch", "fail", `${found.length} branches are named for ${key} (${found.join(", ")}); --pr names the pull request whose branch to remove`)] };
7202
7256
  branch = found[0];
7203
7257
  }
7204
7258
  if (branch) {
@@ -7206,9 +7260,9 @@ async function abandonWork(a) {
7206
7260
  try {
7207
7261
  unpushed = unpushedCommits(git, repoRoot, branch);
7208
7262
  } catch (err) {
7209
- return { rows: [row$29("unpushed commits", "fail", `could not read ${branch}: ${describeError(err)}`)] };
7263
+ return { rows: [row$31("unpushed commits", "fail", `could not read ${branch}: ${describeError(err)}`)] };
7210
7264
  }
7211
- if (unpushed !== void 0 && unpushed > 0) return { rows: [row$29("unpushed commits", "fail", `${branch} holds ${unpushed} commit${unpushed === 1 ? "" : "s"} no remote branch has; push ${unpushed === 1 ? "it" : "them"} or delete the branch by hand. Nothing was changed`)] };
7265
+ if (unpushed !== void 0 && unpushed > 0) return { rows: [row$31("unpushed commits", "fail", `${branch} holds ${unpushed} commit${unpushed === 1 ? "" : "s"} no remote branch has; push ${unpushed === 1 ? "it" : "them"} or delete the branch by hand. Nothing was changed`)] };
7212
7266
  }
7213
7267
  if (!dryRun && !input.yes) {
7214
7268
  const what = [
@@ -7222,31 +7276,31 @@ async function abandonWork(a) {
7222
7276
  };
7223
7277
  }
7224
7278
  let specFiles = [];
7225
- if (!pr) rows.push(row$29("pull request", "skip", `no open pull request for ${key}`));
7279
+ if (!pr) rows.push(row$31("pull request", "skip", `no open pull request for ${key}`));
7226
7280
  else {
7227
7281
  try {
7228
7282
  specFiles = source.listPullRequestFiles ? findSpecFiles(await source.listPullRequestFiles(pr.number)) : [];
7229
7283
  } catch (err) {
7230
- rows.push(row$29("spec", "fail", `could not read the pull request's files: ${describeError(err)}`));
7284
+ rows.push(row$31("spec", "fail", `could not read the pull request's files: ${describeError(err)}`));
7231
7285
  }
7232
- if (pr.state !== "open") rows.push(row$29("pull request", "skip", `#${pr.number} is already closed`));
7233
- else if (!source.updatePullRequest) rows.push(row$29("pull request", "fail", `the \`${source.providerName}\` provider cannot close a pull request`));
7234
- else if (dryRun) rows.push(row$29("pull request", "skip", `would close #${pr.number}`));
7286
+ if (pr.state !== "open") rows.push(row$31("pull request", "skip", `#${pr.number} is already closed`));
7287
+ else if (!source.updatePullRequest) rows.push(row$31("pull request", "fail", `the \`${source.providerName}\` provider cannot close a pull request`));
7288
+ else if (dryRun) rows.push(row$31("pull request", "skip", `would close #${pr.number}`));
7235
7289
  else try {
7236
7290
  await source.updatePullRequest(pr.number, { state: "closed" });
7237
- rows.push(row$29("pull request", "ok", `closed #${pr.number}`));
7291
+ rows.push(row$31("pull request", "ok", `closed #${pr.number}`));
7238
7292
  } catch (err) {
7239
- rows.push(row$29("pull request", "fail", `could not close #${pr.number}: ${describeError(err)}`));
7293
+ rows.push(row$31("pull request", "fail", `could not close #${pr.number}: ${describeError(err)}`));
7240
7294
  }
7241
7295
  }
7242
7296
  if (pr && !rows.some((r) => r.id === "spec")) {
7243
- if (specFiles.length === 0) rows.push(row$29("spec", "skip", "the pull request holds no spec or ADR, so no post to withdraw"));
7244
- else if (!input.withdrawSpecs) rows.push(row$29("spec", "fail", "no way to withdraw the post was given"));
7297
+ if (specFiles.length === 0) rows.push(row$31("spec", "skip", "the pull request holds no spec or ADR, so no post to withdraw"));
7298
+ else if (!input.withdrawSpecs) rows.push(row$31("spec", "fail", "no way to withdraw the post was given"));
7245
7299
  else try {
7246
7300
  const result = await input.withdrawSpecs(specFiles);
7247
- rows.push(row$29("spec", result.ok ? "ok" : "fail", `${specFiles.join(", ")}: ${result.detail}`));
7301
+ rows.push(row$31("spec", result.ok ? "ok" : "fail", `${specFiles.join(", ")}: ${result.detail}`));
7248
7302
  } catch (err) {
7249
- rows.push(row$29("spec", "fail", `could not withdraw the post: ${describeError(err)}`));
7303
+ rows.push(row$31("spec", "fail", `could not withdraw the post: ${describeError(err)}`));
7250
7304
  }
7251
7305
  }
7252
7306
  if (branch) rows.push(...cleanUpWork({
@@ -7257,9 +7311,9 @@ async function abandonWork(a) {
7257
7311
  mode: "abandoned",
7258
7312
  ...input.keepWorktree ? { keepWorktree: true } : {}
7259
7313
  }));
7260
- else rows.push(row$29("local branch", "skip", `no local branch is named for ${key}`));
7261
- if (dryRun) rows.push(row$29("issue", "skip", `would ask whether to close ${key} as not planned`));
7262
- else if (input.yes) rows.push(row$29("issue", "skip", `${key} left open: --yes does not close an issue; run \`holocron update issue ${key} --state closed --state-reason not_planned\` to close it as not planned`));
7314
+ else rows.push(row$31("local branch", "skip", `no local branch is named for ${key}`));
7315
+ if (dryRun) rows.push(row$31("issue", "skip", `would ask whether to close ${key} as not planned`));
7316
+ else if (input.yes) rows.push(row$31("issue", "skip", `${key} left open: --yes does not close an issue; run \`holocron update issue ${key} --state closed --state-reason not_planned\` to close it as not planned`));
7263
7317
  else if (await a.ask(`Close ${key} as not planned?`)) {
7264
7318
  const close = await (input.updateIssue ?? runIssueUpdate)({
7265
7319
  key,
@@ -7276,7 +7330,7 @@ async function abandonWork(a) {
7276
7330
  id: `issue: ${r.id}`,
7277
7331
  title: `issue: ${r.title}`
7278
7332
  });
7279
- } else rows.push(row$29("issue", "skip", `${key} left open`));
7333
+ } else rows.push(row$31("issue", "skip", `${key} left open`));
7280
7334
  return { rows };
7281
7335
  }
7282
7336
  // src/commands/update-work/find-work-pull-request/find-work-pull-request.ts
@@ -7755,7 +7809,7 @@ function workTitle(input) {
7755
7809
  const MAX_TITLE = 100;
7756
7810
  const DEFAULT_BASE = "alpha";
7757
7811
  const WORKTREES = ".claude/worktrees";
7758
- const row$28 = (id, status, detail) => ({
7812
+ const row$30 = (id, status, detail) => ({
7759
7813
  id,
7760
7814
  title: id,
7761
7815
  status,
@@ -7791,7 +7845,7 @@ async function runStartWork(input) {
7791
7845
  };
7792
7846
  };
7793
7847
  const fail = (id, detail) => {
7794
- rows.push(row$28(id, "fail", detail));
7848
+ rows.push(row$30(id, "fail", detail));
7795
7849
  return finish();
7796
7850
  };
7797
7851
  print(style.header(`Holocron start work${dryRun ? " (dry-run)" : ""}`));
@@ -7847,7 +7901,7 @@ async function runStartWork(input) {
7847
7901
  } catch (err) {
7848
7902
  return fail(key, `could not read the issue: ${describeError(err)}`);
7849
7903
  }
7850
- rows.push(row$28(key, "ok", `${issue.summary} (${issue.status})`));
7904
+ rows.push(row$30(key, "ok", `${issue.summary} (${issue.status})`));
7851
7905
  const named = workTitle({
7852
7906
  issueTitle: issue.summary,
7853
7907
  ...input.kind ? {
@@ -7890,14 +7944,14 @@ async function runStartWork(input) {
7890
7944
  ...source ? [`draft pull request "${title}" (${link.keyword} ${key})`] : ["no pull request"]
7891
7945
  ].join("; ");
7892
7946
  if (dryRun) {
7893
- rows.push(row$28("title", "skip", `${title} (${named.reason}${releaseNote})`));
7894
- rows.push(row$28("start date", "skip", `would set the start date${input.effort ? ` and Effort ${input.effort}` : ""}${branchExists ? " (not again: the branch exists)" : ""}`));
7895
- rows.push(row$28("branch", "skip", `would ${branchExists ? "reuse" : "make"} ${branch} from origin/${base}`));
7896
- if (useWorktree) rows.push(row$28("worktree", "skip", `would use ${wtPath}`));
7897
- rows.push(row$28("first commit", "skip", `would commit${spec ? ` ${spec.rel}` : " empty"} as "${commitSubject}"`));
7898
- rows.push(row$28("push", "skip", `would push ${branch} to origin`));
7899
- if (source) rows.push(row$28("pull request", "skip", `would open a draft pull request against ${base}, ${link.keyword} ${key}`));
7900
- rows.push(row$28("board status", "skip", "the open pull request moves the issue to In Progress"));
7947
+ rows.push(row$30("title", "skip", `${title} (${named.reason}${releaseNote})`));
7948
+ rows.push(row$30("start date", "skip", `would set the start date${input.effort ? ` and Effort ${input.effort}` : ""}${branchExists ? " (not again: the branch exists)" : ""}`));
7949
+ rows.push(row$30("branch", "skip", `would ${branchExists ? "reuse" : "make"} ${branch} from origin/${base}`));
7950
+ if (useWorktree) rows.push(row$30("worktree", "skip", `would use ${wtPath}`));
7951
+ rows.push(row$30("first commit", "skip", `would commit${spec ? ` ${spec.rel}` : " empty"} as "${commitSubject}"`));
7952
+ rows.push(row$30("push", "skip", `would push ${branch} to origin`));
7953
+ if (source) rows.push(row$30("pull request", "skip", `would open a draft pull request against ${base}, ${link.keyword} ${key}`));
7954
+ rows.push(row$30("board status", "skip", "the open pull request moves the issue to In Progress"));
7901
7955
  return finish();
7902
7956
  }
7903
7957
  if (!input.yes) {
@@ -7913,18 +7967,18 @@ async function runStartWork(input) {
7913
7967
  };
7914
7968
  }
7915
7969
  }
7916
- rows.push(row$28("title", "ok", `${title} (${named.reason}${releaseNote})`));
7917
- if (branchExists) rows.push(row$28("start date", "skip", "the branch exists, so the work started before; the start date is left as it is"));
7918
- else if (!issues.update) rows.push(row$28("start date", "skip", `the \`${issues.providerName}\` provider cannot update an issue`));
7970
+ rows.push(row$30("title", "ok", `${title} (${named.reason}${releaseNote})`));
7971
+ if (branchExists) rows.push(row$30("start date", "skip", "the branch exists, so the work started before; the start date is left as it is"));
7972
+ else if (!issues.update) rows.push(row$30("start date", "skip", `the \`${issues.providerName}\` provider cannot update an issue`));
7919
7973
  else try {
7920
7974
  const result = await issues.update(key, {
7921
7975
  startDate: io.today(),
7922
7976
  ...input.effort ? { effort: input.effort } : {}
7923
7977
  });
7924
- rows.push(row$28("start date", "ok", result.changed.length > 0 ? result.changed.join(", ") : "already as asked"));
7925
- for (const line of result.dropped ?? []) rows.push(row$28("not carried across", "skip", line));
7978
+ rows.push(row$30("start date", "ok", result.changed.length > 0 ? result.changed.join(", ") : "already as asked"));
7979
+ for (const line of result.dropped ?? []) rows.push(row$30("not carried across", "skip", line));
7926
7980
  } catch (err) {
7927
- rows.push(row$28("start date", "fail", `could not update the issue: ${describeError(err)}`));
7981
+ rows.push(row$30("start date", "fail", `could not update the issue: ${describeError(err)}`));
7928
7982
  }
7929
7983
  let dir = root;
7930
7984
  try {
@@ -7953,7 +8007,7 @@ async function runStartWork(input) {
7953
8007
  "--abbrev-ref",
7954
8008
  "HEAD"
7955
8009
  ], root) !== branch && dir === root) io.git(["switch", branch], root);
7956
- rows.push(row$28("branch", "ok", `${branch} already exists; reused`));
8010
+ rows.push(row$30("branch", "ok", `${branch} already exists; reused`));
7957
8011
  } else if (useWorktree) {
7958
8012
  io.git([
7959
8013
  "worktree",
@@ -7965,7 +8019,7 @@ async function runStartWork(input) {
7965
8019
  start
7966
8020
  ], root);
7967
8021
  dir = wtPath;
7968
- rows.push(row$28("branch", "ok", `made ${branch} from ${start}`));
8022
+ rows.push(row$30("branch", "ok", `made ${branch} from ${start}`));
7969
8023
  } else {
7970
8024
  io.git([
7971
8025
  "switch",
@@ -7974,19 +8028,19 @@ async function runStartWork(input) {
7974
8028
  branch,
7975
8029
  start
7976
8030
  ], root);
7977
- rows.push(row$28("branch", "ok", `made ${branch} from ${start} and switched to it`));
8031
+ rows.push(row$30("branch", "ok", `made ${branch} from ${start} and switched to it`));
7978
8032
  }
7979
8033
  report = {
7980
8034
  ...report,
7981
8035
  directory: dir
7982
8036
  };
7983
- if (useWorktree) rows.push(row$28("worktree", "ok", dir));
8037
+ if (useWorktree) rows.push(row$30("worktree", "ok", dir));
7984
8038
  const ahead = Number(git([
7985
8039
  "rev-list",
7986
8040
  "--count",
7987
8041
  `${start}..${branch}`
7988
8042
  ]) || "0");
7989
- if (ahead > 0) rows.push(row$28("first commit", "skip", `${branch} already has ${ahead} commit${ahead === 1 ? "" : "s"}`));
8043
+ if (ahead > 0) rows.push(row$30("first commit", "skip", `${branch} already has ${ahead} commit${ahead === 1 ? "" : "s"}`));
7990
8044
  else {
7991
8045
  const trailer = `Refs ${workReference(key)}`;
7992
8046
  if (spec) {
@@ -7997,7 +8051,7 @@ async function runStartWork(input) {
7997
8051
  spec.rel
7998
8052
  ], dir);
7999
8053
  const status = /^status:\s*(\S+)/m.exec(io.read(spec.abs))?.[1];
8000
- if (status && status !== "draft") rows.push(row$28("spec", "skip", `the spec's status is ${status}, not draft`));
8054
+ if (status && status !== "draft") rows.push(row$30("spec", "skip", `the spec's status is ${status}, not draft`));
8001
8055
  }
8002
8056
  io.git([
8003
8057
  "commit",
@@ -8008,7 +8062,7 @@ async function runStartWork(input) {
8008
8062
  "-m",
8009
8063
  trailer
8010
8064
  ], dir);
8011
- rows.push(row$28("first commit", "ok", `${io.git([
8065
+ rows.push(row$30("first commit", "ok", `${io.git([
8012
8066
  "rev-parse",
8013
8067
  "--short",
8014
8068
  "HEAD"
@@ -8020,9 +8074,9 @@ async function runStartWork(input) {
8020
8074
  "origin",
8021
8075
  branch
8022
8076
  ], dir);
8023
- rows.push(row$28("push", "ok", `${branch} is on origin`));
8077
+ rows.push(row$30("push", "ok", `${branch} is on origin`));
8024
8078
  } catch (err) {
8025
- rows.push(row$28("git", "fail", `${describeError(err)}; nothing was deleted, run the command again to carry on`));
8079
+ rows.push(row$30("git", "fail", `${describeError(err)}; nothing was deleted, run the command again to carry on`));
8026
8080
  return finish();
8027
8081
  }
8028
8082
  if (source) try {
@@ -8038,7 +8092,7 @@ async function runStartWork(input) {
8038
8092
  ...input.templatesIo ? { templatesIo: input.templatesIo } : {}
8039
8093
  });
8040
8094
  issueBoards = read.boards;
8041
- if (read.problem) rows.push(row$28("boards", "skip", `the pull request is not put on the issue's boards: ${read.problem}`));
8095
+ if (read.problem) rows.push(row$30("boards", "skip", `the pull request is not put on the issue's boards: ${read.problem}`));
8042
8096
  }
8043
8097
  const projects = [.../* @__PURE__ */ new Set([...issueBoards, ...input.project ? [input.project] : []])];
8044
8098
  const mirrored = {
@@ -8070,12 +8124,12 @@ async function runStartWork(input) {
8070
8124
  created: result.created
8071
8125
  }
8072
8126
  };
8073
- rows.push(row$28("pull request", "ok", `${result.created ? "opened" : "already open:"} #${pr.number}${result.draft ? " (draft)" : ""} ${pr.url}`));
8074
- for (const line of result.dropped) rows.push(row$28("not carried across", "skip", line));
8127
+ rows.push(row$30("pull request", "ok", `${result.created ? "opened" : "already open:"} #${pr.number}${result.draft ? " (draft)" : ""} ${pr.url}`));
8128
+ for (const line of result.dropped) rows.push(row$30("not carried across", "skip", line));
8075
8129
  } catch (err) {
8076
- rows.push(row$28("pull request", "fail", `could not open the pull request: ${describeError(err)}; run the command again to open it`));
8130
+ rows.push(row$30("pull request", "fail", `could not open the pull request: ${describeError(err)}; run the command again to open it`));
8077
8131
  }
8078
- rows.push(row$28("board status", "skip", "not set: the open pull request moves the issue to In Progress; `update work --status` sets it by hand while the automation is down"));
8132
+ rows.push(row$30("board status", "skip", "not set: the open pull request moves the issue to In Progress; `update work --status` sets it by hand while the automation is down"));
8079
8133
  return finish();
8080
8134
  }
8081
8135
  // src/commands/update-work/guard-work-status/guard-work-status.ts
@@ -8123,7 +8177,7 @@ function guardWorkStatus(status, force) {
8123
8177
  * terminal it refuses). `--dry-run` runs the reads and writes nothing. A run with nothing to change still syncs the
8124
8178
  * area labels.
8125
8179
  */
8126
- const row$27 = (id, status, detail) => ({
8180
+ const row$29 = (id, status, detail) => ({
8127
8181
  id,
8128
8182
  title: id,
8129
8183
  status,
@@ -8157,7 +8211,7 @@ async function runUpdateWork(input) {
8157
8211
  };
8158
8212
  };
8159
8213
  const fail = (id, detail) => {
8160
- rows.push(row$27(id, "fail", detail));
8214
+ rows.push(row$29(id, "fail", detail));
8161
8215
  return finish();
8162
8216
  };
8163
8217
  print(style.header(`Holocron update work${dryRun ? " (dry-run)" : ""}`));
@@ -8246,7 +8300,7 @@ async function runUpdateWork(input) {
8246
8300
  title: `start: ${r.title}`
8247
8301
  });
8248
8302
  if (started.status === "fail") {
8249
- rows.push(row$27("update work", "skip", "start work failed, so nothing after it was run"));
8303
+ rows.push(row$29("update work", "skip", "start work failed, so nothing after it was run"));
8250
8304
  return finish();
8251
8305
  }
8252
8306
  }
@@ -8258,10 +8312,10 @@ async function runUpdateWork(input) {
8258
8312
  } else if (source.listPullRequests) {
8259
8313
  const found = findWorkPullRequests(await source.listPullRequests("open"), key);
8260
8314
  pr = found[0];
8261
- if (found.length > 1) rows.push(row$27("pull request", "skip", `${found.length} open pull requests match ${key}; using #${pr?.number} (--pr names another)`));
8315
+ if (found.length > 1) rows.push(row$29("pull request", "skip", `${found.length} open pull requests match ${key}; using #${pr?.number} (--pr names another)`));
8262
8316
  }
8263
8317
  } catch (err) {
8264
- rows.push(row$27("pull request", "fail", `could not find the pull request: ${describeError(err)}`));
8318
+ rows.push(row$29("pull request", "fail", `could not find the pull request: ${describeError(err)}`));
8265
8319
  return finish();
8266
8320
  }
8267
8321
  if (pr) {
@@ -8272,24 +8326,24 @@ async function runUpdateWork(input) {
8272
8326
  url: pr.url
8273
8327
  }
8274
8328
  };
8275
- rows.push(row$27("pull request", "ok", `#${pr.number} ${pr.title}`));
8329
+ rows.push(row$29("pull request", "ok", `#${pr.number} ${pr.title}`));
8276
8330
  } else {
8277
8331
  const detail = `no open pull request for ${key} (its branch is <type>/<issue>-<slug>; --pr names one, --start makes one)`;
8278
- rows.push(row$27("pull request", title ? "fail" : "skip", title ? `${detail}; --title needs one` : detail));
8332
+ rows.push(row$29("pull request", title ? "fail" : "skip", title ? `${detail}; --title needs one` : detail));
8279
8333
  }
8280
8334
  let derived = [];
8281
- if (!pr) rows.push(row$27("area labels", "skip", "no pull request to read the changed folders of"));
8282
- else if (!areas || Object.keys(areas).length === 0) rows.push(row$27("area labels", "skip", "the repo declares no `repo.labels.areas`"));
8283
- else if (!source.listPullRequestFiles) rows.push(row$27("area labels", "skip", `the \`${source.providerName}\` provider cannot list a pull request's files`));
8335
+ if (!pr) rows.push(row$29("area labels", "skip", "no pull request to read the changed folders of"));
8336
+ else if (!areas || Object.keys(areas).length === 0) rows.push(row$29("area labels", "skip", "the repo declares no `repo.labels.areas`"));
8337
+ else if (!source.listPullRequestFiles) rows.push(row$29("area labels", "skip", `the \`${source.providerName}\` provider cannot list a pull request's files`));
8284
8338
  else try {
8285
8339
  derived = areaLabelsForFiles(await source.listPullRequestFiles(pr.number), areas);
8286
8340
  report = {
8287
8341
  ...report,
8288
8342
  areaLabels: derived
8289
8343
  };
8290
- rows.push(row$27("area labels", derived.length > 0 ? "ok" : "skip", derived.length > 0 ? derived.join(", ") : "the changed folders are in no area"));
8344
+ rows.push(row$29("area labels", derived.length > 0 ? "ok" : "skip", derived.length > 0 ? derived.join(", ") : "the changed folders are in no area"));
8291
8345
  } catch (err) {
8292
- rows.push(row$27("area labels", "fail", `could not read the changed files: ${describeError(err)}`));
8346
+ rows.push(row$29("area labels", "fail", `could not read the changed files: ${describeError(err)}`));
8293
8347
  }
8294
8348
  let missingOnIssue = derived;
8295
8349
  if (derived.length > 0 && issues.export) try {
@@ -8326,7 +8380,7 @@ async function runUpdateWork(input) {
8326
8380
  id: `issue: ${r.id}`,
8327
8381
  title: `issue: ${r.title}`
8328
8382
  });
8329
- } else rows.push(row$27("issue", "skip", "no issue field to change"));
8383
+ } else rows.push(row$29("issue", "skip", "no issue field to change"));
8330
8384
  if (pr) {
8331
8385
  const prLabels = unique([...addLabels, ...derived]);
8332
8386
  const patch = {
@@ -8345,15 +8399,15 @@ async function runUpdateWork(input) {
8345
8399
  ...milestone ? [`milestone ${milestone}`] : [],
8346
8400
  ...input.project ? [`board ${input.project}`] : []
8347
8401
  ];
8348
- if (parts.length === 0) rows.push(row$27(`pull request #${pr.number}`, "skip", "no field to change"));
8349
- else if (!source.updatePullRequest) rows.push(row$27(`pull request #${pr.number}`, "fail", `the \`${source.providerName}\` provider cannot update a pull request`));
8350
- else if (dryRun) rows.push(row$27(`pull request #${pr.number}`, "skip", `would update ${parts.join("; ")}`));
8402
+ if (parts.length === 0) rows.push(row$29(`pull request #${pr.number}`, "skip", "no field to change"));
8403
+ else if (!source.updatePullRequest) rows.push(row$29(`pull request #${pr.number}`, "fail", `the \`${source.providerName}\` provider cannot update a pull request`));
8404
+ else if (dryRun) rows.push(row$29(`pull request #${pr.number}`, "skip", `would update ${parts.join("; ")}`));
8351
8405
  else try {
8352
8406
  const result = await source.updatePullRequest(pr.number, patch);
8353
- rows.push(row$27(`pull request #${pr.number}`, "ok", `updated ${parts.join("; ")}`));
8354
- for (const line of result.dropped) rows.push(row$27("not carried across", "skip", line));
8407
+ rows.push(row$29(`pull request #${pr.number}`, "ok", `updated ${parts.join("; ")}`));
8408
+ for (const line of result.dropped) rows.push(row$29("not carried across", "skip", line));
8355
8409
  } catch (err) {
8356
- rows.push(row$27(`pull request #${pr.number}`, "fail", `could not update the pull request: ${describeError(err)}`));
8410
+ rows.push(row$29(`pull request #${pr.number}`, "fail", `could not update the pull request: ${describeError(err)}`));
8357
8411
  }
8358
8412
  }
8359
8413
  if (status) {
@@ -8369,11 +8423,11 @@ async function runUpdateWork(input) {
8369
8423
  ...input.board ? { board: input.board } : {}
8370
8424
  });
8371
8425
  const change = set.key && set.to ? `${set.key} ${set.from ?? "no status"} → ${set.to}` : `${key} → ${status}`;
8372
- rows.push(set.status === "ok" ? row$27("board status", dryRun ? "skip" : "ok", dryRun ? `would set ${change}` : change) : row$27("board status", "fail", sub.lines.map((l) => l.trim()).filter(Boolean).join("; ") || "could not set the status"));
8426
+ rows.push(set.status === "ok" ? row$29("board status", dryRun ? "skip" : "ok", dryRun ? `would set ${change}` : change) : row$29("board status", "fail", sub.lines.map((l) => l.trim()).filter(Boolean).join("; ") || "could not set the status"));
8373
8427
  } catch (err) {
8374
- rows.push(row$27("board status", "fail", describeError(err)));
8428
+ rows.push(row$29("board status", "fail", describeError(err)));
8375
8429
  }
8376
- rows.push(row$27("board status is temporary", "skip", guard?.ok && guard.forced ? "forced: the automation owns this status and overwrites it once it runs again (#2388)" : "the board's rules overwrite a hand-set status once the pull request moves it (#2388)"));
8430
+ rows.push(row$29("board status is temporary", "skip", guard?.ok && guard.forced ? "forced: the automation owns this status and overwrites it once it runs again (#2388)" : "the board's rules overwrite a hand-set status once the pull request moves it (#2388)"));
8377
8431
  }
8378
8432
  return finish();
8379
8433
  }
@@ -8392,7 +8446,7 @@ function findClosedWorkPullRequests(prs, issue) {
8392
8446
  return [...matching.filter((pr) => pr.merged), ...matching.filter((pr) => !pr.merged)];
8393
8447
  }
8394
8448
  // src/commands/close-work/release-closed-blockers/release-closed-blockers.ts
8395
- const row$26 = (id, status, detail) => ({
8449
+ const row$28 = (id, status, detail) => ({
8396
8450
  id,
8397
8451
  title: id,
8398
8452
  status,
@@ -8406,16 +8460,16 @@ const row$26 = (id, status, detail) => ({
8406
8460
  */
8407
8461
  async function releaseClosedBlockers(input) {
8408
8462
  const { issues, key } = input;
8409
- if (!issues.export) return [row$26("relations", "skip", `the \`${issues.providerName}\` provider cannot read blockers`)];
8463
+ if (!issues.export) return [row$28("relations", "skip", `the \`${issues.providerName}\` provider cannot read blockers`)];
8410
8464
  try {
8411
8465
  const blockers = (await issues.export({ keys: [key] }))[0]?.blockedBy ?? [];
8412
- if (blockers.length === 0) return [row$26("relations", "skip", `${key} has no blockers`)];
8466
+ if (blockers.length === 0) return [row$28("relations", "skip", `${key} has no blockers`)];
8413
8467
  const closed = (await issues.export({ keys: blockers })).filter((r) => r.closed).map((r) => r.key);
8414
- if (closed.length === 0) return [row$26("relations", "skip", `${blockers.length} blocker${blockers.length === 1 ? "" : "s"} still open: ${blockers.join(", ")}`)];
8468
+ if (closed.length === 0) return [row$28("relations", "skip", `${blockers.length} blocker${blockers.length === 1 ? "" : "s"} still open: ${blockers.join(", ")}`)];
8415
8469
  const done = await input.unblock(closed);
8416
- return [row$26("relations", done.status === "fail" ? "fail" : "ok", `closed ${closed.length === 1 ? "blocker" : "blockers"} ${closed.join(", ")} taken off ${key}`), ...done.rows.filter((r) => r.status === "fail")];
8470
+ return [row$28("relations", done.status === "fail" ? "fail" : "ok", `closed ${closed.length === 1 ? "blocker" : "blockers"} ${closed.join(", ")} taken off ${key}`), ...done.rows.filter((r) => r.status === "fail")];
8417
8471
  } catch (err) {
8418
- return [row$26("relations", "fail", `could not update the blockers: ${describeError(err)}`)];
8472
+ return [row$28("relations", "fail", `could not update the blockers: ${describeError(err)}`)];
8419
8473
  }
8420
8474
  }
8421
8475
  // src/commands/close-work/wait-for-checks/wait-for-checks.ts
@@ -8952,8 +9006,8 @@ async function withdrawSpecs(loaded, context, files) {
8952
9006
  const DEFAULT_TIMEOUT_MINUTES = 30;
8953
9007
  const DEFAULT_INTERVAL_MS = 3e4;
8954
9008
  /** How many failing checks a row names. */
8955
- const MAX_NAMED = 8;
8956
- const row$25 = (id, status, detail) => ({
9009
+ const MAX_NAMED$1 = 8;
9010
+ const row$27 = (id, status, detail) => ({
8957
9011
  id,
8958
9012
  title: id,
8959
9013
  status,
@@ -8978,7 +9032,7 @@ async function runCloseWork(input) {
8978
9032
  };
8979
9033
  };
8980
9034
  const fail = (id, detail) => {
8981
- rows.push(row$25(id, "fail", detail));
9035
+ rows.push(row$27(id, "fail", detail));
8982
9036
  return finish();
8983
9037
  };
8984
9038
  print(style.header(`Holocron close work${input.abandon ? " --abandon" : ""}${dryRun ? " (dry-run)" : ""}`));
@@ -9026,7 +9080,7 @@ async function runCloseWork(input) {
9026
9080
  if (!source.listPullRequests) throw new Error(`the \`${source.providerName}\` provider cannot list pull requests`);
9027
9081
  const open = findWorkPullRequests(await source.listPullRequests("open"), key);
9028
9082
  pr = open[0];
9029
- if (open.length > 1) rows.push(row$25("pull request", "skip", `${open.length} open pull requests match ${key}; using #${pr?.number} (--pr names another)`));
9083
+ if (open.length > 1) rows.push(row$27("pull request", "skip", `${open.length} open pull requests match ${key}; using #${pr?.number} (--pr names another)`));
9030
9084
  if (!pr && !input.abandon) pr = findClosedWorkPullRequests(await source.listPullRequests("closed"), key)[0];
9031
9085
  }
9032
9086
  } catch (err) {
@@ -9064,10 +9118,10 @@ async function runCloseWork(input) {
9064
9118
  const repoRoot = input.context.repoRoot;
9065
9119
  if (pr.state === "closed") {
9066
9120
  if (!pr.merged) {
9067
- rows.push(row$25("pull request", "skip", `#${pr.number} was closed without merging; \`close work ${key} --abandon\` tidies its branch and spec`));
9121
+ rows.push(row$27("pull request", "skip", `#${pr.number} was closed without merging; \`close work ${key} --abandon\` tidies its branch and spec`));
9068
9122
  return finish();
9069
9123
  }
9070
- rows.push(row$25("pull request", "ok", `#${pr.number} merged: ${pr.title}`));
9124
+ rows.push(row$27("pull request", "ok", `#${pr.number} merged: ${pr.title}`));
9071
9125
  if (!dryRun && !input.yes && !await ask(`Remove the worktree and local branch of ${pr.branch}?`)) {
9072
9126
  print(` ${style.skip("cancelled; nothing was changed")}`);
9073
9127
  return {
@@ -9086,7 +9140,7 @@ async function runCloseWork(input) {
9086
9140
  }));
9087
9141
  return finish();
9088
9142
  }
9089
- rows.push(row$25("pull request", "ok", `#${pr.number} ${pr.title}`));
9143
+ rows.push(row$27("pull request", "ok", `#${pr.number} ${pr.title}`));
9090
9144
  if (!source.getPullRequestChecks) return fail("ci / Required checks", `the \`${source.providerName}\` provider cannot read a pull request's checks`);
9091
9145
  const readChecks = source.getPullRequestChecks.bind(source);
9092
9146
  const number = pr.number;
@@ -9107,12 +9161,12 @@ async function runCloseWork(input) {
9107
9161
  }
9108
9162
  const { checks } = result;
9109
9163
  if (checks.state !== "success") {
9110
- const failing = checks.failing.slice(0, MAX_NAMED).map((c) => c.url ? `${c.name} (${c.url})` : c.name);
9164
+ const failing = checks.failing.slice(0, MAX_NAMED$1).map((c) => c.url ? `${c.name} (${c.url})` : c.name);
9111
9165
  const more = checks.failing.length - failing.length;
9112
9166
  const named = failing.length > 0 ? `: ${failing.join(", ")}${more > 0 ? `, and ${more} more` : ""}` : "";
9113
9167
  return fail("ci / Required checks", `${checks.state === "failure" ? `is red${named}` : result.timedOut ? `is still ${checks.state} after ${minutes} minute${minutes === 1 ? "" : "s"}` : `is ${checks.state === "none" ? "not posted yet" : "still running"}; --wait polls until it is green`}. #${number} was not marked ready; run \`close work ${key}\` again once it is green`);
9114
9168
  }
9115
- rows.push(row$25("ci / Required checks", "ok", `green${checks.sha ? ` on ${checks.sha.slice(0, 7)}` : ""}`));
9169
+ rows.push(row$27("ci / Required checks", "ok", `green${checks.sha ? ` on ${checks.sha.slice(0, 7)}` : ""}`));
9116
9170
  if (!dryRun && !input.yes) {
9117
9171
  if (!await ask(`${key} is green. ${`Mark #${number} ready, update the area labels and take closed blockers off ${key}`}?`)) {
9118
9172
  print(` ${style.skip("cancelled; nothing was changed")}`);
@@ -9122,13 +9176,13 @@ async function runCloseWork(input) {
9122
9176
  };
9123
9177
  }
9124
9178
  }
9125
- if (!source.markReady) rows.push(row$25("ready", "fail", `the \`${source.providerName}\` provider cannot mark a pull request ready`));
9126
- else if (dryRun) rows.push(row$25("ready", "skip", `would mark #${number} ready if it is a draft`));
9179
+ if (!source.markReady) rows.push(row$27("ready", "fail", `the \`${source.providerName}\` provider cannot mark a pull request ready`));
9180
+ else if (dryRun) rows.push(row$27("ready", "skip", `would mark #${number} ready if it is a draft`));
9127
9181
  else try {
9128
9182
  const changed = await source.markReady(number);
9129
- rows.push(row$25("ready", "ok", changed ? `#${number} is ready for review; the board moves to In Review by itself. The maintainer merges, \`close work ${key}\` again after that clears the checkout` : `#${number} was already ready; the maintainer merges`));
9183
+ rows.push(row$27("ready", "ok", changed ? `#${number} is ready for review; the board moves to In Review by itself. The maintainer merges, \`close work ${key}\` again after that clears the checkout` : `#${number} was already ready; the maintainer merges`));
9130
9184
  } catch (err) {
9131
- rows.push(row$25("ready", "fail", `could not mark #${number} ready: ${describeError(err)}`));
9185
+ rows.push(row$27("ready", "fail", `could not mark #${number} ready: ${describeError(err)}`));
9132
9186
  }
9133
9187
  try {
9134
9188
  const updated = await (input.updateWork ?? runUpdateWork)({
@@ -9146,7 +9200,7 @@ async function runCloseWork(input) {
9146
9200
  title: `labels: ${r.title}`
9147
9201
  });
9148
9202
  } catch (err) {
9149
- rows.push(row$25("labels", "fail", `could not update the area labels: ${describeError(err)}`));
9203
+ rows.push(row$27("labels", "fail", `could not update the area labels: ${describeError(err)}`));
9150
9204
  }
9151
9205
  rows.push(...await releaseClosedBlockers({
9152
9206
  issues,
@@ -10669,9 +10723,19 @@ const byId = (ids) => new Map(ids.map((id) => [id, id]));
10669
10723
  * stale. A skip when the repo has no aggregate caller, which only the repo that hosts the reusables writes today. The
10670
10724
  * ruleset that requires the aggregate is `doctor repo`'s to compare, not this row's.
10671
10725
  */
10672
- function aggregateRow(callers, derived) {
10726
+ function aggregateRow(callers, derived, poster = "actions") {
10673
10727
  const id = "aggregate";
10674
10728
  const title = "ci aggregate lists the configured tasks";
10729
+ if (poster === "sentinel") {
10730
+ const left = callers.find((caller) => caller.file === "ci.ci.yml" || caller.file === "ci.yml");
10731
+ return left === void 0 ? {
10732
+ id,
10733
+ title,
10734
+ status: "ok",
10735
+ detail: `Sentinel posts the aggregate (ci.aggregate); its expected list derives from the config (${derived.length} ids)`,
10736
+ problems: []
10737
+ } : problemRow(id, title, [`${left.file} is still there, but ci.aggregate says Sentinel posts the check: two posters`], "");
10738
+ }
10675
10739
  const aggregate = callers.find((caller) => (caller.file === "ci.ci.yml" || caller.file === "ci.yml") && caller.expected !== void 0);
10676
10740
  if (aggregate === void 0) return {
10677
10741
  id,
@@ -10866,6 +10930,129 @@ function realCiIo(repoRoot) {
10866
10930
  } };
10867
10931
  /* v8 ignore stop */
10868
10932
  }
10933
+ // src/commands/doctor-ci/shadow-verdict.ts
10934
+ /**
10935
+ * The verdict of the newest run named `name` among a commit's check runs: still running is `pending`, a completed
10936
+ * `success` is `success` and any other completed result is `failure`. The newest is the one with the latest start and,
10937
+ * on a tie, the higher id, the rule the aggregate itself follows. `undefined` when nothing posted under the name.
10938
+ */
10939
+ function shadowVerdict(runs, name) {
10940
+ const newest = runs.filter((run) => run.name === name).sort((a, b) => (b.startedAt ?? "").localeCompare(a.startedAt ?? "") || Number(b.id) - Number(a.id))[0];
10941
+ if (newest === void 0) return void 0;
10942
+ if (newest.status !== "completed") return "pending";
10943
+ return newest.conclusion === "success" ? "success" : "failure";
10944
+ }
10945
+ // src/commands/doctor-ci/read-shadow-samples.ts
10946
+ /** The name Sentinel's shadow posts under; the same string as Sentinel's `SENTINEL_CI_AGGREGATE_SHADOW_NAME`. */
10947
+ const SHADOW_CHECK_NAME = `${AGGREGATE_CHECK_NAME} (sentinel)`;
10948
+ /**
10949
+ * The two aggregate verdicts of the newest pull requests, newest first: the open ones and the merged ones (a pull
10950
+ * request closed without merging has no verdict worth comparing), at most `limit` of them. Each is read from the check
10951
+ * runs of the pull request's head commit through the `source` provider.
10952
+ */
10953
+ async function readShadowSamples(source, limit = 40) {
10954
+ const [open, closed] = await Promise.all([source.listPullRequests("open"), source.listPullRequests("closed")]);
10955
+ const newest = [...open, ...closed.filter((pr) => pr.merged)].filter((pr) => pr.headSha !== void 0).sort((a, b) => b.number - a.number).slice(0, limit);
10956
+ const samples = [];
10957
+ for (const pr of newest) {
10958
+ const runs = await source.listCheckRuns(pr.headSha);
10959
+ const actions = shadowVerdict(runs, AGGREGATE_CHECK_NAME);
10960
+ const sentinel = shadowVerdict(runs, SHADOW_CHECK_NAME);
10961
+ samples.push({
10962
+ number: pr.number,
10963
+ ...actions === void 0 ? {} : { actions },
10964
+ ...sentinel === void 0 ? {} : { sentinel }
10965
+ });
10966
+ }
10967
+ return samples;
10968
+ }
10969
+ // src/commands/doctor-ci/shadow-row.ts
10970
+ const ID$7 = "shadow";
10971
+ const TITLE$7 = "Sentinel's ci shadow agrees with the Actions aggregate";
10972
+ /**
10973
+ * The `shadow` row (SPEC-0099, phase 4): do `ci / Required checks (sentinel)` and `ci / Required checks` say the same on
10974
+ * the same commit? `samples` are the newest pull requests first. A pull request is **decided** when both posted and
10975
+ * neither is still `pending`; one the shadow never posted on (it predates it) and one still running are left out, since
10976
+ * neither says the two disagree. Any decided pull request where they differ fails the row and is named. With none, the
10977
+ * row is a skip. Otherwise it counts the newest pull requests in a row that agree and passes at
10978
+ * {@link SHADOW_AGREEMENT_TARGET}, and is a skip (not a failure) below it: the shadow is still being watched. The spec
10979
+ * also asks that the agreeing set include a re-run of one leaf, a cancelled first batch, a late status, a skipped leaf and
10980
+ * a missing id; that is read by a person, not here.
10981
+ */
10982
+ function shadowRow$1(samples, target = 20) {
10983
+ const decided = samples.filter((sample) => sample.actions !== void 0 && sample.sentinel !== void 0 && sample.actions !== "pending" && sample.sentinel !== "pending");
10984
+ if (decided.length === 0) return {
10985
+ id: ID$7,
10986
+ title: TITLE$7,
10987
+ status: "skip",
10988
+ detail: "no pull request has a finished verdict from both the Actions aggregate and the shadow yet",
10989
+ problems: []
10990
+ };
10991
+ const disagreements = decided.filter((sample) => sample.actions !== sample.sentinel);
10992
+ if (disagreements.length > 0) return {
10993
+ id: ID$7,
10994
+ title: TITLE$7,
10995
+ status: "fail",
10996
+ detail: `${disagreements.length} of ${decided.length} decided pull requests disagree`,
10997
+ problems: disagreements.map((s) => `#${s.number}: Actions said ${s.actions}, the shadow said ${s.sentinel}`)
10998
+ };
10999
+ const consecutive = decided.length;
11000
+ return consecutive >= target ? {
11001
+ id: ID$7,
11002
+ title: TITLE$7,
11003
+ status: "ok",
11004
+ detail: `${consecutive} consecutive pull requests agree (target ${target})`,
11005
+ problems: []
11006
+ } : {
11007
+ id: ID$7,
11008
+ title: TITLE$7,
11009
+ status: "skip",
11010
+ detail: `${consecutive} of ${target} consecutive pull requests agree so far`,
11011
+ problems: []
11012
+ };
11013
+ }
11014
+ // src/commands/doctor-ci/shadow-rows.ts
11015
+ const fail$1 = (detail) => ({
11016
+ id: "shadow",
11017
+ title: "Sentinel's ci shadow agrees with the Actions aggregate",
11018
+ status: "fail",
11019
+ detail,
11020
+ problems: []
11021
+ });
11022
+ /**
11023
+ * The `shadow` row for `doctor ci --shadow`: loads only the `source` provider, reads the newest pull requests' two
11024
+ * aggregate verdicts and compares them with {@link shadowRow}. A missing provider, a provider that cannot list check runs
11025
+ * or a read that throws is a failing row with the reason, never a throw.
11026
+ */
11027
+ async function shadowRows(input) {
11028
+ const providers = input.loaded.resolved.providers;
11029
+ if (!providers.source) return [fail$1("the config has no `source` provider to read the check runs with")];
11030
+ /* v8 ignore start -- the real loader is only built outside tests, which always inject one */
11031
+ const loader = input.loader ?? new PluginLoader({
11032
+ ...input.loaded.resolved,
11033
+ providers: {
11034
+ source: providers.source,
11035
+ ...providers.credentials ? { credentials: providers.credentials } : {}
11036
+ }
11037
+ }, input.context);
11038
+ /* v8 ignore stop */
11039
+ try {
11040
+ await loader.load();
11041
+ assertPluginsResolvable(loader, "doctor ci");
11042
+ if (!loader.has("source")) {
11043
+ const failure = loader.loadFailures().find((f) => f.key === "source");
11044
+ return [fail$1(`the \`source\` provider is not available${failure ? ` (${describeError(failure.error)})` : ""}`)];
11045
+ }
11046
+ const source = loader.get("source");
11047
+ if (!source.listPullRequests || !source.listCheckRuns) return [fail$1(`the \`${source.providerName}\` provider cannot list pull requests and check runs`)];
11048
+ return [shadowRow$1(await readShadowSamples({
11049
+ listPullRequests: source.listPullRequests.bind(source),
11050
+ listCheckRuns: source.listCheckRuns.bind(source)
11051
+ }, input.shadowLimit))];
11052
+ } catch (error) {
11053
+ return [fail$1(describeError(error))];
11054
+ }
11055
+ }
10869
11056
  // src/commands/doctor-ci/tasks-row.ts
10870
11057
  /**
10871
11058
  * The `tasks` row: a `tasks:` entry in the config that uses a deprecated alias (an old dotted name, `validate`,
@@ -10897,11 +11084,13 @@ async function runDoctorCi(input) {
10897
11084
  const callers = io.workflows().flatMap(({ file, text }) => parseCaller(file, text) ?? []);
10898
11085
  const tasksConfig = { tasks };
10899
11086
  if (config.extraRequiredChecks) tasksConfig.extraRequiredChecks = config.extraRequiredChecks;
11087
+ if (config.ci) tasksConfig.ci = config.ci;
10900
11088
  const rows = [
10901
11089
  tasksRow(tasks.map((entry) => typeof entry === "string" ? entry : entry.name)),
10902
11090
  callersRow(callers),
10903
- aggregateRow(callers, aggregateChecks(tasksConfig).expected),
10904
- homeRow(callers, input.legacyGate ?? legacyGate())
11091
+ aggregateRow(callers, aggregateChecks(tasksConfig).expected, aggregatePoster(tasksConfig)),
11092
+ homeRow(callers, input.legacyGate ?? legacyGate()),
11093
+ ...input.shadow ? await shadowRows(input) : []
10905
11094
  ];
10906
11095
  printCheckRows(rows, print);
10907
11096
  const summary = summariseChecks(rows);
@@ -10921,12 +11110,27 @@ async function runDoctorCi(input) {
10921
11110
  const doctorCiCommand = {
10922
11111
  command: "ci",
10923
11112
  describe: "Check the repo against the flat task vocabulary: aliases, caller names, the ci aggregate, home (read-only)",
11113
+ builder: (y) => y.option("shadow", {
11114
+ type: "boolean",
11115
+ describe: "Also compare Sentinel's shadow aggregate (ci / Required checks (sentinel)) with the Actions one on the newest pull requests (reads through `source`)"
11116
+ }).option("limit", {
11117
+ type: "number",
11118
+ describe: "With --shadow: how many of the newest pull requests to read (default 40)"
11119
+ }),
10924
11120
  handler: async (argv) => {
11121
+ const tokens = argv.shadow ? tokenContext(argv.token) : {};
11122
+ if (!tokens) return;
10925
11123
  const loaded = await loadConfig(argv.cwd);
10926
11124
  applyResolvedConfig(argv, loaded.resolved);
10927
11125
  if ((await runDoctorCi({
10928
11126
  loaded,
10929
- context: { repoRoot: argv.cwd }
11127
+ context: {
11128
+ repoRoot: argv.cwd,
11129
+ ...tokens,
11130
+ ...argv.shadow ? { org: resolveOrg(argv, loaded.resolved) } : {}
11131
+ },
11132
+ ...argv.shadow ? { shadow: true } : {},
11133
+ ...argv.limit !== void 0 ? { shadowLimit: Number(argv.limit) } : {}
10930
11134
  })).status === "fail") process.exitCode = 1;
10931
11135
  }
10932
11136
  };
@@ -11314,7 +11518,7 @@ async function runDoctorDns(input) {
11314
11518
  });
11315
11519
  else if (!loader.has("dns")) {
11316
11520
  const why = whyMissing(loader, "dns", "no `dns` provider to check them with");
11317
- for (const zone of zones) rows.push(row$24(zone, "skip", why));
11521
+ for (const zone of zones) rows.push(row$26(zone, "skip", why));
11318
11522
  for (const { hostname } of domains) rows.push(domainRow(hostname, "skip", why));
11319
11523
  } else {
11320
11524
  const dns = loader.get("dns");
@@ -11336,7 +11540,7 @@ async function runDoctorDns(input) {
11336
11540
  ...status === "skip" ? { reason: [...new Set(rows.map((r) => r.detail))].join("; ") } : {}
11337
11541
  };
11338
11542
  }
11339
- function row$24(zone, status, detail, problems = []) {
11543
+ function row$26(zone, status, detail, problems = []) {
11340
11544
  return {
11341
11545
  id: `dns-${zone}`,
11342
11546
  title: `${zone} records exist`,
@@ -11365,7 +11569,7 @@ async function checkDomain(dns, deploy, project, hostname) {
11365
11569
  return noToken !== void 0 ? domainRow(hostname, "skip", noToken) : domainRow(hostname, "fail", errorMessage(err));
11366
11570
  }
11367
11571
  }
11368
- async function checkZone(dns, zone, wanted, rowOf = (...args) => row$24(zone, ...args)) {
11572
+ async function checkZone(dns, zone, wanted, rowOf = (...args) => row$26(zone, ...args)) {
11369
11573
  try {
11370
11574
  const have = await dns.listRecords(zone);
11371
11575
  const problems = declaredVsActual(new Map(wanted.map((w) => [keyOf(w), w])), new Map(have.map((h) => [keyOf(h), h])), {
@@ -11484,7 +11688,7 @@ function declaredProjects$1(layouts) {
11484
11688
  return [...new Set(layouts.flatMap((layout) => layout.relay?.errors?.projects ?? []))];
11485
11689
  }
11486
11690
  // src/commands/doctor-errors/errors-rows.ts
11487
- const row$23 = (id, title, status, detail, problems = []) => ({
11691
+ const row$25 = (id, title, status, detail, problems = []) => ({
11488
11692
  id,
11489
11693
  title,
11490
11694
  status,
@@ -11501,27 +11705,27 @@ function errorsRows(found, providerName) {
11501
11705
  const orgSlug = found.org.slug;
11502
11706
  if (!found.org.exists) {
11503
11707
  const problem = `${providerName} has no organization named ${orgSlug}; check the \`org\` option of the \`errors\` provider`;
11504
- const rows = [row$23("errors:org", "organization exists", "fail", `${orgSlug} not found`, [problem])];
11505
- for (const project of found.projects) rows.push(row$23(`errors:project:${project.slug}`, `project ${project.slug} exists`, "skip", "not checked: no organization"));
11708
+ const rows = [row$25("errors:org", "organization exists", "fail", `${orgSlug} not found`, [problem])];
11709
+ for (const project of found.projects) rows.push(row$25(`errors:project:${project.slug}`, `project ${project.slug} exists`, "skip", "not checked: no organization"));
11506
11710
  return rows;
11507
11711
  }
11508
- const rows = [row$23("errors:org", "organization exists", "ok", `${orgSlug} (${found.org.name ?? orgSlug})`)];
11712
+ const rows = [row$25("errors:org", "organization exists", "ok", `${orgSlug} (${found.org.name ?? orgSlug})`)];
11509
11713
  if (found.projects.length === 0) {
11510
- rows.push(row$23("errors:projects", "declared projects", "skip", "none declared: no `relay.errors.projects` in a layout"));
11714
+ rows.push(row$25("errors:projects", "declared projects", "skip", "none declared: no `relay.errors.projects` in a layout"));
11511
11715
  return rows;
11512
11716
  }
11513
11717
  for (const project of found.projects) {
11514
11718
  const slug = project.slug;
11515
11719
  if (!project.exists) {
11516
11720
  const problem = `no project ${slug} in ${found.org.slug}; create it in ${providerName}`;
11517
- rows.push(row$23(`errors:project:${slug}`, `project ${slug} exists`, "fail", "not found", [problem]), row$23(`errors:dsn:${slug}`, `project ${slug} has a key`, "skip", "not checked: no project"), row$23(`errors:alerts:${slug}`, `project ${slug} has an alert rule`, "skip", "not checked: no project"));
11721
+ rows.push(row$25(`errors:project:${slug}`, `project ${slug} exists`, "fail", "not found", [problem]), row$25(`errors:dsn:${slug}`, `project ${slug} has a key`, "skip", "not checked: no project"), row$25(`errors:alerts:${slug}`, `project ${slug} has an alert rule`, "skip", "not checked: no project"));
11518
11722
  continue;
11519
11723
  }
11520
- rows.push(row$23(`errors:project:${slug}`, `project ${slug} exists`, "ok", slug));
11521
- rows.push(project.hasDsn ? row$23(`errors:dsn:${slug}`, `project ${slug} has a key`, "ok", "a client key (DSN) exists") : row$23(`errors:dsn:${slug}`, `project ${slug} has a key`, "fail", "no client key", [`${slug} has no client key, so an SDK has no DSN to send to; add one in ${providerName}`]));
11522
- if (project.alertRules === void 0) rows.push(row$23(`errors:alerts:${slug}`, `project ${slug} has an alert rule`, "skip", found.alertsUnreadable ? `could not read the alert rules: ${found.alertsUnreadable}` : "not read"));
11523
- else if (project.alertRules === 0) rows.push(row$23(`errors:alerts:${slug}`, `project ${slug} has an alert rule`, "fail", "no enabled rule", [`no enabled alert rule watches ${slug}, so its errors reach no one`]));
11524
- else rows.push(row$23(`errors:alerts:${slug}`, `project ${slug} has an alert rule`, "ok", `${project.alertRules} enabled rule(s)`));
11724
+ rows.push(row$25(`errors:project:${slug}`, `project ${slug} exists`, "ok", slug));
11725
+ rows.push(project.hasDsn ? row$25(`errors:dsn:${slug}`, `project ${slug} has a key`, "ok", "a client key (DSN) exists") : row$25(`errors:dsn:${slug}`, `project ${slug} has a key`, "fail", "no client key", [`${slug} has no client key, so an SDK has no DSN to send to; add one in ${providerName}`]));
11726
+ if (project.alertRules === void 0) rows.push(row$25(`errors:alerts:${slug}`, `project ${slug} has an alert rule`, "skip", found.alertsUnreadable ? `could not read the alert rules: ${found.alertsUnreadable}` : "not read"));
11727
+ else if (project.alertRules === 0) rows.push(row$25(`errors:alerts:${slug}`, `project ${slug} has an alert rule`, "fail", "no enabled rule", [`no enabled alert rule watches ${slug}, so its errors reach no one`]));
11728
+ else rows.push(row$25(`errors:alerts:${slug}`, `project ${slug} has an alert rule`, "ok", `${project.alertRules} enabled rule(s)`));
11525
11729
  }
11526
11730
  return rows;
11527
11731
  }
@@ -11624,7 +11828,7 @@ function installationSettingsUrl(account, id) {
11624
11828
  return `https://github.com/settings/installations/${id}`;
11625
11829
  }
11626
11830
  // src/commands/doctor-github-app/app-rows.ts
11627
- const row$22 = (name, what, problems, ok) => ({
11831
+ const row$24 = (name, what, problems, ok) => ({
11628
11832
  id: `${name}:${what}`,
11629
11833
  title: `${name}: ${what}`,
11630
11834
  status: problems.length > 0 ? "fail" : "ok",
@@ -11651,11 +11855,116 @@ function appRows(name, manifest, app, installations) {
11651
11855
  return [`${who} has not accepted the current App: ${gaps.join("; ")}`, `fix: ${who} accepts the update at ${url}`];
11652
11856
  });
11653
11857
  return [
11654
- row$22(name, "events", eventProblems.length > 0 ? [...eventProblems, fix] : [], `all ${manifest.events.length} subscribed${extrasNote("extra event(s)", extraEvents)}`),
11655
- row$22(name, "permissions", permissionProblems.length > 0 ? [...permissionProblems, fix] : [], `all ${Object.keys(manifest.permissions).length} granted${extrasNote("extra permission(s)", extraPermissions)}`),
11656
- row$22(name, "installations", installationProblems, `${installations.length} installation(s) up to date`)
11858
+ row$24(name, "events", eventProblems.length > 0 ? [...eventProblems, fix] : [], `all ${manifest.events.length} subscribed${extrasNote("extra event(s)", extraEvents)}`),
11859
+ row$24(name, "permissions", permissionProblems.length > 0 ? [...permissionProblems, fix] : [], `all ${Object.keys(manifest.permissions).length} granted${extrasNote("extra permission(s)", extraPermissions)}`),
11860
+ row$24(name, "installations", installationProblems, `${installations.length} installation(s) up to date`)
11657
11861
  ];
11658
11862
  }
11863
+ // src/commands/webhook-deliveries/failed-deliveries.ts
11864
+ /** Whether a delivery reached the App's endpoint and was answered with a success (2xx). */
11865
+ const succeeded = (delivery) => delivery.statusCode >= 200 && delivery.statusCode < 300;
11866
+ /**
11867
+ * The deliveries that still need delivering again, oldest first (SPEC-0099, recovery 2). A delivery and its
11868
+ * redeliveries share one GUID, so each GUID is judged by its **latest** attempt: a first attempt that failed and was
11869
+ * redelivered successfully is done, and one whose latest redelivery failed too is returned once, as that attempt, never
11870
+ * once per attempt. A delivery that got no answer at all (`statusCode` `0`) has failed.
11871
+ */
11872
+ function failedDeliveries(deliveries) {
11873
+ const latest = /* @__PURE__ */ new Map();
11874
+ for (const delivery of deliveries) {
11875
+ const seen = latest.get(delivery.guid);
11876
+ if (seen === void 0 || delivery.deliveredAt > seen.deliveredAt) latest.set(delivery.guid, delivery);
11877
+ }
11878
+ return [...latest.values()].filter((delivery) => !succeeded(delivery)).sort((a, b) => a.deliveredAt.localeCompare(b.deliveredAt) || a.id - b.id);
11879
+ }
11880
+ // src/commands/doctor-github-app/read-app-credentials.ts
11881
+ /** The names the App's credentials are kept under, Sentinel's own first and the bare ones an older Environment has (#1864). */
11882
+ const APP_ID = ["SENTINEL_GITHUB_APP_ID", "GITHUB_APP_ID"];
11883
+ const PRIVATE_KEY = ["SENTINEL_GITHUB_APP_PRIVATE_KEY", "GITHUB_APP_PRIVATE_KEY"];
11884
+ /** The first of `names` the environment holds a value for. */
11885
+ function held(values, names) {
11886
+ return names.map((name) => values[name]).find((value) => value?.trim());
11887
+ }
11888
+ /** An error's message with the secrets it was handed taken out, so nothing read from the vault is ever printed. */
11889
+ function scrubbed$1(err, secrets) {
11890
+ return secrets.filter(Boolean).reduce((text, secret) => text.split(secret).join("[redacted]"), errorMessage(err));
11891
+ }
11892
+ /**
11893
+ * The App's id and key from its vault environment, read in memory and never printed or written, or the reason they cannot
11894
+ * be had (no `vault` provider, an environment that cannot be read, a name it does not hold). Shared by `doctor github-app`
11895
+ * and `redeliver webhooks`, which both call the App's own endpoints with its JWT.
11896
+ */
11897
+ async function readAppCredentials(instance, loader) {
11898
+ const vault = loader.has("vault") ? loader.get("vault") : void 0;
11899
+ if (!vault?.readEnvironment) return { reason: vault ? `${vault.providerName} cannot read an environment's variables` : "needs a `vault` provider in holocron.config.ts (1password)" };
11900
+ const environment = resolvedEnvironment(instance);
11901
+ let values;
11902
+ try {
11903
+ values = await vault.readEnvironment(environment);
11904
+ } catch (err) {
11905
+ return { reason: `cannot read the "${environment}" environment: ${errorMessage(err)}` };
11906
+ }
11907
+ const appId = held(values, APP_ID);
11908
+ const key = held(values, PRIVATE_KEY);
11909
+ const missing = [appId ? void 0 : APP_ID, key ? void 0 : PRIVATE_KEY].filter((names) => names !== void 0);
11910
+ if (missing.length > 0) return { reason: `"${environment}" does not hold ${missing.map(([preferred, older]) => `${preferred} (or ${older})`).join(" or ")}` };
11911
+ const privateKey = key.includes("\n") ? key : key.replace(/\\n/g, "\n");
11912
+ return { creds: {
11913
+ appId: appId.trim(),
11914
+ privateKey
11915
+ } };
11916
+ }
11917
+ // src/commands/doctor-github-app/delivery-row.ts
11918
+ const DAY_MS$1 = 864e5;
11919
+ /** The most failed deliveries a row names; the rest are counted. */
11920
+ const MAX_NAMED = 10;
11921
+ /**
11922
+ * The `deliveries` row of one App instance (SPEC-0099, signal 3): how many webhook deliveries in the last day failed and
11923
+ * have not been delivered again successfully. A failing row names the oldest ones and ends with the command that repairs
11924
+ * them. A delivery log that cannot be read (an API without the call, a refusal) is a skip with the reason, never a failure
11925
+ * of the check.
11926
+ */
11927
+ async function deliveryRow(name, creds, api, now, secrets) {
11928
+ const id = `${name}:deliveries`;
11929
+ const title = `${name}: deliveries`;
11930
+ if (!api.listAppDeliveries) return {
11931
+ id,
11932
+ title,
11933
+ status: "skip",
11934
+ detail: "the delivery log is not read here",
11935
+ problems: []
11936
+ };
11937
+ let failed;
11938
+ try {
11939
+ failed = failedDeliveries(await api.listAppDeliveries(creds, { since: (/* @__PURE__ */ new Date(now - DAY_MS$1)).toISOString() }));
11940
+ } catch (err) {
11941
+ return {
11942
+ id,
11943
+ title,
11944
+ status: "skip",
11945
+ detail: `cannot read the delivery log: ${scrubbed$1(err, secrets)}`,
11946
+ problems: []
11947
+ };
11948
+ }
11949
+ if (failed.length === 0) return {
11950
+ id,
11951
+ title,
11952
+ status: "ok",
11953
+ detail: "no failed webhook deliveries in the last day",
11954
+ problems: []
11955
+ };
11956
+ const named = failed.slice(0, MAX_NAMED).map((d) => {
11957
+ return `${d.action === null ? d.event : `${d.event}.${d.action}`}, ${d.status || `status ${d.statusCode}`}, ${d.deliveredAt}`;
11958
+ });
11959
+ const more = failed.length > MAX_NAMED ? [`and ${failed.length - MAX_NAMED} more`] : [];
11960
+ return {
11961
+ id,
11962
+ title,
11963
+ status: "fail",
11964
+ detail: `${failed.length} failed webhook deliver${failed.length === 1 ? "y" : "ies"} in the last day; repair with \`holocron redeliver webhooks --app ${name}\``,
11965
+ problems: [...named, ...more]
11966
+ };
11967
+ }
11659
11968
  // src/commands/doctor-github-app/parse-manifest.ts
11660
11969
  const LEVELS = [
11661
11970
  "read",
@@ -11686,20 +11995,15 @@ function parseManifest(text) {
11686
11995
  * memory (never printed, never written), signs the App's own JWT and calls `GET /app` and `GET /app/installations`.
11687
11996
  * Rows per instance: reachable; events (every manifest event is subscribed); permissions (each manifest permission is
11688
11997
  * granted at least at its level, `read < write < admin`); installations (none lags the App, which is a pending
11689
- * update an owner has not accepted). Extras on the App are named in a row's detail as `info`, never a failure. A row
11998
+ * update an owner has not accepted); deliveries (no webhook delivery of the last day failed and stayed failed, SPEC-0099;
11999
+ * a log that cannot be read is a skip). Extras on the App are named in a row's detail as `info`, never a failure. A row
11690
12000
  * that fails ends with the settings page that fixes it. An instance whose credentials cannot be read is a skip with
11691
12001
  * the reason; an unreadable manifest, a rejected JWT or a gap is a failure.
11692
12002
  */
11693
- /** The names the App's credentials are kept under, Sentinel's own first and the bare ones an older Environment has (#1864). */
11694
- const APP_ID = ["SENTINEL_GITHUB_APP_ID", "GITHUB_APP_ID"];
11695
- const PRIVATE_KEY = ["SENTINEL_GITHUB_APP_PRIVATE_KEY", "GITHUB_APP_PRIVATE_KEY"];
11696
- /** The first of `names` the environment holds a value for. */
11697
- function held(values, names) {
11698
- return names.map((name) => values[name]).find((value) => value?.trim());
11699
- }
11700
- const defaultApi = {
12003
+ const defaultApi$1 = {
11701
12004
  getApp,
11702
- listAppInstallations
12005
+ listAppInstallations,
12006
+ listAppDeliveries
11703
12007
  };
11704
12008
  async function runDoctorGitHubApp(input) {
11705
12009
  const print = input.print ?? ((line) => console.log(line));
@@ -11711,7 +12015,7 @@ async function runDoctorGitHubApp(input) {
11711
12015
  assertPluginsResolvable(loader, "doctor github-app");
11712
12016
  }
11713
12017
  const rows = [];
11714
- if (instances.length === 0) rows.push(row$21("github-app", "reachable", "skip", "no `githubApps` are declared in holocron.config.ts"));
12018
+ if (instances.length === 0) rows.push(row$23("github-app", "reachable", "skip", "no `githubApps` are declared in holocron.config.ts"));
11715
12019
  for (const instance of instances) rows.push(...await checkInstance(instance, loader, input));
11716
12020
  printCheckRows(rows, print);
11717
12021
  const summary = summariseChecks(rows);
@@ -11728,7 +12032,7 @@ async function runDoctorGitHubApp(input) {
11728
12032
  ...status === "skip" ? { reason: [...new Set(rows.map((r) => r.detail))].join("; ") } : {}
11729
12033
  };
11730
12034
  }
11731
- function row$21(name, what, status, detail) {
12035
+ function row$23(name, what, status, detail) {
11732
12036
  return {
11733
12037
  id: `${name}:${what}`,
11734
12038
  title: `${name}: ${what}`,
@@ -11737,31 +12041,6 @@ function row$21(name, what, status, detail) {
11737
12041
  problems: []
11738
12042
  };
11739
12043
  }
11740
- /** An error's message with the secrets it was handed taken out, so nothing read from the vault is ever printed. */
11741
- function scrubbed$1(err, secrets) {
11742
- return secrets.filter(Boolean).reduce((text, secret) => text.split(secret).join("[redacted]"), errorMessage(err));
11743
- }
11744
- /** The App's id and key from its vault environment, or the reason they cannot be had. */
11745
- async function readCredentials(instance, loader) {
11746
- const vault = loader.has("vault") ? loader.get("vault") : void 0;
11747
- if (!vault?.readEnvironment) return { reason: vault ? `${vault.providerName} cannot read an environment's variables` : "needs a `vault` provider in holocron.config.ts (1password)" };
11748
- const environment = resolvedEnvironment(instance);
11749
- let values;
11750
- try {
11751
- values = await vault.readEnvironment(environment);
11752
- } catch (err) {
11753
- return { reason: `cannot read the "${environment}" environment: ${errorMessage(err)}` };
11754
- }
11755
- const appId = held(values, APP_ID);
11756
- const key = held(values, PRIVATE_KEY);
11757
- const missing = [appId ? void 0 : APP_ID, key ? void 0 : PRIVATE_KEY].filter((names) => names !== void 0);
11758
- if (missing.length > 0) return { reason: `"${environment}" does not hold ${missing.map(([preferred, older]) => `${preferred} (or ${older})`).join(" or ")}` };
11759
- const privateKey = key.includes("\n") ? key : key.replace(/\\n/g, "\n");
11760
- return { creds: {
11761
- appId: appId.trim(),
11762
- privateKey
11763
- } };
11764
- }
11765
12044
  async function checkInstance(instance, loader, input) {
11766
12045
  const { name } = instance;
11767
12046
  const readManifest = input.readManifest ?? ((path) => readFileSync(join(input.context.repoRoot, path), "utf8"));
@@ -11769,19 +12048,23 @@ async function checkInstance(instance, loader, input) {
11769
12048
  try {
11770
12049
  manifest = parseManifest(readManifest(instance.manifest));
11771
12050
  } catch (err) {
11772
- return [row$21(name, "manifest", "fail", `cannot read ${instance.manifest}: ${errorMessage(err)}`)];
12051
+ return [row$23(name, "manifest", "fail", `cannot read ${instance.manifest}: ${errorMessage(err)}`)];
11773
12052
  }
11774
- const read = await readCredentials(instance, loader);
11775
- if ("reason" in read) return [row$21(name, "reachable", "skip", read.reason)];
11776
- const api = input.api ?? defaultApi;
12053
+ const read = await readAppCredentials(instance, loader);
12054
+ if ("reason" in read) return [row$23(name, "reachable", "skip", read.reason)];
12055
+ const api = input.api ?? defaultApi$1;
11777
12056
  const secrets = [read.creds.privateKey];
11778
12057
  try {
11779
12058
  const app = await api.getApp(read.creds);
11780
12059
  const installations = await api.listAppInstallations(read.creds);
11781
12060
  const owner = app.owner ? `, owned by ${app.owner.login}` : "";
11782
- return [row$21(name, "reachable", "ok", `${app.slug}${owner}, settings: ${appSettingsUrl(app)}`), ...appRows(name, manifest, app, installations)];
12061
+ return [
12062
+ row$23(name, "reachable", "ok", `${app.slug}${owner}, settings: ${appSettingsUrl(app)}`),
12063
+ ...appRows(name, manifest, app, installations),
12064
+ await deliveryRow(name, read.creds, api, (input.now ?? Date.now)(), secrets)
12065
+ ];
11783
12066
  } catch (err) {
11784
- return [row$21(name, "reachable", "fail", `cannot call GitHub as the App: ${scrubbed$1(err, secrets)}`)];
12067
+ return [row$23(name, "reachable", "fail", `cannot call GitHub as the App: ${scrubbed$1(err, secrets)}`)];
11785
12068
  }
11786
12069
  }
11787
12070
  // src/commands/doctor-github-app/doctor-github-app.command.ts
@@ -11848,7 +12131,7 @@ function datasetTargets(config) {
11848
12131
  * dataset, shared by every environment in it). Only a dataset the provider says is missing, or a token it refuses, fails;
11849
12132
  * 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.
11850
12133
  */
11851
- const row$20 = (id, title, status, detail, problems = []) => ({
12134
+ const row$22 = (id, title, status, detail, problems = []) => ({
11852
12135
  id,
11853
12136
  title,
11854
12137
  status,
@@ -11865,7 +12148,7 @@ async function runDoctorLogs(input) {
11865
12148
  if (!loader.has("logs")) {
11866
12149
  const failure = loader.loadFailures().find((f) => f.key === "logs");
11867
12150
  const why = failure ? `\`${failure.provider}\` failed to load: ${describeError(failure.error)}` : "no `logs` provider is configured in holocron.config.ts";
11868
- rows.push(row$20("logs", "logs", "skip", why));
12151
+ rows.push(row$22("logs", "logs", "skip", why));
11869
12152
  } else rows.push(...await checkLogs(loader.get("logs"), datasetTargets(input.loaded.resolved)));
11870
12153
  printCheckRows(rows, print);
11871
12154
  const summary = summariseChecks(rows);
@@ -11889,38 +12172,38 @@ async function checkLogs(logs, targets) {
11889
12172
  for (const target of targets) {
11890
12173
  const id = `logs:dataset:${target.id}`;
11891
12174
  const title = `dataset for ${target.label}`;
11892
- if (!target.name) rows.push(row$20(id, title, "skip", `${target.variable} is not set here, so there is no name to look for`));
11893
- else if (!token.usable) rows.push(row$20(id, title, "skip", `${target.name}: not checked, the token is not usable`));
11894
- else if (!logs.readDataset) rows.push(row$20(id, title, "skip", `${logs.providerName} cannot read a dataset`));
12175
+ if (!target.name) rows.push(row$22(id, title, "skip", `${target.variable} is not set here, so there is no name to look for`));
12176
+ else if (!token.usable) rows.push(row$22(id, title, "skip", `${target.name}: not checked, the token is not usable`));
12177
+ else if (!logs.readDataset) rows.push(row$22(id, title, "skip", `${logs.providerName} cannot read a dataset`));
11895
12178
  else rows.push(...await checkDataset(logs, target, target.name, id, title));
11896
12179
  }
11897
12180
  const org = resolveValue$1(["AXIOM_ORG"], void 0, { prefix: PREFIX$1 });
11898
- rows.push(org ? row$20("logs:org", "organization", "ok", `${PREFIX$1}_AXIOM_ORG (or AXIOM_ORG) is set`) : row$20("logs:org", "organization", "skip", `${PREFIX$1}_AXIOM_ORG (or AXIOM_ORG) is not set here; Sentinel's log links need it`));
12181
+ rows.push(org ? row$22("logs:org", "organization", "ok", `${PREFIX$1}_AXIOM_ORG (or AXIOM_ORG) is set`) : row$22("logs:org", "organization", "skip", `${PREFIX$1}_AXIOM_ORG (or AXIOM_ORG) is not set here; Sentinel's log links need it`));
11899
12182
  return rows;
11900
12183
  }
11901
12184
  /** Whether the provider accepts the token. `usable` is false when it was refused or could not be tried. */
11902
12185
  async function checkToken$1(logs, dataset) {
11903
12186
  const title = "token is accepted";
11904
12187
  if (!logs.checkToken) return {
11905
- row: row$20("logs:token", title, "skip", `${logs.providerName} cannot check a token`),
12188
+ row: row$22("logs:token", title, "skip", `${logs.providerName} cannot check a token`),
11906
12189
  usable: true
11907
12190
  };
11908
12191
  try {
11909
12192
  const result = await logs.checkToken(dataset);
11910
12193
  if (result.ok) return {
11911
- row: row$20("logs:token", title, "ok", `${logs.providerName} accepts the token`),
12194
+ row: row$22("logs:token", title, "ok", `${logs.providerName} accepts the token`),
11912
12195
  usable: true
11913
12196
  };
11914
12197
  const reason = result.reason ?? `${logs.providerName} refused the token`;
11915
12198
  return {
11916
- row: row$20("logs:token", title, "fail", reason, [reason]),
12199
+ row: row$22("logs:token", title, "fail", reason, [reason]),
11917
12200
  usable: false
11918
12201
  };
11919
12202
  } catch (err) {
11920
12203
  const noToken = missingTokenReason(err);
11921
12204
  const detail = noToken ?? `could not check the token: ${describeError(err)}`;
11922
12205
  return {
11923
- row: row$20("logs:token", title, "skip", detail),
12206
+ row: row$22("logs:token", title, "skip", detail),
11924
12207
  usable: noToken === void 0
11925
12208
  };
11926
12209
  }
@@ -11930,17 +12213,17 @@ async function checkDataset(logs, target, name, id, title) {
11930
12213
  const found = await logs.readDataset(name);
11931
12214
  if (found.forbidden) {
11932
12215
  const why = `${name}: not visible to this token (${logs.providerName} refused the read; it may also not exist)`;
11933
- return [row$20(id, title, "skip", why)];
12216
+ return [row$22(id, title, "skip", why)];
11934
12217
  }
11935
12218
  if (!found.exists) {
11936
12219
  const problem = `dataset ${name} does not exist (${target.variable}); ${target.fix}`;
11937
- return [row$20(id, title, "fail", `${name} does not exist`, [problem])];
12220
+ return [row$22(id, title, "fail", `${name} does not exist`, [problem])];
11938
12221
  }
11939
12222
  const retention = found.retentionDays === void 0 ? `retention: ${logs.providerName} did not report one for ${name}` : `retention: ${found.retentionDays} days for ${name}`;
11940
- return [row$20(id, title, "ok", `${name} exists`), row$20(`logs:retention:${target.id}`, `retention of ${name}`, "skip", `info: ${retention}; one setting shared by every environment in the dataset (ADR-0019)`)];
12223
+ return [row$22(id, title, "ok", `${name} exists`), row$22(`logs:retention:${target.id}`, `retention of ${name}`, "skip", `info: ${retention}; one setting shared by every environment in the dataset (ADR-0019)`)];
11941
12224
  } catch (err) {
11942
12225
  const detail = missingTokenReason(err) ?? `could not read ${name}: ${describeError(err)}`;
11943
- return [row$20(id, title, "skip", detail)];
12226
+ return [row$22(id, title, "skip", detail)];
11944
12227
  }
11945
12228
  }
11946
12229
  // src/commands/doctor-logs/doctor-logs.command.ts
@@ -15523,7 +15806,7 @@ const info = (id, title, noun, extras) => ({
15523
15806
  detail: `info: ${extras.length} ${noun} not in the template (never deleted)`,
15524
15807
  problems: extras
15525
15808
  });
15526
- const row$19 = (id, title, problems, ok) => ({
15809
+ const row$21 = (id, title, problems, ok) => ({
15527
15810
  id,
15528
15811
  title,
15529
15812
  status: problems.length > 0 ? "fail" : "ok",
@@ -15559,19 +15842,19 @@ function viewProblems(want, found) {
15559
15842
  function boardRows(boardName, template, state) {
15560
15843
  const id = `project:${boardName}`;
15561
15844
  const rows = [];
15562
- rows.push(row$19(`${id}:statuses`, `${boardName}: statuses`, listProblems("status", "statuses", template.statuses.map((s) => s.name), state.statuses), `${template.statuses.length} in order`));
15845
+ rows.push(row$21(`${id}:statuses`, `${boardName}: statuses`, listProblems("status", "statuses", template.statuses.map((s) => s.name), state.statuses), `${template.statuses.length} in order`));
15563
15846
  const extraStatuses = state.statuses.filter((s) => !template.statuses.some((t) => t.name === s));
15564
15847
  if (extraStatuses.length > 0) rows.push(info(`${id}:extra-statuses`, `${boardName}: extra statuses`, "status(es)", extraStatuses));
15565
- for (const want of template.fields) rows.push(row$19(`${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));
15848
+ for (const want of template.fields) rows.push(row$21(`${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));
15566
15849
  const extraFields = state.fields.filter((f) => !template.fields.some((t) => t.name === f.name));
15567
15850
  if (extraFields.length > 0) rows.push(info(`${id}:extra-fields`, `${boardName}: extra fields`, "field(s)", extraFields.map((f) => f.name)));
15568
- for (const want of template.views) rows.push(row$19(`${id}:view:${want.name}`, `${boardName}: view ${want.name}`, viewProblems(want, state.views.find((v) => v.name === want.name)), `${want.layout}${want.filter ? `, ${want.filter}` : ""}`));
15851
+ for (const want of template.views) rows.push(row$21(`${id}:view:${want.name}`, `${boardName}: view ${want.name}`, viewProblems(want, state.views.find((v) => v.name === want.name)), `${want.layout}${want.filter ? `, ${want.filter}` : ""}`));
15569
15852
  const extraViews = state.views.filter((v) => !template.views.some((t) => t.name === v.name));
15570
15853
  if (extraViews.length > 0) rows.push(info(`${id}:extra-views`, `${boardName}: extra views`, "view(s)", extraViews.map((v) => v.name)));
15571
15854
  for (const name of template.rules ?? []) {
15572
15855
  const found = state.rules.find((r) => r.name === name);
15573
15856
  const problems = !found ? [`missing rule ${name}`] : found.enabled ? [] : [`rule ${name} is off`];
15574
- rows.push(row$19(`${id}:rule:${name}`, `${boardName}: rule ${name}`, problems, "on"));
15857
+ rows.push(row$21(`${id}:rule:${name}`, `${boardName}: rule ${name}`, problems, "on"));
15575
15858
  }
15576
15859
  return rows;
15577
15860
  }
@@ -15631,7 +15914,7 @@ function itemRows(boardName, items) {
15631
15914
  * never fail the run. A template file that does not read is a failure naming the file. `--post [channel]` shares the
15632
15915
  * failing rows through the `notifications` provider's bot, like `doctor notifications --post`.
15633
15916
  */
15634
- const row$18 = (id, title, status, detail, problems = []) => ({
15917
+ const row$20 = (id, title, status, detail, problems = []) => ({
15635
15918
  id,
15636
15919
  title,
15637
15920
  status,
@@ -15685,14 +15968,14 @@ async function checkBoards(input, loader) {
15685
15968
  loader,
15686
15969
  ...input.io ? { io: input.io } : {}
15687
15970
  });
15688
- if (!opened.ok) return [row$18("project", "project", opened.kind, opened.reason, opened.problems)];
15971
+ if (!opened.ok) return [row$20("project", "project", opened.kind, opened.reason, opened.problems)];
15689
15972
  const { projects, owner, boards, templates, templateProblems } = opened.context;
15690
15973
  const rows = templateProblems.map((problem) => {
15691
15974
  /* v8 ignore next -- split always returns at least one element; the fallback only satisfies noUncheckedIndexedAccess */
15692
15975
  const file = problem.split(": ")[0] ?? problem;
15693
- return row$18(`project:template:${file}`, `template file ${file}`, "fail", problem);
15976
+ return row$20(`project:template:${file}`, `template file ${file}`, "fail", problem);
15694
15977
  });
15695
- if (boards.length === 0) return [...rows, row$18("project", "project", "skip", "no boards are declared in `providers.projects.boards`")];
15978
+ if (boards.length === 0) return [...rows, row$20("project", "project", "skip", "no boards are declared in `providers.projects.boards`")];
15696
15979
  for (const declared of boards) {
15697
15980
  const template = templates[declared.template];
15698
15981
  const title = `${declared.name}: board exists and is open`;
@@ -15700,18 +15983,18 @@ async function checkBoards(input, loader) {
15700
15983
  const board = await projects.find(owner, declared.name);
15701
15984
  if (!board) {
15702
15985
  const closed = (await projects.list(owner)).some((b) => b.name === declared.name && b.closed);
15703
- rows.push(row$18(`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`"]));
15986
+ rows.push(row$20(`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`"]));
15704
15987
  continue;
15705
15988
  }
15706
- rows.push(row$18(`project:${declared.name}`, title, "ok", board.url));
15989
+ rows.push(row$20(`project:${declared.name}`, title, "ok", board.url));
15707
15990
  if (!template) {
15708
- rows.push(row$18(`project:${declared.name}:template`, `${declared.name}: template ${declared.template}`, "fail", "no built-in or file template has this name"));
15991
+ rows.push(row$20(`project:${declared.name}:template`, `${declared.name}: template ${declared.template}`, "fail", "no built-in or file template has this name"));
15709
15992
  continue;
15710
15993
  }
15711
15994
  rows.push(...boardRows(declared.name, template, await projects.read(owner, board)));
15712
- rows.push(...projects.items ? itemRows(declared.name, await projects.items(owner, board, template)) : [row$18(`project:${declared.name}:items`, `${declared.name}: items`, "skip", "the provider cannot list a board's items")]);
15995
+ rows.push(...projects.items ? itemRows(declared.name, await projects.items(owner, board, template)) : [row$20(`project:${declared.name}:items`, `${declared.name}: items`, "skip", "the provider cannot list a board's items")]);
15713
15996
  } catch (err) {
15714
- rows.push(row$18(`project:${declared.name}`, title, "fail", describeError(err)));
15997
+ rows.push(row$20(`project:${declared.name}`, title, "fail", describeError(err)));
15715
15998
  }
15716
15999
  }
15717
16000
  return rows;
@@ -16065,6 +16348,21 @@ async function issueTypesRow(declared, issues, whyNoIssues) {
16065
16348
  problems: []
16066
16349
  };
16067
16350
  }
16351
+ // src/commands/aggregate-pin/aggregate-pin.ts
16352
+ /**
16353
+ * Reads `ci.pin` against the repo's derived required checks. Off (no pin, `problem` unset) when the option is not set;
16354
+ * only the `ci / Required checks` context is ever pinned, never the other required checks. When the option is set but
16355
+ * that context is not required (a repo on the legacy gate, or a preset that requires nothing), nothing is pinned and
16356
+ * `problem` says why, so neither `setup` nor `doctor repo` pretends the pin is in place.
16357
+ */
16358
+ function aggregatePin(ci, requiredChecks) {
16359
+ if (ci?.pin === void 0) return { pins: {} };
16360
+ if (!requiredChecks.includes(AGGREGATE_CHECK)) return {
16361
+ pins: {},
16362
+ problem: `ci.pin is set but ${AGGREGATE_CHECK} is not a required check of this repo`
16363
+ };
16364
+ return { pins: { [AGGREGATE_CHECK]: ci.pin.integrationId } };
16365
+ }
16068
16366
  // src/commands/repo-files/hosted-reusables.ts
16069
16367
  /** The name of the private package that holds the reusable workflows and composite actions. */
16070
16368
  const CI_PACKAGE = "@theholocron/ci";
@@ -16119,7 +16417,11 @@ function buildClassicProtectionPayload(requiredChecks = []) {
16119
16417
  allow_deletions: false
16120
16418
  };
16121
16419
  }
16122
- function buildRulesetPayload(requiredChecks = []) {
16420
+ /**
16421
+ * The ruleset `setup` writes. `pins` maps a required context to the integration id of the one GitHub App whose check
16422
+ * may satisfy it (written as `integration_id` on that entry); a context with no entry may be satisfied by any app.
16423
+ */
16424
+ function buildRulesetPayload(requiredChecks = [], pins = {}) {
16123
16425
  const rules = [
16124
16426
  { type: "deletion" },
16125
16427
  { type: "non_fast_forward" },
@@ -16138,7 +16440,10 @@ function buildRulesetPayload(requiredChecks = []) {
16138
16440
  if (requiredChecks.length > 0) rules.push({
16139
16441
  type: "required_status_checks",
16140
16442
  parameters: {
16141
- required_status_checks: requiredChecks.map((context) => ({ context })),
16443
+ required_status_checks: requiredChecks.map((context) => pins[context] === void 0 ? { context } : {
16444
+ context,
16445
+ integration_id: pins[context]
16446
+ }),
16142
16447
  strict_required_status_checks_policy: false
16143
16448
  }
16144
16449
  });
@@ -16158,7 +16463,7 @@ function buildRulesetPayload(requiredChecks = []) {
16158
16463
  rules
16159
16464
  };
16160
16465
  }
16161
- async function upsertBranchProtection(source, dryRun, requiredChecks) {
16466
+ async function upsertBranchProtection(source, dryRun, requiredChecks, pins = {}) {
16162
16467
  const step = `upsert ruleset ${RULESET_NAME}`;
16163
16468
  if (dryRun) return {
16164
16469
  capability: "source",
@@ -16168,7 +16473,7 @@ async function upsertBranchProtection(source, dryRun, requiredChecks) {
16168
16473
  try {
16169
16474
  const found = (await source.listRulesets()).find((r) => r.name === RULESET_NAME);
16170
16475
  if (found) {
16171
- await source.updateRuleset(found.id, buildRulesetPayload(requiredChecks));
16476
+ await source.updateRuleset(found.id, buildRulesetPayload(requiredChecks, pins));
16172
16477
  return {
16173
16478
  capability: "source",
16174
16479
  step,
@@ -16176,7 +16481,7 @@ async function upsertBranchProtection(source, dryRun, requiredChecks) {
16176
16481
  message: "updated"
16177
16482
  };
16178
16483
  }
16179
- await source.createRuleset(buildRulesetPayload(requiredChecks));
16484
+ await source.createRuleset(buildRulesetPayload(requiredChecks, pins));
16180
16485
  return {
16181
16486
  capability: "source",
16182
16487
  step,
@@ -16426,6 +16731,22 @@ const BALANCED_REPO_SETTINGS = {
16426
16731
  has_projects: true,
16427
16732
  has_wiki: false
16428
16733
  };
16734
+ // src/commands/doctor-repo/pinned-sources.ts
16735
+ /**
16736
+ * Compares the app each required context is pinned to with the declared pins: one line per declared pin the ruleset
16737
+ * lacks or sets to another app, and one per pin the ruleset holds that nothing declares (the option was turned off or
16738
+ * the id changed). Empty when they match. Ids are the integration ids of GitHub Apps, never credentials.
16739
+ */
16740
+ function comparePinnedSources(declared, found) {
16741
+ const problems = [];
16742
+ for (const [context, id] of Object.entries(declared)) {
16743
+ const actual = found[context];
16744
+ if (actual === void 0) problems.push(`${context} is not pinned (declared app ${id}; any app may satisfy it)`);
16745
+ else if (actual !== id) problems.push(`${context} is pinned to app ${actual}, declared app ${id}`);
16746
+ }
16747
+ for (const [context, id] of Object.entries(found)) if (declared[context] === void 0) problems.push(`${context} is pinned to app ${id} but ci.pin does not declare it`);
16748
+ return problems;
16749
+ }
16429
16750
  // src/commands/doctor-repo/required-contexts.ts
16430
16751
  /**
16431
16752
  * Compares the ruleset's required status-check contexts with the ones `requiredChecks()` (from
@@ -16653,6 +16974,33 @@ function repoChecks(config, repoRoot, statusContexts) {
16653
16974
  };
16654
16975
  }
16655
16976
  });
16977
+ if (preset === "strict") checks.push({
16978
+ id: "repo-ci-pin",
16979
+ title: "ci / Required checks is pinned to the declared app",
16980
+ needs: "getRulesetDetail",
16981
+ async run(source) {
16982
+ const plan = aggregatePin(config.ci, strictChecks(config, repoRoot, statusContexts));
16983
+ if (plan.problem) return {
16984
+ problems: [plan.problem],
16985
+ checked: 1
16986
+ };
16987
+ let rulesets;
16988
+ try {
16989
+ rulesets = await source.listRulesets();
16990
+ } catch (err) {
16991
+ if (err instanceof ProviderApiError && err.status === 403) return { skip: "rulesets are not available on this plan" };
16992
+ throw err;
16993
+ }
16994
+ const found = rulesets.find((r) => r.name === RULESET_NAME);
16995
+ if (!found) return { skip: `no ruleset ${RULESET_NAME} (see repo-protection)` };
16996
+ const actual = (await source.getRulesetDetail(found.id)).requiredCheckSources ?? {};
16997
+ if (Object.keys(plan.pins).length === 0 && Object.keys(actual).length === 0) return { skip: "not pinned: ci.pin is off, so any app may satisfy ci / Required checks" };
16998
+ return {
16999
+ problems: comparePinnedSources(plan.pins, actual),
17000
+ checked: Math.max(Object.keys(plan.pins).length, 1)
17001
+ };
17002
+ }
17003
+ });
16656
17004
  checks.push({
16657
17005
  id: "repo-security",
16658
17006
  title: "security settings match",
@@ -16732,19 +17080,19 @@ async function runDoctorRepo(input) {
16732
17080
  const rows = [];
16733
17081
  if (!loader.has("source")) {
16734
17082
  const why = whyMissing(loader, "source", "no `source` provider to read the repository with");
16735
- for (const check of checks) rows.push(row$17(check, { skip: why }));
17083
+ for (const check of checks) rows.push(row$19(check, { skip: why }));
16736
17084
  } else {
16737
17085
  const source = loader.get("source");
16738
17086
  for (const check of checks) {
16739
17087
  if (typeof source[check.needs] !== "function") {
16740
- rows.push(row$17(check, { skip: `provider does not implement ${check.needs}` }));
17088
+ rows.push(row$19(check, { skip: `provider does not implement ${check.needs}` }));
16741
17089
  continue;
16742
17090
  }
16743
17091
  try {
16744
- rows.push(row$17(check, await check.run(source)));
17092
+ rows.push(row$19(check, await check.run(source)));
16745
17093
  } catch (err) {
16746
17094
  const noToken = missingTokenReason(err);
16747
- if (noToken !== void 0) rows.push(row$17(check, { skip: noToken }));
17095
+ if (noToken !== void 0) rows.push(row$19(check, { skip: noToken }));
16748
17096
  else rows.push({
16749
17097
  id: check.id,
16750
17098
  title: check.title,
@@ -16771,7 +17119,7 @@ async function runDoctorRepo(input) {
16771
17119
  ...status === "skip" ? { reason: rows.map((r) => r.detail).join("; ") } : {}
16772
17120
  };
16773
17121
  }
16774
- function row$17(check, result) {
17122
+ function row$19(check, result) {
16775
17123
  const { id, title } = check;
16776
17124
  if ("skip" in result) return {
16777
17125
  id,
@@ -17295,7 +17643,7 @@ function providerGroup(providerName) {
17295
17643
  }
17296
17644
  // src/commands/doctor-secrets/credentials-rows.ts
17297
17645
  /** A row for the provider as a whole, or for one of its variables when `name` is given. */
17298
- function row$16(provider, status, detail, name) {
17646
+ function row$18(provider, status, detail, name) {
17299
17647
  return name === void 0 ? {
17300
17648
  id: provider,
17301
17649
  title: provider,
@@ -17320,10 +17668,10 @@ async function credentialsRows(input) {
17320
17668
  const { loader } = input;
17321
17669
  const { resolved } = input.loaded;
17322
17670
  if (!resolved.providers.credentials) return {
17323
- rows: input.asked ? [row$16("credentials", "skip", "no `credentials` provider is configured")] : [],
17671
+ rows: input.asked ? [row$18("credentials", "skip", "no `credentials` provider is configured")] : [],
17324
17672
  places: []
17325
17673
  };
17326
- const rows = loader.loadFailures().filter((f) => f.key === "credentials").map((f) => row$16(f.provider, "fail", `failed to load: ${errorMessage(f.error)}`));
17674
+ const rows = loader.loadFailures().filter((f) => f.key === "credentials").map((f) => row$18(f.provider, "fail", `failed to load: ${errorMessage(f.error)}`));
17327
17675
  const places = [];
17328
17676
  if (!loader.has("credentials")) return {
17329
17677
  rows,
@@ -17335,7 +17683,7 @@ async function credentialsRows(input) {
17335
17683
  const tuple = tuples.find((t) => t.provider === impl.providerName);
17336
17684
  const explicit = tuple && credentialsEnvironment(tuple, resolved);
17337
17685
  if (!explicit && !derivesEnvironment(impl.providerName)) {
17338
- rows.push(row$16(impl.providerName, "skip", "no `environment` option and `credentials.environment` is not set"));
17686
+ rows.push(row$18(impl.providerName, "skip", "no `environment` option and `credentials.environment` is not set"));
17339
17687
  continue;
17340
17688
  }
17341
17689
  try {
@@ -17347,7 +17695,7 @@ async function credentialsRows(input) {
17347
17695
  rows.push(...checked.rows);
17348
17696
  places.push(...checked.places);
17349
17697
  } catch (err) {
17350
- rows.push(row$16(impl.providerName, "fail", errorMessage(err)));
17698
+ rows.push(row$18(impl.providerName, "fail", errorMessage(err)));
17351
17699
  }
17352
17700
  }
17353
17701
  return {
@@ -17363,17 +17711,17 @@ async function credentialsRows(input) {
17363
17711
  async function checkProvider(impl, candidates, expected, synced) {
17364
17712
  const provider = impl.providerName;
17365
17713
  if (!impl.inspect) return {
17366
- rows: [row$16(provider, "skip", "cannot list the variables without reading their values")],
17714
+ rows: [row$18(provider, "skip", "cannot list the variables without reading their values")],
17367
17715
  places: []
17368
17716
  };
17369
17717
  if (expected.length === 0) return {
17370
- rows: [row$16(provider, "skip", "no configured plugin lists the tokens it takes")],
17718
+ rows: [row$18(provider, "skip", "no configured plugin lists the tokens it takes")],
17371
17719
  places: []
17372
17720
  };
17373
17721
  const inspect = impl.inspect.bind(impl);
17374
17722
  try {
17375
17723
  const { found, missing } = await tryEnvironments(candidates, inspect);
17376
- const rows = missing.map((name) => row$16(provider, "fail", `${provider} has no Environment named "${name}"`));
17724
+ const rows = missing.map((name) => row$18(provider, "fail", `${provider} has no Environment named "${name}"`));
17377
17725
  const group = providerGroup(provider);
17378
17726
  const unreadPlaces = missing.map((name) => ({
17379
17727
  column: {
@@ -17396,9 +17744,9 @@ async function checkProvider(impl, candidates, expected, synced) {
17396
17744
  const have = (name) => found.some((f) => f.result.names.includes(name));
17397
17745
  let present = 0;
17398
17746
  for (const { name, optional } of expected) if (have(name)) present++;
17399
- else if (optional) rows.push(row$16(provider, "skip", `optional, not set in ${where}`, name));
17400
- else rows.push(row$16(provider, "fail", `missing from ${where}`, name));
17401
- if (present > 0) rows.push(row$16(provider, "ok", `${present} of ${expected.length} tokens present in ${where}`, "tokens"));
17747
+ else if (optional) rows.push(row$18(provider, "skip", `optional, not set in ${where}`, name));
17748
+ else rows.push(row$18(provider, "fail", `missing from ${where}`, name));
17749
+ if (present > 0) rows.push(row$18(provider, "ok", `${present} of ${expected.length} tokens present in ${where}`, "tokens"));
17402
17750
  const names = new Set(expected.map((e) => e.name));
17403
17751
  const places = [];
17404
17752
  const missingRequired = expected.filter((e) => !e.optional && !have(e.name)).map((e) => e.name);
@@ -17437,7 +17785,7 @@ async function checkProvider(impl, candidates, expected, synced) {
17437
17785
  };
17438
17786
  } catch (err) {
17439
17787
  return {
17440
- rows: [row$16(provider, "fail", errorMessage(err))],
17788
+ rows: [row$18(provider, "fail", errorMessage(err))],
17441
17789
  places: []
17442
17790
  };
17443
17791
  }
@@ -18311,7 +18659,7 @@ async function variableRows(loader, config, org) {
18311
18659
  if (!loader.has("source")) {
18312
18660
  const why = whyMissing(loader, "source", "no `source` provider to read them with");
18313
18661
  for (const check of checks) {
18314
- rows.push(row$15(check, { skip: why }));
18662
+ rows.push(row$17(check, { skip: why }));
18315
18663
  observations.push({
18316
18664
  scope: check.scope,
18317
18665
  unread: why
@@ -18321,7 +18669,7 @@ async function variableRows(loader, config, org) {
18321
18669
  const source = loader.get("source");
18322
18670
  for (const check of checks) try {
18323
18671
  const result = await check.run(source);
18324
- rows.push(row$15(check, result));
18672
+ rows.push(row$17(check, result));
18325
18673
  observations.push("skip" in result ? {
18326
18674
  scope: check.scope,
18327
18675
  unread: result.skip
@@ -18332,7 +18680,7 @@ async function variableRows(loader, config, org) {
18332
18680
  } catch (err) {
18333
18681
  const noToken = missingTokenReason(err);
18334
18682
  if (noToken !== void 0) {
18335
- rows.push(row$15(check, { skip: noToken }));
18683
+ rows.push(row$17(check, { skip: noToken }));
18336
18684
  observations.push({
18337
18685
  scope: check.scope,
18338
18686
  unread: noToken
@@ -18358,7 +18706,7 @@ async function variableRows(loader, config, org) {
18358
18706
  observations
18359
18707
  };
18360
18708
  }
18361
- function row$15(check, result) {
18709
+ function row$17(check, result) {
18362
18710
  const { id, title } = check;
18363
18711
  if ("skip" in result) return {
18364
18712
  id,
@@ -18448,7 +18796,7 @@ function describeExpiry(expiresAt, now) {
18448
18796
  *
18449
18797
  * What a token may do is not checked: GitHub does not return a fine-grained token's permissions.
18450
18798
  */
18451
- function row$14(id, status, detail) {
18799
+ function row$16(id, status, detail) {
18452
18800
  return {
18453
18801
  id: `verify:${id}`,
18454
18802
  title: `verify ${id}`,
@@ -18476,12 +18824,12 @@ async function verifyRows(input) {
18476
18824
  try {
18477
18825
  module = await importer(pkg);
18478
18826
  } catch (err) {
18479
- rows.push(row$14(pkg, "skip", `cannot load the plugin: ${errorMessage(err)}`));
18827
+ rows.push(row$16(pkg, "skip", `cannot load the plugin: ${errorMessage(err)}`));
18480
18828
  continue;
18481
18829
  }
18482
18830
  for (const token of module.tokens ?? []) rows.push(await checkToken(token, module, env, readToken, now()));
18483
18831
  }
18484
- if (rows.length === 0) rows.push(row$14("tokens", "skip", "no configured plugin lists the tokens it takes"));
18832
+ if (rows.length === 0) rows.push(row$16("tokens", "skip", "no configured plugin lists the tokens it takes"));
18485
18833
  return rows;
18486
18834
  }
18487
18835
  /**
@@ -18494,30 +18842,30 @@ async function loadCredentials(input) {
18494
18842
  try {
18495
18843
  await input.loader.load();
18496
18844
  } catch (err) {
18497
- return [row$14("credentials", "skip", `could not load the credentials providers: ${errorMessage(err)}`)];
18845
+ return [row$16("credentials", "skip", `could not load the credentials providers: ${errorMessage(err)}`)];
18498
18846
  }
18499
- return input.loader.loadFailures().filter((failure) => failure.key === "credentials").map((failure) => row$14(`credentials ${failure.provider}`, "fail", `could not be read: ${errorMessage(failure.error)}`));
18847
+ return input.loader.loadFailures().filter((failure) => failure.key === "credentials").map((failure) => row$16(`credentials ${failure.provider}`, "fail", `could not be read: ${errorMessage(failure.error)}`));
18500
18848
  }
18501
18849
  async function checkToken(token, module, env, readToken, now) {
18502
18850
  const { keyringKey, envName, vendorEnvName } = token;
18503
18851
  const fromEnv = env.get(envName) ? envName : vendorEnvName && env.get(vendorEnvName) ? vendorEnvName : void 0;
18504
18852
  const stored = fromEnv ? void 0 : findCredential(...vendorEnvName ? [envName, vendorEnvName] : [envName]);
18505
18853
  const value = fromEnv ? env.get(fromEnv) : stored?.value ?? readToken(keyringKey);
18506
- if (!value) return row$14(keyringKey, "skip", `not set (${vendorEnvName ? `${envName} / ${vendorEnvName}` : envName}, or \`holocron new token ${keyringKey}\`)`);
18854
+ if (!value) return row$16(keyringKey, "skip", `not set (${vendorEnvName ? `${envName} / ${vendorEnvName}` : envName}, or \`holocron new token ${keyringKey}\`)`);
18507
18855
  const verify = token.verify ?? (token.verifiable === false ? void 0 : module.verifyToken);
18508
- if (!verify) return row$14(keyringKey, "skip", "set, but its plugin cannot verify it");
18856
+ if (!verify) return row$16(keyringKey, "skip", "set, but its plugin cannot verify it");
18509
18857
  const from = fromEnv ?? stored?.source ?? "keyring";
18510
18858
  try {
18511
18859
  const verified = await verify(value);
18512
- if (!verified.ok) return row$14(keyringKey, "fail", `rejected (${from}): ${verified.message}`);
18860
+ if (!verified.ok) return row$16(keyringKey, "fail", `rejected (${from}): ${verified.message}`);
18513
18861
  const expiry = verified.expiresAt ? describeExpiry(verified.expiresAt, now) : void 0;
18514
- if (!expiry) return row$14(keyringKey, "ok", `${verified.subject} (${from})`);
18862
+ if (!expiry) return row$16(keyringKey, "ok", `${verified.subject} (${from})`);
18515
18863
  return expiry.soon ? {
18516
- ...row$14(keyringKey, "fail", `${verified.subject} (${from}), ${expiry.text}`),
18864
+ ...row$16(keyringKey, "fail", `${verified.subject} (${from}), ${expiry.text}`),
18517
18865
  problems: [`${expiry.text}: renew it`]
18518
- } : row$14(keyringKey, "ok", `${verified.subject} (${from}), ${expiry.text}`);
18866
+ } : row$16(keyringKey, "ok", `${verified.subject} (${from}), ${expiry.text}`);
18519
18867
  } catch (err) {
18520
- return row$14(keyringKey, "fail", `could not be verified (${from}): ${errorMessage(err)}`);
18868
+ return row$16(keyringKey, "fail", `could not be verified (${from}): ${errorMessage(err)}`);
18521
18869
  }
18522
18870
  }
18523
18871
  // src/commands/doctor-secrets/doctor-secrets.ts
@@ -19199,7 +19547,7 @@ function summariseProbeRows(id, title, rows) {
19199
19547
  * provider with no `token` probe, no declared layer, or one that cannot be read is a skip with the reason.
19200
19548
  */
19201
19549
  const PROBE = "token";
19202
- const row$13 = (id, title, status, detail, problems = []) => ({
19550
+ const row$15 = (id, title, status, detail, problems = []) => ({
19203
19551
  id,
19204
19552
  title,
19205
19553
  status,
@@ -19224,12 +19572,12 @@ async function runDoctorTokens(input) {
19224
19572
  try {
19225
19573
  tokens = await providerTokens(provider);
19226
19574
  } catch (err) {
19227
- rows.push(row$13(`tokens:${provider}`, provider, "skip", `could not read its tokens: ${describeError(err)}`));
19575
+ rows.push(row$15(`tokens:${provider}`, provider, "skip", `could not read its tokens: ${describeError(err)}`));
19228
19576
  continue;
19229
19577
  }
19230
19578
  const expectations = tokenExpectations(tokens);
19231
- if (expectations.length === 0) rows.push(row$13(`tokens:${provider}`, provider, "skip", "info: declares no token layers, nothing to check"));
19232
- else if (!usableProbe(probes.get(provider))) rows.push(row$13(`tokens:${provider}`, provider, "skip", `info: has no \`${PROBE}\` probe loaded, so its tokens are not checked`));
19579
+ if (expectations.length === 0) rows.push(row$15(`tokens:${provider}`, provider, "skip", "info: declares no token layers, nothing to check"));
19580
+ else if (!usableProbe(probes.get(provider))) rows.push(row$15(`tokens:${provider}`, provider, "skip", `info: has no \`${PROBE}\` probe loaded, so its tokens are not checked`));
19233
19581
  else declared.push({
19234
19582
  provider,
19235
19583
  tokens,
@@ -19291,14 +19639,14 @@ async function checkLayer(c) {
19291
19639
  tokens
19292
19640
  });
19293
19641
  } catch (err) {
19294
- if (err instanceof HoldsNoTokenError) return c.wanted.map((e) => row$13(id(e), title(e), "fail", "not held in this layer", [err.message]));
19295
- return c.wanted.map((e) => row$13(id(e), title(e), "skip", `could not read the Environment: ${describeError(err)}`));
19642
+ if (err instanceof HoldsNoTokenError) return c.wanted.map((e) => row$15(id(e), title(e), "fail", "not held in this layer", [err.message]));
19643
+ return c.wanted.map((e) => row$15(id(e), title(e), "skip", `could not read the Environment: ${describeError(err)}`));
19296
19644
  }
19297
19645
  const rows = [];
19298
19646
  for (const e of c.wanted) {
19299
19647
  const token = held.held.find((h) => h.envName === e.envName);
19300
19648
  if (!token) {
19301
- rows.push(row$13(id(e), title(e), "fail", `not held in ${held.environment}`, [`${e.envName} is declared for ${c.layer}`]));
19649
+ rows.push(row$15(id(e), title(e), "fail", `not held in ${held.environment}`, [`${e.envName} is declared for ${c.layer}`]));
19302
19650
  continue;
19303
19651
  }
19304
19652
  rows.push(summariseProbeRows(id(e), title(e), await probeToken(c, e, token.token, held.plain)));
@@ -19371,7 +19719,7 @@ const doctorTokensCommand = {
19371
19719
  }
19372
19720
  };
19373
19721
  // src/commands/doctor-wiki/wiki-rows.ts
19374
- const row$12 = (id, title, status, detail, problems = []) => ({
19722
+ const row$14 = (id, title, status, detail, problems = []) => ({
19375
19723
  id,
19376
19724
  title,
19377
19725
  status,
@@ -19387,11 +19735,11 @@ const names = (paths) => paths.length > LISTED ? `${paths.slice(0, LISTED).join(
19387
19735
  * skip, since a machine with no network says nothing about the site.
19388
19736
  */
19389
19737
  function siteRow(id, title, probe, notFoundHint) {
19390
- if (probe.status === void 0) return row$12(id, title, "skip", `${probe.url}: ${probe.error ?? "no answer"}`);
19391
- if (probe.status < 400) return row$12(id, title, "ok", `${probe.url} answers ${probe.status}`);
19392
- if (probe.status === 401 || probe.status === 403) return row$12(id, title, "ok", `${probe.url} answers ${probe.status} (access is restricted)`);
19738
+ if (probe.status === void 0) return row$14(id, title, "skip", `${probe.url}: ${probe.error ?? "no answer"}`);
19739
+ if (probe.status < 400) return row$14(id, title, "ok", `${probe.url} answers ${probe.status}`);
19740
+ if (probe.status === 401 || probe.status === 403) return row$14(id, title, "ok", `${probe.url} answers ${probe.status} (access is restricted)`);
19393
19741
  const problem = probe.status === 404 ? `${probe.url} answers 404; ${notFoundHint}` : `${probe.url} answers ${probe.status}, expected a page`;
19394
- return row$12(id, title, "fail", `${probe.url} answers ${probe.status}`, [problem]);
19742
+ return row$14(id, title, "fail", `${probe.url} answers ${probe.status}`, [problem]);
19395
19743
  }
19396
19744
  /**
19397
19745
  * The rows `holocron doctor wiki` prints for one {@link WikiInspection}: organization, docs instance, the site and its
@@ -19403,42 +19751,42 @@ function wikiRows(found, providerName) {
19403
19751
  const { declared, found: foundOrg } = found.organization;
19404
19752
  if (foundOrg === null) {
19405
19753
  const problem = `fern/fern.config.json has no organization; \`holocron setup\` writes it`;
19406
- rows.push(row$12("wiki:organization", "organization is set", "fail", problem, [problem]));
19754
+ rows.push(row$14("wiki:organization", "organization is set", "fail", problem, [problem]));
19407
19755
  } else if (foundOrg !== declared) {
19408
19756
  const problem = `fern/fern.config.json names ${foundOrg}, the config declares ${declared}; run \`holocron setup\``;
19409
- rows.push(row$12("wiki:organization", "organization is set", "fail", `${foundOrg}, declared ${declared}`, [problem]));
19410
- } else rows.push(row$12("wiki:organization", "organization is set", "ok", `${declared} in fern/fern.config.json`));
19757
+ rows.push(row$14("wiki:organization", "organization is set", "fail", `${foundOrg}, declared ${declared}`, [problem]));
19758
+ } else rows.push(row$14("wiki:organization", "organization is set", "ok", `${declared} in fern/fern.config.json`));
19411
19759
  const instance = found.instance;
19412
19760
  if (instance === null) {
19413
19761
  const problem = "fern/docs.yml does not exist; `holocron setup` writes it";
19414
- rows.push(row$12("wiki:instance", "docs site is declared", "fail", problem, [problem]));
19762
+ rows.push(row$14("wiki:instance", "docs site is declared", "fail", problem, [problem]));
19415
19763
  } else {
19416
19764
  const problems = [];
19417
19765
  if (instance.foundUrl !== instance.expectedUrl) problems.push(`instance url is ${instance.foundUrl ?? "not set"}, expected ${instance.expectedUrl}`);
19418
19766
  if (instance.expectedDomain !== void 0 && instance.foundDomain !== instance.expectedDomain) problems.push(`custom-domain is ${instance.foundDomain ?? "not set"}, expected ${instance.expectedDomain}`);
19419
- rows.push(problems.length > 0 ? row$12("wiki:instance", "docs site is declared", "fail", `${problems.length} problem(s)`, [...problems.map((p) => `fern/docs.yml: ${p}`)]) : row$12("wiki:instance", "docs site is declared", "ok", `${instance.expectedUrl} in fern/docs.yml`));
19767
+ rows.push(problems.length > 0 ? row$14("wiki:instance", "docs site is declared", "fail", `${problems.length} problem(s)`, [...problems.map((p) => `fern/docs.yml: ${p}`)]) : row$14("wiki:instance", "docs site is declared", "ok", `${instance.expectedUrl} in fern/docs.yml`));
19420
19768
  }
19421
19769
  const [site, domain] = found.site;
19422
19770
  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\`)`));
19423
19771
  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`));
19424
- if (found.navigation === null) rows.push(row$12("wiki:navigation", "navigation pages exist", "skip", "no fern/docs.yml to read"));
19772
+ if (found.navigation === null) rows.push(row$14("wiki:navigation", "navigation pages exist", "skip", "no fern/docs.yml to read"));
19425
19773
  else if (found.navigation.missing.length > 0) {
19426
19774
  const problems = found.navigation.missing.map((p) => `${p} is listed in fern/docs.yml but is not on disk`);
19427
- rows.push(row$12("wiki:navigation", "navigation pages exist", "fail", `${found.navigation.missing.length} missing`, problems));
19775
+ rows.push(row$14("wiki:navigation", "navigation pages exist", "fail", `${found.navigation.missing.length} missing`, problems));
19428
19776
  } else {
19429
- rows.push(row$12("wiki:navigation", "navigation pages exist", "ok", `${found.navigation.listed} listed pages exist`));
19430
- if (found.navigation.unlisted.length > 0) rows.push(row$12("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`));
19777
+ rows.push(row$14("wiki:navigation", "navigation pages exist", "ok", `${found.navigation.listed} listed pages exist`));
19778
+ if (found.navigation.unlisted.length > 0) rows.push(row$14("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`));
19431
19779
  }
19432
19780
  const published = found.published;
19433
19781
  const listed = found.navigation?.listed;
19434
- if (!published) rows.push(row$12("wiki:published", "published pages", "skip", "the site's page index could not be asked"));
19782
+ if (!published) rows.push(row$14("wiki:published", "published pages", "skip", "the site's page index could not be asked"));
19435
19783
  else if (published.pages === void 0) {
19436
19784
  const why = published.status === void 0 ? published.error ?? "no answer" : `answered ${published.status}`;
19437
- rows.push(row$12("wiki:published", "published pages", "skip", `${published.url}: ${why}`));
19785
+ rows.push(row$14("wiki:published", "published pages", "skip", `${published.url}: ${why}`));
19438
19786
  } else if (listed !== void 0 && published.pages < listed) {
19439
19787
  const problem = `${published.url} lists ${published.pages} page(s), the navigation lists ${listed}; the last publish is behind (run the wiki workflow)`;
19440
- rows.push(row$12("wiki:published", "published pages", "fail", `${published.pages} of ${listed}`, [problem]));
19441
- } else rows.push(row$12("wiki:published", "published pages", "ok", listed === void 0 ? `${published.pages} page(s) in ${published.url}` : `${published.pages} page(s) published for ${listed} listed`));
19788
+ rows.push(row$14("wiki:published", "published pages", "fail", `${published.pages} of ${listed}`, [problem]));
19789
+ } else rows.push(row$14("wiki:published", "published pages", "ok", listed === void 0 ? `${published.pages} page(s) in ${published.url}` : `${published.pages} page(s) published for ${listed} listed`));
19442
19790
  return rows;
19443
19791
  }
19444
19792
  // src/commands/doctor-wiki/doctor-wiki.ts
@@ -19544,7 +19892,7 @@ function readFailureRow(id, title, err) {
19544
19892
  };
19545
19893
  }
19546
19894
  // src/commands/doctor-workers/check-project.ts
19547
- const row$11 = (id, title, status, detail, problems = []) => ({
19895
+ const row$13 = (id, title, status, detail, problems = []) => ({
19548
19896
  id,
19549
19897
  title,
19550
19898
  status,
@@ -19573,30 +19921,30 @@ async function checkProject(deploy, declared) {
19573
19921
  let exists = false;
19574
19922
  try {
19575
19923
  exists = (await deploy.listProjects()).some((p) => same$1(p.name, project) || p.id === project);
19576
- rows.push(exists ? row$11(ids.exists, titles.exists, "ok", `${project} on ${deploy.providerName}`) : row$11(ids.exists, titles.exists, "fail", "not found", [`no project ${project} on ${deploy.providerName}; \`holocron setup\` makes it`]));
19924
+ rows.push(exists ? row$13(ids.exists, titles.exists, "ok", `${project} on ${deploy.providerName}`) : row$13(ids.exists, titles.exists, "fail", "not found", [`no project ${project} on ${deploy.providerName}; \`holocron setup\` makes it`]));
19577
19925
  } catch (err) {
19578
19926
  rows.push(readFailureRow(ids.exists, titles.exists, err));
19579
19927
  }
19580
19928
  const notChecked = (reason) => `not checked: ${reason}`;
19581
19929
  const gone = exists ? void 0 : "the project is not readable or not there";
19582
- if (declared.hostname === void 0) {} else if (gone) rows.push(row$11(ids.domain, titles.domain, "skip", notChecked(gone)));
19583
- else if (!deploy.listDomains) rows.push(row$11(ids.domain, titles.domain, "skip", `the \`${deploy.providerName}\` provider cannot list domains`));
19930
+ if (declared.hostname === void 0) {} else if (gone) rows.push(row$13(ids.domain, titles.domain, "skip", notChecked(gone)));
19931
+ else if (!deploy.listDomains) rows.push(row$13(ids.domain, titles.domain, "skip", `the \`${deploy.providerName}\` provider cannot list domains`));
19584
19932
  else try {
19585
19933
  const attached = await deploy.listDomains(project);
19586
- rows.push(attached.some((d) => same$1(d, declared.hostname)) ? row$11(ids.domain, titles.domain, "ok", `${declared.hostname} attached`) : row$11(ids.domain, titles.domain, "fail", `${declared.hostname} not attached`, [`${declared.hostname} is not a domain of ${project}; \`holocron setup\` attaches it`]));
19934
+ rows.push(attached.some((d) => same$1(d, declared.hostname)) ? row$13(ids.domain, titles.domain, "ok", `${declared.hostname} attached`) : row$13(ids.domain, titles.domain, "fail", `${declared.hostname} not attached`, [`${declared.hostname} is not a domain of ${project}; \`holocron setup\` attaches it`]));
19587
19935
  } catch (err) {
19588
19936
  rows.push(readFailureRow(ids.domain, titles.domain, err));
19589
19937
  }
19590
- if (gone) rows.push(row$11(ids.deploy, titles.deploy, "skip", notChecked(gone)));
19591
- else if (!deploy.latestDeployment) rows.push(row$11(ids.deploy, titles.deploy, "skip", `the \`${deploy.providerName}\` provider cannot list deployments`));
19938
+ if (gone) rows.push(row$13(ids.deploy, titles.deploy, "skip", notChecked(gone)));
19939
+ else if (!deploy.latestDeployment) rows.push(row$13(ids.deploy, titles.deploy, "skip", `the \`${deploy.providerName}\` provider cannot list deployments`));
19592
19940
  else try {
19593
19941
  const latest = await deploy.latestDeployment(project);
19594
- if (!latest) rows.push(row$11(ids.deploy, titles.deploy, "skip", "no production deployment yet"));
19595
- else if (latest.status === "ready") rows.push(row$11(ids.deploy, titles.deploy, "ok", latest.createdAt ? `ready, ${latest.createdAt}` : "ready"));
19942
+ if (!latest) rows.push(row$13(ids.deploy, titles.deploy, "skip", "no production deployment yet"));
19943
+ else if (latest.status === "ready") rows.push(row$13(ids.deploy, titles.deploy, "ok", latest.createdAt ? `ready, ${latest.createdAt}` : "ready"));
19596
19944
  else if (latest.status === "error") {
19597
19945
  const why = latest.errorMessage ? `: ${latest.errorMessage}` : "";
19598
- rows.push(row$11(ids.deploy, titles.deploy, "fail", "the newest deployment errored", [`the newest production deployment of ${project} failed${why}`]));
19599
- } else rows.push(row$11(ids.deploy, titles.deploy, "skip", `info: the newest deployment is ${latest.status}`));
19946
+ rows.push(row$13(ids.deploy, titles.deploy, "fail", "the newest deployment errored", [`the newest production deployment of ${project} failed${why}`]));
19947
+ } else rows.push(row$13(ids.deploy, titles.deploy, "skip", `info: the newest deployment is ${latest.status}`));
19600
19948
  } catch (err) {
19601
19949
  rows.push(readFailureRow(ids.deploy, titles.deploy, err));
19602
19950
  }
@@ -19604,7 +19952,7 @@ async function checkProject(deploy, declared) {
19604
19952
  }
19605
19953
  // src/commands/doctor-workers/check-worker.ts
19606
19954
  const same = (a, b) => a.toLowerCase() === b.toLowerCase();
19607
- const row$10 = (id, title, status, detail, problems = []) => ({
19955
+ const row$12 = (id, title, status, detail, problems = []) => ({
19608
19956
  id,
19609
19957
  title,
19610
19958
  status,
@@ -19629,9 +19977,9 @@ async function checkWorker(workers, worker) {
19629
19977
  deploy: `${name} Worker's latest deployment is healthy`
19630
19978
  };
19631
19979
  const skipAll = (reason) => [
19632
- row$10(ids.deployed, titles.deployed, "skip", reason),
19633
- row$10(ids.bindings, titles.bindings, "skip", reason),
19634
- row$10(ids.deploy, titles.deploy, "skip", reason)
19980
+ row$12(ids.deployed, titles.deployed, "skip", reason),
19981
+ row$12(ids.bindings, titles.bindings, "skip", reason),
19982
+ row$12(ids.deploy, titles.deploy, "skip", reason)
19635
19983
  ];
19636
19984
  if (worker.script === void 0) return skipAll(`${workers.providerName} does not say how it names this Worker`);
19637
19985
  const script = worker.script;
@@ -19644,29 +19992,29 @@ async function checkWorker(workers, worker) {
19644
19992
  exists = state.exists;
19645
19993
  if (!state.exists) {
19646
19994
  const problem = `no Worker named ${script}; \`holocron setup\` deploys it`;
19647
- rows.push(row$10(ids.deployed, titles.deployed, "fail", `${script} not deployed`, [problem]), row$10(ids.bindings, titles.bindings, "skip", `not checked: no Worker named ${script}`));
19995
+ rows.push(row$12(ids.deployed, titles.deployed, "fail", `${script} not deployed`, [problem]), row$12(ids.bindings, titles.bindings, "skip", `not checked: no Worker named ${script}`));
19648
19996
  } else {
19649
- rows.push(state.routes.some((r) => same(r, route)) ? row$10(ids.deployed, titles.deployed, "ok", `${script} serves ${route}`) : row$10(ids.deployed, titles.deployed, "fail", `no route ${route}`, [`${script} has no route ${route}`]));
19650
- if (worker.bindings.length === 0) rows.push(row$10(ids.bindings, titles.bindings, "ok", "none declared"));
19997
+ rows.push(state.routes.some((r) => same(r, route)) ? row$12(ids.deployed, titles.deployed, "ok", `${script} serves ${route}`) : row$12(ids.deployed, titles.deployed, "fail", `no route ${route}`, [`${script} has no route ${route}`]));
19998
+ if (worker.bindings.length === 0) rows.push(row$12(ids.bindings, titles.bindings, "ok", "none declared"));
19651
19999
  else {
19652
20000
  const bound = new Set(state.bindingNames.map((n) => n.toUpperCase()));
19653
20001
  const missing = worker.bindings.filter((n) => !bound.has(n.toUpperCase()));
19654
- rows.push(missing.length === 0 ? row$10(ids.bindings, titles.bindings, "ok", `${worker.bindings.length} of ${worker.bindings.length} bound`) : row$10(ids.bindings, titles.bindings, "fail", `${missing.length} not bound`, missing.map((n) => `${n}: not bound`)));
20002
+ rows.push(missing.length === 0 ? row$12(ids.bindings, titles.bindings, "ok", `${worker.bindings.length} of ${worker.bindings.length} bound`) : row$12(ids.bindings, titles.bindings, "fail", `${missing.length} not bound`, missing.map((n) => `${n}: not bound`)));
19655
20003
  }
19656
20004
  }
19657
20005
  } catch (err) {
19658
20006
  const failure = readFailureRow(ids.deployed, titles.deployed, err);
19659
- rows.push(failure, row$10(ids.bindings, titles.bindings, "skip", "not checked: could not read the Worker"));
20007
+ rows.push(failure, row$12(ids.bindings, titles.bindings, "skip", "not checked: could not read the Worker"));
19660
20008
  }
19661
- if (!exists) rows.push(row$10(ids.deploy, titles.deploy, "skip", "not checked: the Worker is not readable or not there"));
19662
- else if (!workers.latestDeployment) rows.push(row$10(ids.deploy, titles.deploy, "skip", `the \`${workers.providerName}\` provider cannot list deployments`));
20009
+ if (!exists) rows.push(row$12(ids.deploy, titles.deploy, "skip", "not checked: the Worker is not readable or not there"));
20010
+ else if (!workers.latestDeployment) rows.push(row$12(ids.deploy, titles.deploy, "skip", `the \`${workers.providerName}\` provider cannot list deployments`));
19663
20011
  else try {
19664
20012
  const latest = await workers.latestDeployment(script);
19665
- if (!latest) rows.push(row$10(ids.deploy, titles.deploy, "skip", `${script} has no recorded deployment`));
20013
+ if (!latest) rows.push(row$12(ids.deploy, titles.deploy, "skip", `${script} has no recorded deployment`));
19666
20014
  else if (!latest.active) {
19667
20015
  const problem = `the newest deployment of ${script} does not serve all traffic`;
19668
- rows.push(row$10(ids.deploy, titles.deploy, "fail", "not serving all traffic", [problem]));
19669
- } else rows.push(row$10(ids.deploy, titles.deploy, "ok", latest.createdAt ? `deployed ${latest.createdAt}` : "serving all traffic"));
20016
+ rows.push(row$12(ids.deploy, titles.deploy, "fail", "not serving all traffic", [problem]));
20017
+ } else rows.push(row$12(ids.deploy, titles.deploy, "ok", latest.createdAt ? `deployed ${latest.createdAt}` : "serving all traffic"));
19670
20018
  } catch (err) {
19671
20019
  rows.push(readFailureRow(ids.deploy, titles.deploy, err));
19672
20020
  }
@@ -19730,7 +20078,7 @@ function declaredWorkers(input) {
19730
20078
  * custom domain is attached, and the newest production deployment is ready. Only what the provider proves wrong
19731
20079
  * fails; a missing token, a 401 or 403, or a provider that cannot read it is a skip with the reason.
19732
20080
  */
19733
- const row$9 = (id, title, status, detail) => ({
20081
+ const row$11 = (id, title, status, detail) => ({
19734
20082
  id,
19735
20083
  title,
19736
20084
  status,
@@ -19756,12 +20104,12 @@ async function runDoctorWorkers(input) {
19756
20104
  ...loader.has("wiki") ? { wiki: loader.get("wiki") } : {},
19757
20105
  ...workers ? { workers } : {}
19758
20106
  });
19759
- if (declared.length === 0) rows.push(row$9("workers", "declared Workers", "ok", "none declared"));
20107
+ if (declared.length === 0) rows.push(row$11("workers", "declared Workers", "ok", "none declared"));
19760
20108
  else if (!workers) {
19761
20109
  const why = whyNone(loader, "workers", "no `workers` provider is configured in holocron.config.ts");
19762
- for (const worker of declared) rows.push(row$9(`workers:${worker.label}`, `${worker.label} Worker`, "skip", why));
20110
+ for (const worker of declared) rows.push(row$11(`workers:${worker.label}`, `${worker.label} Worker`, "skip", why));
19763
20111
  } else for (const worker of declared) rows.push(...await checkWorker(workers, worker));
19764
- if (!loader.has("deployment")) rows.push(row$9("deployment", "deployment project", "skip", whyNone(loader, "deployment", "no `deployment` provider is configured in holocron.config.ts")));
20112
+ if (!loader.has("deployment")) rows.push(row$11("deployment", "deployment project", "skip", whyNone(loader, "deployment", "no `deployment` provider is configured in holocron.config.ts")));
19765
20113
  else {
19766
20114
  const deploy = loader.get("deployment");
19767
20115
  for (const project of declaredProjects(input.loaded.resolved, deploy)) rows.push(...await checkProject(deploy, project));
@@ -20745,7 +21093,7 @@ function resolveExportDir(input) {
20745
21093
  * listed under the provider's row and does not fail the run. It writes files, so it asks first unless `--dry-run` (the
20746
21094
  * files are converted and listed, nothing is written) or `--yes` (without a terminal it refuses instead).
20747
21095
  */
20748
- const row$8 = (id, status, detail, problems = []) => ({
21096
+ const row$10 = (id, status, detail, problems = []) => ({
20749
21097
  id,
20750
21098
  title: id,
20751
21099
  status,
@@ -20787,9 +21135,9 @@ async function runRequestsExport(input) {
20787
21135
  print("");
20788
21136
  const entry = input.loaded.resolved.providers.tooling;
20789
21137
  const tuples = entry?.cardinality === "many" ? entry.tuples : [];
20790
- if (tuples.length === 0) return finish([row$8("tooling", "fail", "the config has no `tooling` provider to export for")]);
21138
+ if (tuples.length === 0) return finish([row$10("tooling", "fail", "the config has no `tooling` provider to export for")]);
20791
21139
  const chosen = input.to === void 0 ? tuples : tuples.filter((t) => t.provider === input.to);
20792
- if (chosen.length === 0) return finish([row$8(input.to, "fail", `not a \`tooling\` provider of this config (${tuples.map((t) => t.provider).join(", ")})`)]);
21140
+ if (chosen.length === 0) return finish([row$10(input.to, "fail", `not a \`tooling\` provider of this config (${tuples.map((t) => t.provider).join(", ")})`)]);
20793
21141
  /* v8 ignore start -- the real loader is only built outside tests, which always inject one */
20794
21142
  const loader = input.loader ?? new PluginLoader({
20795
21143
  ...input.loaded.resolved,
@@ -20809,17 +21157,17 @@ async function runRequestsExport(input) {
20809
21157
  const tool = loaded.find((t) => t.providerName === id);
20810
21158
  if (!tool) {
20811
21159
  const failure = loader.loadFailures().find((f) => f.key === "tooling" && f.provider === id);
20812
- rows.push(row$8(id, "fail", `the provider is not available${failure ? ` (${describeError(failure.error)})` : ""}`));
21160
+ rows.push(row$10(id, "fail", `the provider is not available${failure ? ` (${describeError(failure.error)})` : ""}`));
20813
21161
  continue;
20814
21162
  }
20815
21163
  if (!tool.export) {
20816
- rows.push(row$8(id, "skip", "has no export: it reads the repo's files as they are"));
21164
+ rows.push(row$10(id, "skip", "has no export: it reads the repo's files as they are"));
20817
21165
  continue;
20818
21166
  }
20819
21167
  const collectionFiles = fileList$1(tuple.options.collectionFiles);
20820
21168
  const envFiles = fileList$1(tuple.options.envFiles);
20821
21169
  if (collectionFiles.length === 0) {
20822
- rows.push(row$8(id, "skip", "names no `collectionFiles`, so there is nothing to export"));
21170
+ rows.push(row$10(id, "skip", "names no `collectionFiles`, so there is nothing to export"));
20823
21171
  continue;
20824
21172
  }
20825
21173
  const groups = input.out === void 0 ? groupByFolder(collectionFiles) : [collectionFiles];
@@ -20833,7 +21181,7 @@ async function runRequestsExport(input) {
20833
21181
  ...input.out !== void 0 ? { out: input.out } : {}
20834
21182
  });
20835
21183
  if (!dir.ok) {
20836
- rows.push(row$8(label, "fail", dir.message));
21184
+ rows.push(row$10(label, "fail", dir.message));
20837
21185
  continue;
20838
21186
  }
20839
21187
  targets.push({
@@ -20872,9 +21220,9 @@ async function runRequestsExport(input) {
20872
21220
  const where = relative(repoRoot, outDir);
20873
21221
  const files = result.files.length > 0 ? ` (${result.files.join(", ")})` : "";
20874
21222
  paths.push(...result.files.map((file) => resolve(outDir, file)));
20875
- rows.push(row$8(label, "ok", `${dryRun ? "would write" : "wrote"} ${result.files.length} file(s) to ${where}${files}`, result.issues.map((issue) => `issue in ${issue.file}: ${issue.message}`)));
21223
+ rows.push(row$10(label, "ok", `${dryRun ? "would write" : "wrote"} ${result.files.length} file(s) to ${where}${files}`, result.issues.map((issue) => `issue in ${issue.file}: ${issue.message}`)));
20876
21224
  } catch (err) {
20877
- rows.push(row$8(label, "fail", describeError(err)));
21225
+ rows.push(row$10(label, "fail", describeError(err)));
20878
21226
  }
20879
21227
  const report = finish(rows.sort((a, b) => a.id.localeCompare(b.id)));
20880
21228
  if (paths.length > 0) {
@@ -21740,7 +22088,8 @@ function generateWorkflowFiles(input) {
21740
22088
  cwd: input.repoRoot,
21741
22089
  config: {
21742
22090
  tasks,
21743
- extraRequiredChecks: config.extraRequiredChecks
22091
+ extraRequiredChecks: config.extraRequiredChecks,
22092
+ ...config.ci === void 0 ? {} : { ci: config.ci }
21744
22093
  },
21745
22094
  orgContext: {
21746
22095
  org: config.org,
@@ -21809,6 +22158,7 @@ function generateWorkflowFiles(input) {
21809
22158
  });
21810
22159
  }
21811
22160
  for (const [id, content] of hostedReusableWorkflows()) {
22161
+ if (id === "ci" && astromech.aggregatePoster() === "sentinel") continue;
21812
22162
  const filename = workflowFile(id);
21813
22163
  entries.push({
21814
22164
  kind: "file",
@@ -22899,8 +23249,18 @@ async function runSetup(input) {
22899
23249
  logger,
22900
23250
  ...statusContexts ? { statusContexts } : {}
22901
23251
  }).requiredChecks(hostsReusables(input.context.repoRoot)) : [];
22902
- steps.push(await upsertBranchProtection(source, dryRun, requiredChecks));
23252
+ const pinPlan = aggregatePin(config.ci, requiredChecks);
23253
+ steps.push(await upsertBranchProtection(source, dryRun, requiredChecks, pinPlan.pins));
22903
23254
  print(formatStep(steps[steps.length - 1]));
23255
+ if (pinPlan.problem) {
23256
+ steps.push({
23257
+ capability: "source",
23258
+ step: "pin ci / Required checks",
23259
+ status: "skip",
23260
+ message: pinPlan.problem
23261
+ });
23262
+ print(formatStep(steps[steps.length - 1]));
23263
+ }
22904
23264
  }
22905
23265
  }
22906
23266
  if (loader.has("source")) {
@@ -25058,7 +25418,7 @@ function specName(title, name) {
25058
25418
  */
25059
25419
  /** How many lines of the spec a dry run shows. */
25060
25420
  const PREVIEW_LINES$1 = 12;
25061
- const row$7 = (id, status, detail) => ({
25421
+ const row$9 = (id, status, detail) => ({
25062
25422
  id,
25063
25423
  title: id,
25064
25424
  status,
@@ -25088,7 +25448,7 @@ async function runIdeasPromote(input) {
25088
25448
  print(style.header(`Holocron new spec${dryRun ? " (dry-run)" : ""}`));
25089
25449
  print("");
25090
25450
  const entry = input.loaded.resolved.providers.issues;
25091
- if (!entry) return finish([row$7(input.issue, "fail", "the config has no `issues` provider to read the issue with")]);
25451
+ if (!entry) return finish([row$9(input.issue, "fail", "the config has no `issues` provider to read the issue with")]);
25092
25452
  const credentials = input.loaded.resolved.providers.credentials;
25093
25453
  /* v8 ignore start -- the real loader is only built outside tests, which always inject one */
25094
25454
  const loader = input.loader ?? new PluginLoader({
@@ -25103,18 +25463,18 @@ async function runIdeasPromote(input) {
25103
25463
  assertPluginsResolvable(loader, "new spec");
25104
25464
  if (!loader.has("issues")) {
25105
25465
  const failure = loader.loadFailures().find((f) => f.key === "issues");
25106
- return finish([row$7(input.issue, "fail", `the \`issues\` provider is not available${failure ? ` (${describeError(failure.error)})` : ""}`)]);
25466
+ return finish([row$9(input.issue, "fail", `the \`issues\` provider is not available${failure ? ` (${describeError(failure.error)})` : ""}`)]);
25107
25467
  }
25108
25468
  let issue;
25109
25469
  try {
25110
25470
  issue = await loader.get("issues").get(input.issue);
25111
25471
  } catch (err) {
25112
- return finish([row$7(input.issue, "fail", `could not read the issue: ${describeError(err)}`)]);
25472
+ return finish([row$9(input.issue, "fail", `could not read the issue: ${describeError(err)}`)]);
25113
25473
  }
25114
25474
  const name = specName(issue.summary, input.name);
25115
- if (!name) return finish([row$7(issue.key, "fail", input.name === void 0 ? "no spec name can be made from the title; pass --name" : `"${input.name}" is not a spec name: use lower-case words joined by hyphens, such as tech-my-topic`)]);
25475
+ if (!name) return finish([row$9(issue.key, "fail", input.name === void 0 ? "no spec name can be made from the title; pass --name" : `"${input.name}" is not a spec name: use lower-case words joined by hyphens, such as tech-my-topic`)]);
25116
25476
  const relative = join(".notes", `${name}.spec.md`);
25117
- if (io.exists(join(input.context.repoRoot, relative))) return finish([row$7(relative, "fail", "the spec already exists; it is never overwritten")], relative);
25477
+ if (io.exists(join(input.context.repoRoot, relative))) return finish([row$9(relative, "fail", "the spec already exists; it is never overwritten")], relative);
25118
25478
  const { org, name: repoName } = input.loaded.resolved;
25119
25479
  const ref = githubRef(issue.url) ?? (issue.key.startsWith("#") ? `${org}/${repoName}${issue.key}` : issue.key);
25120
25480
  const { content, fromIdea } = buildSpec({
@@ -25127,7 +25487,7 @@ async function runIdeasPromote(input) {
25127
25487
  print(` ${relative}`);
25128
25488
  for (const line of content.split("\n").slice(0, PREVIEW_LINES$1)) print(` ${style.skip(line)}`);
25129
25489
  print("");
25130
- return finish([row$7(relative, "skip", `would write the spec ${origin}`)], relative);
25490
+ return finish([row$9(relative, "skip", `would write the spec ${origin}`)], relative);
25131
25491
  }
25132
25492
  if (!input.yes) {
25133
25493
  if (!(input.interactive ?? Boolean(process.stdin.isTTY))) throw new NonInteractiveError(`\`new spec\` writes ${relative}; pass --yes to run it without asking, or --dry-run to preview`);
@@ -25146,9 +25506,9 @@ async function runIdeasPromote(input) {
25146
25506
  try {
25147
25507
  io.write(join(input.context.repoRoot, relative), content);
25148
25508
  } catch (err) {
25149
- return finish([row$7(relative, "fail", `could not write the spec: ${describeError(err)}`)], relative);
25509
+ return finish([row$9(relative, "fail", `could not write the spec: ${describeError(err)}`)], relative);
25150
25510
  }
25151
- return finish([row$7(relative, "ok", `wrote the spec ${origin}`)], relative);
25511
+ return finish([row$9(relative, "ok", `wrote the spec ${origin}`)], relative);
25152
25512
  }
25153
25513
  // src/commands/ideas-promote/ideas-promote.command.ts
25154
25514
  const ideasPromoteCommand = {
@@ -25224,7 +25584,7 @@ function readIssueBody(file, cwd, read = (p) => readFileSync(p, "utf8")) {
25224
25584
  */
25225
25585
  /** How many lines of the body a dry run shows. */
25226
25586
  const PREVIEW_LINES = 8;
25227
- const row$6 = (id, status, detail) => ({
25587
+ const row$8 = (id, status, detail) => ({
25228
25588
  id,
25229
25589
  title: id,
25230
25590
  status,
@@ -25248,11 +25608,11 @@ async function runIssueCreate(input) {
25248
25608
  print(style.header(`Holocron new issue${dryRun ? " (dry-run)" : ""}`));
25249
25609
  print("");
25250
25610
  const title = input.title.trim();
25251
- if (!title) return finish([row$6("title", "fail", "the title is empty")]);
25611
+ if (!title) return finish([row$8("title", "fail", "the title is empty")]);
25252
25612
  const prepared = prepareIssueFields(input, input.loaded.resolved.repo?.labels?.areas);
25253
- if (!prepared.ok) return finish(prepared.problems.map((p) => row$6(title, "fail", p)));
25613
+ if (!prepared.ok) return finish(prepared.problems.map((p) => row$8(title, "fail", p)));
25254
25614
  const entry = input.loaded.resolved.providers.issues;
25255
- if (!entry) return finish([row$6(title, "fail", "the config has no `issues` provider to file the issue with")]);
25615
+ if (!entry) return finish([row$8(title, "fail", "the config has no `issues` provider to file the issue with")]);
25256
25616
  const credentials = input.loaded.resolved.providers.credentials;
25257
25617
  const projects = prepared.project ? input.loaded.resolved.providers.projects : void 0;
25258
25618
  /* v8 ignore start -- the real loader is only built outside tests, which always inject one */
@@ -25269,7 +25629,7 @@ async function runIssueCreate(input) {
25269
25629
  assertPluginsResolvable(loader, "new issue");
25270
25630
  if (!loader.has("issues")) {
25271
25631
  const failure = loader.loadFailures().find((f) => f.key === "issues");
25272
- return finish([row$6(title, "fail", `the \`issues\` provider is not available${failure ? ` (${describeError(failure.error)})` : ""}`)]);
25632
+ return finish([row$8(title, "fail", `the \`issues\` provider is not available${failure ? ` (${describeError(failure.error)})` : ""}`)]);
25273
25633
  }
25274
25634
  const labels = [.../* @__PURE__ */ new Set([...(input.labels ?? []).map((l) => l.trim()).filter(Boolean), ...prepared.areaLabels])];
25275
25635
  const body = input.body?.trim() ? input.body : void 0;
@@ -25286,7 +25646,7 @@ async function runIssueCreate(input) {
25286
25646
  print(` ${title}`);
25287
25647
  for (const line of body ? body.split("\n").slice(0, PREVIEW_LINES) : []) print(` ${style.skip(line)}`);
25288
25648
  print("");
25289
- return finish([row$6(title, "skip", `would file the issue${summary}`)]);
25649
+ return finish([row$8(title, "skip", `would file the issue${summary}`)]);
25290
25650
  }
25291
25651
  if (!input.yes) {
25292
25652
  if (!(input.interactive ?? Boolean(process.stdin.isTTY))) throw new NonInteractiveError("`new issue` files an issue; pass --yes to run it without asking, or --dry-run to preview");
@@ -25319,12 +25679,12 @@ async function runIssueCreate(input) {
25319
25679
  ...prepared.fields.priority ? { priority: prepared.fields.priority } : {}
25320
25680
  }) : void 0;
25321
25681
  return finish([
25322
- row$6(title, "ok", `filed ${key}`),
25323
- ...(dropped ?? []).map((line) => row$6("not carried across", "skip", line)),
25682
+ row$8(title, "ok", `filed ${key}`),
25683
+ ...(dropped ?? []).map((line) => row$8("not carried across", "skip", line)),
25324
25684
  ...board ? [board] : []
25325
25685
  ], key);
25326
25686
  } catch (err) {
25327
- return finish([row$6(title, "fail", `could not file the issue: ${describeError(err)}`)]);
25687
+ return finish([row$8(title, "fail", `could not file the issue: ${describeError(err)}`)]);
25328
25688
  }
25329
25689
  }
25330
25690
  // src/commands/issue-create/issue-create.command.ts
@@ -25620,7 +25980,7 @@ function readGitConfig(cwd, key, run = runGit) {
25620
25980
  * identity; Effort is asked on a terminal when it was not given (the CLI never chooses it). The issue's key is printed
25621
25981
  * by the first row, before anything else is done, so a failed spec leaves the issue as the anchor to resume from.
25622
25982
  */
25623
- const row$5 = (id, status, detail) => ({
25983
+ const row$7 = (id, status, detail) => ({
25624
25984
  id,
25625
25985
  title: id,
25626
25986
  status,
@@ -25639,7 +25999,7 @@ async function runNewWork(input) {
25639
25999
  const name = specName(input.title, input.specName);
25640
26000
  if (!name) {
25641
26001
  const detail = input.specName === void 0 ? "no spec name can be made from the title; pass --spec <name>" : `"${input.specName}" is not a spec name: use lower-case words joined by hyphens, such as tech-my-topic`;
25642
- const rows = [row$5("spec", "fail", detail)];
26002
+ const rows = [row$7("spec", "fail", detail)];
25643
26003
  printCheckRows(rows, print);
25644
26004
  return {
25645
26005
  status: "fail",
@@ -25648,7 +26008,7 @@ async function runNewWork(input) {
25648
26008
  }
25649
26009
  specPath = join(".notes", `${name}.spec.md`);
25650
26010
  if (io.exists(join(root, specPath))) {
25651
- const rows = [row$5(specPath, "fail", "the spec already exists; it is never overwritten")];
26011
+ const rows = [row$7(specPath, "fail", "the spec already exists; it is never overwritten")];
25652
26012
  printCheckRows(rows, print);
25653
26013
  return {
25654
26014
  status: "fail",
@@ -25658,7 +26018,7 @@ async function runNewWork(input) {
25658
26018
  }
25659
26019
  }
25660
26020
  const assignees = input.assignees && input.assignees.length > 0 ? input.assignees : [gitAssignee(input.gitConfig ?? ((key) => readGitConfig(root, key)))].filter((a) => Boolean(a));
25661
- if (!input.assignees?.length && assignees.length === 0) extra.push(row$5("assignee", "skip", "git config has no GitHub login (`github.user`); pass --assignee to assign the issue"));
26021
+ if (!input.assignees?.length && assignees.length === 0) extra.push(row$7("assignee", "skip", "git config has no GitHub login (`github.user`); pass --assignee to assign the issue"));
25662
26022
  let effort = input.effort;
25663
26023
  const interactive = input.interactive ?? Boolean(process.stdin.isTTY);
25664
26024
  if (!effort && !input.yes && !dryRun && interactive) effort = await (input.askEffort ?? promptEffort)();
@@ -28403,7 +28763,7 @@ const MARKER = "# written by `holocron open requests` for one session and remove
28403
28763
  const SECRETS_FILE = `${PRIVATE_DIR}/requests.env`;
28404
28764
  /** The lock a launch holds, in the private directory. */
28405
28765
  const LOCK_FILE = `${PRIVATE_DIR}/open-requests.lock`;
28406
- const row$4 = (id, status, detail, problems = []) => ({
28766
+ const row$6 = (id, status, detail, problems = []) => ({
28407
28767
  id,
28408
28768
  title: id,
28409
28769
  status,
@@ -28444,7 +28804,7 @@ async function runOpenRequests(input) {
28444
28804
  const tuples = entry?.cardinality === "many" ? entry.tuples : [];
28445
28805
  const chosen = input.to === void 0 ? tuples : tuples.filter((t) => t.provider === input.to);
28446
28806
  if (chosen.length === 0) {
28447
- say(row$4(input.to ?? "tooling", "fail", input.to === void 0 ? "the config has no `tooling` provider to open" : `not a \`tooling\` provider of this config (${tuples.map((t) => t.provider).join(", ")})`));
28807
+ say(row$6(input.to ?? "tooling", "fail", input.to === void 0 ? "the config has no `tooling` provider to open" : `not a \`tooling\` provider of this config (${tuples.map((t) => t.provider).join(", ")})`));
28448
28808
  return finish();
28449
28809
  }
28450
28810
  /* v8 ignore start -- the real loader is only built outside tests, which always inject one */
@@ -28454,7 +28814,7 @@ async function runOpenRequests(input) {
28454
28814
  assertPluginsResolvable(loader, "open requests");
28455
28815
  const openable = (loader.has("tooling") ? loader.get("tooling") : []).filter((t) => chosen.some((tuple) => tuple.provider === t.providerName)).filter((t) => t.open !== void 0);
28456
28816
  if (openable.length !== 1) {
28457
- say(row$4("tooling", "fail", openable.length === 0 ? "no `tooling` provider can open its workspace" : `more than one \`tooling\` provider can open its workspace (${openable.map((t) => t.providerName).join(", ")}); name one with --to`));
28817
+ say(row$6("tooling", "fail", openable.length === 0 ? "no `tooling` provider can open its workspace" : `more than one \`tooling\` provider can open its workspace (${openable.map((t) => t.providerName).join(", ")}); name one with --to`));
28458
28818
  return finish();
28459
28819
  }
28460
28820
  const tool = openable[0];
@@ -28468,34 +28828,34 @@ async function runOpenRequests(input) {
28468
28828
  repoRoot
28469
28829
  });
28470
28830
  } catch (err) {
28471
- say(row$4(tool.providerName, "fail", describeError(err)));
28831
+ say(row$6(tool.providerName, "fail", describeError(err)));
28472
28832
  return finish();
28473
28833
  }
28474
28834
  const loaded = plan.wants.filter((want) => layers.includes(want.layer));
28475
28835
  const notLoaded = plan.wants.filter((want) => !layers.includes(want.layer));
28476
28836
  const names = [...new Set(loaded.map((want) => want.name))].sort();
28477
- if (plan.unfilled.length > 0) say(row$4("unfilled", "skip", `${plan.unfilled.length} secret variable(s) refer to no entry, so nobody fills them`, plan.unfilled));
28478
- say(row$4("layers", notLoaded.length > 0 ? "skip" : "ok", `loaded: ${layers.join(", ")}; not loaded: ${OPEN_LAYERS.filter((layer) => !layers.includes(layer)).join(", ") || "none"}`, notLoaded.map((want) => `${want.collection}: ${want.variable} is a ${want.layer} secret (${want.name}); start with --environment ${want.layer} to load it`)));
28837
+ if (plan.unfilled.length > 0) say(row$6("unfilled", "skip", `${plan.unfilled.length} secret variable(s) refer to no entry, so nobody fills them`, plan.unfilled));
28838
+ say(row$6("layers", notLoaded.length > 0 ? "skip" : "ok", `loaded: ${layers.join(", ")}; not loaded: ${OPEN_LAYERS.filter((layer) => !layers.includes(layer)).join(", ") || "none"}`, notLoaded.map((want) => `${want.collection}: ${want.variable} is a ${want.layer} secret (${want.name}); start with --environment ${want.layer} to load it`)));
28479
28839
  if (dryRun) {
28480
- for (const want of loaded) say(row$4(want.variable, "ok", `would fill ${want.collection}'s ${want.variable} from ${want.entry} of ${want.layer} as ${want.name}`));
28481
- if (names.length === 0) say(row$4("secrets", "ok", "nothing to fill: no variable refers to an entry"));
28482
- else say(row$4("secrets", "ok", `would write ${names.length} value(s) to ${SECRETS_FILE} and link it from ${plan.targets.length} collection(s)`));
28483
- say(row$4(plan.app, "ok", `would start ${plan.launch.command} in the foreground`));
28840
+ for (const want of loaded) say(row$6(want.variable, "ok", `would fill ${want.collection}'s ${want.variable} from ${want.entry} of ${want.layer} as ${want.name}`));
28841
+ if (names.length === 0) say(row$6("secrets", "ok", "nothing to fill: no variable refers to an entry"));
28842
+ else say(row$6("secrets", "ok", `would write ${names.length} value(s) to ${SECRETS_FILE} and link it from ${plan.targets.length} collection(s)`));
28843
+ say(row$6(plan.app, "ok", `would start ${plan.launch.command} in the foreground`));
28484
28844
  return finish();
28485
28845
  }
28486
28846
  if (deps.platform === "win32" && names.length > 0) {
28487
- say(row$4(plan.app, "fail", "cannot make the values file private on Windows: its mode bits are not enforced, and a link needs rights it may lack"));
28847
+ say(row$6(plan.app, "fail", "cannot make the values file private on Windows: its mode bits are not enforced, and a link needs rights it may lack"));
28488
28848
  return finish();
28489
28849
  }
28490
28850
  let running;
28491
28851
  try {
28492
28852
  running = await deps.processes();
28493
28853
  } catch (err) {
28494
- say(row$4(plan.app, "fail", `could not tell whether ${plan.app} is running: ${describeError(err)}`));
28854
+ say(row$6(plan.app, "fail", `could not tell whether ${plan.app} is running: ${describeError(err)}`));
28495
28855
  return finish();
28496
28856
  }
28497
28857
  if (running.split("\n").some((line) => line.includes(plan.running))) {
28498
- say(row$4(plan.app, "fail", `${plan.app} is already running; quit it and run this again (it would not see the values)`));
28858
+ say(row$6(plan.app, "fail", `${plan.app} is already running; quit it and run this again (it would not see the values)`));
28499
28859
  return finish();
28500
28860
  }
28501
28861
  if (!input.yes) {
@@ -28512,7 +28872,7 @@ async function runOpenRequests(input) {
28512
28872
  if (names.length > 0) {
28513
28873
  const vault = loader.has("vault") ? loader.get("vault") : void 0;
28514
28874
  if (!vault?.readEnvironmentEntries) {
28515
- say(row$4("vault", "fail", vault ? `${vault.providerName} cannot read an Environment's entries` : "needs a `vault` provider in holocron.config.ts (1password)"));
28875
+ say(row$6("vault", "fail", vault ? `${vault.providerName} cannot read an Environment's entries` : "needs a `vault` provider in holocron.config.ts (1password)"));
28516
28876
  return finish();
28517
28877
  }
28518
28878
  let failed = false;
@@ -28529,17 +28889,17 @@ async function runOpenRequests(input) {
28529
28889
  names: [...new Set(wanted.map((want) => want.entry))].sort()
28530
28890
  });
28531
28891
  } catch (err) {
28532
- say(row$4(`vault ${layer}`, "fail", describeError(err)));
28892
+ say(row$6(`vault ${layer}`, "fail", describeError(err)));
28533
28893
  failed = true;
28534
28894
  continue;
28535
28895
  }
28536
28896
  for (const entry of read.missing) {
28537
- say(row$4(`${layer} ${entry}`, "fail", `${read.environmentId} holds no value for ${entry}`));
28897
+ say(row$6(`${layer} ${entry}`, "fail", `${read.environmentId} holds no value for ${entry}`));
28538
28898
  failed = true;
28539
28899
  }
28540
28900
  if (read.missing.length > 0) continue;
28541
28901
  for (const want of wanted) values.set(want.name, read.values.get(want.entry));
28542
- say(row$4(`vault ${read.environmentId}`, "ok", `${wanted.length} value(s) read: ${[...new Set(wanted.map((want) => want.name))].join(", ")}`));
28902
+ say(row$6(`vault ${read.environmentId}`, "ok", `${wanted.length} value(s) read: ${[...new Set(wanted.map((want) => want.name))].join(", ")}`));
28543
28903
  }
28544
28904
  if (failed) return finish();
28545
28905
  }
@@ -28559,7 +28919,7 @@ async function runOpenRequests(input) {
28559
28919
  };
28560
28920
  deps.makeDir(dirname(secrets));
28561
28921
  if (!deps.takeLock(lock, deps.pid)) {
28562
- say(row$4(plan.app, "fail", `another \`open requests\` is starting ${plan.app} (${LOCK_FILE} is held); try again when it has`));
28922
+ say(row$6(plan.app, "fail", `another \`open requests\` is starting ${plan.app} (${LOCK_FILE} is held); try again when it has`));
28563
28923
  return finish();
28564
28924
  }
28565
28925
  const stop = deps.onTerminate(cleanup);
@@ -28567,18 +28927,18 @@ async function runOpenRequests(input) {
28567
28927
  if (names.length > 0) {
28568
28928
  const ignored = deps.isIgnored(secrets);
28569
28929
  if (ignored === "tracked" || ignored === "unknown") {
28570
- say(row$4("values file", "fail", `refusing to write ${SECRETS_FILE}: git ${ignored === "tracked" ? "does not ignore it, so it could be committed" : "could not say whether it ignores it"}`, [ignoreAdvice(true, "")]));
28930
+ say(row$6("values file", "fail", `refusing to write ${SECRETS_FILE}: git ${ignored === "tracked" ? "does not ignore it, so it could be committed" : "could not say whether it ignores it"}`, [ignoreAdvice(true, "")]));
28571
28931
  return finish();
28572
28932
  }
28573
28933
  const stale = deps.inspect(secrets);
28574
28934
  if (stale.kind !== "none" && !(stale.kind === "file" && stale.firstLine === "# written by `holocron open requests` for one session and removed when it ends")) {
28575
- say(row$4("values file", "fail", `${SECRETS_FILE} is not this command's (no marker line); move it away`));
28935
+ say(row$6("values file", "fail", `${SECRETS_FILE} is not this command's (no marker line); move it away`));
28576
28936
  return finish();
28577
28937
  }
28578
28938
  for (const link of plan.targets) {
28579
28939
  const state = deps.inspect(link);
28580
28940
  if (state.kind !== "none" && !isOurs(state, link, secrets)) {
28581
- say(row$4("link", "fail", `${relative(repoRoot, link)} exists and is not this command's (it is not a link to ${SECRETS_FILE}, and has no marker line); move it away`));
28941
+ say(row$6("link", "fail", `${relative(repoRoot, link)} exists and is not this command's (it is not a link to ${SECRETS_FILE}, and has no marker line); move it away`));
28582
28942
  return finish();
28583
28943
  }
28584
28944
  }
@@ -28586,7 +28946,7 @@ async function runOpenRequests(input) {
28586
28946
  for (const [name, value] of values) {
28587
28947
  const line = dotenvLine(name, value);
28588
28948
  if (line === null) {
28589
- say(row$4(name, "fail", `the value of ${name} cannot be written to a .env file as it is; it was not written`));
28949
+ say(row$6(name, "fail", `the value of ${name} cannot be written to a .env file as it is; it was not written`));
28590
28950
  return finish();
28591
28951
  }
28592
28952
  lines.push(line);
@@ -28599,7 +28959,7 @@ async function runOpenRequests(input) {
28599
28959
  deps.symlink(relative(dirname(link), secrets), link);
28600
28960
  created.push(link);
28601
28961
  }
28602
- say(row$4("values file", "ok", `${SECRETS_FILE} (mode 0600, git-ignored) linked from ${plan.targets.map((t) => relative(repoRoot, t)).join(", ")}`));
28962
+ say(row$6("values file", "ok", `${SECRETS_FILE} (mode 0600, git-ignored) linked from ${plan.targets.map((t) => relative(repoRoot, t)).join(", ")}`));
28603
28963
  }
28604
28964
  print("");
28605
28965
  print(`starting ${plan.app}${names.length > 0 ? `; the values are removed when it quits (Ctrl-C ends it too)` : ""}`);
@@ -28607,10 +28967,10 @@ async function runOpenRequests(input) {
28607
28967
  try {
28608
28968
  exitCode = await deps.run(plan.launch);
28609
28969
  } catch (err) {
28610
- say(row$4(plan.app, "fail", describeError(err)));
28970
+ say(row$6(plan.app, "fail", describeError(err)));
28611
28971
  return finish();
28612
28972
  }
28613
- say(row$4(plan.app, exitCode === 0 ? "ok" : "fail", `ended with ${exitCode}`));
28973
+ say(row$6(plan.app, exitCode === 0 ? "ok" : "fail", `ended with ${exitCode}`));
28614
28974
  return finish();
28615
28975
  } finally {
28616
28976
  stop();
@@ -32490,11 +32850,380 @@ const projectReconcileCommand = {
32490
32850
  })).status === "fail") process.exitCode = 1;
32491
32851
  }
32492
32852
  };
32853
+ // src/commands/reconcile-ci/run-reconcile-ci/run-reconcile-ci.ts
32854
+ /**
32855
+ * `holocron reconcile ci [pull-request]` — make the `ci / Required checks` check say what the state calls for.
32856
+ *
32857
+ * It is the manual tool and the scheduled sweep of spec `process-sentinel-posts-ci` (SPEC-0099): for each open pull
32858
+ * request (or the one named) it reads the check runs and commit statuses of the head commit through the `source`
32859
+ * provider and calls astromech's `postAggregate()`, the one function Sentinel's webhook handler uses too. A pull request
32860
+ * whose check already says the verdict is left alone, so a healthy run writes nothing; one with no check, or one that
32861
+ * disagrees, is posted. A pull request that was missing or wrong and had waited longer than `--max-age` is a failing
32862
+ * row, because that is what a missed delivery looks like; one younger than that is still in flight and only reported.
32863
+ *
32864
+ * It posts the real `ci / Required checks` only where the checkout's `ci.aggregate` is `sentinel`: while it is
32865
+ * `actions` the Actions job is the poster and a second writer would be a second poster, so the command does nothing
32866
+ * unless `--shadow` asks it to repair Sentinel's shadow check. A run on a commit where another app (the Actions
32867
+ * job) already posts the check leaves it alone.
32868
+ *
32869
+ * `expected` comes from the config of the checkout it runs in. The sweep runs from the default branch, which is the
32870
+ * base of the pull requests it repairs, so a pull request cannot shrink its own gate. `--dry-run` reads and prints what
32871
+ * it would do and posts nothing.
32872
+ */
32873
+ const DEFAULT_MAX_AGE_MINUTES = 10;
32874
+ const row$5 = (id, status, detail) => ({
32875
+ id,
32876
+ title: id,
32877
+ status,
32878
+ detail,
32879
+ problems: []
32880
+ });
32881
+ /** The `source` methods the sweep needs, all of them optional on the capability. */
32882
+ function missingMethods(source) {
32883
+ return [
32884
+ "listCheckRuns",
32885
+ "listCommitStatuses",
32886
+ "createCheckRun",
32887
+ "updateCheckRun"
32888
+ ].filter((name) => typeof source[name] !== "function");
32889
+ }
32890
+ /** Runs `holocron reconcile ci`; see the file's comment. */
32891
+ async function runReconcileCi(input) {
32892
+ /* v8 ignore next -- the console is only used outside tests, which inject `print` */
32893
+ const print = input.print ?? ((line) => console.log(line));
32894
+ const logger = input.logger ?? getLogger();
32895
+ const now = input.now ?? Date.now;
32896
+ const dryRun = Boolean(input.context.dryRun);
32897
+ const rows = [];
32898
+ const finish = () => {
32899
+ printCheckRows(rows, print);
32900
+ const summary = summariseChecks(rows);
32901
+ printCheckSummary(summary, print);
32902
+ const status = summary.fail > 0 ? "fail" : "ok";
32903
+ logger.info({
32904
+ ...summary,
32905
+ status
32906
+ }, "reconcile ci");
32907
+ return {
32908
+ status,
32909
+ rows
32910
+ };
32911
+ };
32912
+ const fail = (id, detail) => {
32913
+ rows.push(row$5(id, "fail", detail));
32914
+ return finish();
32915
+ };
32916
+ print(style.header(`Holocron reconcile ci${dryRun ? " (dry-run)" : ""}`));
32917
+ print("");
32918
+ if (input.maxAgeMinutes !== void 0 && !(input.maxAgeMinutes > 0)) return fail("max-age", "--max-age is a number of minutes above zero");
32919
+ if (!input.shadow && aggregatePoster({ ci: input.loaded.resolved.ci }) === "actions") {
32920
+ rows.push(row$5("ci.aggregate", "skip", `ci.aggregate is actions here, so the Actions job posts ${AGGREGATE_CHECK_NAME} and nothing is posted; --shadow repairs Sentinel's shadow check`));
32921
+ return finish();
32922
+ }
32923
+ const providers = input.loaded.resolved.providers;
32924
+ if (!providers.source) return fail("source", "the config has no `source` provider to read and post the checks with");
32925
+ /* v8 ignore start -- the real loader is only built outside tests, which always inject one */
32926
+ const loader = input.loader ?? new PluginLoader({
32927
+ ...input.loaded.resolved,
32928
+ providers: {
32929
+ source: providers.source,
32930
+ ...providers.credentials ? { credentials: providers.credentials } : {}
32931
+ }
32932
+ }, input.context);
32933
+ /* v8 ignore stop */
32934
+ await loader.load();
32935
+ assertPluginsResolvable(loader, "reconcile ci");
32936
+ if (!loader.has("source")) {
32937
+ const failure = loader.loadFailures().find((f) => f.key === "source");
32938
+ return fail("source", `the \`source\` provider is not available${failure ? ` (${describeError(failure.error)})` : ""}`);
32939
+ }
32940
+ const source = loader.get("source");
32941
+ const lacking = missingMethods(source);
32942
+ if (lacking.length > 0) return fail("source", `the \`${source.providerName}\` provider cannot ${lacking.join(", ")}`);
32943
+ const config = input.loaded.resolved;
32944
+ const tasksConfig = { tasks: config.tasks ?? [] };
32945
+ if (config.extraRequiredChecks) tasksConfig.extraRequiredChecks = config.extraRequiredChecks;
32946
+ const { expected, statuses } = aggregateChecks(tasksConfig);
32947
+ let pullRequests;
32948
+ try {
32949
+ if (input.pullRequest !== void 0) {
32950
+ if (!source.getPullRequest) return fail("pull requests", `the \`${source.providerName}\` provider cannot read a pull request`);
32951
+ pullRequests = [await source.getPullRequest(input.pullRequest)];
32952
+ } else {
32953
+ if (!source.listPullRequests) return fail("pull requests", `the \`${source.providerName}\` provider cannot list pull requests`);
32954
+ pullRequests = await source.listPullRequests("open");
32955
+ }
32956
+ } catch (error) {
32957
+ return fail("pull requests", describeError(error));
32958
+ }
32959
+ if (pullRequests.length === 0) {
32960
+ rows.push(row$5("pull requests", "skip", "no open pull requests"));
32961
+ return finish();
32962
+ }
32963
+ const api = {
32964
+ listCheckRuns: (sha) => source.listCheckRuns(sha),
32965
+ listCommitStatuses: (sha) => source.listCommitStatuses(sha),
32966
+ createCheckRun: (sha, name, write) => source.createCheckRun(sha, name, write),
32967
+ updateCheckRun: (id, write) => source.updateCheckRun(id, write)
32968
+ };
32969
+ const graceMs = (input.maxAgeMinutes ?? DEFAULT_MAX_AGE_MINUTES) * 6e4;
32970
+ for (const pr of pullRequests) {
32971
+ const id = `#${pr.number}`;
32972
+ if (pr.headSha === void 0) {
32973
+ rows.push(row$5(id, "skip", "the provider gave no head commit"));
32974
+ continue;
32975
+ }
32976
+ try {
32977
+ const out = await postAggregate({
32978
+ api,
32979
+ sha: pr.headSha,
32980
+ expected,
32981
+ statuses,
32982
+ now: now(),
32983
+ graceMs,
32984
+ dryRun,
32985
+ name: input.shadow ? AGGREGATE_SHADOW_CHECK_NAME : AGGREGATE_CHECK_NAME
32986
+ });
32987
+ const verdict = out.result.conclusion;
32988
+ if (out.action === "foreign") rows.push(row$5(id, "skip", "another app (the Actions job) already posts this check on the commit; left alone"));
32989
+ else if (out.action === "unchanged") rows.push(row$5(id, "ok", `up to date (${verdict})`));
32990
+ else if (out.stale) {
32991
+ const what = dryRun ? "would repair" : "repaired";
32992
+ rows.push(row$5(id, "fail", `${what}: the check was missing or wrong (now ${verdict}); a delivery was missed`));
32993
+ } else {
32994
+ const what = dryRun ? "would post" : "posted";
32995
+ rows.push(row$5(id, "ok", `${what} ${verdict} (still in flight)`));
32996
+ }
32997
+ } catch (error) {
32998
+ rows.push(row$5(id, "fail", describeError(error)));
32999
+ }
33000
+ }
33001
+ return finish();
33002
+ }
33003
+ // src/commands/reconcile-ci/reconcile-ci.command.ts
33004
+ const reconcileCiCommand = {
33005
+ command: "ci [pull-request]",
33006
+ describe: "Make the ci / Required checks check say what the checks on each open pull request call for (the manual path and the sweep)",
33007
+ builder: (y) => y.positional("pull-request", {
33008
+ type: "number",
33009
+ describe: "Reconcile only this pull request (default: every open one)"
33010
+ }).option("shadow", {
33011
+ type: "boolean",
33012
+ describe: "Repair Sentinel's shadow check (ci / Required checks (sentinel)) instead of the real one; the only way to post while ci.aggregate is actions"
33013
+ }).option("max-age", {
33014
+ type: "number",
33015
+ describe: "Minutes a missing or unfinished aggregate may wait before it counts as a missed delivery and fails the run (default 10)"
33016
+ }),
33017
+ handler: async (argv) => {
33018
+ const tokens = tokenContext(argv.token);
33019
+ if (!tokens) return;
33020
+ const loaded = await loadConfig(argv.cwd);
33021
+ applyResolvedConfig(argv, loaded.resolved);
33022
+ if ((await runReconcileCi({
33023
+ loaded,
33024
+ context: {
33025
+ repoRoot: argv.cwd,
33026
+ dryRun: argv.dryRun,
33027
+ ...tokens,
33028
+ org: resolveOrg(argv, loaded.resolved)
33029
+ },
33030
+ ...argv["pull-request"] !== void 0 ? { pullRequest: Number(argv["pull-request"]) } : {},
33031
+ ...argv["max-age"] !== void 0 ? { maxAgeMinutes: Number(argv["max-age"]) } : {},
33032
+ ...argv.shadow ? { shadow: true } : {}
33033
+ })).status === "fail") process.exitCode = 1;
33034
+ }
33035
+ };
32493
33036
  // src/commands/reconcile/reconcile.command.ts
32494
33037
  const reconcileCommand = {
32495
33038
  command: "reconcile",
32496
- describe: "Set project board item statuses where a rule says so",
32497
- builder: (y) => y.command(projectReconcileCommand).command(groupMenu("reconcile")),
33039
+ describe: "Set project board item statuses where a rule says so, or bring the ci check up to date",
33040
+ builder: (y) => y.command(projectReconcileCommand).command(reconcileCiCommand).command(groupMenu("reconcile")),
33041
+ handler: () => {}
33042
+ };
33043
+ // src/commands/sync-issues/parse-since/parse-since.ts
33044
+ const UNITS = {
33045
+ m: 6e4,
33046
+ h: 36e5,
33047
+ d: 864e5,
33048
+ w: 6048e5
33049
+ };
33050
+ /**
33051
+ * Turns the `--since` value into an ISO timestamp: a date or date and time (`2026-03-01`, `2026-03-01T09:00:00Z`) or a
33052
+ * span back from `now` (`30m`, `12h`, `7d`, `2w`). Anything else is a `ConfigError`, so a typo never reads as "all".
33053
+ */
33054
+ function parseSince(value, now = Date.now()) {
33055
+ const span = /^(\d+)([mhdw])$/.exec(value.trim());
33056
+ if (span) return new Date(now - Number(span[1]) * UNITS[span[2]]).toISOString();
33057
+ const at = Date.parse(value);
33058
+ if (Number.isNaN(at)) throw new ConfigError(`sync issues: --since "${value}" is not a date or a span like 30m, 12h, 7d or 2w`);
33059
+ return new Date(at).toISOString();
33060
+ }
33061
+ // src/commands/redeliver-webhooks/run-redeliver-webhooks/run-redeliver-webhooks.ts
33062
+ /**
33063
+ * `holocron redeliver webhooks [--since <time>] [--app <name>] [--dry-run] [--yes]` — the recovery step after a Sentinel
33064
+ * outage (spec `process-sentinel-posts-ci`, SPEC-0099, recovery 2).
33065
+ *
33066
+ * For each registered GitHub App instance it reads the App's webhook delivery log with the App's own JWT, keeps the
33067
+ * deliveries whose latest attempt did not succeed (`failedDeliveries()`), and asks GitHub to deliver each one again, oldest
33068
+ * first and once. It repairs every Sentinel handler (the `#prs` feed, board status, role sync, the checks, the `ci`
33069
+ * aggregate), not only the aggregate, and replaying is safe because each handler recomputes from the API. It never
33070
+ * reaches a delivery that was never attempted, and GitHub keeps the log only for a limited time.
33071
+ *
33072
+ * The App's id and key are read in memory from its vault environment, as `doctor github-app` reads them, and never
33073
+ * printed. It asks once before redelivering unless `--yes`; without a terminal that is a `NonInteractiveError`, except on
33074
+ * `--dry-run`, which lists what it would redeliver and calls nothing that writes.
33075
+ */
33076
+ const DEFAULT_SINCE = "1d";
33077
+ const defaultApi = {
33078
+ listAppDeliveries,
33079
+ redeliverAppDelivery
33080
+ };
33081
+ const row$4 = (id, status, detail) => ({
33082
+ id,
33083
+ title: id,
33084
+ status,
33085
+ detail,
33086
+ problems: []
33087
+ });
33088
+ /** Runs `holocron redeliver webhooks`; see the file's comment. */
33089
+ async function runRedeliverWebhooks(input) {
33090
+ /* v8 ignore next -- the console is only used outside tests, which inject `print` */
33091
+ const print = input.print ?? ((line) => console.log(line));
33092
+ const logger = input.logger ?? getLogger();
33093
+ /* v8 ignore next -- the real GitHub calls are only used outside tests, which inject `api` */
33094
+ const api = input.api ?? defaultApi;
33095
+ const dryRun = Boolean(input.context.dryRun);
33096
+ const rows = [];
33097
+ const finish = () => {
33098
+ printCheckRows(rows, print);
33099
+ const summary = summariseChecks(rows);
33100
+ printCheckSummary(summary, print);
33101
+ const status = summary.fail > 0 ? "fail" : "ok";
33102
+ logger.info({
33103
+ ...summary,
33104
+ status
33105
+ }, "redeliver webhooks");
33106
+ return {
33107
+ status,
33108
+ rows
33109
+ };
33110
+ };
33111
+ const fail = (id, detail) => {
33112
+ rows.push(row$4(id, "fail", detail));
33113
+ return finish();
33114
+ };
33115
+ print(style.header(`Holocron redeliver webhooks${dryRun ? " (dry-run)" : ""}`));
33116
+ print("");
33117
+ let since;
33118
+ try {
33119
+ since = parseSince(input.since ?? DEFAULT_SINCE, (input.now ?? Date.now)());
33120
+ } catch (error) {
33121
+ return fail("since", describeError(error).replace(/^sync issues: /, ""));
33122
+ }
33123
+ const all = input.loaded.resolved.githubApps ?? [];
33124
+ if (all.length === 0) {
33125
+ rows.push(row$4("github-app", "skip", "no `githubApps` are declared in holocron.config.ts"));
33126
+ return finish();
33127
+ }
33128
+ const instances = input.app === void 0 ? all : all.filter((instance) => instance.name === input.app);
33129
+ if (instances.length === 0) return fail("app", `no \`githubApps\` entry is named "${input.app}" (${all.map((i) => i.name).join(", ")})`);
33130
+ /* v8 ignore start -- the real loader is only built outside tests, which always inject one */
33131
+ const loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);
33132
+ /* v8 ignore stop */
33133
+ await loader.load();
33134
+ assertPluginsResolvable(loader, "redeliver webhooks");
33135
+ const pending = [];
33136
+ for (const instance of instances) {
33137
+ const read = await readAppCredentials(instance, loader);
33138
+ if ("reason" in read) {
33139
+ rows.push(row$4(`${instance.name}`, "skip", read.reason));
33140
+ continue;
33141
+ }
33142
+ try {
33143
+ const failed = failedDeliveries(await api.listAppDeliveries(read.creds, { since }));
33144
+ if (failed.length === 0) rows.push(row$4(instance.name, "ok", `no failed deliveries since ${since}`));
33145
+ for (const delivery of failed) pending.push({
33146
+ app: instance.name,
33147
+ creds: read.creds,
33148
+ delivery
33149
+ });
33150
+ } catch (error) {
33151
+ rows.push(row$4(instance.name, "fail", `cannot read the delivery log: ${scrubbed$1(error, [read.creds.privateKey])}`));
33152
+ }
33153
+ }
33154
+ if (pending.length === 0) return finish();
33155
+ const label = ({ app, delivery }) => {
33156
+ const what = delivery.action === null ? delivery.event : `${delivery.event}.${delivery.action}`;
33157
+ return {
33158
+ id: `${app}:${delivery.id}`,
33159
+ text: `${what} of ${delivery.deliveredAt} (${delivery.status || `status ${delivery.statusCode}`})`
33160
+ };
33161
+ };
33162
+ if (dryRun) {
33163
+ for (const item of pending) rows.push(row$4(label(item).id, "skip", `would redeliver ${label(item).text}`));
33164
+ return finish();
33165
+ }
33166
+ /* v8 ignore next -- the terminal is only asked outside tests, which inject `interactive` */
33167
+ const interactive = input.interactive ?? Boolean(process.stdin.isTTY);
33168
+ if (!input.yes && !interactive) throw new NonInteractiveError("`redeliver webhooks` asks GitHub to deliver webhooks again; pass --yes to run it without asking, or --dry-run to preview");
33169
+ /* v8 ignore next -- inquirer only runs outside tests, which inject `confirm` */
33170
+ const ask = input.confirm ?? ((message) => confirm({
33171
+ message,
33172
+ default: false
33173
+ }));
33174
+ if (!input.yes && !await ask(`Redeliver ${pending.length} failed webhook deliver${pending.length === 1 ? "y" : "ies"}?`)) {
33175
+ rows.push(row$4("redeliver", "skip", "not confirmed; nothing was redelivered"));
33176
+ return finish();
33177
+ }
33178
+ for (const item of pending) {
33179
+ const { id, text } = label(item);
33180
+ try {
33181
+ await api.redeliverAppDelivery(item.creds, item.delivery.id);
33182
+ rows.push(row$4(id, "ok", `redelivered ${text}`));
33183
+ } catch (error) {
33184
+ rows.push(row$4(id, "fail", scrubbed$1(error, [item.creds.privateKey])));
33185
+ }
33186
+ }
33187
+ return finish();
33188
+ }
33189
+ // src/commands/redeliver-webhooks/redeliver-webhooks.command.ts
33190
+ const redeliverWebhooksCommand = {
33191
+ command: "webhooks",
33192
+ describe: "Ask GitHub to deliver again the webhooks each registered App's endpoint did not accept (the recovery step after a Sentinel outage)",
33193
+ builder: (y) => y.option("since", {
33194
+ type: "string",
33195
+ describe: "How far back to look: a span (30m, 12h, 7d, 2w) or a date (default 1d)"
33196
+ }).option("app", {
33197
+ type: "string",
33198
+ describe: "Only this githubApps instance, by name"
33199
+ }).option("yes", {
33200
+ type: "boolean",
33201
+ describe: "Redeliver without asking (required without a terminal)"
33202
+ }),
33203
+ handler: async (argv) => {
33204
+ const tokens = tokenContext(argv.token);
33205
+ if (!tokens) return;
33206
+ const loaded = await loadConfig(argv.cwd);
33207
+ applyResolvedConfig(argv, loaded.resolved);
33208
+ if ((await runRedeliverWebhooks({
33209
+ loaded,
33210
+ context: {
33211
+ repoRoot: argv.cwd,
33212
+ dryRun: argv.dryRun,
33213
+ ...tokens,
33214
+ org: resolveOrg(argv, loaded.resolved)
33215
+ },
33216
+ ...argv.since !== void 0 ? { since: String(argv.since) } : {},
33217
+ ...argv.app !== void 0 ? { app: String(argv.app) } : {},
33218
+ ...argv.yes ? { yes: true } : {}
33219
+ })).status === "fail") process.exitCode = 1;
33220
+ }
33221
+ };
33222
+ // src/commands/redeliver/redeliver.command.ts
33223
+ const redeliverCommand = {
33224
+ command: "redeliver",
33225
+ describe: "Deliver again what a GitHub App's endpoint did not accept",
33226
+ builder: (y) => y.command(redeliverWebhooksCommand).command(groupMenu("redeliver")),
32498
33227
  handler: () => {}
32499
33228
  };
32500
33229
  // src/commands/auth/auth-unset.args.ts
@@ -34165,24 +34894,6 @@ const syncGithubCommand = {
34165
34894
  })).status === "fail") process.exitCode = 1;
34166
34895
  }
34167
34896
  };
34168
- // src/commands/sync-issues/parse-since/parse-since.ts
34169
- const UNITS = {
34170
- m: 6e4,
34171
- h: 36e5,
34172
- d: 864e5,
34173
- w: 6048e5
34174
- };
34175
- /**
34176
- * Turns the `--since` value into an ISO timestamp: a date or date and time (`2026-03-01`, `2026-03-01T09:00:00Z`) or a
34177
- * span back from `now` (`30m`, `12h`, `7d`, `2w`). Anything else is a `ConfigError`, so a typo never reads as "all".
34178
- */
34179
- function parseSince(value, now = Date.now()) {
34180
- const span = /^(\d+)([mhdw])$/.exec(value.trim());
34181
- if (span) return new Date(now - Number(span[1]) * UNITS[span[2]]).toISOString();
34182
- const at = Date.parse(value);
34183
- if (Number.isNaN(at)) throw new ConfigError(`sync issues: --since "${value}" is not a date or a span like 30m, 12h, 7d or 2w`);
34184
- return new Date(at).toISOString();
34185
- }
34186
34897
  // src/commands/sync-issues/assignees-location/assignees-location.ts
34187
34898
  /** Where the assignees file is: the org's private config repo, as the Discord links file is. */
34188
34899
  function assigneesLocation(org) {
@@ -36618,6 +37329,7 @@ const COMMAND_MODULES = [
36618
37329
  deployCommand,
36619
37330
  resolveCommand,
36620
37331
  reconcileCommand,
37332
+ redeliverCommand,
36621
37333
  projectCommand
36622
37334
  ];
36623
37335
  // src/cli/own-package-json.ts