@theholocron/astromech 5.0.0-alpha.28 → 5.0.0-alpha.281

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,253 @@
1
- import { r as TasksConfig } from "./schema-D01VYg43.mjs";
2
- //#region src/run.d.ts
1
+ import { r as TasksConfig } from "./schema.type-C-3fZESa.mjs";
3
2
  /**
4
- * `holocron run <task> [job] [-- <passthrough>]` — run a registry task (or one
5
- * of its sub-jobs) locally.
3
+ * How strictly a repo enforces doc-comment coverage of its public API (`repoValidation.docsCoverage`, spec
4
+ * `tech-api-docs`): `off` (the default) does nothing, `warn` reports without failing and posts informational Codecov
5
+ * statuses, `required` fails the check and posts statuses that are not informational.
6
+ */
7
+ type DocsCoverageMode = "off" | "warn" | "required";
8
+ /** Per-repo choices that change what the `codecov.yml` generator writes. */
9
+ interface CodecovConfigOptions {
10
+ /** Adds the `documentation` flag and its statuses to `codecov.yml`. Default `off`: nothing is added. */
11
+ docsCoverage?: DocsCoverageMode;
12
+ }
13
+ /** A workspace package as the `codecov.yml` generator sees it: the flag and component it gets, and where it lives. */
14
+ interface WorkspacePackage$1 {
15
+ /** The package's folder name, used as its Codecov flag and component id. */
16
+ slug: string;
17
+ /** The package's npm name. */
18
+ name: string;
19
+ /** The workspace root the package was discovered under (`packages`, `apps`, `clients`, ...). Defaults to `"packages"`. */
20
+ dir?: string;
21
+ /**
22
+ * Repo-relative directory, set when it is not `<dir>/<slug>` -- a package that
23
+ * is itself a workspace folder (`observability`) or sits deeper (`docs/theme`).
24
+ */
25
+ path?: string;
26
+ }
27
+ /** The YAML list of components, one per package and grouped by workspace root, that `codecov.yml` carries. */
28
+ export declare function codecovComponentBlock(packages: WorkspacePackage$1[]): string;
29
+ /**
30
+ * Ensure every codecov status default carries `if_not_found: success`, so an
31
+ * infra-only PR (dep bump, config, lockfile — no coverable change) passes
32
+ * instead of hanging forever on a required check codecov never posts.
6
33
  *
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/`).
34
+ * Injects the key on the line after each `target:` that sits inside a status
35
+ * block (`coverage.status.*.default` or a `statuses:` list item — indent ≥ 8,
36
+ * or ≥ 8 for a `- type:` list entry), when the immediate sibling lines do not
37
+ * already declare it.
38
+ */
39
+ export declare function ensureIfNotFound(yaml: string): string;
40
+ /**
41
+ * The `uploads` input of the `verification.unitTests` workflow: a JSON list of `{ flag, files }`, one per package
42
+ * that has a flag. `files` is where the package writes its lcov report (`<location>/coverage/lcov.info`), unless
43
+ * `lcovPaths` names another for that slug (a package whose test runner writes it elsewhere).
44
+ */
45
+ export declare function codecovUploads(packages: WorkspacePackage$1[], lcovPaths?: Record<string, string>): string;
46
+ /**
47
+ * Brings an existing `codecov.yml` up to date with the workspace packages (flags, components and status rules) and the
48
+ * repo's `options`, keeping every hand edit.
49
+ */
50
+ export declare function mergeCodecovComponents(existing: string, packages: WorkspacePackage$1[], options?: CodecovConfigOptions): string;
51
+ /**
52
+ * Every package the repo's `pnpm-workspace.yaml` declares (the default roots
53
+ * when it declares none), sorted by location, so each group folder (`cli/`, `plugins/`, ...) stays together. Every one needs a
54
+ * codecov component so `codecov/patch/<slug>` actually posts for each. A
55
+ * package at `<root>/<slug>` carries `dir: <root>`; one that is itself a
56
+ * workspace folder (`observability`) or sits deeper (`docs/theme`) carries its
57
+ * `path`. Two packages with the same folder name are told apart by their full
58
+ * path (`docs-theme`). `[]` when there are none.
59
+ */
60
+ export declare function readWorkspacePackages(repoRoot: string): WorkspacePackage$1[];
61
+ /** A brand-new `codecov.yml` — the scaffold header + the base template + this repo's component list. */
62
+ export declare function createCodecovConfig(packages: WorkspacePackage$1[], options?: CodecovConfigOptions): string;
63
+ /**
64
+ * The full pipeline `holocron repo setup` needs: read this repo's public
65
+ * `packages/*`, then either merge them into an `existing` `codecov.yml` or
66
+ * scaffold a new one.
67
+ */
68
+ export declare function codecovConfig(repoRoot: string, existing: string | null, options?: CodecovConfigOptions): string;
69
+ /**
70
+ * The **reusable** GitHub Actions surface pushed to `theholocron/.github` by
71
+ * `holocron sync github` — the `workflow_call` implementations and composite
72
+ * actions that every repo's thin callers delegate to.
10
73
  *
11
- * Resolution:
74
+ * `theholocron/.github` is a **pure sync target**: `.github/workflows/*`,
75
+ * `.github/actions/*` and `workflow-templates/*` there are generated from the
76
+ * `.yml` files in `src/templates/reusable/` and pushed verbatim (with a
77
+ * "do not edit" header). Never hand-edit them in `.github`.
78
+ *
79
+ * Not to be confused with `WORKFLOW_TEMPLATES` in `github-action-thin-callers.ts` — those are
80
+ * the *thin-caller bases* written into each consumer repo's `.github/workflows/`.
81
+ */
82
+ /** `workflow_call` implementations → `.github/workflows/<name>.yml`. */
83
+ export declare const REUSABLE_WORKFLOWS: Record<string, string>;
84
+ /** Composite actions → `.github/actions/<name>/action.yml` (key includes `/action`). */
85
+ export declare const REUSABLE_ACTIONS: Record<string, string>;
86
+ /** GitHub starter-workflow metadata → `workflow-templates/<name>.properties.json`. */
87
+ export declare const WORKFLOW_TEMPLATE_PROPERTIES: Record<string, string>;
88
+ /**
89
+ * The complete file batch `holocron sync github` pushes to `theholocron/.github`:
90
+ * path → content. YAML gets the "do not edit" header; the starter-workflow
91
+ * `.properties.json` files are left bare (native JSON, not a commented file).
92
+ */
93
+ export declare function reusableTemplates(): Map<string, string>;
94
+ /** Where a repo's pull-request previews are deployed. */
95
+ interface PreviewConfig {
96
+ /** Cloudflare Pages project name shared across all repos for previews. */
97
+ project: string;
98
+ /**
99
+ * Base domain for preview URLs (e.g. `"preview.theholocron.dev"`).
100
+ * When set, `holocron repo setup` automatically provisions:
101
+ * - Cloudflare Pages custom domain `*.<domain>` on the project
102
+ * - DNS wildcard CNAME `*.<domain>` → `<project>.pages.dev`
103
+ *
104
+ * Preview URLs resolve as `<repo>-pr-<n>.<domain>`.
105
+ */
106
+ domain?: string;
107
+ }
108
+ /** Org-level context used to derive preview defaults from `preview: true`. */
109
+ interface OrgContext {
110
+ /** GitHub org name — becomes the prefix of the default project: `<org>-preview`. */
111
+ org?: string;
112
+ /** Org canonical domain — becomes `preview.<domain>` for the default preview domain. */
113
+ domain?: string;
114
+ /** Project name — injected as the `name` input to the deploy reusable when `docs: true`. */
115
+ repoName?: string;
116
+ }
117
+ /** The reusable-workflow thin-caller templates, by task name. */
118
+ export declare const WORKFLOW_TEMPLATES: Record<string, string>;
119
+ /** The task names that have a thin-caller workflow template. */
120
+ export declare const KNOWN_WORKFLOWS: Set<string>;
121
+ /**
122
+ * The GitHub status-check context a `required` task contributes to branch
123
+ * protection. Format: `"{workflow name} / {job name}"`.
12
124
  *
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)
125
+ * Most of these are single-job workflows now (D3's decomposition split what
126
+ * used to be multi-job `lint`/`audit` into one task per concern) — the
127
+ * context names that job directly, no `Conclusion` aggregator needed; a
128
+ * single job's own conclusion already *is* the workflow's conclusion.
129
+ * `Conclusion` fan-in jobs are kept only where a task genuinely has several
130
+ * conditionally-run jobs feeding one required check:
131
+ * `verification.unitTests` (unit / Storybook / Chromatic / interaction /
132
+ * user-flow, each gated by its own `run-*` input) and
133
+ * `platform.repoValidation` (its three script jobs all must pass). Only
134
+ * merge-gating workflows are listed. `astromech.requiredChecks()` reads this
135
+ * for every `required` task.
136
+ */
137
+ export declare const WORKFLOW_CHECK_CONTEXTS: Partial<Record<string, string>>;
138
+ /**
139
+ * Generate the thin caller content for a workflow, optionally injecting or
140
+ * merging `with:` overrides into the jobs block.
23
141
  *
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.
142
+ * Two strategies are used depending on the template:
143
+ * - Templates that already have a `with:` block (e.g. lint):
144
+ * the override entries are merged in, replacing existing keys and appending
145
+ * new ones.
146
+ * - Templates that end with ` secrets: inherit`: a new `with:` block is
147
+ * injected immediately before `secrets: inherit`.
148
+ * If neither pattern matches the template, a warning is emitted and the
149
+ * base template is returned unchanged.
150
+ */
151
+ export declare function generateThinCallerContent(name: string, withOverrides?: Record<string, unknown>, additionalPaths?: string[],
152
+ /** Optional sink for the "could not inject `with:`" warning. */
153
+ logger?: {
154
+ warn(obj: Record<string, unknown>, msg: string): void;
155
+ },
156
+ /**
157
+ * `with:` key → a `# comment` line rendered immediately above that entry.
158
+ * Only honored when injecting a fresh `with:` block (no template today
159
+ * ships one), which is the path `lint` takes.
31
160
  */
161
+ comments?: Record<string, string>): string;
162
+ /**
163
+ * Extract the Cloudflare Pages preview config from a deploy workflow's `with:` object.
164
+ *
165
+ * Accepts three forms:
166
+ * - `preview: true` — derive both project and domain from org context
167
+ * - `preview: { project: "..." }` — explicit project; domain derived from context if omitted
168
+ * - `preview: { project: "...", domain: "..." }` — fully explicit
169
+ *
170
+ * Returns null when `preview:` is absent, false, or can't be resolved.
171
+ */
172
+ export declare function extractPreviewConfig(raw: Record<string, unknown>, ctx?: OrgContext): PreviewConfig | null;
173
+ /**
174
+ * Generate the full thin-caller YAML for a `deploy.yml` that handles both
175
+ * production (push to main → GitHub Pages) and preview (pull_request →
176
+ * Cloudflare Pages) in a single file.
177
+ *
178
+ * Both jobs receive the same docs/storybook `with:` inputs. If the per-repo
179
+ * config supplies `cloudflare-project` it is forwarded; otherwise the reusable
180
+ * falls back to the `CLOUDFLARE_PAGES_PROJECT` org variable — set that once and
181
+ * all repos with a `deploy` workflow get previews without per-repo config.
182
+ */
183
+ export declare function generateCombinedDeployContent(deployWith: Record<string, unknown>, paths: string[], preview: Pick<PreviewConfig, "project">): string;
184
+ /**
185
+ * Expand structured with-values to flat GitHub Actions inputs before
186
+ * generating the thin caller. Handles:
187
+ * - deploy shorthand: docs/storybook → type + storybook-projects
188
+ * - preview: stripped (handled separately via extractPreviewConfig)
189
+ * - chromatic-projects entries' untraced array → newline-joined string
190
+ * - plain arrays → JSON-stringified for YAML scalar quoting
191
+ *
192
+ * Used by both `holocron repo setup` and `sync-workflow-templates`.
193
+ */
194
+ export declare function normalizeWorkflowWith(raw: Record<string, unknown>): Record<string, unknown>;
195
+ /**
196
+ * Derive on.push.paths entries from the deploy with: shorthand.
197
+ * Used by both `holocron repo setup` and `sync-workflow-templates`.
198
+ */
199
+ export declare function deriveDeployPaths(raw: Record<string, unknown>): string[];
200
+ /** Ordered (task contexts in {@link CI_ORDER}, then extras), de-duplicated. */
201
+ export declare function requiredChecks(config: TasksConfig): string[];
202
+ /** Options for a package's generated `tsconfig.json`. */
203
+ interface TsconfigOptions {
204
+ /** Human-readable name for the `display` field — the package's own name is the usual choice. */
205
+ display: string;
206
+ /**
207
+ * `@theholocron/tsconfig` variant. Defaults to `"node-lts"` — every
208
+ * checked package uses it; the other three (`astro`, `nextjs`, `react`)
209
+ * exist for a template repo's app-shaped packages, not the plain
210
+ * Node.js library packages this org's currently-migrated repos ship.
211
+ */
212
+ variant?: "astro" | "nextjs" | "node-lts" | "react";
213
+ /**
214
+ * Add a `@/*` → `./src/*` path alias. A real per-package choice, not a
215
+ * default — roughly 40% of packages checked use one, the rest don't.
216
+ */
217
+ paths?: boolean;
218
+ }
219
+ /**
220
+ * A package-level `tsconfig.json` — the uniform shape confirmed across
221
+ * every package checked, parameterized only by the two fields that
222
+ * genuinely vary (`display`, `paths`). No scaffold/workflow header (matches
223
+ * `.alexrc.json`'s existing precedent for a strict-JSON Bucket B file —
224
+ * JSON has no comment syntax to carry one, and TypeScript's own tolerance
225
+ * for JSONC comments in `tsconfig.json` isn't worth relying on for a file
226
+ * this thin).
227
+ */
228
+ export declare function createTsconfig(options: TsconfigOptions): string;
229
+ interface EnsureRootWorkspaceMemberResult {
230
+ content: string;
231
+ changed: boolean;
232
+ }
233
+ interface EnsureTurboDependencyResult {
234
+ content: string;
235
+ changed: boolean;
236
+ }
32
237
  /** Minimal structural logger — `@theholocron/observability`'s `Logger` satisfies it. */
