@theholocron/cli 5.0.0-alpha.489 โ†’ 5.0.0-alpha.490

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
@@ -661,7 +661,7 @@ commands and the config are provider-neutral; Discord is the first provider.
661
661
  | `holocron new 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) |
662
662
  | `holocron link account` | Links your account on the provider to your GitHub account by signing in with the provider (OAuth, nothing secret kept) |
663
663
  | `holocron sync roles` | Makes who holds a role match a GitHub team, through the links file (`--keep` only adds; `--provider` picks one) |
664
- | `holocron reconcile project [board]` | Sets item statuses where a rule says so: an open blocker means `blocked`, no blocker left means `planned`, closed means `done`, and (from the pull requests that close the item) an open pull request means `active` and a green `ci / Required checks` means `review` (status only; `--dry-run` previews; an open item with no status is reported). Runs hourly from `platform.projectReconcile.yml`, which `setup` writes when `providers.projects` declares boards |
664
+ | `holocron reconcile project [board]` | Sets item statuses where a rule says so: an open blocker means `blocked`, no blocker left means `planned`, closed means `done`, and, from the pull requests that close the item, an open one means `active` and a green `ci / Required checks` means `review` (a failure moves `review` back; GitHub reads them through `closedByPullRequestsReferences`) (status only; `--dry-run` previews; an open item with no status is reported). Runs hourly from `platform.projectReconcile.yml`, which `setup` writes when `providers.projects` declares boards |
665
665
  | `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 fail). 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 |
