@theholocron/cli 5.0.0-alpha.575 → 5.0.0-alpha.576

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/dist/cli.mjs CHANGED
@@ -2,19 +2,20 @@
2
2
  import { createRequire } from "node:module";
3
3
  import { constants, homedir, tmpdir } from "node:os";
4
4
  import path, { basename, dirname, isAbsolute, join, posix, relative, resolve, sep } from "node:path";
5
- import { PREFIX as PREFIX$1, createEnvLookup, detectEnvironment, environment, firstEnv, holocronEnv } from "@theholocron/env-utils/lookup";
5
+ import { Separator, checkbox, confirm, input, password, select } from "@inquirer/prompts";
6
+ import { PREFIX as PREFIX$1, createEnvLookup, detectEnvironment, environment, firstEnv, holocronEnv, isCI } from "@theholocron/env-utils/lookup";
6
7
  import { ProviderApiError, ProviderApiError as ProviderApiError$1, createRestClient, onRetry } from "@theholocron/http-client";
7
8
  import { addGlobalOptions, groupMenu as groupMenu$1, tokenContext as tokenContext$1 } from "@theholocron/kyber/flags";
9
+ import { DRY_RUN_NOOP_EXIT_CODE, createCommandRegistry, createMenu, dryRunPreviewEnvVar, numeric, spawnChild } from "@theholocron/kyber/menu";
8
10
  import { checkForUpdates } from "@theholocron/kyber/notifier";
9
11
  import { NonInteractiveError, commandFailureMessage, createProgress, createRetryNotice, declaredVsActual, describeError, logReason, openPath, pad as pad$1, printCheckRows, printCheckSummary, sanitizeDetail, setProgressListener, statusRow as statusRow$1, stripControl, style, summariseChecks, viewJson, withProgress, withSpinner } from "@theholocron/kyber/ui";
10
12
  import { LOG_LEVELS } from "@theholocron/observability/core";
11
13
  import yargs from "yargs";
12
14
  import { hideBin } from "yargs/helpers";
13
15
  import { appendFileSync, closeSync, copyFileSync, existsSync, fstatSync, lstatSync, mkdirSync, mkdtempSync, openSync, readFileSync, readdirSync, readlinkSync, realpathSync, rmSync, statSync, symlinkSync, writeFileSync, writeSync } from "node:fs";
14
- import { DRY_RUN_NOOP_EXIT_CODE, createCommandRegistry, createMenu, numeric } from "@theholocron/kyber/menu";
15
16
  import { Entry, findCredentials } from "@napi-rs/keyring";
16
17
  import { AuthError, DOTENV_FILE, copyToClipboard, createFeatureResolver as createFeatureResolver$1, createKeyring, createPrivateFile, dotenvLine, findCredential, finishCredentialsFile, hasCredentials, isGitIgnored, readDotenvFile, resolveValue as resolveValue$1, resolveValue as resolveValue$2, setCredentials, writeCredentialsFile } from "@theholocron/kyber/secrets";
17
- import { AGGREGATE_CHECK, AGGREGATE_CHECK_NAME, AGGREGATE_SHADOW_CHECK_NAME, DEFAULT_ORG, DOCUMENTATION_FLAG, DOT_GITHUB_REPO, HOLOCRON_REPO, KNOWN_TASKS, KNOWN_WORKFLOWS, LEGACY_NAMES, PNPM_BUILTIN_COMMANDS, PRERELEASE_CHANNEL, RELEASE_BRANCHES, RESERVED_SCRIPT_NAMES, SUITES, TASKS, aggregateChecks, aggregatePoster, checkPackageScripts, checkReleaseLines, codecovFlagNames, createAstromech, createCommitMsg, createDependabot, createDevmoji, createEditorconfig, createEditorconfigChecker, createHeader, createLabeler, createPreCommit, createPrePush, createPrepareCommitMsg, createYamlignore, createYamllint, defaultListDirs, defaultPaths, defaultReadJson, deployOnRelease, describeTasks, extractPreviewConfig, formatJson, frozenReusablePaths, generateThinCallerContent, hostedReusableWorkflows, isDeprecated, isTask, legacyCaller, legacyCallerFile, legacyGate, legacyWorkflowKey, localize, localizeActions, mergeScripts, packageLocation, postAggregate, readWorkspacePackages, recordDeploys, resolveTaskName, reusableTemplates, scriptName, stampDeprecated, wedgeFix, workflowFile, workflowKey, workflowKeys, workspacePackages as workspacePackages$1 } from "@theholocron/astromech";
18
+ import { AGGREGATE_CHECK, AGGREGATE_CHECK_NAME, AGGREGATE_SHADOW_CHECK_NAME, DEFAULT_ORG, DOCUMENTATION_FLAG, DOT_GITHUB_REPO, HOLOCRON_REPO, KNOWN_TASKS, KNOWN_WORKFLOWS, LEGACY_NAMES, PNPM_BUILTIN_COMMANDS, PRERELEASE_CHANNEL, RELEASE_BRANCHES, RESERVED_SCRIPT_NAMES, SUITES, TASKS, aggregateChecks, aggregatePoster, checkPackageScripts, checkReleaseLines, codecovFlagNames, createAstromech, createCommitMsg, createDependabot, createDevmoji, createEditorconfig, createEditorconfigChecker, createHeader, createLabeler, createPreCommit, createPrePush, createPrepareCommitMsg, createYamlignore, createYamllint, defaultListDirs, defaultPaths, defaultReadJson, deployOnRelease, describeTasks, extractPreviewConfig, formatJson, frozenReusablePaths, generateThinCallerContent, hostedReusableWorkflows, isDeprecated, isTask, legacyCaller, legacyCallerFile, legacyGate, legacyWorkflowKey, localize, localizeActions, mergeScripts, packageLocation, postAggregate, readWorkspacePackages, recordDeploys, requiredChecks, resolveTaskName, reusableTemplates, scriptName, stampDeprecated, wedgeFix, workflowFile, workflowKey, workflowKeys, workspacePackages as workspacePackages$1 } from "@theholocron/astromech";
18
19
  import { loadTasksConfig, releaseGroups } from "@theholocron/astromech/config";
19
20
  import { createCliLogger, createCliTelemetry } from "@theholocron/kyber/observability";
20
21
  import { resolveAxiomFromEnv } from "@theholocron/observability/logger";
@@ -23,7 +24,6 @@ import { LoaderError, assertPluginsResolvable as assertPluginsResolvable$1, crea
23
24
  import { readGitRemote, updateGitignore, upsertManagedBlock } from "@theholocron/git-utils";
24
25
  import { bumpCatalogPins, discoverWorkspacePackages, parseCatalogs, readPackageJson, readPackageJsonSync, resolveWorkspaceGlobs } from "@theholocron/pkg-utils";
25
26
  import { runCheckAgainstUrl } from "@theholocron/kyber/checks";
26
- import { Separator, checkbox, confirm, input, password, select } from "@inquirer/prompts";
27
27
  import { access, copyFile, lstat, mkdir, open, readFile, readdir, realpath, rename, rm, stat, symlink, unlink, writeFile } from "node:fs/promises";
28
28
  import { createHash, createHmac, randomBytes, randomUUID } from "node:crypto";
29
29
  import { promptForPositionals } from "@theholocron/kyber/prompts";
@@ -2671,6 +2671,65 @@ const menuCommand = (version) => ({
2671
2671
  await launchMenu([...COMMAND_REGISTRY, ...runEntries], argv);
2672
2672
  }
2673
2673
  });