33
238
  interface RunLogger {
239
+ /** Records a debug-level structured line. */
34
240
  debug(obj: Record<string, unknown>, msg?: string): void;
241
+ /** Records a warning. */
35
242
  warn(obj: Record<string, unknown>, msg?: string): void;
36
243
  }
244
+ /**
245
+ * Runs `cmd` and reports its exit code. `opts.env` is added to the child's
246
+ * environment (on top of the parent's), e.g. `TURBO_SCM_BASE` for `--affected`.
247
+ */
37
248
  type ExecFn = (cmd: string, args: string[], opts: {
38
249
  cwd: string;
250
+ env?: Record<string, string>;
39
251
  }) => {
40
252
  exitCode: number;
41
253
  };
@@ -55,6 +267,7 @@ interface RunDeps {
55
267
  /** `node_modules/.bin/<bin>` or a PATH entry; `null` when not runnable. */
56
268
  lookPath: (cwd: string, bin: string) => string | null;
57
269
  }
270
+ /** What `runTask` needs for one task: the task, where to run it, and the injected dependencies. */
58
271
  interface RunTaskInput extends RunDeps {
59
272
  /** Registry task name, e.g. `"test"`. */
60
273
  task: string;
@@ -73,161 +286,254 @@ interface RunTaskInput extends RunDeps {
73
286
  required?: boolean;
74
287
  /** `turbo --filter=<pkg>` passthrough (monorepo). Ignored when the repo has no `turbo.json`. */
75
288
  filter?: string;
289
+ /** `turbo --affected`: only the packages changed since `base`, plus their dependents. Ignored without a `turbo.json`. */
290
+ affected?: boolean;
291
+ /** Git ref `affected` compares against; falls back to `TURBO_SCM_BASE`. */
292
+ base?: string;
293
+ /** Environment `affected` reads (`GITHUB_EVENT_NAME`, `GITHUB_REF_NAME`, `TURBO_SCM_BASE`). Defaults to empty. */
294
+ env?: Record<string, string | undefined>;
295
+ /** The task entry's `jobs` switches: a sub-job set to `false` (by key or alias) is not run. */
296
+ jobSwitches?: Record<string, boolean>;
76
297
  }
298
+ /** The result of `runTask`. */
77
299
  interface RunTaskReport {
300
+ /** `ok`, `fail`, `skip` (no such task for this repo), `dry-run` or `unknown` (not a registry task). */
78
301
  status: "ok" | "fail" | "skip" | "dry-run" | "unknown";
79
302
  /** Resolved command, for the caller / tests. */
80
303
  command?: string;
304
+ /** Why the task failed or was skipped. */
81
305
  message?: string;
82
306
  }
83
- declare function runTask(input: RunTaskInput): RunTaskReport;
84
- //#endregion
85
- //#region src/ci.d.ts
307
+ /**
308
+ * Resolves one registry task (an explicit turbo task, a `package.json` script, then the registry's built-in runner)
309
+ * and runs it, or prints the command on a dry run.
310
+ */
311
+ export declare function runTask(input: RunTaskInput): RunTaskReport;
312
+ /** Options for `Astromech.ci`: the scope, turbo filtering and whether to only print the plan. */
86
313
  interface CiOptions {
87
314
  /** Print the plan without running anything. */
88
315
  dryRun?: boolean;
89
316
  /** `turbo --filter=<pkg>` passthrough (monorepo). */
90
317
  filter?: string;
318
+ /** `turbo --affected`: only the packages changed since `base`. */
319
+ affected?: boolean;
320
+ /** Git ref `affected` compares against. */
321
+ base?: string;
322
+ /** Environment `affected` reads. */
323
+ env?: Record<string, string | undefined>;
91
324
  /** `"required"` (default) or `"all"` (every `ci: true` task). */
92
325
  scope?: "required" | "all";
93
326
  }
327
+ /** The result of one task in a CI pre-flight run. */
94
328
  interface CiJobReport {
329
+ /** Registry task name, e.g. `"test"`. */
95
330
  task: string;
96
331
  /** The branch-protection check context, or `null` for a non-gating task. */
97
332
  checkContext: string | null;
333
+ /** `ok`, `fail`, `skip` (nothing to run for this repo) or `dry-run` (planned, not run). */
98
334
  status: "ok" | "fail" | "skip" | "dry-run";
335
+ /** The resolved command, when one was run or planned. */
99
336
  command?: string;
337
+ /** Why the job failed or was skipped. */
100
338
  message?: string;
101
339
  }
340
+ /** The result of a CI pre-flight run. */
102
341
  interface CiReport {
342
+ /** `fail` if any job failed, else `ok`. */
103
343
  status: "ok" | "fail";
344
+ /** One entry per task. */
104
345
  jobs: CiJobReport[];
105
346
  }
106
347
  interface CiInput extends RunDeps, CiOptions {
107
348
  cwd: string;
108
349
  config: TasksConfig;
109
350
  }
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;
351
+ /** Runs the merge-gating tasks in CI order and reports each job and an overall `ok` or `fail`. */
352
+ export declare function runCi(input: CiInput): CiReport;
353
+ /** Comment style produced by workflowHeader. */
354
+ type WorkflowHeaderFormat = "yaml" | "cjs" | "shebang";
355
+ /** Where a generated file came from, for the header `createHeader` writes. */
356
+ interface CreateHeaderOptions {
357
+ /** Path within theholocron/holocron that owns the file being generated. */
358
+ source: string;
359
+ /** CLI command that produces the file. Defaults to "holocron repo setup". */
360
+ tool?: string;
361
+ /** Set true only when writing to theholocron/.github itself. */
362
+ forPrimary?: boolean;
363
+ }
364
+ /** The header writers `createHeader` returns, one per kind of generated file. */
365
+ interface HeaderFunctions {
166
366
  /**
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`
367
+ * "AUTO-GENERATED — do not edit" header for files managed on every run.
171
368
  *
172
- * Preview URLs resolve as `<repo>-pr-<n>.<domain>`.
369
+ * format:
370
+ * "yaml" — `# …` comment lines (YAML, text, ignore files)
371
+ * "cjs" — `/* … *\/` block comment (CommonJS modules)
372
+ * "shebang" — `#!/bin/sh` on line 1, then yaml header (shell scripts)
173
373
  */
174
- domain?: string;
175
- }
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;
374
+ workflowHeader(format?: WorkflowHeaderFormat): string;
375
+ /**
376
+ * "Scaffolded — edit this file freely" header for one-time generated files
377
+ * that the user is expected to take over (e.g. codecov.yml).
378
+ */
379
+ scaffoldHeader(): string;
184
380
  }
