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