2674
+ // src/commands/offer-real-run/command-supports-dry-run.ts
2675
+ /**
2676
+ * Whether the command that ran honours `--dry-run`: the longest leading run of `words` (up to three) that names a
2677
+ * registered command decides, so `sync secrets --env ci` is `sync secrets`.
2678
+ *
2679
+ * @param words - The command words yargs parsed.
2680
+ * @param entries - The registered commands.
2681
+ * @returns `true` when that command declares `supportsDryRun`.
2682
+ */
2683
+ function commandSupportsDryRun(words, entries) {
2684
+ for (const length of [
2685
+ 3,
2686
+ 2,
2687
+ 1
2688
+ ]) {
2689
+ const name = words.slice(0, length).join(" ");
2690
+ const entry = entries.find((e) => e.name === name);
2691
+ if (entry) return entry.supportsDryRun === true;
2692
+ }
2693
+ return false;
2694
+ }
2695
+ // src/commands/offer-real-run/without-dry-run.ts
2696
+ /**
2697
+ * Takes `--dry-run` (and `--dry-run=true`) out of a command's arguments, leaving everything after a bare `--` alone:
2698
+ * that part belongs to the tool the command forwards to.
2699
+ *
2700
+ * @param args - The command's arguments.
2701
+ * @returns The same arguments, for a real run.
2702
+ */
2703
+ function withoutDryRun(args) {
2704
+ const stop = args.indexOf("--");
2705
+ const own = stop === -1 ? args : args.slice(0, stop);
2706
+ const rest = stop === -1 ? [] : args.slice(stop);
2707
+ return [...own.filter((arg) => arg !== "--dry-run" && !arg.startsWith("--dry-run=")), ...rest];
2708
+ }
2709
+ // src/commands/offer-real-run/offer-real-run.ts
2710
+ const INFO_FLAGS = /* @__PURE__ */ new Set([
2711
+ "--help",
2712
+ "-h",
2713
+ "--version",
2714
+ "-v"
2715
+ ]);
2716
+ /**
2717
+ * After a person's own `--dry-run` ends well, asks at once whether to run the same command for real, and runs it with
2718
+ * `--dry-run` taken out. Nothing is asked when nobody is there to answer (no terminal, CI), when the menu's preview is
2719
+ * running (it asks its own question), when the dry run failed, when the command has no dry run to speak of, or when
2720
+ * help or the version was what was shown. The default is no.
2721
+ *
2722
+ * @param input - The run that just ended, and the seams to ask and to run again.
2723
+ * @returns The exit code of the real run, or `undefined` when nothing was offered or the answer was no.
2724
+ */
2725
+ async function offerRealRun(input) {
2726
+ if (!input.dryRun || input.exitCode !== 0) return void 0;
2727
+ if (!input.interactive || input.ci || input.preview) return void 0;
2728
+ if (input.args.some((arg) => INFO_FLAGS.has(arg))) return void 0;
2729
+ if (!input.supportsDryRun(input.words)) return void 0;
2730
+ if (!await input.confirm("Dry run complete — run it for real?")) return void 0;
2731
+ return input.spawn(withoutDryRun(input.args));
2732
+ }
2674
2733
  // src/observability/logger/logger.ts
2675
2734
  /**
2676
2735
  * CLI-side wiring for `@theholocron/observability/logger`.
@@ -7946,6 +8005,207 @@ async function abandonWork(a) {
7946
8005
  } else rows.push(row$36("issue", "skip", `${key} left open`));
7947
8006
  return { rows };
7948
8007
  }
8008
+ // src/required-checks/required-from-contexts/required-from-contexts.ts
8009
+ /** What GitHub puts between a caller job's name and the called job's name in a check run's name. */
8010
+ const SEPARATOR = " / ";
8011
+ /**
8012
+ * Turns required status-check contexts (a ruleset's `requiredChecks`, or `requiredChecks()` from astromech) into the
8013
+ * `{ expected, statuses }` form the aggregate and `requiredChecksVerdict()` read.
8014
+ *
8015
+ * A context with ` / ` in it names a check run (`test:unit / Conclusion`): its id is the part before the first ` / `,
8016
+ * and `evaluateAggregate()` matches any run named `<id> / ...`, which is how `aggregateChecks()` derives `expected`
8017
+ * from the same contexts. A context with none (`codecov/patch`, `codecov/patch/documentation`) is a `statuses` entry:
8018
+ * the verdict then accepts a check run named like it, else a commit status of that context. Order is kept and
8019
+ * duplicates dropped (two contexts of one caller are one id).
8020
+ */
8021
+ function requiredFromContexts(contexts) {
8022
+ const expected = /* @__PURE__ */ new Set();
8023
+ const statuses = /* @__PURE__ */ new Set();
8024
+ for (const context of contexts) {
8025
+ const at = context.indexOf(SEPARATOR);
8026
+ if (at === -1) statuses.add(context);
8027
+ else expected.add(context.slice(0, at));
8028
+ }
8029
+ return {
8030
+ expected: [...expected],
8031
+ statuses: [...statuses]
8032
+ };
8033
+ }
8034
+ // src/commands/declared-required-checks/declared-required-checks.ts
8035
+ /**
8036
+ * The status-check contexts the repo writes down in `repo.requiredChecks` (`.holocron/repo.ts`), de-duplicated and in the
8037
+ * order given, or `undefined` when it leaves the list out and `holocron setup` derives it from the task manifest
8038
+ * (`astromech.requiredChecks()`). A declared list is the whole list: nothing is added to it (not the DCO check, not a
8039
+ * task's context), so what the ruleset requires is what the file says. `setup` writes it and `doctor repo` compares it.
8040
+ */
8041
+ function declaredRequiredChecks(repo) {
8042
+ const declared = repo?.requiredChecks;
8043
+ return declared === void 0 ? void 0 : [...new Set(declared)];
8044
+ }
8045
+ // src/commands/setup/branch-protection.ts
8046
+ const RULESET_NAME = "holocron-default-branch";
8047
+ function buildClassicProtectionPayload(requiredChecks = []) {
8048
+ return {
8049
+ required_status_checks: requiredChecks.length > 0 ? {
8050
+ strict: false,
8051
+ contexts: requiredChecks
8052
+ } : null,
8053
+ enforce_admins: false,
8054
+ required_pull_request_reviews: {
8055
+ required_approving_review_count: 0,
8056
+ dismiss_stale_reviews: false,
8057
+ require_code_owner_reviews: false
8058
+ },
8059
+ restrictions: null,
8060
+ allow_force_pushes: false,
8061
+ allow_deletions: false
8062
+ };
8063
+ }
8064
+ /**
8065
+ * The ruleset `setup` writes. `pins` maps a required context to the integration id of the one GitHub App whose check
8066
+ * may satisfy it (written as `integration_id` on that entry); a context with no entry may be satisfied by any app.
8067
+ */
8068
+ function buildRulesetPayload(requiredChecks = [], pins = {}) {
8069
+ const rules = [
8070
+ { type: "deletion" },
8071
+ { type: "non_fast_forward" },
8072
+ {
8073
+ type: "pull_request",
8074
+ parameters: {
8075
+ required_approving_review_count: 0,
8076
+ dismiss_stale_reviews_on_push: false,
8077
+ require_code_owner_review: false,
8078
+ require_last_push_approval: false,
8079
+ required_review_thread_resolution: true,
8080
+ require_extra_approval_for_unattributed_changes: false
8081
+ }
8082
+ }
8083
+ ];
8084
+ if (requiredChecks.length > 0) rules.push({
8085
+ type: "required_status_checks",
8086
+ parameters: {
8087
+ required_status_checks: requiredChecks.map((context) => pins[context] === void 0 ? { context } : {
8088
+ context,
8089
+ integration_id: pins[context]
8090
+ }),
8091
+ strict_required_status_checks_policy: false
8092
+ }
8093
+ });
8094
+ return {
8095
+ name: RULESET_NAME,
8096
+ target: "branch",
8097
+ enforcement: "active",
8098
+ bypass_actors: [{
8099
+ actor_id: 4,
8100
+ actor_type: "RepositoryRole",
8101
+ bypass_mode: "always"
8102
+ }],
8103
+ conditions: { ref_name: {
8104
+ include: ["~DEFAULT_BRANCH"],
8105
+ exclude: []
8106
+ } },
8107
+ rules
8108
+ };
8109
+ }
8110
+ async function upsertBranchProtection(source, dryRun, requiredChecks, pins = {}) {
8111
+ const step = `upsert ruleset ${RULESET_NAME}`;
8112
+ if (dryRun) return {
8113
+ capability: "source",
8114
+ step,
8115
+ status: "dry-run"
8116
+ };
8117
+ try {
8118
+ const found = (await source.listRulesets()).find((r) => r.name === RULESET_NAME);
8119
+ if (found) {
8120
+ await source.updateRuleset(found.id, buildRulesetPayload(requiredChecks, pins));
8121
+ return {
8122
+ capability: "source",
8123
+ step,
8124
+ status: "ok",
8125
+ message: "updated"
8126
+ };
8127
+ }
8128
+ await source.createRuleset(buildRulesetPayload(requiredChecks, pins));
8129
+ return {
8130
+ capability: "source",
8131
+ step,
8132
+ status: "ok",
8133
+ message: "created"
8134
+ };
8135
+ } catch (err) {
8136
+ if (!(err instanceof ProviderApiError) || err.status !== 403) return {
8137
+ capability: "source",
8138
+ step,
8139
+ status: "fail",
8140
+ message: errorMessage(err)
8141
+ };
8142
+ }
8143
+ try {
8144
+ const repo = await source.getRepo();
8145
+ await source.protectBranch(repo.defaultBranch, buildClassicProtectionPayload(requiredChecks));
8146
+ return {
8147
+ capability: "source",
8148
+ step,
8149
+ status: "ok",
8150
+ message: `classic protection on ${repo.defaultBranch}`
8151
+ };
8152
+ } catch (err) {
8153
+ if (err instanceof ProviderApiError && err.status === 403) return {
8154
+ capability: "source",
8155
+ step,
8156
+ status: "skip",
8157
+ message: "branch protection unavailable on private repos without GitHub Pro/Team"
8158
+ };
8159
+ return {
8160
+ capability: "source",
8161
+ step,
8162
+ status: "fail",
8163
+ message: errorMessage(err)
8164
+ };
8165
+ }
8166
+ }
8167
+ // src/required-checks/resolve-required-checks/resolve-required-checks.ts
8168
+ /** The contexts of the repo's own list: what `holocron setup` writes to the ruleset when there is no aggregate. */
8169
+ function configContexts(config) {
8170
+ const declared = declaredRequiredChecks(config.repo);
8171
+ if (declared !== void 0) return declared;
8172
+ const tasks = { tasks: config.tasks };
8173
+ if (config.extraRequiredChecks) tasks.extraRequiredChecks = config.extraRequiredChecks;
8174
+ if (config.ci) tasks.ci = config.ci;
8175
+ return requiredChecks(tasks, false);
8176
+ }
8177
+ /**
8178
+ * The checks that must be green before a pull request may merge, for a repo whose `ci.aggregate` is `none` (spec
8179
+ * `tech-checks-without-aggregate`, decision 2): the live ruleset's required contexts first, read through the `source`
8180
+ * provider, because the ruleset is the real gate. When that cannot be read (the provider has no ruleset reads, the
8181
+ * call throws, the repo has no active `holocron-default-branch` ruleset, or it requires no checks) the checkout's own
8182
+ * list is used, the one `setup` writes to the ruleset, and `why` says why. Both go through
8183
+ * {@link requiredFromContexts}, so the result has one shape either way.
8184
+ *
8185
+ * The ruleset is found by name, as `doctor repo` does; the provider reports no branch conditions, so there is no
8186
+ * branch argument. Never throws: a failed read is a fallback, not an error.
8187
+ */
8188
+ async function resolveRequiredChecks(input) {
8189
+ const { source, config } = input;
8190
+ const fallback = (why) => ({
8191
+ required: requiredFromContexts(configContexts(config)),
8192
+ from: "config",
8193
+ why
8194
+ });
8195
+ if (!source.listRulesets || !source.getRulesetDetail) return fallback("the source provider cannot read rulesets");
8196
+ try {
8197
+ const found = (await source.listRulesets()).find((r) => r.name === "holocron-default-branch" && r.enforcement === "active");
8198
+ if (!found) return fallback(`no active ruleset ${RULESET_NAME}`);
8199
+ const detail = await source.getRulesetDetail(found.id);
8200
+ if (detail.requiredChecks.length === 0) return fallback(`ruleset ${RULESET_NAME} requires no checks`);
8201
+ return {
8202
+ required: requiredFromContexts(detail.requiredChecks),
8203
+ from: "ruleset"
8204
+ };
8205
+ } catch (err) {
8206
+ return fallback(`could not read the ruleset: ${describeError(err)}`);
8207
+ }
8208
+ }
7949
8209
  // src/commands/update-work/find-work-pull-request/find-work-pull-request.ts