185
381
  /**
186
- * Extract the Cloudflare Pages preview config from a deploy workflow's `with:` object.
382
+ * Factory that binds `source` and `tool` once and returns all header
383
+ * constructors for auto-generated files. Prefer this over passing source
384
+ * as a positional argument at every call site.
187
385
  *
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
386
+ * @example
387
+ * const { workflowHeader, scaffoldHeader } = createHeader({
388
+ * source: "cli/astromech/src/templates/configs/editorconfig/create-config.ts",
389
+ * });
192
390
  *
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.
391
+ * export function createConfig(): string {
392
+ * return `${workflowHeader()}${body}`;
393
+ * }
200
394
  *
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.
395
+ * ## Which header to use
396
+ *
397
+ * | Function | When to use | User can edit? |
398
+ * |-------------------|----------------------------------------------------|----------------|
399
+ * | `workflowHeader` | Files overwritten on every setup / sync-github run | No — "AUTO-GENERATED — do not edit" |
400
+ * | `scaffoldHeader` | Files written once; user takes ownership after | Yes — "Scaffolded — edit this file freely" |
401
+ *
402
+ * ## `workflowHeader` formats
403
+ *
404
+ * | Format | Comment style | Used for |
405
+ * |---------------------|------------------------|-------------------------------------------------------|
406
+ * | `"yaml"` (default) | `# …` lines | YAML workflows, ignore files, `.editorconfig`, labeler|
407
+ * | `"cjs"` | `/* … *\/` block | CommonJS config files (`.cjs`) |
408
+ * | `"shebang"` | `#!/bin/sh` + `# …` | Shell scripts (`prepare-commit-msg`, hooks) |
205
409
  */