666
666
  | `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 |
667
667
  | `holocron doctor github-app` | Does each GitHub App instance in `githubApps` (`{ name, manifest, environment }`) have what its manifest file (`default_permissions`, `default_events`) declares? Reads the App's id and key from the vault `environment` in memory (never printed), calls `GET /app` and `GET /app/installations` with the App's JWT. Rows per instance: `reachable`, `events` (all subscribed), `permissions` (each granted at least at the manifest's level, `read < write < admin`), `installations` (none lags the App, a pending update fails). Extras on the App are `info` in a row's detail, never a failure. A gap ends with the App's settings page (user- or organization-owned) and, for an installation, its own page. Credentials that cannot be read are a skip; an unreadable manifest or a rejected JWT fails. Read-only |
package/dist/cli.mjs CHANGED
@@ -27721,6 +27721,58 @@ const publishCommand = {
27721
27721
  builder: (y) => y.command(npmBumpVersionsCommand).command(moveTagCommand).command(publishPackageCommand).command(groupMenu("publish")),
27722
27722
  handler: () => {}
27723
27723
  };
27724
+ // src/commands/project/plan-pull-request-status/plan-pull-request-status.ts
27725
+ /**
27726
+ * Decide the status an item's linked pull requests ask for (spec `tech-board-status-automation`, #2388). Pure: it reads
27727
+ * one item and the template and touches nothing; status only, never priority or any other field.
27728
+ *
27729
+ * - an open linked pull request (a draft counts) puts the item in `active`;
27730
+ * - an open one whose aggregate check is `success` puts it in `review`;
27731
+ * - when the item is in `review` and no open pull request is green, a `failure` moves it back to `active`, while
27732
+ * `pending` and `none` leave it, so a re-run after a push does not flicker the board;
27733
+ * - no open pull request: no change (closed and merged ones are `planReconcile()`'s, through the closed issue).
27734
+ *
27735
+ * Left to `planReconcile()`, which runs first: a closed item, an item with an open blocker or in `blocked`, and an
27736
+ * item with no status (reported there, not set). An item in `done` is left alone. Where the template has no status of
27737
+ * the wanted category the rule comes back as `unresolved` and nothing is guessed; where a category has several statuses
27738
+ * the first in template order is used. Applying the change and planning again gives no change.
27739
+ */
27740
+ function planPullRequestStatus(item, template) {
27741
+ if (!item.open || item.status === void 0 || item.blockedBy.length > 0) return void 0;
27742
+ const category = template.statuses.find((s) => s.name === item.status)?.category ?? item.category;
27743
+ if (category === "blocked" || category === "done") return void 0;
27744
+ const open = (item.pullRequests ?? []).filter((pr) => pr.state === "open");
27745
+ if (open.length === 0) return void 0;
27746
+ let want;
27747
+ let reason;
27748
+ if (open.some((pr) => pr.checks === "success")) {
27749
+ if (category !== "review") [want, reason] = ["review", "checks-green"];
27750
+ } else if (category === "review") {
27751
+ if (open.some((pr) => pr.checks === "failure")) [want, reason] = ["active", "checks-failed"];
27752
+ } else if (category !== "active") [want, reason] = ["active", "pull-request-open"];
27753
+ if (want === void 0 || reason === void 0) return void 0;
27754
+ const to = template.statuses.find((s) => s.category === want)?.name;
27755
+ if (to === void 0) return {
27756
+ kind: "unresolved",
27757
+ unresolved: {
27758
+ key: item.key,
27759
+ title: item.title,
27760
+ category: want,
27761
+ reason
27762
+ }
27763
+ };
27764
+ return {
27765
+ kind: "change",
27766
+ change: {
27767
+ key: item.key,
27768
+ title: item.title,
27769
+ from: item.status,
27770
+ to,
27771
+ category: want,
27772
+ reason
27773
+ }
27774
+ };
27775
+ }
27724
27776
  // src/commands/project/plan-reconcile/plan-reconcile.ts
27725
27777
  /**
27726
27778
  * Decide the status changes that keep a board true (spec `command-project`, "Keeping a board true"). Pure: it reads
@@ -27781,7 +27833,9 @@ function planReconcile(items, template) {
27781
27833
  /**
27782
27834
  * `holocron reconcile project [board]` โ€” set the status of board items where a rule says so (spec `command-project`,
27783
27835
  * "Keeping a board true"): an open item with an open blocker goes to the `blocked` status, an open blocked one with no
27784
- * blocker returns to `planned`, a closed or merged one goes to `done`. Status only, never priority or any other field.
27836
+ * blocker returns to `planned`, a closed or merged one goes to `done`; then `planPullRequestStatus()` puts an open item with
27837
+ * an open linked pull request in `active` and one whose aggregate check is green in `review` (#2388). Status only, never
27838
+ * priority or any other field.
27785
27839
  *
27786
27840
  * The rules are `planReconcile()`, pure; this reads the items through the `projects` capability, applies each change
27787
27841
  * through `setStatus` and prints one line per item. A refusal is a reported failure and the run continues; the exit is
@@ -27792,7 +27846,10 @@ function planReconcile(items, template) {
27792
27846
  const WHY = {
27793
27847
  blocked: "has an open blocker",
27794
27848
  unblocked: "no open blocker left",
27795
- closed: "closed"
27849
+ closed: "closed",
27850
+ "pull-request-open": "a pull request is open",
27851
+ "checks-green": "its pull request is green",
27852
+ "checks-failed": "its pull request failed its checks"
27796
27853
  };
27797
27854
  const line = (c) => `${c.key} ${c.from ?? "no status"} โ†’ ${c.to} (${WHY[c.reason]})`;
27798
27855
  async function runProjectReconcile(input) {
@@ -27862,7 +27919,15 @@ async function runProjectReconcile(input) {
27862
27919
  failStep(declared.name, "the board does not exist or is closed; run `holocron setup project`");
27863
27920
  continue;
27864
27921
  }
27865
- plan = planReconcile(await projects.items(owner, board, template), template);
27922
+ const items = await projects.items(owner, board, template);
27923
+ plan = planReconcile(items, template);
27924
+ const settled = /* @__PURE__ */ new Set([...plan.changes.map((c) => c.key), ...plan.unset.map((i) => i.key)]);
27925
+ for (const item of items) {
27926
+ if (settled.has(item.key)) continue;
27927
+ const byPullRequest = planPullRequestStatus(item, template);
27928
+ if (byPullRequest?.kind === "change") plan.changes.push(byPullRequest.change);
27929
+ else if (byPullRequest) plan.unresolved.push(byPullRequest.unresolved);
27930
+ }
27866
27931
  } catch (err) {
27867
27932
  failStep(declared.name, describeError(err));
27868
27933
  logger.warn({