7950
8210
  /**
7951
8211
  * The open pull requests of a piece of work, found by the branch name `start work` gives them
@@ -9050,6 +9310,28 @@ async function runUpdateWork(input) {
9050
9310
  }
9051
9311
  return finish();
9052
9312
  }
9313
+ // src/commands/close-work/checks-wording/checks-wording.ts
9314
+ /**
9315
+ * The words `close work` uses for the checks it waits on: the `ci / Required checks` aggregate where a repo posts one,
9316
+ * "the required checks" where `ci.aggregate` is `none`. The aggregate's words are exactly what the command always
9317
+ * printed.
9318
+ */
9319
+ function checksWording(noAggregate) {
9320
+ if (noAggregate) return {
9321
+ id: "required checks",
9322
+ subject: "the required checks",
9323
+ are: "are",
9324
+ they: "they are",
9325
+ unknown: "not known yet (none is listed, or the state could not be read)"
9326
+ };
9327
+ return {
9328
+ id: "ci / Required checks",
9329
+ subject: "ci / Required checks",
9330
+ are: "is",
9331
+ they: "it is",
9332
+ unknown: "not posted yet"
9333
+ };
9334
+ }
9053
9335
  // src/commands/close-work/find-closed-work-pull-request/find-closed-work-pull-request.ts
9054
9336
  /**
9055
9337
  * The closed pull requests of a piece of work, merged ones first, found by the same branch rule as
@@ -9611,7 +9893,9 @@ async function withdrawSpecs(loaded, context, files) {
9611
9893
  * `holocron close work <issue>` — the end of a piece of work (spec `tool-work-commands`, #2429, part 6).
9612
9894
  *
9613
9895
  * It never merges: the maintainer does. For work with an open pull request it reads the `ci / Required checks`
9614
- * aggregate (with `--wait`, polling until it is green or red or `--timeout` passes), and only on green asks, marks the
9896
+ * aggregate, or, in a repo whose `ci.aggregate` is `none`, the required checks themselves (the live ruleset's list, else
9897
+ * the config's; optional checks never block and a failure of one is only listed), with `--wait` polling until they are
9898
+ * green or red or `--timeout` passes, and only on green asks, marks the
9615
9899
  * pull request ready (the board then moves to In Review by itself), adds the area labels the changed folders earn
9616
9900
  * (through `update work`, add-only) and takes closed blockers off the issue. Not green stops there and names the failing
9617
9901
  * checks. Run again after the maintainer merged, it removes the worktree and the local branch and checks the remote
@@ -9633,6 +9917,8 @@ const row$32 = (id, status, detail) => ({
9633
9917
  detail,
9634
9918
  problems: []
9635
9919
  });
9920
+ /** A failing check as a row names it: its name, a link when there is one, and a note when it is optional. */
9921
+ const nameOf = (c) => `${c.url ? `${c.name} (${c.url})` : c.name}${c.required === false ? " [optional]" : ""}`;
9636
9922
  /** Runs `holocron close work`; see the file's comment. */
9637
9923
  async function runCloseWork(input) {
9638
9924
  /* v8 ignore next -- the console is only used outside tests, which inject `print` */
@@ -9759,33 +10045,47 @@ async function runCloseWork(input) {
9759
10045
  }));
9760
10046
  return finish();
9761
10047
  }
10048
+ const noAggregate = aggregatePoster({ ci: input.loaded.resolved.ci }) === "none";
10049
+ const words = checksWording(noAggregate);
9762
10050
  rows.push(row$32("pull request", "ok", `#${pr.number} ${pr.title}`));
9763
- if (!source.getPullRequestChecks) return fail("ci / Required checks", `the \`${source.providerName}\` provider cannot read a pull request's checks`);
10051
+ if (!source.getPullRequestChecks) return fail(words.id, `the \`${source.providerName}\` provider cannot read a pull request's checks`);
9764
10052
  const readChecks = source.getPullRequestChecks.bind(source);
9765
10053
  const number = pr.number;
10054
+ let required;
10055
+ if (noAggregate) {
10056
+ const resolved = await resolveRequiredChecks({
10057
+ source,
10058
+ config: input.loaded.resolved
10059
+ });
10060
+ required = resolved.required;
10061
+ const list = [...required.expected, ...required.statuses].join(", ") || "none";
10062
+ rows.push(row$32("required checks list", "skip", resolved.from === "ruleset" ? `from the live ruleset: ${list}` : `from the config (${resolved.why}): ${list}`));
10063
+ }
9766
10064
  const minutes = input.timeoutMinutes ?? DEFAULT_TIMEOUT_MINUTES;
