@theholocron/cli 5.0.0-alpha.357 → 5.0.0-alpha.359

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
@@ -617,27 +617,27 @@ A `notifications` provider can declare a whole server in `holocron.config.ts`
617
617
  pinned messages, onboarding, the bot application) and the CLI applies and checks it. The
618
618
  commands and the config are provider-neutral; Discord is the first provider.
619
619
 
620
- | Command | What it does |
621
- | --------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
622
- | `holocron notifications setup` | Applies the layout; looks everything up by name first, so a re-run changes nothing that matches |
623
- | `holocron notifications channel add <name>` | Creates one channel (optionally with a webhook whose URL is stored as a secret) |
624
- | `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) |
625
- | `holocron notifications link` | Links your account on the provider to your GitHub account by signing in with the provider (OAuth, nothing secret kept) |
626
- | `holocron notifications sync-roles` | Makes who holds a role match a GitHub team, through the links file (`--keep` only adds; `--provider` picks one) |
627
- | `holocron project reconcile [board]` | Sets item statuses where a rule says so: an open blocker means `blocked`, no blocker left means `planned`, closed means `done` (status only; `--dry-run` previews; an open item with no status is reported). Runs hourly from `platform.projectReconcile.yml`, which `repo setup` writes when `providers.projects` declares boards |
628
- | `holocron doctor notifications [--built-only] [--deliver] [--post]` | 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; `--post [channel]` posts the result as the bot (the failures, or only the summary when none failed). It also reads the Checkly feed (webhook, alert channel, subscriptions), the Comlink relay (Worker, route, bindings, the tracker's integration and rule) and the Notifications workflow (the file, and the secrets it reads), posting nothing, so `--built-only` keeps those steps |
629
- | `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. A `repo.variables.sync` entry adds one row that checks its names exist (no value is read or shown). An undeclared variable counts only with `prune`; a scope that cannot be read (no provider, no org token) is a skip, not a failure |
630
- | `holocron doctor ci` | Has the repo moved to the flat task vocabulary? One row each for the `tasks:` entries (a deprecated alias, with the id that replaces it), the generated callers (file, workflow and job name equal the task id), the `ci` aggregate's `expected` list (no id missing or stale) and where the callers point (`theholocron/.github` or holocron `ci-v1`). Read-only, no provider needed; exits 1 on a failure. The ruleset's checks are `doctor repo`'s |
631
- | `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 |
632
- | `holocron doctor project [--post [channel]]` | Does each board `providers.projects.boards` declares exist and match its template? One row per board, status list, field, view and automation rule; the board's extras and the items `project reconcile` would fix (no status, closed but not done, open blocker but not blocked, blocked without a blocker) are `info` rows, never a failure. A template file that does not read fails, naming the file. Read-only; `--post` shares the failing rows through the `notifications` bot. |
633
- | `holocron doctor credentials` | Does the credentials environment exist, and does it hold every variable the configured plugins take? One row per variable and provider (`ok`, `fail` when missing, `skip` for an optional one not set), listing names only: it never reads a value, and says which spelling of the environment's name matched. |
634
- | `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 |
635
- | `holocron doctor dns` | Do the DNS records the config makes setup write exist, pointing where they should? The preview domain's apex and wildcard CNAMEs (Cloudflare), the docs host a wiki provider asks for, and the relay Worker's proxied placeholder; one row per zone. A missing record, another target or a missing proxy fails; an extra record never does. A record `ensureCustomDomain()` returns is not checked, because asking for it creates the domain |
636
- | `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 |
637
- | `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 |
638
- | `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 |
639
- | `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 |
640
- | `holocron probe [<provider> [<probe>]] [--dry-run] [--yes] [--lcov <path>]` | Poke a live provider on purpose: list the probes, inspect something, or run a proof that cleans up after itself. Plugins offer the probes; nothing secret is printed; one that changes things asks first |
620
+ | Command | What it does |
621
+ | --------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
622
+ | `holocron notifications setup` | Applies the layout; looks everything up by name first, so a re-run changes nothing that matches |
623
+ | `holocron notifications channel add <name>` | Creates one channel (optionally with a webhook whose URL is stored as a secret) |
624
+ | `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) |
625
+ | `holocron notifications link` | Links your account on the provider to your GitHub account by signing in with the provider (OAuth, nothing secret kept) |
626
+ | `holocron notifications sync-roles` | Makes who holds a role match a GitHub team, through the links file (`--keep` only adds; `--provider` picks one) |
627
+ | `holocron project reconcile [board]` | Sets item statuses where a rule says so: an open blocker means `blocked`, no blocker left means `planned`, closed means `done` (status only; `--dry-run` previews; an open item with no status is reported). Runs hourly from `platform.projectReconcile.yml`, which `repo setup` writes when `providers.projects` declares boards |
628
+ | `holocron doctor notifications [--built-only] [--deliver] [--post]` | 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; `--post [channel]` posts the result as the bot (the failures, or only the summary when none failed). It also reads the Checkly feed (webhook, alert channel, subscriptions), the Comlink relay (Worker, route, bindings, the tracker's integration and rule) and the Notifications workflow (the file, and the secrets it reads), posting nothing, so `--built-only` keeps those steps. The `bot-permissions` row compares what the bot's roles hold server-wide with the permissions it needs (`ServerInspection` `botPermissions`; the owner and Administrator hold all, channel overwrites are left to the forum row) and, when some are missing, fails naming them in plain words with the invite link that asks for them again (not a credential); it is skipped, with the reason, when the roles could not be read |
629
+ | `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. A `repo.variables.sync` entry adds one row that checks its names exist (no value is read or shown). An undeclared variable counts only with `prune`; a scope that cannot be read (no provider, no org token) is a skip, not a failure |
630
+ | `holocron doctor ci` | Has the repo moved to the flat task vocabulary? One row each for the `tasks:` entries (a deprecated alias, with the id that replaces it), the generated callers (file, workflow and job name equal the task id), the `ci` aggregate's `expected` list (no id missing or stale) and where the callers point (`theholocron/.github` or holocron `ci-v1`). Read-only, no provider needed; exits 1 on a failure. The ruleset's checks are `doctor repo`'s |
631
+ | `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 |
632
+ | `holocron doctor project [--post [channel]]` | Does each board `providers.projects.boards` declares exist and match its template? One row per board, status list, field, view and automation rule; the board's extras and the items `project reconcile` would fix (no status, closed but not done, open blocker but not blocked, blocked without a blocker) are `info` rows, never a failure. A template file that does not read fails, naming the file. Read-only; `--post` shares the failing rows through the `notifications` bot. |
633
+ | `holocron doctor credentials` | Does the credentials environment exist, and does it hold every variable the configured plugins take? One row per variable and provider (`ok`, `fail` when missing, `skip` for an optional one not set), listing names only: it never reads a value, and says which spelling of the environment's name matched. |
634
+ | `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 |
635
+ | `holocron doctor dns` | Do the DNS records the config makes setup write exist, pointing where they should? The preview domain's apex and wildcard CNAMEs (Cloudflare), the docs host a wiki provider asks for, and the relay Worker's proxied placeholder; one row per zone. A missing record, another target or a missing proxy fails; an extra record never does. A record `ensureCustomDomain()` returns is not checked, because asking for it creates the domain |
636
+ | `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 |
637
+ | `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 |
638
+ | `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 |
639
+ | `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 |
640
+ | `holocron probe [<provider> [<probe>]] [--dry-run] [--yes] [--lcov <path>]` | Poke a live provider on purpose: list the probes, inspect something, or run a proof that cleans up after itself. Plugins offer the probes; nothing secret is printed; one that changes things asks first |
641
641
 
