@theholocron/cli 5.0.0-alpha.357 → 5.0.0-alpha.358
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 +2 -2
- package/dist/cli.mjs +106 -28
- package/dist/cli.mjs.map +1 -1
- package/dist/{config-system-M2V5jsbK.d.mts → config-system-xpeIKBPC.d.mts} +1 -1
- package/dist/{index-CmdMBl-M.d.mts → index-5u6vMImd.d.mts} +54 -3
- 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 +9 -9
package/README.md
CHANGED
|
@@ -649,9 +649,9 @@ Channels fed by the error tracker add `feeds: { errors: true }` and a layout `re
|
|
|
649
649
|
|
|
650
650
|
`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`.
|
|
651
651
|
|
|
652
|
-
A channel with `kind: "forum"` is a forum, with `tags` (each a `name`, an `emoji` and whether it is `moderated`); `setup` adds and corrects the tags but never removes one, and a text channel of the same name must be deleted first, since neither kind can become the other. A forum takes no `webhook`
|
|
652
|
+
A channel with `kind: "forum"` is a forum, with `tags` (each a `name`, an `emoji` and whether it is `moderated`); `setup` adds and corrects the tags but never removes one, and a text channel of the same name must be deleted first, since neither kind can become the other. A forum takes no `webhook` and none of the webhook feeds (`monitoring`, `errors`); its one feed is `feeds: { prs: true }`, the pull-request feed, where Sentinel keeps one post per pull request tagged with its state. The object form `feeds: { prs: { exclude: { repos?: ["owner/name"], authors?: ["login"] } } }` leaves some pull requests out. `feeds.prs` belongs to a forum (a text channel with it is refused) and the forum's `tags` must hold all eight states, `draft`, `conflicts`, `failing`, `changes requested`, `ready`, `waiting`, `merged` and `closed`, or `setup` refuses the layout. `setup` does nothing more for it; `doctor notifications` checks that the forum exists, has those tags and that the bot can start posts and manage threads in it (`ServerInspection` `botThreads`, filled in by the Discord provider after the forum's own permission overwrites). `defaultReaction` is the emoji Discord offers on every post (its Get Started step "Set a default reaction for posts"); Discord allows only one, so `starterReactions` lists more (`["👍", "👎", "❓"]` for approve, disapprove, question) that the bot adds to the first message of each post `specs sync` makes. Existing posts are left alone, a reaction the bot cannot add is skipped, and `doctor notifications` checks `defaultReaction`. Unicode emoji only.
|
|
653
653
|
|
|
654
|
-
`holocron specs sync [--channel <forum>] [--files <paths...>] [--pr <number>] [--refresh] [--refresh-origin] [--refresh-titles] [--withdraw] [--notify]` keeps one forum post per ADR and spec in step with the files: it makes the post (titled with the document's own title, tagged with the file's status), writes its address into the file as `discussion.url`, and turns a gatekeeper's retag into an edit of the file's `status:` line in the working tree for a pull request. `--files` syncs only those files and `--pr` names a pull request on their posts, for a pull request that is still open. `--refresh-origin` is a one-off repair: it rewrites the `PR:` line of existing posts to the one the current rule names (the optional `prLine` of `DiscussionPatch`, and of `DiscussionPost`), and nothing else in them. `--refresh-titles` is the same kind of one-off repair for the title: it renames each existing post whose title differs from the current rule's (the optional `title` of `DiscussionPatch`, and of `DiscussionPost`) and changes nothing else; a rate limit stops it cleanly, reports how many documents are left, and the next run continues. The id that opens a post is a link to the file on the default branch (`repo.defaultBranch`, else `HEAD`) once the file is there, and plain text while `--pr` names an open pull request; the normal sync rewrites a post's id line (and only that line) whenever it is not the one the rule gives and no `--pr` is given, which covers a file that moved and a post made while its pull request was open, so it needs no extra request when every post is right and `--refresh` is no longer needed for it. `--refresh` runs the `PR:`, title and id-link repairs in one pass (the id link is the optional `idLine` of `DiscussionPatch`, and of `DiscussionPost`, which changes only the message's first line); `--refresh-origin` and `--refresh-titles` still do only their own. `--withdraw` (with `--files`, on the base branch) tags the posts of a pull request closed unmerged `withdrawn` and closes them; `withdrawn` is a tag only, never a file `status:`, and the next sync puts the file's own status back. It cannot be combined with `--refresh`, `--refresh-origin` or `--refresh-titles`. `--dry-run` previews it. See the [`specs sync` page](https://docs.theholocron.dev/holocron/commands/specs-sync/).
|
|
654
|
+
`holocron specs sync [--channel <forum>] [--files <paths...>] [--pr <number>] [--refresh] [--refresh-origin] [--refresh-titles] [--withdraw] [--notify]` keeps one forum post per ADR and spec in step with the files: it makes the post (titled with the document's own title, tagged with the file's status), writes its address into the file as `discussion.url`, and turns a gatekeeper's retag into an edit of the file's `status:` line in the working tree for a pull request. `--files` syncs only those files and `--pr` names a pull request on their posts, for a pull request that is still open. `--refresh-origin` is a one-off repair: it rewrites the `PR:` line of existing posts to the one the current rule names (the optional `prLine` of `DiscussionPatch`, and of `DiscussionPost`), and nothing else in them. `--refresh-titles` is the same kind of one-off repair for the title: it renames each existing post whose title differs from the current rule's (the optional `title` of `DiscussionPatch`, and of `DiscussionPost`) and changes nothing else; a rate limit stops it cleanly, reports how many documents are left, and the next run continues. The id that opens a post is a link to the file on the default branch (`repo.defaultBranch`, else `HEAD`) once the file is there, and plain text while `--pr` names an open pull request; the normal sync rewrites a post's id line (and only that line) whenever it is not the one the rule gives and no `--pr` is given, which covers a file that moved and a post made while its pull request was open, so it needs no extra request when every post is right and `--refresh` is no longer needed for it. `--refresh` runs the `PR:`, title and id-link repairs in one pass (the id link is the optional `idLine` of `DiscussionPatch`, and of `DiscussionPost`, which changes only the message's first line); `--refresh-origin` and `--refresh-titles` still do only their own. `--withdraw` (with `--files`, on the base branch) tags the posts of a pull request closed unmerged `withdrawn` and closes them; `withdrawn` is a tag only, never a file `status:`, and the next sync puts the file's own status back. It cannot be combined with `--refresh`, `--refresh-origin` or `--refresh-titles`. `--dry-run` previews it. The posts behind it are also usable for other keys, such as a pull request (`owner/repo#123`, the state a tag name): `DiscussionPatch.body` replaces the first message's text (the provider keeps its footer), and the optional `Notifications` methods `postDiscussionMessage(channel, key, content, { quiet })` (a closed post is unarchived, written to and closed again), `readDiscussionMessages(channel, key, limit)` (text, newest first, 50 by default) and `dedupeDiscussion(channel, key)` (keeps the oldest post of the key, deletes the rest, returns how many) append to, read and repair a post. See the [`specs sync` page](https://docs.theholocron.dev/holocron/commands/specs-sync/).
|
|
655
655
|
|
|
656
656
|
Pinned messages are declared under the provider's `layout` as `pinned: [{ channel, content }]` or `pinned: [{ channel, file }]` (`channel` is a channel in the layout, `content` up to 2000 characters, `file` a text file in the repository, such as `.holocron/pinned/rules.md`, whose contents are the message and win over a hand edit; `doctor notifications` reports the drift); the layout is the whole set of messages the bot has pinned in those channels.
|
|
657
657
|
|
package/dist/cli.mjs
CHANGED
|
@@ -6099,9 +6099,21 @@ function effectiveAccess(category, channel) {
|
|
|
6099
6099
|
...channel
|
|
6100
6100
|
};
|
|
6101
6101
|
}
|
|
6102
|
+
/** The states a pull request's post can be tagged with, so a forum with `feeds.prs` must have all of them (lower case). */
|
|
6103
|
+
const PR_FEED_TAGS = [
|
|
6104
|
+
"draft",
|
|
6105
|
+
"conflicts",
|
|
6106
|
+
"failing",
|
|
6107
|
+
"changes requested",
|
|
6108
|
+
"ready",
|
|
6109
|
+
"waiting",
|
|
6110
|
+
"merged",
|
|
6111
|
+
"closed"
|
|
6112
|
+
];
|
|
6102
6113
|
/**
|
|
6103
|
-
* The first reason a channel's `kind` and `tags` cannot work, or undefined. A forum takes no webhook or feed (its
|
|
6104
|
-
* conversations are posts, which a plain webhook post cannot start)
|
|
6114
|
+
* The first reason a channel's `kind` and `tags` cannot work, or undefined. A forum takes no webhook or webhook feed (its
|
|
6115
|
+
* conversations are posts, which a plain webhook post cannot start); `feeds.prs` is the one feed a forum takes, and only
|
|
6116
|
+
* a forum does, with a tag for every state a pull request can be in and no pinned message of its own (a pin lives in a
|
|
6105
6117
|
* post); tags belong to a forum; and a tag needs a name no other tag of the channel has. Checked before anything is
|
|
6106
6118
|
* created, so a half-applied forum is never the result.
|
|
6107
6119
|
*/
|
|
@@ -6112,9 +6124,10 @@ function forumLayoutProblem(layout) {
|
|
|
6112
6124
|
if (channel.kind !== "forum") {
|
|
6113
6125
|
if (channel.tags) return `${where}: \`tags\` belong to a forum -- set \`kind: "forum"\` or remove them`;
|
|
6114
6126
|
if (channel.defaultReaction || channel.starterReactions) return `${where}: reactions belong to a forum -- set \`kind: "forum"\` or remove them`;
|
|
6127
|
+
if (channel.feeds?.prs) return `${where}: \`feeds.prs\` belongs to a forum, where each pull request is a post -- set \`kind: "forum"\` or remove it`;
|
|
6115
6128
|
continue;
|
|
6116
6129
|
}
|
|
6117
|
-
if (channel.webhook || channel.feeds?.monitoring || channel.feeds?.errors) return `${where}: a forum takes no \`webhook\` or \`feeds
|
|
6130
|
+
if (channel.webhook || channel.feeds?.monitoring || channel.feeds?.errors) return `${where}: a forum takes no \`webhook\` or the \`monitoring\` and \`errors\` feeds; its conversations are posts`;
|
|
6118
6131
|
if (channel.defaultReaction !== void 0 && channel.defaultReaction.trim() === "") return `${where}: \`defaultReaction\` is empty`;
|
|
6119
6132
|
if ((channel.starterReactions ?? []).some((r) => r.trim() === "")) return `${where}: a starter reaction is empty`;
|
|
6120
6133
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -6124,6 +6137,10 @@ function forumLayoutProblem(layout) {
|
|
|
6124
6137
|
if (seen.has(name)) return `${where}: two tags are named \`${tag.name}\``;
|
|
6125
6138
|
seen.add(name);
|
|
6126
6139
|
}
|
|
6140
|
+
if (channel.feeds?.prs) {
|
|
6141
|
+
const missing = PR_FEED_TAGS.filter((tag) => !seen.has(tag));
|
|
6142
|
+
if (missing.length > 0) return `${where}: \`feeds.prs\` needs the tags ${missing.map((t) => `\`${t}\``).join(", ")}; add them to \`tags\``;
|
|
6143
|
+
}
|
|
6127
6144
|
}
|
|
6128
6145
|
const forums = new Set(channels.filter((c) => c.kind === "forum").map((c) => c.name.toLowerCase()));
|
|
6129
6146
|
for (const pin of layout.pinned ?? []) if (forums.has(pin.channel.toLowerCase())) return `pinned: \`${pin.channel}\` is a forum; a message is pinned in a post, not in the forum`;
|
|
@@ -6592,8 +6609,8 @@ const CHANNEL_ID = "monitoring-alert-channel";
|
|
|
6592
6609
|
const CHANNEL_TITLE = "monitoring alert channel posts through the feed webhook";
|
|
6593
6610
|
const SUBSCRIPTIONS_ID = "monitoring-subscriptions";
|
|
6594
6611
|
const SUBSCRIPTIONS_TITLE = "monitoring alert channel is subscribed to the checks routed to it";
|
|
6595
|
-
const same$
|
|
6596
|
-
const shown$
|
|
6612
|
+
const same$3 = (a, b) => a.toLowerCase() === b.toLowerCase();
|
|
6613
|
+
const shown$5 = (s) => sanitizeDetail(s);
|
|
6597
6614
|
const skipAll = (reason) => [
|
|
6598
6615
|
skipRow(WEBHOOK_ID$1, WEBHOOK_TITLE$1, reason),
|
|
6599
6616
|
skipRow(CHANNEL_ID, CHANNEL_TITLE, reason),
|
|
@@ -6620,14 +6637,14 @@ async function monitoringFeedChecks(input) {
|
|
|
6620
6637
|
let channelSkip;
|
|
6621
6638
|
for (const { channel, feed } of fed) {
|
|
6622
6639
|
const names = monitoringFeed(channel.name, feed, monitoring);
|
|
6623
|
-
const where = found.channels.find((c) => same$
|
|
6640
|
+
const where = found.channels.find((c) => same$3(c.name, channel.name));
|
|
6624
6641
|
const hookId = where?.webhookIds?.[names.webhook.toLowerCase()];
|
|
6625
|
-
const named = where?.webhooks.some((w) => same$
|
|
6626
|
-
const label = `#${shown$
|
|
6642
|
+
const named = where?.webhooks.some((w) => same$3(w, names.webhook)) ?? false;
|
|
6643
|
+
const label = `#${shown$5(channel.name)}`;
|
|
6627
6644
|
if (!where) webhookProblems.push(`${label}: no channel to hold the feed webhook`);
|
|
6628
|
-
else if (where.webhooksError) webhookProblems.push(`${label}: could not list its webhooks (${shown$
|
|
6629
|
-
else if (!named) webhookProblems.push(`${label}: no webhook named ${shown$
|
|
6630
|
-
else if (feedAvatarOf(layout, feed, monitoring).length > 0 && !where.webhookAvatars?.some((w) => same$
|
|
6645
|
+
else if (where.webhooksError) webhookProblems.push(`${label}: could not list its webhooks (${shown$5(where.webhooksError)})`);
|
|
6646
|
+
else if (!named) webhookProblems.push(`${label}: no webhook named ${shown$5(names.webhook)}`);
|
|
6647
|
+
else if (feedAvatarOf(layout, feed, monitoring).length > 0 && !where.webhookAvatars?.some((w) => same$3(w, names.webhook))) webhookProblems.push(`${label}: webhook ${shown$5(names.webhook)} has no picture`);
|
|
6631
6648
|
if (channelSkip !== void 0) continue;
|
|
6632
6649
|
if (!monitoring.inspectAlertChannel) {
|
|
6633
6650
|
channelSkip = `the \`${monitoring.providerName}\` provider cannot read its alert channels`;
|
|
@@ -6642,24 +6659,24 @@ async function monitoringFeedChecks(input) {
|
|
|
6642
6659
|
channelSkip = noToken;
|
|
6643
6660
|
continue;
|
|
6644
6661
|
}
|
|
6645
|
-
channelProblems.push(`${label}: ${shown$
|
|
6662
|
+
channelProblems.push(`${label}: ${shown$5(describeError(err))}`);
|
|
6646
6663
|
continue;
|
|
6647
6664
|
}
|
|
6648
6665
|
if (!state.exists) {
|
|
6649
|
-
channelProblems.push(`${label}: missing alert channel ${shown$
|
|
6666
|
+
channelProblems.push(`${label}: missing alert channel ${shown$5(names.name)}`);
|
|
6650
6667
|
continue;
|
|
6651
6668
|
}
|
|
6652
|
-
if (!state.discord) channelProblems.push(`${label}: ${shown$
|
|
6653
|
-
if (!state.webhookId) channelProblems.push(`${label}: ${shown$
|
|
6654
|
-
else if (hookId !== void 0 && state.webhookId !== hookId) channelProblems.push(`${label}: ${shown$
|
|
6669
|
+
if (!state.discord) channelProblems.push(`${label}: ${shown$5(names.name)} is not formatted for Discord`);
|
|
6670
|
+
if (!state.webhookId) channelProblems.push(`${label}: ${shown$5(names.name)} does not post to a Discord webhook URL`);
|
|
6671
|
+
else if (hookId !== void 0 && state.webhookId !== hookId) channelProblems.push(`${label}: ${shown$5(names.name)} posts through a different webhook than ${shown$5(names.webhook)}`);
|
|
6655
6672
|
for (const [key, want] of Object.entries(names.alerts ?? {})) {
|
|
6656
6673
|
const have = state.alerts?.[key];
|
|
6657
|
-
if (have !== want) channelProblems.push(`${label}: ${shown$
|
|
6674
|
+
if (have !== want) channelProblems.push(`${label}: ${shown$5(names.name)} ${key} is ${String(have)}, declared ${String(want)}`);
|
|
6658
6675
|
}
|
|
6659
|
-
for (const check of state.unsubscribed) subscriptionProblems.push(`${label}: ${shown$
|
|
6660
|
-
for (const check of state.misrouted) subscriptionProblems.push(`${label}: ${shown$
|
|
6661
|
-
if (state.groupSubscriptions) subscriptionProblems.push(`${label}: ${shown$
|
|
6662
|
-
for (const check of state.deactivated) subscriptionProblems.push(`${label}: ${shown$
|
|
6676
|
+
for (const check of state.unsubscribed) subscriptionProblems.push(`${label}: ${shown$5(names.name)} is not subscribed to ${shown$5(check)}`);
|
|
6677
|
+
for (const check of state.misrouted) subscriptionProblems.push(`${label}: ${shown$5(names.name)} is still subscribed to ${shown$5(check)}, which is routed elsewhere`);
|
|
6678
|
+
if (state.groupSubscriptions) subscriptionProblems.push(`${label}: ${shown$5(names.name)} is subscribed to ${state.groupSubscriptions} check group(s), which alert for every check in them, including any routed elsewhere; which checks a group holds cannot be read, so check them in ${shown$5(monitoring.providerName)}`);
|
|
6679
|
+
for (const check of state.deactivated) subscriptionProblems.push(`${label}: ${shown$5(names.name)} has ${shown$5(check)} switched off`);
|
|
6663
6680
|
}
|
|
6664
6681
|
const n = fed.length;
|
|
6665
6682
|
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)]];
|
|
@@ -7242,7 +7259,7 @@ const WIRED_ID = "notifications-workflow-wiring";
|
|
|
7242
7259
|
const WIRED_TITLE = "Notifications workflow posts through the layout's webhooks";
|
|
7243
7260
|
const NAMES_ID = "notifications-workflow-names";
|
|
7244
7261
|
const NAMES_TITLE = "Notifications workflow lists only task ids";
|
|
7245
|
-
const shown$
|
|
7262
|
+
const shown$4 = (s) => sanitizeDetail(s);
|
|
7246
7263
|
const upper = (names) => new Set(names.map((n) => n.toUpperCase()));
|
|
7247
7264
|
/**
|
|
7248
7265
|
* The steps of `doctor notifications` that check the workflow which posts failed runs and releases: the file is on
|
|
@@ -7267,7 +7284,7 @@ async function notificationsWorkflowChecks(input) {
|
|
|
7267
7284
|
try {
|
|
7268
7285
|
text = (await source.readFile(NOTIFICATIONS_WORKFLOW_PATH))?.content;
|
|
7269
7286
|
} catch (err) {
|
|
7270
|
-
const reason = shown$
|
|
7287
|
+
const reason = shown$4(describeError(err));
|
|
7271
7288
|
return [
|
|
7272
7289
|
{
|
|
7273
7290
|
id: PRESENT_ID,
|
|
@@ -7287,7 +7304,7 @@ async function notificationsWorkflowChecks(input) {
|
|
|
7287
7304
|
];
|
|
7288
7305
|
const read = [...text.matchAll(/secrets\.(HOLOCRON_NOTIFY_[A-Z0-9_]+)/g)].map((m) => m[1]);
|
|
7289
7306
|
const readSet = upper(read);
|
|
7290
|
-
const problems = [...[...new Set(read)].filter((name) => !filled.has(name.toUpperCase())).map((name) => `${shown$
|
|
7307
|
+
const problems = [...[...new Set(read)].filter((name) => !filled.has(name.toUpperCase())).map((name) => `${shown$4(name)}: the workflow reads it but the layout fills no such secret`), ...wired.filter((name) => !readSet.has(name)).map((name) => `${name}: the layout fills it but the workflow never posts through it`)];
|
|
7291
7308
|
return [
|
|
7292
7309
|
resultRow(PRESENT_ID, PRESENT_TITLE, [], "found"),
|
|
7293
7310
|
resultRow(WIRED_ID, WIRED_TITLE, problems, `${wired.length} of ${wired.length} wired`),
|
|
@@ -7327,6 +7344,61 @@ async function postDoctorReport(notifications, channel, report, name = "notifica
|
|
|
7327
7344
|
return `not posted: ${sanitizeDetail(describeError(err))}`;
|
|
7328
7345
|
}
|
|
7329
7346
|
}
|
|
7347
|
+
// src/commands/pr-feed-checks/pr-feed-checks.ts
|
|
7348
|
+
const FORUM_TITLE = "pull request feed forum exists";
|
|
7349
|
+
const TAGS_TITLE = "pull request feed forum has the tags of every state";
|
|
7350
|
+
const BOT_TITLE = "bot can post in the pull request feed forum and manage its threads";
|
|
7351
|
+
const same$2 = (a, b) => a.toLowerCase() === b.toLowerCase();
|
|
7352
|
+
const shown$3 = (s) => sanitizeDetail(s);
|
|
7353
|
+
/**
|
|
7354
|
+
* The steps of `doctor notifications` for the pull-request feed (`feeds.prs`): the forum is there (in its category, as a
|
|
7355
|
+
* forum), it holds a tag for every state a pull request's post can be in, and the bot can start posts and manage their
|
|
7356
|
+
* threads in it (read from `inspect`, after the channel's own overwrites). Read-only. No rows when no channel has
|
|
7357
|
+
* `feeds.prs`.
|
|
7358
|
+
*/
|
|
7359
|
+
function prFeedChecks(input) {
|
|
7360
|
+
const { layout, found } = input;
|
|
7361
|
+
const fed = (layout.categories ?? []).flatMap((cat) => (cat.channels ?? []).map((channel) => ({
|
|
7362
|
+
cat: cat.name,
|
|
7363
|
+
channel
|
|
7364
|
+
}))).filter(({ channel }) => channel.feeds?.prs);
|
|
7365
|
+
if (fed.length === 0) return [];
|
|
7366
|
+
if (!found) {
|
|
7367
|
+
const reason = "not checked: could not read the server";
|
|
7368
|
+
return [
|
|
7369
|
+
skipRow("pr-feed-forum", FORUM_TITLE, reason),
|
|
7370
|
+
skipRow("pr-feed-tags", TAGS_TITLE, reason),
|
|
7371
|
+
skipRow("pr-feed-bot", BOT_TITLE, reason)
|
|
7372
|
+
];
|
|
7373
|
+
}
|
|
7374
|
+
const forumProblems = [];
|
|
7375
|
+
const tagProblems = [];
|
|
7376
|
+
const botProblems = [];
|
|
7377
|
+
for (const { cat, channel } of fed) {
|
|
7378
|
+
const name = shown$3(channel.name);
|
|
7379
|
+
const have = found.channels.find((c) => same$2(c.name, channel.name) && c.category !== void 0 && same$2(c.category, cat));
|
|
7380
|
+
if (!have) {
|
|
7381
|
+
forumProblems.push(`#${name}: missing from ${shown$3(cat)}`);
|
|
7382
|
+
continue;
|
|
7383
|
+
}
|
|
7384
|
+
if (have.kind !== "forum") {
|
|
7385
|
+
forumProblems.push(`#${name}: is a text channel, not a forum; delete it so \`setup\` can make it again`);
|
|
7386
|
+
continue;
|
|
7387
|
+
}
|
|
7388
|
+
for (const tag of PR_FEED_TAGS) if (!have.tags?.some((t) => same$2(t.name, tag))) tagProblems.push(`#${name}: tag "${tag}" is missing`);
|
|
7389
|
+
if (have.botThreadsError) botProblems.push(`#${name}: could not read the bot's permissions (${shown$3(have.botThreadsError)})`);
|
|
7390
|
+
else if (have.botThreads) {
|
|
7391
|
+
if (!have.botThreads.post) botProblems.push(`#${name}: the bot cannot start posts or reply in it`);
|
|
7392
|
+
if (!have.botThreads.manage) botProblems.push(`#${name}: the bot cannot manage threads in it (Manage Threads)`);
|
|
7393
|
+
} else botProblems.push(`#${name}: the provider did not report the bot's permissions`);
|
|
7394
|
+
}
|
|
7395
|
+
const ok = `${fed.length} of ${fed.length} as declared`;
|
|
7396
|
+
return [
|
|
7397
|
+
resultRow("pr-feed-forum", FORUM_TITLE, forumProblems, ok),
|
|
7398
|
+
resultRow("pr-feed-tags", TAGS_TITLE, tagProblems, ok),
|
|
7399
|
+
resultRow("pr-feed-bot", BOT_TITLE, botProblems, ok)
|
|
7400
|
+
];
|
|
7401
|
+
}
|
|
7330
7402
|
// src/commands/relay-checks/relay-checks.ts
|
|
7331
7403
|
/** How long to wait for the Worker before calling it unreachable. */
|
|
7332
7404
|
const RELAY_TIMEOUT_MS = 5e3;
|
|
@@ -7965,6 +8037,10 @@ async function runDoctorNotifications(input) {
|
|
|
7965
8037
|
missingReason: whyMissing(loader, "monitoring", "no `monitoring` provider is configured"),
|
|
7966
8038
|
found
|
|
7967
8039
|
}));
|
|
8040
|
+
checks.push(...prFeedChecks({
|
|
8041
|
+
layout,
|
|
8042
|
+
found
|
|
8043
|
+
}));
|
|
7968
8044
|
checks.push(...await notificationsWorkflowChecks({
|
|
7969
8045
|
layout,
|
|
7970
8046
|
source: loader.has("source") ? loader.get("source") : void 0,
|
|
@@ -21527,8 +21603,9 @@ const skillsCommand = {
|
|
|
21527
21603
|
};
|
|
21528
21604
|
// src/commands/specs-sync/forum-channel.ts
|
|
21529
21605
|
/**
|
|
21530
|
-
* The forum channel the discussion posts live in: the one named, or the only forum the layout declares
|
|
21531
|
-
*
|
|
21606
|
+
* The forum channel the discussion posts live in: the one named, or the only forum the layout declares that is not the
|
|
21607
|
+
* pull request feed's (`feeds.prs`, whose posts Sentinel makes, one for each pull request). Returns the name, or the
|
|
21608
|
+
* reason there is none, so the run can refuse before it reads a document.
|
|
21532
21609
|
*/
|
|
21533
21610
|
function forumChannel(layout, wanted) {
|
|
21534
21611
|
const forums = (layout.categories ?? []).flatMap((c) => c.channels ?? []).filter((c) => c.kind === "forum");
|
|
@@ -21536,8 +21613,9 @@ function forumChannel(layout, wanted) {
|
|
|
21536
21613
|
const found = forums.find((c) => c.name.toLowerCase() === wanted.toLowerCase());
|
|
21537
21614
|
return found ? { channel: found.name } : { problem: `the layout declares no forum named \`${wanted}\` -- add it with \`kind: "forum"\`` };
|
|
21538
21615
|
}
|
|
21539
|
-
|
|
21540
|
-
|
|
21616
|
+
const documents = forums.filter((c) => !c.feeds?.prs);
|
|
21617
|
+
if (documents.length === 1) return { channel: documents[0].name };
|
|
21618
|
+
return { problem: documents.length === 0 ? "the layout declares no forum channel -- add one with `kind: \"forum\"`" : `the layout declares several forums (${documents.map((c) => `\`${c.name}\``).join(", ")}) -- pass --channel` };
|
|
21541
21619
|
}
|
|
21542
21620
|
/**
|
|
21543
21621
|
* The origin of a document from the commit that first added it: `line` is that commit's `<seconds>\t<subject>` and
|