9767
10065
  let result;
9768
10066
  try {
9769
10067
  result = await waitForChecks({
9770
- read: () => readChecks(number),
10068
+ read: () => required ? readChecks(number, void 0, required) : readChecks(number),
9771
10069
  wait: Boolean(input.wait),
9772
10070
  timeoutMs: minutes * 6e4,
9773
10071
  intervalMs: input.intervalMs ?? DEFAULT_INTERVAL_MS,
9774
10072
  now: input.now ?? Date.now,
9775
10073
  sleep: input.sleep ?? ((ms) => new Promise((done) => setTimeout(done, ms))),
9776
- onPoll: (state, polls) => print(` ${style.skip(`waiting: ci / Required checks is ${state.state} (read ${polls})`)}`)
10074
+ onPoll: (state, polls) => print(` ${style.skip(`waiting: ${words.subject} ${words.are} ${state.state} (read ${polls})`)}`)
9777
10075
  });
9778
10076
  } catch (err) {
9779
- return fail("ci / Required checks", `could not read the aggregate: ${describeError(err)}`);
10077
+ return fail(words.id, `could not read ${noAggregate ? "the checks" : "the aggregate"}: ${describeError(err)}`);
9780
10078
  }
9781
10079
  const { checks } = result;
9782
10080
  if (checks.state !== "success") {
9783
- const failing = checks.failing.slice(0, MAX_NAMED$1).map((c) => c.url ? `${c.name} (${c.url})` : c.name);
10081
+ const failing = checks.failing.slice(0, MAX_NAMED$1).map(nameOf);
9784
10082
  const more = checks.failing.length - failing.length;
9785
10083
  const named = failing.length > 0 ? `: ${failing.join(", ")}${more > 0 ? `, and ${more} more` : ""}` : "";
9786
- return fail("ci / Required checks", `${checks.state === "failure" ? `is red${named}` : result.timedOut ? `is still ${checks.state} after ${minutes} minute${minutes === 1 ? "" : "s"}` : `is ${checks.state === "none" ? "not posted yet" : "still running"}; --wait polls until it is green`}. #${number} was not marked ready; run \`close work ${key}\` again once it is green`);
10084
+ const why = checks.state === "failure" ? `${words.are} red${named}` : result.timedOut ? `${words.are} still ${checks.state} after ${minutes} minute${minutes === 1 ? "" : "s"}` : `${words.are} ${checks.state === "none" ? words.unknown : "still running"}; --wait polls until ${words.they} green`;
10085
+ return fail(words.id, `${why}. #${number} was not marked ready; run \`close work ${key}\` again once ${words.they} green`);
9787
10086
  }
9788
- rows.push(row$32("ci / Required checks", "ok", `green${checks.sha ? ` on ${checks.sha.slice(0, 7)}` : ""}`));
10087
+ const optional = checks.failing.filter((c) => c.required === false);
10088
+ rows.push(row$32(words.id, "ok", `green${checks.sha ? ` on ${checks.sha.slice(0, 7)}` : ""}${optional.length > 0 ? `; optional checks failing: ${optional.slice(0, MAX_NAMED$1).map(nameOf).join(", ")}` : ""}`));
9789
10089
  if (!dryRun && !input.yes) {
9790
10090
  if (!await ask(`${key} is green. ${`Mark #${number} ready, update the area labels and take closed blockers off ${key}`}?`)) {
9791
10091
  print(` ${style.skip("cancelled; nothing was changed")}`);
@@ -18223,17 +18523,6 @@ function aggregatePin(ci, requiredChecks) {
18223
18523
  };
18224
18524
  return { pins: { [AGGREGATE_CHECK]: ci.pin.integrationId } };
18225
18525
  }
18226
- // src/commands/declared-required-checks/declared-required-checks.ts
18227
- /**
18228
- * The status-check contexts the repo writes down in `repo.requiredChecks` (`.holocron/repo.ts`), de-duplicated and in the
18229
- * order given, or `undefined` when it leaves the list out and `holocron setup` derives it from the task manifest
18230
- * (`astromech.requiredChecks()`). A declared list is the whole list: nothing is added to it (not the DCO check, not a
18231
- * task's context), so what the ruleset requires is what the file says. `setup` writes it and `doctor repo` compares it.
18232
- */
18233
- function declaredRequiredChecks(repo) {
18234
- const declared = repo?.requiredChecks;
18235
- return declared === void 0 ? void 0 : [...new Set(declared)];
18236
- }
18237
18526
  // src/commands/repo-files/hosted-reusables.ts
18238
18527
  /** The name of the private package that holds the reusable workflows and composite actions. */
18239
18528
  const CI_PACKAGE = "@theholocron/ci";
@@ -18269,128 +18558,6 @@ function hostedReusableFile(id, content) {
18269
18558
  });
18270
18559
  return `${workflowHeader()}# Source package: .\n\n${localizeActions(content, LOCAL_ACTIONS)}`;
18271
18560
  }
18272
- // src/commands/setup/branch-protection.ts
18273
- const RULESET_NAME = "holocron-default-branch";
18274
- function buildClassicProtectionPayload(requiredChecks = []) {
18275
- return {
18276
- required_status_checks: requiredChecks.length > 0 ? {
18277
- strict: false,
18278
- contexts: requiredChecks
18279
- } : null,
18280
- enforce_admins: false,
18281
- required_pull_request_reviews: {
18282
- required_approving_review_count: 0,
18283
- dismiss_stale_reviews: false,
18284
- require_code_owner_reviews: false
18285
- },
18286
- restrictions: null,
18287
- allow_force_pushes: false,
18288
- allow_deletions: false
18289
- };
18290
- }
18291
- /**
18292
- * The ruleset `setup` writes. `pins` maps a required context to the integration id of the one GitHub App whose check
18293
- * may satisfy it (written as `integration_id` on that entry); a context with no entry may be satisfied by any app.
18294
- */
18295
- function buildRulesetPayload(requiredChecks = [], pins = {}) {
18296
- const rules = [
18297
- { type: "deletion" },
18298
- { type: "non_fast_forward" },
18299
- {
18300
- type: "pull_request",
18301
- parameters: {
18302
- required_approving_review_count: 0,
18303
- dismiss_stale_reviews_on_push: false,
18304
- require_code_owner_review: false,
18305
- require_last_push_approval: false,
18306
- required_review_thread_resolution: true,
18307
- require_extra_approval_for_unattributed_changes: false
18308
- }
18309
- }
18310
- ];
18311
- if (requiredChecks.length > 0) rules.push({
18312
- type: "required_status_checks",
18313
- parameters: {
18314
- required_status_checks: requiredChecks.map((context) => pins[context] === void 0 ? { context } : {
18315
- context,
18316
- integration_id: pins[context]
18317
- }),
18318
- strict_required_status_checks_policy: false
18319
- }
18320
- });
18321
- return {
18322
- name: RULESET_NAME,
18323
- target: "branch",
18324
- enforcement: "active",
18325
- bypass_actors: [{
18326
- actor_id: 4,
18327
- actor_type: "RepositoryRole",
18328
- bypass_mode: "always"
18329
- }],
18330
- conditions: { ref_name: {
18331
- include: ["~DEFAULT_BRANCH"],
18332
- exclude: []
18333
- } },
18334
- rules
18335
- };
18336
- }
18337
- async function upsertBranchProtection(source, dryRun, requiredChecks, pins = {}) {
18338
- const step = `upsert ruleset ${RULESET_NAME}`;
18339
- if (dryRun) return {
18340
- capability: "source",
18341
- step,
18342
- status: "dry-run"
18343
- };
18344
- try {
18345
- const found = (await source.listRulesets()).find((r) => r.name === RULESET_NAME);
18346
- if (found) {
18347
- await source.updateRuleset(found.id, buildRulesetPayload(requiredChecks, pins));
18348
- return {
18349
- capability: "source",
18350
- step,
18351
- status: "ok",
18352
- message: "updated"
18353
- };
18354
- }
18355
- await source.createRuleset(buildRulesetPayload(requiredChecks, pins));
18356
- return {
18357
- capability: "source",
18358
- step,
18359
- status: "ok",
18360
- message: "created"
18361
- };
18362
- } catch (err) {
18363
- if (!(err instanceof ProviderApiError) || err.status !== 403) return {
18364
- capability: "source",
18365
- step,
18366
- status: "fail",
18367
- message: errorMessage(err)
18368
- };
18369
- }
18370
- try {
18371
- const repo = await source.getRepo();
18372
- await source.protectBranch(repo.defaultBranch, buildClassicProtectionPayload(requiredChecks));
18373
- return {
18374
- capability: "source",
18375
- step,
18376
- status: "ok",
18377
- message: `classic protection on ${repo.defaultBranch}`
18378
- };
18379
- } catch (err) {
18380
- if (err instanceof ProviderApiError && err.status === 403) return {
18381
- capability: "source",
18382
- step,
18383
- status: "skip",
18384
- message: "branch protection unavailable on private repos without GitHub Pro/Team"
18385
- };
18386
- return {
18387
- capability: "source",
18388
- step,
18389
- status: "fail",
18390
- message: errorMessage(err)
18391
- };
18392
- }
18393
- }
18394
18561
  // src/commands/setup/derived-properties/derived-properties.ts
