@theholocron/cli 5.0.0-alpha.462 → 5.0.0-alpha.464

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
@@ -259,13 +259,14 @@ const cleanupPreviewEntry = {
259
259
  flag: "--project",
260
260
  type: "input",
261
261
  required: true,
262
- message: "Cloudflare Pages project name (e.g. theholocron-preview):"
262
+ message: "Deployment project (a Cloudflare Pages project name such as theholocron-preview, or a Vercel project):"
263
263
  }],
264
264
  skipOptions: [
265
265
  "project-id",
266
266
  "target",
267
267
  "files",
268
- "repo"
268
+ "repo",
269
+ "yes"
269
270
  ],
270
271
  supportsDryRun: true
271
272
  };
@@ -1037,7 +1038,7 @@ const providerEntry = {
1037
1038
  supportsDryRun: false
1038
1039
  };
1039
1040
  // src/commands/publish/publish.entry.ts
1040
- const env$10 = createEnvLookup();
1041
+ const env$11 = createEnvLookup();
1041
1042
  const PUBLISH_TAG_OPTION = {
1042
1043
  key: "tag",
1043
1044
  flag: "--tag",
@@ -1050,7 +1051,7 @@ const PUBLISH_OTP_OPTION = {
1050
1051
  type: "password",
1051
1052
  secret: true,
1052
1053
  askLast: true,
1053
- required: Boolean(env$10.get("HOLOCRON_NPM_ENFORCE_2FA")),
1054
+ required: Boolean(env$11.get("HOLOCRON_NPM_ENFORCE_2FA")),
1054
1055
  message: "One-time password (2FA), if npm requires it for this publish:"
1055
1056
  };
1056
1057
  const publishEntry = {
@@ -1740,7 +1741,7 @@ const menuCommand = (version) => ({
1740
1741
  * traces, errors, structured context that routes to Axiom. It runs in
1741
1742
  * parallel to `print` (user-facing UX output) and does not replace it.
1742
1743
  */
1743
- const env$9 = createEnvLookup();
1744
+ const env$10 = createEnvLookup();
1744
1745
  const holocron = holocronEnv();
1745
1746
  /**
1746
1747
  * The CLI's Axiom dataset (`holocron`; each service has its own): the process environment (`HOLOCRON_AXIOM_DATASET`, then the unprefixed `AXIOM_DATASET`,
@@ -1768,7 +1769,7 @@ function resolveCliAxiom(opts, ctx) {
1768
1769
  if (fromEnv) return fromEnv;
1769
1770
  const dataset = resolveCliDataset(opts, contextForCommand(ctx.command ?? "") === "global");
1770
1771
  if (!dataset) return void 0;
1771
- const org = opts.org ?? env$9.get(`${PREFIX$1}_ORG`);
1772
+ const org = opts.org ?? env$10.get(`${PREFIX$1}_ORG`);
1772
1773
  const token = holocron.get("AXIOM_TOKEN") || (org ? keyring.get(`axiom.${org}`) : null) || keyring.get("axiom");
1773
1774
  return token ? {
1774
1775
  dataset,
@@ -1794,7 +1795,7 @@ const getRunId = logger.getRunId;
1794
1795
  logger.resetCliLogger;
1795
1796
  logger.resolveLogLevel;
1796
1797
  // src/observability/resolve-telemetry/resolve-telemetry.ts
1797
- const env$8 = holocronEnv();
1798
+ const env$9 = holocronEnv();
1798
1799
  /**
1799
1800
  * Holocron-specific credential resolution for the telemetry sinks — the env
1800
1801
  * chain plus Holocron's own shipped fallbacks. This is **CLI policy**, not part
@@ -1818,15 +1819,15 @@ const FALLBACK_POSTHOG_PROJECT_TOKEN = "phc_AC4vFCvYzwnzmG7Vg5nEc3PZKZztoPyfKp4L
1818
1819
  const DEFAULT_POSTHOG_HOST = "https://us.i.posthog.com";
1819
1820
  /** Resolve the Sentry DSN. `""` → error telemetry disabled. */
1820
1821
  function resolveDsn() {
1821
- return env$8.get("SENTRY_DSN") ?? FALLBACK_DSN;
1822
+ return env$9.get("SENTRY_DSN") ?? FALLBACK_DSN;
1822
1823
  }
1823
1824
  /** Resolve the PostHog project key. `""` → usage analytics disabled. */
1824
1825
  function resolvePostHogKey() {
1825
- return env$8.get("POSTHOG_PROJECT_TOKEN") ?? FALLBACK_POSTHOG_PROJECT_TOKEN;
1826
+ return env$9.get("POSTHOG_PROJECT_TOKEN") ?? FALLBACK_POSTHOG_PROJECT_TOKEN;
1826
1827
  }
1827
1828
  /** Resolve the PostHog ingest host. */
1828
1829
  function resolvePostHogHost() {
1829
- return env$8.get("POSTHOG_HOST") ?? DEFAULT_POSTHOG_HOST;
1830
+ return env$9.get("POSTHOG_HOST") ?? DEFAULT_POSTHOG_HOST;
1830
1831
  }
1831
1832
  // src/observability/telemetry/telemetry.ts
1832
1833
  /**
@@ -2855,7 +2856,7 @@ function resolvedEnvironment(entry) {
2855
2856
  return entry.environment;
2856
2857
  }
2857
2858
  // src/commands/resolve-org/resolve-org.ts
2858
- const env$7 = createEnvLookup();
2859
+ const env$8 = createEnvLookup();
2859
2860
  /**
2860
2861
  * Resolves the active org in priority order:
2861
2862
  * 1. `--org` CLI flag
@@ -2863,7 +2864,7 @@ const env$7 = createEnvLookup();
2863
2864
  * 3. `org` from `holocron.config.ts`
2864
2865
  */
2865
2866
  function resolveOrg(argv, config) {
2866
- return argv.org ?? env$7.get("HOLOCRON_ORG") ?? config.org;
2867
+ return argv.org ?? env$8.get("HOLOCRON_ORG") ?? config.org;
2867
2868
  }
2868
2869
  // src/commands/apply-resolved-config/apply-resolved-config.ts
2869
2870
  /**
@@ -5122,7 +5123,7 @@ async function runClone(input) {
5122
5123
  };
5123
5124
  }
5124
5125
  // src/commands/clone/clone.command.ts
5125
- const env$6 = createEnvLookup();
5126
+ const env$7 = createEnvLookup();
5126
5127
  const resolveCloneToken = createFeatureResolver({
5127
5128
  envName: "HOLOCRON_READ_TOKEN",
5128
5129
  keyringKey: "github.read"
@@ -5160,7 +5161,7 @@ const cloneCommand = {
5160
5161
  } } : {},
5161
5162
  confirmOpen: async (openTarget, moreToCome) => {
5162
5163
  if (!process.stdin.isTTY) return;
5163
- if (moreToCome && env$6.get(DRY_RUN_PREVIEW_ENV_VAR) === "1") return;
5164
+ if (moreToCome && env$7.get(DRY_RUN_PREVIEW_ENV_VAR) === "1") return;
5164
5165
  if (await confirm({
5165
5166
  message: `Open ${openTarget}?`,
5166
5167
  default: false
@@ -5170,7 +5171,7 @@ const cloneCommand = {
5170
5171
  if (report.status === "fail") {
5171
5172
  if (report.message) reportError(`clone: ${report.message}`);
5172
5173
  process.exitCode = 1;
5173
- } else if (report.status === "dry-run" && report.cloned === 0 && env$6.get(DRY_RUN_PREVIEW_ENV_VAR) === "1") process.exitCode = DRY_RUN_NOOP_EXIT_CODE;
5174
+ } else if (report.status === "dry-run" && report.cloned === 0 && env$7.get(DRY_RUN_PREVIEW_ENV_VAR) === "1") process.exitCode = DRY_RUN_NOOP_EXIT_CODE;
5174
5175
  }
5175
5176
  };
5176
5177
  // src/commands/project/project-options/project-options.ts
@@ -5400,6 +5401,10 @@ const cleanupPreviewArgs = (y) => y.positional("pr", {
5400
5401
  }).option("repo", {
5401
5402
  type: "string",
5402
5403
  describe: "GitHub repo as owner/name — defaults to the repo in holocron.config"
5404
+ }).option("yes", {
5405
+ type: "boolean",
5406
+ default: false,
5407
+ describe: "Delete every preview deployment found without asking (for CI). Refuses a pull request that is still open."
5403
5408
  });
5404
5409
  // src/commands/cleanup-preview/cleanup-preview.ts
5405
5410
  function prStateLabel(pr) {
@@ -5433,7 +5438,7 @@ async function runCleanupPreview(input) {
5433
5438
  print(`${style.header(`PR #${pr.number}`)} — ${pr.title}`);
5434
5439
  print(` Status : ${prStateLabel(pr)} | Branch : ${style.dim(pr.branch)}`);
5435
5440
  print(` URL : ${style.dim(pr.url)}`);
5436
- print(` CF alias : ${style.dim(branch)}`);
5441
+ print(` Alias : ${style.dim(branch)}`);
5437
5442
  print("");
5438
5443
  if (!loader.has("deployment")) throw new Error("deployment capability is not configured — add a deployment provider to holocron.config.json");
5439
5444
  const deploy = loader.get("deployment");
@@ -5464,6 +5469,23 @@ async function runCleanupPreview(input) {
5464
5469
  }
5465
5470
  print(`Found ${deployments.length} deployment${deployments.length === 1 ? "" : "s"} for ${style.dim(branch)}:`);
5466
5471
  print("");
5472
+ if (input.yes && pr.state === "open") {
5473
+ const message = `PR #${pr.number} is still open: --yes only deletes the previews of a closed pull request.`;
5474
+ print(style.fail(message));
5475
+ logger.warn({
5476
+ pr: pr.number,
5477
+ branch,
5478
+ status: "fail"
5479
+ }, "cleanup-preview: refused, PR is open");
5480
+ return {
5481
+ pr,
5482
+ branch,
5483
+ found: deployments.length,
5484
+ deleted: 0,
5485
+ status: "fail",
5486
+ message
5487
+ };
5488
+ }
5467
5489
  if (pr.state === "open") {
5468
5490
  print(style.warn(`PR #${pr.number} is still open. Deleting its preview deployments will break the live preview link.`));
5469
5491
  print(style.warn("Nothing is pre-selected — check the deployments you want to remove."));
@@ -5477,7 +5499,8 @@ async function runCleanupPreview(input) {
5477
5499
  };
5478
5500
  });
5479
5501
  let selected;
5480
- try {
5502
+ if (input.yes) selected = deployments.map((d) => d.id);
5503
+ else try {
5481
5504
  selected = await checkbox({
5482
5505
  message: "Select deployments to delete (space to toggle, a to select all, enter to confirm):",
5483
5506
  choices
@@ -5561,7 +5584,8 @@ const cleanupPreviewCommand = {
5561
5584
  },
5562
5585
  prNumber: Number(pr),
5563
5586
  project: argv.project,
5564
- ...argv.repo ? { repo: argv.repo } : {}
5587
+ ...argv.repo ? { repo: argv.repo } : {},
5588
+ ...argv.yes ? { yes: true } : {}
5565
5589
  })).status === "fail") process.exitCode = 1;
5566
5590
  }
5567
5591
  };
@@ -6108,7 +6132,8 @@ async function runDeployFromFiles(input) {
6108
6132
  try {
6109
6133
  const result = await withSpinner(`Deploying ${fileCount} file${fileCount === 1 ? "" : "s"} from ${input.dir}…`, () => deploy.deployFunction(input.projectId, {
6110
6134
  files,
6111
- ...input.target ? { target: input.target } : {}
6135
+ ...input.target ? { target: input.target } : {},
6136
+ ...input.previewKey && !input.target ? { meta: { holocronPreview: input.previewKey } } : {}
6112
6137
  }));
6113
6138
  logger.info({
6114
6139
  url: result.url,
@@ -6153,6 +6178,7 @@ async function runDeployFromFiles(input) {
6153
6178
  }
6154
6179
  }
6155
6180
  // src/commands/deploy/deploy.command.ts
6181
+ const env$6 = createEnvLookup();
6156
6182
  const deployCommand = {
6157
6183
  command: "deploy [branch]",
6158
6184
  describe: "Trigger a deployment via the configured `deployment` capability",
@@ -6179,7 +6205,8 @@ const deployCommand = {
6179
6205
  context,
6180
6206
  projectId: argv.projectId,
6181
6207
  dir: argv.files,
6182
- ...argv.target ? { target: argv.target } : {}
6208
+ ...argv.target ? { target: argv.target } : {},
6209
+ ...env$6.get("HOLOCRON_PREVIEW_KEY") ? { previewKey: env$6.get("HOLOCRON_PREVIEW_KEY") } : {}
6183
6210
  })).status === "fail") process.exitCode = 1;
6184
6211
  return;
6185
6212
  }
@@ -7283,8 +7310,8 @@ const SETUP_ENVIRONMENTS = ["staging", "production"];
7283
7310
  * set on one that exists. An environment that exists but is not expected is never a problem. With no provider and
7284
7311
  * nothing named, nothing is declared; with no provider but some named, the row is a skip with the reason.
7285
7312
  */
7286
- const ID$2 = "environments";
7287
- const TITLE$2 = "environments exist";
7313
+ const ID$4 = "environments";
7314
+ const TITLE$4 = "environments exist";
7288
7315
  async function runDoctorEnvironments(input) {
7289
7316
  const print = input.print ?? ((line) => console.log(line));
7290
7317
  const logger = input.logger ?? getLogger();
@@ -7308,8 +7335,8 @@ async function runDoctorEnvironments(input) {
7308
7335
  }
7309
7336
  async function checkEnvironments(loader, named) {
7310
7337
  const make = (status, detail, problems = []) => ({
7311
- id: ID$2,
7312
- title: TITLE$2,
7338
+ id: ID$4,
7339
+ title: TITLE$4,
7313
7340
  status,
7314
7341
  detail,
7315
7342
  problems
@@ -7706,16 +7733,257 @@ const doctorLogsCommand = {
7706
7733
  })).status === "fail") process.exitCode = 1;
7707
7734
  }
7708
7735
  };
7736
+ // src/commands/doctor-monitoring/dashboard-rows/dashboard-rows.ts
7737
+ const ID$3 = "monitoring-dashboards";
7738
+ const TITLE$3 = "monitoring dashboards match";
7739
+ /** The tags as comparable text: sorted and de-duplicated. */
7740
+ const tagsText = (tags) => [...new Set(tags)].sort().join(", ") || "none";
7741
+ /** What differs between a declared dashboard and the one the account holds. Privacy is always compared (default private). */
7742
+ function problemsFor(want, have) {
7743
+ if (!have.exists) return [`missing dashboard ${want.name}`];
7744
+ const problems = [];
7745
+ const wantPrivate = want.private ?? true;
7746
+ if ((have.private ?? false) !== wantPrivate) {
7747
+ const now = have.private ? "private" : "public";
7748
+ problems.push(wantPrivate ? `dashboard ${want.name} is public but declared private: anyone with the link can read it` : `dashboard ${want.name}: declared public, found ${now}`);
7749
+ }
7750
+ if (tagsText(want.tags) !== tagsText(have.tags ?? [])) problems.push(`dashboard ${want.name} tags: declared ${tagsText(want.tags)}, found ${tagsText(have.tags ?? [])}`);
7751
+ if (want.domain !== void 0 && want.domain !== have.domain) problems.push(`dashboard ${want.name} domain: declared ${want.domain}, found ${have.domain ?? "none"}`);
7752
+ return problems;
7753
+ }
7754
+ /**
7755
+ * The `doctor monitoring` rows for dashboards: none when the config declares none. One row compares each declared
7756
+ * dashboard (exists, privacy, tags, domain; a public dashboard declared private is a failure), and an `info` row
7757
+ * (a skipped one) names dashboards the account holds that the config does not. A provider that cannot inspect, or a
7758
+ * missing token, is a skip with the reason.
7759
+ */
7760
+ async function dashboardRows(monitoring) {
7761
+ const declared = monitoring.dashboards ?? [];
7762
+ if (declared.length === 0) return [];
7763
+ const skip = (id, title, detail) => ({
7764
+ id,
7765
+ title,
7766
+ status: "skip",
7767
+ detail,
7768
+ problems: []
7769
+ });
7770
+ if (!monitoring.inspectDashboard) return [skip(ID$3, TITLE$3, "provider does not implement inspectDashboard")];
7771
+ try {
7772
+ const names = new Set(declared.map((d) => d.name));
7773
+ const problems = [];
7774
+ const extra = /* @__PURE__ */ new Set();
7775
+ for (const want of declared) {
7776
+ const have = await monitoring.inspectDashboard(want.name);
7777
+ problems.push(...problemsFor(want, have));
7778
+ for (const other of have.others) if (!names.has(other)) extra.add(other);
7779
+ }
7780
+ const rows = [problems.length > 0 ? {
7781
+ id: ID$3,
7782
+ title: TITLE$3,
7783
+ status: "fail",
7784
+ detail: `${problems.length} problem(s)`,
7785
+ problems
7786
+ } : {
7787
+ id: ID$3,
7788
+ title: TITLE$3,
7789
+ status: "ok",
7790
+ detail: `${declared.length} of ${declared.length} match`,
7791
+ problems: []
7792
+ }];
7793
+ if (extra.size > 0) rows.push(skip("monitoring-dashboards-extra", "other dashboards on the account", `not declared: ${[...extra].sort().join(", ")}`));
7794
+ return rows;
7795
+ } catch (err) {
7796
+ const noToken = missingTokenReason(err);
7797
+ if (noToken !== void 0) return [skip(ID$3, TITLE$3, noToken)];
7798
+ return [{
7799
+ id: ID$3,
7800
+ title: TITLE$3,
7801
+ status: "fail",
7802
+ detail: errorMessage(err),
7803
+ problems: []
7804
+ }];
7805
+ }
7806
+ }
7807
+ // src/commands/doctor-monitoring/heartbeat-rows/heartbeat-rows.ts
7808
+ /**
7809
+ * The heartbeat rows of `doctor monitoring`: each declared heartbeat must exist with the declared period and grace
7810
+ * (a tag the config states is compared too; one it leaves out is not), and a heartbeat the account holds beyond the
7811
+ * config is an `info` row (shown as skipped). Names only: the ping URL is never read here.
7812
+ */
7813
+ const ID$2 = "monitoring-heartbeats";
7814
+ const TITLE$2 = "monitoring heartbeats match";
7815
+ const show = (b) => new Map([
7816
+ ["period", `${b.period} ${b.periodUnit}`],
7817
+ ["grace", `${b.grace} ${b.graceUnit}`],
7818
+ ...b.tags === void 0 ? [] : [["tags", [...b.tags].sort().join(", ") || "none"]]
7819
+ ]);
7820
+ /** No rows when the provider declares no heartbeats: the doctor then prints what it always did. */
7821
+ async function heartbeatRows(monitoring) {
7822
+ const declared = monitoring.heartbeats ?? [];
7823
+ if (declared.length === 0) return [];
7824
+ const skip = (detail) => ({
7825
+ id: ID$2,
7826
+ title: TITLE$2,
7827
+ status: "skip",
7828
+ detail,
7829
+ problems: []
7830
+ });
7831
+ if (!monitoring.listHeartbeats) return [skip("provider does not implement listHeartbeats")];
7832
+ try {
7833
+ const have = new Map((await monitoring.listHeartbeats()).map((b) => [b.name, b]));
7834
+ const problems = declaredVsActual(new Map(declared.map((b) => [b.name, b])), have, {
7835
+ noun: "heartbeat",
7836
+ flagExtra: false,
7837
+ equal: () => true
7838
+ });
7839
+ for (const want of declared) {
7840
+ const found = have.get(want.name);
7841
+ if (!found) continue;
7842
+ const wanted = show(want);
7843
+ const actual = new Map([...show(found)].filter(([key]) => wanted.has(key)));
7844
+ problems.push(...declaredVsActual(wanted, actual, {
7845
+ noun: `heartbeat ${want.name}`,
7846
+ flagExtra: false
7847
+ }));
7848
+ }
7849
+ const rows = [problems.length > 0 ? {
7850
+ id: ID$2,
7851
+ title: TITLE$2,
7852
+ status: "fail",
7853
+ detail: `${problems.length} problem(s)`,
7854
+ problems
7855
+ } : {
7856
+ id: ID$2,
7857
+ title: TITLE$2,
7858
+ status: "ok",
7859
+ detail: `${declared.length} of ${declared.length} match`,
7860
+ problems: []
7861
+ }];
7862
+ const declaredNames = new Set(declared.map((b) => b.name));
7863
+ const extras = [...have.keys()].filter((name) => !declaredNames.has(name)).sort();
7864
+ if (extras.length > 0) rows.push({
7865
+ id: `${ID$2}-extra`,
7866
+ title: "heartbeats beyond the config",
7867
+ status: "skip",
7868
+ detail: `info: the account also holds ${extras.length}: ${extras.join(", ")}`,
7869
+ problems: []
7870
+ });
7871
+ return rows;
7872
+ } catch (err) {
7873
+ const noToken = missingTokenReason(err);
7874
+ if (noToken !== void 0) return [skip(noToken)];
7875
+ return [{
7876
+ id: ID$2,
7877
+ title: TITLE$2,
7878
+ status: "fail",
7879
+ detail: errorMessage(err),
7880
+ problems: []
7881
+ }];
7882
+ }
7883
+ }
7884
+ // src/commands/doctor-monitoring/status-page-rows/status-page-rows.ts
7885
+ const title = (name) => `status page ${name} matches`;
7886
+ /** What is wrong with a status page, one line each; a record still to make is a `todo:`, which fails the run. */
7887
+ function problemsOf(input, state) {
7888
+ const problems = [];
7889
+ if (input.private === true && state.public) problems.push("declared private but the page is public");
7890
+ if (input.private === false && state.public === false) problems.push("declared public but the page is private");
7891
+ problems.push(...state.missingComponents.map((n) => `component ${n} is missing`));
7892
+ problems.push(...state.misplacedComponents.map((n) => `component ${n}`));
7893
+ problems.push(...state.missingRules.map((n) => `rule for ${n} is missing or does not tie its tags and a full outage to it`));
7894
+ problems.push(...state.domainProblems);
7895
+ if (state.domainVerified === false) {
7896
+ const r = state.domainRecord;
7897
+ problems.push(r ? `todo: make ${r.type} ${r.name} -> ${r.value}, then run \`holocron setup\` or recheck the domain` : `todo: ${input.domain} is not verified and the provider names no record yet`);
7898
+ }
7899
+ return problems;
7900
+ }
7901
+ /**
7902
+ * One row per declared status page: it exists, its privacy is what is declared, its components and rules are as
7903
+ * declared and its custom domain is verified. What the page holds beyond the config is a skipped `info` row.
7904
+ * Read-only. A provider with no `inspectStatusPage`, or no token, is a skip with the reason.
7905
+ */
7906
+ async function statusPageRows(monitoring) {
7907
+ const rows = [];
7908
+ for (const page of monitoring.statusPages ?? []) {
7909
+ const id = `monitoring-status-page:${page.name}`;
7910
+ if (!monitoring.inspectStatusPage) {
7911
+ rows.push({
7912
+ id,
7913
+ title: title(page.name),
7914
+ status: "skip",
7915
+ detail: "provider does not implement inspectStatusPage",
7916
+ problems: []
7917
+ });
7918
+ continue;
7919
+ }
7920
+ try {
7921
+ const state = await monitoring.inspectStatusPage(page);
7922
+ if (!state.exists) {
7923
+ rows.push({
7924
+ id,
7925
+ title: title(page.name),
7926
+ status: "fail",
7927
+ detail: "does not exist; run `holocron setup`",
7928
+ problems: []
7929
+ });
7930
+ continue;
7931
+ }
7932
+ const problems = problemsOf(page, state);
7933
+ rows.push(problems.length > 0 ? {
7934
+ id,
7935
+ title: title(page.name),
7936
+ status: "fail",
7937
+ detail: `${problems.length} problem(s)`,
7938
+ problems
7939
+ } : {
7940
+ id,
7941
+ title: title(page.name),
7942
+ status: "ok",
7943
+ detail: `${state.public ? "public" : "private"}, ${page.components.length} component(s)${state.domainVerified ? ", domain verified" : ""}`,
7944
+ problems: []
7945
+ });
7946
+ const extras = [...state.extraComponents.map((n) => `component ${n}`), ...state.extraRules.map((n) => `rule ${n}`)];
7947
+ if (extras.length > 0) rows.push({
7948
+ id: `${id}:extra`,
7949
+ title: `status page ${page.name} has more than the config`,
7950
+ status: "skip",
7951
+ detail: extras.join(", "),
7952
+ problems: []
7953
+ });
7954
+ } catch (err) {
7955
+ const noToken = missingTokenReason(err);
7956
+ rows.push(noToken !== void 0 ? {
7957
+ id,
7958
+ title: title(page.name),
7959
+ status: "skip",
7960
+ detail: noToken,
7961
+ problems: []
7962
+ } : {
7963
+ id,
7964
+ title: title(page.name),
7965
+ status: "fail",
7966
+ detail: errorMessage(err),
7967
+ problems: []
7968
+ });
7969
+ }
7970
+ }
7971
+ return rows;
7972
+ }
7709
7973
  // src/commands/doctor-monitoring/doctor-monitoring.ts
7710
7974
  /**
7711
7975
  * `holocron doctor monitoring` — do the checks the `monitoring` provider declares exist in its account, as declared?
7712
7976
  *
7713
7977
  * Read-only. One row for the declared checks: each must exist by name, and what the config sets on it (URL, method,
7714
- * frequency, locations, activated, should-fail, body, assertions) must be what the provider holds. A setting the
7978
+ * frequency, locations, tags, activated, should-fail, body, assertions) must be what the provider holds. A setting the
7715
7979
  * config leaves out is not compared, and a check in the account that is not declared is never a problem, since the
7716
- * account may hold checks made by hand or by another tool. A provider that cannot list its checks, a missing
7980
+ * account may hold checks made by hand or by another tool. Tags are compared one way: a declared tag the check
7981
+ * lacks fails, an extra tag on it does not. A provider that cannot list its checks, a missing
7717
7982
  * provider that failed to load, or a missing token is a skip with the reason, not a failure.
7718
7983
  *
7984
+ * Heartbeats are one more row (`heartbeat-rows/`): each declared one must exist with the declared period and grace, and
7985
+ * the account's others are an `info` row. Names only.
7986
+ *
7719
7987
  * Out of scope: the alert channel and its subscriptions (the notification layout declares those, see
7720
7988
  * `doctor notifications`) and any check that a message really arrives.
7721
7989
  */
@@ -7728,6 +7996,9 @@ async function runDoctorMonitoring(input) {
7728
7996
  await loader.load();
7729
7997
  assertPluginsResolvable(loader, "doctor monitoring");
7730
7998
  const rows = [await checkRow(loader)];
7999
+ if (loader.has("monitoring")) rows.push(...await dashboardRows(loader.get("monitoring")));
8000
+ if (loader.has("monitoring")) rows.push(...await statusPageRows(loader.get("monitoring")));
8001
+ rows.push(...await heartbeatRowsOf(loader));
7731
8002
  printCheckRows(rows, print);
7732
8003
  const summary = summariseChecks(rows);
7733
8004
  printCheckSummary(summary, print);
@@ -7799,6 +8070,10 @@ async function checkRow(loader) {
7799
8070
  };
7800
8071
  }
7801
8072
  }
8073
+ /** The heartbeat rows, only when a monitoring provider is loaded and declares heartbeats. */
8074
+ async function heartbeatRowsOf(loader) {
8075
+ return loader.has("monitoring") ? heartbeatRows(loader.get("monitoring")) : [];
8076
+ }
7802
8077
  /** One assertion as a line: `status_code equals 405`, `header[x-a] contains b`. */
7803
8078
  function showAssertion(a) {
7804
8079
  return [
@@ -7840,6 +8115,13 @@ function compareChecks(declared, have) {
7840
8115
  flagExtra: false,
7841
8116
  show: (value) => value === "" ? "none" : value
7842
8117
  }));
8118
+ if (want.tags !== void 0) {
8119
+ const tagMap = (tags) => new Map((tags ?? []).map((t) => [t, t]));
8120
+ problems.push(...declaredVsActual(tagMap(want.tags), tagMap(found.tags), {
8121
+ noun: `check ${want.name} tag`,
8122
+ flagExtra: false
8123
+ }));
8124
+ }
7843
8125
  }
7844
8126
  return problems;
7845
8127
  }
