@theholocron/cli 5.0.0-alpha.486 โ†’ 5.0.0-alpha.487

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
@@ -665,7 +665,7 @@ commands and the config are provider-neutral; Discord is the first provider.
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 |
668
- | `holocron doctor releases` | Did npm receive every release tag? One row per release line (each `release` task group, tags `<group>-v<version>`, and the repo-wide `v<version>`) and channel (`latest`, or a prerelease's first identifier such as `alpha`): the newest tag against what each package serves on that dist-tag. A package behind, or not on npm, fails the row, which names the tag and the `refs/notes/semantic-release-<tag>` note to delete and the two known causes (a sigstore 409, `ENEEDAUTH` fixed by `holocron publish package --sync-trust`). A tag under 30 minutes old is a skip. Reads git tags and npm's public registry; no provider or token. Read-only |
668
+ | `holocron doctor releases` | Did npm receive every release tag? One row per release line (each `release` task group, tags `<group>-v<version>`, and the repo-wide `v<version>`) and channel (`latest`, or a prerelease's first identifier such as `alpha`): the newest tag against what each package serves on that dist-tag. A package behind, or not on npm, fails the row, which names the tag and the `refs/notes/semantic-release-<tag>` note to delete and the two known causes (a sigstore 409, `ENEEDAUTH` fixed by `holocron publish package --sync-trust`). `publish package --skip-already-published` retries a sigstore 409 twice, publishes the rest of the group anyway and ends with every failure listed (and in the job summary), so a package left behind is the case to look for here. A tag under 30 minutes old is a skip. Reads git tags and npm's public registry; no provider or token. Read-only |
669
669
  | `holocron doctor logs` | Does each Axiom dataset the setup ships logs to exist, and does the token reach it? Rows: `token is accepted` (a 401 fails), one `dataset for <service>` for the CLI (`HOLOCRON_AXIOM_DATASET`, resolved by the logger's own chain), Sentinel (`SENTINEL_AXIOM_DATASET`) and any other `dev.serve.logging.datasetVar` (a 404 fails and names the fix), `organization` (`HOLOCRON_AXIOM_ORG`, then `AXIOM_ORG`), and an `info` row per dataset with the `retentionDays` Axiom reports (or says it reported none). Reads through the optional `Logs.readDataset` / `Logs.checkToken`; never creates a dataset or prints a token. A name or token that cannot be read is a skip. Read-only |
670
670
  | `holocron doctor wiki` | Does the wiki the config declares exist, and does it match the sources? Rows: `organization is set` (`fern/fern.config.json` against the declared `fernOrg`), `docs site is declared` (the `instances:` url and `custom-domain` of `fern/docs.yml`), `docs site answers` and `custom domain answers` (one unauthenticated GET each: a 404 or 5xx fails, a 401/403 passes as restricted, no answer is a skip), `navigation pages exist` (every `path:` of the navigation is on disk), an `info` row for pages under `docs/wiki` the navigation leaves out, and `published pages` (the site's sitemap lists at least as many pages as the navigation; fewer fails and names the wiki workflow). Reads through the optional `Wiki.inspect()`; never publishes, writes or sends a token. A provider that cannot inspect, or a site that cannot be reached, is a skip. Read-only |
671
671
  | `holocron doctor errors` | Does the error tracker have the organization, projects, keys and alert rules the config relies on? Rows: `organization exists`, and for each project a notifications layout's `relay.errors.projects` declares, `project <slug> exists` (a 404 fails), `project <slug> has a key` (a client key, so an SDK has a DSN; none fails) and `project <slug> has an alert rule` (at least one enabled rule watches its issues; none fails). The Comlink relay's integration and rule stay in `doctor notifications`. Reads through the optional `Errors.inspect()` and returns counts only, never a DSN or key. A missing token or `org`, or alert rules the token cannot read, is a skip. Read-only |
package/dist/cli.mjs CHANGED
@@ -26998,6 +26998,101 @@ async function runPublish(input = {}) {
26998
26998
  packageNames
26999
26999
  };
27000
27000
  }
27001
+ // src/commands/publish/publish-failures/publish-failures.ts
27002
+ /** The command that publishes what is still missing for the version the checkout is on. */
27003
+ const REPUBLISH_COMMAND = "holocron publish package --skip-already-published";
27004
+ function advice(failures) {
27005
+ const out = [];
27006
+ if (failures.some((f) => f.kind === "tlog-conflict")) out.push("A sigstore 409 that survives retries means the tarball is identical to one already in the transparency log (an earlier publish of the same bytes). Retrying cannot fix it: change the package's contents and release again.");
27007
+ if (failures.some((f) => f.kind === "failed")) out.push(`For any other failure, fix the cause and run \`${REPUBLISH_COMMAND}\` (add \`--group <folder>\` for a version group) at the tag it happened on; it publishes only what npm lacks. \`holocron doctor releases\` names a tag npm never received.`);
27008
+ return out;
27009
+ }
27010
+ /** Plain lines printed at the end of a run that left packages unpublished, all failures together. */
27011
+ function formatPublishFailures(failures) {
27012
+ const lines = [` โœ— ${failures.length} package(s) not published:`];
27013
+ for (const f of failures) lines.push(f.kind === "tlog-conflict" ? ` - ${f.name}@${f.version}: sigstore 409, identical tarball already in the transparency log` : ` - ${f.message}`);
27014
+ for (const line of advice(failures)) lines.push(` โ†’ ${line}`);
27015
+ return lines;
27016
+ }
27017
+ /** The same report as Markdown for the job summary. */
27018
+ function publishFailuresMarkdown(failures) {
27019
+ return [
27020
+ "## Packages not published",
27021
+ "",
27022
+ "| Package | Reason |",
27023
+ "| --- | --- |",
27024
+ ...failures.map((f) => `| \`${f.name}@${f.version}\` | ${f.kind === "tlog-conflict" ? "sigstore 409 (identical tarball already logged)" : "failed"} |`),
27025
+ "",
27026
+ ...advice(failures).flatMap((a) => [a, ""])
27027
+ ].join("\n").trimEnd();
27028
+ }
27029
+ // src/commands/publish/is-tlog-conflict.ts
27030
+ /**
27031
+ * Whether a failed `pnpm publish` was npm's sigstore step answering 409
27032
+ * (`TLOG_CREATE_ENTRY_ERROR`, "an equivalent entry already exists in the
27033
+ * transparency log"): the only failure class `publish package` retries (#1387).
27034
+ * A bare registry `E409` (the version already exists) is not this class; the
27035
+ * view check after every failure settles that one.
27036
+ */
27037
+ function isTlogConflict(output) {
27038
+ return /TLOG_CREATE_ENTRY_ERROR|equivalent entry already exists in the transparency log/i.test(output);
27039
+ }
27040
+ // src/commands/publish/publish-one-package/publish-one-package.ts
27041
+ /** Default waits before the two retries of a sigstore 409. */
27042
+ const DEFAULT_BACKOFF_MS = [5e3, 15e3];
27043
+ const defaultSleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
27044
+ /**
27045
+ * Publishes one package and settles what a failure means (#1387). After every failed call it asks the registry
27046
+ * (`npm view <name>@<version>`): a version that is there counts as published (another run made it). Only a sigstore 409
27047
+ * (`TLOG_CREATE_ENTRY_ERROR`) is tried again, after a short backoff; any other failure ends the package at once. A 409
27048
+ * that survives every retry is reported as `tlog-conflict`: the same bytes are already in the transparency log, which a
27049
+ * retry cannot change.
27050
+ */
27051
+ async function publishOnePackage(input) {
27052
+ const { entry, exec, cwd, print } = input;
27053
+ const sleep = input.sleep ?? defaultSleep;
27054
+ const backoff = input.backoffMs ?? DEFAULT_BACKOFF_MS;
27055
+ const label = `${entry.name}@${entry.version}`;
27056
+ for (let attempt = 0;; attempt += 1) {
27057
+ const publish = await exec("pnpm", [...input.publishArgs], { cwd });
27058
+ if (publish.exitCode === 0) return { outcome: "published" };
27059
+ const view = await exec("npm", [
27060
+ "view",
27061
+ label,
27062
+ "version"
27063
+ ], { cwd });
27064
+ if (view.exitCode === 0 && view.stdout.trim()) return { outcome: "concurrent" };
27065
+ const output = `${publish.stderr}\n${publish.stdout}`;
27066
+ const message = `publish failed for ${label} (exit ${publish.exitCode}): ${publish.stderr.trim() || publish.stdout.trim() || "no output"}`;
27067
+ if (!isTlogConflict(output)) return {
27068
+ outcome: "failed",
27069
+ message
27070
+ };
27071
+ const wait = backoff[attempt];
27072
+ if (wait === void 0) return {
27073
+ outcome: "tlog-conflict",
27074
+ message
27075
+ };
27076
+ print(` โ€ฆ ${label} hit a sigstore 409; retrying in ${wait / 1e3}s (${attempt + 1} of ${backoff.length})`);
27077
+ await sleep(wait);
27078
+ }
27079
+ }
27080
+ // src/commands/publish/write-job-summary/write-job-summary.ts
27081
+ /**
27082
+ * Appends Markdown to the file GitHub Actions names in `GITHUB_STEP_SUMMARY`, so the job's page says what happened.
27083
+ * Does nothing outside Actions (the variable is unset) and never throws: a summary that cannot be written must not
27084
+ * fail a publish. Returns whether the text was written.
27085
+ */
27086
+ function writeJobSummary(markdown, env = createEnvLookup(), append = appendFileSync) {
27087
+ const file = env.get("GITHUB_STEP_SUMMARY");
27088
+ if (file === void 0) return false;
27089
+ try {
27090
+ append(file, `${markdown}\n`);
27091
+ return true;
27092
+ } catch {
27093
+ return false;
27094
+ }
27095
+ }
27001
27096
  // src/commands/publish/run-steady-publish/run-steady-publish.ts
27002
27097
  /**
27003
27098
  * `holocron publish package` (no `--initial`) โ€” the steady-state publish
@@ -27086,6 +27181,7 @@ async function runSteadyPublish(input = {}) {
27086
27181
  }
27087
27182
  if (skipAlreadyPublished) {
27088
27183
  print(" โ†’ publishing packages not already on npmโ€ฆ");
27184
+ const failures = [];
27089
27185
  for (const entry of entries) {
27090
27186
  const view = await exec("npm", [
27091
27187
  "view",
@@ -27096,37 +27192,46 @@ async function runSteadyPublish(input = {}) {
27096
27192
  print(` skip ${entry.name}@${entry.version} (already published)`);
27097
27193
  continue;
27098
27194
  }
27099
- const publish = await exec("pnpm", [
27100
- "--filter",
27101
- entry.dir,
27102
- "publish",
27103
- ...baseFlags,
27104
- ...otpFlags
27105
- ], { cwd });
27106
- if (publish.exitCode !== 0) {
27107
- const recheck = await exec("npm", [
27108
- "view",
27109
- `${entry.name}@${entry.version}`,
27110
- "version"
27111
- ], { cwd });
27112
- if (recheck.exitCode === 0 && recheck.stdout.trim()) {
27113
- print(` skip ${entry.name}@${entry.version} (published concurrently by another run)`);
27114
- continue;
27115
- }
27116
- const message = `publish failed for ${entry.name}@${entry.version} (exit ${publish.exitCode}): ${publish.stderr.trim() || publish.stdout.trim() || "no output"}`;
27117
- print(` โœ— ${message}`);
27118
- logger.warn({
27119
- tag,
27120
- package: entry.name,
27121
- reason: message
27122
- }, "publish: done");
27123
- return {
27124
- status: "fail",
27125
- message,
27126
- packageNames
27127
- };
27128
- }
27129
- print(` โœ“ ${entry.name}@${entry.version}`);
27195
+ const result = await publishOnePackage({
27196
+ entry,
27197
+ publishArgs: [
27198
+ "--filter",
27199
+ entry.dir,
27200
+ "publish",
27201
+ ...baseFlags,
27202
+ ...otpFlags
27203
+ ],
27204
+ cwd,
27205
+ exec,
27206
+ print,
27207
+ ...input.sleep ? { sleep: input.sleep } : {},
27208
+ ...input.backoffMs ? { backoffMs: input.backoffMs } : {}
27209
+ });
27210
+ if ("message" in result) {
27211
+ print(` โœ— ${result.message}`);
27212
+ failures.push({
27213
+ name: entry.name,
27214
+ version: entry.version,
27215
+ kind: result.outcome,
27216
+ message: result.message
27217
+ });
27218
+ } else if (result.outcome === "concurrent") print(` skip ${entry.name}@${entry.version} (published concurrently by another run)`);
27219
+ else print(` โœ“ ${entry.name}@${entry.version}`);
27220
+ }
27221
+ if (failures.length > 0) {
27222
+ for (const line of formatPublishFailures(failures)) print(line);
27223
+ writeJobSummary(publishFailuresMarkdown(failures), input.envLookup);
27224
+ const message = `${failures.length} of ${entries.length} package(s) not published: ${failures.map((f) => `${f.name}@${f.version}`).join(", ")}`;
27225
+ logger.warn({
27226
+ tag,
27227
+ failed: failures.map((f) => f.name),
27228
+ reason: message
27229
+ }, "publish: done");
27230
+ return {
27231
+ status: "fail",
27232
+ message,
27233
+ packageNames
27234
+ };
27130
27235
  }
27131
27236
  logger.info({
27132
27237
  tag,