@theholocron/astromech 5.0.0-alpha.254 → 5.0.0-alpha.256
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
|
@@ -73,7 +73,7 @@ documents, not a naming convention repos need to follow.
|
|
|
73
73
|
| `platform.notifyCheck` | _(none — manual workflow)_ | posts a labelled test message to every notification channel; fails per channel that does not work |
|
|
74
74
|
| `platform.repoSync` | `holocron repo sync` | keeps generated files current |
|
|
75
75
|
| `platform.commitStandards` | commitlint | no local equivalent — enforced by the `commit-msg` hook locally, over the PR's commit range in CI |
|
|
76
|
-
| `platform.repoValidation` | `scripts/validate-adrs.mjs`, `scripts/validate-
|
|
76
|
+
| `platform.repoValidation` | `scripts/validate-adrs.mjs`, `scripts/validate-docs-presence.mjs` | a job-bearing task — spec/ADR frontmatter and docs-presence, not linters |
|
|
77
77
|
| `knowledge.wiki` | Fern | publishes `docs/wiki/*.md` — not a sync, a publish; carries `preview` |
|
|
78
78
|
| `knowledge.docs` | Astro build | the docs site itself; carries `preview` (defaults on) |
|
|
79
79
|
| `knowledge.components` | Storybook build | a browsable component catalog — "Storybook" is the tool, not the intent; carries `preview` (defaults on) |
|
package/dist/config/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as TaskEntry, r as TasksConfig, t as TaskConfigItem } from "../schema.type-
|
|
1
|
+
import { n as TaskEntry, r as TasksConfig, t as TaskConfigItem } from "../schema.type-C-3fZESa.mjs";
|
|
2
2
|
import { Loaded } from "@theholocron/datapad";
|
|
3
3
|
/**
|
|
4
4
|
* The `tasks` config shape — the single manifest of what a repo runs.
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as TasksConfig } from "./schema.type-
|
|
1
|
+
import { r as TasksConfig } from "./schema.type-C-3fZESa.mjs";
|
|
2
2
|
import { ListWorkspacePackagesOptions, WorkspacePackageEntry } from "@theholocron/pkg-utils";
|
|
3
3
|
interface WorkspacePackage$1 {
|
|
4
4
|
slug: string;
|
|
@@ -211,8 +211,13 @@ interface RunLogger {
|
|
|
211
211
|
debug(obj: Record<string, unknown>, msg?: string): void;
|
|
212
212
|
warn(obj: Record<string, unknown>, msg?: string): void;
|
|
213
213
|
}
|
|
214
|
+
/**
|
|
215
|
+
* Runs `cmd` and reports its exit code. `opts.env` is added to the child's
|
|
216
|
+
* environment (on top of the parent's), e.g. `TURBO_SCM_BASE` for `--affected`.
|
|
217
|
+
*/
|
|
214
218
|
type ExecFn = (cmd: string, args: string[], opts: {
|
|
215
219
|
cwd: string;
|
|
220
|
+
env?: Record<string, string>;
|
|
216
221
|
}) => {
|
|
217
222
|
exitCode: number;
|
|
218
223
|
};
|
|
@@ -250,6 +255,12 @@ interface RunTaskInput extends RunDeps {
|
|
|
250
255
|
required?: boolean;
|
|
251
256
|
/** `turbo --filter=<pkg>` passthrough (monorepo). Ignored when the repo has no `turbo.json`. */
|
|
252
257
|
filter?: string;
|
|
258
|
+
/** `turbo --affected`: only the packages changed since `base`, plus their dependents. Ignored without a `turbo.json`. */
|
|
259
|
+
affected?: boolean;
|
|
260
|
+
/** Git ref `affected` compares against; falls back to `TURBO_SCM_BASE`. */
|
|
261
|
+
base?: string;
|
|
262
|
+
/** Environment `affected` reads (`GITHUB_EVENT_NAME`, `GITHUB_REF_NAME`, `TURBO_SCM_BASE`). Defaults to empty. */
|
|
263
|
+
env?: Record<string, string | undefined>;
|
|
253
264
|
/** The task entry's `jobs` switches: a sub-job set to `false` (by key or alias) is not run. */
|
|
254
265
|
jobSwitches?: Record<string, boolean>;
|
|
255
266
|
}
|
|
@@ -265,6 +276,12 @@ interface CiOptions {
|
|
|
265
276
|
dryRun?: boolean;
|
|
266
277
|
/** `turbo --filter=<pkg>` passthrough (monorepo). */
|
|
267
278
|
filter?: string;
|
|
279
|
+
/** `turbo --affected`: only the packages changed since `base`. */
|
|
280
|
+
affected?: boolean;
|
|
281
|
+
/** Git ref `affected` compares against. */
|
|
282
|
+
base?: string;
|
|
283
|
+
/** Environment `affected` reads. */
|
|
284
|
+
env?: Record<string, string | undefined>;
|
|
268
285
|
/** `"required"` (default) or `"all"` (every `ci: true` task). */
|
|
269
286
|
scope?: "required" | "all";
|
|
270
287
|
}
|
|
@@ -415,6 +432,12 @@ interface GroupOptions {
|
|
|
415
432
|
dryRun?: boolean;
|
|
416
433
|
/** `turbo --filter=<pkg>` passthrough (monorepo). */
|
|
417
434
|
filter?: string;
|
|
435
|
+
/** `turbo --affected`: only the packages changed since `base`. */
|
|
436
|
+
affected?: boolean;
|
|
437
|
+
/** Git ref `affected` compares against. */
|
|
438
|
+
base?: string;
|
|
439
|
+
/** Environment `affected` reads. */
|
|
440
|
+
env?: Record<string, string | undefined>;
|
|
418
441
|
}
|
|
419
442
|
interface GroupJobReport {
|
|
420
443
|
task: string;
|
|
@@ -460,6 +483,8 @@ interface AstromechOptions {
|
|
|
460
483
|
readFile?: (path: string) => string;
|
|
461
484
|
fileExists?: (path: string) => boolean;
|
|
462
485
|
listDir?: (path: string) => string[];
|
|
486
|
+
/** Injectable environment for `--affected` (tests). Defaults to `process.env`. */
|
|
487
|
+
env?: Record<string, string | undefined>;
|
|
463
488
|
/** Injectable binary lookup (tests). Default checks `node_modules/.bin` then `PATH`. */
|
|
464
489
|
lookPath?: (cwd: string, bin: string) => string | null;
|
|
465
490
|
}
|
|
@@ -478,6 +503,10 @@ interface RunOptions {
|
|
|
478
503
|
required?: boolean;
|
|
479
504
|
/** `turbo --filter=<pkg>` passthrough (monorepo). */
|
|
480
505
|
filter?: string;
|
|
506
|
+
/** `turbo --affected`: only the packages changed since `base`. */
|
|
507
|
+
affected?: boolean;
|
|
508
|
+
/** Git ref `affected` compares against. */
|
|
509
|
+
base?: string;
|
|
481
510
|
}
|
|
482
511
|
interface Astromech {
|
|
483
512
|
/**
|
|
@@ -609,19 +638,24 @@ interface JobDef {
|
|
|
609
638
|
local: LocalRunner | null;
|
|
610
639
|
/**
|
|
611
640
|
* The CI status-check context this job reports as (e.g.
|
|
612
|
-
* `platform.repoValidation / Validate
|
|
641
|
+
* `platform.repoValidation / Validate docs presence`) — every sub-job is a CI job.
|
|
613
642
|
* `holocron run <task>` and `holocron run ci` label each job line with it;
|
|
614
643
|
* the task-level `… / Conclusion` context (only for tasks with several
|
|
615
644
|
* jobs) lives in `WORKFLOW_CHECK_CONTEXTS`.
|
|
616
645
|
*/
|
|
617
646
|
checkContext: string;
|
|
618
647
|
/**
|
|
619
|
-
* The name a repo's config uses to switch this job off (`jobs: {
|
|
648
|
+
* The name a repo's config uses to switch this job off (`jobs: { docsEnforcement: false }`),
|
|
620
649
|
* where the job's own key is vague or fixed by the reusable workflow. The key itself works too.
|
|
621
650
|
*/
|
|
622
651
|
alias?: string;
|
|
623
652
|
}
|
|
624
653
|
interface TaskDef {
|
|
654
|
+
/**
|
|
655
|
+
* Sub-job slugs that no longer exist but that a reusable workflow synced earlier may still pass:
|
|
656
|
+
* `holocron run <task> <retired>` is a clean skip instead of an unknown-job failure.
|
|
657
|
+
*/
|
|
658
|
+
retiredJobs?: string[];
|
|
625
659
|
/**
|
|
626
660
|
* `null` — the registry has no built-in runner (CodeQL, deploys, the
|
|
627
661
|
* bundle-size job). An explicit turbo task or `package.json` script still
|
package/dist/index.mjs
CHANGED
|
@@ -263,13 +263,13 @@ function codecovConfig(repoRoot, existing) {
|
|
|
263
263
|
// src/templates/reusable/actions/auto-commit.yml
|
|
264
264
|
var auto_commit_default = "name: Auto Commit\ndescription: >\n Commit and push any file changes using stefanzweifel/git-auto-commit-action.\n If a branch name is provided and differs from the current branch, a new branch\n is created automatically.\n\ninputs:\n token:\n description: >\n GitHub token with push access to the target branch. Used to authenticate\n the git remote so the commit can be pushed.\n required: true\n branch:\n description: >\n Branch to commit to. Leave empty to commit to the current branch (useful\n in PR contexts). Provide an explicit name (e.g. chore/auto-sync-<sha>) to push\n to a separate branch.\n required: false\n default: \"\"\n commit-message:\n description: Commit message.\n required: true\n commit-options:\n description: >\n Additional options passed to git commit (e.g. --no-verify).\n required: false\n default: \"\"\n commit-user-name:\n description: Git user.name for the commit.\n required: false\n default: \"github-actions[bot]\"\n commit-user-email:\n description: Git user.email for the commit.\n required: false\n default: \"41898282+github-actions[bot]@users.noreply.github.com\"\n commit-author:\n description: >\n Git author string in \"Name <email>\" format.\n required: false\n default: \"github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>\"\n\noutputs:\n changes-detected:\n description: \"'true' if any files were committed, 'false' otherwise.\"\n value: ${{ steps.commit.outputs.changes_detected }}\n\nruns:\n using: composite\n steps:\n - name: Configure git remote with token\n shell: bash\n run: |\n REMOTE_URL=$(git remote get-url origin)\n AUTHED_URL=$(echo \"$REMOTE_URL\" | sed \"s|https://|https://x-access-token:${TOKEN}@|\")\n git remote set-url origin \"$AUTHED_URL\"\n env:\n TOKEN: ${{ inputs.token }}\n\n - name: Reset branch to current HEAD\n if: ${{ inputs.branch != '' }}\n shell: bash\n run: git checkout -B \"$BRANCH\"\n env:\n BRANCH: ${{ inputs.branch }}\n\n - name: Build signed commit message\n id: msg\n shell: bash\n run: |\n TRAILER=\"Signed-off-by: ${COMMIT_USER_NAME} <${COMMIT_USER_EMAIL}>\"\n if echo \"$COMMIT_MESSAGE\" | grep -qF \"$TRAILER\"; then\n FINAL=\"$COMMIT_MESSAGE\"\n else\n FINAL=\"${COMMIT_MESSAGE}\"$'\\n\\n'\"${TRAILER}\"\n fi\n {\n echo \"value<<EOF_TRAILER\"\n printf '%s' \"$FINAL\"\n echo \"\"\n echo \"EOF_TRAILER\"\n } >> \"$GITHUB_OUTPUT\"\n env:\n COMMIT_MESSAGE: ${{ inputs.commit-message }}\n COMMIT_USER_NAME: ${{ inputs.commit-user-name }}\n COMMIT_USER_EMAIL: ${{ inputs.commit-user-email }}\n\n - uses: stefanzweifel/git-auto-commit-action@4a55954c782fc1ea30b9056cd3e7a2b40ca8887d # v7.2.0\n id: commit\n with:\n branch: ${{ inputs.branch }}\n commit_message: ${{ steps.msg.outputs.value }}\n commit_options: ${{ inputs.commit-options }}\n commit_user_name: ${{ inputs.commit-user-name }}\n commit_user_email: ${{ inputs.commit-user-email }}\n commit_author: ${{ inputs.commit-author }}\n";
|
|
265
265
|
// src/templates/reusable/actions/holocron.yml
|
|
266
|
-
var holocron_default = "name: Holocron\ndescription: >\n Run the Holocron CLI — `holocron run <task> [job]` by default, or any other\n subcommand via `command:` (`repo sync`, `sync github`, …). Resolves\n `@theholocron/cli` from `node_modules` (published tarball) or builds it from\n source when it resolves to an unbuilt workspace checkout (the holocron repo\n itself). Requires dependencies to be installed already (run the setup action\n first).\n\ninputs:\n command:\n description: >\n Holocron subcommand. Default `run` — then `task` (and optional `job`)\n name the manifest task. Set to `repo sync` / `sync github` / … to run that\n subcommand directly; `args` becomes everything after it.\n required: false\n default: run\n task:\n description: >\n Manifest task to run when command is run — typecheck, test, build, audit.\n required: false\n default: \"\"\n job:\n description: Optional sub-job within the task (e.g. knip, performance for audit).\n required: false\n default: \"\"\n args:\n description: >\n For `command: run`, extra arguments forwarded to the tool after `--`.\n For any other command, the arguments passed straight to it.\n required: false\n default: \"\"\n\noutputs:\n log-file:\n description: >\n Path to a file holding the full captured stdout+stderr of this\n invocation — the same text the live Actions log shows, saved for a\n caller that wants to ship it elsewhere (e.g. Sentinel's dispatched\n checks shipping it to Axiom, holocron#769/#794).\n value: ${{ steps.run.outputs.log-file }}\n\nruns:\n using: composite\n\n steps:\n - name: Build the workspace when the CLI resolves to an unbuilt checkout\n shell: bash\n # The holocron repo carries @theholocron/cli as `workspace:*`; its bin\n # (dist/cli.mjs) does not exist on a fresh checkout. `pnpm build` is a\n # turbo run — cached and cheap once warm. A no-op everywhere else, where\n # the published tarball already ships dist/.\n #\n # pnpm creates every workspace package's node_modules/.bin/holocron shim\n # once, during the setup action's earlier `pnpm install` — before this\n # build has run, so every one of them is silently skipped (\"Failed to\n # create bin ... ENOENT\"), not just @theholocron/cli's own. That's a\n # one-time decision: a later build doesn't retroactively fix a shim that\n # was never created. Re-running `pnpm install` here (fast — the lockfile\n # hasn't changed, so it only re-links `.bin`) is what actually fixes it,\n # confirmed against a real cold install: `holocron` stays unresolvable\n # from inside any package until this second install runs.\n run: |\n if [ ! -f node_modules/@theholocron/cli/dist/cli.mjs ]; then\n echo \"→ @theholocron/cli dist/ missing — building the workspace from source\" >&2\n pnpm build\n echo \"→ re-linking node_modules/.bin — pnpm skipped it pre-build\" >&2\n pnpm install --frozen-lockfile\n fi\n\n - name: holocron ${{ inputs.command }} ${{ inputs.task }}\n id: run\n shell: bash\n env:\n HOLOCRON_COMMAND: ${{ inputs.command }}\n HOLOCRON_TASK: ${{ inputs.task }}\n HOLOCRON_JOB: ${{ inputs.job }}\n HOLOCRON_ARGS: ${{ inputs.args }}\n run: |\n if [ \"$HOLOCRON_COMMAND\" = \"run\" ]; then\n set -- run \"$HOLOCRON_TASK\"\n [ -n \"$HOLOCRON_JOB\" ] && set -- \"$@\" \"$HOLOCRON_JOB\"\n # shellcheck disable=SC2086\n [ -n \"$HOLOCRON_ARGS\" ] && set -- \"$@\" -- $HOLOCRON_ARGS\n else\n # `command` may be a multi-word path (`repo sync`, `deploy on-release`):\n # word-split it so each token is its own argument.\n # shellcheck disable=SC2086\n set -- $HOLOCRON_COMMAND $HOLOCRON_ARGS\n fi\n # Invoke the built entry directly. `pnpm exec holocron` relies on a\n # node_modules/.bin/holocron shim that pnpm does not create for a\n # workspace package whose dist/ was absent at install time (the holocron\n # repo itself). Resolving the package's main export gives dist/index.mjs;\n # the bin sits next to it as dist/cli.mjs. This is `require.resolve` from\n # node_modules — it works in the holocron monorepo AND in every consumer\n # repo (theholocron/holocron#655), unlike a hard-coded `cli/cli/…`.\n cli=\"$(dirname \"$(node -e 'process.stdout.write(require.resolve(\"@theholocron/cli\"))')\")/cli.mjs\"\n if [ ! -f \"$cli\" ]; then\n echo \"::error::@theholocron/cli entry not found at $cli — is the workspace built?\" >&2\n exit 1\n fi\n echo \"→ $cli $*\" >&2\n # `tee` keeps the live Actions log streaming exactly as before while\n # also capturing it to a file callers can ship elsewhere (log-file\n # output, above). PIPESTATUS[0] -- not $? -- is `node`'s own exit\n # code; $? after a pipe is tee's, which succeeds even when node fails.\n log_file=\"${RUNNER_TEMP}/holocron-output.log\"\n node \"$cli\" \"$@\" 2>&1 | tee \"$log_file\"\n exit_code=${PIPESTATUS[0]}\n echo \"log-file=$log_file\" >> \"$GITHUB_OUTPUT\"\n exit \"$exit_code\"\n";
|
|
266
|
+
var holocron_default = "name: Holocron\ndescription: >\n Run the Holocron CLI — `holocron run <task> [job]` by default, or any other\n subcommand via `command:` (`repo sync`, `sync github`, …). Resolves\n `@theholocron/cli` from `node_modules` (published tarball) or builds it from\n source when it resolves to an unbuilt workspace checkout (the holocron repo\n itself). Requires dependencies to be installed already (run the setup action\n first).\n\ninputs:\n command:\n description: >\n Holocron subcommand. Default `run` — then `task` (and optional `job`)\n name the manifest task. Set to `repo sync` / `sync github` / … to run that\n subcommand directly; `args` becomes everything after it.\n required: false\n default: run\n task:\n description: >\n Manifest task to run when command is run — typecheck, test, build, audit.\n required: false\n default: \"\"\n job:\n description: Optional sub-job within the task (e.g. knip, performance for audit).\n required: false\n default: \"\"\n affected:\n description: >\n For `command: run`, only run the packages changed since the PR base (or the\n merge-base with the default branch), plus their dependents: `--affected`.\n Needs a checkout with enough history to reach the base (`fetch-depth: 0`);\n without it holocron logs a warning and runs everything.\n required: false\n default: \"false\"\n args:\n description: >\n For `command: run`, extra arguments forwarded to the tool after `--`.\n For any other command, the arguments passed straight to it.\n required: false\n default: \"\"\n\noutputs:\n log-file:\n description: >\n Path to a file holding the full captured stdout+stderr of this\n invocation — the same text the live Actions log shows, saved for a\n caller that wants to ship it elsewhere (e.g. Sentinel's dispatched\n checks shipping it to Axiom, holocron#769/#794).\n value: ${{ steps.run.outputs.log-file }}\n\nruns:\n using: composite\n\n steps:\n - name: Build the workspace when the CLI resolves to an unbuilt checkout\n shell: bash\n # The holocron repo carries @theholocron/cli as `workspace:*`; its bin\n # (dist/cli.mjs) does not exist on a fresh checkout. `pnpm build` is a\n # turbo run — cached and cheap once warm. A no-op everywhere else, where\n # the published tarball already ships dist/.\n #\n # pnpm creates every workspace package's node_modules/.bin/holocron shim\n # once, during the setup action's earlier `pnpm install` — before this\n # build has run, so every one of them is silently skipped (\"Failed to\n # create bin ... ENOENT\"), not just @theholocron/cli's own. That's a\n # one-time decision: a later build doesn't retroactively fix a shim that\n # was never created. Re-running `pnpm install` here (fast — the lockfile\n # hasn't changed, so it only re-links `.bin`) is what actually fixes it,\n # confirmed against a real cold install: `holocron` stays unresolvable\n # from inside any package until this second install runs.\n run: |\n if [ ! -f node_modules/@theholocron/cli/dist/cli.mjs ]; then\n echo \"→ @theholocron/cli dist/ missing — building the workspace from source\" >&2\n pnpm build\n echo \"→ re-linking node_modules/.bin — pnpm skipped it pre-build\" >&2\n pnpm install --frozen-lockfile\n fi\n\n - name: holocron ${{ inputs.command }} ${{ inputs.task }}\n id: run\n shell: bash\n env:\n HOLOCRON_COMMAND: ${{ inputs.command }}\n HOLOCRON_TASK: ${{ inputs.task }}\n HOLOCRON_JOB: ${{ inputs.job }}\n HOLOCRON_ARGS: ${{ inputs.args }}\n HOLOCRON_AFFECTED: ${{ inputs.affected }}\n HOLOCRON_PR_BASE_SHA: ${{ github.event.pull_request.base.sha }}\n HOLOCRON_DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}\n run: |\n if [ \"$HOLOCRON_COMMAND\" = \"run\" ]; then\n set -- run \"$HOLOCRON_TASK\"\n [ -n \"$HOLOCRON_JOB\" ] && set -- \"$@\" \"$HOLOCRON_JOB\"\n if [ \"$HOLOCRON_AFFECTED\" = \"true\" ]; then\n # A pull request compares against its base commit. Any other trigger\n # (a push to a PR branch) compares against where the branch left the\n # default branch. If neither resolves, no --base is passed and holocron\n # runs everything.\n base=\"$HOLOCRON_PR_BASE_SHA\"\n if [ -z \"$base\" ] && [ -n \"$HOLOCRON_DEFAULT_BRANCH\" ]; then\n git fetch --no-tags --quiet origin \"$HOLOCRON_DEFAULT_BRANCH\" || true\n base=\"$(git merge-base HEAD \"origin/$HOLOCRON_DEFAULT_BRANCH\" 2>/dev/null || true)\"\n fi\n set -- \"$@\" --affected\n [ -n \"$base\" ] && set -- \"$@\" --base \"$base\"\n fi\n # shellcheck disable=SC2086\n [ -n \"$HOLOCRON_ARGS\" ] && set -- \"$@\" -- $HOLOCRON_ARGS\n else\n # `command` may be a multi-word path (`repo sync`, `deploy on-release`):\n # word-split it so each token is its own argument.\n # shellcheck disable=SC2086\n set -- $HOLOCRON_COMMAND $HOLOCRON_ARGS\n fi\n # Invoke the built entry directly. `pnpm exec holocron` relies on a\n # node_modules/.bin/holocron shim that pnpm does not create for a\n # workspace package whose dist/ was absent at install time (the holocron\n # repo itself). Resolving the package's main export gives dist/index.mjs;\n # the bin sits next to it as dist/cli.mjs. This is `require.resolve` from\n # node_modules — it works in the holocron monorepo AND in every consumer\n # repo (theholocron/holocron#655), unlike a hard-coded `cli/cli/…`.\n cli=\"$(dirname \"$(node -e 'process.stdout.write(require.resolve(\"@theholocron/cli\"))')\")/cli.mjs\"\n if [ ! -f \"$cli\" ]; then\n echo \"::error::@theholocron/cli entry not found at $cli — is the workspace built?\" >&2\n exit 1\n fi\n echo \"→ $cli $*\" >&2\n # `tee` keeps the live Actions log streaming exactly as before while\n # also capturing it to a file callers can ship elsewhere (log-file\n # output, above). PIPESTATUS[0] -- not $? -- is `node`'s own exit\n # code; $? after a pipe is tee's, which succeeds even when node fails.\n log_file=\"${RUNNER_TEMP}/holocron-output.log\"\n node \"$cli\" \"$@\" 2>&1 | tee \"$log_file\"\n exit_code=${PIPESTATUS[0]}\n echo \"log-file=$log_file\" >> \"$GITHUB_OUTPUT\"\n exit \"$exit_code\"\n";
|
|
267
267
|
// src/templates/reusable/actions/install.yml
|
|
268
268
|
var install_default = "name: Install dependencies\ndescription: Install project dependencies with pnpm frozen lockfile.\n\nruns:\n using: composite\n\n steps:\n - name: Install dependencies\n if: ${{ hashFiles('pnpm-lock.yaml') != '' }}\n shell: bash\n run: pnpm install --frozen-lockfile\n";
|
|
269
269
|
// src/templates/reusable/actions/notify.yml
|
|
270
270
|
var notify_default = "name: Notify\ndescription: >\n Post a message to a chat channel through an incoming webhook. The request\n body is Discord-compatible (`content`, `username`, `allowed_mentions`), so\n the webhook must accept that shape. Does nothing (and never fails the\n calling job) when no webhook is provided, so repos that haven't set one up\n are unaffected. Set `strict` for a check whose only purpose is to prove the\n notification works: it then fails when the webhook is missing or rejects the post.\n\ninputs:\n webhook:\n description: >\n Incoming webhook URL for the target channel.\n A webhook posts to exactly one channel, so pass the secret for the\n channel this message belongs in (for example\n `secrets.HOLOCRON_NOTIFY_WEBHOOK_ALERTS`). Empty = skip.\n required: false\n default: \"\"\n message:\n description: Message text. Truncated to 2000 characters.\n required: true\n mention:\n description: >\n Optional role id (digits only) to ping. Only that one role can\n be mentioned; anything else in the message never pings.\n required: false\n default: \"\"\n username:\n description: Display name for the post.\n required: false\n default: \"Holocron\"\n strict:\n description: >\n \"true\" fails the step when no webhook is set or the post is rejected.\n Off by default: a notification problem must never fail the job it reports on.\n required: false\n default: \"false\"\n\nruns:\n using: composite\n steps:\n - name: Post the notification\n shell: bash\n run: |\n if [ -z \"$WEBHOOK\" ]; then\n if [ \"$STRICT\" = \"true\" ]; then\n echo \"::error::No notification webhook set.\"\n exit 1\n fi\n echo \"::notice::No notification webhook set — skipping notification.\"\n exit 0\n fi\n echo \"::add-mask::$WEBHOOK\"\n # allowed_mentions.parse = [] so message text can never ping @everyone\n # or a role; only the explicit `mention` role id is allowed through. The\n # body is built with jq so quotes/newlines in the message can't break the JSON.\n content=\"$MESSAGE\"\n roles='[]'\n # A mention that is not a role id is dropped, which is right for a real\n # notification but would let a check pass without ever pinging anyone.\n if [ \"$STRICT\" = \"true\" ] && [ -n \"$MENTION\" ] && ! [[ \"$MENTION\" =~ ^[0-9]+$ ]]; then\n echo \"::error::The mention is not a role id (digits only).\"\n exit 1\n fi\n if [[ \"$MENTION\" =~ ^[0-9]+$ ]]; then\n content=\"<@&$MENTION> $MESSAGE\"\n roles=$(jq -cn --arg r \"$MENTION\" '[$r]')\n fi\n body=$(jq -n --arg content \"${content:0:2000}\" --arg username \"$USERNAME\" --argjson roles \"$roles\" \\\n '{content: $content, username: $username, allowed_mentions: {parse: [], roles: $roles}}')\n status=$(curl -sS -o /dev/null -w '%{http_code}' --max-time 15 \\\n -H 'Content-Type: application/json' -d \"$body\" \"$WEBHOOK\" || true)\n case \"${status:-000}\" in\n 2??) echo \"Notification posted.\" ;;\n *)\n if [ \"$STRICT\" = \"true\" ]; then\n echo \"::error::Notification failed (HTTP ${status:-000}).\"\n exit 1\n fi\n echo \"::warning::Notification failed (HTTP ${status:-000}).\"\n ;;\n esac\n env:\n WEBHOOK: ${{ inputs.webhook }}\n MESSAGE: ${{ inputs.message }}\n MENTION: ${{ inputs.mention }}\n USERNAME: ${{ inputs.username }}\n STRICT: ${{ inputs.strict }}\n";
|
|
271
271
|
// src/templates/reusable/actions/setup.yml
|
|
272
|
-
var setup_default = "name: Setup\ndescription: Prepare the environment and install project dependencies.\n\ninputs:\n node-version:\n description: Node.js version\n required: false\n default: \"22.x\"\n\nruns:\n using: composite\n\n steps:\n - uses: theholocron/.github/.github/actions/setup-node@main\n with:\n node-version: ${{ inputs.node-version }}\n\n - uses: theholocron/.github/.github/actions/install@main\n\n # `@theholocron/cli`'s `dist/cli.mjs` doesn't exist yet at this point, so\n # pnpm's workspace bin-linking can't create `node_modules/.bin/holocron`\n # (silent `WARN ... ENOENT`, not a hard failure). Every package whose\n # scripts delegate via `holocron run <task> --` then fails at run time\n # with `holocron: not found` (#698). Same fix the `holocron` composite\n # action already applies for its own direct invocation (see its \"Build\n # the workspace when the CLI resolves to an unbuilt checkout\" step) —\n # mirrored here so it also covers *nested* `holocron run <task> --`\n # calls from inside package.json scripts, which that action's own guard\n # doesn't reach. `pnpm build` (not a scoped `--filter`) so the CLI's own\n # workspace dependencies (e.g. astromech) build\n # in topological order too — a scoped build skips them and fails.\n # No-op in every consumer repo, where the published tarball already\n # ships `dist/`.\n - name: Build the Holocron CLI\n shell: bash\n run: |\n if [ ! -f node_modules/@theholocron/cli/dist/cli.mjs ]; then\n echo \"→ @theholocron/cli dist/ missing — building the workspace from source\" >&2\n pnpm build\n echo \"→ re-linking node_modules/.bin — pnpm skipped it pre-build\" >&2\n pnpm install --frozen-lockfile\n fi\n\n
|
|
272
|
+
var setup_default = "name: Setup\ndescription: Prepare the environment and install project dependencies.\n\ninputs:\n node-version:\n description: Node.js version\n required: false\n default: \"22.x\"\n\nruns:\n using: composite\n\n steps:\n - uses: theholocron/.github/.github/actions/setup-node@main\n with:\n node-version: ${{ inputs.node-version }}\n\n - uses: theholocron/.github/.github/actions/install@main\n\n # Restored before the bootstrap build below so `pnpm build` replays from the cache instead of running cold.\n - name: Cache Turbo artifacts\n if: ${{ hashFiles('turbo.json') != '' }}\n uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0\n with:\n path: .turbo\n key: turbo-${{ runner.os }}-${{ github.sha }}\n restore-keys: |\n turbo-${{ runner.os }}-\n\n # `@theholocron/cli`'s `dist/cli.mjs` doesn't exist yet at this point, so\n # pnpm's workspace bin-linking can't create `node_modules/.bin/holocron`\n # (silent `WARN ... ENOENT`, not a hard failure). Every package whose\n # scripts delegate via `holocron run <task> --` then fails at run time\n # with `holocron: not found` (#698). Same fix the `holocron` composite\n # action already applies for its own direct invocation (see its \"Build\n # the workspace when the CLI resolves to an unbuilt checkout\" step) —\n # mirrored here so it also covers *nested* `holocron run <task> --`\n # calls from inside package.json scripts, which that action's own guard\n # doesn't reach. `pnpm build` (not a scoped `--filter`) so the CLI's own\n # workspace dependencies (e.g. astromech) build\n # in topological order too — a scoped build skips them and fails.\n # No-op in every consumer repo, where the published tarball already\n # ships `dist/`.\n - name: Build the Holocron CLI\n shell: bash\n run: |\n if [ ! -f node_modules/@theholocron/cli/dist/cli.mjs ]; then\n echo \"→ @theholocron/cli dist/ missing — building the workspace from source\" >&2\n pnpm build\n echo \"→ re-linking node_modules/.bin — pnpm skipped it pre-build\" >&2\n pnpm install --frozen-lockfile\n fi\n\n # A Turbo token with no team turns the remote cache off without a word: every task just runs cold. `TURBO_TEAM` is\n # an organization variable that `holocron repo setup` writes from `repo.variables.org.TURBO_TEAM` in\n # holocron.config.ts. Quiet when there is no token, because then the cache is meant to be off.\n - name: Warn when the Turbo remote cache is off\n if: ${{ hashFiles('turbo.json') != '' }}\n shell: bash\n run: |\n if [ -n \"$TURBO_TOKEN\" ] && [ -z \"$TURBO_TEAM\" ]; then\n echo \"::warning title=Turbo remote cache is off::TURBO_TOKEN is set but TURBO_TEAM is not. Declare it under repo.variables.org in holocron.config.ts and run holocron repo setup.\"\n fi\n";
|
|
273
273
|
// src/templates/reusable/actions/setup-node.yml
|
|
274
274
|
var setup_node_default = "name: Setup Node\ndescription: Install pnpm and Node.js with pnpm dependency caching.\n\ninputs:\n node-version:\n description: Node.js version\n required: false\n default: \"22.x\"\nruns:\n using: composite\n\n steps:\n - name: Setup pnpm\n if: ${{ hashFiles('pnpm-lock.yaml') != '' }}\n uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4\n\n - name: Setup Node.js\n uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0\n with:\n node-version: ${{ hashFiles('.node-version') != '' && '' || inputs.node-version }}\n node-version-file: ${{ hashFiles('.node-version') != '' && '.node-version' || '' }}\n cache: ${{ hashFiles('pnpm-lock.yaml') != '' && 'pnpm' || '' }}\n # Do NOT add registry-url here. setup-node writes .npmrc with\n # _authToken=${NODE_AUTH_TOKEN} and sets NPM_CONFIG_USERCONFIG to it.\n # pnpm reads that file, fails env-var substitution when the token is\n # empty, and loses auth entirely. Without registry-url, pnpm 10.15+\n # handles Trusted Publishing via its own native OIDC exchange.\n\n - name: Add node_modules/.bin to PATH\n shell: bash\n run: echo \"$GITHUB_WORKSPACE/node_modules/.bin\" >> $GITHUB_PATH\n";
|
|
275
275
|
// src/templates/reusable/bookkeeping.yml
|
|
@@ -301,7 +301,7 @@ var platform_notifyCheck_default$1 = "name: Notify Check\n\n# Proves the notific
|
|
|
301
301
|
// src/templates/reusable/platform.repoSync.yml
|
|
302
302
|
var platform_repoSync_default$1 = "name: Sync\n\non: # yamllint disable-line rule:truthy\n workflow_call:\n inputs:\n steps:\n description: >\n Sync steps to run (default: all). Valid values:\n labels, properties, teams, topics, keywords, description, homepage, readme, workflows, wiki.\n Pass a space-separated list to run a subset, e.g. \"readme\" or \"readme wiki\".\n type: string\n required: false\n secrets:\n HOLOCRON_ADMIN_TOKEN:\n description: Fine-grained PAT with admin scopes (labels, properties, teams).\n required: false\n HOLOCRON_AXIOM_TOKEN:\n description: >\n Axiom API token. When set alongside the HOLOCRON_AXIOM_DATASET\n repo/org variable, the CLI ships this run's structured logs to Axiom.\n Falls back to the vendor-native AXIOM_TOKEN secret.\n required: false\n AXIOM_TOKEN:\n description: Vendor-native fallback for HOLOCRON_AXIOM_TOKEN.\n required: false\n HOLOCRON_DEPLOY_TOKEN:\n description: Fine-grained PAT for GitHub Pages configuration.\n required: false\n HOLOCRON_ISSUES_TOKEN:\n description: Fine-grained PAT for issue management.\n required: false\n HOLOCRON_ORG_TOKEN:\n description: Org-scoped fine-grained PAT for team sync and org properties.\n required: false\n HOLOCRON_READ_TOKEN:\n description: Fine-grained PAT for read-only GitHub API calls.\n required: false\n HOLOCRON_SYNC_TOKEN:\n required: false\n HOLOCRON_NOTIFY_WEBHOOK_SYNC:\n description: >\n Webhook for the sync channel: a sync PR opened and its\n auto-merge result. Unset = no post.\n required: false\n HOLOCRON_NOTIFY_WEBHOOK_ALERTS:\n description: >\n Webhook for the alerts channel: a failed sync run, or a sync\n PR that needs a manual merge. Unset = no post. The optional\n HOLOCRON_NOTIFY_ALERT_ROLE secret (a role id) makes these posts\n mention that role.\n required: false\n HOLOCRON_NOTIFY_ALERT_ROLE:\n description: >\n Id of the role to mention on alerts. Written by `holocron\n notifications setup`; not sensitive, kept as a secret so the same\n token that writes the webhook secrets can write it. Optional.\n required: false\n GH_TOKEN:\n description: >\n Generic GitHub token fallback for gh CLI calls. Used when\n HOLOCRON_SYNC_TOKEN is not set.\n required: false\n\njobs:\n sync:\n name: Run holocron repo sync\n runs-on: ubuntu-latest\n timeout-minutes: 10\n # Serialise the find-or-create-PR and supersede steps repo-wide: the caller's\n # concurrency key is per ref, so runs from different refs could otherwise\n # interleave and leave several sync PRs open.\n concurrency:\n group: repo-sync-pr-${{ github.repository }}\n cancel-in-progress: false\n permissions:\n contents: write\n pull-requests: write\n # Job-level so the `holocron` composite action's steps inherit them.\n env:\n HOLOCRON_ADMIN_TOKEN: ${{ secrets.HOLOCRON_ADMIN_TOKEN }}\n HOLOCRON_AXIOM_TOKEN: ${{ secrets.HOLOCRON_AXIOM_TOKEN || secrets.AXIOM_TOKEN }}\n HOLOCRON_AXIOM_DATASET: ${{ vars.HOLOCRON_AXIOM_DATASET || vars.AXIOM_DATASET }}\n POSTHOG_PROJECT_TOKEN: ${{ vars.POSTHOG_PROJECT_TOKEN }}\n HOLOCRON_DEPLOY_TOKEN: ${{ secrets.HOLOCRON_DEPLOY_TOKEN }}\n HOLOCRON_ISSUES_TOKEN: ${{ secrets.HOLOCRON_ISSUES_TOKEN }}\n HOLOCRON_ORG_TOKEN: ${{ secrets.HOLOCRON_ORG_TOKEN }}\n HOLOCRON_READ_TOKEN: ${{ secrets.HOLOCRON_READ_TOKEN }}\n HOLOCRON_SYNC_TOKEN: ${{ secrets.HOLOCRON_SYNC_TOKEN }}\n steps:\n - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0\n name: Checkout repository\n with:\n token: ${{ secrets.HOLOCRON_SYNC_TOKEN || secrets.GH_TOKEN || github.token }}\n\n - uses: theholocron/.github/.github/actions/setup@main\n name: Setup\n\n - name: Run holocron repo sync\n # The `holocron` action resolves @theholocron/cli from node_modules (or\n # builds the workspace when it's an unbuilt checkout — the holocron repo\n # itself). `inputs.steps` is a space-separated list or empty; the\n # `--steps <list>` arg is omitted when empty.\n uses: theholocron/.github/.github/actions/holocron@main\n with:\n command: repo sync\n args: ${{ inputs.steps != '' && format('--steps {0}', inputs.steps) || '' }}\n\n - name: Format generated files\n run: |\n pnpm exec prettier --write README.md docs/src/content/docs/index.mdx 2>/dev/null || true\n # `holocron repo sync` writes package.json fields (keywords, description,\n # homepage) with a plain assignment, which appends new keys at the\n # end — re-apply the canonical order the lint config enforces.\n pnpm exec eslint --fix --no-warn-ignored package.json 2>/dev/null || true\n\n - uses: theholocron/.github/.github/actions/auto-commit@main\n id: auto-commit\n name: Commit sync changes\n with:\n token: ${{ secrets.HOLOCRON_SYNC_TOKEN || secrets.GH_TOKEN || github.token }}\n # One branch per source commit (full SHA, so distinct commits never collide): a PR left unreviewed never blocks the\n # next sync, and a re-run for the same commit updates its own branch.\n branch: ${{ format('chore/auto-sync-{0}', github.sha) }}\n commit-message: \"chore: sync from holocron.config\"\n commit-options: \"--no-verify\"\n\n - name: Open PR and enable auto-merge\n id: pr\n if: steps.auto-commit.outputs.changes-detected == 'true'\n run: |\n # Find or create this run's PR first: older PRs are only closed once\n # a replacement exists, so a failure here never leaves the changes\n # without an open PR.\n url=$(gh pr view \"$BRANCH\" --json url --jq .url 2>/dev/null || gh pr create \\\n --title \"chore: sync README and repo metadata\" \\\n --body \"Automated sync from holocron.config. Auto-merges once required checks pass.\" \\\n --base main \\\n --head \"$BRANCH\")\n created=$(gh pr view \"$url\" --json createdAt --jq .createdAt)\n\n # Supersede older sync PRs: same-repo only, exact generated or legacy\n # branch name, and created before this one (a slow older run can\n # never close a newer PR). --limit covers more than the default page.\n gh pr list --state open --limit 200 --json number,headRefName,isCrossRepository,createdAt \\\n --jq \".[] | select(.isCrossRepository | not) | select(.headRefName == \\\"chore/auto-sync\\\" or (.headRefName | test(\\\"^chore/auto-sync-[0-9a-f]{40}$\\\"))) | select(.headRefName != \\\"$BRANCH\\\") | select(.createdAt < \\\"$created\\\") | .number\" |\n while read -r n; do\n gh pr close \"$n\" --delete-branch --comment \"Superseded by $url.\" || true\n done\n\n # Delete pushed sync branches that never got a PR (e.g. a run\n # cancelled between push and PR creation). The repo-wide concurrency\n # group means no other run is mid-flight here.\n open=$(gh pr list --state open --limit 200 --json headRefName --jq '.[].headRefName')\n git ls-remote --heads origin 'refs/heads/chore/auto-sync-*' | sed 's|.*refs/heads/||' |\n while read -r b; do\n [ \"$b\" = \"$BRANCH\" ] && continue\n echo \"$b\" | grep -Eq '^chore/auto-sync-[0-9a-f]{40}$' || continue\n echo \"$open\" | grep -qxF \"$b\" || git push origin --delete \"$b\" || true\n done\n\n # A PR opened with the default GITHUB_TOKEN does not trigger\n # pull_request workflows, so required checks would never start and\n # auto-merge would wait forever.\n if [ \"$HAS_PAT\" != \"true\" ]; then\n echo \"::warning::Sync PR $url opened with GITHUB_TOKEN: checks will not run and auto-merge is skipped. Set HOLOCRON_SYNC_TOKEN.\"\n echo \"Sync PR $url — needs manual merge (no PAT).\" >> \"$GITHUB_STEP_SUMMARY\"\n result=\"needs a manual merge (no PAT, so checks will not run)\"\n attention=true\n elif gh pr merge \"$url\" --auto --squash; then\n echo \"Sync PR $url — auto-merge enabled.\" | tee -a \"$GITHUB_STEP_SUMMARY\"\n result=\"auto-merge enabled\"\n else\n echo \"::warning::Sync PR $url opened but auto-merge could not be enabled; merge it manually.\"\n echo \"Sync PR $url — needs manual merge.\" >> \"$GITHUB_STEP_SUMMARY\"\n result=\"needs a manual merge (auto-merge could not be enabled)\"\n attention=true\n fi\n {\n echo \"url=$url\"\n echo \"result=$result\"\n echo \"attention=${attention:-false}\"\n } >> \"$GITHUB_OUTPUT\"\n env:\n BRANCH: ${{ format('chore/auto-sync-{0}', github.sha) }}\n HAS_PAT: ${{ secrets.HOLOCRON_SYNC_TOKEN != '' || secrets.GH_TOKEN != '' }}\n GH_TOKEN: ${{ secrets.HOLOCRON_SYNC_TOKEN || secrets.GH_TOKEN || github.token }}\n\n - uses: theholocron/.github/.github/actions/notify@main\n name: Notify of the sync PR\n if: steps.pr.outputs.url != '' && steps.pr.outputs.attention != 'true'\n with:\n webhook: ${{ secrets.HOLOCRON_NOTIFY_WEBHOOK_SYNC }}\n message: \"🔄 ${{ github.repository }}: sync PR ${{ steps.pr.outputs.url }} — ${{ steps.pr.outputs.result }}${{ github.run_attempt > 1 && format(' (attempt {0})', github.run_attempt) || '' }}\"\n\n - uses: theholocron/.github/.github/actions/notify@main\n name: Notify that a sync PR needs attention\n if: steps.pr.outputs.attention == 'true'\n with:\n webhook: ${{ secrets.HOLOCRON_NOTIFY_WEBHOOK_ALERTS }}\n mention: ${{ secrets.HOLOCRON_NOTIFY_ALERT_ROLE }}\n message: \"⚠️ ${{ github.repository }}: sync PR ${{ steps.pr.outputs.url }} — ${{ steps.pr.outputs.result }}${{ github.run_attempt > 1 && format(' (attempt {0})', github.run_attempt) || '' }}\"\n\n - name: Broadcast wiki sync if navbar changed\n if: >-\n steps.auto-commit.outputs.changes-detected == 'true' &&\n github.event_name == 'push' &&\n (inputs.steps == '' || contains(inputs.steps, 'wiki'))\n run: |\n if git diff HEAD~1 --name-only | grep -q 'fern/docs.yml'; then\n gh workflow run sync-dispatch.yml \\\n --repo theholocron/.github \\\n --field \"steps=wiki\" \\\n || echo \"skipping broadcast — insufficient permissions\"\n fi\n env:\n GH_TOKEN: ${{ secrets.HOLOCRON_SYNC_TOKEN || secrets.GH_TOKEN || github.token }}\n\n # A separate job, not a final step: a job-level timeout cancels the sync job\n # before any later step in it can run, so an in-job `if: failure()` step would\n # stay silent on exactly the hang we most want to hear about. `!cancelled()` is\n # false when the whole run was cancelled (a newer run superseded this one), so\n # that expected case stays quiet, while a failed or timed-out sync job alerts.\n notify-failure:\n name: Notify of a failed sync\n needs: sync\n if: ${{ !cancelled() && (needs.sync.result == 'failure' || needs.sync.result == 'cancelled') }}\n runs-on: ubuntu-latest\n timeout-minutes: 2\n permissions: {}\n steps:\n - uses: theholocron/.github/.github/actions/notify@main\n name: Notify of a failed sync\n with:\n webhook: ${{ secrets.HOLOCRON_NOTIFY_WEBHOOK_ALERTS }}\n mention: ${{ secrets.HOLOCRON_NOTIFY_ALERT_ROLE }}\n message: \"❌ ${{ github.repository }}: repo sync ${{ needs.sync.result == 'cancelled' && 'timed out or was cancelled' || 'failed' }} — ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}${{ github.run_attempt > 1 && format(' (attempt {0})', github.run_attempt) || '' }}\"\n";
|
|
303
303
|
// src/templates/reusable/platform.repoValidation.yml
|
|
304
|
-
var platform_repoValidation_default$1 = "name: Repo Validation\n\non: # yamllint disable-line rule:truthy\n workflow_call:\n secrets:\n TURBO_TOKEN:\n required: false\n\njobs:\n adrs:\n name: Validate ADRs and specs\n permissions:\n contents: read\n runs-on: ubuntu-latest\n timeout-minutes: 10\n steps:\n - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0\n name: Checkout repository\n with:\n fetch-depth: 0\n\n - uses: theholocron/.github/.github/actions/setup@main\n name: Setup\n\n - uses: theholocron/.github/.github/actions/holocron@main\n name: Validate ADR and spec frontmatter\n with:\n task: platform.repoValidation\n job: adrs\n\n
|
|
304
|
+
var platform_repoValidation_default$1 = "name: Repo Validation\n\non: # yamllint disable-line rule:truthy\n workflow_call:\n secrets:\n TURBO_TOKEN:\n required: false\n\njobs:\n adrs:\n name: Validate ADRs and specs\n permissions:\n contents: read\n runs-on: ubuntu-latest\n timeout-minutes: 10\n steps:\n - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0\n name: Checkout repository\n with:\n fetch-depth: 0\n\n - uses: theholocron/.github/.github/actions/setup@main\n name: Setup\n\n - uses: theholocron/.github/.github/actions/holocron@main\n name: Validate ADR and spec frontmatter\n with:\n task: platform.repoValidation\n job: adrs\n\n docs-presence:\n name: Validate docs presence\n permissions:\n contents: read\n runs-on: ubuntu-latest\n timeout-minutes: 10\n steps:\n - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0\n name: Checkout repository\n with:\n fetch-depth: 0\n\n - uses: theholocron/.github/.github/actions/setup@main\n name: Setup\n\n - uses: theholocron/.github/.github/actions/holocron@main\n name: Validate docs presence for new packages\n with:\n task: platform.repoValidation\n job: docsPresence\n env:\n BASE_SHA: ${{ github.event.pull_request.base.sha || github.event.before }}\n\n conclusion:\n name: Conclusion\n runs-on: ubuntu-latest\n if: always()\n needs: [adrs, docs-presence]\n steps:\n - name: Check job statuses\n run: |\n if [[ \"$RESULTS\" == *\"failure\"* ]] || [[ \"$RESULTS\" == *\"cancelled\"* ]]; then\n exit 1\n fi\n env:\n RESULTS: ${{ join(needs.*.result, ',') }}\n";
|
|
305
305
|
// src/templates/reusable/platform.syncTemplates.yml
|
|
306
306
|
var platform_syncTemplates_default$1 = "name: Sync Templates\n\non: # yamllint disable-line rule:truthy\n workflow_call:\n secrets:\n HOLOCRON_SYNC_TOKEN:\n description: >\n Fine-grained PAT (resource owner org) with BOTH contents:write and\n workflows:write on theholocron/.github — contents:write alone is\n rejected for anything under .github/workflows/, a GitHub\n fine-grained-PAT restriction independent of repo permissions.\n required: false\n GH_TOKEN:\n description: >\n Fallback PAT with the same two permissions, used only when\n HOLOCRON_SYNC_TOKEN is not set. The default GITHUB_TOKEN is never\n an acceptable fallback here — it cannot write to a different repo\n no matter what this job's own `permissions:` block grants, so it\n is deliberately not offered as a third fallback; the CLI's own\n token resolver already fails with a clear, actionable message\n when both secrets above are unset.\n required: false\n\njobs:\n sync-templates:\n name: Run holocron sync github\n runs-on: ubuntu-latest\n timeout-minutes: 10\n permissions:\n contents: read\n steps:\n - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0\n name: Checkout repository\n\n - uses: theholocron/.github/.github/actions/setup@main\n name: Setup\n\n - name: Run holocron sync github\n # No local commit, no branch, no PR — pushes directly to\n # theholocron/.github's own default branch.\n #\n # HOLOCRON_SYNC_TOKEN is scoped to ONLY this step, not the job —\n # \"Setup\" (above) runs this ref's own pnpm install, and the\n # \"Build the workspace\" step this composite action may run (an\n # unbuilt workspace checkout — the holocron repo itself) runs this\n # ref's own build, including any postinstall/build-time script a\n # malicious push could carry. Neither sees a write credential.\n uses: theholocron/.github/.github/actions/holocron@main\n env:\n HOLOCRON_SYNC_TOKEN: ${{ secrets.HOLOCRON_SYNC_TOKEN || secrets.GH_TOKEN }}\n with:\n command: sync github\n";
|
|
307
307
|
// src/templates/reusable/preview.yml
|
|
@@ -1143,6 +1143,7 @@ const TASKS = {
|
|
|
1143
1143
|
},
|
|
1144
1144
|
"platform.repoValidation": {
|
|
1145
1145
|
local: null,
|
|
1146
|
+
retiredJobs: ["registry"],
|
|
1146
1147
|
jobs: {
|
|
1147
1148
|
adrs: {
|
|
1148
1149
|
local: {
|
|
@@ -1151,14 +1152,6 @@ const TASKS = {
|
|
|
1151
1152
|
},
|
|
1152
1153
|
checkContext: "platform.repoValidation / Validate ADRs and specs"
|
|
1153
1154
|
},
|
|
1154
|
-
registry: {
|
|
1155
|
-
local: {
|
|
1156
|
-
tool: "node",
|
|
1157
|
-
args: ["scripts/validate-registry.mjs"]
|
|
1158
|
-
},
|
|
1159
|
-
checkContext: "platform.repoValidation / Validate registry consistency",
|
|
1160
|
-
alias: "packageRegistry"
|
|
1161
|
-
},
|
|
1162
1155
|
docsPresence: {
|
|
1163
1156
|
local: {
|
|
1164
1157
|
tool: "node",
|
|
@@ -1356,12 +1349,15 @@ function turboConfig(config) {
|
|
|
1356
1349
|
if (!turbo) continue;
|
|
1357
1350
|
const extraEnv = validatedGlobList(entry.turbo?.passThroughEnv, entry.name, "passThroughEnv");
|
|
1358
1351
|
const extraInputs = validatedGlobList(entry.turbo?.inputs, entry.name, "inputs");
|
|
1352
|
+
const extraDependsOn = validatedGlobList(entry.turbo?.dependsOn, entry.name, "dependsOn");
|
|
1359
1353
|
const current = tasks[entry.name] ?? turbo;
|
|
1360
1354
|
const passThroughEnv = extraEnv.length > 0 ? [...current.passThroughEnv ?? [], ...extraEnv] : current.passThroughEnv;
|
|
1361
1355
|
const inputs = extraInputs.length > 0 ? [...current.inputs, ...extraInputs] : current.inputs;
|
|
1356
|
+
const dependsOn = [.../* @__PURE__ */ new Set([...current.dependsOn, ...extraDependsOn])];
|
|
1362
1357
|
tasks[entry.name] = {
|
|
1363
1358
|
...turbo,
|
|
1364
1359
|
inputs,
|
|
1360
|
+
dependsOn,
|
|
1365
1361
|
...passThroughEnv && passThroughEnv.length > 0 ? { passThroughEnv } : {}
|
|
1366
1362
|
};
|
|
1367
1363
|
}
|
|
@@ -1668,6 +1664,42 @@ function resolveLinters(opts) {
|
|
|
1668
1664
|
def: LINTERS[name]
|
|
1669
1665
|
}));
|
|
1670
1666
|
}
|
|
1667
|
+
// src/tasks/run/resolve-affected/resolve-affected.ts
|
|
1668
|
+
/** Branches that releases are cut from: on a push to one, HEAD equals the base, so nothing would be "affected". */
|
|
1669
|
+
const RELEASE_BRANCHES = /* @__PURE__ */ new Set(["main", "alpha"]);
|
|
1670
|
+
/**
|
|
1671
|
+
* Decide whether `turbo run` gets `--affected`, and against which base.
|
|
1672
|
+
*
|
|
1673
|
+
* `--affected` is dropped (everything runs, the safe direction) on a push to a
|
|
1674
|
+
* release branch, and when the base ref is missing or not in this checkout —
|
|
1675
|
+
* raw turbo would error on that, a shallow CI clone must not.
|
|
1676
|
+
*/
|
|
1677
|
+
function resolveAffected(input) {
|
|
1678
|
+
if (!input.affected) return { affected: false };
|
|
1679
|
+
const { env, exec, cwd } = input;
|
|
1680
|
+
const branch = env.GITHUB_REF_NAME;
|
|
1681
|
+
if (env.GITHUB_EVENT_NAME === "push" && branch !== void 0 && RELEASE_BRANCHES.has(branch)) return {
|
|
1682
|
+
affected: false,
|
|
1683
|
+
notice: `--affected ignored on a push to ${branch}: running everything`
|
|
1684
|
+
};
|
|
1685
|
+
const base = input.base ?? env.TURBO_SCM_BASE;
|
|
1686
|
+
if (!base) return {
|
|
1687
|
+
affected: false,
|
|
1688
|
+
notice: "--affected ignored: no base given (--base or TURBO_SCM_BASE); running everything"
|
|
1689
|
+
};
|
|
1690
|
+
if (exec("git", [
|
|
1691
|
+
"cat-file",
|
|
1692
|
+
"-e",
|
|
1693
|
+
`${base}^{commit}`
|
|
1694
|
+
], { cwd }).exitCode !== 0) return {
|
|
1695
|
+
affected: false,
|
|
1696
|
+
notice: `--affected ignored: base "${base}" is not in this checkout (fetch more history); running everything`
|
|
1697
|
+
};
|
|
1698
|
+
return {
|
|
1699
|
+
affected: true,
|
|
1700
|
+
env: { TURBO_SCM_BASE: base }
|
|
1701
|
+
};
|
|
1702
|
+
}
|
|
1671
1703
|
// src/tasks/run/resolve-bin/resolve-bin.ts
|
|
1672
1704
|
/** `<cwd>/node_modules/.bin/<tool>` when it exists, else the bare `tool` name (left to `PATH`). */
|
|
1673
1705
|
function resolveBin(cwd, tool, fileExists) {
|
|
@@ -1922,7 +1954,7 @@ function turboDefinesTask(cwd, task, readFile, fileExists) {
|
|
|
1922
1954
|
function makeRunOne(input) {
|
|
1923
1955
|
const { print, logger, exec, task, cwd } = input;
|
|
1924
1956
|
const dryRun = input.dryRun ?? false;
|
|
1925
|
-
return (cmd, args) => {
|
|
1957
|
+
return (cmd, args, env) => {
|
|
1926
1958
|
const command = [cmd, ...args].join(" ");
|
|
1927
1959
|
if (dryRun) {
|
|
1928
1960
|
print(`would run: ${command}`);
|
|
@@ -1937,7 +1969,10 @@ function makeRunOne(input) {
|
|
|
1937
1969
|
};
|
|
1938
1970
|
}
|
|
1939
1971
|
print(`→ ${command}`);
|
|
1940
|
-
const { exitCode } = exec(cmd, args,
|
|
1972
|
+
const { exitCode } = exec(cmd, args, env ? {
|
|
1973
|
+
cwd,
|
|
1974
|
+
env
|
|
1975
|
+
} : { cwd });
|
|
1941
1976
|
const status = exitCode === 0 ? "ok" : "fail";
|
|
1942
1977
|
logger[status === "fail" ? "warn" : "debug"]({
|
|
1943
1978
|
task,
|
|
@@ -1968,6 +2003,19 @@ function runTask(input) {
|
|
|
1968
2003
|
}
|
|
1969
2004
|
if (job !== void 0) {
|
|
1970
2005
|
const jobDef = def.jobs[job];
|
|
2006
|
+
if (!jobDef && def.retiredJobs?.includes(job)) {
|
|
2007
|
+
const message = `${task} ${job} was retired — nothing to run (re-sync the reusable workflows)`;
|
|
2008
|
+
print(`· ${message}`);
|
|
2009
|
+
logger.debug({
|
|
2010
|
+
task,
|
|
2011
|
+
job,
|
|
2012
|
+
status: "skip"
|
|
2013
|
+
}, `run: ${task} ${job}`);
|
|
2014
|
+
return {
|
|
2015
|
+
status: "skip",
|
|
2016
|
+
message
|
|
2017
|
+
};
|
|
2018
|
+
}
|
|
1971
2019
|
if (!jobDef) {
|
|
1972
2020
|
const known = Object.keys(def.jobs).join(", ");
|
|
1973
2021
|
print(`✗ unknown job "${job}" for "${task}" (known: ${known})`);
|
|
@@ -2004,14 +2052,25 @@ function runTask(input) {
|
|
|
2004
2052
|
if (turboDefinesTask(cwd, task, readFile, fileExists)) {
|
|
2005
2053
|
const filterArg = input.filter ? [`--filter=${input.filter}`] : [];
|
|
2006
2054
|
const forwarded = [...def?.local && !def.local.command && def.local.tool ? def.flags?.[def.local.tool] ?? [] : [], ...passthrough];
|
|
2055
|
+
const plan = resolveAffected({
|
|
2056
|
+
affected: input.affected,
|
|
2057
|
+
base: input.base,
|
|
2058
|
+
env: input.env ?? {},
|
|
2059
|
+
exec: input.exec,
|
|
2060
|
+
cwd
|
|
2061
|
+
});
|
|
2062
|
+
if (plan.notice) print(`· ${plan.notice}`);
|
|
2063
|
+
const affectedArg = plan.affected ? ["--affected"] : [];
|
|
2007
2064
|
const args = [
|
|
2008
2065
|
"run",
|
|
2009
2066
|
task,
|
|
2010
2067
|
...filterArg,
|
|
2068
|
+
...affectedArg,
|
|
2011
2069
|
...forwarded.length ? ["--", ...forwarded] : []
|
|
2012
2070
|
];
|
|
2013
|
-
return run(resolveBin(cwd, "turbo", fileExists), args);
|
|
2071
|
+
return run(resolveBin(cwd, "turbo", fileExists), args, plan.env);
|
|
2014
2072
|
}
|
|
2073
|
+
if (input.affected) print("· --affected ignored: this repo has no turbo task for it");
|
|
2015
2074
|
const script = readPackageJsonSync(cwd, { readFile })?.scripts?.[task];
|
|
2016
2075
|
if (script && !/^holocron run\b/.test(script.trim())) return run(detectPackageManager(cwd, {
|
|
2017
2076
|
readFile,
|
|
@@ -2286,7 +2345,10 @@ function runCi(input) {
|
|
|
2286
2345
|
cwd: input.cwd,
|
|
2287
2346
|
dryRun: input.dryRun ?? false,
|
|
2288
2347
|
required: entry.required === true,
|
|
2289
|
-
...input.filter ? { filter: input.filter } : {}
|
|
2348
|
+
...input.filter ? { filter: input.filter } : {},
|
|
2349
|
+
...input.affected ? { affected: true } : {},
|
|
2350
|
+
...input.base ? { base: input.base } : {},
|
|
2351
|
+
...input.env ? { env: input.env } : {}
|
|
2290
2352
|
});
|
|
2291
2353
|
const status = r.status;
|
|
2292
2354
|
jobs.push({
|
|
@@ -2390,7 +2452,11 @@ const defaultSleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
|
2390
2452
|
const realExec = (cmd, args, opts) => {
|
|
2391
2453
|
return { exitCode: spawnSync(cmd, args, {
|
|
2392
2454
|
cwd: opts.cwd,
|
|
2393
|
-
stdio: "inherit"
|
|
2455
|
+
stdio: "inherit",
|
|
2456
|
+
...opts.env ? { env: {
|
|
2457
|
+
...process.env,
|
|
2458
|
+
...opts.env
|
|
2459
|
+
} } : {}
|
|
2394
2460
|
}).status ?? -1 };
|
|
2395
2461
|
};
|
|
2396
2462
|
// src/utils/look-path/look-path.ts
|
|
@@ -2751,7 +2817,10 @@ function runGroup(input) {
|
|
|
2751
2817
|
...jobSwitches(input.config, name),
|
|
2752
2818
|
cwd: input.cwd,
|
|
2753
2819
|
dryRun: input.dryRun ?? false,
|
|
2754
|
-
...input.filter ? { filter: input.filter } : {}
|
|
2820
|
+
...input.filter ? { filter: input.filter } : {},
|
|
2821
|
+
...input.affected ? { affected: true } : {},
|
|
2822
|
+
...input.base ? { base: input.base } : {},
|
|
2823
|
+
...input.env ? { env: input.env } : {}
|
|
2755
2824
|
});
|
|
2756
2825
|
jobs.push({
|
|
2757
2826
|
task: name,
|
|
@@ -2781,6 +2850,7 @@ function createAstromech(options) {
|
|
|
2781
2850
|
listDir: options.listDir ?? ((path) => readdirSync(path)),
|
|
2782
2851
|
lookPath: options.lookPath ?? realLookPath
|
|
2783
2852
|
};
|
|
2853
|
+
const env = options.env ?? process.env;
|
|
2784
2854
|
const items = () => (options.config?.tasks ?? []).map((i) => normalizeTaskEntry(i));
|
|
2785
2855
|
/** The `jobs` switches of a task's entry in the manifest, as a `runTask` input; nothing when it has none. */
|
|
2786
2856
|
const jobSwitchesFor = (task) => {
|
|
@@ -2814,7 +2884,12 @@ function createAstromech(options) {
|
|
|
2814
2884
|
config: options.config,
|
|
2815
2885
|
namespace: task,
|
|
2816
2886
|
dryRun: opts.dryRun ?? false,
|
|
2817
|
-
...opts.filter ? { filter: opts.filter } : {}
|
|
2887
|
+
...opts.filter ? { filter: opts.filter } : {},
|
|
2888
|
+
...opts.affected ? {
|
|
2889
|
+
affected: true,
|
|
2890
|
+
env
|
|
2891
|
+
} : {},
|
|
2892
|
+
...opts.base ? { base: opts.base } : {}
|
|
2818
2893
|
});
|
|
2819
2894
|
return runTask({
|
|
2820
2895
|
...deps,
|
|
@@ -2825,6 +2900,11 @@ function createAstromech(options) {
|
|
|
2825
2900
|
dryRun: opts.dryRun ?? false,
|
|
2826
2901
|
required: opts.required ?? false,
|
|
2827
2902
|
...opts.filter ? { filter: opts.filter } : {},
|
|
2903
|
+
...opts.affected ? {
|
|
2904
|
+
affected: true,
|
|
2905
|
+
env
|
|
2906
|
+
} : {},
|
|
2907
|
+
...opts.base ? { base: opts.base } : {},
|
|
2828
2908
|
...jobSwitchesFor(task)
|
|
2829
2909
|
});
|
|
2830
2910
|
},
|
|
@@ -2832,6 +2912,7 @@ function createAstromech(options) {
|
|
|
2832
2912
|
...deps,
|
|
2833
2913
|
cwd: options.cwd,
|
|
2834
2914
|
config: options.config ?? {},
|
|
2915
|
+
...opts.affected ? { env } : {},
|
|
2835
2916
|
...opts
|
|
2836
2917
|
}),
|
|
2837
2918
|
thinCallers: () => {
|
package/dist/release/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as TasksConfig } from "../schema.type-
|
|
1
|
+
import { r as TasksConfig } from "../schema.type-C-3fZESa.mjs";
|
|
2
2
|
import { defineConfig } from "@theholocron/semantic-release-config";
|
|
3
3
|
/** Runs `git` with `args` in `cwd`, feeding it `input` on stdin, and returns stdout. */
|
|
4
4
|
export type GitRun = (args: string[], input: string, cwd: string) => string;
|
|
@@ -22,7 +22,7 @@ interface TaskEntry {
|
|
|
22
22
|
with?: Record<string, unknown>;
|
|
23
23
|
/**
|
|
24
24
|
* Switch individual sub-jobs of a task off for this repo (`false`), by their registry key or alias:
|
|
25
|
-
* `{ name: "platform.repoValidation", jobs: {
|
|
25
|
+
* `{ name: "platform.repoValidation", jobs: { docsEnforcement: false } }`. A job left out runs. The job's CI
|
|
26
26
|
* check still reports (green, "off in this repo's config"), so a required check never goes missing.
|
|
27
27
|
*/
|
|
28
28
|
jobs?: Record<string, boolean>;
|
|
@@ -46,6 +46,14 @@ interface TaskEntry {
|
|
|
46
46
|
* stay tracked without needing to be repeated here.
|
|
47
47
|
*/
|
|
48
48
|
inputs?: string[];
|
|
49
|
+
/**
|
|
50
|
+
* Extra tasks this one waits for, appended to the registry default's
|
|
51
|
+
* `dependsOn` — for a build the package does not list as a dependency
|
|
52
|
+
* but its task loads anyway (e.g. `staticAnalysis` loading the root
|
|
53
|
+
* ESLint config, which imports a package of the workspace). Turbo
|
|
54
|
+
* syntax: `"<package>#<task>"`, `"^<task>"`.
|
|
55
|
+
*/
|
|
56
|
+
dependsOn?: string[];
|
|
49
57
|
};
|
|
50
58
|
}
|
|
51
59
|
/** A task is either its bare name (all defaults) or an entry object. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/astromech",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.256",
|
|
4
4
|
"description": "The Holocron task runner — one task manifest drives `holocron run`, `holocron run ci`, the CI workflows, package.json scripts, linters, and required checks.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ci",
|
|
@@ -50,18 +50,15 @@
|
|
|
50
50
|
"@commitlint/lint": "^21.2.3",
|
|
51
51
|
"@commitlint/load": "^21.2.3",
|
|
52
52
|
"@commitlint/types": "^21.2.3",
|
|
53
|
-
"@theholocron/datapad": "5.0.0-alpha.
|
|
53
|
+
"@theholocron/datapad": "5.0.0-alpha.256",
|
|
54
54
|
"@theholocron/fs-utils": "^1.16.1-alpha.1",
|
|
55
|
-
"@theholocron/
|
|
56
|
-
"@theholocron/
|
|
55
|
+
"@theholocron/pkg-utils": "^1.16.1-alpha.1",
|
|
56
|
+
"@theholocron/json-utils": "^1.16.1-alpha.1"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@commitlint/config-conventional": "^21.2.3",
|
|
60
60
|
"@semantic-release/commit-analyzer": "^13.0.1",
|
|
61
61
|
"@semantic-release/release-notes-generator": "^14.1.1",
|
|
62
|
-
"@theholocron/commitlint-config": "^8.8.0",
|
|
63
|
-
"@theholocron/eslint-config": "^8.8.2",
|
|
64
|
-
"@theholocron/semantic-release-config": "^8.8.2",
|
|
65
62
|
"@types/node": "^26",
|
|
66
63
|
"@vitest/coverage-v8": "^5.0.5",
|
|
67
64
|
"@vitest/eslint-plugin": "^1.6.27",
|
|
@@ -71,10 +68,13 @@
|
|
|
71
68
|
"tsdown": "^0.23.3",
|
|
72
69
|
"typescript": "^5.9.3",
|
|
73
70
|
"vitest": "^5.0.5",
|
|
71
|
+
"@theholocron/commitlint-config": "^8.9.0-alpha.3",
|
|
74
72
|
"@theholocron/rollup-plugin-transform-template": "^8.9.0-alpha.3",
|
|
73
|
+
"@theholocron/eslint-config": "^8.9.0-alpha.3",
|
|
74
|
+
"@theholocron/semantic-release-config": "^8.9.0-alpha.3",
|
|
75
|
+
"@theholocron/tsconfig": "^8.9.0-alpha.3",
|
|
75
76
|
"@theholocron/tsdown-config": "^8.9.0-alpha.3",
|
|
76
|
-
"@theholocron/vitest-config": "^8.9.0-alpha.3"
|
|
77
|
-
"@theholocron/tsconfig": "^8.9.0-alpha.3"
|
|
77
|
+
"@theholocron/vitest-config": "^8.9.0-alpha.3"
|
|
78
78
|
},
|
|
79
79
|
"peerDependencies": {
|
|
80
80
|
"@semantic-release/commit-analyzer": "^13",
|