@theholocron/astromech 5.0.0-alpha.48 → 5.0.0-alpha.481

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/index.d.mts CHANGED
@@ -1,41 +1,604 @@
1
- import { r as TasksConfig } from "./schema-D01VYg43.mjs";
2
- //#region src/run.d.ts
3
- /**
4
- * `holocron run <task> [job] [-- <passthrough>]` — run a registry task (or one
5
- * of its sub-jobs) locally.
6
- *
7
- * A `job` argument only applies to tasks that declare `jobs`; for any other
8
- * task it is folded back into the passthrough (`holocron run delivery.build
9
- * src/`).
10
- *
11
- * Resolution:
12
- *
13
- * J. job given → TASKS[task].jobs[job].local (unknown job → exit 1)
14
- * 1. turbo.json defines the task → `turbo run <task>`
15
- * 2. package.json has a `<task>` script → `<pm> run <task>`
16
- * (unless it's the `holocron run …` thin caller — that recurses)
17
- * 3. TASKS[task].local resolves → `<tool> <args> <org-flags> <passthrough>`
18
- * 3b. TASKS[task].linterGroup → run each resolved linter natively (see below)
19
- * 4. TASKS[task].jobs has entries → run each job in declared order
20
- * 5. TASKS[task].local === null → "enforced in CI" (skip, even with --required)
21
- * 5b. known task, nothing resolved → "no <task> task" (exit 0, or 1 with --required)
22
- * 6. unknown task → "unknown task" (exit 1)
23
- *
24
- * A `linterGroup` task (`sourceQuality.staticAnalysis`, etc.) runs its fixed
25
- * set of `linters.ts` entries, each still gated by that linter's own
26
- * `detect`/`always` rule — every entry runs its `localBin` natively when
27
- * found on PATH. Missing tools are flagged; the exit code is the worst of
28
- * the lot. Unlike the old single `lint` task, this check runs *after*
29
- * turbo/`package.json` resolution (step 3b, not step 0) — a `linterGroup`
30
- * task is a normal turbo-delegatable task like any other.
1
+ /**
2
+ * `@theholocron/astromech` — the Holocron task runner.
3
+ *
4
+ * An astromech droid runs a starfighter's maintenance, diagnostics and
5
+ * system wiring while the pilot flies. This does that for a repo: one
6
+ * task manifest drives `holocron run` (local), `holocron run ci` (the CI
7
+ * suite locally), the generated GitHub Actions workflows, the
8
+ * `package.json` scripts, the linter set, and the required-checks list.
9
+ *
10
+ * A plain library — not a capability plugin. `@theholocron/cli` depends
11
+ * on it and instantiates it once.
12
+ *
13
+ * ```ts
14
+ * import { createAstromech } from "@theholocron/astromech";
15
+ *
16
+ * const astromech = createAstromech({ cwd });
17
+ * const report = astromech.run("test", { passthrough: ["--watch"] });
18
+ * ```
19
+ *
20
+ * The config surface (`defineConfig`, `TasksConfig`, `loadTasksConfig`)
21
+ * lives in the zero-runtime-dep `@theholocron/astromech/config` subpath.
22
+ */
23
+ import { r as TasksConfig } from "./schema.type-Cg6I1dCc.mjs";
24
+ /** A commit status a coverage provider reports on a pull request (names only), as `Coverage.statusContexts()` returns it. */
25
+ interface StatusContext {
26
+ /** The context GitHub shows, such as `codecov/patch`. */
27
+ name: string;
28
+ /** Whether the `ci` aggregate (and a ruleset) must see it reach `success`. */
29
+ required: boolean;
30
+ }
31
+ /** What the `ci` aggregate check waits on, as the two inputs of its reusable workflow. */
32
+ interface AggregateChecks {
33
+ /**
34
+ * Check ids: each must have a check run named `<id> / ...`. The part of a check context before its first ` / `
35
+ * (the caller job's name), so a renamed called job or a matrix label cannot break the match.
36
+ */
37
+ expected: string[];
38
+ /** Commit-status contexts (`codecov/patch`, ...) that must reach `success`. */
39
+ statuses: string[];
40
+ }
41
+ /**
42
+ * The `expected` ids and `statuses` the `ci` aggregate waits on, derived from the same list `requiredChecks()` read
43
+ * before the aggregate: every `required: true` task, then the `extraRequiredChecks`. `DCO` is left out because it stays
44
+ * its own required context. The ids are the callers' job names, which GitHub puts before the " / " of each check they post.
45
+ *
46
+ * Commit statuses go to `statuses`, polled through the status API. With `statusContexts` (what a `coverage` provider
47
+ * reports) a context is a status when the provider names it, and the provider's required ones are added; without it, a
48
+ * context is a status when it starts with `codecov/`.
49
+ */
50
+ export declare function aggregateChecks(config: TasksConfig, statusContexts?: readonly StatusContext[]): AggregateChecks;
51
+ /**
52
+ * Where the reusable workflows and composite actions that every generated workflow calls are hosted, and at which ref.
53
+ * This is the only place that says so: the templates are written against the spelling in {@link TEMPLATE_HOME}, and
54
+ * {@link rehome} rewrites it to {@link CI_HOME} once, where the template maps are built. Moving the home is a change
55
+ * to {@link CI_HOME} alone (spec `tech-workflows-in-holocron`, issue #1474).
56
+ */
57
+ /** The base path of a hosted workflow or action, without its name: `<owner>/<repo>/<dir>`, and the ref to run it at. */
58
+ interface CiHome {
59
+ /** Base of the reusable workflows; a name and `.yml` follow. */
60
+ workflows: string;
61
+ /** Base of the composite actions; a name follows. */
62
+ actions: string;
63
+ /** The git ref every reference is pinned to. */
64
+ ref: string;
65
+ }
66
+ /**
67
+ * The org slug a CLI user gets when no config names one. Where a resolved config is in reach, `config.org` is the
68
+ * source and this is only the fallback; a command with no config (`new repo`, `sync github`, `publish --sync-trust`)
69
+ * uses it as it is.
70
+ */
71
+ export declare const DEFAULT_ORG = "theholocron";
72
+ /** The `owner/repo` of the org's `.github` repo, which hosts the frozen reusable workflows (and Sentinel's dispatch target). */
73
+ export declare const DOT_GITHUB_REPO = "theholocron/.github";
74
+ /** The `owner/repo` of this monorepo, where the CLI, the reusables' sources and the Trusted Publisher config live. */
75
+ export declare const HOLOCRON_REPO = "theholocron/holocron";
76
+ /** How the templates spell a reference. Never emitted as it is, and never to be changed: {@link rehome} reads it. */
77
+ export declare const TEMPLATE_HOME: CiHome;
78
+ /**
79
+ * Whether a caller that calls its reusables at `home` keeps the names it had before they became the task id (the
80
+ * legacy-name gate): while 'home' is the frozen copies on `main`, the callers of a repo other than the one that hosts
81
+ * the reusables keep their old workflow, job and file names, because their rulesets list the checks those post. `ci-v1`
82
+ * has only flat names, so the gate is open there and every caller is flat (spec `ci-flat-task-vocabulary`, phase K).
83
+ */
84
+ export declare function legacyGate(home?: CiHome): boolean;
85
+ /**
86
+ * `text` with every reference to a hosted reusable workflow at `home` rewritten to the file in the same checkout
87
+ * (`./.github/workflows/<name>.yml`, always the flat name, whichever spelling the reference had). For the repo that hosts the reusables: its own callers then run the reusable at
88
+ * their own commit, so a PR that edits one exercises it. Composite actions are left on their full ref, because a
89
+ * reusable called from another repository cannot see this checkout.
90
+ */
91
+ export declare function localize(text: string, home?: CiHome): string;
92
+ /**
93
+ * `text` with each reference to a hosted composite action in `names` at `home` rewritten to its folder in the same
94
+ * checkout (`./ci/actions/<name>`). For the written copy of a reusable in the repo that hosts it, which only that
95
+ * repo's own callers run: a change to the action then takes effect at the PR's own commit, instead of waiting for
96
+ * the frozen copy in `theholocron/.github` that `home` still names. An action not in `names` keeps its full ref.
97
+ */
98
+ export declare function localizeActions(text: string, names: readonly string[], home?: CiHome): string;
99
+ /**
100
+ * How strictly a repo enforces doc-comment coverage of its public API (`repoValidation.docsCoverage`, spec
101
+ * `tech-api-docs`): `off` (the default) does nothing, `warn` reports without failing and posts informational Codecov
102
+ * statuses, `required` fails the check and posts statuses that are not informational.
103
+ */
104
+ type DocsCoverageMode = "off" | "warn" | "required";
105
+ /** A workspace package as the flag, upload and component lists see it: the flag and component it gets, and where it lives. */
106
+ interface WorkspacePackage$1 {
107
+ /** The package's folder name, used as its Codecov flag and component id. */
108
+ slug: string;
109
+ /** The package's npm name. */
110
+ name: string;
111
+ /** The workspace root the package was discovered under (`packages`, `apps`, `clients`, ...). Defaults to `"packages"`. */
112
+ dir?: string;
113
+ /**
114
+ * Repo-relative directory, set when it is not `<dir>/<slug>` -- a package that
115
+ * is itself a workspace folder (`observability`) or sits deeper (`docs/theme`).
116
+ */
117
+ path?: string;
118
+ }
119
+ /** The Codecov flag the Docs coverage workflow uploads doc-comment coverage as (`holocron probe docs --lcov`). */
120
+ export declare const DOCUMENTATION_FLAG = "documentation";
121
+ /** Where a package lives, relative to the repo root: its `path`, else `<dir>/<slug>` (`dir` defaults to `packages`). */
122
+ export declare function packageLocation({ slug, dir, path }: WorkspacePackage$1): string;
123
+ /**
124
+ * One Codecov flag per workspace package (its slug, the same name as its
125
+ * component), in package order, without `docs`. A flag per package, not per
126
+ * group folder: Codecov carries a flag forward whole or not at all, so a run that
127
+ * tests one package of a group would otherwise drop the group's other packages.
128
+ */
129
+ export declare function codecovFlagNames(packages: WorkspacePackage$1[]): string[];
130
+ /**
131
+ * The `uploads` input of the `verification.unitTests` workflow: a JSON list of `{ flag, files }`, one per package
132
+ * that has a flag. `files` is where the package writes its lcov report (`<location>/coverage/lcov.info`), unless
133
+ * `lcovPaths` names another for that slug (a package whose test runner writes it elsewhere).
134
+ */
135
+ export declare function codecovUploads(packages: WorkspacePackage$1[], lcovPaths?: Record<string, string>): string;
136
+ /**
137
+ * Every package the repo's `pnpm-workspace.yaml` declares (the default roots
138
+ * when it declares none), sorted by location, so each group folder (`cli/`, `plugins/`, ...) stays together. Every one needs a
139
+ * codecov component so `codecov/patch/<slug>` actually posts for each. A
140
+ * package at `<root>/<slug>` carries `dir: <root>`; one that is itself a
141
+ * workspace folder (`observability`) or sits deeper (`docs/theme`) carries its
142
+ * `path`. Two packages with the same folder name are told apart by their full
143
+ * path (`docs-theme`). `[]` when there are none.
144
+ */
145
+ export declare function readWorkspacePackages(repoRoot: string): WorkspacePackage$1[];
146
+ /**
147
+ * The **reusable** GitHub Actions surface pushed to `theholocron/.github` by
148
+ * `holocron sync github` — the `workflow_call` implementations and composite
149
+ * actions that every repo's thin callers delegate to.
150
+ *
151
+ * `theholocron/.github` is a **pure sync target**: `.github/workflows/*`,
152
+ * `.github/actions/*` and `workflow-templates/*` there are generated from the
153
+ * `.yml` files in `ci/` (`@theholocron/ci`) and pushed verbatim (with a
154
+ * "do not edit" header). Never hand-edit them in `.github`.
155
+ *
156
+ * Not to be confused with `WORKFLOW_TEMPLATES` in `github-action-thin-callers.ts` — those are
157
+ * the *thin-caller bases* written into each consumer repo's `.github/workflows/`.
158
+ */
159
+ /**
160
+ * The workflows by task id (`test:unit`): a hosting repo writes one as `.github/workflows/<workflowFile(id)>` and
161
+ * `theholocron/.github` holds the frozen copy under its old name ({@link legacyFile}).
162
+ */
163
+ export declare const REUSABLE_WORKFLOWS: Record<string, string>;
164
+ /**
165
+ * The reusables a repo that hosts them keeps in its own `.github/workflows`, by id: the ones that only run when
166
+ * another workflow calls them. A reusable that is also started by an event or by hand (`tag`, `sync-dispatch`)
167
+ * would become a live workflow of the hosting repo, and runs where it is dispatched, so
168
+ * it stays out (spec `tech-workflows-in-holocron`, #1216).
169
+ */
170
+ export declare function hostedReusableWorkflows(): Map<string, string>;
171
+ /** Composite actions → `.github/actions/<name>/action.yml` (key includes `/action`). */
172
+ export declare const REUSABLE_ACTIONS: Record<string, string>;
173
+ /** GitHub starter-workflow metadata → `workflow-templates/<name>.properties.json`. */
174
+ export declare const WORKFLOW_TEMPLATE_PROPERTIES: Record<string, string>;
175
+ /**
176
+ * The complete file batch `holocron sync github` pushes to `theholocron/.github`:
177
+ * path → content. YAML gets the "do not edit" header; the starter-workflow
178
+ * `.properties.json` files are left bare (native JSON, not a commented file).
179
+ */
180
+ export declare function reusableTemplates(): Map<string, string>;
181
+ /**
182
+ * The files in `theholocron/.github` that moved to holocron and are frozen: every reusable workflow
183
+ * {@link hostedReusableWorkflows} hosts, and every composite action. `holocron sync github` stops pushing them and
184
+ * stamps each once with {@link stampDeprecated}; repos still calling them keep working, and the copies never change
185
+ * again. (A forwarding shim would nest a job and rename every required check of its callers, so the copies are
186
+ * frozen instead; spec `tech-workflows-in-holocron`, issue #1477.)
187
+ */
188
+ export declare function frozenReusablePaths(): string[];
189
+ /** Whether `content` already carries the deprecation notice. */
190
+ export declare function isDeprecated(content: string): boolean;
191
+ /**
192
+ * `content` of a frozen file with the deprecation notice added below its AUTO-GENERATED header: what it was replaced
193
+ * by, the removal condition and the tracking issue. Already stamped content is returned as it is.
194
+ */
195
+ export declare function stampDeprecated(content: string, path: string): string;
196
+ /** Where a repo's pull-request previews are deployed. */
197
+ interface PreviewConfig {
198
+ /** Cloudflare Pages project name shared across all repos for previews. */
199
+ project: string;
200
+ /**
201
+ * Base domain for preview URLs (e.g. `"preview.theholocron.dev"`).
202
+ * When set, `holocron setup` automatically provisions:
203
+ * - Cloudflare Pages custom domain `*.<domain>` on the project
204
+ * - DNS wildcard CNAME `*.<domain>` → `<project>.pages.dev`
205
+ *
206
+ * Preview URLs resolve as `<repo>-pr-<n>.<domain>`.
207
+ */
208
+ domain?: string;
209
+ }
210
+ /** Org-level context used to derive preview defaults from `preview: true`. */
211
+ interface OrgContext {
212
+ /** GitHub org name — becomes the prefix of the default project: `<org>-preview`. */
213
+ org?: string;
214
+ /** Org canonical domain — becomes `preview.<domain>` for the default preview domain. */
215
+ domain?: string;
216
+ /** Project name — injected as the `name` input to the deploy reusable when `docs: true`. */
217
+ repoName?: string;
218
+ }
219
+ /**
220
+ * The reusable-workflow thin-caller templates, by task id. A template's id is its path under `templates/workflows/`
221
+ * (`lint/code.yml` is `lint:code`, see `idFromSource`). The workflow `name:`, the job id and the job `name:` of each are
222
+ * the id (see `legacyCaller` for the names they had before).
223
+ */
224
+ export declare const WORKFLOW_TEMPLATES: Record<string, string>;
225
+ /** The task names that have a thin-caller workflow template. */
226
+ export declare const KNOWN_WORKFLOWS: Set<string>;
227
+ /**
228
+ * The GitHub status-check context a `required` task contributes, by task id. Format: `"{caller job name} / {called job
229
+ * name}"`, and the caller job name is the id, so the `ci` aggregate (which waits for a check starting with `<id> / `)
230
+ * reads the id from the part before the slash.
231
+ *
232
+ * Most of these are single-job workflows (D3's decomposition split what used to be multi-job `lint`/`audit` into one
233
+ * task per concern), so the context names that job directly; a single job's own conclusion already *is* the workflow's
234
+ * conclusion. `Conclusion` fan-in jobs are kept only where a task has several conditionally-run jobs feeding one
235
+ * check: `test:unit` (unit / Storybook / Chromatic / interaction / user-flow, each gated by its own `run-*` input).
236
+ * `format` has no workflow of its own: its check is a step of `lint:code` (the `ci/actions/format` action), so it is
237
+ * listed under that. Only merge-gating workflows are listed.
238
+ * `astromech.requiredChecks()` reads this for every `required` task.
239
+ */
240
+ export declare const WORKFLOW_CHECK_CONTEXTS: Partial<Record<string, string>>;
241
+ /**
242
+ * Generate the thin caller content for a workflow, optionally injecting or
243
+ * merging `with:` overrides into the jobs block.
244
+ *
245
+ * Two strategies are used depending on the template:
246
+ * - Templates that already have a `with:` block (e.g. lint):
247
+ * the override entries are merged in, replacing existing keys and appending
248
+ * new ones.
249
+ * - Templates that end with ` secrets: inherit`: a new `with:` block is
250
+ * injected immediately before `secrets: inherit`.
251
+ * If neither pattern matches the template, a warning is emitted and the
252
+ * base template is returned unchanged.
253
+ */
254
+ export declare function generateThinCallerContent(name: string, withOverrides?: Record<string, unknown>, additionalPaths?: string[],
255
+ /** Optional sink for the "could not inject `with:`" warning. */
256
+ logger?: {
257
+ warn(obj: Record<string, unknown>, msg: string): void;
258
+ },
259
+ /**
260
+ * `with:` key → a `# comment` line rendered immediately above that entry.
261
+ * Only honored when injecting a fresh `with:` block (no template today
262
+ * ships one), which is the path `lint` takes.
263
+ */
264
+ comments?: Record<string, string>): string;
265
+ /**
266
+ * Extract the Cloudflare Pages preview config from a deploy workflow's `with:` object.
267
+ *
268
+ * Accepts three forms:
269
+ * - `preview: true` — derive both project and domain from org context
270
+ * - `preview: { project: "..." }` — explicit project; domain derived from context if omitted
271
+ * - `preview: { project: "...", domain: "..." }` — fully explicit
272
+ *
273
+ * Returns null when `preview:` is absent, false, or can't be resolved.
274
+ */
275
+ export declare function extractPreviewConfig(raw: Record<string, unknown>, ctx?: OrgContext): PreviewConfig | null;
276
+ /**
277
+ * Generate the full thin-caller YAML for a `deploy.yml` that handles both
278
+ * production (push to main → GitHub Pages) and preview (pull_request →
279
+ * Cloudflare Pages) in a single file.
280
+ *
281
+ * Both jobs receive the same docs/storybook `with:` inputs. If the per-repo
282
+ * config supplies `cloudflare-project` it is forwarded; otherwise the reusable
283
+ * falls back to the `CLOUDFLARE_PAGES_PROJECT` org variable (filled from the 1Password sync) — set that once and
284
+ * all repos with a `deploy` workflow get previews without per-repo config.
285
+ */
286
+ export declare function generateCombinedDeployContent(deployWith: Record<string, unknown>, paths: string[], preview: Pick<PreviewConfig, "project">,
287
+ /** The task id the caller is for: the workflow name, and the name of both jobs (`deploy`, `deploy-docs`, `deploy-components`). */
288
+ id?: string): string;
289
+ /**
290
+ * Expand structured with-values to flat GitHub Actions inputs before
291
+ * generating the thin caller. Handles:
292
+ * - deploy shorthand: docs/storybook → type + storybook-projects
293
+ * - preview: stripped (handled separately via extractPreviewConfig)
294
+ * - chromatic-projects entries' untraced array → newline-joined string
295
+ * - plain arrays → JSON-stringified for YAML scalar quoting
296
+ *
297
+ * Used by both `holocron setup` and `sync-workflow-templates`.
298
+ */
299
+ export declare function normalizeWorkflowWith(raw: Record<string, unknown>): Record<string, unknown>;
300
+ /**
301
+ * Derive on.push.paths entries from the deploy with: shorthand.
302
+ * Used by both `holocron setup` and `sync-workflow-templates`.
303
+ */
304
+ export declare function deriveDeployPaths(raw: Record<string, unknown>): string[];
305
+ /**
306
+ * The context of the aggregate check: the caller's job (`ci`) and the called job (`Required checks`), as GitHub joins
307
+ * them for a reusable workflow.
308
+ */
309
+ export declare const AGGREGATE_CHECK = "ci / Required checks";
310
+ /**
311
+ * The context of the DCO check: Sentinel's `validate:dco / Run Developer Certificate of Origin`. It replaced the probot DCO
312
+ * app's `DCO` (#1044). Required on its own, outside the aggregate.
313
+ */
314
+ export declare const DCO_CHECK = "validate:dco / Run Developer Certificate of Origin";
315
+ /** Ordered, de-duplicated. */
316
+ export declare function requiredChecks(config: TasksConfig, aggregate: boolean, statusContexts?: readonly StatusContext[]): string[];
317
+ /** Where a `package.json` sits in the repo: the root (which holds the suite scripts) or any other package. */
318
+ type PackageRole = "root" | "package";
319
+ /** One thing wrong with a script. `warn` is a deprecated spelling accepted for a window; `fail` breaks a rule. */
320
+ interface PackageScriptProblem {
321
+ /** `warn` is allowed for now; `fail` breaks the build. */
322
+ level: "warn" | "fail";
323
+ /** The script name the problem is about. */
324
+ script: string;
325
+ /** What is wrong and what to use instead. */
326
+ message: string;
327
+ }
328
+ /**
329
+ * The rule violations in one `package.json`'s `scripts` (spec `ci-flat-task-vocabulary`, "The recursion hazard" and "The
330
+ * check that keeps them aligned"):
331
+ *
332
+ * - a script named like an npm or pnpm lifecycle word (`publish`, `install`, …), except the root's `prepare` (husky);
333
+ * - a script named like a suite (`test`, `lint`, `scan`) in a package: a suite is a turbo task with no script, and a
334
+ * package's own would be run by `turbo run test` as well as the aggregator. The root holds the suite scripts;
335
+ * - a leaf script that calls `turbo run` or `holocron run` in a package: it must hold the real tool command, or turbo
336
+ * would run it, and it would run turbo again;
337
+ * - a script that looks like a suite member but is none (`test:unt`), other than a known variant;
338
+ * - a script named by a task id's hyphen spelling (`deploy-preview`) where the script spelling takes a colon
339
+ * (`deploy:preview`): `holocron run` looks the script up by the script spelling, so the task would find none and be
340
+ * skipped as "enforced in CI" (#1929);
341
+ * - an old dotted task name, as a `warn` while those are accepted.
342
+ */
343
+ export declare function checkPackageScripts(scripts: Readonly<Record<string, string>>, role: PackageRole): PackageScriptProblem[];
344
+ /** The scripts of a `package.json` after the generated ones are merged in. */
345
+ interface MergedScripts {
346
+ /** `existing` with the generated scripts set. */
347
+ scripts: Record<string, string>;
348
+ /** The names that were added or rewritten, sorted. */
349
+ changed: string[];
350
+ }
351
+ /**
352
+ * `true` for a script body this tool writes: a `turbo run …` call or a `holocron run … --` wrapper. Both call back into
353
+ * the task machinery, so neither may stand for a package's own command (a root that is itself a package would loop).
354
+ */
355
+ export declare function isGeneratedScript(command: string): boolean;
356
+ /**
357
+ * `existing` with `desired` set, key by key; every other script is left alone. `turboKeys` are the keys the repo's
358
+ * `turbo.json` fans out (#747): for those, and for any script whose desired body is `turbo run …`, an existing script
359
+ * that is not itself generated is left untouched. Root may be a directly buildable package with its own real command
360
+ * (`tsc --noEmit`, `vitest run`) for that task, and overwriting it would send turbo into the root script, which calls
361
+ * turbo again, forever. Every other key is generator-owned: a hand edit of it is drift.
362
+ */
363
+ export declare function mergeScripts(existing: Readonly<Record<string, string>>, desired: Readonly<Record<string, string>>, turboKeys: ReadonlySet<string>): MergedScripts;
364
+ /** How to run one task locally. */
365
+ interface LocalRunner {
366
+ /** Binary to invoke — resolved from `node_modules/.bin` then PATH. */
367
+ tool?: string;
368
+ /** Args appended after the tool. */
369
+ args?: string[];
370
+ /** First entry whose `when` filename matches a repo-root file wins. */
371
+ detect?: Array<{
372
+ when: RegExp;
373
+ tool: string;
374
+ args?: string[];
375
+ }>;
376
+ /** The task is already a holocron subcommand (`sync`, `sync-wiki`). */
377
+ command?: string;
378
+ }
379
+ /**
380
+ * How a task fans out across every workspace via Turborepo — content-hash
381
+ * caching + `^`-prefixed cross-package ordering, epic #672 D9 (#681).
382
+ * Present only on tasks that genuinely run *per workspace* (a real build/
383
+ * compile/test step); whole-repo single-run tools (prettier, gitleaks,
384
+ * commitlint, yamllint, …) have no entry here — they stay off turbo.json
385
+ * entirely and run once, un-fanned-out, the way they already do.
386
+ */
387
+ interface TurboTaskConfig {
388
+ /** Glob patterns turbo hashes to decide whether a cached run is still valid. */
389
+ inputs: string[];
390
+ /** Glob patterns turbo caches/restores after a run. Empty array for a task with no build artifact (lint, typecheck). */
391
+ outputs: string[];
392
+ /** Task names this depends on — a bare name runs in this package first; `^name` waits on every upstream workspace's task. */
393
+ dependsOn: string[];
394
+ }
395
+ /** The six intent groups. They survive only as documentation and `--help` grouping. */
396
+ type TaskGroup = "Verification" | "Source Quality" | "Security" | "Delivery" | "Platform" | "Knowledge";
397
+ /** Where a task runs: once per package that has it, or once at the repo root. */
398
+ type TaskScope = "package" | "repo";
399
+ /**
400
+ * One registry task: its built-in runner (`local`) and its
401
+ * Turborepo fan-out. `holocron run <task>` and `holocron run ci` start from this definition.
402
+ */
403
+ interface TaskDef {
404
+ /** The intent group: documentation and `--help` grouping only. It is no longer part of any name. */
405
+ group: TaskGroup;
406
+ /**
407
+ * `package` — runs in each package that has the script (turbo-delegated); `repo` — runs once at the root (a linter
408
+ * group, a probe, a workflow). `holocron run <suite>` from a package directory runs only the package-scoped members.
409
+ */
410
+ scope: TaskScope;
411
+ /**
412
+ * The suite this task is a leaf of (`test` for `test:unit`). A suite is declared here, by its leaves; it is never a
413
+ * task id of its own, and `holocron run <suite>` runs the repo's configured members in registry order.
414
+ */
415
+ suite?: string;
416
+ /**
417
+ * Args that replace {@link LocalRunner.args} when `--check` is given, for a task that writes by default (`format`):
418
+ * `holocron run format --check` runs `prettier --check .` instead of `prettier --write .`.
419
+ */
420
+ checkArgs?: string[];
421
+ /** `false` — the task has no workflow of its own, so no thin caller is generated for it (`format`). */
422
+ workflow?: false;
423
+ /**
424
+ * The id of the workflow that runs this task's check, for a task with no workflow of its own: `format` is checked
425
+ * by an action that `lint:code` calls, so its host is `lint:code`.
426
+ */
427
+ host?: string;
428
+ /**
429
+ * `null` — the registry has no built-in runner (CodeQL, deploys, the
430
+ * bundle-size job). An explicit turbo task or `package.json` script still
431
+ * runs (resolution steps 1–2); with neither, `holocron run` does nothing
432
+ * and `holocron run ci` skips it — never a failure, even when the task is
433
+ * `required` (a CI-only check isn't a local one).
434
+ */
435
+ local: LocalRunner | null;
436
+ /**
437
+ * This task is a linter-group aggregate: `holocron run <task>` resolves
438
+ * this fixed set of `linters.ts` entries (still gated by each linter's
439
+ * own `detect`/`always` rule) and runs each natively, instead of using
440
+ * `local`. Replaces the old single `lint` task's auto-detected linter
441
+ * list (`config.tasks[].linters`) — a repo's choice of which of these
442
+ * run is now just whether it includes this task in `tasks: [...]`, same
443
+ * as any other task. See `linters.ts` / `run.ts`.
444
+ */
445
+ linterGroup?: string[];
446
+ /** Carries a `preview` mode (Cloudflare/Vercel deploy, npm dist-tag, Fern preview docs, …). Cross-cutting, not its own task. */
447
+ preview?: boolean;
448
+ /** Turborepo fan-out config for this task — see {@link TurboTaskConfig}. Omitted for whole-repo, non-fan-out tasks. */
449
+ turbo?: TurboTaskConfig;
450
+ }
451
+ /**
452
+ * The task registry — how each task runs *locally*, without GitHub
453
+ * Actions. `holocron run <task>` and `holocron run ci` resolve against this;
454
+ * adding a task here gives every repo that task.
455
+ *
456
+ * Keyed by the flat, verb-first id (`test:unit`, `lint:code`, `build`,
457
+ * `deploy-preview`), the one spelling of a task in the CLI (spec
458
+ * `ci-flat-task-vocabulary`, SPEC-0064, epic #1612). A colon means "member of
459
+ * the suite named before it": `test`, `lint`, `scan`,
460
+ * `validate` and `measure` are suites, declared here by the `suite` field of their leaves
461
+ * and never ids of their own. A hyphen is part of a verb phrase and implies no
462
+ * suite. The old dotted names (`verification.unitTests`, …) are accepted for a
463
+ * window through {@link LEGACY_NAMES} and still name the generated workflow
464
+ * files, turbo tasks and `package.json` scripts until the later phases move
465
+ * those (see {@link legacyName}).
466
+ *
467
+ * Every other artifact (`KNOWN_TASKS`, `CI_ORDER`, the suites) derives from
468
+ * these keys rather than hand-duplicating them — including the GitHub App
469
+ * (#679), which imports this same table for config-schema validation.
470
+ *
471
+ * Declared order is run order: a suite runs its members in the order they
472
+ * appear here.
473
+ *
474
+ * Task names are an intent-facing vocabulary, not tool names —
475
+ * `eslint`/`vitest`/`tsdown`/… stay internal to this file and the `configs/`
476
+ * folder.
477
+ *
478
+ * Spec: `.notes/ci-flat-task-vocabulary.spec.md`, and
479
+ * `docs/wiki/specifications/tech-astromech-task-runner.spec.md` (epic #581).
480
+ */
481
+ export declare const TASKS: Record<string, TaskDef>;
482
+ /**
483
+ * The order `holocron run ci` runs tasks in — cheapest / fastest signal first, so
484
+ * an agent or a `pre-push` hook fails early. Tasks not listed here run last, in
485
+ * manifest order. (The generated thin callers carry no `needs:` — cross-workflow
486
+ * ordering lives in `theholocron/.github` — so `holocron run ci` declares its own.)
487
+ */
488
+ export declare const CI_ORDER: string[];
489
+ /**
490
+ * How a runnable task reaches a script in a repo with a `turbo.json`:
491
+ *
492
+ * - `turbo`: fans out over the packages (`turbo run <key>`), each running its own script of that name;
493
+ * - `tool`: a repo-scoped leaf whose root script holds the registry's own command, run once at the root;
494
+ * - `cli`: runnable only through `holocron run` (a holocron subcommand, a set of sub-jobs, a tool picked by what the
495
+ * repo contains, a linter group with no local binary), so a turbo repo has no script for it.
496
+ */
497
+ type PlannedKind = "turbo" | "tool" | "cli";
498
+ /** One flat task id a manifest entry stands for and the repo can run locally. */
499
+ interface PlannedTask {
500
+ /** The manifest entry that listed it (`verification.unitTests`, or `test:unit` itself). */
501
+ entry: string;
502
+ /** The flat id. */
503
+ id: string;
504
+ /** The root script's name: the id in its script spelling (`deploy-preview` is `deploy:preview`). */
505
+ script: string;
506
+ /** The key in `turbo.json` and the package scripts: follows the entry's spelling (see `taskKey`). */
507
+ key: string;
508
+ /** How the task reaches a script: through turbo, a root tool script, or only the CLI. */
509
+ kind: PlannedKind;
510
+ /** The root script's body for a `tool` leaf. */
511
+ command?: string;
512
+ }
513
+ /**
514
+ * The tasks a manifest can run locally, once per flat id, in manifest order: what `scriptsFor` and the `turbo.json`
515
+ * generator both read, so a root script and the turbo task it calls never disagree.
516
+ *
517
+ * `local: null` alone means there is genuinely no local equivalent (CodeQL, a deploy); a `linterGroup`
518
+ * task still runs through `holocron run`. An entry with `local: false` is left out, and so is an id the registry does
519
+ * not know.
520
+ */
521
+ export declare function planTasks(config: TasksConfig, registry: Record<string, TaskDef>): PlannedTask[];
522
+ /**
523
+ * The suites of a plan with the planned leaves that take part in them, in registry (run) order. Only a leaf a turbo
524
+ * repo has a script for counts (`turbo` and `tool`); a suite none of whose configured leaves has one is not in the map,
525
+ * so no aggregator task and no root script exists for it.
526
+ */
527
+ export declare function planSuites(planned: readonly PlannedTask[], registry: Record<string, TaskDef>): Map<string, PlannedTask[]>;
528
+ /** The facts about a repo that decide what its scripts call. */
529
+ interface RepoShape {
530
+ /**
531
+ * `true` for a workspace whose `turbo.json` is generated (holocron, the monorepo templates): its root scripts call
532
+ * `turbo run` directly, because the `holocron` bin may not exist yet on a fresh clone and turbo is an ordinary
533
+ * devDependency. `false` for a single package, whose scripts call `holocron run`.
534
+ */
535
+ monorepo: boolean;
536
+ }
537
+ /**
538
+ * The `package.json` scripts a manifest asks for, by name: the one rule that `sync` writes, `probe generated
539
+ * check` compares against, and the `turbo.json` generator agrees with (spec `ci-flat-task-vocabulary`, "Scripts").
540
+ * `holocron` and `prepare` are not tasks and are added by the caller.
541
+ *
542
+ * A repo with a generated `turbo.json` ({@link RepoShape.monorepo}) gets root scripts that call turbo:
543
+ * `turbo run <key>` for a package-scoped leaf and for each suite (an aggregator task), and, for a repo-scoped leaf with
544
+ * a local tool, the tool's own command (`prettier --write .`), because `turbo run <id>` would call itself. A leaf with no
545
+ * local command has no script. The key a leaf has in turbo follows the manifest entry's spelling.
546
+ *
547
+ * A single package gets `holocron run <words> --` for every task it can run locally; the trailing `--` is there because
548
+ * pnpm appends arguments as typed, and `holocron run` would otherwise reject a flag meant for the tool. An entry written
549
+ * with an old dotted name keeps its old script, named as the entry is, and no suite scripts, until the list is
550
+ * rewritten with flat ids.
551
+ */
552
+ export declare function scriptsFor(config: TasksConfig, registry?: Record<string, TaskDef>, repo?: RepoShape): Record<string, string>;
553
+ /** Options for a package's generated `tsconfig.json`. */
554
+ interface TsconfigOptions {
555
+ /** Human-readable name for the `display` field — the package's own name is the usual choice. */
556
+ display: string;
557
+ /**
558
+ * `@theholocron/tsconfig` variant. Defaults to `"node-lts"` — every
559
+ * checked package uses it; the other three (`astro`, `nextjs`, `react`)
560
+ * exist for a template repo's app-shaped packages, not the plain
561
+ * Node.js library packages this org's currently-migrated repos ship.
562
+ */
563
+ variant?: "astro" | "nextjs" | "node-lts" | "react";
564
+ /**
565
+ * Add a `@/*` → `./src/*` path alias. A real per-package choice, not a
566
+ * default — roughly 40% of packages checked use one, the rest don't.
567
+ */
568
+ paths?: boolean;
569
+ }
570
+ /**
571
+ * A package-level `tsconfig.json` — the uniform shape confirmed across
572
+ * every package checked, parameterized only by the two fields that
573
+ * genuinely vary (`display`, `paths`). No scaffold/workflow header (a strict-JSON
574
+ * Bucket B file, like `.editorconfig-checker.json` —
575
+ * JSON has no comment syntax to carry one, and TypeScript's own tolerance
576
+ * for JSONC comments in `tsconfig.json` isn't worth relying on for a file
577
+ * this thin).
31
578
  */