@@ -15327,6 +15609,80 @@ function coverageConfigFiles(input) {
15327
15609
  });
15328
15610
  };
15329
15611
  }
15612
+ // src/commands/heartbeat-secret-name/heartbeat-secret-name.ts
15613
+ /**
15614
+ * The secret that holds a heartbeat's ping URL: `HOLOCRON_HEARTBEAT_<NAME>`, the name upper-snake-cased
15615
+ * (`check-tokens` is `HOLOCRON_HEARTBEAT_CHECK_TOKENS`). A name with nothing a variable name can carry is `undefined`.
15616
+ */
15617
+ function heartbeatSecretName(name) {
15618
+ const snake = name.replace(/([a-z0-9])([A-Z])/g, "$1_$2").replace(/[^A-Za-z0-9]+/g, "_").replace(/^_+|_+$/g, "").toUpperCase();
15619
+ return snake === "" ? void 0 : `HOLOCRON_HEARTBEAT_${snake}`;
15620
+ }
15621
+ // src/commands/heartbeat-handoff/heartbeat-handoff.ts
15622
+ /**
15623
+ * Hand the ping URLs of heartbeats just made to 1Password. A ping URL is a credential (anyone holding it can fake a
15624
+ * success) and the CLI cannot write to a 1Password Environment, so the hand-off is the private import file, the way
15625
+ * `export tokens` does it: `.holocron/.private/.credentials`, mode 0600, never overwritten, deleted once the import is
15626
+ * done. The lines go only to that file: never to a terminal or a redirected file, and nothing here prints, logs or
15627
+ * returns a URL. The names are `HOLOCRON_HEARTBEAT_<NAME>`, for the `ci` layer.
15628
+ */
15629
+ async function handOffHeartbeats(input) {
15630
+ const { print } = input;
15631
+ const fail = (reason, ...message) => {
15632
+ for (const line of message) print(line);
15633
+ return {
15634
+ status: "fail",
15635
+ written: [],
15636
+ reason
15637
+ };
15638
+ };
15639
+ if (input.pings.length === 0) return {
15640
+ status: "skip",
15641
+ written: [],
15642
+ reason: "no heartbeat was made"
15643
+ };
15644
+ const lines = /* @__PURE__ */ new Map();
15645
+ for (const ping of input.pings) {
15646
+ const name = heartbeatSecretName(ping.name);
15647
+ if (!name) return fail("name", `heartbeat "${ping.name}" has no name a variable can carry`);
15648
+ if (lines.has(name)) return fail("collision", `two heartbeats are named ${name}: rename one`);
15649
+ const line = dotenvLine(name, ping.url);
15650
+ if (line === null) return fail("unsupported", `${name}: its address is not one a dotenv file can carry, so add it by hand`);
15651
+ lines.set(name, line);
15652
+ }
15653
+ if ((input.platform ?? process.platform) === "win32") return fail("windows", "cannot make the file private on Windows: its mode bits are not enforced");
15654
+ const target = resolveCredentialsFile(input.base, void 0, input.makeDir);
15655
+ const file = target.path;
15656
+ const git = (input.isIgnored ?? isGitIgnored)(file);
15657
+ if (git === "tracked" || git === "unknown") return fail("not-ignored", git === "tracked" ? `refusing to write ping URLs to ${file}: git does not ignore it, so it could be committed` : `refusing to write ping URLs to ${file}: git could not say whether it ignores it`, ignoreAdvice(target.isDefault, "choose a path outside the repository"));
15658
+ const names = [...lines.keys()].sort();
15659
+ let identity;
15660
+ try {
15661
+ identity = (input.writeFile ?? writeCredentialsFile)(file, `${names.map((n) => lines.get(n)).join("\n")}\n`, false);
15662
+ } catch (err) {
15663
+ return fail("write", `could not write ${file}: ${errorMessage(err)}`, "an existing file is never overwritten: finish importing it, delete it, then run setup again");
15664
+ }
15665
+ print(`wrote ${names.length} heartbeat ping URL(s) for import: ${names.join(", ")}`);
15666
+ print("they belong to the `ci` layer's 1Password Environment and a repo-scoped `repo.secrets.sync` entry");
15667
+ return await finishCredentialsFile({
15668
+ path: file,
15669
+ identity,
15670
+ print,
15671
+ holds: "the heartbeats' ping URLs",
15672
+ importHint: "import it in the 1Password app: Developer, View Environments, the `ci` Environment, Import .env file",
15673
+ keep: input.keep,
15674
+ interactive: input.interactive,
15675
+ shred: input.shred,
15676
+ waitForImport: input.waitForImport
15677
+ }) ? {
15678
+ status: "ok",
15679
+ written: names
15680
+ } : {
15681
+ status: "fail",
15682
+ written: names,
15683
+ reason: "file-left"
15684
+ };
15685
+ }
15330
15686
  // ../../.holocron/org.md