18395
18562
  /**
18396
18563
  * Repo archetype, in priority order:
@@ -23472,7 +23639,7 @@ function findObsoleteWorkflows({ workflows, written, pkgRelPath }) {
23472
23639
  return obsolete.sort();
23473
23640
  }
23474
23641
  // ../../.holocron/org.md
23475
- var org_default = "<!-- editorconfig-checker-disable-file -->\n\n# theholocron — agent operating contract\n\nOrg-level agent conventions for all `theholocron` repositories. The canonical\ncopy is `.holocron/org.md` in `theholocron/holocron`. `holocron sync` writes\nit into each repo's `AGENTS.md` between generated markers, so no repo needs a\nsibling checkout to read it; holocron itself imports it with `@.holocron/org.md`.\nEdit it in holocron, then run `holocron sync`.\n\n## Repo map\n\nEach concern lives in exactly one repo:\n\n| Concern | Repo |\n| ----------------------------------------------------------------- | ----------------------------------------- |\n| Shareable tool config (ESLint, Prettier, TSConfig, Vitest, …) | `theholocron/holocron` (`configs/`) |\n| HTTP clients and API wrappers | `theholocron/holocron` (`clients/`) |\n| Infrastructure automation, CI orchestration, repo lifecycle | `theholocron/holocron` |\n| Org-level CI workflows, composite actions, community health files | `theholocron/.github` |\n| Internal member docs and private org config | `theholocron/.github-private` (this repo) |\n| Shared agent skills registry | `theholocron/holocron` (`skills/`) |\n\nIf you find yourself copy-pasting a tool config across repos, it belongs in\nthe `configs/` folder of `theholocron/holocron`. If you find yourself writing a new\nautomation command, it belongs in `holocron` too. Generic helpers (`utils/`) and\nobservability (`observability/`) live in that monorepo as well.\n\n### `holocron.config` format\n\n- Repos **with** a `package.json` → `holocron.config.ts` with `defineConfig`\n from `@theholocron/cli`. The CLI must be resolvable at runtime for the TS\n format to work.\n- Repos **without** a `package.json` (e.g. `.github`, `.github-private`) →\n `holocron.config.json`.\n\n## Workflow\n\n- **Always open a PR — never push directly to the default branch.** Even for\n small fixes: create a branch, push it, open a PR. This lets CI run, keeps\n history reviewable, and respects branch protection. The only exception is\n bootstrapping a brand-new repo before protection is set up.\n- **Conventional Commits.** `feat:` / `fix:` / `chore:` / `docs:` / `ci:` /\n `test:` / `refactor:` / `perf:` — semantic-release uses these for versioning\n and changelogs. Repos without a release step use the subset relevant to them.\n- **Always `git commit -s`** (DCO). The `Signed-off-by:` trailer is required\n on every commit. `-s` generates it automatically from `git config user.name`\n and `user.email`.\n- **Always rebase, never merge `main`.** Use `git rebase origin/main` to keep a\n branch current. `git merge main` creates an unsigned merge commit and drags bot\n commits into the PR history — both trigger DCO check failures.\n- **No Claude attribution** in commits, PRs, issues, or docs. No\n `Co-Authored-By` trailer. The author is the user.\n- **One PR = one focused change.** Squash-merge; the PR title becomes the\n squashed commit subject that semantic-release reads.\n- **File issues for non-trivial work** and reference them in commits/PRs\n (`Closes #N` / `Refs #N`). Skip for typo fixes.\n- **Spec process: Issue before spec.** Before writing a spec file, file an issue\n first, in the tracker the config's `issues` provider names (GitHub when the\n config sets no `issues` provider). The issue is the durable tracking artifact.\n The spec's frontmatter `issue:` field must reference it. Order: Issue → Spec →\n PR → Review → merge.\n- **Reference the issue in that tracker's syntax** in commits and the PR: `Closes #N`\n / `Refs #N` for GitHub, the issue key (`Closes ENG-42` / `Refs ENG-42`) for Linear.\n\n## Before starting any coding task\n\n1. Verify you are on a feature branch, not `main`. If on `main`, create a branch\n first. Never commit directly to `main`. If on an existing feature branch, run\n `git fetch origin && git rebase origin/main` to ensure it has the latest from\n `main` — never start work on a stale branch.\n2. Any PR that adds new behavior must include tests and documentation in the same\n PR. Do not open docs-only or test-only follow-up PRs — tests and docs ship with\n the feature. This applies to new packages, capabilities, commands, APIs, and\n any observable behavior change.\n3. If adding a new client or plugin package, update the docs-theme registry in\n the same PR or a cleanly scoped immediate follow-up.\n4. One PR per logical change. Do not bundle unrelated fixes with a feature.\n\n## After completing any coding task\n\n1. Confirm you are still on the intended feature branch.\n2. Confirm all checklist items in any invoked skill are complete.\n3. Confirm CI is green before requesting review.\n\n## Keeping the project board true\n\nThe board's statuses follow the pull request, so an agent only starts the work and marks the pull request ready.\n\n1. **Starting an issue:** `holocron start work <issue>` makes the branch, the first commit and a draft pull request,\n and the open pull request moves the board to In Progress. Only while the automation is down, set it by hand with\n `holocron update work <issue> --status \"In Progress\"` (a hand-set status is temporary).\n2. **Open the pull request as a draft** (`start work` does; otherwise `gh pr create --draft`) as soon as there is\n something to push.\n3. **When the `ci / Required checks` aggregate is green, mark it ready** with `holocron close work <issue> --wait` (it\n waits for the aggregate, marks the pull request ready and never merges; `gh pr ready` does the same by hand). The\n board moves to In Review by itself. After the maintainer merges, run `holocron close work <issue>` again to remove\n the worktree and the local branch.\n4. **Never set In Review, Blocked or Done by hand.** The rules own them; Blocked comes from a blocked-by link, never\n from the status.\n\n## CI workflows\n\nAll reusable workflow implementations and composite actions **live as source in\n`theholocron/holocron` — `packages/astromech/src/templates/reusable/`** and are\ngenerated + pushed to `theholocron/.github` by `holocron sync github`.\n**`theholocron/.github` and `.github-private` are pure sync targets** — never\nhand-edit their `.github/workflows/*`, `.github/actions/*` or\n`workflow-templates/*`; edit the source in `holocron` and merge.\n\nEvery other repo (`configs`, `clients`, `holocron`, `.github-private`) gets\n**thin callers** — lightweight `.github/workflows/` files that delegate to\n`.github` via `uses: theholocron/.github/.github/workflows/<name>.yml@main` and\n`secrets: inherit`. Thin callers are generated from the manifest by\n`astromech.thinCallers()` (`holocron sync` / `holocron setup`).\n\n### Sync\n\nThe `sync-workflow-templates` workflow in `theholocron/holocron` keeps thin\ncallers up to date. It runs automatically on push to `main` when\n`packages/cli/src/templates/**` or `packages/astromech/src/templates/**` change.\nChanges to other parts of the sync machinery (e.g. `sync-github.ts`) require a\nmanual dispatch:\n\n```sh\ngh workflow run sync-workflow-templates.yml --repo theholocron/holocron --ref main\n```\n\n### Per-repo task list\n\nEach secondary repo controls which tasks (and their CI workflows) it\nreceives — and can supply per-task `with:` overrides — via the `tasks`\narray in its `holocron.config.ts` (or `holocron.config.json`).\n`@theholocron/astromech` reads it as the single source for `holocron run`\n/ `holocron run ci` / the generated workflow thin callers:\n\n```typescript\ntasks: [\"lint\", { name: \"release\", with: { \"run-build\": false } }];\n```\n\nOnly add a task if the corresponding capability exists in the repo:\n\n| Task | Requires |\n| ------------- | ------------------------------------------------- |\n| `test` | vitest suite with `--coverage` |\n| `typecheck` | TypeScript (`pnpm typecheck` script) |\n| `audit` | a bundle build step (`pnpm build` script) |\n| `sync-github` | `packages/cli/src/templates/**` — `holocron` only |\n\n### Release workflow — npm prefix and registry-url\n\n**Never run `npm config set prefix <path>` in a release workflow.** It writes\n`prefix=<path>` to `~/.npmrc`, which pnpm reads for npm configuration. With a\nnon-default prefix set, pnpm cannot locate the registry auth it needs to perform\nthe GitHub OIDC token exchange and fails with `ENEEDAUTH` — even when Trusted\nPublishers are correctly configured on npmjs.com.\n\nNode.js from `hostedtoolcache` already provides a user-writable npm prefix on\nPATH. Run `npm install -g <pkg>` directly.\n\n**Never cache `~/.npm-global` or any npm global directory in release workflows.**\nA stale cache restores old auth config that poisons the OIDC exchange.\n\n**Never set `registry-url` in the shared `setup-node` composite action.** It\ncauses `actions/setup-node` to write `//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}`\nto a temp `.npmrc` and set `NPM_CONFIG_USERCONFIG` pointing at it. pnpm then\nreads that file, fails env-var substitution when the token is empty, and loses\nauth entirely.\n\nThe reference implementation is `theholocron/holocron`'s own release workflow —\nno prefix step, no cache, no `registry-url`.\n\n### Discarding a bad sync PR\n\n**Delete the branch, don't only close the PR.** A closed-but-existing branch\nblocks future PR creation — GitHub returns 422 \"A pull request already exists\"\nand the sync silently skips opening a new one.\n\n```sh\ngh pr close <n> --repo <owner>/<repo> --delete-branch\n```\n\n## Code standards\n\n### Package manager\n\n**pnpm only.** Never use `npm` or `yarn`. Run workspace-wide tasks through\nTurbo (`pnpm test`, `pnpm build`, etc.); run single-package tasks with\n`pnpm --filter <name> <script>`.\n\n### TypeScript\n\n**No `any`.** Use `unknown` for values of genuinely unknown shape and narrow\nwith type guards. Use generics instead of `any` in function signatures.\n`as never` and `as unknown as T` are acceptable for internal casts where the\ntype system can't follow; `any` is not.\n\n### Node.js version\n\n`engines.node` must be set in every `package.json`. To update the Node.js\nversion across a repo run `holocron upgrade node <to>` from any repo that has\nthe CLI installed — it patches `engines.node`, `@types/node`, `.nvmrc`,\n`.node-version`, and `.github/workflows/*.yml` automatically.\n\n### Inclusive language (`alex`)\n\n`holocron setup` no longer writes `.alexrc.json` or `.alexignore` (#831). The\ncheck is Sentinel's `lint:language / Run alex`, which reads the org's own\nallow-list, `alexrc.json` in `theholocron/holocron · cli/astromech/src/lint/alex-config/`\n(`ALEX_CONFIG`). To allow a new term across all repos: edit that file, open a PR\nin `holocron`, merge; Sentinel uses it after its next deploy. A repo that still\nhas the two files from an earlier setup can delete them; nothing reads them.\n\n### Running `holocron setup`\n\nInstall `@theholocron/cli` and `@theholocron/holocron-plugin-github` under\n`catalogs.holocron` in `pnpm-workspace.yaml`:\n\n```yaml\ncatalogs:\n holocron:\n \"@theholocron/cli\": <version>\n \"@theholocron/holocron-plugin-github\": <version>\n```\n\nThen run:\n\n```sh\nGITHUB_TOKEN=$(gh auth token) \\\nHOLOCRON_ORG_TOKEN=$(security find-generic-password -s \"com.theholocron.cli\" -a \"github.org\" -w) \\\npnpm exec holocron setup --token $(security find-generic-password -s \"com.theholocron.cli\" -a \"github.admin\" -w)\n```\n\nAll tokens are stored in the macOS keychain under service `com.theholocron.cli`. See `docs/tokens.md` in the `holocron` repo for the full token matrix and required scopes.\n\nBump both catalog entries together when upgrading — they publish in lockstep.\n\n### README structure\n\nEvery repo README follows this layout. Use `holocron sync readme` to regenerate the Installation + Usage block automatically.\n\n```markdown\n# Package Name\n\n<!-- holocron:description -->\n\nOne-line description (synced from holocron.config.ts description field).\n<!-- /holocron:description -->\n\n<!-- holocron:installation -->\n\n## Installation\n\n...generated from package.json bin / exports...\n\n## Usage\n\n...generated from package.json bin / exports...\n<!-- /holocron:installation -->\n\n## What's Included ← template repos only; omit for libraries\n\n...feature table...\n\n## Development\n\npnpm scripts table or code block\n\n## Releases\n\nAutomated via semantic-release. Link to CHANGELOG.md.\n\n## Documentation\n\nLink to docs site.\n```\n\n**Rules:**\n\n- Never write \"Getting Started\" — use separate \"Installation\" and \"Usage\" headings.\n- The `<!-- holocron:description -->` and `<!-- holocron:installation -->` marker blocks must stay in sync with the config/package; run `holocron sync readme` after changing `description` in `holocron.config.ts` or `bin` in `package.json`.\n- The \"What's Included\" section belongs only in template repos (cli-template, node-template, react-template, etc.) where it describes what the template ships. Library and app repos omit it.\n\n---\n\n## This repo (`.github-private`)\n\n> **Local path:** `~/Code/theholocron/github-private/`\n> **GitHub repo:** `theholocron/.github-private`\n\nInternal member documentation and private org-level configuration for the\n`theholocron` org. Content here is only visible to org members.\n\nConventional Commit types used here: `docs:` for content changes, `ci:` for\nworkflow changes, `chore:` for maintenance.\n\nNo test suite (documentation repo). `pnpm lint` runs `yamllint` on workflow\nfiles. Branch protection on `main` requires DCO and passing CI checks.\n";
23642
+ var org_default = "<!-- editorconfig-checker-disable-file -->\n\n# theholocron — agent operating contract\n\nOrg-level agent conventions for all `theholocron` repositories. The canonical\ncopy is `.holocron/org.md` in `theholocron/holocron`. `holocron sync` writes\nit into each repo's `AGENTS.md` between generated markers, so no repo needs a\nsibling checkout to read it; holocron itself imports it with `@.holocron/org.md`.\nEdit it in holocron, then run `holocron sync`.\n\n## Repo map\n\nEach concern lives in exactly one repo:\n\n| Concern | Repo |\n| ----------------------------------------------------------------- | ----------------------------------------- |\n| Shareable tool config (ESLint, Prettier, TSConfig, Vitest, …) | `theholocron/holocron` (`configs/`) |\n| HTTP clients and API wrappers | `theholocron/holocron` (`clients/`) |\n| Infrastructure automation, CI orchestration, repo lifecycle | `theholocron/holocron` |\n| Org-level CI workflows, composite actions, community health files | `theholocron/.github` |\n| Internal member docs and private org config | `theholocron/.github-private` (this repo) |\n| Shared agent skills registry | `theholocron/holocron` (`skills/`) |\n\nIf you find yourself copy-pasting a tool config across repos, it belongs in\nthe `configs/` folder of `theholocron/holocron`. If you find yourself writing a new\nautomation command, it belongs in `holocron` too. Generic helpers (`utils/`) and\nobservability (`observability/`) live in that monorepo as well.\n\n### `holocron.config` format\n\n- Repos **with** a `package.json` → `holocron.config.ts` with `defineConfig`\n from `@theholocron/cli`. The CLI must be resolvable at runtime for the TS\n format to work.\n- Repos **without** a `package.json` (e.g. `.github`, `.github-private`) →\n `holocron.config.json`.\n\n## Workflow\n\n- **Always open a PR — never push directly to the default branch.** Even for\n small fixes: create a branch, push it, open a PR. This lets CI run, keeps\n history reviewable, and respects branch protection. The only exception is\n bootstrapping a brand-new repo before protection is set up.\n- **Conventional Commits.** `feat:` / `fix:` / `chore:` / `docs:` / `ci:` /\n `test:` / `refactor:` / `perf:` — semantic-release uses these for versioning\n and changelogs. Repos without a release step use the subset relevant to them.\n- **Always `git commit -s`** (DCO). The `Signed-off-by:` trailer is required\n on every commit. `-s` generates it automatically from `git config user.name`\n and `user.email`.\n- **Always rebase, never merge `main`.** Use `git rebase origin/main` to keep a\n branch current. `git merge main` creates an unsigned merge commit and drags bot\n commits into the PR history — both trigger DCO check failures.\n- **No Claude attribution** in commits, PRs, issues, or docs. No\n `Co-Authored-By` trailer. The author is the user.\n- **One PR = one focused change.** Squash-merge; the PR title becomes the\n squashed commit subject that semantic-release reads.\n- **File issues for non-trivial work** and reference them in commits/PRs\n (`Closes #N` / `Refs #N`). Skip for typo fixes.\n- **Spec process: Issue before spec.** Before writing a spec file, file an issue\n first, in the tracker the config's `issues` provider names (GitHub when the\n config sets no `issues` provider). The issue is the durable tracking artifact.\n The spec's frontmatter `issue:` field must reference it. Order: Issue → Spec →\n PR → Review → merge.\n- **Reference the issue in that tracker's syntax** in commits and the PR: `Closes #N`\n / `Refs #N` for GitHub, the issue key (`Closes ENG-42` / `Refs ENG-42`) for Linear.\n\n## Before starting any coding task\n\n1. Verify you are on a feature branch, not `main`. If on `main`, create a branch\n first. Never commit directly to `main`. If on an existing feature branch, run\n `git fetch origin && git rebase origin/main` to ensure it has the latest from\n `main` — never start work on a stale branch.\n2. Any PR that adds new behavior must include tests and documentation in the same\n PR. Do not open docs-only or test-only follow-up PRs — tests and docs ship with\n the feature. This applies to new packages, capabilities, commands, APIs, and\n any observable behavior change.\n3. If adding a new client or plugin package, update the docs-theme registry in\n the same PR or a cleanly scoped immediate follow-up.\n4. One PR per logical change. Do not bundle unrelated fixes with a feature.\n\n## After completing any coding task\n\n1. Confirm you are still on the intended feature branch.\n2. Confirm all checklist items in any invoked skill are complete.\n3. Confirm CI is green before requesting review.\n\n## Keeping the project board true\n\nThe board's statuses follow the pull request, so an agent only starts the work and marks the pull request ready.\n\n1. **Starting an issue:** `holocron start work <issue>` makes the branch, the first commit and a draft pull request,\n and the open pull request moves the board to In Progress. Only while the automation is down, set it by hand with\n `holocron update work <issue> --status \"In Progress\"` (a hand-set status is temporary).\n2. **Open the pull request as a draft** (`start work` does; otherwise `gh pr create --draft`) as soon as there is\n something to push.\n3. **When the required checks are green, mark it ready** with `holocron close work <issue> --wait` (it\n waits for the required checks, marks the pull request ready and never merges; `gh pr ready` does the same by hand). The\n board moves to In Review by itself. After the maintainer merges, run `holocron close work <issue>` again to remove\n the worktree and the local branch.\n4. **Never set In Review, Blocked or Done by hand.** The rules own them; Blocked comes from a blocked-by link, never\n from the status.\n\n## CI workflows\n\nAll reusable workflow implementations and composite actions **live as source in\n`theholocron/holocron` — `packages/astromech/src/templates/reusable/`** and are\ngenerated + pushed to `theholocron/.github` by `holocron sync github`.\n**`theholocron/.github` and `.github-private` are pure sync targets** — never\nhand-edit their `.github/workflows/*`, `.github/actions/*` or\n`workflow-templates/*`; edit the source in `holocron` and merge.\n\nEvery other repo (`configs`, `clients`, `holocron`, `.github-private`) gets\n**thin callers** — lightweight `.github/workflows/` files that delegate to\n`.github` via `uses: theholocron/.github/.github/workflows/<name>.yml@main` and\n`secrets: inherit`. Thin callers are generated from the manifest by\n`astromech.thinCallers()` (`holocron sync` / `holocron setup`).\n\n### Sync\n\nThe `sync-workflow-templates` workflow in `theholocron/holocron` keeps thin\ncallers up to date. It runs automatically on push to `main` when\n`packages/cli/src/templates/**` or `packages/astromech/src/templates/**` change.\nChanges to other parts of the sync machinery (e.g. `sync-github.ts`) require a\nmanual dispatch:\n\n```sh\ngh workflow run sync-workflow-templates.yml --repo theholocron/holocron --ref main\n```\n\n### Per-repo task list\n\nEach secondary repo controls which tasks (and their CI workflows) it\nreceives — and can supply per-task `with:` overrides — via the `tasks`\narray in its `holocron.config.ts` (or `holocron.config.json`).\n`@theholocron/astromech` reads it as the single source for `holocron run`\n/ `holocron run ci` / the generated workflow thin callers:\n\n```typescript\ntasks: [\"lint\", { name: \"release\", with: { \"run-build\": false } }];\n```\n\nOnly add a task if the corresponding capability exists in the repo:\n\n| Task | Requires |\n| ------------- | ------------------------------------------------- |\n| `test` | vitest suite with `--coverage` |\n| `typecheck` | TypeScript (`pnpm typecheck` script) |\n| `audit` | a bundle build step (`pnpm build` script) |\n| `sync-github` | `packages/cli/src/templates/**` — `holocron` only |\n\n### Release workflow — npm prefix and registry-url\n\n**Never run `npm config set prefix <path>` in a release workflow.** It writes\n`prefix=<path>` to `~/.npmrc`, which pnpm reads for npm configuration. With a\nnon-default prefix set, pnpm cannot locate the registry auth it needs to perform\nthe GitHub OIDC token exchange and fails with `ENEEDAUTH` — even when Trusted\nPublishers are correctly configured on npmjs.com.\n\nNode.js from `hostedtoolcache` already provides a user-writable npm prefix on\nPATH. Run `npm install -g <pkg>` directly.\n\n**Never cache `~/.npm-global` or any npm global directory in release workflows.**\nA stale cache restores old auth config that poisons the OIDC exchange.\n\n**Never set `registry-url` in the shared `setup-node` composite action.** It\ncauses `actions/setup-node` to write `//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}`\nto a temp `.npmrc` and set `NPM_CONFIG_USERCONFIG` pointing at it. pnpm then\nreads that file, fails env-var substitution when the token is empty, and loses\nauth entirely.\n\nThe reference implementation is `theholocron/holocron`'s own release workflow —\nno prefix step, no cache, no `registry-url`.\n\n### Discarding a bad sync PR\n\n**Delete the branch, don't only close the PR.** A closed-but-existing branch\nblocks future PR creation — GitHub returns 422 \"A pull request already exists\"\nand the sync silently skips opening a new one.\n\n```sh\ngh pr close <n> --repo <owner>/<repo> --delete-branch\n```\n\n## Code standards\n\n### Package manager\n\n**pnpm only.** Never use `npm` or `yarn`. Run workspace-wide tasks through\nTurbo (`pnpm test`, `pnpm build`, etc.); run single-package tasks with\n`pnpm --filter <name> <script>`.\n\n### TypeScript\n\n**No `any`.** Use `unknown` for values of genuinely unknown shape and narrow\nwith type guards. Use generics instead of `any` in function signatures.\n`as never` and `as unknown as T` are acceptable for internal casts where the\ntype system can't follow; `any` is not.\n\n### Node.js version\n\n`engines.node` must be set in every `package.json`. To update the Node.js\nversion across a repo run `holocron upgrade node <to>` from any repo that has\nthe CLI installed — it patches `engines.node`, `@types/node`, `.nvmrc`,\n`.node-version`, and `.github/workflows/*.yml` automatically.\n\n### Inclusive language (`alex`)\n\n`holocron setup` no longer writes `.alexrc.json` or `.alexignore` (#831). The\ncheck is Sentinel's `lint:language / Run alex`, which reads the org's own\nallow-list, `alexrc.json` in `theholocron/holocron · cli/astromech/src/lint/alex-config/`\n(`ALEX_CONFIG`). To allow a new term across all repos: edit that file, open a PR\nin `holocron`, merge; Sentinel uses it after its next deploy. A repo that still\nhas the two files from an earlier setup can delete them; nothing reads them.\n\n### Running `holocron setup`\n\nInstall `@theholocron/cli` and `@theholocron/holocron-plugin-github` under\n`catalogs.holocron` in `pnpm-workspace.yaml`:\n\n```yaml\ncatalogs:\n holocron:\n \"@theholocron/cli\": <version>\n \"@theholocron/holocron-plugin-github\": <version>\n```\n\nThen run:\n\n```sh\nGITHUB_TOKEN=$(gh auth token) \\\nHOLOCRON_ORG_TOKEN=$(security find-generic-password -s \"com.theholocron.cli\" -a \"github.org\" -w) \\\npnpm exec holocron setup --token $(security find-generic-password -s \"com.theholocron.cli\" -a \"github.admin\" -w)\n```\n\nAll tokens are stored in the macOS keychain under service `com.theholocron.cli`. See `docs/tokens.md` in the `holocron` repo for the full token matrix and required scopes.\n\nBump both catalog entries together when upgrading — they publish in lockstep.\n\n### README structure\n\nEvery repo README follows this layout. Use `holocron sync readme` to regenerate the Installation + Usage block automatically.\n\n```markdown\n# Package Name\n\n<!-- holocron:description -->\n\nOne-line description (synced from holocron.config.ts description field).\n<!-- /holocron:description -->\n\n<!-- holocron:installation -->\n\n## Installation\n\n...generated from package.json bin / exports...\n\n## Usage\n\n...generated from package.json bin / exports...\n<!-- /holocron:installation -->\n\n## What's Included ← template repos only; omit for libraries\n\n...feature table...\n\n## Development\n\npnpm scripts table or code block\n\n## Releases\n\nAutomated via semantic-release. Link to CHANGELOG.md.\n\n## Documentation\n\nLink to docs site.\n```\n\n**Rules:**\n\n- Never write \"Getting Started\" — use separate \"Installation\" and \"Usage\" headings.\n- The `<!-- holocron:description -->` and `<!-- holocron:installation -->` marker blocks must stay in sync with the config/package; run `holocron sync readme` after changing `description` in `holocron.config.ts` or `bin` in `package.json`.\n- The \"What's Included\" section belongs only in template repos (cli-template, node-template, react-template, etc.) where it describes what the template ships. Library and app repos omit it.\n\n---\n\n## This repo (`.github-private`)\n\n> **Local path:** `~/Code/theholocron/github-private/`\n> **GitHub repo:** `theholocron/.github-private`\n\nInternal member documentation and private org-level configuration for the\n`theholocron` org. Content here is only visible to org members.\n\nConventional Commit types used here: `docs:` for content changes, `ci:` for\nworkflow changes, `chore:` for maintenance.\n\nNo test suite (documentation repo). `pnpm lint` runs `yamllint` on workflow\nfiles. Branch protection on `main` requires DCO and passing CI checks.\n";
23476
23643
  // src/commands/repo-files/generate-agent-files.ts
23477
23644
  const ORG_BLOCK_BEGIN = "<!-- BEGIN holocron org agent instructions (generated by `holocron sync` from theholocron/holocron .agents/org.md; do not edit) -->";
23478
23645
  const ORG_BLOCK_END = "<!-- END holocron org agent instructions -->";
@@ -37159,7 +37326,7 @@ function planReconcile(items, template) {
37159
37326
  * `holocron reconcile project [board]` — set the status of board items where a rule says so (spec `command-project`,
37160
37327
  * "Keeping a board true"): an open item with an open blocker goes to the `blocked` status, an open blocked one with no
37161
37328
  * blocker returns to `planned`, a closed or merged one goes to `done`; then `planPullRequestStatus()` puts an open item with
37162
- * an open linked pull request in `active` and one whose aggregate check is green in `review` (#2388). Status only, never
37329
+ * an open linked pull request in `active` and one whose required checks are green in `review` (#2388, #2756: with no `ci / Required checks` aggregate the list is the ruleset's, else the config's). Status only, never
37163
37330
  * priority or any other field.
37164
37331
  *
37165
37332
  * The rules are `planReconcile()`, pure; this reads the items through the `projects` capability, applies each change
@@ -37225,6 +37392,16 @@ async function runProjectReconcile(input) {
37225
37392
  if (boards.length === 0) return refuse("`providers.projects` declares no boards — add `boards: [{ template, name }]`");
37226
37393
  const wanted = input.board === void 0 ? boards : boards.filter((b) => b.name === input.board);
37227
37394
  if (wanted.length === 0) return refuse(`no declared board is named "${input.board}" (declared: ${boards.map((b) => b.name).join(", ")})`);
37395
+ let required;
37396
+ if (aggregatePoster({ ci: input.loaded.resolved.ci }) === "none") {
37397
+ const resolvedChecks = await resolveRequiredChecks({
37398
+ source: loader.has("source") ? loader.get("source") : {},
37399
+ config: input.loaded.resolved
37400
+ });
37401
+ required = resolvedChecks.required;
37402
+ const list = [...required.expected, ...required.statuses].join(", ");
37403
+ print(` ${style.skip(resolvedChecks.from === "ruleset" ? `required checks, from the live ruleset: ${list}` : `required checks, from the config (${resolvedChecks.why}): ${list}`)}`);
37404
+ }
37228
37405
  const loadedTemplates = await loadTemplates(join(input.context.repoRoot, templatesDir), input.templatesIo ?? createFsTemplatesIo(input.context.repoRoot));
37229
37406
  for (const problem of loadedTemplates.problems) print(` ${style.warn(problem)}`);
37230
37407
  let ok = 0;
@@ -37245,7 +37422,7 @@ async function runProjectReconcile(input) {
37245
37422
  failStep(declared.name, "the board does not exist or is closed; run `holocron setup project`");
37246
37423
  continue;
37247
37424
  }
37248
- const items = await projects.items(owner, board, template);
37425
+ const items = required ? await projects.items(owner, board, template, required) : await projects.items(owner, board, template);
37249
37426
  plan = planReconcile(items, template);
37250
37427
  for (const item of items) {
37251
37428
  if (item.pullRequestsProblem === void 0) continue;
@@ -42332,6 +42509,9 @@ const updateCheckPromise = checkForUpdates({
42332
42509
  }
42333
42510
  });
42334
42511
  let finishCommand = () => {};
42512
+ /** What ran, for the offer to run it for real after a `--dry-run` of it. */
42513
+ let ranWords = [];
42514
+ let ranDryRun = false;
42335
42515
  /** Set by `.fail()` once it has printed an error, so the outer catch doesn't repeat it. */
