@theholocron/astromech 5.0.0-alpha.26 → 5.0.0-alpha.260

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,223 @@
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";
2
+ import { ListWorkspacePackagesOptions, WorkspacePackageEntry } from "@theholocron/pkg-utils";
3
+ interface WorkspacePackage$1 {
4
+ slug: string;
5
+ name: string;
6
+ /** The workspace root the package was discovered under (`packages`, `apps`, `clients`, ...). Defaults to `"packages"`. */
7
+ dir?: string;
8
+ /**
9
+ * Repo-relative directory, set when it is not `<dir>/<slug>` -- a package that
10
+ * is itself a workspace folder (`observability`) or sits deeper (`docs/theme`).
11
+ */
12
+ path?: string;
13
+ }
14
+ export declare function codecovComponentBlock(packages: WorkspacePackage$1[]): string;
15
+ /**
16
+ * Ensure every codecov status default carries `if_not_found: success`, so an
17
+ * infra-only PR (dep bump, config, lockfile — no coverable change) passes
18
+ * instead of hanging forever on a required check codecov never posts.
19
+ *
20
+ * Injects the key on the line after each `target:` that sits inside a status
21
+ * block (`coverage.status.*.default` or a `statuses:` list item — indent ≥ 8,
22
+ * or ≥ 8 for a `- type:` list entry), when the immediate sibling lines do not
23
+ * already declare it.
24
+ */
25
+ export declare function ensureIfNotFound(yaml: string): string;
26
+ export declare function mergeCodecovComponents(existing: string, packages: WorkspacePackage$1[]): string;
3
27
  /**
4
- * `holocron run <task> [job] [-- <passthrough>]` — run a registry task (or one
5
- * of its sub-jobs) locally.
28
+ * Every package the repo's `pnpm-workspace.yaml` declares (the default roots
29
+ * when it declares none), sorted by location, so each group folder (`cli/`, `plugins/`, ...) stays together. Every one needs a
30
+ * codecov component so `codecov/patch/<slug>` actually posts for each. A
31
+ * package at `<root>/<slug>` carries `dir: <root>`; one that is itself a
32
+ * workspace folder (`observability`) or sits deeper (`docs/theme`) carries its
33
+ * `path`. Two packages with the same folder name are told apart by their full
34
+ * path (`docs-theme`). `[]` when there are none.
35
+ */
36
+ export declare function readWorkspacePackages(repoRoot: string): WorkspacePackage$1[];
37
+ /** A brand-new `codecov.yml` — the scaffold header + the base template + this repo's component list. */
38
+ export declare function createCodecovConfig(packages: WorkspacePackage$1[]): string;
39
+ /**
40
+ * The full pipeline `holocron repo setup` needs: read this repo's public
41
+ * `packages/*`, then either merge them into an `existing` `codecov.yml` or
42
+ * scaffold a new one.
43
+ */
44
+ export declare function codecovConfig(repoRoot: string, existing: string | null): string;
45
+ /**
46
+ * The **reusable** GitHub Actions surface pushed to `theholocron/.github` by
47
+ * `holocron sync github` — the `workflow_call` implementations and composite
48
+ * actions that every repo's thin callers delegate to.
49
+ *
50
+ * `theholocron/.github` is a **pure sync target**: `.github/workflows/*`,
51
+ * `.github/actions/*` and `workflow-templates/*` there are generated from the
52
+ * `.yml` files in `src/templates/reusable/` and pushed verbatim (with a
53
+ * "do not edit" header). Never hand-edit them in `.github`.
6
54
  *
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/`).
55
+ * Not to be confused with `WORKFLOW_TEMPLATES` in `github-action-thin-callers.ts` — those are
56
+ * the *thin-caller bases* written into each consumer repo's `.github/workflows/`.
57
+ */
58
+ /** `workflow_call` implementations → `.github/workflows/<name>.yml`. */
59
+ export declare const REUSABLE_WORKFLOWS: Record<string, string>;
60
+ /** Composite actions → `.github/actions/<name>/action.yml` (key includes `/action`). */
61
+ export declare const REUSABLE_ACTIONS: Record<string, string>;
62
+ /** GitHub starter-workflow metadata → `workflow-templates/<name>.properties.json`. */
63
+ export declare const WORKFLOW_TEMPLATE_PROPERTIES: Record<string, string>;
64
+ /**
65
+ * The complete file batch `holocron sync github` pushes to `theholocron/.github`:
66
+ * path → content. YAML gets the "do not edit" header; the starter-workflow
67
+ * `.properties.json` files are left bare (native JSON, not a commented file).
68
+ */
69
+ export declare function reusableTemplates(): Map<string, string>;
70
+ interface PreviewConfig {
71
+ /** Cloudflare Pages project name shared across all repos for previews. */
72
+ project: string;
73
+ /**
74
+ * Base domain for preview URLs (e.g. `"preview.theholocron.dev"`).
75
+ * When set, `holocron repo setup` automatically provisions:
76
+ * - Cloudflare Pages custom domain `*.<domain>` on the project
77
+ * - DNS wildcard CNAME `*.<domain>` → `<project>.pages.dev`
78
+ *
79
+ * Preview URLs resolve as `<repo>-pr-<n>.<domain>`.
80
+ */
81
+ domain?: string;
82
+ }
83
+ /** Org-level context used to derive preview defaults from `preview: true`. */
84
+ interface OrgContext {
85
+ /** GitHub org name — becomes the prefix of the default project: `<org>-preview`. */
86
+ org?: string;
87
+ /** Org canonical domain — becomes `preview.<domain>` for the default preview domain. */
88
+ domain?: string;
89
+ /** Project name — injected as the `name` input to the deploy reusable when `docs: true`. */
90
+ repoName?: string;
91
+ }
92
+ export declare const WORKFLOW_TEMPLATES: Record<string, string>;
93
+ export declare const KNOWN_WORKFLOWS: Set<string>;
94
+ /**
95
+ * The GitHub status-check context a `required` task contributes to branch
96
+ * protection. Format: `"{workflow name} / {job name}"`.
97
+ *
98
+ * Most of these are single-job workflows now (D3's decomposition split what
99
+ * used to be multi-job `lint`/`audit` into one task per concern) — the
100
+ * context names that job directly, no `Conclusion` aggregator needed; a
101
+ * single job's own conclusion already *is* the workflow's conclusion.
102
+ * `Conclusion` fan-in jobs are kept only where a task genuinely has several
103
+ * conditionally-run jobs feeding one required check:
104
+ * `verification.unitTests` (unit / Storybook / Chromatic / interaction /
105
+ * user-flow, each gated by its own `run-*` input) and
106
+ * `platform.repoValidation` (its three script jobs all must pass). Only
107
+ * merge-gating workflows are listed. `astromech.requiredChecks()` reads this
108
+ * for every `required` task.
109
+ */
110
+ export declare const WORKFLOW_CHECK_CONTEXTS: Partial<Record<string, string>>;
111
+ /**
112
+ * Generate the thin caller content for a workflow, optionally injecting or
113
+ * merging `with:` overrides into the jobs block.
114
+ *
115
+ * Two strategies are used depending on the template:
116
+ * - Templates that already have a `with:` block (e.g. lint):
117
+ * the override entries are merged in, replacing existing keys and appending
118
+ * new ones.
119
+ * - Templates that end with ` secrets: inherit`: a new `with:` block is
120
+ * injected immediately before `secrets: inherit`.
121
+ * If neither pattern matches the template, a warning is emitted and the
122
+ * base template is returned unchanged.
123
+ */
124
+ export declare function generateThinCallerContent(name: string, withOverrides?: Record<string, unknown>, additionalPaths?: string[],
125
+ /** Optional sink for the "could not inject `with:`" warning. */
126
+ logger?: {
127
+ warn(obj: Record<string, unknown>, msg: string): void;
128
+ },
129
+ /**
130
+ * `with:` key → a `# comment` line rendered immediately above that entry.
131
+ * Only honored when injecting a fresh `with:` block (no template today
132
+ * ships one), which is the path `lint` takes.
133
+ */
134
+ comments?: Record<string, string>): string;
135
+ /**
136
+ * Extract the Cloudflare Pages preview config from a deploy workflow's `with:` object.
137
+ *
138
+ * Accepts three forms:
139
+ * - `preview: true` — derive both project and domain from org context
140
+ * - `preview: { project: "..." }` — explicit project; domain derived from context if omitted
141
+ * - `preview: { project: "...", domain: "..." }` — fully explicit
10
142
  *
11
- * Resolution:
143
+ * Returns null when `preview:` is absent, false, or can't be resolved.
144
+ */
145
+ export declare function extractPreviewConfig(raw: Record<string, unknown>, ctx?: OrgContext): PreviewConfig | null;
146
+ /**
147
+ * Generate the full thin-caller YAML for a `deploy.yml` that handles both
148
+ * production (push to main → GitHub Pages) and preview (pull_request →
149
+ * Cloudflare Pages) in a single file.
12
150
  *
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)
151
+ * Both jobs receive the same docs/storybook `with:` inputs. If the per-repo
152
+ * config supplies `cloudflare-project` it is forwarded; otherwise the reusable
153
+ * falls back to the `CLOUDFLARE_PAGES_PROJECT` org variable — set that once and
154
+ * all repos with a `deploy` workflow get previews without per-repo config.
155
+ */
156
+ export declare function generateCombinedDeployContent(deployWith: Record<string, unknown>, paths: string[], preview: Pick<PreviewConfig, "project">): string;
157
+ /**
158
+ * Expand structured with-values to flat GitHub Actions inputs before
159
+ * generating the thin caller. Handles:
160
+ * - deploy shorthand: docs/storybook → type + storybook-projects
161
+ * - preview: stripped (handled separately via extractPreviewConfig)
162
+ * - chromatic-projects entries' untraced array → newline-joined string
163
+ * - plain arrays → JSON-stringified for YAML scalar quoting
23
164
  *
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.
165
+ * Used by both `holocron repo setup` and `sync-workflow-templates`.
166
+ */
167
+ export declare function normalizeWorkflowWith(raw: Record<string, unknown>): Record<string, unknown>;
168
+ /**
169
+ * Derive on.push.paths entries from the deploy with: shorthand.
170
+ * Used by both `holocron repo setup` and `sync-workflow-templates`.
171
+ */
172
+ export declare function deriveDeployPaths(raw: Record<string, unknown>): string[];
173
+ /** Ordered (task contexts in {@link CI_ORDER}, then extras), de-duplicated. */
174
+ export declare function requiredChecks(config: TasksConfig): string[];
175
+ interface TsconfigOptions {
176
+ /** Human-readable name for the `display` field — the package's own name is the usual choice. */
177
+ display: string;
178
+ /**
179
+ * `@theholocron/tsconfig` variant. Defaults to `"node-lts"` — every
180
+ * checked package uses it; the other three (`astro`, `nextjs`, `react`)
181
+ * exist for a template repo's app-shaped packages, not the plain
182
+ * Node.js library packages this org's currently-migrated repos ship.
183
+ */
184
+ variant?: "astro" | "nextjs" | "node-lts" | "react";
185
+ /**
186
+ * Add a `@/*` → `./src/*` path alias. A real per-package choice, not a
187
+ * default — roughly 40% of packages checked use one, the rest don't.
188
+ */
189
+ paths?: boolean;
190
+ }
191
+ /**
192
+ * A package-level `tsconfig.json` — the uniform shape confirmed across
193
+ * every package checked, parameterized only by the two fields that
194
+ * genuinely vary (`display`, `paths`). No scaffold/workflow header (matches
195
+ * `.alexrc.json`'s existing precedent for a strict-JSON Bucket B file —
196
+ * JSON has no comment syntax to carry one, and TypeScript's own tolerance
197
+ * for JSONC comments in `tsconfig.json` isn't worth relying on for a file
198
+ * this thin).
31
199
  */