15331
15687
  var org_default = "<!-- editorconfig-checker-disable-file -->\n\n# theholocron — agent operating contract\n\nOrg-level agent conventions for all `theholocron` repositories. The canonical\ncopy is `.holocron/org.md` in `theholocron/holocron`. `holocron sync` writes\nit into each repo's `AGENTS.md` between generated markers, so no repo needs a\nsibling checkout to read it; holocron itself imports it with `@.holocron/org.md`.\nEdit it in holocron, then run `holocron sync`.\n\n## Repo map\n\nEach concern lives in exactly one repo:\n\n| Concern | Repo |\n| ----------------------------------------------------------------- | ----------------------------------------- |\n| Shareable tool config (ESLint, Prettier, TSConfig, Vitest, …) | `theholocron/holocron` (`configs/`) |\n| HTTP clients and API wrappers | `theholocron/holocron` (`clients/`) |\n| Infrastructure automation, CI orchestration, repo lifecycle | `theholocron/holocron` |\n| Org-level CI workflows, composite actions, community health files | `theholocron/.github` |\n| Internal member docs and private org config | `theholocron/.github-private` (this repo) |\n| Shared agent skills registry | `theholocron/holocron` (`skills/`) |\n\nIf you find yourself copy-pasting a tool config across repos, it belongs in\nthe `configs/` folder of `theholocron/holocron`. If you find yourself writing a new\nautomation command, it belongs in `holocron` too. Generic helpers (`utils/`) and\nobservability (`observability/`) live in that monorepo as well.\n\n### `holocron.config` format\n\n- Repos **with** a `package.json` → `holocron.config.ts` with `defineConfig`\n from `@theholocron/cli`. The CLI must be resolvable at runtime for the TS\n format to work.\n- Repos **without** a `package.json` (e.g. `.github`, `.github-private`) →\n `holocron.config.json`.\n\n## Workflow\n\n- **Always open a PR — never push directly to the default branch.** Even for\n small fixes: create a branch, push it, open a PR. This lets CI run, keeps\n history reviewable, and respects branch protection. The only exception is\n bootstrapping a brand-new repo before protection is set up.\n- **Conventional Commits.** `feat:` / `fix:` / `chore:` / `docs:` / `ci:` /\n `test:` / `refactor:` / `perf:` — semantic-release uses these for versioning\n and changelogs. Repos without a release step use the subset relevant to them.\n- **Always `git commit -s`** (DCO). The `Signed-off-by:` trailer is required\n on every commit. `-s` generates it automatically from `git config user.name`\n and `user.email`.\n- **Always rebase, never merge `main`.** Use `git rebase origin/main` to keep a\n branch current. `git merge main` creates an unsigned merge commit and drags bot\n commits into the PR history — both trigger DCO check failures.\n- **No Claude attribution** in commits, PRs, issues, or docs. No\n `Co-Authored-By` trailer. The author is the user.\n- **One PR = one focused change.** Squash-merge; the PR title becomes the\n squashed commit subject that semantic-release reads.\n- **File issues for non-trivial work** and reference them in commits/PRs\n (`Closes #N` / `Refs #N`). Skip for typo fixes.\n- **Spec process: Issue before spec.** Before writing a spec file, file an issue\n first, in the tracker the config's `issues` provider names (GitHub when the\n config sets no `issues` provider). The issue is the durable tracking artifact.\n The spec's frontmatter `issue:` field must reference it. Order: Issue → Spec →\n PR → Review → merge.\n- **Reference the issue in that tracker's syntax** in commits and the PR: `Closes #N`\n / `Refs #N` for GitHub, the issue key (`Closes ENG-42` / `Refs ENG-42`) for Linear.\n\n## Before starting any coding task\n\n1. Verify you are on a feature branch, not `main`. If on `main`, create a branch\n first. Never commit directly to `main`. If on an existing feature branch, run\n `git fetch origin && git rebase origin/main` to ensure it has the latest from\n `main` — never start work on a stale branch.\n2. Any PR that adds new behavior must include tests and documentation in the same\n PR. Do not open docs-only or test-only follow-up PRs — tests and docs ship with\n the feature. This applies to new packages, capabilities, commands, APIs, and\n any observable behavior change.\n3. If adding a new client or plugin package, update the docs-theme registry in\n the same PR or a cleanly scoped immediate follow-up.\n4. One PR per logical change. Do not bundle unrelated fixes with a feature.\n\n## After completing any coding task\n\n1. Confirm you are still on the intended feature branch.\n2. Confirm all checklist items in any invoked skill are complete.\n3. Confirm CI is green before requesting review.\n\n## CI workflows\n\nAll reusable workflow implementations and composite actions **live as source in\n`theholocron/holocron` — `packages/astromech/src/templates/reusable/`** and are\ngenerated + pushed to `theholocron/.github` by `holocron sync github`.\n**`theholocron/.github` and `.github-private` are pure sync targets** — never\nhand-edit their `.github/workflows/*`, `.github/actions/*` or\n`workflow-templates/*`; edit the source in `holocron` and merge.\n\nEvery other repo (`configs`, `clients`, `holocron`, `.github-private`) gets\n**thin callers** — lightweight `.github/workflows/` files that delegate to\n`.github` via `uses: theholocron/.github/.github/workflows/<name>.yml@main` and\n`secrets: inherit`. Thin callers are generated from the manifest by\n`astromech.thinCallers()` (`holocron sync` / `holocron setup`).\n\n### Sync\n\nThe `sync-workflow-templates` workflow in `theholocron/holocron` keeps thin\ncallers up to date. It runs automatically on push to `main` when\n`packages/cli/src/templates/**` or `packages/astromech/src/templates/**` change.\nChanges to other parts of the sync machinery (e.g. `sync-github.ts`) require a\nmanual dispatch:\n\n```sh\ngh workflow run sync-workflow-templates.yml --repo theholocron/holocron --ref main\n```\n\n### Per-repo task list\n\nEach secondary repo controls which tasks (and their CI workflows) it\nreceives — and can supply per-task `with:` overrides — via the `tasks`\narray in its `holocron.config.ts` (or `holocron.config.json`).\n`@theholocron/astromech` reads it as the single source for `holocron run`\n/ `holocron run ci` / the generated workflow thin callers:\n\n```typescript\ntasks: [\"lint\", { name: \"release\", with: { \"run-build\": false } }];\n```\n\nOnly add a task if the corresponding capability exists in the repo:\n\n| Task | Requires |\n| ------------- | ------------------------------------------------- |\n| `test` | vitest suite with `--coverage` |\n| `typecheck` | TypeScript (`pnpm typecheck` script) |\n| `audit` | a bundle build step (`pnpm build` script) |\n| `sync-github` | `packages/cli/src/templates/**` — `holocron` only |\n\n### Release workflow — npm prefix and registry-url\n\n**Never run `npm config set prefix <path>` in a release workflow.** It writes\n`prefix=<path>` to `~/.npmrc`, which pnpm reads for npm configuration. With a\nnon-default prefix set, pnpm cannot locate the registry auth it needs to perform\nthe GitHub OIDC token exchange and fails with `ENEEDAUTH` — even when Trusted\nPublishers are correctly configured on npmjs.com.\n\nNode.js from `hostedtoolcache` already provides a user-writable npm prefix on\nPATH. Run `npm install -g <pkg>` directly.\n\n**Never cache `~/.npm-global` or any npm global directory in release workflows.**\nA stale cache restores old auth config that poisons the OIDC exchange.\n\n**Never set `registry-url` in the shared `setup-node` composite action.** It\ncauses `actions/setup-node` to write `//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}`\nto a temp `.npmrc` and set `NPM_CONFIG_USERCONFIG` pointing at it. pnpm then\nreads that file, fails env-var substitution when the token is empty, and loses\nauth entirely.\n\nThe reference implementation is `theholocron/holocron`'s own release workflow —\nno prefix step, no cache, no `registry-url`.\n\n### Discarding a bad sync PR\n\n**Delete the branch, don't only close the PR.** A closed-but-existing branch\nblocks future PR creation — GitHub returns 422 \"A pull request already exists\"\nand the sync silently skips opening a new one.\n\n```sh\ngh pr close <n> --repo <owner>/<repo> --delete-branch\n```\n\n## Code standards\n\n### Package manager\n\n**pnpm only.** Never use `npm` or `yarn`. Run workspace-wide tasks through\nTurbo (`pnpm test`, `pnpm build`, etc.); run single-package tasks with\n`pnpm --filter <name> <script>`.\n\n### TypeScript\n\n**No `any`.** Use `unknown` for values of genuinely unknown shape and narrow\nwith type guards. Use generics instead of `any` in function signatures.\n`as never` and `as unknown as T` are acceptable for internal casts where the\ntype system can't follow; `any` is not.\n\n### Node.js version\n\n`engines.node` must be set in every `package.json`. To update the Node.js\nversion across a repo run `holocron upgrade node <to>` from any repo that has\nthe CLI installed — it patches `engines.node`, `@types/node`, `.nvmrc`,\n`.node-version`, and `.github/workflows/*.yml` automatically.\n\n### Inclusive language (`alex`)\n\n`holocron setup` no longer writes `.alexrc.json` or `.alexignore` (#831). The\ncheck is Sentinel's `lint:language / Run alex`, which reads the org's own\nallow-list, `alexrc.json` in `theholocron/holocron · cli/astromech/src/lint/alex-config/`\n(`ALEX_CONFIG`). To allow a new term across all repos: edit that file, open a PR\nin `holocron`, merge; Sentinel uses it after its next deploy. A repo that still\nhas the two files from an earlier setup can delete them; nothing reads them.\n\n### Running `holocron setup`\n\nInstall `@theholocron/cli` and `@theholocron/holocron-plugin-github` under\n`catalogs.holocron` in `pnpm-workspace.yaml`:\n\n```yaml\ncatalogs:\n holocron:\n \"@theholocron/cli\": <version>\n \"@theholocron/holocron-plugin-github\": <version>\n```\n\nThen run:\n\n```sh\nGITHUB_TOKEN=$(gh auth token) \\\nHOLOCRON_ORG_TOKEN=$(security find-generic-password -s \"com.theholocron.cli\" -a \"github.org\" -w) \\\npnpm exec holocron setup --token $(security find-generic-password -s \"com.theholocron.cli\" -a \"github.admin\" -w)\n```\n\nAll tokens are stored in the macOS keychain under service `com.theholocron.cli`. See `docs/tokens.md` in the `holocron` repo for the full token matrix and required scopes.\n\nBump both catalog entries together when upgrading — they publish in lockstep.\n\n### README structure\n\nEvery repo README follows this layout. Use `holocron sync readme` to regenerate the Installation + Usage block automatically.\n\n```markdown\n# Package Name\n\n<!-- holocron:description -->\n\nOne-line description (synced from holocron.config.ts description field).\n<!-- /holocron:description -->\n\n<!-- holocron:installation -->\n\n## Installation\n\n...generated from package.json bin / exports...\n\n## Usage\n\n...generated from package.json bin / exports...\n<!-- /holocron:installation -->\n\n## What's Included ← template repos only; omit for libraries\n\n...feature table...\n\n## Development\n\npnpm scripts table or code block\n\n## Releases\n\nAutomated via semantic-release. Link to CHANGELOG.md.\n\n## Documentation\n\nLink to docs site.\n```\n\n**Rules:**\n\n- Never write \"Getting Started\" — use separate \"Installation\" and \"Usage\" headings.\n- The `<!-- holocron:description -->` and `<!-- holocron:installation -->` marker blocks must stay in sync with the config/package; run `holocron sync readme` after changing `description` in `holocron.config.ts` or `bin` in `package.json`.\n- The \"What's Included\" section belongs only in template repos (cli-template, node-template, react-template, etc.) where it describes what the template ships. Library and app repos omit it.\n\n---\n\n## This repo (`.github-private`)\n\n> **Local path:** `~/Code/theholocron/github-private/`\n> **GitHub repo:** `theholocron/.github-private`\n\nInternal member documentation and private org-level configuration for the\n`theholocron` org. Content here is only visible to org members.\n\nConventional Commit types used here: `docs:` for content changes, `ci:` for\nworkflow changes, `chore:` for maintenance.\n\nNo test suite (documentation repo). `pnpm lint` runs `yamllint` on workflow\nfiles. Branch protection on `main` requires DCO and passing CI checks.\n";
