@theholocron/cli 5.0.0-alpha.271 → 5.0.0-alpha.273

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -188,14 +188,14 @@ A minimal config — for repos with a `package.json` and a GitHub remote
188
188
 
189
189
  Additional `repo` fields recognised by `holocron repo setup`:
190
190
 
191
- | Field | Type | Description |
192
- | ----------------- | --------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
193
- | `repo.teams` | `Array<string \| { slug, permission }>` | GitHub teams granted repo access. String shorthand defaults to `push` (Write). `holocron repo setup` also writes `.github/CODEOWNERS` for teams with `push`/`maintain`/`admin`. |
194
- | `repo.topics` | `string[]` | GitHub topics set on the repository. |
195
- | `repo.protection` | `"balanced" \| "strict" \| "none"` | Branch-protection preset applied by `holocron repo setup`. For `"strict"`, the required status checks are derived from the task manifest — see below. |
196
- | `repo.properties` | `RepoProperties` | Org-level custom property values synced to the GitHub dashboard. |
197
- | `repo.variables` | `{ repo?, org?, prune? }` | GitHub Actions variables created and updated by `holocron repo setup`. Undeclared ones are left alone unless `prune` is on. |
198
- | `repo.secrets` | `{ repo?, org?, environments? }` | Names of the secrets that must exist, checked (never written) by `holocron doctor secrets`. Names only. The notification layout's secrets and a Chromatic project token are expected without being listed. |
191
+ | Field | Type | Description |
192
+ | ----------------- | --------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
193
+ | `repo.teams` | `Array<string \| { slug, permission }>` | GitHub teams granted repo access. String shorthand defaults to `push` (Write). `holocron repo setup` also writes `.github/CODEOWNERS` for teams with `push`/`maintain`/`admin`. |
194
+ | `repo.topics` | `string[]` | GitHub topics set on the repository. |
195
+ | `repo.protection` | `"balanced" \| "strict" \| "none"` | Branch-protection preset applied by `holocron repo setup`. For `"strict"`, the required status checks are derived from the task manifest — see below. |
196
+ | `repo.properties` | `RepoProperties` | Org-level custom property values synced to the GitHub dashboard. |
197
+ | `repo.variables` | `{ repo?, org?, prune? }` | GitHub Actions variables created and updated by `holocron repo setup`. Undeclared ones are left alone unless `prune` is on. |
198
+ | `repo.secrets` | `{ repo?, org?, environments?, sync? }` | Names of the secrets that must exist, checked (never written) by `holocron doctor secrets`. Names only. The notification layout's secrets and a Chromatic project token are expected without being listed. `sync: [{ environment, keys?, scope? }]` declares the vault environments `secrets sync` fills from; the doctor expects their keys (every key the `vault` provider lists when `keys` is omitted, names only) at the `scope` (`repo`, `env=<name>`, `org=<name>`). |
199
199
 
200
200
  ### Custom properties synced to GitHub
201
201
 
@@ -550,6 +550,7 @@ commands and the config are provider-neutral; Discord is the first provider.
550
550
  | `holocron doctor notifications [--built-only] [--deliver]` | Step by step: does the server match the layout, do the secrets exist, and does a person (not the bot) own it. A full run also leaves one `🧪 test:` post in the layout's `testChannel`; `--built-only` posts nothing; `--deliver` posts to every channel and removes each post |