200
+ export declare function createTsconfig(options: TsconfigOptions): string;
201
+ interface EnsureRootWorkspaceMemberResult {
202
+ content: string;
203
+ changed: boolean;
204
+ }
205
+ interface EnsureTurboDependencyResult {
206
+ content: string;
207
+ changed: boolean;
208
+ }
32
209
  /** Minimal structural logger — `@theholocron/observability`'s `Logger` satisfies it. */
33
210
  interface RunLogger {
34
211
  debug(obj: Record<string, unknown>, msg?: string): void;
35
212
  warn(obj: Record<string, unknown>, msg?: string): void;
36
213
  }
214
+ /**
215
+ * Runs `cmd` and reports its exit code. `opts.env` is added to the child's
216
+ * environment (on top of the parent's), e.g. `TURBO_SCM_BASE` for `--affected`.
217
+ */
37
218
  type ExecFn = (cmd: string, args: string[], opts: {
38
219
  cwd: string;
220
+ env?: Record<string, string>;
39
221
  }) => {
40
222
  exitCode: number;
41
223
  };
@@ -73,6 +255,14 @@ interface RunTaskInput extends RunDeps {
73
255
  required?: boolean;
74
256
  /** `turbo --filter=<pkg>` passthrough (monorepo). Ignored when the repo has no `turbo.json`. */
75
257
  filter?: string;
258
+ /** `turbo --affected`: only the packages changed since `base`, plus their dependents. Ignored without a `turbo.json`. */
259
+ affected?: boolean;
260
+ /** Git ref `affected` compares against; falls back to `TURBO_SCM_BASE`. */
261
+ base?: string;
262
+ /** Environment `affected` reads (`GITHUB_EVENT_NAME`, `GITHUB_REF_NAME`, `TURBO_SCM_BASE`). Defaults to empty. */
263
+ env?: Record<string, string | undefined>;
264
+ /** The task entry's `jobs` switches: a sub-job set to `false` (by key or alias) is not run. */
265
+ jobSwitches?: Record<string, boolean>;
76
266
  }