15332
15688
  // src/commands/repo-files/generate-agent-files.ts
@@ -16315,6 +16671,43 @@ async function installAgentPrompts({ repoRoot }) {
16315
16671
  });
16316
16672
  return `wrote ${Object.keys(AGENT_PROMPTS).length} prompt files to ${AGENTS_PROMPTS_ROOT}/`;
16317
16673
  }
16674
+ // src/commands/setup/dashboard-key/dashboard-key.ts
16675
+ /** The 1Password variable that holds a private dashboard's view key (the `dev` layer, never synced). */
16676
+ const DASHBOARD_KEY_VARIABLE = "HOLOCRON_CHECKLY_DASHBOARD_KEY";
16677
+ /**
16678
+ * Hands a private dashboard's view key over for the 1Password import, the way `export tokens` does: one
16679
+ * `HOLOCRON_CHECKLY_DASHBOARD_KEY=<value>` line in the private, git-ignored, never-overwritten
16680
+ * `.holocron/.private/.credentials`, which is deleted once the import is done. The key is never printed, logged or
16681
+ * written anywhere else. Throws with a reason that holds no key when the file cannot be written safely; the key is
16682
+ * then still in Checkly's dashboard settings.
16683
+ */
16684
+ async function handOffDashboardKey(input) {
16685
+ if ((input.platform ?? process.platform) === "win32") throw new Error("cannot make the file private on Windows: its mode bits are not enforced; copy the key from Checkly");
16686
+ const line = dotenvLine(DASHBOARD_KEY_VARIABLE, input.key);
16687
+ if (line === null) throw new Error(`the key is a value dotenv cannot carry unchanged, so add ${DASHBOARD_KEY_VARIABLE} by hand`);
16688
+ const target = resolveCredentialsFile(input.repoRoot, void 0, input.makeDir);
16689
+ const git = (input.isIgnored ?? isGitIgnored)(target.path);
16690
+ if (git === "tracked" || git === "unknown") {
16691
+ const why = git === "tracked" ? "git does not ignore it" : "git could not say whether it ignores it";
16692
+ throw new Error(`refusing to write ${target.path}: ${why}; ${ignoreAdvice(target.isDefault, "choose another path")}`);
16693
+ }
16694
+ let identity;
16695
+ try {
16696
+ identity = (input.writeFile ?? writeCredentialsFile)(target.path, `${line}\n`, false);
16697
+ } catch (err) {
16698
+ throw new Error(`could not write ${target.path}: ${errorMessage(err)} (an existing file is never overwritten: delete it and run setup again)`, { cause: err });
16699
+ }
16700
+ if (!await finishCredentialsFile({
16701
+ path: target.path,
16702
+ identity,
16703
+ print: input.print,
16704
+ holds: `the dashboard key (HOLOCRON_CHECKLY_DASHBOARD_KEY)`,
16705
+ importHint: "import it in the 1Password app, in the dev layer: Developer, View Environments, the Environment, Import .env file",
16706
+ interactive: input.interactive ?? Boolean(process.stdin.isTTY),
16707
+ shred: input.shred,
16708
+ waitForImport: input.waitForImport
16709
+ })) throw new Error(`${target.path} still holds the key in plain text: delete it`);
16710
+ }
16318
16711
  // src/commands/setup/derive-repo-stack/derive-repo-stack.ts
