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