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

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