551
551
  | `holocron doctor variables` | Do the Actions variables `repo.variables` declares exist, with those values (and, for the organization's, that visibility)? One row for the repository and one for the organization, each only when declared. Read-only. An undeclared variable counts only with `prune`; a scope that cannot be read (no provider, no org token) is a skip, not a failure |
552
552
  | `holocron doctor environments` | Do the deployment environments exist? The ones `repo setup` creates (`staging`, `production`, when an `environments` provider is configured) plus every environment `repo.secrets.environments` names. One row. A missing one fails; an extra one is never a problem; no provider with some named is a skip |
553
+ | `holocron doctor monitoring` | Do the checks the `monitoring` provider declares exist in its account, matched by name, with the URL, method and (when stated) frequency, locations, activated, should-fail, body and assertions the config sets? One row. A check in the account that is not declared is never a problem. A provider that cannot list its checks, failed to load or has no token is a skip |
553
554
  | `holocron doctor secrets` | Do the secrets the config says must exist (`repo.secrets`, plus the notification layout's webhook and role secrets and the Chromatic token) exist? One row for the repository, the organization and each environment, each only when something is expected there. Names only; an undeclared secret is never a problem. A scope that cannot be read is a skip |
554
555
  | `holocron doctor tokens` | For every token a configured plugin lists (every plugin that resolves one: GitHub's nine, Discord's three, Sentry's two, ...), looked up as the plugin does (its env var, the vendor's, then keyring) and verified with its `verifyToken`: set and accepted is ok (with how long is left, when the token expires), set and rejected fails, a token with 7 days or fewer left fails with `expires in N days: renew it`, not set is a skip. No token is printed. What a token may do is not checked, because GitHub does not return a fine-grained token's permissions |
555
556
  | `holocron doctor --all` | Runs every deep check (`doctor notifications`, `doctor variables`, ...) and prints one row each, then `N ok, N fail, N skipped` counted in checks. Exits 1 when any check failed. A check that cannot run (no provider, no token) is a skip with the reason. Read-only: notifications runs as `--built-only`, so it posts nothing |
@@ -561,7 +562,7 @@ Channels fed by the error tracker add `feeds: { errors: true }` and a layout `re
561
562
 
562
563
  `holocron secrets sync <env> --worker <script>` also sets every key of the vault environment on a deployed Worker as a secret, through the optional `Workers.setSecret(script, name, value)` (write-only; the Cloudflare plugin implements it). The Worker must already exist. Sync only adds and updates: it never removes a binding, because a Worker also holds secrets that are not in the vault (for Comlink, the `COMLINK_<SOURCE>_WEBHOOK` that `notifications setup` sets), so a key deleted from the vault must be deleted from the Worker separately. Keys are written one at a time and each is reported; if one fails, the exit code is 1 and re-running finishes the rest, since every write is idempotent.
563
564
 
564
- `holocron secrets list [--scope repo|environment|organization] [--env <name>] [--json]` prints the names (never the values; GitHub does not return them) of the secrets at each scope, sorted, under a heading per scope. With no `--scope` it lists the repository, plus the organization (`--org`, `HOLOCRON_ORG` or the config's `org`) and the `--env` environment when they are known; `--scope` lists one. A scope that cannot be listed is reported under its heading and the rest are still listed; the exit code is 1 if any failed. `--json` prints `[{ scope, names, error? }]`. It is read-only, so `--dry-run` does not apply. Comparing the names with what the config expects is `doctor secrets`.
565
+ `holocron secrets list [--scope repo|environment|organization] [--env <name>] [--json]` prints the names (never the values; GitHub does not return them) of the secrets at each scope, sorted, under a heading per scope. With no `--scope` it lists the repository, plus the organization (`--org`, `HOLOCRON_ORG` or the config's `org`) and the `--env` environment when they are known; `--scope` lists one. A scope that cannot be listed is reported under its heading and the rest are still listed; the exit code is 1 if any failed. `--json` prints `[{ scope, names, error? }]`. It is read-only, so `--dry-run` does not apply. Comparing the names with what the config expects is `doctor secrets`, which also covers the keys of the vault environments declared in `repo.secrets.sync`.
565
566
 
566
567
  Pinned messages are declared under the provider's `layout` as `pinned: [{ channel, content }]` (`channel` is a channel in the layout, `content` up to 2000 characters); the layout is the whole set of messages the bot has pinned in those channels.
567
568
 
@@ -774,7 +775,7 @@ the local override exists to exempt.
774
775
  `package bump-versions`, `sync github`, `repo upgrade node`,
775
776
  `repo upgrade deps`, `new plugin`, `auth`, `notifications setup`,
776
777
  `notifications channel add`, `notifications link`,
777
- `notifications sync-roles`, `doctor environments`, `doctor notifications`, `doctor secrets`, `doctor tokens`, `doctor variables`
778
+ `notifications sync-roles`, `doctor environments`, `doctor monitoring`, `doctor notifications`, `doctor secrets`, `doctor tokens`, `doctor variables`
778
779
  - `src/commands/doctor-checks/` and `src/commands/deep-checks/` — the shared row
779
780
  renderer and `declaredVsActual` helper, and `DEEP_CHECKS`, the registry every
780
781
  `doctor <capability>` is listed in
package/dist/cli.mjs CHANGED
@@ -223,6 +223,7 @@ const COMMAND_CONTEXTS = {
223
223
  "doctor environments": "workspace",
224
224
  "doctor secrets": "workspace",
225
225
  "doctor tokens": "workspace",
226
+ "doctor monitoring": "workspace",
226
227
  "doctor variables": "workspace",
227
228
  probe: "workspace",
228
229
  deploy: "workspace",
@@ -1429,6 +1430,13 @@ const doctorEnvironmentsEntry = {
1429
1430
  positionals: [],
1430
1431
  supportsDryRun: false
1431
1432
  };
1433
+ // src/commands/doctor-monitoring/doctor-monitoring.entry.ts
1434
+ const doctorMonitoringEntry = {
1435
+ name: "doctor monitoring",
1436
+ description: "Check the monitoring checks the config declares against the ones the provider holds (read-only)",
1437
+ positionals: [],
1438
+ supportsDryRun: false
1439
+ };
1432
1440
  // src/commands/doctor-notifications/doctor-notifications.entry.ts
1433
1441
  const doctorNotificationsEntry = {
1434
1442
  name: "doctor notifications",
@@ -1667,6 +1675,7 @@ const COMMAND_REGISTRY = [
1667
1675
  supportsDryRun: true
1668
1676
  },
1669
1677
  notificationsChannelAddEntry,
1678
+ doctorMonitoringEntry,
1670
1679
  doctorNotificationsEntry,
1671
1680
  doctorEnvironmentsEntry,
1672
1681
  doctorSecretsEntry,
@@ -4440,8 +4449,8 @@ const SETUP_ENVIRONMENTS = ["staging", "production"];
4440
4449
  * set on one that exists. An environment that exists but is not expected is never a problem. With no provider and
4441
4450
  * nothing named, nothing is declared; with no provider but some named, the row is a skip with the reason.
4442
4451
  */
4443
- const ID = "environments";
4444
- const TITLE = "environments exist";
4452
+ const ID$1 = "environments";
4453
+ const TITLE$1 = "environments exist";
4445
4454
  async function runDoctorEnvironments(input) {
4446
4455
  const print = input.print ?? ((line) => console.log(line));
4447
4456
  const logger = input.logger ?? getLogger();
@@ -4465,8 +4474,8 @@ async function runDoctorEnvironments(input) {
4465
4474
  }
4466
4475
  async function checkEnvironments(loader, named) {
4467
4476
  const make = (status, detail, problems = []) => ({
4468
- id: ID,
4469
- title: TITLE,
4477
+ id: ID$1,
4478
+ title: TITLE$1,
4470
4479
  status,
4471
4480
  detail,
4472
4481
  problems
@@ -4503,6 +4512,160 @@ const doctorEnvironmentsCommand = {
4503
4512
  })).status === "fail") process.exitCode = 1;
4504
4513
  }
4505
4514
  };
4515
+ // src/commands/doctor-monitoring/doctor-monitoring.ts
4516
+ /**
4517
+ * `holocron doctor monitoring` — do the checks the `monitoring` provider declares exist in its account, as declared?
4518
+ *
4519
+ * Read-only. One row for the declared checks: each must exist by name, and what the config sets on it (URL, method,
4520
+ * frequency, locations, activated, should-fail, body, assertions) must be what the provider holds. A setting the
4521
+ * config leaves out is not compared, and a check in the account that is not declared is never a problem, since the
4522
+ * account may hold checks made by hand or by another tool. A provider that cannot list its checks, a missing
4523
+ * provider that failed to load, or a missing token is a skip with the reason, not a failure.
4524
+ *
4525
+ * Out of scope: the alert channel and its subscriptions (the notification layout declares those, see
4526
+ * `doctor notifications`) and any check that a message really arrives.
4527
+ */
4528
+ const ID = "monitoring-checks";
4529
+ const TITLE = "monitoring checks match";
4530
+ async function runDoctorMonitoring(input) {
4531
+ const print = input.print ?? ((line) => console.log(line));
4532
+ const logger = input.logger ?? getLogger();
4533
+ const loader = input.loader ?? new PluginLoader(input.loaded.resolved, input.context);
4534
+ await loader.load();
4535
+ assertPluginsResolvable(loader, "doctor monitoring");
4536
+ const rows = [await checkRow(loader)];
4537
+ printCheckRows(rows, print);
4538
+ const summary = summariseChecks(rows);
4539
+ printCheckSummary(summary, print);
4540
+ const status = summary.fail > 0 ? "fail" : summary.ok === 0 ? "skip" : "ok";
4541
+ logger.info({
4542
+ ...summary,
4543
+ status
4544
+ }, "doctor monitoring");
4545
+ return {
4546
+ status,
4547
+ rows,
4548
+ summary,
4549
+ ...status === "skip" ? { reason: rows.map((r) => r.detail).join("; ") } : {}
4550
+ };
4551
+ }
4552
+ async function checkRow(loader) {
4553
+ const skip = (detail) => ({
4554
+ id: ID,
4555
+ title: TITLE,
4556
+ status: "skip",
4557
+ detail,
4558
+ problems: []
4559
+ });
4560
+ if (!loader.has("monitoring")) {
4561
+ if (loader.loadFailures().some((f) => f.key === "monitoring")) return skip(whyMissing(loader, "monitoring", "no `monitoring` provider is available"));
4562
+ return {
4563
+ id: ID,
4564
+ title: TITLE,
4565
+ status: "ok",
4566
+ detail: "none declared",
4567
+ problems: []
4568
+ };
4569
+ }
4570
+ const monitoring = loader.get("monitoring");
4571
+ if (monitoring.checks.length === 0) return {
4572
+ id: ID,
4573
+ title: TITLE,
4574
+ status: "ok",
4575
+ detail: "none declared",
4576
+ problems: []
4577
+ };
4578
+ if (!monitoring.listChecks) return skip("provider does not implement listChecks");
4579
+ try {
4580
+ const problems = compareChecks(monitoring.checks, await monitoring.listChecks());
4581
+ if (problems.length > 0) return {
4582
+ id: ID,
4583
+ title: TITLE,
4584
+ status: "fail",
4585
+ detail: `${problems.length} problem(s)`,
4586
+ problems
4587
+ };
4588
+ const n = monitoring.checks.length;
4589
+ return {
4590
+ id: ID,
4591
+ title: TITLE,
4592
+ status: "ok",
4593
+ detail: `${n} of ${n} match`,
4594
+ problems: []
4595
+ };
4596
+ } catch (err) {
4597
+ if (err instanceof MissingTokenError) return skip(err.message);
4598
+ return {
4599
+ id: ID,
4600
+ title: TITLE,
4601
+ status: "fail",
4602
+ detail: errorMessage(err),
4603
+ problems: []
4604
+ };
4605
+ }
4606
+ }
4607
+ /** One assertion as a line: `status_code equals 405`, `header[x-a] contains b`. */
4608
+ function showAssertion(a) {
4609
+ return [
4610
+ a.property === void 0 ? a.source : `${a.source}[${a.property}]`,
4611
+ a.comparison,
4612
+ ...a.target === void 0 ? [] : [a.target]
4613
+ ].join(" ");
4614
+ }
4615
+ /** The settings of a check the config states, as comparable text; a setting it leaves out is not in the map. */
4616
+ function settings(check, declared) {
4617
+ const out = /* @__PURE__ */ new Map();
4618
+ const set = (key, value, present) => {
4619
+ if (present) out.set(key, value === void 0 ? "none" : String(value));
4620
+ };
4621
+ set("url", check.url, true);
4622
+ set("method", check.method ?? "GET", true);
4623
+ set("frequency", check.frequency, !declared || check.frequency !== void 0);
4624
+ set("activated", check.activated, !declared || check.activated !== void 0);
4625
+ set("shouldFail", check.shouldFail, !declared || check.shouldFail !== void 0);
4626
+ set("body", check.body, !declared || check.body !== void 0);
4627
+ set("locations", [...check.locations ?? []].sort().join(", "), !declared || check.locations !== void 0);
4628
+ set("assertions", (check.assertions ?? []).map(showAssertion).sort().join("; "), !declared || check.assertions !== void 0);
4629
+ return out;
4630
+ }
4631
+ function compareChecks(declared, have) {
4632
+ const byName = new Map(have.map((c) => [c.name, c]));
4633
+ const problems = declaredVsActual(new Map(declared.map((c) => [c.name, c])), byName, {
4634
+ noun: "check",
4635
+ flagExtra: false,
4636
+ equal: () => true
4637
+ });
4638
+ for (const want of declared) {
4639
+ const found = byName.get(want.name);
4640
+ if (!found) continue;
4641
+ const wanted = settings(want, true);
4642
+ const actual = new Map([...settings(found, false)].filter(([key]) => wanted.has(key)));
4643
+ problems.push(...declaredVsActual(wanted, actual, {
4644
+ noun: `check ${want.name}`,
4645
+ flagExtra: false,
4646
+ show: (value) => value === "" ? "none" : value
4647
+ }));
4648
+ }
4649
+ return problems;
4650
+ }
4651
+ // src/commands/doctor-monitoring/doctor-monitoring.command.ts
4652
+ const doctorMonitoringCommand = {
4653
+ command: "monitoring",
4654
+ describe: "Check the monitoring checks the config declares against the ones the provider holds (read-only)",
4655
+ handler: async (argv) => {
4656
+ const tokens = tokenContext(argv.token);
4657
+ if (!tokens) return;
4658
+ const loaded = await loadConfig(argv.cwd);
4659
+ applyResolvedConfig(argv, loaded.resolved);
4660
+ if ((await runDoctorMonitoring({
4661
+ loaded,
4662
+ context: {
4663
+ repoRoot: argv.cwd,
4664
+ ...tokens
4665
+ }
4666
+ })).status === "fail") process.exitCode = 1;
4667
+ }
4668
+ };
4506
4669
  // src/commands/doctor-notifications/doctor-notifications.args.ts
4507
4670
  const doctorNotificationsArgs = (y) => y.option("scope", {
4508
4671
  type: "string",
@@ -5640,13 +5803,14 @@ const doctorNotificationsCommand = {
5640
5803
  })).status === "fail") process.exitCode = 1;
5641
5804
  }
5642
5805
  };
5643
- // src/commands/doctor-secrets/expected-secrets.ts
5806
+ // src/commands/doctor-secrets/unique-names.ts
5644
5807
  /** Names that differ only in case are one secret to GitHub, so the first spelling wins. */
5645
- const unique = (names) => {
5808
+ const uniqueNames = (names) => {
5646
5809
  const seen = /* @__PURE__ */ new Map();
5647
5810
  for (const name of names) if (!seen.has(name.toUpperCase())) seen.set(name.toUpperCase(), name);
5648
5811
  return [...seen.values()];
5649
5812
  };
5813
+ // src/commands/doctor-secrets/expected-secrets.ts
5650
5814
  /**
5651
5815
  * The secret a Chromatic project reads: `CHROMATIC_PROJECT_TOKEN` for `default` (or no name), otherwise
5652
5816
  * `CHROMATIC_PROJECT_TOKEN_<NAME>`.
@@ -5661,9 +5825,69 @@ function expectedSecrets(config, layouts) {
5661
5825
  const declared = config.repo?.secrets;
5662
5826
  const chromatic = (config.tasks ?? []).flatMap((task) => typeof task === "object" && task.name === "verification.visualRegression" ? (task.with?.["chromatic-projects"] ?? []).map((project) => chromaticSecret(project.tokenName)) : []);
5663
5827
  return {
5664
- repo: unique([...declared?.repo ?? [], ...chromatic]),
5665
- org: unique([...declared?.org ?? [], ...layouts.flatMap(layoutSecretNames)]),
5666
- environments: Object.fromEntries(Object.entries(declared?.environments ?? {}).map(([env, names]) => [env, unique(names)]))
5828
+ repo: uniqueNames([...declared?.repo ?? [], ...chromatic]),
5829
+ org: uniqueNames([...declared?.org ?? [], ...layouts.flatMap(layoutSecretNames)]),
5830
+ environments: Object.fromEntries(Object.entries(declared?.environments ?? {}).map(([env, names]) => [env, uniqueNames(names)]))
5831
+ };
5832
+ }
5833
+ // src/commands/doctor-secrets/synced-secrets.ts
5834
+ /**
5835
+ * The secrets `holocron secrets sync` fills from a vault, as `repo.secrets.sync` declares them: which names land at
5836
+ * which scope. An entry that lists `keys` needs no vault. One that does not asks the vault which keys the environment
5837
+ * holds, and only the names are kept: the values the provider returns are dropped at once and never logged or printed.
5838
+ * An entry that cannot be resolved (no vault, no token, an environment the vault cannot list) is a skipped row with
5839
+ * the reason, and an unreadable `scope` is a failed one.
5840
+ *
5841
+ * @param entries - `repo.secrets.sync`.
5842
+ * @param vault - The `vault` provider, or why there is none.
5843
+ */
5844
+ async function syncedSecrets(entries, vault) {
5845
+ const scopes = [];
5846
+ const rows = [];
5847
+ for (const entry of entries) {
5848
+ const id = `sync-${entry.environment}`;
5849
+ const title = `${entry.environment} vault environment is synced`;
5850
+ let scope;
5851
+ try {
5852
+ scope = parseScope(entry.scope ?? "repo");
5853
+ } catch (err) {
5854
+ rows.push({
5855
+ id,
5856
+ title,
5857
+ status: "fail",
5858
+ detail: "1 problem(s)",
5859
+ problems: [describeProviderError(err)]
5860
+ });
5861
+ continue;
5862
+ }
5863
+ if (entry.keys) {
5864
+ scopes.push({
5865
+ scope,
5866
+ names: entry.keys
5867
+ });
5868
+ continue;
5869
+ }
5870
+ const skip = (detail) => rows.push({
5871
+ id,
5872
+ title,
5873
+ status: "skip",
5874
+ detail,
5875
+ problems: []
5876
+ });
5877
+ if ("why" in vault) skip(vault.why);
5878
+ else if (!vault.readEnvironment) skip(`vault provider (${vault.providerName}) cannot list an environment's keys`);
5879
+ else try {
5880
+ scopes.push({
5881
+ scope,
5882
+ names: Object.keys(await vault.readEnvironment(entry.environment))
5883
+ });
5884
+ } catch (err) {
5885
+ skip(err instanceof MissingTokenError ? err.message : `could not read vault environment ${entry.environment}: ${describeProviderError(err)}`);
5886
+ }
5887
+ }
5888
+ return {
5889
+ scopes,
5890
+ rows
5667
5891
  };
5668
5892
  }