206
- declare function generateCombinedDeployContent(deployWith: Record<string, unknown>, paths: string[], preview: Pick<PreviewConfig, "project">): string;
410
+ export declare function createHeader(options: CreateHeaderOptions): HeaderFunctions;
411
+ /** The names of the directories directly inside `path`. */
412
+ export declare const defaultListDirs: (path: string) => string[];
413
+ /** Reads and parses the JSON file at `path`. */
414
+ export declare const defaultReadJson: (path: string) => unknown;
415
+ interface SpawnResult {
416
+ status: number | null;
417
+ stdout: string;
418
+ stderr: string;
419
+ }
420
+ type Run = (command: string, args: string[], options: Record<string, unknown>) => SpawnResult;
421
+ /** A workspace package: absolute folder, and what its `package.json` says. */
422
+ interface WorkspacePackage {
423
+ /** The package's `name`. */
424
+ name: string;
425
+ /** Absolute path of the package folder. */
426
+ dir: string;
427
+ /** The package's `version`; `undefined` when its manifest has none. */
428
+ version: string | undefined;
429
+ /** The package's `dependencies`, name to range. */
430
+ dependencies: Record<string, string>;
431
+ /**
432
+ * A workspace:* devDependency can optionally count too (holocron#1071,
433
+ * workspaceDependencies' includeDevDependencies option). Optional so a
434
+ * caller holding the previous, dev-dependency-less shape (a plain
435
+ * object literal, or a value from outside this package's own version)
436
+ * keeps compiling and working -- a missing value is treated the same
437
+ * as `{}`.
438
+ */
439
+ devDependencies?: Record<string, string>;
440
+ }
441
+ interface Tree {
442
+ readJson: (path: string) => unknown;
443
+ listDirs: (path: string) => string[];
444
+ }
207
445
  /**
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
214
- *
215
- * Used by both `holocron setup` and `sync-workflow-templates`.
446
+ * Every package the repo's `pnpm-workspace.yaml` declares (`packages/*`,
447
+ * `apps/*` and `plugins/*` when it declares none) with a readable, named
448
+ * `package.json`.
216
449
  */
217
- declare function normalizeWorkflowWith(raw: Record<string, unknown>): Record<string, unknown>;
450
+ export declare function workspacePackages(repoRoot: string, { readJson, listDirs }: Tree): WorkspacePackage[];
451
+ /** What `deployOnRelease` needs to know about a release. */
452
+ interface DeployOnReleaseOptions {
453
+ /** Repo root. */
454
+ cwd: string;
455
+ /** The release's channel: its prerelease identifier (`alpha`); empty or `main` for a stable release. */
456
+ channel: string;
457
+ /** The previous release's commit; omitted when there is none, so every deploying channel match deploys. */
458
+ from?: string;
459
+ /** The release commit. Default `HEAD`. */
460
+ to?: string;
461
+ /** Where progress lines go (stdout in the CLI). */
462
+ print: (line: string) => void;
463
+ /** Print what would deploy without running it. */
464
+ dryRun?: boolean;
465
+ }
466
+ interface DeployOnReleaseDeps extends Partial<Tree> {
467
+ run?: Run;
468
+ sleep?: (ms: number) => Promise<void>;
469
+ now?: () => number;
470
+ /** Reads a package folder's task manifest; `loadTasksConfig` by default. */
471
+ loadTasks?: (dir: string) => Promise<TasksConfig>;
472
+ }
473
+ /** The outcome of deploying one workspace package. */
474
+ interface DeployOnReleaseResult {
475
+ /** The package's name. */
476
+ pkg: string;
477
+ /** `ok`, `fail`, `skip` (the package does not deploy on this release) or `dry-run`. */
478
+ status: "ok" | "fail" | "skip" | "dry-run";
479
+ /** A one-line account of what happened. */
480
+ message: string;
481
+ }
482
+ /** The outcome of a release-time deploy across the workspace. */
483
+ interface DeployOnReleaseReport {
484
+ /** `fail` if any package's deploy failed; `skip` if none applied to this release; else `ok`. */
485
+ status: "ok" | "fail" | "skip";
486
+ /** One entry per package considered for this release. */
487
+ results: DeployOnReleaseResult[];
488
+ }
218
489
  /**
219
- * Derive on.push.paths entries from the deploy with: shorthand.
220
- * Used by both `holocron setup` and `sync-workflow-templates`.
490
+ * Deploys every package whose manifest declares a release-time deploy that
491
+ * applies to this release. Never throws for a deploy problem: each package's
492
+ * outcome is in the report, and `status: "fail"` is the caller's exit code.
221
493
  */
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;
494
+ export declare function deployOnRelease(options: DeployOnReleaseOptions, { run, readJson, listDirs, sleep, now, loadTasks }?: DeployOnReleaseDeps): Promise<DeployOnReleaseReport>;
495
+ /** Options for running a namespace of tasks: a dry run and turbo scoping. */
496
+ interface GroupOptions {
497
+ /** Print the resolved commands without running anything. */
498
+ dryRun?: boolean;
499
+ /** `turbo --filter=<pkg>` passthrough (monorepo). */
500
+ filter?: string;
501
+ /** `turbo --affected`: only the packages changed since `base`. */
502
+ affected?: boolean;
503
+ /** Git ref `affected` compares against. */
504
+ base?: string;
505
+ /** Environment `affected` reads. */
506
+ env?: Record<string, string | undefined>;
507
+ }
508
+ /** The result of one task in a namespace run. */
509
+ interface GroupJobReport {
510
+ /** Registry task name, e.g. `"sourceQuality.formatting"`. */
511
+ task: string;
512
+ /** `ok`, `fail`, `skip` (nothing to run for this repo) or `dry-run` (planned, not run). */
513
+ status: "ok" | "fail" | "skip" | "dry-run";
514
+ /** The resolved command, when one was run or planned. */
515
+ command?: string;
516
+ /** Why the job failed or was skipped. */
517
+ message?: string;
228
518
  }