642
642
  Channels fed by another service are declared with `feeds` on the channel: `{ name: "uptime", webhook: true, feeds: { monitoring: true } }` (the object form `{ name?, webhook?, avatar?, alerts? }` overrides the alert channel's name, default `Message to #<channel>`, the dedicated webhook's name, default the provider's, and gives that webhook a picture, a file path or `https://` URL, or `{ url, image }` (the URL is tried first, the file in the repo is the fallback), else the provider's own icon (`Monitoring.icon`, a URL and an embedded `data:` image; Checkly provides one), else the layout's `webhookAvatar`). A channel's own `webhook.avatar` and the layout's `webhookAvatar` take the same forms, a path or `https://` URL, or `{ url, image }` (the URL first, the file in the repo as the fallback); a relative path is read from the repository root. `setup` gives the channel a dedicated webhook and hands its URL straight to the `monitoring` provider through `Monitoring.ensureAlertChannel({ name, format: "discord", url? })`, which finds an alert channel of that name or creates one and subscribes every check; the URL is never stored as a secret. It needs a `monitoring` provider that implements `ensureAlertChannel` (Checkly does). `alerts: { failure?, recovery?, degraded?, sslExpiry?, sslExpiryThreshold? }` (`MonitoringAlertSettings`, passed as `ensureAlertChannel({ ..., alerts })`) sets what the alert channel alerts about: a new channel defaults to failure, recovery and degraded on and `sslExpiry` off, and on an existing channel a setting left out is left alone. A check in the `monitoring` provider's `checks` can route itself with `alertChannels: ["Message to #uptime"]` (`MonitoringCheckInput.alertChannels`, the alert channel names): it is then subscribed to those channels only, and a name no feed declares is refused by `setup`. `inspectAlertChannel` returns the channel's `alerts` and the `misrouted` checks that `doctor notifications` reports. Two feeds may not share an alert channel name, and a feed's webhook may not share the channel's own webhook name (compared without regard to case).
643
643
 
@@ -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` or `feeds`. `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.
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
@@ -5551,7 +5551,7 @@ const SETUP_ENVIRONMENTS = ["staging", "production"];
5551
5551
  * nothing named, nothing is declared; with no provider but some named, the row is a skip with the reason.
5552
5552
  */
5553
5553
  const ID$2 = "environments";
5554
- const TITLE$1 = "environments exist";
5554
+ const TITLE$2 = "environments exist";
5555
5555
  async function runDoctorEnvironments(input) {
5556
5556
  const print = input.print ?? ((line) => console.log(line));
5557
5557
  const logger = input.logger ?? getLogger();
@@ -5576,7 +5576,7 @@ async function runDoctorEnvironments(input) {
5576
5576
  async function checkEnvironments(loader, named) {
5577
5577
  const make = (status, detail, problems = []) => ({
5578
5578
  id: ID$2,
5579
- title: TITLE$1,
5579
+ title: TITLE$2,
5580
5580
  status,
5581
5581
  detail,
5582
5582
  problems
@@ -5628,7 +5628,7 @@ const doctorEnvironmentsCommand = {
5628
5628
  * `doctor notifications`) and any check that a message really arrives.
5629
5629
  */
5630
5630
  const ID$1 = "monitoring-checks";
5631
- const TITLE = "monitoring checks match";
5631
+ const TITLE$1 = "monitoring checks match";
5632
5632
  async function runDoctorMonitoring(input) {
5633
5633
  const print = input.print ?? ((line) => console.log(line));
5634
5634
  const logger = input.logger ?? getLogger();
@@ -5654,7 +5654,7 @@ async function runDoctorMonitoring(input) {
5654
5654
  async function checkRow(loader) {
5655
5655
  const skip = (detail) => ({
5656
5656
  id: ID$1,
5657
- title: TITLE,
5657
+ title: TITLE$1,
5658
5658
  status: "skip",
5659
5659
  detail,
5660
5660
  problems: []
@@ -5663,7 +5663,7 @@ async function checkRow(loader) {
5663
5663
  if (loader.loadFailures().some((f) => f.key === "monitoring")) return skip(whyMissing(loader, "monitoring", "no `monitoring` provider is available"));
5664
5664
  return {
5665
5665
  id: ID$1,
5666
- title: TITLE,
5666
+ title: TITLE$1,
5667
5667
  status: "ok",
5668
5668
  detail: "none declared",
5669
5669
  problems: []
@@ -5672,7 +5672,7 @@ async function checkRow(loader) {
5672
5672
  const monitoring = loader.get("monitoring");
5673
5673
  if (monitoring.checks.length === 0) return {
5674
5674
  id: ID$1,
5675
- title: TITLE,
5675
+ title: TITLE$1,
5676
5676
  status: "ok",
5677
5677
  detail: "none declared",
5678
5678
  problems: []
@@ -5682,7 +5682,7 @@ async function checkRow(loader) {
5682
5682
  const problems = compareChecks(monitoring.checks, await monitoring.listChecks());
5683
5683
  if (problems.length > 0) return {
5684
5684
  id: ID$1,
5685
- title: TITLE,
5685
+ title: TITLE$1,
5686
5686
  status: "fail",
5687
5687
  detail: `${problems.length} problem(s)`,
5688
5688
  problems
@@ -5690,7 +5690,7 @@ async function checkRow(loader) {
5690
5690
  const n = monitoring.checks.length;
5691
5691
  return {
5692
5692
  id: ID$1,
5693
- title: TITLE,
5693
+ title: TITLE$1,
5694
5694
  status: "ok",
5695
5695
  detail: `${n} of ${n} match`,
5696
5696
  problems: []
@@ -5700,7 +5700,7 @@ async function checkRow(loader) {
5700
5700
  if (noToken !== void 0) return skip(noToken);
5701
5701
  return {
5702
5702
  id: ID$1,
5703
- title: TITLE,
5703
+ title: TITLE$1,
5704
5704
  status: "fail",
5705
5705
  detail: errorMessage(err),
5706
5706
  problems: []
@@ -5823,6 +5823,24 @@ function resultRow(id, title, problems, ok) {
5823
5823
  problems
5824
5824
  };
5825
5825
  }
5826
+ // src/commands/bot-permission-checks/bot-permission-checks.ts
5827
+ const TITLE = "bot holds the server-wide permissions it needs";
5828
+ /**
5829
+ * The step of `doctor notifications` for the bot's own role: the permissions the provider says it needs (read from
5830
+ * `inspect`, server-wide, before any channel overwrite) are all held. A failure names the missing ones and carries the
5831
+ * link that invites the bot again asking for them, which updates its role in place. Read-only. No row when the provider
5832
+ * reports nothing about its bot; a skip when the server or the bot's roles could not be read.
5833
+ */
5834
+ function botPermissionChecks(input) {
5835
+ const { found } = input;
5836
+ if (!found) return [skipRow("bot-permissions", TITLE, "not checked: could not read the server")];
5837
+ if (found.botPermissionsError) return [skipRow("bot-permissions", TITLE, `not checked: could not read the bot's roles (${sanitizeDetail(found.botPermissionsError)})`)];
5838
+ const { botPermissions } = found;
5839
+ if (!botPermissions) return [];
5840
+ const { missing, inviteUrl } = botPermissions;
5841
+ const problems = missing.length === 0 ? [] : [`missing: ${missing.map((m) => sanitizeDetail(m)).join(", ")}`, ...inviteUrl ? [`invite the bot again with them (updates its role in place): ${inviteUrl}`] : []];
5842
+ return [resultRow("bot-permissions", TITLE, problems, "every permission it needs")];
5843
+ }
5826
5844
  // src/commands/notifications-setup/layout-picture-problem/layout-picture-problem.ts
5827
5845
  /** The first reason a picture in the layout (`webhookAvatar`, a channel's `webhook.avatar`) cannot work, or undefined. */
5828
5846
  function layoutPictureProblem(layout) {
@@ -6099,9 +6117,21 @@ function effectiveAccess(category, channel) {
6099
6117
  ...channel
6100
6118
  };
6101
6119
  }
6120
+ /** The states a pull request's post can be tagged with, so a forum with `feeds.prs` must have all of them (lower case). */
6121
+ const PR_FEED_TAGS = [
6122
+ "draft",
6123
+ "conflicts",
6124
+ "failing",
6125
+ "changes requested",
6126
+ "ready",
6127
+ "waiting",
6128
+ "merged",
6129
+ "closed"
6130
+ ];
6102
6131
  /**
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) and no pinned message of its own (a pin lives in a
6132
+ * The first reason a channel's `kind` and `tags` cannot work, or undefined. A forum takes no webhook or webhook feed (its
6133
+ * conversations are posts, which a plain webhook post cannot start); `feeds.prs` is the one feed a forum takes, and only
6134
+ * 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
6135
  * post); tags belong to a forum; and a tag needs a name no other tag of the channel has. Checked before anything is
6106
6136
  * created, so a half-applied forum is never the result.
6107
6137
  */
@@ -6112,9 +6142,10 @@ function forumLayoutProblem(layout) {
6112
6142
  if (channel.kind !== "forum") {
6113
6143
  if (channel.tags) return `${where}: \`tags\` belong to a forum -- set \`kind: "forum"\` or remove them`;
6114
6144
  if (channel.defaultReaction || channel.starterReactions) return `${where}: reactions belong to a forum -- set \`kind: "forum"\` or remove them`;
6145
+ 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
6146
  continue;
6116
6147
  }
6117
- if (channel.webhook || channel.feeds?.monitoring || channel.feeds?.errors) return `${where}: a forum takes no \`webhook\` or \`feeds\`; its conversations are posts`;
6148
+ 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
6149
  if (channel.defaultReaction !== void 0 && channel.defaultReaction.trim() === "") return `${where}: \`defaultReaction\` is empty`;
6119
6150
  if ((channel.starterReactions ?? []).some((r) => r.trim() === "")) return `${where}: a starter reaction is empty`;
6120
6151
  const seen = /* @__PURE__ */ new Set();
@@ -6124,6 +6155,10 @@ function forumLayoutProblem(layout) {
6124
6155
  if (seen.has(name)) return `${where}: two tags are named \`${tag.name}\``;
6125
6156
  seen.add(name);
6126
6157
  }
6158
+ if (channel.feeds?.prs) {
6159
+ const missing = PR_FEED_TAGS.filter((tag) => !seen.has(tag));
6160
+ if (missing.length > 0) return `${where}: \`feeds.prs\` needs the tags ${missing.map((t) => `\`${t}\``).join(", ")}; add them to \`tags\``;
6161
+ }
6127
6162
  }
6128
6163
  const forums = new Set(channels.filter((c) => c.kind === "forum").map((c) => c.name.toLowerCase()));
6129
6164
  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 +6627,8 @@ const CHANNEL_ID = "monitoring-alert-channel";
6592
6627
  const CHANNEL_TITLE = "monitoring alert channel posts through the feed webhook";
6593
6628
  const SUBSCRIPTIONS_ID = "monitoring-subscriptions";
6594
6629
  const SUBSCRIPTIONS_TITLE = "monitoring alert channel is subscribed to the checks routed to it";
6595
- const same$2 = (a, b) => a.toLowerCase() === b.toLowerCase();
6596
- const shown$4 = (s) => sanitizeDetail(s);
6630
+ const same$3 = (a, b) => a.toLowerCase() === b.toLowerCase();
6631
+ const shown$5 = (s) => sanitizeDetail(s);
6597
6632
  const skipAll = (reason) => [
6598
6633
  skipRow(WEBHOOK_ID$1, WEBHOOK_TITLE$1, reason),
6599
6634
  skipRow(CHANNEL_ID, CHANNEL_TITLE, reason),
@@ -6620,14 +6655,14 @@ async function monitoringFeedChecks(input) {
6620
6655
  let channelSkip;
6621
6656
  for (const { channel, feed } of fed) {
6622
6657
  const names = monitoringFeed(channel.name, feed, monitoring);
6623
- const where = found.channels.find((c) => same$2(c.name, channel.name));
6658
+ const where = found.channels.find((c) => same$3(c.name, channel.name));
6624
6659
  const hookId = where?.webhookIds?.[names.webhook.toLowerCase()];
6625
- const named = where?.webhooks.some((w) => same$2(w, names.webhook)) ?? false;
6626
- const label = `#${shown$4(channel.name)}`;
6660
+ const named = where?.webhooks.some((w) => same$3(w, names.webhook)) ?? false;
6661
+ const label = `#${shown$5(channel.name)}`;
6627
6662
  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$4(where.webhooksError)})`);
6629
- else if (!named) webhookProblems.push(`${label}: no webhook named ${shown$4(names.webhook)}`);
6630
- else if (feedAvatarOf(layout, feed, monitoring).length > 0 && !where.webhookAvatars?.some((w) => same$2(w, names.webhook))) webhookProblems.push(`${label}: webhook ${shown$4(names.webhook)} has no picture`);
6663
+ else if (where.webhooksError) webhookProblems.push(`${label}: could not list its webhooks (${shown$5(where.webhooksError)})`);
6664
+ else if (!named) webhookProblems.push(`${label}: no webhook named ${shown$5(names.webhook)}`);
6665
+ 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
6666
  if (channelSkip !== void 0) continue;
6632
6667
  if (!monitoring.inspectAlertChannel) {
6633
6668
  channelSkip = `the \`${monitoring.providerName}\` provider cannot read its alert channels`;
@@ -6642,24 +6677,24 @@ async function monitoringFeedChecks(input) {
6642
6677
  channelSkip = noToken;
6643
6678
  continue;
6644
6679
  }
6645
- channelProblems.push(`${label}: ${shown$4(describeError(err))}`);
6680
+ channelProblems.push(`${label}: ${shown$5(describeError(err))}`);
6646
6681
  continue;
6647
6682
  }
6648
6683
  if (!state.exists) {
6649
- channelProblems.push(`${label}: missing alert channel ${shown$4(names.name)}`);
6684
+ channelProblems.push(`${label}: missing alert channel ${shown$5(names.name)}`);
6650
6685
  continue;
6651
6686
  }
6652
- if (!state.discord) channelProblems.push(`${label}: ${shown$4(names.name)} is not formatted for Discord`);
6653
- if (!state.webhookId) channelProblems.push(`${label}: ${shown$4(names.name)} does not post to a Discord webhook URL`);
6654
- else if (hookId !== void 0 && state.webhookId !== hookId) channelProblems.push(`${label}: ${shown$4(names.name)} posts through a different webhook than ${shown$4(names.webhook)}`);
6687
+ if (!state.discord) channelProblems.push(`${label}: ${shown$5(names.name)} is not formatted for Discord`);
6688
+ if (!state.webhookId) channelProblems.push(`${label}: ${shown$5(names.name)} does not post to a Discord webhook URL`);
6689
+ 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
6690
  for (const [key, want] of Object.entries(names.alerts ?? {})) {
6656
6691
  const have = state.alerts?.[key];
6657
- if (have !== want) channelProblems.push(`${label}: ${shown$4(names.name)} ${key} is ${String(have)}, declared ${String(want)}`);
6692
+ if (have !== want) channelProblems.push(`${label}: ${shown$5(names.name)} ${key} is ${String(have)}, declared ${String(want)}`);
6658
6693
  }
6659
- for (const check of state.unsubscribed) subscriptionProblems.push(`${label}: ${shown$4(names.name)} is not subscribed to ${shown$4(check)}`);
6660
- for (const check of state.misrouted) subscriptionProblems.push(`${label}: ${shown$4(names.name)} is still subscribed to ${shown$4(check)}, which is routed elsewhere`);
6661
- if (state.groupSubscriptions) subscriptionProblems.push(`${label}: ${shown$4(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$4(monitoring.providerName)}`);
6662
- for (const check of state.deactivated) subscriptionProblems.push(`${label}: ${shown$4(names.name)} has ${shown$4(check)} switched off`);
6694
+ for (const check of state.unsubscribed) subscriptionProblems.push(`${label}: ${shown$5(names.name)} is not subscribed to ${shown$5(check)}`);
6695
+ for (const check of state.misrouted) subscriptionProblems.push(`${label}: ${shown$5(names.name)} is still subscribed to ${shown$5(check)}, which is routed elsewhere`);
6696
+ 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)}`);
6697
+ for (const check of state.deactivated) subscriptionProblems.push(`${label}: ${shown$5(names.name)} has ${shown$5(check)} switched off`);
6663
6698
  }
6664
6699
  const n = fed.length;
6665
6700
  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 +7277,7 @@ const WIRED_ID = "notifications-workflow-wiring";
7242
7277
  const WIRED_TITLE = "Notifications workflow posts through the layout's webhooks";
7243
7278
  const NAMES_ID = "notifications-workflow-names";
7244
7279
  const NAMES_TITLE = "Notifications workflow lists only task ids";
7245
- const shown$3 = (s) => sanitizeDetail(s);
7280
+ const shown$4 = (s) => sanitizeDetail(s);
7246
7281
  const upper = (names) => new Set(names.map((n) => n.toUpperCase()));
7247
7282
  /**
7248
7283
  * The steps of `doctor notifications` that check the workflow which posts failed runs and releases: the file is on
@@ -7267,7 +7302,7 @@ async function notificationsWorkflowChecks(input) {
7267
7302
  try {
7268
7303
  text = (await source.readFile(NOTIFICATIONS_WORKFLOW_PATH))?.content;
7269
7304
  } catch (err) {
7270
- const reason = shown$3(describeError(err));
7305
+ const reason = shown$4(describeError(err));
7271
7306
  return [
7272
7307
  {
7273
7308
  id: PRESENT_ID,
@@ -7287,7 +7322,7 @@ async function notificationsWorkflowChecks(input) {
7287
7322
  ];
7288
7323
  const read = [...text.matchAll(/secrets\.(HOLOCRON_NOTIFY_[A-Z0-9_]+)/g)].map((m) => m[1]);
7289
7324
  const readSet = upper(read);
7290
- const problems = [...[...new Set(read)].filter((name) => !filled.has(name.toUpperCase())).map((name) => `${shown$3(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`)];
7325
+ 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
7326
  return [
7292
7327
  resultRow(PRESENT_ID, PRESENT_TITLE, [], "found"),
7293
7328
  resultRow(WIRED_ID, WIRED_TITLE, problems, `${wired.length} of ${wired.length} wired`),
@@ -7327,6 +7362,61 @@ async function postDoctorReport(notifications, channel, report, name = "notifica
7327
7362
  return `not posted: ${sanitizeDetail(describeError(err))}`;
7328
7363
  }
7329
7364
  }
7365
+ // src/commands/pr-feed-checks/pr-feed-checks.ts
7366
+ const FORUM_TITLE = "pull request feed forum exists";
7367
+ const TAGS_TITLE = "pull request feed forum has the tags of every state";
7368
+ const BOT_TITLE = "bot can post in the pull request feed forum and manage its threads";
7369
+ const same$2 = (a, b) => a.toLowerCase() === b.toLowerCase();
7370
+ const shown$3 = (s) => sanitizeDetail(s);
7371
+ /**
7372
+ * The steps of `doctor notifications` for the pull-request feed (`feeds.prs`): the forum is there (in its category, as a
7373
+ * 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
7374
+ * threads in it (read from `inspect`, after the channel's own overwrites). Read-only. No rows when no channel has
7375
+ * `feeds.prs`.
7376
+ */
7377
+ function prFeedChecks(input) {
7378
+ const { layout, found } = input;
7379
+ const fed = (layout.categories ?? []).flatMap((cat) => (cat.channels ?? []).map((channel) => ({
7380
+ cat: cat.name,
7381
+ channel
7382
+ }))).filter(({ channel }) => channel.feeds?.prs);
7383
+ if (fed.length === 0) return [];
7384
+ if (!found) {
7385
+ const reason = "not checked: could not read the server";
7386
+ return [
7387
+ skipRow("pr-feed-forum", FORUM_TITLE, reason),
7388
+ skipRow("pr-feed-tags", TAGS_TITLE, reason),
7389
+ skipRow("pr-feed-bot", BOT_TITLE, reason)
7390
+ ];
7391
+ }
7392
+ const forumProblems = [];
7393
+ const tagProblems = [];
7394
+ const botProblems = [];
7395
+ for (const { cat, channel } of fed) {
7396
+ const name = shown$3(channel.name);
7397
+ const have = found.channels.find((c) => same$2(c.name, channel.name) && c.category !== void 0 && same$2(c.category, cat));
7398
+ if (!have) {
7399
+ forumProblems.push(`#${name}: missing from ${shown$3(cat)}`);
7400
+ continue;
7401
+ }
7402
+ if (have.kind !== "forum") {
7403
+ forumProblems.push(`#${name}: is a text channel, not a forum; delete it so \`setup\` can make it again`);
7404
+ continue;
7405
+ }
7406
+ for (const tag of PR_FEED_TAGS) if (!have.tags?.some((t) => same$2(t.name, tag))) tagProblems.push(`#${name}: tag "${tag}" is missing`);
7407
+ if (have.botThreadsError) botProblems.push(`#${name}: could not read the bot's permissions (${shown$3(have.botThreadsError)})`);
7408
+ else if (have.botThreads) {
7409
+ if (!have.botThreads.post) botProblems.push(`#${name}: the bot cannot start posts or reply in it`);
7410
+ if (!have.botThreads.manage) botProblems.push(`#${name}: the bot cannot manage threads in it (Manage Threads)`);
7411
+ } else botProblems.push(`#${name}: the provider did not report the bot's permissions`);
7412
+ }
7413
+ const ok = `${fed.length} of ${fed.length} as declared`;
7414
+ return [
7415
+ resultRow("pr-feed-forum", FORUM_TITLE, forumProblems, ok),
7416
+ resultRow("pr-feed-tags", TAGS_TITLE, tagProblems, ok),
7417
+ resultRow("pr-feed-bot", BOT_TITLE, botProblems, ok)
7418
+ ];
7419
+ }
7330
7420
  // src/commands/relay-checks/relay-checks.ts
7331
7421
  /** How long to wait for the Worker before calling it unreachable. */
7332
7422
  const RELAY_TIMEOUT_MS = 5e3;
@@ -7965,6 +8055,11 @@ async function runDoctorNotifications(input) {
7965
8055
  missingReason: whyMissing(loader, "monitoring", "no `monitoring` provider is configured"),
7966
8056
  found
7967
8057
  }));
8058
+ checks.push(...botPermissionChecks({ found }));
8059
+ checks.push(...prFeedChecks({
8060
+ layout,
8061
+ found
8062
+ }));
7968
8063
  checks.push(...await notificationsWorkflowChecks({
7969
8064
  layout,
7970
8065
  source: loader.has("source") ? loader.get("source") : void 0,
@@ -21527,8 +21622,9 @@ const skillsCommand = {
21527
21622
  };
21528
21623
  // src/commands/specs-sync/forum-channel.ts
21529
21624
  /**
21530
- * The forum channel the discussion posts live in: the one named, or the only forum the layout declares. Returns the
21531
- * name, or the reason there is none, so the run can refuse before it reads a document.
21625
+ * The forum channel the discussion posts live in: the one named, or the only forum the layout declares that is not the
21626
+ * pull request feed's (`feeds.prs`, whose posts Sentinel makes, one for each pull request). Returns the name, or the
21627
+ * reason there is none, so the run can refuse before it reads a document.
21532
21628
  */
21533
21629
  function forumChannel(layout, wanted) {
21534
21630
  const forums = (layout.categories ?? []).flatMap((c) => c.channels ?? []).filter((c) => c.kind === "forum");
@@ -21536,8 +21632,9 @@ function forumChannel(layout, wanted) {
21536
21632
  const found = forums.find((c) => c.name.toLowerCase() === wanted.toLowerCase());
21537
21633
  return found ? { channel: found.name } : { problem: `the layout declares no forum named \`${wanted}\` -- add it with \`kind: "forum"\`` };
21538
21634
  }
21539
- if (forums.length === 1) return { channel: forums[0].name };
21540
- return { problem: forums.length === 0 ? "the layout declares no forum channel -- add one with `kind: \"forum\"`" : `the layout declares several forums (${forums.map((c) => `\`${c.name}\``).join(", ")}) -- pass --channel` };
21635
+ const documents = forums.filter((c) => !c.feeds?.prs);
21636
+ if (documents.length === 1) return { channel: documents[0].name };
21637
+ 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
21638
  }
21542
21639
  /**
21543
21640
  * The origin of a document from the commit that first added it: `line` is that commit's `<seconds>\t<subject>` and