579
+ export declare function createTsconfig(options: TsconfigOptions): string;
580
+ interface EnsureRootWorkspaceMemberResult {
581
+ content: string;
582
+ changed: boolean;
583
+ }
584
+ interface EnsureTurboDependencyResult {
585
+ content: string;
586
+ changed: boolean;
587
+ }
32
588
  /** Minimal structural logger — `@theholocron/observability`'s `Logger` satisfies it. */
33
589
  interface RunLogger {
590
+ /** Records a debug-level structured line. */
34
591
  debug(obj: Record<string, unknown>, msg?: string): void;
592
+ /** Records a warning. */
35
593
  warn(obj: Record<string, unknown>, msg?: string): void;
36
594
  }
595
+ /**
596
+ * Runs `cmd` and reports its exit code. `opts.env` is added to the child's
597
+ * environment (on top of the parent's), e.g. `TURBO_SCM_BASE` for `--affected`.
598
+ */
37
599
  type ExecFn = (cmd: string, args: string[], opts: {
38
600
  cwd: string;
601
+ env?: Record<string, string>;
39
602
  }) => {
40
603
  exitCode: number;
41
604
  };
@@ -55,14 +618,10 @@ interface RunDeps {
55
618
  /** `node_modules/.bin/<bin>` or a PATH entry; `null` when not runnable. */
56
619
  lookPath: (cwd: string, bin: string) => string | null;
57
620
  }