16319
16712
  /**
16320
16713
  * The stack of a whole repo: `deriveStack()` of the root `package.json` and of
@@ -16607,6 +17000,101 @@ async function updateSkillsGitignore(gitignorePath, skills, symlinkFn) {
16607
17000
  lines: [`/${AGENTS_SKILLS_ROOT}/`, ...skills.map((n) => `/${symlinkFn(n)}`)]
16608
17001
  });
16609
17002
  }
17003
+ // src/commands/setup/status-pages-step/status-pages-step.ts
17004
+ /** The records Checkly asks for a status page's custom domain, as DNS records. */
17005
+ function recordsToMake(domain) {
17006
+ return [...domain.record ? [domain.record] : [], ...domain.extraRecords ?? []].map((r) => ({
17007
+ type: r.type,
17008
+ name: r.name,
17009
+ content: r.value,
17010
+ proxied: false
17011
+ }));
17012
+ }
17013
+ /**
17014
+ * `holocron setup`'s step for the status pages `monitoring` declares (spec `tech-monitoring-dashboards-status-pages`):
17015
+ * ensure each page, then make the DNS records its custom domain needs through the `dns` provider. With no `dns`
17016
+ * provider a record still to make is a failing `todo` row that says what to make, never a silent skip. `--dry-run`
17017
+ * writes nothing, not even DNS. Never deletes.
17018
+ */
17019
+ async function statusPagesStep(monitoring, loader, dryRun) {
17020
+ const steps = [];
17021
+ for (const page of monitoring.statusPages ?? []) {
17022
+ if (!monitoring.ensureStatusPage) {
17023
+ steps.push({
17024
+ capability: "monitoring",
17025
+ step: `ensureStatusPage ${page.name}`,
17026
+ status: "skip",
17027
+ message: "provider does not implement ensureStatusPage"
17028
+ });
17029
+ continue;
17030
+ }
17031
+ let result;
17032
+ steps.push(await runStep("monitoring", `ensureStatusPage ${page.name}`, dryRun, async () => {
17033
+ result = await monitoring.ensureStatusPage(page);
17034
+ const made = result.components.created.length + result.rules.created.length;
17035
+ const changed = result.components.updated.length + result.rules.updated.length + (result.updated?.length ?? 0);
17036
+ return `${result.created ? "created" : "exists"}; ${made} made, ${changed} brought in line`;
17037
+ }));
17038
+ if (page.domain === void 0) continue;
17039
+ if (dryRun) {
17040
+ steps.push({
17041
+ capability: "monitoring",
17042
+ step: `dns ${page.domain}`,
17043
+ status: "dry-run",
17044
+ message: "would make the record the provider asks for"
17045
+ });
17046
+ continue;
17047
+ }
17048
+ const domain = result?.domain;
17049
+ if (!domain) continue;
17050
+ if (domain.verified) {
17051
+ steps.push({
17052
+ capability: "monitoring",
17053
+ step: `dns ${domain.name}`,
17054
+ status: "ok",
17055
+ message: "domain verified"
17056
+ });
17057
+ continue;
17058
+ }
17059
+ const records = recordsToMake(domain);
17060
+ if (records.length === 0) {
17061
+ steps.push({
17062
+ capability: "monitoring",
17063
+ step: `dns ${domain.name}`,
17064
+ status: "fail",
17065
+ message: "todo: the provider has not said which record to make yet; run setup again"
17066
+ });
17067
+ continue;
17068
+ }
17069
+ if (!loader.has("dns")) {
17070
+ for (const r of records) steps.push({
17071
+ capability: "monitoring",
17072
+ step: `dns ${r.name}`,
17073
+ status: "fail",
17074
+ message: `todo: no \`dns\` provider is configured; make ${r.type} ${r.name} -> ${r.content}`
17075
+ });
17076
+ continue;
17077
+ }
17078
+ const dns = loader.get("dns");
17079
+ for (const r of records) try {
17080
+ await dns.upsertRecord(r.name, r);
17081
+ steps.push({
17082
+ capability: "monitoring",
17083
+ step: `dns ${r.name}`,
17084
+ status: "ok",
17085
+ message: `${r.type} (DNS only) made; run \`holocron doctor monitoring\` once it has propagated`
17086
+ });
17087
+ } catch (err) {
17088
+ steps.push({
17089
+ capability: "monitoring",
17090
+ step: `dns ${r.name}`,
17091
+ status: "fail",
17092
+ message: errorMessage(err)
17093
+ });
17094
+ }
17095
+ }
17096
+ return steps;
17097
+ }
16610
17098
  // src/commands/setup/run-setup.ts
