@theholocron/cli 5.0.0-alpha.276 → 5.0.0-alpha.277
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 +1 -1
- package/dist/cli.mjs +227 -133
- package/dist/cli.mjs.map +1 -1
- package/dist/{index-Czpb0oQX.d.mts → index-D_HJGtOY.d.mts} +54 -1
- package/dist/{index-DvgH4Vvm.d.mts → index-dMk1XHFO.d.mts} +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/plugin/capabilities.d.mts +2 -2
- package/dist/presets.d.mts +1 -1
- package/package.json +13 -13
package/README.md
CHANGED
|
@@ -548,7 +548,7 @@ commands and the config are provider-neutral; Discord is the first provider.
|
|
|
548
548
|
| `holocron notifications create-server --name <n> --owner <id>` | Creates the server the layout describes, writes its id into the config, applies the layout, invites the owner, waits for them to join and hands the server over (`--resume` finishes an interrupted hand-over; `--force` allows a second server) |
|
|
549
549
|
| `holocron notifications link` | Links your account on the provider to your GitHub account by signing in with the provider (OAuth, nothing secret kept) |
|
|
550
550
|
| `holocron notifications sync-roles` | Makes who holds a role match a GitHub team, through the links file (`--keep` only adds; `--provider` picks one) |
|
|
551
|
-
| `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
|
+
| `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. It also reads the Checkly feed (webhook, alert channel, subscriptions) and the Comlink relay (Worker, route, bindings, the tracker's integration and rule), posting nothing, so `--built-only` keeps those steps |
|
|
552
552
|
| `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 |
|
|
553
553
|
| `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 |
|
|
554
554
|
| `holocron doctor repo` | Do the repository settings `repo setup` writes match the config? One row per group the config declares: description and homepage, default branch and merge settings, topics, custom properties, team access, branch protection; labels and security settings are always checked. Read-only. Reads through optional `Source` methods (`getRepoInfo`, `getProperties`, `listLabels`, `listTeamAccess`, `getRulesetDetail`, `getSecurity`); a group that cannot be read is a skip, not a failure |
|
package/dist/cli.mjs
CHANGED
|
@@ -24,7 +24,7 @@ import { errorMessage } from "@theholocron/misc-utils";
|
|
|
24
24
|
import path, { basename, dirname, join, relative, resolve, sep } from "node:path";
|
|
25
25
|
import { ConfigFileError, loadConfigFile } from "@theholocron/datapad";
|
|
26
26
|
import { readGitRemote, updateGitignore } from "@theholocron/git-utils";
|
|
27
|
-
import { discoverWorkspacePackages, readPackageJson, readPackageJsonSync, resolveWorkspaceGlobs } from "@theholocron/pkg-utils";
|
|
27
|
+
import { bumpCatalogPins, discoverWorkspacePackages, parseCatalogs, readPackageJson, readPackageJsonSync, resolveWorkspaceGlobs } from "@theholocron/pkg-utils";
|
|
28
28
|
import { findRootSync, isWorkspaceRoot, walkFilesSync } from "@theholocron/fs-utils";
|
|
29
29
|
import { access, copyFile, mkdir, open, readFile, readdir, realpath, rename, rm, stat, symlink, unlink, writeFile } from "node:fs/promises";
|
|
30
30
|
import { createServer } from "node:http";
|
|
@@ -3966,6 +3966,17 @@ function summariseChecks(rows) {
|
|
|
3966
3966
|
skip: rows.filter((r) => r.status === "skip").length
|
|
3967
3967
|
};
|
|
3968
3968
|
}
|
|
3969
|
+
// src/commands/missing-token/missing-token.ts
|
|
3970
|
+
/**
|
|
3971
|
+
* Why a provider call could not be tried for want of a token, or undefined when the error is something else. A plugin
|
|
3972
|
+
* resolves its token on first use and throws an `AuthError` naming where it looked; the GitHub plugin throws a
|
|
3973
|
+
* {@link MissingTokenError}. Both mean "no token", which a deep check reports as a skip, not a failure. The
|
|
3974
|
+
* `AuthError` is matched by name because the plugin and the CLI may each hold their own copy of the class.
|
|
3975
|
+
*/
|
|
3976
|
+
function missingTokenReason(err) {
|
|
3977
|
+
if (err instanceof MissingTokenError) return err.message;
|
|
3978
|
+
if (err instanceof Error && err.name === "AuthError") return err.message;
|
|
3979
|
+
}
|
|
3969
3980
|
// src/commands/notifications-channel-add/avatar.ts
|
|
3970
3981
|
/**
|
|
3971
3982
|
* Read a webhook avatar named in a layout: a file path (from the directory the CLI runs in) or an
|
|
@@ -4633,7 +4644,7 @@ async function runDoctorDns(input) {
|
|
|
4633
4644
|
});
|
|
4634
4645
|
else if (!loader.has("dns")) {
|
|
4635
4646
|
const why = whyMissing(loader, "dns", "no `dns` provider to check them with");
|
|
4636
|
-
for (const zone of zones) rows.push(row$
|
|
4647
|
+
for (const zone of zones) rows.push(row$3(zone, "skip", why));
|
|
4637
4648
|
} else {
|
|
4638
4649
|
const dns = loader.get("dns");
|
|
4639
4650
|
for (const zone of zones) rows.push(await checkZone(dns, zone, expected.filter((e) => e.zone === zone).map((e) => e.record)));
|
|
@@ -4653,7 +4664,7 @@ async function runDoctorDns(input) {
|
|
|
4653
4664
|
...status === "skip" ? { reason: [...new Set(rows.map((r) => r.detail))].join("; ") } : {}
|
|
4654
4665
|
};
|
|
4655
4666
|
}
|
|
4656
|
-
function row$
|
|
4667
|
+
function row$3(zone, status, detail, problems = []) {
|
|
4657
4668
|
return {
|
|
4658
4669
|
id: `dns-${zone}`,
|
|
4659
4670
|
title: `${zone} records exist`,
|
|
@@ -4671,9 +4682,10 @@ async function checkZone(dns, zone, wanted) {
|
|
|
4671
4682
|
equal: (want, found) => sameContent(want.content, found.content) && (want.proxied !== true || found.proxied === true),
|
|
4672
4683
|
show: (r) => `${r.content}${r.proxied ? " (proxied)" : ""}`
|
|
4673
4684
|
});
|
|
4674
|
-
return problems.length > 0 ? row$
|
|
4685
|
+
return problems.length > 0 ? row$3(zone, "fail", `${problems.length} problem(s)`, problems) : row$3(zone, "ok", `${wanted.length} of ${wanted.length} exist`);
|
|
4675
4686
|
} catch (err) {
|
|
4676
|
-
|
|
4687
|
+
const noToken = missingTokenReason(err);
|
|
4688
|
+
return noToken !== void 0 ? row$3(zone, "skip", noToken) : row$3(zone, "fail", errorMessage(err));
|
|
4677
4689
|
}
|
|
4678
4690
|
}
|
|
4679
4691
|
// src/commands/doctor-dns/doctor-dns.command.ts
|
|
@@ -4748,7 +4760,8 @@ async function checkEnvironments(loader, named) {
|
|
|
4748
4760
|
});
|
|
4749
4761
|
return problems.length > 0 ? make("fail", `${problems.length} problem(s)`, problems) : make("ok", `${names.length} of ${names.length} exist`);
|
|
4750
4762
|
} catch (err) {
|
|
4751
|
-
|
|
4763
|
+
const noToken = missingTokenReason(err);
|
|
4764
|
+
return noToken !== void 0 ? make("skip", noToken) : make("fail", errorMessage(err));
|
|
4752
4765
|
}
|
|
4753
4766
|
}
|
|
4754
4767
|
// src/commands/doctor-environments/doctor-environments.command.ts
|
|
@@ -4852,7 +4865,8 @@ async function checkRow(loader) {
|
|
|
4852
4865
|
problems: []
|
|
4853
4866
|
};
|
|
4854
4867
|
} catch (err) {
|
|
4855
|
-
|
|
4868
|
+
const noToken = missingTokenReason(err);
|
|
4869
|
+
if (noToken !== void 0) return skip(noToken);
|
|
4856
4870
|
return {
|
|
4857
4871
|
id: ID,
|
|
4858
4872
|
title: TITLE,
|
|
@@ -4940,16 +4954,26 @@ const doctorNotificationsArgs = (y) => y.option("scope", {
|
|
|
4940
4954
|
default: false,
|
|
4941
4955
|
describe: "Post a test message through every channel's webhook, read it back and remove it (works with --built-only)"
|
|
4942
4956
|
});
|
|
4943
|
-
// src/commands/
|
|
4944
|
-
/**
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4957
|
+
// src/commands/notification-check-rows/notification-check-rows.ts
|
|
4958
|
+
/** A step that could not be tried: the reason is the detail, and it is not a failure. */
|
|
4959
|
+
function skipRow(id, title, reason) {
|
|
4960
|
+
return {
|
|
4961
|
+
id,
|
|
4962
|
+
title,
|
|
4963
|
+
status: "skip",
|
|
4964
|
+
detail: reason,
|
|
4965
|
+
problems: []
|
|
4966
|
+
};
|
|
4967
|
+
}
|
|
4968
|
+
/** A step that held when it has no problems, and failed with one line per problem when it has. */
|
|
4969
|
+
function resultRow(id, title, problems, ok) {
|
|
4970
|
+
return {
|
|
4971
|
+
id,
|
|
4972
|
+
title,
|
|
4973
|
+
status: problems.length === 0 ? "pass" : "fail",
|
|
4974
|
+
detail: problems.length === 0 ? ok : `${problems.length} problem(s)`,
|
|
4975
|
+
problems
|
|
4976
|
+
};
|
|
4953
4977
|
}
|
|
4954
4978
|
// src/commands/notifications-sync-roles/plan.ts
|
|
4955
4979
|
/**
|
|
@@ -5576,32 +5600,18 @@ async function runNotificationsSetup(input$1) {
|
|
|
5576
5600
|
return report;
|
|
5577
5601
|
}
|
|
5578
5602
|
// src/commands/monitoring-feed-checks/monitoring-feed-checks.ts
|
|
5579
|
-
const WEBHOOK_ID = "monitoring-feed-webhook";
|
|
5580
|
-
const WEBHOOK_TITLE = "monitoring feed webhook exists and has a picture";
|
|
5603
|
+
const WEBHOOK_ID$1 = "monitoring-feed-webhook";
|
|
5604
|
+
const WEBHOOK_TITLE$1 = "monitoring feed webhook exists and has a picture";
|
|
5581
5605
|
const CHANNEL_ID = "monitoring-alert-channel";
|
|
5582
5606
|
const CHANNEL_TITLE = "monitoring alert channel posts through the feed webhook";
|
|
5583
5607
|
const SUBSCRIPTIONS_ID = "monitoring-subscriptions";
|
|
5584
5608
|
const SUBSCRIPTIONS_TITLE = "monitoring alert channel is subscribed to every check";
|
|
5585
|
-
const same$
|
|
5586
|
-
const shown$
|
|
5587
|
-
const skip = (id, title, reason) => ({
|
|
5588
|
-
id,
|
|
5589
|
-
title,
|
|
5590
|
-
status: "skip",
|
|
5591
|
-
detail: reason,
|
|
5592
|
-
problems: []
|
|
5593
|
-
});
|
|
5594
|
-
const row$3 = (id, title, problems, ok) => ({
|
|
5595
|
-
id,
|
|
5596
|
-
title,
|
|
5597
|
-
status: problems.length === 0 ? "pass" : "fail",
|
|
5598
|
-
detail: problems.length === 0 ? ok : `${problems.length} problem(s)`,
|
|
5599
|
-
problems
|
|
5600
|
-
});
|
|
5609
|
+
const same$2 = (a, b) => a.toLowerCase() === b.toLowerCase();
|
|
5610
|
+
const shown$3 = (s) => sanitizeDetail(s);
|
|
5601
5611
|
const skipAll = (reason) => [
|
|
5602
|
-
|
|
5603
|
-
|
|
5604
|
-
|
|
5612
|
+
skipRow(WEBHOOK_ID$1, WEBHOOK_TITLE$1, reason),
|
|
5613
|
+
skipRow(CHANNEL_ID, CHANNEL_TITLE, reason),
|
|
5614
|
+
skipRow(SUBSCRIPTIONS_ID, SUBSCRIPTIONS_TITLE, reason)
|
|
5605
5615
|
];
|
|
5606
5616
|
/**
|
|
5607
5617
|
* The steps of `doctor notifications` that check the monitoring provider's feed into Discord: the webhook it posts
|
|
@@ -5624,14 +5634,14 @@ async function monitoringFeedChecks(input) {
|
|
|
5624
5634
|
let channelSkip;
|
|
5625
5635
|
for (const { channel, feed } of fed) {
|
|
5626
5636
|
const names = monitoringFeed(channel.name, feed, monitoring);
|
|
5627
|
-
const where = found.channels.find((c) => same$
|
|
5637
|
+
const where = found.channels.find((c) => same$2(c.name, channel.name));
|
|
5628
5638
|
const hookId = where?.webhookIds?.[names.webhook.toLowerCase()];
|
|
5629
|
-
const named = where?.webhooks.some((w) => same$
|
|
5630
|
-
const label = `#${shown$
|
|
5639
|
+
const named = where?.webhooks.some((w) => same$2(w, names.webhook)) ?? false;
|
|
5640
|
+
const label = `#${shown$3(channel.name)}`;
|
|
5631
5641
|
if (!where) webhookProblems.push(`${label}: no channel to hold the feed webhook`);
|
|
5632
|
-
else if (where.webhooksError) webhookProblems.push(`${label}: could not list its webhooks (${shown$
|
|
5633
|
-
else if (!named) webhookProblems.push(`${label}: no webhook named ${shown$
|
|
5634
|
-
else if (feedAvatarOf(layout, feed, monitoring).length > 0 && !where.webhookAvatars?.some((w) => same$
|
|
5642
|
+
else if (where.webhooksError) webhookProblems.push(`${label}: could not list its webhooks (${shown$3(where.webhooksError)})`);
|
|
5643
|
+
else if (!named) webhookProblems.push(`${label}: no webhook named ${shown$3(names.webhook)}`);
|
|
5644
|
+
else if (feedAvatarOf(layout, feed, monitoring).length > 0 && !where.webhookAvatars?.some((w) => same$2(w, names.webhook))) webhookProblems.push(`${label}: webhook ${shown$3(names.webhook)} has no picture`);
|
|
5635
5645
|
if (channelSkip !== void 0) continue;
|
|
5636
5646
|
if (!monitoring.inspectAlertChannel) {
|
|
5637
5647
|
channelSkip = `the \`${monitoring.providerName}\` provider cannot read its alert channels`;
|
|
@@ -5646,21 +5656,21 @@ async function monitoringFeedChecks(input) {
|
|
|
5646
5656
|
channelSkip = noToken;
|
|
5647
5657
|
continue;
|
|
5648
5658
|
}
|
|
5649
|
-
channelProblems.push(`${label}: ${shown$
|
|
5659
|
+
channelProblems.push(`${label}: ${shown$3(describeProviderError(err))}`);
|
|
5650
5660
|
continue;
|
|
5651
5661
|
}
|
|
5652
5662
|
if (!state.exists) {
|
|
5653
|
-
channelProblems.push(`${label}: missing alert channel ${shown$
|
|
5663
|
+
channelProblems.push(`${label}: missing alert channel ${shown$3(names.name)}`);
|
|
5654
5664
|
continue;
|
|
5655
5665
|
}
|
|
5656
|
-
if (!state.discord) channelProblems.push(`${label}: ${shown$
|
|
5657
|
-
if (!state.webhookId) channelProblems.push(`${label}: ${shown$
|
|
5658
|
-
else if (hookId !== void 0 && state.webhookId !== hookId) channelProblems.push(`${label}: ${shown$
|
|
5659
|
-
for (const check of state.unsubscribed) subscriptionProblems.push(`${label}: ${shown$
|
|
5660
|
-
for (const check of state.deactivated) subscriptionProblems.push(`${label}: ${shown$
|
|
5666
|
+
if (!state.discord) channelProblems.push(`${label}: ${shown$3(names.name)} is not formatted for Discord`);
|
|
5667
|
+
if (!state.webhookId) channelProblems.push(`${label}: ${shown$3(names.name)} does not post to a Discord webhook URL`);
|
|
5668
|
+
else if (hookId !== void 0 && state.webhookId !== hookId) channelProblems.push(`${label}: ${shown$3(names.name)} posts through a different webhook than ${shown$3(names.webhook)}`);
|
|
5669
|
+
for (const check of state.unsubscribed) subscriptionProblems.push(`${label}: ${shown$3(names.name)} is not subscribed to ${shown$3(check)}`);
|
|
5670
|
+
for (const check of state.deactivated) subscriptionProblems.push(`${label}: ${shown$3(names.name)} has ${shown$3(check)} switched off`);
|
|
5661
5671
|
}
|
|
5662
5672
|
const n = fed.length;
|
|
5663
|
-
return [
|
|
5673
|
+
return [resultRow(WEBHOOK_ID$1, WEBHOOK_TITLE$1, webhookProblems, `${n} of ${n} as declared`), ...channelSkip === void 0 ? [resultRow(CHANNEL_ID, CHANNEL_TITLE, channelProblems, `${n} of ${n} as declared`), resultRow(SUBSCRIPTIONS_ID, SUBSCRIPTIONS_TITLE, subscriptionProblems, `${n} of ${n} subscribed`)] : [skipRow(CHANNEL_ID, CHANNEL_TITLE, channelSkip), skipRow(SUBSCRIPTIONS_ID, SUBSCRIPTIONS_TITLE, channelSkip)]];
|
|
5664
5674
|
}
|
|
5665
5675
|
const localRedirectUri = (port) => `http://localhost:${port}/callback`;
|
|
5666
5676
|
/**
|
|
@@ -6166,6 +6176,143 @@ async function runNotificationsLink(input) {
|
|
|
6166
6176
|
return refuse(describeProviderError(err), logReason(err));
|
|
6167
6177
|
}
|
|
6168
6178
|
}
|
|
6179
|
+
// src/commands/relay-checks/relay-checks.ts
|
|
6180
|
+
/** How long to wait for the Worker before calling it unreachable. */
|
|
6181
|
+
const RELAY_TIMEOUT_MS = 5e3;
|
|
6182
|
+
const ANSWERS_ID = "relay-answers";
|
|
6183
|
+
const ANSWERS_TITLE = "relay Worker answers an unsigned request with 401";
|
|
6184
|
+
const WORKER_ID = "relay-worker";
|
|
6185
|
+
const WORKER_TITLE = "relay Worker is deployed and routed";
|
|
6186
|
+
const BINDINGS_ID = "relay-bindings";
|
|
6187
|
+
const BINDINGS_TITLE = "relay Worker has its webhook and signing secret bound";
|
|
6188
|
+
const WEBHOOK_ID = "relay-feed-webhook";
|
|
6189
|
+
const WEBHOOK_TITLE = "error feed webhook exists and has a picture";
|
|
6190
|
+
const same$1 = (a, b) => a.toLowerCase() === b.toLowerCase();
|
|
6191
|
+
const shown$2 = (s) => sanitizeDetail(s);
|
|
6192
|
+
/** One unsigned `POST` to the Worker, and what the answer says about it. Reads nothing from the response. */
|
|
6193
|
+
async function answers(url, doFetch) {
|
|
6194
|
+
try {
|
|
6195
|
+
const response = await doFetch(url, {
|
|
6196
|
+
method: "POST",
|
|
6197
|
+
redirect: "manual",
|
|
6198
|
+
signal: AbortSignal.timeout(RELAY_TIMEOUT_MS)
|
|
6199
|
+
});
|
|
6200
|
+
if (response.status === 401) return [];
|
|
6201
|
+
if (response.status === 404) return [`${shown$2(url)} answered 404: the Worker is not deployed or has no route`];
|
|
6202
|
+
return [`${shown$2(url)} answered ${response.status}, expected 401 for an unsigned request`];
|
|
6203
|
+
} catch (err) {
|
|
6204
|
+
return [err instanceof Error && err.name === "TimeoutError" ? `${shown$2(url)} gave no answer within ${RELAY_TIMEOUT_MS / 1e3}s` : `${shown$2(url)} could not be reached: ${shown$2(errorMessage(err))}`];
|
|
6205
|
+
}
|
|
6206
|
+
}
|
|
6207
|
+
/**
|
|
6208
|
+
* The steps of `doctor notifications` that check the Comlink relay: the Worker answers an unsigned request with 401,
|
|
6209
|
+
* its script and route are deployed, its webhook and signing secret are bound (names only), and the feed webhook the
|
|
6210
|
+
* relay posts through exists. Read-only: the one request is unsigned, which the Worker rejects before reading it. No
|
|
6211
|
+
* rows when the layout declares no relay. The DNS record is `doctor dns`'s.
|
|
6212
|
+
*/
|
|
6213
|
+
async function relayChecks(input) {
|
|
6214
|
+
const { layout } = input;
|
|
6215
|
+
const relay = layout.relay;
|
|
6216
|
+
if (!relay?.host || !wantsRelay(layout)) return [];
|
|
6217
|
+
if (!input.errors) return [
|
|
6218
|
+
skipRow(ANSWERS_ID, ANSWERS_TITLE, input.errorsMissingReason),
|
|
6219
|
+
skipRow(WORKER_ID, WORKER_TITLE, input.errorsMissingReason),
|
|
6220
|
+
skipRow(BINDINGS_ID, BINDINGS_TITLE, input.errorsMissingReason),
|
|
6221
|
+
skipRow(WEBHOOK_ID, WEBHOOK_TITLE, input.errorsMissingReason)
|
|
6222
|
+
];
|
|
6223
|
+
const source = input.errors.providerName;
|
|
6224
|
+
const rows = [];
|
|
6225
|
+
rows.push(resultRow(ANSWERS_ID, ANSWERS_TITLE, await answers(`https://${relay.host}/${source}`, input.fetch ?? fetch), `https://${shown$2(relay.host)}/${shown$2(source)} answered 401`));
|
|
6226
|
+
const script = relay.script ?? "comlink";
|
|
6227
|
+
const route = `${relay.host}/*`;
|
|
6228
|
+
const skipWorker = (reason) => [skipRow(WORKER_ID, WORKER_TITLE, reason), skipRow(BINDINGS_ID, BINDINGS_TITLE, reason)];
|
|
6229
|
+
if (!input.workers) rows.push(...skipWorker(input.workersMissingReason));
|
|
6230
|
+
else if (!input.workers.inspectScript) rows.push(...skipWorker(`the \`${input.workers.providerName}\` provider cannot read its Workers`));
|
|
6231
|
+
else try {
|
|
6232
|
+
const state = await input.workers.inspectScript(script, relay.host);
|
|
6233
|
+
if (!state.exists) rows.push(resultRow(WORKER_ID, WORKER_TITLE, [`no Worker named ${shown$2(script)}`], ""), skipRow(BINDINGS_ID, BINDINGS_TITLE, `not checked: no Worker named ${shown$2(script)}`));
|
|
6234
|
+
else {
|
|
6235
|
+
const bound = new Set(state.bindingNames.map((n) => n.toUpperCase()));
|
|
6236
|
+
const wanted = [relayWebhookBinding(source), relaySecretBinding(source)];
|
|
6237
|
+
rows.push(resultRow(WORKER_ID, WORKER_TITLE, state.routes.some((r) => same$1(r, route)) ? [] : [`${shown$2(script)} has no route ${shown$2(route)}`], `${shown$2(script)} serves ${shown$2(route)}`), resultRow(BINDINGS_ID, BINDINGS_TITLE, wanted.filter((n) => !bound.has(n)).map((n) => `${n}: not bound`), `${wanted.length} of ${wanted.length} bound`));
|
|
6238
|
+
}
|
|
6239
|
+
} catch (err) {
|
|
6240
|
+
const reason = missingTokenReason(err);
|
|
6241
|
+
rows.push(...reason === void 0 ? [resultRow(WORKER_ID, WORKER_TITLE, [shown$2(describeProviderError(err))], ""), skipRow(BINDINGS_ID, BINDINGS_TITLE, "not checked: could not read the Worker")] : skipWorker(reason));
|
|
6242
|
+
}
|
|
6243
|
+
rows.push(webhookRow(input, source));
|
|
6244
|
+
return rows;
|
|
6245
|
+
}
|
|
6246
|
+
/** The error feed's webhook is on its channel, with a picture when the layout or the provider gives one. */
|
|
6247
|
+
function webhookRow(input, source) {
|
|
6248
|
+
if (!input.found) return skipRow(WEBHOOK_ID, WEBHOOK_TITLE, "not checked: could not read the server");
|
|
6249
|
+
const channel = input.layout.categories.flatMap((cat) => cat.channels ?? []).find((c) => c.feeds?.errors);
|
|
6250
|
+
const feed = channel.feeds.errors;
|
|
6251
|
+
const name = errorsFeedWebhook(feed, { providerName: source });
|
|
6252
|
+
const where = input.found.channels.find((c) => same$1(c.name, channel.name));
|
|
6253
|
+
const label = `#${shown$2(channel.name)}`;
|
|
6254
|
+
const problems = [];
|
|
6255
|
+
if (!where) problems.push(`${label}: no channel to hold the feed webhook`);
|
|
6256
|
+
else if (where.webhooksError) problems.push(`${label}: could not list its webhooks (${shown$2(where.webhooksError)})`);
|
|
6257
|
+
else if (!where.webhooks.some((w) => same$1(w, name))) problems.push(`${label}: no webhook named ${shown$2(name)}`);
|
|
6258
|
+
else if (feedAvatarOf(input.layout, feed).length > 0 && !where.webhookAvatars?.some((w) => same$1(w, name))) problems.push(`${label}: webhook ${shown$2(name)} has no picture`);
|
|
6259
|
+
return resultRow(WEBHOOK_ID, WEBHOOK_TITLE, problems, `${label}: ${shown$2(name)}`);
|
|
6260
|
+
}
|
|
6261
|
+
// src/commands/sentry-relay-checks/sentry-relay-checks.ts
|
|
6262
|
+
const INTEGRATION_ID = "relay-integration";
|
|
6263
|
+
const INTEGRATION_TITLE = "error tracker integration posts to the relay";
|
|
6264
|
+
const RULE_ID = "relay-rule";
|
|
6265
|
+
const RULE_TITLE = "error tracker alert rule is on and sends through the integration";
|
|
6266
|
+
const shown$1 = (s) => sanitizeDetail(s);
|
|
6267
|
+
const bare = (url) => url.replace(/\/+$/, "");
|
|
6268
|
+
/**
|
|
6269
|
+
* The steps of `doctor notifications` that check the error tracker's side of the relay: the integration exists, posts
|
|
6270
|
+
* to the relay Worker and is offered as an alert action, and the alert rule is on each project, enabled and sending
|
|
6271
|
+
* through the integration. Read-only, and the integration's signing secret is never read. No rows unless the layout
|
|
6272
|
+
* declares `relay.errors`, which is what `notifications setup` acts on.
|
|
6273
|
+
*/
|
|
6274
|
+
async function sentryRelayChecks(input) {
|
|
6275
|
+
const { layout, errors } = input;
|
|
6276
|
+
const tracker = layout.relay?.errors;
|
|
6277
|
+
if (!tracker || !wantsRelay(layout)) return [];
|
|
6278
|
+
const skipBoth = (reason) => [skipRow(INTEGRATION_ID, INTEGRATION_TITLE, reason), skipRow(RULE_ID, RULE_TITLE, reason)];
|
|
6279
|
+
if (!errors) return skipBoth(input.errorsMissingReason);
|
|
6280
|
+
if (!errors.inspectRelay) return skipBoth(`the \`${errors.providerName}\` provider cannot read its relay`);
|
|
6281
|
+
const name = tracker.integration ?? "Comlink";
|
|
6282
|
+
const rule = tracker.rule ?? "Errors to Discord (Comlink)";
|
|
6283
|
+
let state;
|
|
6284
|
+
try {
|
|
6285
|
+
state = await errors.inspectRelay({
|
|
6286
|
+
name,
|
|
6287
|
+
projects: tracker.projects,
|
|
6288
|
+
rule: { name: rule }
|
|
6289
|
+
});
|
|
6290
|
+
} catch (err) {
|
|
6291
|
+
const noToken = missingTokenReason(err);
|
|
6292
|
+
if (noToken !== void 0) return skipBoth(noToken);
|
|
6293
|
+
return [resultRow(INTEGRATION_ID, INTEGRATION_TITLE, [shown$1(describeProviderError(err))], ""), skipRow(RULE_ID, RULE_TITLE, "not checked: could not read the integration")];
|
|
6294
|
+
}
|
|
6295
|
+
const expected = `https://${layout.relay.host}/${errors.providerName}`;
|
|
6296
|
+
const integrationProblems = [];
|
|
6297
|
+
if (!state.integration) integrationProblems.push(`no integration named ${shown$1(name)}`);
|
|
6298
|
+
else {
|
|
6299
|
+
const posts = state.integration.webhookUrl;
|
|
6300
|
+
if (bare(posts ?? "") !== expected) integrationProblems.push(`${shown$1(name)} posts to ${shown$1(posts ?? "nowhere")}, not ${shown$1(expected)}`);
|
|
6301
|
+
if (!state.integration.alertAction) integrationProblems.push(`${shown$1(name)} is not offered as an alert action`);
|
|
6302
|
+
}
|
|
6303
|
+
const ruleProblems = [];
|
|
6304
|
+
for (const project of tracker.projects) {
|
|
6305
|
+
const found = state.rules.find((r) => r.project === project);
|
|
6306
|
+
if (!found) {
|
|
6307
|
+
ruleProblems.push(`${shown$1(project)}: no rule named ${shown$1(rule)} on it`);
|
|
6308
|
+
continue;
|
|
6309
|
+
}
|
|
6310
|
+
if (!found.enabled) ruleProblems.push(`${shown$1(project)}: ${shown$1(rule)} is disabled`);
|
|
6311
|
+
if (!found.sends) ruleProblems.push(`${shown$1(project)}: ${shown$1(rule)} does not send through ${shown$1(name)}`);
|
|
6312
|
+
}
|
|
6313
|
+
const n = tracker.projects.length;
|
|
6314
|
+
return [resultRow(INTEGRATION_ID, INTEGRATION_TITLE, integrationProblems, `${shown$1(name)} posts to ${shown$1(expected)}`), resultRow(RULE_ID, RULE_TITLE, ruleProblems, n === 0 ? "none declared" : `${n} of ${n} projects`)];
|
|
6315
|
+
}
|
|
6169
6316
|
// src/commands/doctor-notifications/doctor-notifications.ts
|
|
6170
6317
|
/**
|
|
6171
6318
|
* `holocron doctor notifications` -- compare the layout a provider
|
|
@@ -6649,6 +6796,20 @@ async function runDoctorNotifications(input) {
|
|
|
6649
6796
|
missingReason: whyMissing(loader, "monitoring", "no `monitoring` provider is configured"),
|
|
6650
6797
|
found
|
|
6651
6798
|
}));
|
|
6799
|
+
checks.push(...await relayChecks({
|
|
6800
|
+
layout,
|
|
6801
|
+
errors: loader.has("errors") ? loader.get("errors") : void 0,
|
|
6802
|
+
errorsMissingReason: whyMissing(loader, "errors", "no `errors` provider is configured"),
|
|
6803
|
+
workers: loader.has("workers") ? loader.get("workers") : void 0,
|
|
6804
|
+
workersMissingReason: whyMissing(loader, "workers", "no `workers` provider is configured"),
|
|
6805
|
+
found,
|
|
6806
|
+
...input.fetch ? { fetch: input.fetch } : {}
|
|
6807
|
+
}));
|
|
6808
|
+
checks.push(...await sentryRelayChecks({
|
|
6809
|
+
layout,
|
|
6810
|
+
errors: loader.has("errors") ? loader.get("errors") : void 0,
|
|
6811
|
+
errorsMissingReason: whyMissing(loader, "errors", "no `errors` provider is configured")
|
|
6812
|
+
}));
|
|
6652
6813
|
const withHook = (layout.categories ?? []).flatMap((cat) => (cat.channels ?? []).filter((c) => c.webhook).map((channel) => ({
|
|
6653
6814
|
cat,
|
|
6654
6815
|
channel
|
|
@@ -7201,7 +7362,8 @@ async function runDoctorRepo(input) {
|
|
|
7201
7362
|
try {
|
|
7202
7363
|
rows.push(row$2(check, await check.run(source)));
|
|
7203
7364
|
} catch (err) {
|
|
7204
|
-
|
|
7365
|
+
const noToken = missingTokenReason(err);
|
|
7366
|
+
if (noToken !== void 0) rows.push(row$2(check, { skip: noToken }));
|
|
7205
7367
|
else rows.push({
|
|
7206
7368
|
id: check.id,
|
|
7207
7369
|
title: check.title,
|
|
@@ -7349,7 +7511,7 @@ async function syncedSecrets(entries, vault) {
|
|
|
7349
7511
|
names: Object.keys(await vault.readEnvironment(entry.environment))
|
|
7350
7512
|
});
|
|
7351
7513
|
} catch (err) {
|
|
7352
|
-
skip(err
|
|
7514
|
+
skip(missingTokenReason(err) ?? `could not read vault environment ${entry.environment}: ${describeProviderError(err)}`);
|
|
7353
7515
|
}
|
|
7354
7516
|
}
|
|
7355
7517
|
return {
|
|
@@ -7488,11 +7650,12 @@ async function checkScope(secrets, check) {
|
|
|
7488
7650
|
problems: []
|
|
7489
7651
|
};
|
|
7490
7652
|
} catch (err) {
|
|
7491
|
-
|
|
7653
|
+
const noToken = missingTokenReason(err);
|
|
7654
|
+
if (noToken !== void 0) return {
|
|
7492
7655
|
id,
|
|
7493
7656
|
title,
|
|
7494
7657
|
status: "skip",
|
|
7495
|
-
detail:
|
|
7658
|
+
detail: noToken,
|
|
7496
7659
|
problems: []
|
|
7497
7660
|
};
|
|
7498
7661
|
return {
|
|
@@ -7713,7 +7876,8 @@ async function runDoctorVariables(input) {
|
|
|
7713
7876
|
for (const check of checks) try {
|
|
7714
7877
|
rows.push(row(check, await check.run(source)));
|
|
7715
7878
|
} catch (err) {
|
|
7716
|
-
|
|
7879
|
+
const noToken = missingTokenReason(err);
|
|
7880
|
+
if (noToken !== void 0) rows.push(row(check, { skip: noToken }));
|
|
7717
7881
|
else rows.push({
|
|
7718
7882
|
id: check.id,
|
|
7719
7883
|
title: check.title,
|
|
@@ -7974,14 +8138,15 @@ async function outcomeOf(check, input) {
|
|
|
7974
8138
|
});
|
|
7975
8139
|
} catch (err) {
|
|
7976
8140
|
if (err instanceof WorkspaceContextError) throw err;
|
|
7977
|
-
|
|
8141
|
+
const noToken = missingTokenReason(err);
|
|
8142
|
+
if (noToken !== void 0) return {
|
|
7978
8143
|
status: "skip",
|
|
7979
8144
|
summary: {
|
|
7980
8145
|
ok: 0,
|
|
7981
8146
|
fail: 0,
|
|
7982
8147
|
skip: 1
|
|
7983
8148
|
},
|
|
7984
|
-
reason:
|
|
8149
|
+
reason: noToken
|
|
7985
8150
|
};
|
|
7986
8151
|
return {
|
|
7987
8152
|
status: "fail",
|
|
@@ -12184,40 +12349,6 @@ function collectEdges(root, dirs) {
|
|
|
12184
12349
|
inRepo
|
|
12185
12350
|
};
|
|
12186
12351
|
}
|
|
12187
|
-
// src/commands/probe/deps/parse-catalogs.ts
|
|
12188
|
-
/** Parse the `catalog:` and `catalogs:` blocks of `pnpm-workspace.yaml` (the generated, flat format). */
|
|
12189
|
-
function parseCatalogs(text) {
|
|
12190
|
-
const catalogs = { default: {} };
|
|
12191
|
-
let current = null;
|
|
12192
|
-
let inCatalogs = false;
|
|
12193
|
-
for (const raw of text.split("\n")) {
|
|
12194
|
-
if (raw.trim() === "" || raw.trimStart().startsWith("#")) continue;
|
|
12195
|
-
if (/^catalog:\s*$/.test(raw)) {
|
|
12196
|
-
current = "default";
|
|
12197
|
-
inCatalogs = false;
|
|
12198
|
-
continue;
|
|
12199
|
-
}
|
|
12200
|
-
if (/^catalogs:\s*$/.test(raw)) {
|
|
12201
|
-
current = null;
|
|
12202
|
-
inCatalogs = true;
|
|
12203
|
-
continue;
|
|
12204
|
-
}
|
|
12205
|
-
if (/^\S/.test(raw)) {
|
|
12206
|
-
current = null;
|
|
12207
|
-
inCatalogs = false;
|
|
12208
|
-
continue;
|
|
12209
|
-
}
|
|
12210
|
-
const named = inCatalogs ? raw.match(/^ {2}([A-Za-z0-9_-]+):\s*$/) : null;
|
|
12211
|
-
if (named?.[1]) {
|
|
12212
|
-
current = named[1];
|
|
12213
|
-
catalogs[current] ??= {};
|
|
12214
|
-
continue;
|
|
12215
|
-
}
|
|
12216
|
-
const entry = raw.match(/^\s+("[^"]+"|[^\s:][^:]*?):\s*(.+?)\s*$/);
|
|
12217
|
-
if (entry?.[1] && entry[2] && current) (catalogs[current] ??= {})[entry[1].replace(/^"|"$/g, "")] = entry[2].replace(/^"|"$/g, "");
|
|
12218
|
-
}
|
|
12219
|
-
return catalogs;
|
|
12220
|
-
}
|
|
12221
12352
|
// src/commands/probe/deps/pick-range.ts
|
|
12222
12353
|
/** `^1.2.3`, `~1.2.3`, `1.2.3`, `>=1.2.3` -> [1, 2, 3]; null for anything else. */
|
|
12223
12354
|
function minVersion(range) {
|
|
@@ -16291,50 +16422,13 @@ const fetchLatestFromNpm = async (pkg) => {
|
|
|
16291
16422
|
return null;
|
|
16292
16423
|
}
|
|
16293
16424
|
};
|
|
16294
|
-
|
|
16295
|
-
function gt(a, b) {
|
|
16296
|
-
const pa = a.split(".").map((n) => parseInt(n, 10));
|
|
16297
|
-
const pb = b.split(".").map((n) => parseInt(n, 10));
|
|
16298
|
-
for (let i = 0; i < 3; i++) {
|
|
16299
|
-
const x = pa[i] ?? 0;
|
|
16300
|
-
const y = pb[i] ?? 0;
|
|
16301
|
-
if (x !== y) return x > y;
|
|
16302
|
-
}
|
|
16303
|
-
return false;
|
|
16304
|
-
}
|
|
16305
|
-
const CATALOG_LINE = /^(\s*['"]?)(@theholocron\/[a-z0-9-]+)(['"]?\s*:\s*['"]?)([~^]?)(\d+\.\d+\.\d+[\w.-]*)(['"]?\s*)$/;
|
|
16425
|
+
const HOLOCRON_PACKAGE = /^@theholocron\/[a-z0-9-]+$/;
|
|
16306
16426
|
/**
|
|
16307
16427
|
* Rewrite every `@theholocron/*` pin in a `pnpm-workspace.yaml` to `latest`,
|
|
16308
16428
|
* keeping the range prefix. `latest` is looked up once per package.
|
|
16309
16429
|
*/
|
|
16310
|
-
|
|
16311
|
-
|
|
16312
|
-
const wanted = /* @__PURE__ */ new Set();
|
|
16313
|
-
for (const line of lines) {
|
|
16314
|
-
const m = CATALOG_LINE.exec(line);
|
|
16315
|
-
if (m) wanted.add(m[2]);
|
|
16316
|
-
}
|
|
16317
|
-
const latest = /* @__PURE__ */ new Map();
|
|
16318
|
-
await Promise.all([...wanted].map(async (pkg) => {
|
|
16319
|
-
latest.set(pkg, await fetchLatest(pkg));
|
|
16320
|
-
}));
|
|
16321
|
-
const bumps = [];
|
|
16322
|
-
return {
|
|
16323
|
-
content: lines.map((line) => {
|
|
16324
|
-
const m = CATALOG_LINE.exec(line);
|
|
16325
|
-
if (!m) return line;
|
|
16326
|
-
const [, pre, pkg, mid, prefix, current, post] = m;
|
|
16327
|
-
const next = latest.get(pkg);
|
|
16328
|
-
if (!next || next === current || !gt(next, current)) return line;
|
|
16329
|
-
bumps.push({
|
|
16330
|
-
pkg,
|
|
16331
|
-
from: current,
|
|
16332
|
-
to: next
|
|
16333
|
-
});
|
|
16334
|
-
return `${pre}${pkg}${mid}${prefix}${next}${post}`;
|
|
16335
|
-
}).join("\n"),
|
|
16336
|
-
bumps
|
|
16337
|
-
};
|
|
16430
|
+
function bumpCatalogs(content, fetchLatest) {
|
|
16431
|
+
return bumpCatalogPins(content, fetchLatest, { include: (pkg) => HOLOCRON_PACKAGE.test(pkg) });
|
|
16338
16432
|
}
|
|
16339
16433
|
/** True if the file still uses the 7.x preset shape. */
|
|
16340
16434
|
function isLegacyConfig(content) {
|