621
+ /** What `runTask` needs for one task: the task, where to run it, and the injected dependencies. */
58
622
  interface RunTaskInput extends RunDeps {
59
623
  /** Registry task name, e.g. `"test"`. */
60
624
  task: string;
61
- /**
62
- * Sub-job within the task, e.g. `"performance"` in `holocron run audit
63
- * performance`. Ignored (folded into `passthrough`) for tasks with no `jobs`.
64
- */
65
- job?: string;
66
625
  /** Directory to run in. */
67
626
  cwd: string;
68
627
  /** Args after `--` on the command line, forwarded to the tool / turbo / script. */
@@ -73,165 +632,337 @@ interface RunTaskInput extends RunDeps {
73
632
  required?: boolean;
74
633
  /** `turbo --filter=<pkg>` passthrough (monorepo). Ignored when the repo has no `turbo.json`. */
75
634
  filter?: string;
635
+ /** `turbo --affected`: only the packages changed since `base`, plus their dependents. Ignored without a `turbo.json`. */
636
+ affected?: boolean;
637
+ /** Git ref `affected` compares against; falls back to `TURBO_SCM_BASE`. */
638
+ base?: string;
639
+ /** Environment `affected` reads (`GITHUB_EVENT_NAME`, `GITHUB_REF_NAME`, `TURBO_SCM_BASE`). Defaults to empty. */
640
+ env?: Record<string, string | undefined>;
76
641
  }
642
+ /** The result of `runTask`. */
77
643
  interface RunTaskReport {
644
+ /** `ok`, `fail`, `skip` (no such task for this repo), `dry-run` or `unknown` (not a registry task). */
78
645
  status: "ok" | "fail" | "skip" | "dry-run" | "unknown";
79
646
  /** Resolved command, for the caller / tests. */
80
647
  command?: string;
648
+ /** Why the task failed or was skipped. */
81
649
  message?: string;
82
650
  }
83
- declare function runTask(input: RunTaskInput): RunTaskReport;
84
- //#endregion
85
- //#region src/ci.d.ts
651
+ /**
652
+ * Resolves one registry task (an explicit turbo task, a `package.json` script, then the registry's built-in runner)
653
+ * and runs it, or prints the command on a dry run.
654
+ */
655
+ export declare function runTask(input: RunTaskInput): RunTaskReport;
656
+ /** Options for `Astromech.ci`: the scope, turbo filtering and whether to only print the plan. */
86
657
  interface CiOptions {
87
658
  /** Print the plan without running anything. */
88
659
  dryRun?: boolean;
89
660
  /** `turbo --filter=<pkg>` passthrough (monorepo). */
90
661
  filter?: string;
91
- /** `"required"` (default) or `"all"` (every `ci: true` task). */
92
- scope?: "required" | "all";
662
+ /** `turbo --affected`: only the packages changed since `base`. */
663
+ affected?: boolean;
664
+ /** Git ref `affected` compares against. */
665
+ base?: string;
666
+ /** Environment `affected` reads. */
667
+ env?: Record<string, string | undefined>;
668
+ /** `"required"` (default) or `"all"` (every `ci: true` task). */
669
+ scope?: "required" | "all";
670
+ }
671
+ /** The result of one task in a CI pre-flight run. */
672
+ interface CiJobReport {
673
+ /** Registry task name, e.g. `"test"`. */
674
+ task: string;
675
+ /** The branch-protection check context, or `null` for a non-gating task. */
676
+ checkContext: string | null;
677
+ /** `ok`, `fail`, `skip` (nothing to run for this repo) or `dry-run` (planned, not run). */
678
+ status: "ok" | "fail" | "skip" | "dry-run";
679
+ /** The resolved command, when one was run or planned. */
680
+ command?: string;
681
+ /** Why the job failed or was skipped. */
682
+ message?: string;
683
+ }
684
+ /** The result of a CI pre-flight run. */
685
+ interface CiReport {
686
+ /** `fail` if any job failed, else `ok`. */
687
+ status: "ok" | "fail";
688
+ /** One entry per task. */
689
+ jobs: CiJobReport[];
690
+ }
691
+ interface CiInput extends RunDeps, CiOptions {
692
+ cwd: string;
693
+ config: TasksConfig;
694
+ }
695
+ /** Runs the merge-gating tasks in CI order and reports each job and an overall `ok` or `fail`. */
696
+ export declare function runCi(input: CiInput): CiReport;
697
+ /** Comment style produced by workflowHeader. */
698
+ type WorkflowHeaderFormat = "yaml" | "cjs" | "shebang";
699
+ /** Where a generated file came from, for the header `createHeader` writes. */
700
+ interface CreateHeaderOptions {
701
+ /** Path within theholocron/holocron that owns the file being generated. */
702
+ source: string;
703
+ /** CLI command that produces the file. Defaults to "holocron setup". */
704
+ tool?: string;
705
+ /** Set true only when writing to theholocron/.github itself. */
706
+ forPrimary?: boolean;
707
+ }
708
+ /** The header writers `createHeader` returns, one per kind of generated file. */
709
+ interface HeaderFunctions {
710
+ /**
711
+ * "AUTO-GENERATED — do not edit" header for files managed on every run.
712
+ *
713
+ * format:
714
+ * "yaml" — `# …` comment lines (YAML, text, ignore files)
715
+ * "cjs" — `/* … *\/` block comment (CommonJS modules)
716
+ * "shebang" — `#!/bin/sh` on line 1, then yaml header (shell scripts)
717
+ */
718
+ workflowHeader(format?: WorkflowHeaderFormat): string;
719
+ /**
720
+ * "Scaffolded — edit this file freely" header for one-time generated files
721
+ * that the user is expected to take over (e.g. codecov.yml).
722
+ */
723
+ scaffoldHeader(): string;
724
+ }
725
+ /**
726
+ * Factory that binds `source` and `tool` once and returns all header
727
+ * constructors for auto-generated files. Prefer this over passing source
728
+ * as a positional argument at every call site.
729
+ *
730
+ * @example
731
+ * const { workflowHeader, scaffoldHeader } = createHeader({
732
+ * source: "cli/astromech/src/templates/configs/editorconfig/create-config.ts",
733
+ * });
734
+ *
735
+ * export function createConfig(): string {
736
+ * return `${workflowHeader()}${body}`;
737
+ * }
738
+ *
739
+ * ## Which header to use
740
+ *
741
+ * | Function | When to use | User can edit? |
742
+ * |-------------------|----------------------------------------------------|----------------|
743
+ * | `workflowHeader` | Files overwritten on every setup / sync-github run | No — "AUTO-GENERATED — do not edit" |
744
+ * | `scaffoldHeader` | Files written once; user takes ownership after | Yes — "Scaffolded — edit this file freely" |
745
+ *
746
+ * ## `workflowHeader` formats
747
+ *
748
+ * | Format | Comment style | Used for |
749
+ * |---------------------|------------------------|-------------------------------------------------------|
750
+ * | `"yaml"` (default) | `# …` lines | YAML workflows, ignore files, `.editorconfig`, labeler|
751
+ * | `"cjs"` | `/* … *\/` block | CommonJS config files (`.cjs`) |
752
+ * | `"shebang"` | `#!/bin/sh` + `# …` | Shell scripts (`prepare-commit-msg`, hooks) |
753
+ */
754
+ export declare function createHeader(options: CreateHeaderOptions): HeaderFunctions;
755
+ /** The names of the directories directly inside `path`. */
756
+ export declare const defaultListDirs: (path: string) => string[];
757
+ /** Reads and parses the JSON file at `path`. */
758
+ export declare const defaultReadJson: (path: string) => unknown;
759
+ interface SpawnResult {
760
+ status: number | null;
761
+ stdout: string;
762
+ stderr: string;
763
+ }
764
+ type Run = (command: string, args: string[], options: Record<string, unknown>) => SpawnResult;
765
+ /**
766
+ * `value` as JSON laid out the way this repo's Prettier lays out a `.json` file, so a file a generator writes is
767
+ * already what the formatting check expects and a re-run does not change it. Objects are always expanded, one key
768
+ * per line; an array of plain values stays on one line when it fits in 120 columns and goes one value per line when
769
+ * it does not (what Prettier does for strings). Ends in a single newline.
770
+ *
771
+ * `JSON.stringify` rules apply first: `undefined`, functions and symbols are dropped from objects.
772
+ */
773
+ export declare function formatJson(value: unknown): string;
774
+ /** A workspace package: absolute folder, and what its `package.json` says. */
775
+ interface WorkspacePackage {
776
+ /** The package's `name`. */
777
+ name: string;
778
+ /** Absolute path of the package folder. */
779
+ dir: string;
780
+ /** The package's `version`; `undefined` when its manifest has none. */
781
+ version: string | undefined;
782
+ /** The package's `dependencies`, name to range. */
783
+ dependencies: Record<string, string>;
784
+ /**
785
+ * A workspace:* devDependency can optionally count too (holocron#1071,
786
+ * workspaceDependencies' includeDevDependencies option). Optional so a
787
+ * caller holding the previous, dev-dependency-less shape (a plain
788
+ * object literal, or a value from outside this package's own version)
789
+ * keeps compiling and working -- a missing value is treated the same
790
+ * as `{}`.
791
+ */
792
+ devDependencies?: Record<string, string>;
793
+ }
794
+ interface Tree {
795
+ readJson: (path: string) => unknown;
796
+ listDirs: (path: string) => string[];
797
+ }
798
+ /**
799
+ * Every package the repo's `pnpm-workspace.yaml` declares (`packages/*`,
800
+ * `apps/*` and `plugins/*` when it declares none) with a readable, named
801
+ * `package.json`.
802
+ */
803
+ export declare function workspacePackages(repoRoot: string, { readJson, listDirs }: Tree): WorkspacePackage[];
804
+ /** What `deployOnRelease` needs to know about a release. */
805
+ interface DeployOnReleaseOptions {
806
+ /** Repo root. */
807
+ cwd: string;
808
+ /** The release's channel: its prerelease identifier (`alpha`); empty or `main` for a stable release. */
809
+ channel: string;
810
+ /** The previous release's commit; omitted when there is none, so every deploying channel match deploys. */
811
+ from?: string;
812
+ /** The release commit. Default `HEAD`. */
813
+ to?: string;
814
+ /** Where progress lines go (stdout in the CLI). */
815
+ print: (line: string) => void;
816
+ /** Print what would deploy without running it. */
817
+ dryRun?: boolean;
818
+ /**
819
+ * A file to list the packages whose deploy succeeded in, for `recordDeploys` to tag in a later step. The deploy
820
+ * phase itself never writes a tag, so it needs no write credential. Not written on a dry run.
821
+ */
822
+ recordFile?: string;
823
+ }
824
+ interface DeployOnReleaseDeps extends Partial<Tree> {
825
+ run?: Run;
826
+ sleep?: (ms: number) => Promise<void>;
827
+ now?: () => number;
828
+ /** Reads a package folder's task manifest; `loadTasksConfig` by default. */
829
+ loadTasks?: (dir: string) => Promise<TasksConfig>;
830
+ /** Writes the record file's text. */
831
+ writeFile?: (path: string, text: string) => void;
832
+ }
833
+ /** The outcome of deploying one workspace package. */
834
+ interface DeployOnReleaseResult {
835
+ /** The package's name. */
836
+ pkg: string;
837
+ /** `ok`, `fail`, `skip` (the package does not deploy on this release) or `dry-run`. */
838
+ status: "ok" | "fail" | "skip" | "dry-run";
839
+ /** A one-line account of what happened. */
840
+ message: string;
841
+ }
842
+ /** The outcome of a release-time deploy across the workspace. */
843
+ interface DeployOnReleaseReport {
844
+ /** `fail` if any package's deploy failed; `skip` if none applied to this release; else `ok`. */
845
+ status: "ok" | "fail" | "skip";
846
+ /** One entry per package considered for this release. */
847
+ results: DeployOnReleaseResult[];
848
+ }
849
+ /**
850
+ * Deploys every package whose manifest declares a release-time deploy that
851
+ * applies to this release. Never throws for a deploy problem: each package's
852
+ * outcome is in the report, and `status: "fail"` is the caller's exit code.
853
+ */
854
+ export declare function deployOnRelease(options: DeployOnReleaseOptions, { run, readJson, listDirs, sleep, now, loadTasks, writeFile }?: DeployOnReleaseDeps): Promise<DeployOnReleaseReport>;
855
+ /** What `recordDeploys` needs. */
856
+ interface RecordDeploysOptions {
857
+ /** Repo root. */
858
+ cwd: string;
859
+ /** The file the deploy phase wrote (`--record-file`). */
860
+ file: string;
861
+ /** The token the tags are pushed with; never printed. */
862
+ token: string | undefined;
863
+ /** Where progress lines go. */
864
+ print: (line: string) => void;
865
+ /** Say what would be tagged without tagging. */
866
+ dryRun?: boolean;
867
+ }
868
+ interface RecordDeploysDeps {
869
+ run?: Run;
870
+ /** Reads the record file's text; `undefined` when there is no such file. */
871
+ readFile?: (path: string) => string | undefined;
872
+ }
873
+ /** The outcome of recording the deploys: `fail` if a tag could not be written, `skip` when there was nothing to record. */
874
+ interface RecordDeploysReport {
875
+ status: "ok" | "fail" | "skip";
876
+ results: {
877
+ pkg: string;
878
+ status: "ok" | "fail" | "dry-run";
879
+ message: string;
880
+ }[];
881
+ }
882
+ /**
883
+ * The record phase of a release-time deploy (holocron#2330): tags and pushes the `deployed/<package>` marker for each
884
+ * package the deploy phase listed in its record file, which holds only the ones whose deploy succeeded. It runs as its
885
+ * own step so the write token is in this step's environment and not the app's deploy script's. A missing or empty
886
+ * file is a skip (nothing deployed); a tag that cannot be written fails the step, loudly, naming the package.
887
+ */
888
+ export declare function recordDeploys({ cwd, file, token, print, dryRun }: RecordDeploysOptions, { run, readFile }?: RecordDeploysDeps): RecordDeploysReport;
889
+ /** Options for running a suite: a dry run and turbo scoping. */
890
+ interface GroupOptions {
891
+ /** Print the resolved commands without running anything. */
892
+ dryRun?: boolean;
893
+ /** `turbo --filter=<pkg>` passthrough (monorepo). */
894
+ filter?: string;
895
+ /** `turbo --affected`: only the packages changed since `base`. */
896
+ affected?: boolean;
897
+ /** Git ref `affected` compares against. */
898
+ base?: string;
899
+ /** Environment `affected` reads. */
900
+ env?: Record<string, string | undefined>;
93
901
  }
94
- interface CiJobReport {
902
+ /** One task of a group run. */
903
+ interface GroupMember {
904
+ /** Flat id, e.g. `"lint:code"`. */
95
905
  task: string;
96
- /** The branch-protection check context, or `null` for a non-gating task. */
97
- checkContext: string | null;
906
+ /** Args the task is run with (`--check` for `format` when an old name asked for it). */
907
+ passthrough?: string[];
908
+ }
909
+ /** The result of one task in a group run. */
910
+ interface GroupJobReport {
911
+ /** Flat id, e.g. `"lint:code"`. */
912
+ task: string;
913
+ /** `ok`, `fail`, `skip` (nothing to run for this repo) or `dry-run` (planned, not run). */
98
914
  status: "ok" | "fail" | "skip" | "dry-run";
915
+ /** The resolved command, when one was run or planned. */
99
916
  command?: string;
917
+ /** Why the job failed or was skipped. */
100
918
  message?: string;
101
919
  }
102
- interface CiReport {
103
- status: "ok" | "fail";
104
- jobs: CiJobReport[];
920
+ /** The result of running every task in a group. */
921
+ interface GroupReport {
922
+ /** `"unknown"` when the group has no task to run. */
923
+ status: "ok" | "fail" | "dry-run" | "unknown";
924
+ /** One entry per task. */
925
+ jobs: GroupJobReport[];
105
926
  }
106
- interface CiInput extends RunDeps, CiOptions {
927
+ interface GroupInput extends RunDeps, GroupOptions {
107
928
  cwd: string;
108
- config: TasksConfig;
109
- }
110
- declare function runCi(input: CiInput): CiReport;
111
- //#endregion
112
- //#region src/thin-callers.d.ts
113
- /**
114
- * Workflow templates + thin-caller generation.
115
- *
116
- * `WORKFLOW_TEMPLATES` holds each reusable `.github/workflows/<name>.yml`
117
- * (synced to `theholocron/.github`); `generateThinCallerContent` wraps one
118
- * into the thin caller `holocron setup` / `holocron sync` write locally.
119
- */
120
- declare const WORKFLOW_TEMPLATES: Record<string, string>;
121
- declare const KNOWN_WORKFLOWS: Set<string>;
122
- /**
123
- * The GitHub status-check context a `required` task contributes to branch
124
- * protection. Format: `"{workflow name} / {job name}"`.
125
- *
126
- * Most of these are single-job workflows now (D3's decomposition split what
127
- * used to be multi-job `lint`/`audit` into one task per concern) — the
128
- * context names that job directly, no `Conclusion` aggregator needed; a
129
- * single job's own conclusion already *is* the workflow's conclusion.
130
- * `Conclusion` fan-in jobs are kept only where a task genuinely has several
131
- * conditionally-run jobs feeding one required check:
132
- * `verification.unitTests` (unit / Storybook / Chromatic / interaction /
133
- * user-flow, each gated by its own `run-*` input) and
134
- * `platform.repoValidation` (its three script jobs all must pass). Only
135
- * merge-gating workflows are listed. `astromech.requiredChecks()` reads this
136
- * for every `required` task.
137
- */
138
- declare const WORKFLOW_CHECK_CONTEXTS: Partial<Record<string, string>>;
139
- /**
140
- * Generate the thin caller content for a workflow, optionally injecting or
141
- * merging `with:` overrides into the jobs block.
142
- *
143
- * Two strategies are used depending on the template:
144
- * - Templates that already have a `with:` block (e.g. lint):
145
- * the override entries are merged in, replacing existing keys and appending
146
- * new ones.
147
- * - Templates that end with ` secrets: inherit`: a new `with:` block is
148
- * injected immediately before `secrets: inherit`.
149
- * If neither pattern matches the template, a warning is emitted and the
150
- * base template is returned unchanged.
151
- */
152
- declare function generateThinCallerContent(name: string, withOverrides?: Record<string, unknown>, additionalPaths?: string[],
153
- /** Optional sink for the "could not inject `with:`" warning. */
154
- logger?: {
155
- warn(obj: Record<string, unknown>, msg: string): void;
156
- },
157
- /**
158
- * `with:` key → a `# comment` line rendered immediately above that entry.
159
- * Only honored when injecting a fresh `with:` block (no template today
160
- * ships one), which is the path `lint` takes.
161
- */
162
- comments?: Record<string, string>): string;
163
- interface PreviewConfig {
164
- /** Cloudflare Pages project name shared across all repos for previews. */
165
- project: string;
166
- /**
167
- * Base domain for preview URLs (e.g. `"preview.theholocron.dev"`).
168
- * When set, `holocron setup` automatically provisions:
169
- * - Cloudflare Pages custom domain `*.<domain>` on the project
170
- * - DNS wildcard CNAME `*.<domain>` → `<project>.pages.dev`
171
- *
172
- * Preview URLs resolve as `<repo>-pr-<n>.<domain>`.
173
- */
174
- domain?: string;
929
+ /** What was asked for, as typed: `"test"`, `"sourceQuality"`. */
930
+ label: string;
931
+ /** The tasks to run, in order. */
932
+ members: GroupMember[];
933
+ /** Tasks reported as skipped without running, each with its reason (the repo-wide leaves, from a package directory). */
934
+ skipped?: Array<{
935
+ task: string;
936
+ message: string;
937
+ }>;
175
938
  }
176
- /** Org-level context used to derive preview defaults from `preview: true`. */
177
- interface OrgContext {
178
- /** GitHub org name — becomes the prefix of the default project: `<org>-preview`. */
179
- org?: string;
180
- /** Org canonical domain — becomes `preview.<domain>` for the default preview domain. */
181
- domain?: string;
182
- /** Project name — injected as the `name` input to the deploy reusable when `docs: true`. */
183
- repoName?: string;
939
+ /** Runs every task of a group in sequence and reports each. */
940
+ export declare function runGroup(input: GroupInput): GroupReport;
941
+ /** One flat id an old dotted name stands for, with the args it adds to that id's run. */
942
+ interface LegacyTarget {
943
+ /** The flat id (`lint:editorconfig`). */
944
+ id: string;
945
+ /** Args the old name implied: `sourceQuality.formatting` checked prettier, it never wrote, so it adds `--check` to `format`. */
946
+ passthrough?: string[];
184
947
  }
185
948
  /**
186
- * Extract the Cloudflare Pages preview config from a deploy workflow's `with:` object.
187
- *
188
- * Accepts three forms:
189
- * - `preview: true` — derive both project and domain from org context
190
- * - `preview: { project: "..." }` — explicit project; domain derived from context if omitted
191
- * - `preview: { project: "...", domain: "..." }` — fully explicit
192
- *
193
- * Returns null when `preview:` is absent, false, or can't be resolved.
194
- */
195
- declare function extractPreviewConfig(raw: Record<string, unknown>, ctx?: OrgContext): PreviewConfig | null;
196
- /**
197
- * Generate the full thin-caller YAML for a `deploy.yml` that handles both
198
- * production (push to main → GitHub Pages) and preview (pull_request →
199
- * Cloudflare Pages) in a single file.
200
- *
201
- * Both jobs receive the same docs/storybook `with:` inputs. If the per-repo
202
- * config supplies `cloudflare-project` it is forwarded; otherwise the reusable
203
- * falls back to the `CLOUDFLARE_PAGES_PROJECT` org variable — set that once and
204
- * all repos with a `deploy` workflow get previews without per-repo config.
205
- */
206
- declare function generateCombinedDeployContent(deployWith: Record<string, unknown>, paths: string[], preview: Pick<PreviewConfig, "project">): string;
207
- /**
208
- * Expand structured with-values to flat GitHub Actions inputs before
209
- * generating the thin caller. Handles:
210
- * - deploy shorthand: docs/storybook → type + storybook-projects
211
- * - preview: stripped (handled separately via extractPreviewConfig)
212
- * - run-chromatic object → run-chromatic: true + chromatic-projects
213
- * - plain arrays → JSON-stringified for YAML scalar quoting
949
+ * The old dotted task names (and the workflow-only keys) and the flat ids they became — the complete map of spec
950
+ * `ci-flat-task-vocabulary`, "Old to new". `holocron run <old>` and `tasks:` in `holocron.config` still accept them
951
+ * for a window (the frozen reusables in `theholocron/.github` run `holocron run <old>` until #1216 deletes them), and
952
+ * a name that stood for one workflow carrying several checks maps to all of its successors, in run order.
214
953
  *
215
- * Used by both `holocron setup` and `sync-workflow-templates`.
954
+ * Each key is also the name of the generated workflow file, the turbo task and the `package.json` script until the
955
+ * later phases move those, so {@link legacyName} reads this table backwards. Removed together with the aliases in the
956
+ * last phase.
216
957
  */
217
- declare function normalizeWorkflowWith(raw: Record<string, unknown>): Record<string, unknown>;
958
+ export declare const LEGACY_NAMES: Record<string, LegacyTarget[]>;
218
959
  /**
219
- * Derive on.push.paths entries from the deploy with: shorthand.
220
- * Used by both `holocron setup` and `sync-workflow-templates`.
960
+ * The configured tasks that were under an old intent-group namespace (`sourceQuality` matches the tasks that were
961
+ * `sourceQuality.*`), as flat ids in manifest declaration order. The old group names are accepted for the window that
962
+ * the old dotted names are, and a new-style `tasks:` entry matches through the old name its id replaced.
221
963
  */
222
- declare function deriveDeployPaths(raw: Record<string, unknown>): string[];
223
- //#endregion
224
- //#region src/turbo.d.ts
225
- interface EnsureRootWorkspaceMemberResult {
226
- content: string;
227
- changed: boolean;
228
- }
229
- interface EnsureTurboDependencyResult {
230
- content: string;
231
- changed: boolean;
232
- }
233
- //#endregion
234
- //#region src/astromech.d.ts
964
+ export declare function matchNamespace(config: TasksConfig, namespace: string): LegacyTarget[];
965
+ /** Everything `createAstromech` needs from the repo and the outside world; only `cwd` is required. */
235
966
  interface AstromechOptions {
236
967
  /** Repo root. */
237
968
  cwd: string;
@@ -246,38 +977,71 @@ interface AstromechOptions {
246
977
  * derive the Cloudflare Pages project / domain when they are not spelt out.
247
978
  */
248
979
  orgContext?: OrgContext;
980
+ /**
981
+ * The commit statuses a `coverage` provider reports (`Coverage.statusContexts()`, names only), which the CLI passes
982
+ * in because astromech imports no provider. {@link Astromech.requiredChecks} adds the required ones and
983
+ * {@link Astromech.aggregateCaller} treats them as the aggregate's `statuses`. Left out, a context starting with
984
+ * `codecov/` is a status and nothing is added, which is what a run with no provider loaded does.
985
+ */
986
+ statusContexts?: readonly StatusContext[];
249
987
  /** Structured-logging sink. Defaults to a no-op. */
250
988
  logger?: RunLogger;
251
989
  /** User-facing line printer. Defaults to `console.log`. */
252
990
  print?: (line: string) => void;
991
+ /** Where a deprecation notice goes (an old task name, a group name). Defaults to `console.error`, so it is on stderr. */
992
+ warn?: (line: string) => void;
253
993
  /** Injectable subprocess runner (tests). Defaults to `spawnSync` (stdio inherit). */
254
994
  exec?: ExecFn;
255
995
  /** Injectable fs (tests). Default to `node:fs`. */
256
996
  readFile?: (path: string) => string;
997
+ /** Injectable existence check (tests). Defaults to `node:fs`. */
257
998
  fileExists?: (path: string) => boolean;
999
+ /** Injectable directory listing (tests). Defaults to `node:fs`. */
258
1000
  listDir?: (path: string) => string[];
1001
+ /** Injectable environment for `--affected` (tests). Defaults to `process.env`. */
1002
+ env?: Record<string, string | undefined>;
259
1003
  /** Injectable binary lookup (tests). Default checks `node_modules/.bin` then `PATH`. */
260
1004
  lookPath?: (cwd: string, bin: string) => string | null;
261
1005
  }
1006
+ /** Options for `Astromech.run`: which word follows the task, what to forward, and how to scope the turbo run. */
262
1007
  interface RunOptions {
263
1008
  /**
264
- * Sub-job within the task — `performance` in `holocron run audit
265
- * performance`. Only meaningful for tasks that declare `jobs` (`audit`);
266
- * ignored otherwise. Omit to run every job the task has.
1009
+ * The word after `task`, part of the task's name when the two together name a leaf (`unit` in `holocron run test
1010
+ * unit`), else forwarded to the task as an argument.
267
1011
  */
268
1012
  job?: string;
1013
+ /**
1014
+ * Further positional words after `task` and `job`. All the words together name the task: `holocron run test unit
1015
+ * storybook` is `task: "test"`, `job: "unit"`, `args: ["storybook"]`, and the longest match against the registry
1016
+ * (`test:unit`) leaves `storybook` as an argument for the task.
1017
+ */
1018
+ args?: string[];
269
1019
  /** Args after `--`, forwarded to the tool / turbo / script. */
270
1020
  passthrough?: string[];
1021
+ /** The read-only form of a task that writes by default: `format --check` runs prettier without writing. */
1022
+ check?: boolean;
271
1023
  /** Print the resolved command without running it. */
272
1024
  dryRun?: boolean;
273
1025
  /** Fail (exit 1) instead of skipping when the repo has no such task. */
274
1026
  required?: boolean;
275
1027
  /** `turbo --filter=<pkg>` passthrough (monorepo). */
276
1028
  filter?: string;
1029
+ /** `turbo --affected`: only the packages changed since `base`. */
1030
+ affected?: boolean;
1031
+ /** Git ref `affected` compares against. */
1032
+ base?: string;
277
1033
  }
1034
+ /** The task runner: one manifest drives local runs, the CI pre-flight and the generated workflows and scripts. */
278
1035
  interface Astromech {
279
- /** Run one task — or one of its sub-jobs (`opts.job`) — locally. */
280
- run(task: string, opts?: RunOptions): RunTaskReport;
1036
+ /**
1037
+ * Run a task, a suite or an old name locally. The words (`task`, `opts.job`, `opts.args`) are joined with `:` and the
1038
+ * longest match against the registry wins: `test:unit` and `test unit` are one leaf, `test` is the suite (every
1039
+ * configured leaf, in registry order, as a {@link GroupReport}), and what is left over is forwarded to the
1040
+ * task. An old dotted name (`verification.unitTests`) still works and prints a deprecation notice; one that
1041
+ * stood for several tasks (`sourceQuality.formatting`) or an old group name (`"sourceQuality"`) runs each in
1042
+ * sequence as a {@link GroupReport}.
1043
+ */
1044
+ run(task: string, opts?: RunOptions): RunTaskReport | GroupReport;
281
1045
  /**
282
1046
  * Run the merge-gating checks locally, in CI order — "will CI pass?".
283
1047
  * Default scope: `required: true` tasks (falls back to every `ci: true`
@@ -292,36 +1056,46 @@ interface Astromech {
292
1056
  */
293
1057
  thinCallers(): Map<string, string>;
294
1058
  /**
295
- * The complete reusable-workflow batch `holocron sync-github` pushes to
1059
+ * The complete reusable-workflow batch `holocron sync github` pushes to
296
1060
  * `theholocron/.github` — repo-relative path → content, "do not edit" header
297
1061
  * already applied to the YAML. Config-independent (the same for every repo).
298
1062
  */
299
1063
  reusableTemplates(): Map<string, string>;
300
1064
  /**
301
- * `package.json` scripts for this repo's manifest — the `"holocron"` entry
302
- * (`config.holocronScript ?? "holocron"`) plus `"<task>": "holocron run
303
- * <task>"` for every `config.tasks` item that is a runnable registry task
304
- * and not `local: false`. Merge into `package.json`; never clobber. Empty
305
- * when there is no config or `syncScripts: false`.
1065
+ * `package.json` scripts for this repo's manifest, from `scriptsFor()`: the `"holocron"` entry
1066
+ * (`config.holocronScript ?? "holocron"`), `prepare` when hooks are on, and one script per task the repo can run
1067
+ * locally. In a pnpm workspace with a generated `turbo.json` those call `turbo run <key>` (a suite is a turbo task
1068
+ * of its own) or, for a repo-scoped leaf, hold the tool's command; in a single package they are `holocron run
1069
+ * <words> --`. Merge into `package.json` with `mergeScripts()`; never clobber. Empty when there is no config or
1070
+ * `syncScripts: false`.
306
1071
  */
307
1072
  packageScripts(): Record<string, string>;
308
1073
  /**
309
- * The branch-protection required-status-check contexts for this repo —
310
- * every `required: true` task's check context plus `extraRequiredChecks`,
311
- * ordered and de-duplicated. `holocron setup` prepends `"DCO"` and applies
312
- * the list; this method is policy-free (manifest only).
1074
+ * Task names this repo's manifest can actually run locally — the same
1075
+ * filter {@link packageScripts} applies (skips `local: false` and tasks
1076
+ * with no local runner at all), but independent of `syncScripts`: a repo
1077
+ * that opts out of generated `package.json` scripts still has real
1078
+ * runnable tasks. Empty when there is no config. Backs `holocron`'s own
1079
+ * interactive task picker (`run` with no task given).
313
1080
  */
314
- requiredChecks(): string[];
1081
+ runnableTasks(): string[];
315
1082
  /**
316
- * This repo's `codecov.yml` — component `paths` derived from `packages/*`.
317
- * Pass the current file's content (`null` if none exists yet) to either
318
- * merge the component list in or scaffold a fresh file. Policy-free same
319
- * as {@link requiredChecks} — `holocron setup` owns writing the result.
1083
+ * The branch-protection required-status-check contexts for this repo. With `aggregate` (the repo hosts the `ci`
1084
+ * check, see {@link aggregateCaller}) they are `ci / Required checks` and `DCO`; without it, `DCO`, every `required: true` task's
1085
+ * check context and `extraRequiredChecks`, ordered and de-duplicated. `holocron setup` applies the list; this
1086
+ * method is policy-free (manifest only).
320
1087
  */
321
- codecovConfig(existing: string | null): string;
1088
+ requiredChecks(aggregate: boolean): string[];
1089
+ /**
1090
+ * The thin caller of the `ci` aggregate check (a `pull_request` workflow whose job `ci` calls the `Required checks` job that waits on every
1091
+ * `required: true` task, the hand-written checks and the coverage statuses), or `null` when the manifest has
1092
+ * nothing to wait on. Only a repo that hosts the reusable `ci.yml` writes it; the others have no `ci` yet.
1093
+ */
1094
+ aggregateCaller(): string | null;
322
1095
  /**
323
1096
  * The generated `turbo.json` for this repo's manifest, pretty-printed —
324
- * write directly, no merge. `null` when no manifest task has turbo fan-out
1097
+ * write directly, no merge. In a pnpm workspace it also holds the suite aggregator tasks and a `//#<id>` root task
1098
+ * per repo-scoped leaf with a local tool. `null` when no manifest task has turbo fan-out
325
1099
  * config (nothing to write). See {@link TurboTaskConfig} in `registry.ts`.
326
1100
  */
327
1101
  turboConfig(): string | null;
@@ -332,10 +1106,14 @@ interface Astromech {
332
1106
  * (not just an orchestrator) silently vanishes from `turbo run <task>`.
333
1107
  * Pass `pnpm-workspace.yaml`'s current content (or `""` if none exists —
334
1108
  * a no-op either way, since no `packages:` key means single-package mode
335
- * already) and root `package.json`'s own `scripts` keys. `changed: false`
336
- * means don't write anything — the file is already correct.
1109
+ * already) and root `package.json`'s own `scripts` object — values and
1110
+ * all, not just keys, so a task-name-matching script that's already the
1111
+ * generated `holocron run <task> --` wrapper (predating this call, not
1112
+ * written by it) is correctly excluded rather than treated as proof root
1113
+ * is directly buildable (#846). `changed: false` means don't write
1114
+ * anything — the file is already correct.
337
1115
  */
338
- ensureRootWorkspaceMember(workspaceYaml: string, rootScripts: readonly string[]): EnsureRootWorkspaceMemberResult;
1116
+ ensureRootWorkspaceMember(workspaceYaml: string, rootScripts: Readonly<Record<string, string>>): EnsureRootWorkspaceMemberResult;
339
1117
  /**
340
1118
  * `turboConfig()` writes a `turbo.json` but never touches `package.json`
341
1119
  * — a repo with no local `turbo` devDependency falls back to whatever
@@ -347,382 +1125,310 @@ interface Astromech {
347
1125
  */
348
1126
  ensureTurboDependency(packageJson: string, workspaceYaml: string): EnsureTurboDependencyResult;
349
1127
  }
350
- declare function createAstromech(options: AstromechOptions): Astromech;
351
- //#endregion
352
- //#region src/codecov.d.ts
1128
+ export declare function createAstromech(options: AstromechOptions): Astromech;
353
1129
  /**
354
- * `codecov.yml` generation — a manifest-derived artifact (component `paths`
355
- * come from workspace packages; the status targets track the `test` task's
356
- * coverage setup), the same category as the reusable `test.yml` this package
357
- * also generates. Moved out of `@theholocron/cli` (theholocron/holocron#650)
358
- * — `holocron setup`'s codecov step now calls {@link codecovConfig} instead
359
- * of importing this logic directly.
1130
+ * The branches releases are cut from, in release order: `main` is the stable line, `alpha` the prerelease line.
1131
+ *
1132
+ * This is the release-branch LIST. It is not the repo's default branch (`defaultBranch` in `holocron.config.ts` is a
1133
+ * per-repo setting) and it is not the prerelease channel name (see {@link PRERELEASE_CHANNEL}).
360
1134
  */
361
- interface WorkspacePackage {
362
- slug: string;
1135
+ export declare const RELEASE_BRANCHES: readonly ["main", "alpha"];
1136
+ /**
1137
+ * The prerelease channel: the branch name semantic-release publishes prereleases from, which is also the npm
1138
+ * dist-tag those prereleases carry. It is one of {@link RELEASE_BRANCHES}.
1139
+ */
1140
+ export declare const PRERELEASE_CHANNEL: "alpha";
1141
+ /** One line a repo releases on: the repo-wide one (tags `v1.2.3`) or a group's (tags `configs-v1.2.3`). */
1142
+ interface ReleaseLine {
1143
+ /** A name for reports: the group's folder, or `repo` for the line of everything outside a group. */
1144
+ id: string;
1145
+ /** What comes before the version in the line's tags: `v`, `configs-v`. */
1146
+ tagPrefix: string;
1147
+ /** The npm names of the public packages the line publishes. */
1148
+ packages: readonly string[];
1149
+ }
1150
+ /** A git tag and, when known, when it was made. */
1151
+ interface GitTag {
1152
+ /** The tag's name: `v1.2.3`. */
363
1153
  name: string;
364
- /** Which workspace root the package was discovered under. Defaults to `"packages"`. */
365
- dir?: "packages" | "apps";
1154
+ /** Seconds since the epoch. */
1155
+ createdAt?: number;
1156
+ }
1157
+ /** A package's dist-tags on npm (`{ latest: "1.0.0", alpha: "1.1.0-alpha.2" }`), or `undefined` when it is not on npm. */
1158
+ type NpmDistTags = Readonly<Record<string, string>> | undefined;
1159
+ /** How a line's newest tag on one channel compares with npm. */
1160
+ type ReleaseTagState =
1161
+ /** Every package serves that version or a later one. */
1162
+ "published" |
1163
+ /** Some package serves an older version (or none), and the tag is older than the grace period. */
1164
+ "wedged" |
1165
+ /** Some package serves an older version, but the tag is so new its release may still be publishing. */
1166
+ "pending";
1167
+ /** A package that does not serve the line's newest tag. */
1168
+ interface PackageBehind {
1169
+ /** The npm package name. */
1170
+ name: string;
1171
+ /** What npm serves on the channel's dist-tag, or `undefined` when the package or the dist-tag is not there. */
1172
+ onNpm: string | undefined;
1173
+ }
1174
+ /** The newest tag of one channel of one release line, against npm. */
1175
+ interface ReleaseTagCheck {
1176
+ /** The `id` of the release line the tag belongs to. */
1177
+ line: string;
1178
+ /** The npm dist-tag the channel publishes to: `latest`, or the first prerelease identifier (`alpha`). */
1179
+ distTag: string;
1180
+ /** The git tag: `configs-v8.9.0-alpha.20`. */
1181
+ tag: string;
1182
+ /** The version in the tag. */
1183
+ version: string;
1184
+ /** Whether npm serves it, is behind it, or may still be receiving it. */
1185
+ state: ReleaseTagState;
1186
+ /** The packages that do not serve it; empty when `published`. */
1187
+ behind: readonly PackageBehind[];
1188
+ }
1189
+ /** What `checkReleaseLines()` compares: the release lines, the repo's git tags and what npm serves. */
1190
+ interface CheckReleaseLinesInput {
1191
+ /** The release lines to check. */
1192
+ lines: readonly ReleaseLine[];
1193
+ /** Every git tag of the repo. */
1194
+ tags: readonly GitTag[];
1195
+ /** The dist-tags of each package name in `lines`. A name missing from the map counts as not on npm. */
1196
+ npm: ReadonlyMap<string, NpmDistTags>;
1197
+ /** The time now, in seconds since the epoch. Only used with `graceSeconds`. */
1198
+ now?: number;
1199
+ /** A tag younger than this is `pending`, not `wedged`: its release job may still be publishing. Default 0. */
1200
+ graceSeconds?: number;
366
1201
  }
367
- declare function codecovComponentBlock(packages: WorkspacePackage[]): string;
368
1202
  /**
369
- * Ensure every codecov status default carries `if_not_found: success`, so an
370
- * infra-only PR (dep bump, config, lockfile — no coverable change) passes
371
- * instead of hanging forever on a required check codecov never posts.
1203
+ * Compares each release line's newest tag, per channel, with what npm serves on that channel's dist-tag.
372
1204
  *
373
- * Injects the key on the line after each `target:` that sits inside a status
374
- * block (`coverage.status.*.default` or a `statuses:` list item — indent ≥ 8,
375
- * or ≥ 8 for a `- type:` list entry), when the immediate sibling lines do not
376
- * already declare it.
1205
+ * semantic-release pushes its tag (and the `refs/notes/semantic-release-<tag>` note) before it publishes, so a publish
1206
+ * that fails leaves a tag npm never received, and every later run sees the tag, finds nothing new and ends green. A
1207
+ * package that serves an older version than the tag, or none at all, is behind. A line with no tag has nothing to
1208
+ * check and gives no entry. A tag newer than `graceSeconds` is `pending`, because its own release may still be
1209
+ * publishing. Pure: tags and npm's answers come in as data.
377
1210
  */
378
- declare function ensureIfNotFound(yaml: string): string;
379
- declare function mergeCodecovComponents(existing: string, packages: WorkspacePackage[]): string;
1211
+ export declare function checkReleaseLines(input: CheckReleaseLinesInput): ReleaseTagCheck[];
380
1212
  /**
381
- * Every public `packages/*` and `apps/*` workspace, sorted by slug. `[]`
382
- * when neither directory exists. Monorepo templates (Next.js, React, …)
383
- * ship user-facing code under `apps/` alongside library code under
384
- * `packages/` — both need a codecov component so `codecov/patch/<slug>`
385
- * actually posts for each.
1213
+ * Orders two semver versions: negative when `a` is older, positive when newer, 0 when equal (build metadata is
1214
+ * ignored). A prerelease is older than its release, and prerelease identifiers compare as semver says: numbers
1215
+ * numerically and below words, words by their characters, fewer identifiers first. Not a version is a `TypeError`.
386
1216
  */
387
- declare function readWorkspacePackages(repoRoot: string): WorkspacePackage[];
388
- /** A brand-new `codecov.yml` — the scaffold header + the base template + this repo's component list. */
389
- declare function createCodecovConfig(packages: WorkspacePackage[]): string;
1217
+ export declare function compareVersions(a: string, b: string): number;
390
1218
  /**
391
- * The full pipeline `holocron setup` needs: read this repo's public
392
- * `packages/*`, then either merge them into an `existing` `codecov.yml` or
393
- * scaffold a new one.
1219
+ * What to do about a tag npm never received, one line per step. semantic-release's tag and its note
1220
+ * (`refs/notes/semantic-release-<tag>`) both have to go: with the note left behind it still counts the release as
1221
+ * done. The two known causes are named so the log need not be read: a sigstore 409 (the tarball is identical to a
1222
+ * published one, so the change needs different contents) and `ENEEDAUTH` (the Trusted Publisher entries expired, so
1223
+ * `holocron publish package --sync-trust` registers them again).
394
1224
  */
395
- declare function codecovConfig(repoRoot: string, existing: string | null): string;
396
- //#endregion
397
- //#region src/linters.d.ts
1225
+ export declare function wedgeFix(tag: string): string[];
398
1226
  /**
399
- * The linter registry — one list of linter names (from `config.tasks`'
400
- * `{ name: "lint", linters: [...] }`, or auto-detected) maps to both the
401
- * CI super-linter `VALIDATE_*` env and the native local run. This table is
402
- * the single source of truth for that mapping; {@link superLinterConfig}
403
- * (CI) and the `holocron run lint` aggregate (local) both read it.
1227
+ * The paths a release must touch to redeploy `pkg` when its manifest doesn't
1228
+ * list them: its own folder plus the folder of every
1229
+ * {@link workspaceDependencies} entry. Derived rather than listed so a new or
1230
+ * dropped workspace dependency needs no second edit.
404
1231
  *
405
- * Spec: `docs/wiki/specifications/tech-astromech-task-runner.spec.md` "Lint parity".
1232
+ * @returns Repo-relative prefixes, each ending in `/`.
406
1233
  */
407
- interface LinterDef {
408
- /**
409
- * super-linter `VALIDATE_*` keys this linter turns on. Setting any
410
- * `VALIDATE_*` puts super-linter in allow-list mode, so emitting only the
411
- * enabled keys makes it run exactly this set.
412
- */
413
- validate: string[];
414
- /** super-linter `FIX_*` keys (auto-commit / `--write` parity). */
415
- fix?: string[];
416
- /**
417
- * Local binary, resolved from `node_modules/.bin` then `PATH`. Absent →
418
- * the linter has no meaningful local run (`holocron run lint` prints
419
- * "CI only"); CI still enforces it.
420
- */
421
- localBin?: string;
422
- /** Args for `localBin` in CHECK mode — never `--write` / `--fix`. */
423
- localArgs?: string[];
424
- /**
425
- * Shown by `holocron run lint` when `localBin` is set but not found on
426
- * PATH — the "you're missing a tool the repo needs" nudge.
427
- */
428
- installHint?: string;
429
- /**
430
- * Repo-root filenames that auto-enable this linter when the `lint` task
431
- * has no explicit `linters` list. Ignored when {@link always} is set.
432
- */
433
- detect?: string[];
434
- /** Enabled regardless of detection (the org baseline). */
435
- always?: boolean;
436
- /** Reusable-workflow config-file input this linter honors, if any. */
437
- configInput?: "eslint-config" | "prettier-config" | "yaml-config";
438
- }
1234
+ export declare function defaultPaths(repoRoot: string, pkg: WorkspacePackage, all: WorkspacePackage[]): string[];
439
1235
  /**
440
- * Known linters, in execution order. `always` entries are the current
441
- * hard-coded super-linter baseline; `prettier` is always-on because the org
442
- * applies it universally (super-linter only lints files that exist).
1236
+ * The text of `holocron run --help`: the suites with their leaves, and the tasks that are not in a suite, under the six
1237
+ * intent groups (which survive only as this grouping and the docs table).
443
1238
  */
444
- declare const LINTERS: Record<string, LinterDef>;
445
- /** Every linter name the registry knows. */
446
- declare const LINTER_NAMES: ReadonlySet<string>;
1239
+ export declare function describeTasks(): string;
1240
+ /** `true` when a manifest name (a flat id or an old dotted name) stands for the given flat id. */
1241
+ export declare function isTask(name: string, id: string): boolean;
447
1242
  /**
448
- * Resolve the linter set for a repo. An `explicit` list (from `config.tasks`)
449
- * picks the candidate set; otherwise the candidates are every `always` linter
450
- * plus every `detect`-gated linter whose filenames are present at the repo
451
- * root. Either way, a `detect`-gated linter (eslint, markdownlint) only makes
452
- * the final set when its config file is actually present — a repo can't run
453
- * eslint without an `eslint.config.*`, and super-linter FATALs if you ask it
454
- * to (theholocron/holocron#654). `always` linters are unconditional. Result
455
- * is ordered by {@link LINTERS} declaration order.
456
- *
457
- * @throws when an `explicit` name is not in the registry — a typo is a
458
- * config bug, not a linter to silently skip.
1243
+ * Every task name a manifest may list: the flat ids of the registry, the workflow-only ids (`label`, `greet`), and the
1244
+ * old dotted names that are still accepted. What a config validator checks a `tasks:` entry against.
459
1245
  */
460
- declare function resolveLinters(opts: {
461
- explicit?: string[];
462
- rootFiles: string[];
463
- }): Array<{
464
- name: string;
465
- def: LinterDef;
466
- }>;
467
- //#endregion
468
- //#region src/registry.d.ts
1246
+ export declare const KNOWN_TASKS: ReadonlySet<string>;
469
1247
  /**
470
- * The task registry — how each task runs *locally*, without GitHub
471
- * Actions. `holocron run <task>` and `holocron ci` resolve against this;
472
- * adding a task here gives every repo that task.
473
- *
474
- * Keyed identically to the workflow templates — a task IS a workflow. This
475
- * is the canonical vocabulary table (epic #672, D11): every other artifact
476
- * (`KNOWN_TASKS`, `thin-callers.ts`'s `KNOWN_WORKFLOWS`/`WORKFLOW_CHECK_CONTEXTS`,
477
- * `CI_ORDER`) derives from these keys rather than hand-duplicating them —
478
- * including the future GitHub App (#679), which imports this same table for
479
- * config-schema validation instead of reimplementing its own copy.
480
- *
481
- * Task names are an intent-facing vocabulary (`verification.*`,
482
- * `sourceQuality.*`, `security.*`, `delivery.*`, `platform.*`,
483
- * `knowledge.*`), not tool names — `eslint`/`vitest`/`tsdown`/… stay
484
- * internal to this file and `theholocron/configs`. See
485
- * `.notes/tech-vocabulary-rename.spec.md` (#675) for the full mapping and
486
- * the reasoning behind each namespace and decomposition.
487
- *
488
- * Spec: `docs/wiki/specifications/tech-astromech-task-runner.spec.md` (epic #581).
1248
+ * The thin caller `yaml` of task `id` spelled with the names it had before they became the task id: the old workflow
1249
+ * `name:` and the old id and `name:` of each job. This is the legacy-name gate (spec `ci-flat-task-vocabulary`, phase
1250
+ * F): a repo whose callers still call the frozen reusables in `theholocron/.github` keeps the checks its ruleset lists,
1251
+ * so only the repo that hosts the reusables (and, later, every repo once `CI_HOME` is `ci-v1`) gets the flat names.
1252
+ * An id with no old spelling is returned as it is. Only a job `name:` that is the id is rewritten, so a name a caller
1253
+ * builds itself (the grouped release's matrix name) is left to the entry's `replace`.
489
1254
  */
490
- /** How to run one task (or job) locally. */
491
- interface LocalRunner {
492
- /** Binary to invoke — resolved from `node_modules/.bin` then PATH. */
493
- tool?: string;
494
- /** Args appended after the tool. */
495
- args?: string[];
496
- /** First entry whose `when` filename matches a repo-root file wins. */
497
- detect?: Array<{
498
- when: RegExp;
499
- tool: string;
500
- args?: string[];
501
- }>;
502
- /** The task is already a holocron subcommand (`sync`, `sync-wiki`). */
503
- command?: string;
504
- }
1255
+ export declare function legacyCaller(id: string, yaml: string): string;
505
1256
  /**
506
- * How a task fans out across every workspace via Turborepo — content-hash
507
- * caching + `^`-prefixed cross-package ordering, epic #672 D9 (#681).
508
- * Present only on tasks that genuinely run *per workspace* (a real build/
509
- * compile/test step); whole-repo single-run tools (prettier, gitleaks,
510
- * commitlint, yamllint, …) have no entry here — they stay off turbo.json
511
- * entirely and run once, un-fanned-out, the way they already do.
1257
+ * The file name a thin caller of task `id` has while callers are legacy-named (see `legacyCaller`): the old task name
1258
+ * and `.yml`, `verification.unitTests.yml` for `test:unit`. An id with no old name (`preview`) keeps its own.
512
1259
  */
513
- interface TurboTaskConfig {
514
- /** Glob patterns turbo hashes to decide whether a cached run is still valid. */
515
- inputs: string[];
516
- /** Glob patterns turbo caches/restores after a run. Empty array for a task with no build artifact (lint, typecheck). */
517
- outputs: string[];
518
- /** Task names this depends on — a bare name runs in this package first; `^name` waits on every upstream workspace's task. */
519
- dependsOn: string[];
520
- }
521
- /** One sub-job of a task — `performance` in `holocron run audit performance`. */
522
- interface JobDef {
523
- /** How the job runs locally; `null` → no local equivalent (enforced in CI). */
524
- local: LocalRunner | null;
525
- /**
526
- * The CI status-check context this job reports as (e.g.
527
- * `platform.repoValidation / Validate registry consistency`) — every sub-job is a CI job.
528
- * `holocron run <task>` and `holocron ci` label each job line with it;
529
- * the task-level `… / Conclusion` context (only for tasks with several
530
- * jobs) lives in `WORKFLOW_CHECK_CONTEXTS`.
531
- */
532
- checkContext: string;
533
- }
534
- interface TaskDef {
535
- /**
536
- * `null` — the registry has no built-in runner (CodeQL, deploys, the
537
- * bundle-size job). An explicit turbo task or `package.json` script still
538
- * runs (resolution steps 1–2); with neither, `holocron run` does nothing
539
- * and `holocron ci` skips it — never a failure, even when the task is
540
- * `required` (a CI-only check isn't a local one).
541
- */
542
- local: LocalRunner | null;
543
- /**
544
- * Sub-jobs, keyed by slug. Declared order is run order: `holocron run
545
- * <task>` (no job) runs each in turn.
546
- */
547
- jobs?: Record<string, JobDef>;
548
- /** Org-default flags injected by tool name. Removed by a repo override. */
549
- flags?: Record<string, string[]>;
550
- /**
551
- * This task is a linter-group aggregate: `holocron run <task>` resolves
552
- * this fixed set of `linters.ts` entries (still gated by each linter's
553
- * own `detect`/`always` rule) and runs each natively, instead of using
554
- * `local`. Replaces the old single `lint` task's auto-detected linter
555
- * list (`config.tasks[].linters`) — a repo's choice of which of these
556
- * run is now just whether it includes this task in `tasks: [...]`, same
557
- * as any other task. See `linters.ts` / `run.ts`.
558
- */
559
- linterGroup?: string[];
560
- /** Carries a `preview` mode (Cloudflare/Vercel deploy, npm dist-tag, Fern preview docs, …). Cross-cutting, not its own task. */
561
- preview?: boolean;
562
- /** Turborepo fan-out config for this task — see {@link TurboTaskConfig}. Omitted for whole-repo, non-fan-out tasks. */
563
- turbo?: TurboTaskConfig;
564
- }
565
- declare const TASKS: Record<string, TaskDef>;
566
- /** Every task name the registry knows. */
567
- declare const KNOWN_TASKS: Set<string>;
1260
+ export declare function legacyCallerFile(id: string): string;
568
1261
  /**
569
- * The order `holocron ci` runs tasks in — cheapest / fastest signal first, so
570
- * an agent or a `pre-push` hook fails early. Tasks not listed here run last, in
571
- * manifest order. (The generated thin callers carry no `needs:` — cross-workflow
572
- * ordering lives in `theholocron/.github` — so `holocron ci` declares its own.)
573
- */
574
- declare const CI_ORDER: string[];
575
- //#endregion
576
- //#region src/required-checks.d.ts
577
- /** Ordered (task contexts in {@link CI_ORDER}, then extras), de-duplicated. */
578
- declare function requiredChecks(config: TasksConfig): string[];
579
- //#endregion
580
- //#region src/resolver.d.ts
581
- /**
582
- * Resolves the absolute path to a Bucket A tool's shared `@theholocron/*-config`
583
- * entry point, installed in the consuming repo's own `node_modules` — and the
584
- * CLI flag(s) to hand it via (`--config`, `--extends`, …). `run.ts` splices the
585
- * result into the command it builds for a tool/detect runner or a linter-group
586
- * entry, right after the tool's own args.
587
- *
588
- * Every mapped package's resolved entry point already carries a ready-to-use
589
- * default export (a plain re-export for `prettier`/`commitlint`; an invoked,
590
- * zero-arg preset for `eslint`/`vitest`/`tsdown` — verified end-to-end against
591
- * each tool's real `--config`/`--extends` loader, not just the file's shape).
592
- * A repo doesn't need this package installed at all — every lookup degrades to
593
- * `[]` (no flag added, the tool falls back to its own auto-discovery of a
594
- * local file, unchanged from today) rather than throwing.
595
- *
596
- * **Local file wins.** A `<tool>.config.*` sitting in `cwd` (whether it's
597
- * pure boilerplate or has real per-package customization on top of the
598
- * shared bundle, e.g. `mergeConfig(base, { test: { coverage: { exclude }
599
- * } })`) always skips the splice, even when the shared package is also
600
- * installed — an explicit `--config <shared path>` flag beats a tool's own
601
- * auto-discovery every time, so splicing it unconditionally would silently
602
- * discard that customization the file is still sitting right there on disk.
603
- * The shared bundle is only ever the fallback for a package with *no* local
604
- * file at all — that's still the "delete the file to go fully shared" path
605
- * this was designed for (#676); it just isn't unconditional (#749).
606
- *
607
- * `semantic-release`, `devmoji`, `editorconfig-checker`, and `knip` are
608
- * deliberately absent — `semantic-release-config`'s `defineConfig()` needs
609
- * real per-repo data (branches, npm options) a static `--extends <path>` can't
610
- * carry; `devmoji` runs through a git hook template, not `holocron run
611
- * <task>`; `editorconfig-checker` has no shared-config package yet; `knip` is
612
- * repo-specific by nature, never a shared-config candidate. See
613
- * `.notes/tech-config-resolution.spec.md` (#676).
614
- */
615
- interface ResolverDeps {
616
- readFile: (path: string) => string;
617
- fileExists: (path: string) => boolean;
618
- }
619
- /** Every tool name the resolver knows how to point at a shared config. */
620
- declare const RESOLVABLE_TOOLS: ReadonlySet<string>;
1262
+ * The old file name of a flat reusable workflow — `test-unit.yml` is `verification.unitTests.yml`. The frozen copies in
1263
+ * `theholocron/.github` keep the old names and exist only there, so a reference to a reusable that is called from
1264
+ * outside this repo while `CI_HOME` points at `main` is spelled with it (spec `ci-flat-task-vocabulary`, "Legacy names
1265
+ * while `CI_HOME` points at `.github`"). A file with no old name (`preview.yml`, `ci.yml`) is returned as it is.
1266
+ */
1267
+ export declare function legacyFile(file: string): string;
621
1268
  /**
622
- * `<flag> <absolute path>` for `tool`, resolved against `cwd`'s
623
- * `node_modules` — or `[]` when the tool isn't mapped, `cwd` already has its
624
- * own local config file for it (#749 — local always wins, customized or
625
- * not), the shared package isn't installed, its `package.json` doesn't
626
- * declare the export subpath this needs, or the resolved file doesn't
627
- * actually exist on disk (a stale install, or a package version that
628
- * predates the export existing).
1269
+ * The old name a flat id replaced — `test:unit` is `verification.unitTests`. It is what the generated workflow files,
1270
+ * `turbo.json` tasks and `package.json` scripts are still called until the later phases rename them, so generators
1271
+ * translate through it and the files do not change. `undefined` for an id that never had an old name (`preview`).
1272
+ * `format` and the other formatting successors share the formatting workflow's name.
629
1273
  */
630
- declare function resolveToolConfig(tool: string, cwd: string, deps: ResolverDeps): string[];
631
- //#endregion
632
- //#region src/reusable.d.ts
1274
+ export declare function legacyName(id: string): string | undefined;
633
1275
  /**
634
- * The **reusable** GitHub Actions surface pushed to `theholocron/.github` by
635
- * `holocron sync-github` — the `workflow_call` implementations and composite
636
- * actions that every repo's thin callers delegate to.
637
- *
638
- * `theholocron/.github` is a **pure sync target**: `.github/workflows/*`,
639
- * `.github/actions/*` and `workflow-templates/*` there are generated from the
640
- * `.yml` files in `src/templates/reusable/` and pushed verbatim (with a
641
- * "do not edit" header). Never hand-edit them in `.github`.
1276
+ * The key of the workflow that carries `name` in a repo that still calls the frozen reusables in `theholocron/.github`
1277
+ * (the legacy-name gate): a flat id that shared an old workflow with others (`lint:markdown` and `format` with
1278
+ * `lint:editorconfig`, the old `sourceQuality.formatting`) maps to the first of them, because only that one has a
1279
+ * frozen reusable. Every other name is its own key, an old name mapping to its first successor.
1280
+ */
1281
+ export declare function legacyWorkflowKey(name: string): string;
1282
+ /**
1283
+ * Script names npm and pnpm give a meaning of their own, so no task may be named like one (spec
1284
+ * `ci-flat-task-vocabulary`, "npm lifecycle and package-manager names"): `pnpm publish` runs a script called `publish`
1285
+ * after publishing, `prepare` and the install hooks run on `pnpm install`, `version` hooks wrap `npm version`. That is
1286
+ * why the task is `release`. `prepare` stays a root script (husky) and can never be a task.
1287
+ */
1288
+ export declare const RESERVED_SCRIPT_NAMES: ReadonlySet<string>;
1289
+ /**
1290
+ * pnpm's own commands. `pnpm deploy` runs pnpm's `deploy`, not the script, which is reachable only as `pnpm run deploy`,
1291
+ * so anything that prints a command for a script of this name must print `pnpm run <script>`.
1292
+ */
1293
+ export declare const PNPM_BUILTIN_COMMANDS: ReadonlySet<string>;
1294
+ /**
1295
+ * The flat ids a name written in a manifest, a script or on the command line stands for, in run order: a flat id (or
1296
+ * its hyphen compound in the script spelling, `deploy:preview`) stands for itself, an old dotted name for its
1297
+ * successors (`sourceQuality.formatting` for three), anything else for none. A suite name is not a task and resolves to
1298
+ * none.
1299
+ */
1300
+ export declare function resolveTaskName(name: string): LegacyTarget[];
1301
+ /**
1302
+ * The npm script spelling of a task id: a hyphen compound takes a colon (`deploy-preview` is the script
1303
+ * `deploy:preview`), because `deploy:preview` reads as a variant of `deploy` the way `test:watch` does. Every other id
1304
+ * is its own script name, and only an id that has a script needs it (`check-tokens` and `release` have none).
1305
+ */
1306
+ export declare function scriptName(id: string): string;
1307
+ /**
1308
+ * The suites the registry declares, in the order their first leaf appears: `test`, `lint`, `scan` and `validate`. A suite is declared by the `suite` field of its
1309
+ * leaves; it is never a task id.
1310
+ */
1311
+ export declare const SUITES: readonly string[];
1312
+ /** The leaf ids of a suite, in registry (run) order; empty for a name that is not a suite. */
1313
+ export declare function suiteMembers(suite: string): string[];
1314
+ /**
1315
+ * The key a task has in `turbo.json` and, in a package, as the script that runs it (the two must be the same string):
1316
+ * its script spelling, unless the manifest spells the task with the old dotted name it replaced. Both vocabularies are
1317
+ * accepted for a window, and a repo's packages hold scripts named in the vocabulary its `tasks:` list speaks, so the key
1318
+ * follows the entry. Rewriting the list to flat ids is what moves a repo's turbo keys, and its package scripts with them.
642
1319
  *
643
- * Not to be confused with `WORKFLOW_TEMPLATES` in `thin-callers.ts` — those are
644
- * the *thin-caller bases* written into each consumer repo's `.github/workflows/`.
1320
+ * `name` is the manifest entry, `id` one of the flat ids it stands for (`sourceQuality.formatting` stands for three, and
1321
+ * none of them owns the name, so they are keyed by their ids).
645
1322
  */
646
- /** `workflow_call` implementations → `.github/workflows/<name>.yml`. */
647
- declare const REUSABLE_WORKFLOWS: Record<string, string>;
648
- /** Composite actions → `.github/actions/<name>/action.yml` (key includes `/action`). */
649
- declare const REUSABLE_ACTIONS: Record<string, string>;
650
- /** GitHub starter-workflow metadata → `workflow-templates/<name>.properties.json`. */
651
- declare const WORKFLOW_TEMPLATE_PROPERTIES: Record<string, string>;
1323
+ export declare function taskKey(name: string, id: string): string;
652
1324
  /**
653
- * The complete file batch `holocron sync-github` pushes to `theholocron/.github`:
654
- * path → content. YAML gets the "do not edit" header; the starter-workflow
655
- * `.properties.json` files are left bare (native JSON, not a commented file).
1325
+ * The key a manifest name has in the workflow tables (`WORKFLOW_TEMPLATES`, `WORKFLOW_CHECK_CONTEXTS`): the flat id of
1326
+ * the workflow that carries it. A flat id is its own key; an old name maps to the first id that replaced it
1327
+ * (`sourceQuality.formatting` is `lint:editorconfig`); a task with no workflow of its own maps to the workflow that
1328
+ * runs its check (`format` is `lint:code`, see `TaskDef.host`); a name with no old name (`preview`, an unknown one) is
1329
+ * its own key. See {@link legacyWorkflowKey} for the key a repo that still calls the frozen reusables uses.
656
1330
  */
657
- declare function reusableTemplates(): Map<string, string>;
658
- //#endregion
659
- //#region src/tsconfig.d.ts
660
- /**
661
- * `tsconfig.json` generation — Bucket B (config-resolution workstream, #676):
662
- * the file must stay committed (the TypeScript language server discovers it
663
- * directly from disk, no `--config` override mechanism to hand it a path
664
- * instead), but its content is fully derivable, so it's generated rather
665
- * than hand-authored — the same category as `.editorconfig`
666
- * ({@link "./templates/configs/editorconfig/create-config.js" createConfig})
667
- * and {@link codecovConfig}.
668
- *
669
- * Surveyed every package-level `tsconfig.json` across the org (`holocron`,
670
- * `clients`, `utils` — 20+ packages). `extends: "@theholocron/tsconfig/
671
- * node-lts"`, `compilerOptions.baseUrl: "./"`, `compilerOptions.outDir:
672
- * "./dist"`, `include: ["src/**\/*.ts"]`, and `exclude: ["node_modules",
673
- * "dist"]` are uniform in every one — safe defaults here. `paths` (a `@/*`
674
- * → `./src/*` import alias) is a real per-package choice, present in
675
- * roughly 40% of packages checked — an opt-in parameter, not a default.
676
- *
677
- * Two fields checked and deliberately *not* absorbed as defaults, unlike
678
- * `eslint-config`'s `tsconfigRootDir`/`settings.node` (which turned out
679
- * redundant with the shared package's own behavior, `configs`#461):
680
- * `compilerOptions.module`/`moduleResolution` (only `@theholocron/cli`
681
- * overrides these, to `esnext`/`bundler` — a genuine deviation from the
682
- * shared `node-lts` preset's `nodenext`/`nodenext`, needed for its bundler
683
- * tooling, not something every package should inherit) and
684
- * `compilerOptions.rootDir` (present in exactly two packages, always the
685
- * same value `./src` that `include` already implies — an unnecessary
686
- * override wherever it appears, not a pattern worth generalizing).
687
- *
688
- * Monorepo *root* `tsconfig.json` (a TS project-references "solution
689
- * file" — `holocron`'s own root is `{ files: [], references: [...] }`,
690
- * listing which packages to build) is a structurally different, genuinely
691
- * per-repo document — out of scope here, same as Bucket C content.
692
- *
693
- * Not yet wired into `holocron setup`'s per-package write loop (every
694
- * other Bucket B file there is a single repo-root file, safely
695
- * overwritten every run — `tsconfig.json` is per-package, and most
696
- * packages' files still carry real hand-authored content today, not yet
697
- * migrated to a fully-generated state). That per-package iteration +
698
- * safe-migration design is `#680`'s job, not duplicated here — this is
699
- * the generator itself, ready for it to call.
1331
+ export declare function workflowKey(name: string): string;
1332
+ /**
1333
+ * The workflow keys a manifest name needs a thin caller for, without repeats and in run order: one per workflow that
1334
+ * carries the ids the name stands for. A name that stands for one id has one; `validate` has two, `validate:specs` and
1335
+ * `validate:docs`, because each leaf has a reusable workflow of its own, and `sourceQuality.formatting` has
1336
+ * `lint:editorconfig` and `lint:markdown` (its `format` step runs inside `lint:code`, which has no caller of its own for
1337
+ * it). A name that stands for no id (unknown) is its own key.
700
1338
  */
701
- interface TsconfigOptions {
702
- /** Human-readable name for the `display` field — the package's own name is the usual choice. */
703
- display: string;
1339
+ export declare function workflowKeys(name: string): string[];
1340
+ /**
1341
+ * The task id a workflow source path stands for: the `ci/workflows/` prefix (or `../workflows/`, which is how
1342
+ * `src/index.ts` globs it) and the `.yml` suffix are dropped, and each folder separator becomes a colon, so
1343
+ * `ci/workflows/test/unit.yml` is `test:unit` and `ci/workflows/typecheck.yml` is `typecheck`. The folder is the
1344
+ * suite of a leaf; {@link workflowFile} gives the generated file name of the id.
1345
+ */
1346
+ export declare function idFromSource(path: string): string;
1347
+ /**
1348
+ * The file name of the reusable workflow generated for a task id: a colon becomes a hyphen and `.yml` is added, so
1349
+ * `test:unit` is `test-unit.yml` and `typecheck` is `typecheck.yml`. GitHub reads only a flat `.github/workflows`, which
1350
+ * is why the grouped sources of `ci/workflows/` are flattened; {@link idFromSource} goes the other way.
1351
+ */
1352
+ export declare function workflowFile(id: string): string;
1353
+ /**
1354
+ * `.husky/commit-msg` — lints the commit message via `holocron run lint
1355
+ * commit-msg` (holocron#789), the real programmatic replacement for
1356
+ * shelling out to `commitlint --edit`. Installed by `holocron setup` when
1357
+ * hooks are enabled. Same `__HOLOCRON_SCRIPT__` substitution as `pre-push`.
1358
+ *
1359
+ * @param holocronScript - the command that invokes the CLI. Defaults to
1360
+ * `pnpm exec holocron`; the source repo passes `node cli/cli/dist/cli.mjs`.
1361
+ */
1362
+ declare function createConfig(holocronScript?: string): string;
1363
+ /** What varies in the generated `.github/dependabot.yml`; the rest of the file is the same for every repo. */
1364
+ interface DependabotConfigOptions {
704
1365
  /**
705
- * `@theholocron/tsconfig` variant. Defaults to `"node-lts"` — every
706
- * checked package uses it; the other three (`astro`, `nextjs`, `react`)
707
- * exist for a template repo's app-shaped packages, not the plain
708
- * Node.js library packages this org's currently-migrated repos ship.
1366
+ * Packages Dependabot must not raise version updates for, by exact name. Each becomes a name-only
1367
+ * `ignore` entry on the npm ecosystem. Security updates are not affected: for those, Dependabot
1368
+ * only honours an `ignore` entry that lists `versions`.
709
1369
  */
710
- variant?: "astro" | "nextjs" | "node-lts" | "react";
1370
+ ignore?: readonly string[];
711
1371
  /**
712
- * Add a `@/*` → `./src/*` path alias. A real per-package choice, not a
713
- * default — roughly 40% of packages checked use one, the rest don't.
1372
+ * Directories, besides `.github/workflows` (`/`), whose workflow and action files the github-actions ecosystem
1373
+ * watches: the sources a repo generates its workflows from. Dependabot does not bump those otherwise, so
1374
+ * `probe generated check` fails on the difference. Globs are allowed.
714
1375
  */
715
- paths?: boolean;
1376
+ sources?: readonly string[];
716
1377
  }
717
1378
  /**
718
- * A package-level `tsconfig.json` — the uniform shape confirmed across
719
- * every package checked, parameterized only by the two fields that
720
- * genuinely vary (`display`, `paths`). No scaffold/workflow header (matches
721
- * `.alexrc.json`'s existing precedent for a strict-JSON Bucket B file —
722
- * JSON has no comment syntax to carry one, and TypeScript's own tolerance
723
- * for JSONC comments in `tsconfig.json` isn't worth relying on for a file
724
- * this thin).
1379
+ * The content of `.github/dependabot.yml`, with its generated-file header. Names in `ignore` get a name-only
1380
+ * `ignore` entry on the npm ecosystem, and `sources` are watched next to `/` (`.github/workflows`) by the
1381
+ * github-actions one; with neither, the file is the shared body unchanged.
1382
+ */
1383
+ declare function createConfig$1({ ignore, sources }?: DependabotConfigOptions): string;
1384
+ /** The `devmoji.config.cjs` body, which defers to `@theholocron/devmoji-config`. */
1385
+ declare function createConfig$2(): string;
1386
+ /** The `.editorconfig` body, under the auto-generated header. */
1387
+ declare function createConfig$3(): string;
1388
+ /**
1389
+ * The generated `.editorconfig-checker.json`.
1390
+ *
1391
+ * Deliberately carries no `"Version"` key: editorconfig-checker treats it as a
1392
+ * hard gate and exits non-zero the moment the running binary's version differs
1393
+ * — which it does the instant a contributor's local install (Homebrew tracks
1394
+ * latest) drifts from the version super-linter bundles in CI, breaking
1395
+ * `holocron run lint` / the pre-push hook for everyone (#618). The config
1396
+ * options here (`Exclude`, `Disable`) are stable across releases, so pinning
1397
+ * buys nothing.
1398
+ */
1399
+ declare function createConfig$4(): string;
1400
+ /** The `.github/labeler.yml` body, which labels a pull request by its Conventional Commit type. */
1401
+ declare function createConfig$5(): string;
1402
+ /**
1403
+ * `.husky/pre-commit` — runs GitLeaks (scoped to staged changes) and
1404
+ * lint-staged before every commit. Installed by `holocron setup` when hooks
1405
+ * are enabled (default for `protection: "strict"`). `git commit --no-verify`
1406
+ * bypasses it.
1407
+ *
1408
+ * `gitleaks protect --staged` (not `gitleaks git`) is deliberate: the latter
1409
+ * scans the entire commit history on every invocation, so once any false
1410
+ * positive lands in a past commit — a fake test token, an example key in a
1411
+ * doc — every future commit is permanently blocked, regardless of what's
1412
+ * actually staged.
1413
+ */
1414
+ declare function createConfig$6(): string;
1415
+ /**
1416
+ * `.husky/pre-push` — runs `holocron run ci` (the merge-gating checks, in CI order)
1417
+ * before every push. Installed by `holocron setup` when hooks are enabled
1418
+ * (default for `protection: "strict"`). `git push --no-verify` bypasses it.
1419
+ *
1420
+ * A script that runs a built file (`node cli/cli/dist/cli.mjs`) gets a check first: in a fresh clone or linked worktree
1421
+ * the build does not exist yet, and without it the push dies with a module-not-found stack trace instead of saying what
1422
+ * to do (#1104).
1423
+ *
1424
+ * @param holocronScript - the command that invokes the CLI. Defaults to
1425
+ * `pnpm exec holocron`; the source repo passes `node cli/cli/dist/cli.mjs`.
725
1426
  */
726
- declare function createTsconfig(options: TsconfigOptions): string;
727
- //#endregion
728
- export { type Astromech, type AstromechOptions, CI_ORDER, type CiJobReport, type CiOptions, type CiReport, type ExecFn, type JobDef, KNOWN_TASKS, KNOWN_WORKFLOWS, LINTERS, LINTER_NAMES, type LinterDef, type LocalRunner, type OrgContext, type PreviewConfig, RESOLVABLE_TOOLS, REUSABLE_ACTIONS, REUSABLE_WORKFLOWS, type ResolverDeps, type RunLogger, type RunOptions, type RunTaskInput, type RunTaskReport, TASKS, type TaskDef, type TsconfigOptions, WORKFLOW_CHECK_CONTEXTS, WORKFLOW_TEMPLATES, WORKFLOW_TEMPLATE_PROPERTIES, type WorkspacePackage, codecovComponentBlock, codecovConfig, createAstromech, createCodecovConfig, createTsconfig, deriveDeployPaths, ensureIfNotFound, extractPreviewConfig, generateCombinedDeployContent, generateThinCallerContent, mergeCodecovComponents, normalizeWorkflowWith, readWorkspacePackages, requiredChecks, resolveLinters, resolveToolConfig, reusableTemplates, runCi, runTask };
1427
+ declare function createConfig$7(holocronScript?: string): string;
1428
+ /** The `.husky/prepare-commit-msg` hook, a shell script under the auto-generated header. */
1429
+ declare function createConfig$8(): string;
1430
+ /** The `.yamllint.yml` body, under the auto-generated header. */
1431
+ declare function createConfig$9(): string;
1432
+ /** The `.yamlignore` body. */
1433
+ declare function createIgnoreConfig(): string;
1434
+ export { type AggregateChecks, type Astromech, type AstromechOptions, type CheckReleaseLinesInput, type CiJobReport, type CiOptions, type CiReport, type CreateHeaderOptions, type DependabotConfigOptions, type DeployOnReleaseOptions, type DeployOnReleaseReport, type DeployOnReleaseResult, type WorkspacePackage as DeployWorkspacePackage, type DocsCoverageMode, type ExecFn, type GitTag, type GroupJobReport, type GroupOptions, type GroupReport, type HeaderFunctions, type LegacyTarget, type LocalRunner, type MergedScripts, type NpmDistTags, type OrgContext, type PackageBehind, type PackageRole, type PackageScriptProblem, type PlannedKind, type PlannedTask, type PreviewConfig, type ReleaseLine, type ReleaseTagCheck, type ReleaseTagState, type RepoShape, type RunLogger, type RunOptions, type RunTaskInput, type RunTaskReport, type StatusContext, type TaskDef, type TaskGroup, type TaskScope, type TsconfigOptions, type WorkflowHeaderFormat, type WorkspacePackage$1 as WorkspacePackage, createConfig as createCommitMsg, createConfig$1 as createDependabot, createConfig$2 as createDevmoji, createConfig$3 as createEditorconfig, createConfig$4 as createEditorconfigChecker, createConfig$5 as createLabeler, createConfig$6 as createPreCommit, createConfig$7 as createPrePush, createConfig$8 as createPrepareCommitMsg, createIgnoreConfig as createYamlignore, createConfig$9 as createYamllint };