5669
5893
  // src/commands/doctor-secrets/doctor-secrets.ts
@@ -5684,6 +5908,12 @@ async function runDoctorSecrets(input) {
5684
5908
  const config = input.loaded.resolved;
5685
5909
  const expected = expectedSecrets(config, (loader.has("notifications") ? loader.get("notifications") : []).flatMap((p) => p.layout ? [p.layout] : []));
5686
5910
  const org = input.context.org ?? (input.context.repo ?? config.repo?.name ?? "").split("/")[0];
5911
+ const synced = await syncedSecrets(config.repo?.secrets?.sync ?? [], loader.has("vault") ? loader.get("vault") : { why: whyMissing(loader, "vault", "no `vault` provider to list the environment's keys with") });
5912
+ const foreignOrgs = /* @__PURE__ */ new Map();
5913
+ for (const { scope, names } of synced.scopes) if (scope.kind === "repo") expected.repo = uniqueNames([...expected.repo, ...names]);
5914
+ else if (scope.kind === "environment") expected.environments[scope.name] = uniqueNames([...expected.environments[scope.name] ?? [], ...names]);
5915
+ else if (scope.name === org) expected.org = uniqueNames([...expected.org, ...names]);
5916
+ else foreignOrgs.set(scope.name, uniqueNames([...foreignOrgs.get(scope.name) ?? [], ...names]));
5687
5917
  const checks = [];
5688
5918
  if (expected.repo.length > 0) checks.push({
5689
5919
  id: "repo-secrets",
@@ -5712,8 +5942,20 @@ async function runDoctorSecrets(input) {
5712
5942
  names
5713
5943
  });
5714
5944
  }
5945
+ for (const [name, names] of foreignOrgs) {
5946
+ if (names.length === 0) continue;
5947
+ checks.push({
5948
+ id: `org-secrets-${name}`,
5949
+ title: `${name} organization secrets exist`,
5950
+ scope: {
5951
+ kind: "organization",
5952
+ name
5953
+ },
5954
+ names
5955
+ });
5956
+ }
5715
5957
  const rows = [];
5716
- if (checks.length === 0) rows.push({
5958
+ if (checks.length === 0 && synced.rows.length === 0) rows.push({
5717
5959
  id: "secrets",
5718
5960
  title: "secrets",
5719
5961
  status: "ok",
@@ -5733,6 +5975,7 @@ async function runDoctorSecrets(input) {
5733
5975
  const secrets = loader.get("secrets");
5734
5976
  for (const check of checks) rows.push(await checkScope(secrets, check));
5735
5977
  }
5978
+ rows.push(...synced.rows);
5736
5979
  printCheckRows(rows, print);
5737
5980
  const summary = summariseChecks(rows);
5738
5981
  printCheckSummary(summary, print);
@@ -6128,6 +6371,19 @@ const DEEP_CHECKS = [
6128
6371
  };
6129
6372
  }
6130
6373
  },
6374
+ {
6375
+ name: "monitoring",
6376
+ capability: "monitoring",
6377
+ command: doctorMonitoringCommand,
6378
+ async run(input) {
6379
+ const report = await runDoctorMonitoring(input);
6380
+ return {
6381
+ status: report.status,
6382
+ summary: report.summary,
6383
+ ...report.reason ? { reason: report.reason } : {}
6384
+ };
6385
+ }
6386
+ },
6131
6387
  {
6132
6388
  name: "secrets",
6133
6389
  capability: "secrets",