42336
42516
  let errorReported = false;
42337
42517
  try {
@@ -42365,6 +42545,8 @@ try {
42365
42545
  }).middleware((argv) => {
42366
42546
  const name = argv._.slice(0, 3).join(" ") || "unknown";
42367
42547
  printRunId = Boolean(argv.debug || argv.verbose);
42548
+ ranWords = argv._.map(String);
42549
+ ranDryRun = argv.dryRun === true;
42368
42550
  buildCliLogger(argv, {
42369
42551
  command: name,
42370
42552
  org: argv.org
@@ -42391,6 +42573,22 @@ try {
42391
42573
  }
42392
42574
  finishCommand(!process.exitCode);
42393
42575
  endSession();
42576
+ const offered = await offerRealRun({
42577
+ words: ranWords,
42578
+ args: process.argv.slice(2),
42579
+ dryRun: ranDryRun,
42580
+ exitCode: Number(process.exitCode ?? 0),
42581
+ interactive: Boolean(process.stdin.isTTY && process.stdout.isTTY),
42582
+ ci: isCI(),
42583
+ preview: Boolean(env.get(dryRunPreviewEnvVar(PREFIX$1))),
42584
+ supportsDryRun: (words) => commandSupportsDryRun(words, COMMAND_REGISTRY),
42585
+ confirm: (message) => confirm({
42586
+ message,
42587
+ default: false
42588
+ }),
42589
+ spawn: (args) => spawnChild(args)
42590
+ });
42591
+ if (offered !== void 0) process.exitCode = offered;
42394
42592
  const rid = getRunId();
42395
42593
  if (printRunId && rid) console.log(`Run ID: ${rid}`);
42396
42594
  (await updateCheckPromise)?.();