229
- //#endregion
230
- //#region src/astromech.d.ts
519
+ /** The result of running every task in a namespace. */
520
+ interface GroupReport {
521
+ /** `"unknown"` when the namespace matches zero configured tasks. */
522
+ status: "ok" | "fail" | "dry-run" | "unknown";
523
+ /** One entry per matching task. */
524
+ jobs: GroupJobReport[];
525
+ }
526
+ interface GroupInput extends RunDeps, GroupOptions {
527
+ cwd: string;
528
+ config: TasksConfig;
529
+ /** The bare namespace, e.g. `"sourceQuality"` — matched against `"sourceQuality."`-prefixed task names. */
530
+ namespace: string;
531
+ }
532
+ /** Runs every configured task under a namespace (`sourceQuality` runs `sourceQuality.*`) in sequence and reports each. */
533
+ export declare function runGroup(input: GroupInput): GroupReport;
534
+ /** Every configured task whose name starts with `"<namespace>."`, in manifest declaration order. */
535
+ export declare function matchNamespace(config: TasksConfig, namespace: string): string[];
536
+ /** Everything `createAstromech` needs from the repo and the outside world; only `cwd` is required. */
231
537
  interface AstromechOptions {
232
538
  /** Repo root. */
233
539
  cwd: string;
@@ -250,11 +556,16 @@ interface AstromechOptions {
250
556
  exec?: ExecFn;
251
557
  /** Injectable fs (tests). Default to `node:fs`. */
252
558
  readFile?: (path: string) => string;
559
+ /** Injectable existence check (tests). Defaults to `node:fs`. */
253
560
  fileExists?: (path: string) => boolean;
561
+ /** Injectable directory listing (tests). Defaults to `node:fs`. */
254
562
  listDir?: (path: string) => string[];
563
+ /** Injectable environment for `--affected` (tests). Defaults to `process.env`. */
564
+ env?: Record<string, string | undefined>;
255
565
  /** Injectable binary lookup (tests). Default checks `node_modules/.bin` then `PATH`. */
256
566
  lookPath?: (cwd: string, bin: string) => string | null;
257
567
  }
568
+ /** Options for `Astromech.run`: which sub-job, what to forward, and how to scope the turbo run. */
258
569
  interface RunOptions {
259
570
  /**
260
571
  * Sub-job within the task — `performance` in `holocron run audit
@@ -270,10 +581,22 @@ interface RunOptions {
270
581
  required?: boolean;
271
582
  /** `turbo --filter=<pkg>` passthrough (monorepo). */
272
583
  filter?: string;
584
+ /** `turbo --affected`: only the packages changed since `base`. */
585
+ affected?: boolean;
586
+ /** Git ref `affected` compares against. */
587
+ base?: string;
273
588
  }
589
+ /** The task runner: one manifest drives local runs, the CI pre-flight and the generated workflows and scripts. */
274
590
  interface Astromech {
275
- /** Run one task — or one of its sub-jobs (`opts.job`) — locally. */
276
- run(task: string, opts?: RunOptions): RunTaskReport;
591
+ /**
592
+ * Run one task — or one of its sub-jobs (`opts.job`) — locally. When
593
+ * `task` isn't an exact registry task but matches the prefix of one or
594
+ * more configured tasks (`"sourceQuality"` against `sourceQuality.*`),
595
+ * runs every matching task in sequence instead ({@link GroupReport}) —
596
+ * `opts.job` is ignored for a namespace match, since a job belongs to
597
+ * one task, not a namespace.
598
+ */
599
+ run(task: string, opts?: RunOptions): RunTaskReport | GroupReport;
277
600
  /**
278
601
  * Run the merge-gating checks locally, in CI order — "will CI pass?".
279
602
  * Default scope: `required: true` tasks (falls back to every `ci: true`
@@ -288,7 +611,7 @@ interface Astromech {
288
611
  */
289
612
  thinCallers(): Map<string, string>;
290
613
  /**
291
- * The complete reusable-workflow batch `holocron sync-github` pushes to
614
+ * The complete reusable-workflow batch `holocron sync github` pushes to
292
615
  * `theholocron/.github` — repo-relative path → content, "do not edit" header
293
616
  * already applied to the YAML. Config-independent (the same for every repo).
294
617
  */
@@ -301,20 +624,30 @@ interface Astromech {
301
624
  * when there is no config or `syncScripts: false`.
302
625
  */
303
626
  packageScripts(): Record<string, string>;
627
+ /**
628
+ * Task names this repo's manifest can actually run locally — the same
629
+ * filter {@link packageScripts} applies (skips `local: false` and tasks
630
+ * with no local runner at all), but independent of `syncScripts`: a repo
631
+ * that opts out of generated `package.json` scripts still has real
632
+ * runnable tasks. Empty when there is no config. Backs `holocron`'s own
633
+ * interactive task picker (`run` with no task given).
634
+ */
635
+ runnableTasks(): string[];
304
636
  /**
305
637
  * The branch-protection required-status-check contexts for this repo —
306
638
  * every `required: true` task's check context plus `extraRequiredChecks`,
307
- * ordered and de-duplicated. `holocron setup` prepends `"DCO"` and applies
639
+ * ordered and de-duplicated. `holocron repo setup` prepends `"DCO"` and applies
308
640
  * the list; this method is policy-free (manifest only).
309
641
  */
310
642
  requiredChecks(): string[];
311
643
  /**
312
- * This repo's `codecov.yml` — component `paths` derived from `packages/*`.
644
+ * This repo's `codecov.yml` — component `paths` derived from the workspace packages.
313
645
  * Pass the current file's content (`null` if none exists yet) to either
314
646
  * merge the component list in or scaffold a fresh file. Policy-free same
315
- * as {@link requiredChecks} — `holocron setup` owns writing the result.
647
+ * as {@link requiredChecks} — `holocron repo setup` owns writing the result.
648
+ * `options.docsCoverage` adds the `documentation` flag and its statuses.
316
649
  */
317
- codecovConfig(existing: string | null): string;
650
+ codecovConfig(existing: string | null, options?: CodecovConfigOptions): string;
318
651
  /**
319
652
  * The generated `turbo.json` for this repo's manifest, pretty-printed —
320
653
  * write directly, no merge. `null` when no manifest task has turbo fan-out
@@ -328,151 +661,26 @@ interface Astromech {
328
661
  * (not just an orchestrator) silently vanishes from `turbo run <task>`.
329
662
  * Pass `pnpm-workspace.yaml`'s current content (or `""` if none exists —
330
663
  * a no-op either way, since no `packages:` key means single-package mode
331
- * already) and root `package.json`'s own `scripts` keys. `changed: false`
332
- * means don't write anything — the file is already correct.
664
+ * already) and root `package.json`'s own `scripts` object — values and
665
+ * all, not just keys, so a task-name-matching script that's already the
666
+ * generated `holocron run <task> --` wrapper (predating this call, not
667
+ * written by it) is correctly excluded rather than treated as proof root
668
+ * is directly buildable (#846). `changed: false` means don't write
669
+ * anything — the file is already correct.
333
670
  */
334
- ensureRootWorkspaceMember(workspaceYaml: string, rootScripts: readonly string[]): EnsureRootWorkspaceMemberResult;
335
- }
336
- declare function createAstromech(options: AstromechOptions): Astromech;
337
- //#endregion
338
- //#region src/codecov.d.ts
339
- /**
340
- * `codecov.yml` generation — a manifest-derived artifact (component `paths`
341
- * come from workspace packages; the status targets track the `test` task's
342
- * coverage setup), the same category as the reusable `test.yml` this package
343
- * also generates. Moved out of `@theholocron/cli` (theholocron/holocron#650)
344
- * — `holocron setup`'s codecov step now calls {@link codecovConfig} instead
345
- * of importing this logic directly.
346
- */
347
- interface WorkspacePackage {
348
- slug: string;
349
- name: string;
350
- /** Which workspace root the package was discovered under. Defaults to `"packages"`. */
351
- dir?: "packages" | "apps";
352
- }
353
- declare function codecovComponentBlock(packages: WorkspacePackage[]): string;
354
- /**
355
- * Ensure every codecov status default carries `if_not_found: success`, so an
356
- * infra-only PR (dep bump, config, lockfile — no coverable change) passes
357
- * instead of hanging forever on a required check codecov never posts.
358
- *
359
- * Injects the key on the line after each `target:` that sits inside a status
360
- * block (`coverage.status.*.default` or a `statuses:` list item — indent ≥ 8,
361
- * or ≥ 8 for a `- type:` list entry), when the immediate sibling lines do not
362
- * already declare it.
363
- */
364
- declare function ensureIfNotFound(yaml: string): string;
365
- declare function mergeCodecovComponents(existing: string, packages: WorkspacePackage[]): string;
366
- /**
367
- * Every public `packages/*` and `apps/*` workspace, sorted by slug. `[]`
368
- * when neither directory exists. Monorepo templates (Next.js, React, …)
369
- * ship user-facing code under `apps/` alongside library code under
370
- * `packages/` — both need a codecov component so `codecov/patch/<slug>`
371
- * actually posts for each.
372
- */
373
- declare function readWorkspacePackages(repoRoot: string): WorkspacePackage[];
374
- /** A brand-new `codecov.yml` — the scaffold header + the base template + this repo's component list. */
375
- declare function createCodecovConfig(packages: WorkspacePackage[]): string;
376
- /**
377
- * The full pipeline `holocron setup` needs: read this repo's public
378
- * `packages/*`, then either merge them into an `existing` `codecov.yml` or
379
- * scaffold a new one.
380
- */
381
- declare function codecovConfig(repoRoot: string, existing: string | null): string;
382
- //#endregion
383
- //#region src/linters.d.ts
384
- /**
385
- * The linter registry — one list of linter names (from `config.tasks`'
386
- * `{ name: "lint", linters: [...] }`, or auto-detected) maps to both the
387
- * CI super-linter `VALIDATE_*` env and the native local run. This table is
388
- * the single source of truth for that mapping; {@link superLinterConfig}
389
- * (CI) and the `holocron run lint` aggregate (local) both read it.
390
- *
391
- * Spec: `docs/wiki/specifications/tech-astromech-task-runner.spec.md` "Lint parity".
392
- */
393
- interface LinterDef {
394
- /**
395
- * super-linter `VALIDATE_*` keys this linter turns on. Setting any
396
- * `VALIDATE_*` puts super-linter in allow-list mode, so emitting only the
397
- * enabled keys makes it run exactly this set.
398
- */
399
- validate: string[];
400
- /** super-linter `FIX_*` keys (auto-commit / `--write` parity). */
401
- fix?: string[];
402
- /**
403
- * Local binary, resolved from `node_modules/.bin` then `PATH`. Absent →
404
- * the linter has no meaningful local run (`holocron run lint` prints
405
- * "CI only"); CI still enforces it.
406
- */
407
- localBin?: string;
408
- /** Args for `localBin` in CHECK mode — never `--write` / `--fix`. */
409
- localArgs?: string[];
671
+ ensureRootWorkspaceMember(workspaceYaml: string, rootScripts: Readonly<Record<string, string>>): EnsureRootWorkspaceMemberResult;
410
672
  /**
411
- * Shown by `holocron run lint` when `localBin` is set but not found on
412
- * PATH — the "you're missing a tool the repo needs" nudge.
673
+ * `turboConfig()` writes a `turbo.json` but never touches `package.json`
674
+ * — a repo with no local `turbo` devDependency falls back to whatever
675
+ * (if anything) is globally on `PATH`, per `run.ts`'s `resolveBin()`.
676
+ * Pass root `package.json`'s raw content and `pnpm-workspace.yaml`'s
677
+ * current content (checked for an existing `turbo` catalog entry, which
678
+ * takes precedence over the hardcoded fallback version). `changed: false`
679
+ * means don't write anything — `devDependencies.turbo` already exists.
413
680
  */
414
- installHint?: string;
415
- /**
416
- * Repo-root filenames that auto-enable this linter when the `lint` task
417
- * has no explicit `linters` list. Ignored when {@link always} is set.
418
- */
419
- detect?: string[];
420
- /** Enabled regardless of detection (the org baseline). */
421
- always?: boolean;
422
- /** Reusable-workflow config-file input this linter honors, if any. */
423
- configInput?: "eslint-config" | "prettier-config" | "yaml-config";
424
- }
425
- /**
426
- * Known linters, in execution order. `always` entries are the current
427
- * hard-coded super-linter baseline; `prettier` is always-on because the org
428
- * applies it universally (super-linter only lints files that exist).
429
- */
430
- declare const LINTERS: Record<string, LinterDef>;
431
- /** Every linter name the registry knows. */
432
- declare const LINTER_NAMES: ReadonlySet<string>;
433
- /**
434
- * Resolve the linter set for a repo. An `explicit` list (from `config.tasks`)
435
- * picks the candidate set; otherwise the candidates are every `always` linter
436
- * plus every `detect`-gated linter whose filenames are present at the repo
437
- * root. Either way, a `detect`-gated linter (eslint, markdownlint) only makes
438
- * the final set when its config file is actually present — a repo can't run
439
- * eslint without an `eslint.config.*`, and super-linter FATALs if you ask it
440
- * to (theholocron/holocron#654). `always` linters are unconditional. Result
441
- * is ordered by {@link LINTERS} declaration order.
442
- *
443
- * @throws when an `explicit` name is not in the registry — a typo is a
444
- * config bug, not a linter to silently skip.
445
- */
446
- declare function resolveLinters(opts: {
447
- explicit?: string[];
448
- rootFiles: string[];
449
- }): Array<{
450
- name: string;
451
- def: LinterDef;
452
- }>;
453
- //#endregion
454
- //#region src/registry.d.ts
455
- /**
456
- * The task registry — how each task runs *locally*, without GitHub
457
- * Actions. `holocron run <task>` and `holocron ci` resolve against this;
458
- * adding a task here gives every repo that task.
459
- *
460
- * Keyed identically to the workflow templates — a task IS a workflow. This
461
- * is the canonical vocabulary table (epic #672, D11): every other artifact
462
- * (`KNOWN_TASKS`, `thin-callers.ts`'s `KNOWN_WORKFLOWS`/`WORKFLOW_CHECK_CONTEXTS`,
463
- * `CI_ORDER`) derives from these keys rather than hand-duplicating them —
464
- * including the future GitHub App (#679), which imports this same table for
465
- * config-schema validation instead of reimplementing its own copy.
466
- *
467
- * Task names are an intent-facing vocabulary (`verification.*`,
468
- * `sourceQuality.*`, `security.*`, `delivery.*`, `platform.*`,
469
- * `knowledge.*`), not tool names — `eslint`/`vitest`/`tsdown`/… stay
470
- * internal to this file and `theholocron/configs`. See
471
- * `.notes/tech-vocabulary-rename.spec.md` (#675) for the full mapping and
472
- * the reasoning behind each namespace and decomposition.
473
- *
474
- * Spec: `docs/wiki/specifications/tech-astromech-task-runner.spec.md` (epic #581).
475
- */
681
+ ensureTurboDependency(packageJson: string, workspaceYaml: string): EnsureTurboDependencyResult;
682
+ }
683
+ export declare function createAstromech(options: AstromechOptions): Astromech;
476
684
  /** How to run one task (or job) locally. */
477
685
  interface LocalRunner {
478
686
  /** Binary to invoke — resolved from `node_modules/.bin` then PATH. */
@@ -510,19 +718,33 @@ interface JobDef {
510
718
  local: LocalRunner | null;
511
719
  /**
512
720
  * The CI status-check context this job reports as (e.g.
513
- * `platform.repoValidation / Validate registry consistency`) — every sub-job is a CI job.
514
- * `holocron run <task>` and `holocron ci` label each job line with it;
721
+ * `platform.repoValidation / Validate docs presence`) — every sub-job is a CI job.
722
+ * `holocron run <task>` and `holocron run ci` label each job line with it;
515
723
  * the task-level `… / Conclusion` context (only for tasks with several
516
724
  * jobs) lives in `WORKFLOW_CHECK_CONTEXTS`.
517
725
  */
518
726
  checkContext: string;
727
+ /**
728
+ * The name a repo's config uses to switch this job off (`jobs: { docsEnforcement: false }`),
729
+ * where the job's own key is vague or fixed by the reusable workflow. The key itself works too.
730
+ */
731
+ alias?: string;
519
732
  }
733
+ /**
734
+ * One registry task: its built-in runner (`local`), the sub-jobs it splits into, its org-default flags and its
735
+ * Turborepo fan-out. `holocron run <task>` and `holocron run ci` start from this definition.
736
+ */
520
737
  interface TaskDef {
738
+ /**
739
+ * Sub-job slugs that no longer exist but that a reusable workflow synced earlier may still pass:
740
+ * `holocron run <task> <retired>` is a clean skip instead of an unknown-job failure.
741
+ */
742
+ retiredJobs?: string[];
521
743
  /**
522
744
  * `null` — the registry has no built-in runner (CodeQL, deploys, the
523
745
  * bundle-size job). An explicit turbo task or `package.json` script still
524
746
  * runs (resolution steps 1–2); with neither, `holocron run` does nothing
525
- * and `holocron ci` skips it — never a failure, even when the task is
747
+ * and `holocron run ci` skips it — never a failure, even when the task is
526
748
  * `required` (a CI-only check isn't a local one).
527
749
  */
528
750
  local: LocalRunner | null;
@@ -548,155 +770,118 @@ interface TaskDef {
548
770
  /** Turborepo fan-out config for this task — see {@link TurboTaskConfig}. Omitted for whole-repo, non-fan-out tasks. */
549
771
  turbo?: TurboTaskConfig;
550
772
  }
551
- declare const TASKS: Record<string, TaskDef>;
773
+ /**
774
+ * The task registry — how each task runs *locally*, without GitHub
775
+ * Actions. `holocron run <task>` and `holocron run ci` resolve against this;
776
+ * adding a task here gives every repo that task.
777
+ *
778
+ * Keyed identically to the workflow templates — a task IS a workflow. This
779
+ * is the canonical vocabulary table (epic #672, D11): every other artifact
780
+ * (`KNOWN_TASKS`, `thin-callers.ts`'s `KNOWN_WORKFLOWS`/`WORKFLOW_CHECK_CONTEXTS`,
781
+ * `CI_ORDER`) derives from these keys rather than hand-duplicating them —
782
+ * including the future GitHub App (#679), which imports this same table for
783
+ * config-schema validation instead of reimplementing its own copy.
784
+ *
785
+ * Task names are an intent-facing vocabulary (`verification.*`,
786
+ * `sourceQuality.*`, `security.*`, `delivery.*`, `platform.*`,
787
+ * `knowledge.*`), not tool names — `eslint`/`vitest`/`tsdown`/… stay
788
+ * internal to this file and the `configs/` folder. See
789
+ * `docs/wiki/specifications/tech-vocabulary-rename.spec.md` (#675) for the full mapping and
790
+ * the reasoning behind each namespace and decomposition.
791
+ *
792
+ * Spec: `docs/wiki/specifications/tech-astromech-task-runner.spec.md` (epic #581).
793
+ */
794
+ export declare const TASKS: Record<string, TaskDef>;
552
795
  /** Every task name the registry knows. */
553
- declare const KNOWN_TASKS: Set<string>;
796
+ export declare const KNOWN_TASKS: Set<string>;
554
797
  /**
555
- * The order `holocron ci` runs tasks in — cheapest / fastest signal first, so
798
+ * The order `holocron run ci` runs tasks in — cheapest / fastest signal first, so
556
799
  * an agent or a `pre-push` hook fails early. Tasks not listed here run last, in
557
800
  * manifest order. (The generated thin callers carry no `needs:` — cross-workflow
558
- * ordering lives in `theholocron/.github` — so `holocron ci` declares its own.)
801
+ * ordering lives in `theholocron/.github` — so `holocron run ci` declares its own.)
559
802
  */
560
- declare const CI_ORDER: string[];
561
- //#endregion
562
- //#region src/required-checks.d.ts
563
- /** Ordered (task contexts in {@link CI_ORDER}, then extras), de-duplicated. */
564
- declare function requiredChecks(config: TasksConfig): string[];
565
- //#endregion
566
- //#region src/resolver.d.ts
567
- /**
568
- * Resolves the absolute path to a Bucket A tool's shared `@theholocron/*-config`
569
- * entry point, installed in the consuming repo's own `node_modules` — and the
570
- * CLI flag(s) to hand it via (`--config`, `--extends`, …). `run.ts` splices the
571
- * result into the command it builds for a tool/detect runner or a linter-group
572
- * entry, right after the tool's own args.
803
+ export declare const CI_ORDER: string[];
804
+ /**
805
+ * The paths a release must touch to redeploy `pkg` when its manifest doesn't
806
+ * list them: its own folder plus the folder of every
807
+ * {@link workspaceDependencies} entry. Derived rather than listed so a new or
808
+ * dropped workspace dependency needs no second edit.
573
809
  *
574
- * Every mapped package's resolved entry point already carries a ready-to-use
575
- * default export (a plain re-export for `prettier`/`commitlint`; an invoked,
576
- * zero-arg preset for `eslint`/`vitest`/`tsdown` — verified end-to-end against
577
- * each tool's real `--config`/`--extends` loader, not just the file's shape).
578
- * A repo doesn't need this package installed at all — every lookup degrades to
579
- * `[]` (no flag added, the tool falls back to its own auto-discovery of a
580
- * local file, unchanged from today) rather than throwing, so this is additive
581
- * and safe to run unconditionally.
810
+ * @returns Repo-relative prefixes, each ending in `/`.
811
+ */
812
+ export declare function defaultPaths(repoRoot: string, pkg: WorkspacePackage, all: WorkspacePackage[]): string[];
813
+ /** The `.alexrc.json` body: the org's inclusive-language allow-list. */
814
+ declare function createRcConfig(): string;
815
+ /** The `.alexignore` body. */
816
+ declare function createIgnoreConfig(): string;
817
+ /**
818
+ * `.husky/commit-msg` — lints the commit message via `holocron run lint
819
+ * commit-msg` (holocron#789), the real programmatic replacement for
820
+ * shelling out to `commitlint --edit`. Installed by `holocron repo setup` when
821
+ * hooks are enabled. Same `__HOLOCRON_SCRIPT__` substitution as `pre-push`.
582
822
  *
583
- * `semantic-release`, `devmoji`, `editorconfig-checker`, and `knip` are
584
- * deliberately absent — `semantic-release-config`'s `defineConfig()` needs
585
- * real per-repo data (branches, npm options) a static `--extends <path>` can't
586
- * carry; `devmoji` runs through a git hook template, not `holocron run
587
- * <task>`; `editorconfig-checker` has no shared-config package yet; `knip` is
588
- * repo-specific by nature, never a shared-config candidate. See
589
- * `.notes/tech-config-resolution.spec.md` (#676).
590
- */
591
- interface ResolverDeps {
592
- readFile: (path: string) => string;
593
- fileExists: (path: string) => boolean;
823
+ * @param holocronScript - the command that invokes the CLI. Defaults to
824
+ * `pnpm exec holocron`; the source repo passes `node cli/cli/dist/cli.mjs`.
825
+ */
826
+ declare function createConfig(holocronScript?: string): string;
827
+ /** What varies in the generated `.github/dependabot.yml`; the rest of the file is the same for every repo. */
828
+ interface DependabotConfigOptions {
829
+ /**
830
+ * Packages Dependabot must not raise version updates for, by exact name. Each becomes a name-only
831
+ * `ignore` entry on the npm ecosystem. Security updates are not affected: for those, Dependabot
832
+ * only honours an `ignore` entry that lists `versions`.
833
+ */
834
+ ignore?: readonly string[];
594
835
  }
595
- /** Every tool name the resolver knows how to point at a shared config. */
596
- declare const RESOLVABLE_TOOLS: ReadonlySet<string>;
597
836
  /**
598
- * `<flag> <absolute path>` for `tool`, resolved against `cwd`'s
599
- * `node_modules` — or `[]` when the tool isn't mapped, the package isn't
600
- * installed, its `package.json` doesn't declare the export subpath this
601
- * needs, or the resolved file doesn't actually exist on disk (a stale
602
- * install, or a package version that predates the export existing).
837
+ * The content of `.github/dependabot.yml`, with its generated-file header. Names in `ignore` get a name-only
838
+ * `ignore` entry on the npm ecosystem; with none, the file is the shared body unchanged.
603
839
  */
604
- declare function resolveToolConfig(tool: string, cwd: string, deps: ResolverDeps): string[];
605
- //#endregion
606
- //#region src/reusable.d.ts
840
+ declare function createConfig$1({ ignore }?: DependabotConfigOptions): string;
841
+ /** The `devmoji.config.cjs` body, which defers to `@theholocron/devmoji-config`. */
842
+ declare function createConfig$2(): string;
843
+ /** The `.editorconfig` body, under the auto-generated header. */
844
+ declare function createConfig$3(): string;
607
845
  /**
608
- * The **reusable** GitHub Actions surface pushed to `theholocron/.github` by
609
- * `holocron sync-github` — the `workflow_call` implementations and composite
610
- * actions that every repo's thin callers delegate to.
846
+ * The generated `.editorconfig-checker.json`.
611
847
  *
612
- * `theholocron/.github` is a **pure sync target**: `.github/workflows/*`,
613
- * `.github/actions/*` and `workflow-templates/*` there are generated from the
614
- * `.yml` files in `src/templates/reusable/` and pushed verbatim (with a
615
- * "do not edit" header). Never hand-edit them in `.github`.
616
- *
617
- * Not to be confused with `WORKFLOW_TEMPLATES` in `thin-callers.ts` — those are
618
- * the *thin-caller bases* written into each consumer repo's `.github/workflows/`.
848
+ * Deliberately carries no `"Version"` key: editorconfig-checker treats it as a
849
+ * hard gate and exits non-zero the moment the running binary's version differs
850
+ * — which it does the instant a contributor's local install (Homebrew tracks
851
+ * latest) drifts from the version super-linter bundles in CI, breaking
852
+ * `holocron run lint` / the pre-push hook for everyone (#618). The config
853
+ * options here (`Exclude`, `Disable`) are stable across releases, so pinning
854
+ * buys nothing.
619
855
  */
620
- /** `workflow_call` implementations → `.github/workflows/<name>.yml`. */
621
- declare const REUSABLE_WORKFLOWS: Record<string, string>;
622
- /** Composite actions → `.github/actions/<name>/action.yml` (key includes `/action`). */
623
- declare const REUSABLE_ACTIONS: Record<string, string>;
624
- /** GitHub starter-workflow metadata → `workflow-templates/<name>.properties.json`. */
625
- declare const WORKFLOW_TEMPLATE_PROPERTIES: Record<string, string>;
856
+ declare function createConfig$4(): string;
857
+ /** The `.github/labeler.yml` body, which labels a pull request by its Conventional Commit type. */
858
+ declare function createConfig$5(): string;
626
859
  /**
627
- * The complete file batch `holocron sync-github` pushes to `theholocron/.github`:
628
- * path → content. YAML gets the "do not edit" header; the starter-workflow
629
- * `.properties.json` files are left bare (native JSON, not a commented file).
630
- */
631
- declare function reusableTemplates(): Map<string, string>;
632
- //#endregion
633
- //#region src/tsconfig.d.ts
634
- /**
635
- * `tsconfig.json` generation — Bucket B (config-resolution workstream, #676):
636
- * the file must stay committed (the TypeScript language server discovers it
637
- * directly from disk, no `--config` override mechanism to hand it a path
638
- * instead), but its content is fully derivable, so it's generated rather
639
- * than hand-authored — the same category as `.editorconfig`
640
- * ({@link "./templates/configs/editorconfig/create-config.js" createConfig})
641
- * and {@link codecovConfig}.
642
- *
643
- * Surveyed every package-level `tsconfig.json` across the org (`holocron`,
644
- * `clients`, `utils` — 20+ packages). `extends: "@theholocron/tsconfig/
645
- * node-lts"`, `compilerOptions.baseUrl: "./"`, `compilerOptions.outDir:
646
- * "./dist"`, `include: ["src/**\/*.ts"]`, and `exclude: ["node_modules",
647
- * "dist"]` are uniform in every one — safe defaults here. `paths` (a `@/*`
648
- * → `./src/*` import alias) is a real per-package choice, present in
649
- * roughly 40% of packages checked — an opt-in parameter, not a default.
860
+ * `.husky/pre-commit` — runs GitLeaks (scoped to staged changes) and
861
+ * lint-staged before every commit. Installed by `holocron repo setup` when hooks
862
+ * are enabled (default for `protection: "strict"`). `git commit --no-verify`
863
+ * bypasses it.
650
864
  *
651
- * Two fields checked and deliberately *not* absorbed as defaults, unlike
652
- * `eslint-config`'s `tsconfigRootDir`/`settings.node` (which turned out
653
- * redundant with the shared package's own behavior, `configs`#461):
654
- * `compilerOptions.module`/`moduleResolution` (only `@theholocron/cli`
655
- * overrides these, to `esnext`/`bundler` — a genuine deviation from the
656
- * shared `node-lts` preset's `nodenext`/`nodenext`, needed for its bundler
657
- * tooling, not something every package should inherit) and
658
- * `compilerOptions.rootDir` (present in exactly two packages, always the
659
- * same value `./src` that `include` already implies — an unnecessary
660
- * override wherever it appears, not a pattern worth generalizing).
661
- *
662
- * Monorepo *root* `tsconfig.json` (a TS project-references "solution
663
- * file" — `holocron`'s own root is `{ files: [], references: [...] }`,
664
- * listing which packages to build) is a structurally different, genuinely
665
- * per-repo document — out of scope here, same as Bucket C content.
666
- *
667
- * Not yet wired into `holocron setup`'s per-package write loop (every
668
- * other Bucket B file there is a single repo-root file, safely
669
- * overwritten every run — `tsconfig.json` is per-package, and most
670
- * packages' files still carry real hand-authored content today, not yet
671
- * migrated to a fully-generated state). That per-package iteration +
672
- * safe-migration design is `#680`'s job, not duplicated here — this is
673
- * the generator itself, ready for it to call.
865
+ * `gitleaks protect --staged` (not `gitleaks git`) is deliberate: the latter
866
+ * scans the entire commit history on every invocation, so once any false
867
+ * positive lands in a past commit — a fake test token, an example key in a
868
+ * doc — every future commit is permanently blocked, regardless of what's
869
+ * actually staged.
674
870
  */
675
- interface TsconfigOptions {
676
- /** Human-readable name for the `display` field — the package's own name is the usual choice. */
677
- display: string;
678
- /**
679
- * `@theholocron/tsconfig` variant. Defaults to `"node-lts"` — every
680
- * checked package uses it; the other three (`astro`, `nextjs`, `react`)
681
- * exist for a template repo's app-shaped packages, not the plain
682
- * Node.js library packages this org's currently-migrated repos ship.
683
- */
684
- variant?: "astro" | "nextjs" | "node-lts" | "react";
685
- /**
686
- * Add a `@/*` → `./src/*` path alias. A real per-package choice, not a
687
- * default — roughly 40% of packages checked use one, the rest don't.
688
- */
689
- paths?: boolean;
690
- }
871
+ declare function createConfig$6(): string;
691
872
  /**
692
- * A package-level `tsconfig.json` — the uniform shape confirmed across
693
- * every package checked, parameterized only by the two fields that
694
- * genuinely vary (`display`, `paths`). No scaffold/workflow header (matches
695
- * `.alexrc.json`'s existing precedent for a strict-JSON Bucket B file —
696
- * JSON has no comment syntax to carry one, and TypeScript's own tolerance
697
- * for JSONC comments in `tsconfig.json` isn't worth relying on for a file
698
- * this thin).
873
+ * `.husky/pre-push` — runs `holocron run ci` (the merge-gating checks, in CI order)
874
+ * before every push. Installed by `holocron repo setup` when hooks are enabled
875
+ * (default for `protection: "strict"`). `git push --no-verify` bypasses it.
876
+ *
877
+ * @param holocronScript - the command that invokes the CLI. Defaults to
878
+ * `pnpm exec holocron`; the source repo passes `node cli/cli/dist/cli.mjs`.
699
879
  */
700
- declare function createTsconfig(options: TsconfigOptions): string;
701
- //#endregion
702
- 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 };
880
+ declare function createConfig$7(holocronScript?: string): string;
881
+ /** The `.husky/prepare-commit-msg` hook, a shell script under the auto-generated header. */
882
+ declare function createConfig$8(): string;
883
+ /** The `.yamllint.yml` body, under the auto-generated header. */
884
+ declare function createConfig$9(): string;
885
+ /** The `.yamlignore` body. */
886
+ declare function createIgnoreConfig$1(): string;
887
+ export { type Astromech, type AstromechOptions, type CiJobReport, type CiOptions, type CiReport, type CodecovConfigOptions, type CreateHeaderOptions, type DependabotConfigOptions, type DeployOnReleaseOptions, type DeployOnReleaseReport, type DeployOnReleaseResult, type WorkspacePackage as DeployWorkspacePackage, type DocsCoverageMode, type ExecFn, type GroupJobReport, type GroupOptions, type GroupReport, type HeaderFunctions, type JobDef, type LocalRunner, type OrgContext, type PreviewConfig, type RunLogger, type RunOptions, type RunTaskInput, type RunTaskReport, type TaskDef, type TsconfigOptions, type WorkflowHeaderFormat, type WorkspacePackage$1 as WorkspacePackage, createIgnoreConfig as createAlexignore, createRcConfig as createAlexrc, 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$1 as createYamlignore, createConfig$9 as createYamllint };