16611
17099
  /**
16612
17100
  * `holocron setup` — orchestrates per-capability setup actions across
@@ -17131,6 +17619,80 @@ async function runSetup(input) {
17131
17619
  }));
17132
17620
  print(formatStep(steps[steps.length - 1]));
17133
17621
  }
17622
+ for (const dashboard of monitoring.dashboards ?? []) {
17623
+ if (!monitoring.ensureDashboard) {
17624
+ steps.push({
17625
+ capability: "monitoring",
17626
+ step: `ensureDashboard ${dashboard.name}`,
17627
+ status: "skip",
17628
+ message: "provider has no dashboards"
17629
+ });
17630
+ print(formatStep(steps[steps.length - 1]));
17631
+ continue;
17632
+ }
17633
+ let key;
17634
+ steps.push(await runStep("monitoring", `ensureDashboard ${dashboard.name}`, dryRun, async () => {
17635
+ const result = await monitoring.ensureDashboard(dashboard);
17636
+ key = result.key;
17637
+ const changed = result.updated?.length ? ` (updated ${result.updated.join(", ")})` : "";
17638
+ return `${dashboard.name} ${result.created ? "created" : "exists"}${changed}`;
17639
+ }));
17640
+ print(formatStep(steps[steps.length - 1]));
17641
+ if (key !== void 0) {
17642
+ const step = `hand over dashboard key for ${dashboard.name}`;
17643
+ try {
17644
+ await handOffDashboardKey({
17645
+ key,
17646
+ repoRoot: input.context.repoRoot,
17647
+ print
17648
+ });
17649
+ steps.push({
17650
+ capability: "monitoring",
17651
+ step,
17652
+ status: "ok"
17653
+ });
17654
+ } catch (err) {
17655
+ steps.push({
17656
+ capability: "monitoring",
17657
+ step,
17658
+ status: "fail",
17659
+ message: errorMessage(err)
17660
+ });
17661
+ }
17662
+ print(formatStep(steps[steps.length - 1]));
17663
+ }
17664
+ }
17665
+ for (const step of await statusPagesStep(monitoring, loader, dryRun)) {
17666
+ steps.push(step);
17667
+ print(formatStep(step));
17668
+ }
17669
+ const pings = [];
17670
+ for (const beat of monitoring.ensureHeartbeat ? monitoring.heartbeats ?? [] : []) {
17671
+ steps.push(await runStep("monitoring", `ensureHeartbeat ${beat.name}`, dryRun, async () => {
17672
+ const result = await monitoring.ensureHeartbeat(beat);
17673
+ if (!result.alreadyExists && result.pingUrl) pings.push({
17674
+ name: beat.name,
17675
+ url: result.pingUrl
17676
+ });
17677
+ return `${beat.name} ${result.alreadyExists ? "exists" : "created"}`;
17678
+ }));
17679
+ print(formatStep(steps[steps.length - 1]));
17680
+ }
17681
+ if (pings.length > 0) {
17682
+ const handed = await (input.handOffHeartbeats ?? handOffHeartbeats)({
17683
+ pings,
17684
+ base: dirname(input.loaded.filepath),
17685
+ print: (line) => print(` ${line}`),
17686
+ interactive: process.stdin.isTTY === true
17687
+ });
17688
+ steps.push({
17689
+ capability: "monitoring",
17690
+ step: "heartbeat ping URLs for import",
17691
+ status: handed.status === "fail" ? "fail" : handed.status === "skip" ? "skip" : "ok",
17692
+ message: handed.status === "ok" ? `${handed.written.join(", ")} written for import, not printed` : handed.reason
17693
+ });
17694
+ print(formatStep(steps[steps.length - 1]));
17695
+ }
17134
17696
  }
17135
17697
  if (loader.has("tooling")) {
17136
17698
  const tools = loader.get("tooling");