@theholocron/cli 5.0.0-alpha.353 → 5.0.0-alpha.354

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
@@ -646,7 +646,7 @@ Channels fed by the error tracker add `feeds: { errors: true }` and a layout `re
646
646
 
647
647
  `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`.
648
648
 
649
- 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`.
649
+ 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.
650
650
 
651
651
  `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/).
652
652
 
package/dist/cli.mjs CHANGED
@@ -4951,7 +4951,8 @@ async function provisionChannel(deps, spec) {
4951
4951
  ...spec.topic ? { topic: spec.topic } : {},
4952
4952
  ...spec.access ? { access: spec.access } : {},
4953
4953
  ...spec.kind ? { kind: spec.kind } : {},
4954
- ...spec.tags ? { tags: spec.tags } : {}
4954
+ ...spec.tags ? { tags: spec.tags } : {},
4955
+ ...spec.defaultReaction ? { defaultReaction: spec.defaultReaction } : {}
4955
4956
  });
4956
4957
  const changed = channel.created || (channel.updated?.length ?? 0) > 0;
4957
4958
  const verb = channel.created ? "created" : changed ? "updated" : "exists ";
@@ -6066,9 +6067,12 @@ function forumLayoutProblem(layout) {
6066
6067
  const where = `channel \`${channel.name}\``;
6067
6068
  if (channel.kind !== "forum") {
6068
6069
  if (channel.tags) return `${where}: \`tags\` belong to a forum -- set \`kind: "forum"\` or remove them`;
6070
+ if (channel.defaultReaction || channel.starterReactions) return `${where}: reactions belong to a forum -- set \`kind: "forum"\` or remove them`;
6069
6071
  continue;
6070
6072
  }
6071
6073
  if (channel.webhook || channel.feeds?.monitoring || channel.feeds?.errors) return `${where}: a forum takes no \`webhook\` or \`feeds\`; its conversations are posts`;
6074
+ if (channel.defaultReaction !== void 0 && channel.defaultReaction.trim() === "") return `${where}: \`defaultReaction\` is empty`;
6075
+ if ((channel.starterReactions ?? []).some((r) => r.trim() === "")) return `${where}: a starter reaction is empty`;
6072
6076
  const seen = /* @__PURE__ */ new Set();
6073
6077
  for (const tag of channel.tags ?? []) {
6074
6078
  const name = tag.name.trim().toLowerCase();
@@ -6402,6 +6406,7 @@ async function runNotificationsSetup(input$1) {
6402
6406
  ...effectiveAccess(category.access, channel.access) ? { access: effectiveAccess(category.access, channel.access) } : {},
6403
6407
  ...channel.kind ? { kind: channel.kind } : {},
6404
6408
  ...channel.tags ? { tags: channel.tags } : {},
6409
+ ...channel.defaultReaction ? { defaultReaction: channel.defaultReaction } : {},
6405
6410
  ...webhook ? { webhook } : {},
6406
6411
  ...channel.feeds?.monitoring || channel.feeds?.errors ? { feeds: {
6407
6412
  ...channel.feeds.monitoring ? { monitoring: {
@@ -7603,10 +7608,13 @@ async function runDoctorNotifications(input) {
7603
7608
  if (channel.topic && (match.topic ?? "") !== channel.topic) channelProblems.push(`#${shown(channel.name)}: topic is "${shown(match.topic ?? "")}" but the layout says "${shown(channel.topic)}"`);
7604
7609
  const isForum = channel.kind === "forum";
7605
7610
  if (isForum !== (match.kind === "forum")) channelProblems.push(`#${shown(channel.name)}: is ${isForum ? "a text channel, and the layout says forum" : "a forum, and the layout says text"}; delete it so \`setup\` can make it again`);
7606
- else if (isForum) for (const tag of channel.tags ?? []) {
7607
- const have = match.tags?.find((t) => same(t.name, tag.name));
7608
- if (!have) channelProblems.push(`#${shown(channel.name)}: tag "${shown(tag.name)}" is missing`);
7609
- else if ((have.emoji ?? "") !== (tag.emoji ?? "") || (have.moderated ?? false) !== (tag.moderated ?? false)) channelProblems.push(`#${shown(channel.name)}: tag "${shown(tag.name)}" differs from the layout (emoji or moderated)`);
7611
+ else if (isForum) {
7612
+ if (channel.defaultReaction && (match.defaultReaction ?? "") !== channel.defaultReaction) channelProblems.push(`#${shown(channel.name)}: default reaction is ${match.defaultReaction ? `"${shown(match.defaultReaction)}"` : "not set"} but the layout says "${shown(channel.defaultReaction)}"`);
7613
+ for (const tag of channel.tags ?? []) {
7614
+ const have = match.tags?.find((t) => same(t.name, tag.name));
7615
+ if (!have) channelProblems.push(`#${shown(channel.name)}: tag "${shown(tag.name)}" is missing`);
7616
+ else if ((have.emoji ?? "") !== (tag.emoji ?? "") || (have.moderated ?? false) !== (tag.moderated ?? false)) channelProblems.push(`#${shown(channel.name)}: tag "${shown(tag.name)}" differs from the layout (emoji or moderated)`);
7617
+ }
7610
7618
  }
7611
7619
  }
7612
7620
  add("channels", "channels in their category, with topics", channelProblems, declaredChannels.length === 0 ? "none declared" : `${declaredChannels.length} of ${declaredChannels.length} as declared`);