77
267
  interface RunTaskReport {
78
268
  status: "ok" | "fail" | "skip" | "dry-run" | "unknown";
@@ -80,14 +270,18 @@ interface RunTaskReport {
80
270
  command?: string;
81
271
  message?: string;
82
272
  }
83
- declare function runTask(input: RunTaskInput): RunTaskReport;
84
- //#endregion
85
- //#region src/ci.d.ts
273
+ export declare function runTask(input: RunTaskInput): RunTaskReport;
86
274
  interface CiOptions {
87
275
  /** Print the plan without running anything. */
88
276
  dryRun?: boolean;
89
277
  /** `turbo --filter=<pkg>` passthrough (monorepo). */
90
278
  filter?: string;
279
+ /** `turbo --affected`: only the packages changed since `base`. */
280
+ affected?: boolean;
281
+ /** Git ref `affected` compares against. */
282
+ base?: string;
283
+ /** Environment `affected` reads. */
284
+ env?: Record<string, string | undefined>;
91
285
  /** `"required"` (default) or `"all"` (every `ci: true` task). */
92
286
  scope?: "required" | "all";
93
287
  }
@@ -107,127 +301,164 @@ interface CiInput extends RunDeps, CiOptions {
107
301
  cwd: string;
108
302
  config: TasksConfig;
109
303
  }
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;
304
+ export declare function runCi(input: CiInput): CiReport;
305
+ /** Comment style produced by workflowHeader. */
306
+ type WorkflowHeaderFormat = "yaml" | "cjs" | "shebang";
307
+ interface CreateHeaderOptions {
308
+ /** Path within theholocron/holocron that owns the file being generated. */
309
+ source: string;
310
+ /** CLI command that produces the file. Defaults to "holocron repo setup". */
311
+ tool?: string;
312
+ /** Set true only when writing to theholocron/.github itself. */
313
+ forPrimary?: boolean;
314
+ }
315
+ interface HeaderFunctions {
166
316
  /**
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`
317
+ * "AUTO-GENERATED — do not edit" header for files managed on every run.
171
318
  *
172
- * Preview URLs resolve as `<repo>-pr-<n>.<domain>`.
319
+ * format:
320
+ * "yaml" — `# …` comment lines (YAML, text, ignore files)
321
+ * "cjs" — `/* … *\/` block comment (CommonJS modules)
322
+ * "shebang" — `#!/bin/sh` on line 1, then yaml header (shell scripts)
173
323
  */
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;
324
+ workflowHeader(format?: WorkflowHeaderFormat): string;
325
+ /**
326
+ * "Scaffolded — edit this file freely" header for one-time generated files
327
+ * that the user is expected to take over (e.g. codecov.yml).
328
+ */
329
+ scaffoldHeader(): string;
184
330
  }
185
331
  /**
186
- * Extract the Cloudflare Pages preview config from a deploy workflow's `with:` object.
332
+ * Factory that binds `source` and `tool` once and returns all header
333
+ * constructors for auto-generated files. Prefer this over passing source
334
+ * as a positional argument at every call site.
187
335
  *
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
336
+ * @example
337
+ * const { workflowHeader, scaffoldHeader } = createHeader({
338
+ * source: "cli/astromech/src/templates/configs/editorconfig/create-config.ts",
339
+ * });
192
340
  *
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.
341
+ * export function createConfig(): string {
342
+ * return `${workflowHeader()}${body}`;
343
+ * }
200
344
  *
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.
345
+ * ## Which header to use
346
+ *
347
+ * | Function | When to use | User can edit? |
348
+ * |-------------------|----------------------------------------------------|----------------|
349
+ * | `workflowHeader` | Files overwritten on every setup / sync-github run | No — "AUTO-GENERATED — do not edit" |
350
+ * | `scaffoldHeader` | Files written once; user takes ownership after | Yes — "Scaffolded — edit this file freely" |
351
+ *
352
+ * ## `workflowHeader` formats
353
+ *
354
+ * | Format | Comment style | Used for |
355
+ * |---------------------|------------------------|-------------------------------------------------------|
356
+ * | `"yaml"` (default) | `# …` lines | YAML workflows, ignore files, `.editorconfig`, labeler|
357
+ * | `"cjs"` | `/* … *\/` block | CommonJS config files (`.cjs`) |
358
+ * | `"shebang"` | `#!/bin/sh` + `# …` | Shell scripts (`prepare-commit-msg`, hooks) |
205
359
  */
206
- declare function generateCombinedDeployContent(deployWith: Record<string, unknown>, paths: string[], preview: Pick<PreviewConfig, "project">): string;
360
+ export declare function createHeader(options: CreateHeaderOptions): HeaderFunctions;
361
+ export declare const defaultListDirs: (path: string) => string[];
362
+ export declare const defaultReadJson: (path: string) => unknown;
363
+ interface SpawnResult {
364
+ status: number | null;
365
+ stdout: string;
366
+ stderr: string;
367
+ }
368
+ type Run = (command: string, args: string[], options: Record<string, unknown>) => SpawnResult;
369
+ /** A workspace package: absolute folder, and what its `package.json` says. */
370
+ interface WorkspacePackage {
371
+ name: string;
372
+ dir: string;
373
+ version: string | undefined;
374
+ dependencies: Record<string, string>;
375
+ /**
376
+ * A workspace:* devDependency can optionally count too (holocron#1071,
377
+ * workspaceDependencies' includeDevDependencies option). Optional so a
378
+ * caller holding the previous, dev-dependency-less shape (a plain
379
+ * object literal, or a value from outside this package's own version)
380
+ * keeps compiling and working -- a missing value is treated the same
381
+ * as `{}`.
382
+ */
383
+ devDependencies?: Record<string, string>;
384
+ }
385
+ interface Tree {
386
+ readJson: (path: string) => unknown;
387
+ listDirs: (path: string) => string[];
388
+ }
207
389
  /**
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`.
390
+ * Every package the repo's `pnpm-workspace.yaml` declares (`packages/*`,
391
+ * `apps/*` and `plugins/*` when it declares none) with a readable, named
392
+ * `package.json`.
216
393
  */
217
- declare function normalizeWorkflowWith(raw: Record<string, unknown>): Record<string, unknown>;
394
+ export declare function workspacePackages(repoRoot: string, { readJson, listDirs }: Tree): WorkspacePackage[];
395
+ interface DeployOnReleaseOptions {
396
+ cwd: string;
397
+ /** The release's channel: its prerelease identifier (`alpha`); empty or `main` for a stable release. */
398
+ channel: string;
399
+ /** The previous release's commit; omitted when there is none, so every deploying channel match deploys. */
400
+ from?: string;
401
+ /** The release commit. Default `HEAD`. */
402
+ to?: string;
403
+ /** Where progress lines go (stdout in the CLI). */
404
+ print: (line: string) => void;
405
+ dryRun?: boolean;
406
+ }
407
+ interface DeployOnReleaseDeps extends Partial<Tree> {
408
+ run?: Run;
409
+ sleep?: (ms: number) => Promise<void>;
410
+ now?: () => number;
411
+ /** Reads a package folder's task manifest; `loadTasksConfig` by default. */
412
+ loadTasks?: (dir: string) => Promise<TasksConfig>;
413
+ }
414
+ interface DeployOnReleaseResult {
415
+ pkg: string;
416
+ status: "ok" | "fail" | "skip" | "dry-run";
417
+ message: string;
418
+ }
419
+ interface DeployOnReleaseReport {
420
+ /** `fail` if any package's deploy failed; `skip` if none applied to this release; else `ok`. */
421
+ status: "ok" | "fail" | "skip";
422
+ results: DeployOnReleaseResult[];
423
+ }
218
424
  /**
219
- * Derive on.push.paths entries from the deploy with: shorthand.
220
- * Used by both `holocron setup` and `sync-workflow-templates`.
425
+ * Deploys every package whose manifest declares a release-time deploy that
426
+ * applies to this release. Never throws for a deploy problem: each package's
427
+ * outcome is in the report, and `status: "fail"` is the caller's exit code.
221
428
  */
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;
429
+ export declare function deployOnRelease(options: DeployOnReleaseOptions, { run, readJson, listDirs, sleep, now, loadTasks }?: DeployOnReleaseDeps): Promise<DeployOnReleaseReport>;
430
+ interface GroupOptions {
431
+ /** Print the resolved commands without running anything. */
432
+ dryRun?: boolean;
433
+ /** `turbo --filter=<pkg>` passthrough (monorepo). */
434
+ filter?: string;
435
+ /** `turbo --affected`: only the packages changed since `base`. */
436
+ affected?: boolean;
437
+ /** Git ref `affected` compares against. */
438
+ base?: string;
439
+ /** Environment `affected` reads. */
440
+ env?: Record<string, string | undefined>;
441
+ }
442
+ interface GroupJobReport {
443
+ task: string;
444
+ status: "ok" | "fail" | "skip" | "dry-run";
445
+ command?: string;
446
+ message?: string;
447
+ }
448
+ interface GroupReport {
449
+ /** `"unknown"` when the namespace matches zero configured tasks. */
450
+ status: "ok" | "fail" | "dry-run" | "unknown";
451
+ jobs: GroupJobReport[];
452
+ }
453
+ interface GroupInput extends RunDeps, GroupOptions {
454
+ cwd: string;
455
+ config: TasksConfig;
456
+ /** The bare namespace, e.g. `"sourceQuality"` — matched against `"sourceQuality."`-prefixed task names. */
457
+ namespace: string;
228
458
  }
229
- //#endregion
230
- //#region src/astromech.d.ts
459
+ export declare function runGroup(input: GroupInput): GroupReport;
460
+ /** Every configured task whose name starts with `"<namespace>."`, in manifest declaration order. */
461
+ export declare function matchNamespace(config: TasksConfig, namespace: string): string[];
231
462
  interface AstromechOptions {
232
463
  /** Repo root. */
233
464
  cwd: string;
@@ -252,6 +483,8 @@ interface AstromechOptions {
252
483
  readFile?: (path: string) => string;
253
484
  fileExists?: (path: string) => boolean;
254
485
  listDir?: (path: string) => string[];
486
+ /** Injectable environment for `--affected` (tests). Defaults to `process.env`. */
487
+ env?: Record<string, string | undefined>;
255
488
  /** Injectable binary lookup (tests). Default checks `node_modules/.bin` then `PATH`. */
256
489
  lookPath?: (cwd: string, bin: string) => string | null;
257
490
  }
@@ -270,10 +503,21 @@ interface RunOptions {
270
503
  required?: boolean;
271
504
  /** `turbo --filter=<pkg>` passthrough (monorepo). */
272
505
  filter?: string;
506
+ /** `turbo --affected`: only the packages changed since `base`. */
507
+ affected?: boolean;
508
+ /** Git ref `affected` compares against. */
509
+ base?: string;
273
510
  }
274
511
  interface Astromech {
275
- /** Run one task — or one of its sub-jobs (`opts.job`) — locally. */
276
- run(task: string, opts?: RunOptions): RunTaskReport;
512
+ /**
513
+ * Run one task — or one of its sub-jobs (`opts.job`) — locally. When
514
+ * `task` isn't an exact registry task but matches the prefix of one or
515
+ * more configured tasks (`"sourceQuality"` against `sourceQuality.*`),
516
+ * runs every matching task in sequence instead ({@link GroupReport}) —
517
+ * `opts.job` is ignored for a namespace match, since a job belongs to
518
+ * one task, not a namespace.
519
+ */
520
+ run(task: string, opts?: RunOptions): RunTaskReport | GroupReport;
277
521
  /**
278
522
  * Run the merge-gating checks locally, in CI order — "will CI pass?".
279
523
  * Default scope: `required: true` tasks (falls back to every `ci: true`
@@ -288,7 +532,7 @@ interface Astromech {
288
532
  */
289
533
  thinCallers(): Map<string, string>;
290
534
  /**
291
- * The complete reusable-workflow batch `holocron sync-github` pushes to
535
+ * The complete reusable-workflow batch `holocron sync github` pushes to
292
536
  * `theholocron/.github` — repo-relative path → content, "do not edit" header
293
537
  * already applied to the YAML. Config-independent (the same for every repo).
294
538
  */
@@ -301,18 +545,27 @@ interface Astromech {
301
545
  * when there is no config or `syncScripts: false`.
302
546
  */
303
547
  packageScripts(): Record<string, string>;
548
+ /**
549
+ * Task names this repo's manifest can actually run locally — the same
550
+ * filter {@link packageScripts} applies (skips `local: false` and tasks
551
+ * with no local runner at all), but independent of `syncScripts`: a repo
552
+ * that opts out of generated `package.json` scripts still has real
553
+ * runnable tasks. Empty when there is no config. Backs `holocron`'s own
554
+ * interactive task picker (`run` with no task given).
555
+ */
556
+ runnableTasks(): string[];
304
557
  /**
305
558
  * The branch-protection required-status-check contexts for this repo —
306
559
  * every `required: true` task's check context plus `extraRequiredChecks`,
307
- * ordered and de-duplicated. `holocron setup` prepends `"DCO"` and applies
560
+ * ordered and de-duplicated. `holocron repo setup` prepends `"DCO"` and applies
308
561
  * the list; this method is policy-free (manifest only).
309
562
  */
310
563
  requiredChecks(): string[];
311
564
  /**
312
- * This repo's `codecov.yml` — component `paths` derived from `packages/*`.
565
+ * This repo's `codecov.yml` — component `paths` derived from the workspace packages.
313
566
  * Pass the current file's content (`null` if none exists yet) to either
314
567
  * merge the component list in or scaffold a fresh file. Policy-free same
315
- * as {@link requiredChecks} — `holocron setup` owns writing the result.
568
+ * as {@link requiredChecks} — `holocron repo setup` owns writing the result.
316
569
  */
317
570
  codecovConfig(existing: string | null): string;
318
571
  /**
@@ -328,151 +581,26 @@ interface Astromech {
328
581
  * (not just an orchestrator) silently vanishes from `turbo run <task>`.
329
582
  * Pass `pnpm-workspace.yaml`'s current content (or `""` if none exists —
330
583
  * 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.
584
+ * already) and root `package.json`'s own `scripts` object — values and
585
+ * all, not just keys, so a task-name-matching script that's already the
586
+ * generated `holocron run <task> --` wrapper (predating this call, not
587
+ * written by it) is correctly excluded rather than treated as proof root
588
+ * is directly buildable (#846). `changed: false` means don't write
589
+ * anything — the file is already correct.
333
590
  */
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 {
591
+ ensureRootWorkspaceMember(workspaceYaml: string, rootScripts: Readonly<Record<string, string>>): EnsureRootWorkspaceMemberResult;
394
592
  /**
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.
593
+ * `turboConfig()` writes a `turbo.json` but never touches `package.json`
594
+ * — a repo with no local `turbo` devDependency falls back to whatever
595
+ * (if anything) is globally on `PATH`, per `run.ts`'s `resolveBin()`.
596
+ * Pass root `package.json`'s raw content and `pnpm-workspace.yaml`'s
597
+ * current content (checked for an existing `turbo` catalog entry, which
598
+ * takes precedence over the hardcoded fallback version). `changed: false`
599
+ * means don't write anything — `devDependencies.turbo` already exists.
398
600
  */
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[];
410
- /**
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.
413
- */
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";
601
+ ensureTurboDependency(packageJson: string, workspaceYaml: string): EnsureTurboDependencyResult;
424
602
  }
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
- */
603
+ export declare function createAstromech(options: AstromechOptions): Astromech;
476
604
  /** How to run one task (or job) locally. */
477
605
  interface LocalRunner {
478
606
  /** Binary to invoke — resolved from `node_modules/.bin` then PATH. */
@@ -510,19 +638,29 @@ interface JobDef {
510
638
  local: LocalRunner | null;
511
639
  /**
512
640
  * 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;
641
+ * `platform.repoValidation / Validate docs presence`) — every sub-job is a CI job.
642
+ * `holocron run <task>` and `holocron run ci` label each job line with it;
515
643
  * the task-level `… / Conclusion` context (only for tasks with several
516
644
  * jobs) lives in `WORKFLOW_CHECK_CONTEXTS`.
517
645
  */
518
646
  checkContext: string;
647
+ /**
648
+ * The name a repo's config uses to switch this job off (`jobs: { docsEnforcement: false }`),
649
+ * where the job's own key is vague or fixed by the reusable workflow. The key itself works too.
650
+ */
651
+ alias?: string;
519
652
  }
520
653
  interface TaskDef {
654
+ /**
655
+ * Sub-job slugs that no longer exist but that a reusable workflow synced earlier may still pass:
656
+ * `holocron run <task> <retired>` is a clean skip instead of an unknown-job failure.
657
+ */
658
+ retiredJobs?: string[];
521
659
  /**
522
660
  * `null` — the registry has no built-in runner (CodeQL, deploys, the
523
661
  * bundle-size job). An explicit turbo task or `package.json` script still
524
662
  * 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
663
+ * and `holocron run ci` skips it — never a failure, even when the task is
526
664
  * `required` (a CI-only check isn't a local one).
527
665
  */
528
666
  local: LocalRunner | null;
@@ -548,155 +686,167 @@ interface TaskDef {
548
686
  /** Turborepo fan-out config for this task — see {@link TurboTaskConfig}. Omitted for whole-repo, non-fan-out tasks. */
549
687
  turbo?: TurboTaskConfig;
550
688
  }
551
- declare const TASKS: Record<string, TaskDef>;
689
+ /**
690
+ * The task registry — how each task runs *locally*, without GitHub
691
+ * Actions. `holocron run <task>` and `holocron run ci` resolve against this;
692
+ * adding a task here gives every repo that task.
693
+ *
694
+ * Keyed identically to the workflow templates — a task IS a workflow. This
695
+ * is the canonical vocabulary table (epic #672, D11): every other artifact
696
+ * (`KNOWN_TASKS`, `thin-callers.ts`'s `KNOWN_WORKFLOWS`/`WORKFLOW_CHECK_CONTEXTS`,
697
+ * `CI_ORDER`) derives from these keys rather than hand-duplicating them —
698
+ * including the future GitHub App (#679), which imports this same table for
699
+ * config-schema validation instead of reimplementing its own copy.
700
+ *
701
+ * Task names are an intent-facing vocabulary (`verification.*`,
702
+ * `sourceQuality.*`, `security.*`, `delivery.*`, `platform.*`,
703
+ * `knowledge.*`), not tool names — `eslint`/`vitest`/`tsdown`/… stay
704
+ * internal to this file and the `configs/` folder. See
705
+ * `docs/wiki/specifications/tech-vocabulary-rename.spec.md` (#675) for the full mapping and
706
+ * the reasoning behind each namespace and decomposition.
707
+ *
708
+ * Spec: `docs/wiki/specifications/tech-astromech-task-runner.spec.md` (epic #581).
709
+ */
710
+ export declare const TASKS: Record<string, TaskDef>;
552
711
  /** Every task name the registry knows. */
553
- declare const KNOWN_TASKS: Set<string>;
712
+ export declare const KNOWN_TASKS: Set<string>;
554
713
  /**
555
- * The order `holocron ci` runs tasks in — cheapest / fastest signal first, so
714
+ * The order `holocron run ci` runs tasks in — cheapest / fastest signal first, so
556
715
  * an agent or a `pre-push` hook fails early. Tasks not listed here run last, in
557
716
  * manifest order. (The generated thin callers carry no `needs:` — cross-workflow
558
- * ordering lives in `theholocron/.github` — so `holocron ci` declares its own.)
717
+ * ordering lives in `theholocron/.github` — so `holocron run ci` declares its own.)
559
718
  */
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
719
+ export declare const CI_ORDER: string[];
567
720
  /**
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.
721
+ * The paths a release must touch to redeploy `pkg` when its manifest doesn't
722
+ * list them: its own folder plus the folder of every
723
+ * {@link workspaceDependencies} entry. Derived rather than listed so a new or
724
+ * dropped workspace dependency needs no second edit.
573
725
  *
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.
726
+ * @returns Repo-relative prefixes, each ending in `/`.
727
+ */
728
+ export declare function defaultPaths(repoRoot: string, pkg: WorkspacePackage, all: WorkspacePackage[]): string[];
729
+ declare function createRcConfig(): string;
730
+ declare function createIgnoreConfig(): string;
731
+ /**
732
+ * `.husky/commit-msg` — lints the commit message via `holocron run lint
733
+ * commit-msg` (holocron#789), the real programmatic replacement for
734
+ * shelling out to `commitlint --edit`. Installed by `holocron repo setup` when
735
+ * hooks are enabled. Same `__HOLOCRON_SCRIPT__` substitution as `pre-push`.
582
736
  *
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).
737
+ * @param holocronScript - the command that invokes the CLI. Defaults to
738
+ * `pnpm exec holocron`; the source repo passes `node cli/cli/dist/cli.mjs`.
590
739
  */
591
- interface ResolverDeps {
592
- readFile: (path: string) => string;
593
- fileExists: (path: string) => boolean;
740
+ declare function createConfig(holocronScript?: string): string;
741
+ /** What varies in the generated `.github/dependabot.yml`; the rest of the file is the same for every repo. */
742
+ interface DependabotConfigOptions {
743
+ /**
744
+ * Packages Dependabot must not raise version updates for, by exact name. Each becomes a name-only
745
+ * `ignore` entry on the npm ecosystem. Security updates are not affected: for those, Dependabot
746
+ * only honours an `ignore` entry that lists `versions`.
747
+ */
748
+ ignore?: readonly string[];
594
749
  }
595
- /** Every tool name the resolver knows how to point at a shared config. */
596
- declare const RESOLVABLE_TOOLS: ReadonlySet<string>;
597
750
  /**
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).
751
+ * The content of `.github/dependabot.yml`, with its generated-file header. Names in `ignore` get a name-only
752
+ * `ignore` entry on the npm ecosystem; with none, the file is the shared body unchanged.
603
753
  */
604
- declare function resolveToolConfig(tool: string, cwd: string, deps: ResolverDeps): string[];
605
- //#endregion
606
- //#region src/reusable.d.ts
754
+ declare function createConfig$1({ ignore }?: DependabotConfigOptions): string;
755
+ declare function createConfig$2(): string;
756
+ declare function createConfig$3(): string;
607
757
  /**
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.
611
- *
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`.
758
+ * The generated `.editorconfig-checker.json`.
616
759
  *
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/`.
760
+ * Deliberately carries no `"Version"` key: editorconfig-checker treats it as a
761
+ * hard gate and exits non-zero the moment the running binary's version differs
762
+ * — which it does the instant a contributor's local install (Homebrew tracks
763
+ * latest) drifts from the version super-linter bundles in CI, breaking
764
+ * `holocron run lint` / the pre-push hook for everyone (#618). The config
765
+ * options here (`Exclude`, `Disable`) are stable across releases, so pinning
766
+ * buys nothing.
619
767
  */
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>;
768
+ declare function createConfig$4(): string;
769
+ declare function createConfig$5(): string;
626
770
  /**
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).
771
+ * `.husky/pre-commit` — runs GitLeaks (scoped to staged changes) and
772
+ * lint-staged before every commit. Installed by `holocron repo setup` when hooks
773
+ * are enabled (default for `protection: "strict"`). `git commit --no-verify`
774
+ * bypasses it.
775
+ *
776
+ * `gitleaks protect --staged` (not `gitleaks git`) is deliberate: the latter
777
+ * scans the entire commit history on every invocation, so once any false
778
+ * positive lands in a past commit — a fake test token, an example key in a
779
+ * doc — every future commit is permanently blocked, regardless of what's
780
+ * actually staged.
630
781
  */
631
- declare function reusableTemplates(): Map<string, string>;
632
- //#endregion
633
- //#region src/tsconfig.d.ts
782
+ declare function createConfig$6(): string;
634
783
  /**
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.
784
+ * `.husky/pre-push` — runs `holocron run ci` (the merge-gating checks, in CI order)
785
+ * before every push. Installed by `holocron repo setup` when hooks are enabled
786
+ * (default for `protection: "strict"`). `git push --no-verify` bypasses it.
650
787
  *
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.
788
+ * @param holocronScript - the command that invokes the CLI. Defaults to
789
+ * `pnpm exec holocron`; the source repo passes `node cli/cli/dist/cli.mjs`.
674
790
  */
675
- interface TsconfigOptions {
676
- /** Human-readable name for the `display` field — the package's own name is the usual choice. */
677
- display: string;
791
+ declare function createConfig$7(holocronScript?: string): string;
792
+ declare function createConfig$8(): string;
793
+ declare function createConfig$9(): string;
794
+ declare function createIgnoreConfig$1(): string;
795
+ /** The `packages:` entries of a `pnpm-workspace.yaml`, split by whether they include or exclude (`!pattern`) packages. */
796
+ interface WorkspaceGlobs {
797
+ include: string[];
798
+ exclude: string[];
799
+ }
800
+ /**
801
+ * The `packages:` list of a `pnpm-workspace.yaml`. A line-based read of the
802
+ * plain block-list form, not a YAML parse -- the same approach (and for the
803
+ * same reason) as `ensureRootWorkspaceMember()`: the file routinely carries a
804
+ * `catalog:`/`catalogs:`/`overrides:` block after `packages:` that nothing
805
+ * here should have to round-trip. Quotes and trailing comments are stripped;
806
+ * a missing `packages:` key, or the inline `packages: [a, b]` form, reads as no
807
+ * globs (callers fall back to the default roots).
808
+ */
809
+ export declare function readWorkspaceGlobs(workspaceYaml: string): WorkspaceGlobs;
810
+ /** Where packages live when there is no `pnpm-workspace.yaml` (or it lists none): the layout before globs were read. */
811
+ export declare const DEFAULT_WORKSPACE_ROOTS: readonly string[];
812
+ interface DiscoverWorkspacePackagesOptions extends Pick<ListWorkspacePackagesOptions, "listDirs" | "readFile"> {
813
+ /** Replaces the read of `pnpm-workspace.yaml`. Throw (`ENOENT`) when it is absent -- or leave it out to read the real file. */
814
+ readText?: (path: string) => string;
678
815
  /**
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.
816
+ * Only the packages of one version group: a folder of the repo (`clients`,
817
+ * `observability`). A package belongs when it is that folder or sits under it.
683
818
  */
684
- variant?: "astro" | "nextjs" | "node-lts" | "react";
819
+ group?: string;
685
820
  /**
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.
821
+ * Leave out the packages of these version groups. A repo that releases some folders on
822
+ * their own line releases everything else together, and that release must not sweep the
823
+ * independent groups in.
688
824
  */
689
- paths?: boolean;
825
+ excludeGroups?: readonly string[];
690
826
  }
691
827
  /**
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).
828
+ * Every package the repo's `pnpm-workspace.yaml` declares, as
829
+ * `listWorkspacePackagesSync()` entries -- in glob order, packages within a
830
+ * `<dir>/*` glob sorted by name. Two forms of glob are understood:
831
+ *
832
+ * - `<dir>/*`: each child of `<dir>` that has a `package.json` (`clients/*`).
833
+ * - a literal directory: that directory is the package (`observability`,
834
+ * `docs/theme`).
835
+ *
836
+ * `!pattern` entries drop matching packages. The repo root (`.`) is not a
837
+ * workspace child and is skipped; callers that treat a root-only repo as a
838
+ * single package read the root manifest themselves. Any other glob throws
839
+ * rather than being silently skipped. Without a `pnpm-workspace.yaml`, or one
840
+ * with no `packages:`, the default roots are scanned.
841
+ *
842
+ * Nothing is filtered by `name`, `version` or `private`; that is the caller's
843
+ * call, as for `listWorkspacePackagesSync()`.
844
+ */
845
+ export declare function discoverWorkspacePackages(repoRoot: string, options?: DiscoverWorkspacePackagesOptions): WorkspacePackageEntry[];
846
+ /**
847
+ * The globs {@link discoverWorkspacePackages} scans: the repo's
848
+ * `pnpm-workspace.yaml` `packages:` list, or the {@link DEFAULT_WORKSPACE_ROOTS}
849
+ * as `<root>/*` when there is no such file or it lists none.
699
850
  */
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 };
851
+ export declare function resolveWorkspaceGlobs(repoRoot: string, options?: Pick<DiscoverWorkspacePackagesOptions, "readText">): WorkspaceGlobs;
852
+ export { type Astromech, type AstromechOptions, type CiJobReport, type CiOptions, type CiReport, type CreateHeaderOptions, type DependabotConfigOptions, type DeployOnReleaseOptions, type DeployOnReleaseReport, type DeployOnReleaseResult, type WorkspacePackage as DeployWorkspacePackage, type DiscoverWorkspacePackagesOptions, 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 WorkspaceGlobs, 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 };