@theholocron/astromech 5.0.0-alpha.51 → 5.0.0-alpha.511
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 +209 -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 +1239 -533
- package/dist/index.mjs +3874 -1431
- package/dist/lint/index.d.mts +97 -0
- package/dist/lint/index.mjs +160 -0
- package/dist/load-PgZbUPyW.mjs +534 -0
- package/dist/repo-validation/index.d.mts +300 -0
- package/dist/repo-validation/index.mjs +541 -0
- package/dist/{schema-D01VYg43.d.mts → schema.type-Cg6I1dCc.d.mts} +32 -15
- package/dist/upgrade/index.d.mts +126 -0
- package/dist/upgrade/index.mjs +283 -0
- package/package.json +47 -21
- package/dist/schema-Cf5dfaDO.mjs +0 -11
|
@@ -0,0 +1,534 @@
|
|
|
1
|
+
import { loadLayered } from "@theholocron/datapad";
|
|
2
|
+
// src/config/schema/schema.ts
|
|
3
|
+
/**
|
|
4
|
+
* The `tasks` config shape — the single manifest of what a repo runs.
|
|
5
|
+
* Read from a dedicated `astromech.config.*` file or the `tasks` key of
|
|
6
|
+
* `holocron.config.*` (see {@link loadTasksConfig}).
|
|
7
|
+
*
|
|
8
|
+
* Runtime validation is the loader's job, not this type's — the type only
|
|
9
|
+
* describes what an author writes.
|
|
10
|
+
*/
|
|
11
|
+
/** Normalise a `TaskConfigItem` to a full {@link TaskEntry} with defaults applied. */
|
|
12
|
+
function normalizeTaskEntry(item) {
|
|
13
|
+
return {
|
|
14
|
+
ci: true,
|
|
15
|
+
local: true,
|
|
16
|
+
...typeof item === "string" ? { name: item } : item
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
// src/registry/registry.ts
|
|
20
|
+
/**
|
|
21
|
+
* The task registry — how each task runs *locally*, without GitHub
|
|
22
|
+
* Actions. `holocron run <task>` and `holocron run ci` resolve against this;
|
|
23
|
+
* adding a task here gives every repo that task.
|
|
24
|
+
*
|
|
25
|
+
* Keyed by the flat, verb-first id (`test:unit`, `lint:code`, `build`,
|
|
26
|
+
* `deploy-preview`), the one spelling of a task in the CLI (spec
|
|
27
|
+
* `ci-flat-task-vocabulary`, SPEC-0064, epic #1612). A colon means "member of
|
|
28
|
+
* the suite named before it": `test`, `lint`, `scan`,
|
|
29
|
+
* `validate` and `measure` are suites, declared here by the `suite` field of their leaves
|
|
30
|
+
* and never ids of their own. A hyphen is part of a verb phrase and implies no
|
|
31
|
+
* suite. The old dotted names (`verification.unitTests`, …) are accepted for a
|
|
32
|
+
* window through {@link LEGACY_NAMES} and still name the generated workflow
|
|
33
|
+
* files, turbo tasks and `package.json` scripts until the later phases move
|
|
34
|
+
* those (see {@link legacyName}).
|
|
35
|
+
*
|
|
36
|
+
* Every other artifact (`KNOWN_TASKS`, `CI_ORDER`, the suites) derives from
|
|
37
|
+
* these keys rather than hand-duplicating them — including the GitHub App
|
|
38
|
+
* (#679), which imports this same table for config-schema validation.
|
|
39
|
+
*
|
|
40
|
+
* Declared order is run order: a suite runs its members in the order they
|
|
41
|
+
* appear here.
|
|
42
|
+
*
|
|
43
|
+
* Task names are an intent-facing vocabulary, not tool names —
|
|
44
|
+
* `eslint`/`vitest`/`tsdown`/… stay internal to this file and the `configs/`
|
|
45
|
+
* folder.
|
|
46
|
+
*
|
|
47
|
+
* Spec: `.notes/ci-flat-task-vocabulary.spec.md`, and
|
|
48
|
+
* `docs/wiki/specifications/tech-astromech-task-runner.spec.md` (epic #581).
|
|
49
|
+
*/
|
|
50
|
+
const TASKS = {
|
|
51
|
+
"test:unit": {
|
|
52
|
+
group: "Verification",
|
|
53
|
+
scope: "package",
|
|
54
|
+
suite: "test",
|
|
55
|
+
local: {
|
|
56
|
+
tool: "vitest",
|
|
57
|
+
args: ["run", "--coverage"]
|
|
58
|
+
},
|
|
59
|
+
turbo: {
|
|
60
|
+
inputs: [
|
|
61
|
+
"src/**",
|
|
62
|
+
"test/**",
|
|
63
|
+
"vitest.config.ts",
|
|
64
|
+
"vitest.config.js",
|
|
65
|
+
"vitest.config.mjs",
|
|
66
|
+
"$TURBO_ROOT$/vitest.config.ts",
|
|
67
|
+
"$TURBO_ROOT$/vitest.config.js",
|
|
68
|
+
"$TURBO_ROOT$/vitest.config.mjs",
|
|
69
|
+
"package.json"
|
|
70
|
+
],
|
|
71
|
+
outputs: ["test-report.junit.xml", "coverage/**"],
|
|
72
|
+
dependsOn: ["build", "^build"]
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
"test:visual": {
|
|
76
|
+
group: "Verification",
|
|
77
|
+
scope: "repo",
|
|
78
|
+
suite: "test",
|
|
79
|
+
local: null
|
|
80
|
+
},
|
|
81
|
+
"test:perf": {
|
|
82
|
+
group: "Verification",
|
|
83
|
+
scope: "repo",
|
|
84
|
+
suite: "test",
|
|
85
|
+
local: { detect: [{
|
|
86
|
+
when: /^lighthouse\.config\.(cjs|js|mjs|ts)$/,
|
|
87
|
+
tool: "lhci",
|
|
88
|
+
args: ["autorun"]
|
|
89
|
+
}, {
|
|
90
|
+
when: /^lighthouserc\.(cjs|js|mjs|json|yml|yaml)$/,
|
|
91
|
+
tool: "lhci",
|
|
92
|
+
args: ["autorun"]
|
|
93
|
+
}] }
|
|
94
|
+
},
|
|
95
|
+
typecheck: {
|
|
96
|
+
group: "Verification",
|
|
97
|
+
scope: "package",
|
|
98
|
+
local: {
|
|
99
|
+
tool: "tsc",
|
|
100
|
+
args: ["--noEmit"]
|
|
101
|
+
},
|
|
102
|
+
turbo: {
|
|
103
|
+
inputs: [
|
|
104
|
+
"src/**",
|
|
105
|
+
"test/**",
|
|
106
|
+
"tsconfig.json"
|
|
107
|
+
],
|
|
108
|
+
outputs: [],
|
|
109
|
+
dependsOn: ["^build"]
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
"lint:code": {
|
|
113
|
+
group: "Source Quality",
|
|
114
|
+
scope: "package",
|
|
115
|
+
suite: "lint",
|
|
116
|
+
local: null,
|
|
117
|
+
linterGroup: [
|
|
118
|
+
"eslint",
|
|
119
|
+
"actionlint",
|
|
120
|
+
"git-merge-conflict-markers"
|
|
121
|
+
],
|
|
122
|
+
turbo: {
|
|
123
|
+
inputs: [
|
|
124
|
+
"src/**",
|
|
125
|
+
"eslint.config.ts",
|
|
126
|
+
"eslint.config.js",
|
|
127
|
+
"eslint.config.mjs",
|
|
128
|
+
"eslint.config.cjs",
|
|
129
|
+
"$TURBO_ROOT$/eslint.config.ts",
|
|
130
|
+
"$TURBO_ROOT$/eslint.config.js",
|
|
131
|
+
"$TURBO_ROOT$/eslint.config.mjs",
|
|
132
|
+
"$TURBO_ROOT$/eslint.config.cjs"
|
|
133
|
+
],
|
|
134
|
+
outputs: [],
|
|
135
|
+
dependsOn: ["^build"]
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
"lint:editorconfig": {
|
|
139
|
+
group: "Source Quality",
|
|
140
|
+
scope: "repo",
|
|
141
|
+
suite: "lint",
|
|
142
|
+
local: null,
|
|
143
|
+
linterGroup: ["editorconfig"]
|
|
144
|
+
},
|
|
145
|
+
"lint:markdown": {
|
|
146
|
+
group: "Source Quality",
|
|
147
|
+
scope: "repo",
|
|
148
|
+
suite: "lint",
|
|
149
|
+
local: null,
|
|
150
|
+
linterGroup: ["markdownlint"]
|
|
151
|
+
},
|
|
152
|
+
"lint:data": {
|
|
153
|
+
group: "Source Quality",
|
|
154
|
+
scope: "repo",
|
|
155
|
+
suite: "lint",
|
|
156
|
+
local: null,
|
|
157
|
+
linterGroup: ["yamllint"]
|
|
158
|
+
},
|
|
159
|
+
"lint:unused": {
|
|
160
|
+
group: "Source Quality",
|
|
161
|
+
scope: "repo",
|
|
162
|
+
suite: "lint",
|
|
163
|
+
local: { tool: "knip" }
|
|
164
|
+
},
|
|
165
|
+
"lint:commits": {
|
|
166
|
+
group: "Source Quality",
|
|
167
|
+
scope: "repo",
|
|
168
|
+
suite: "lint",
|
|
169
|
+
local: null,
|
|
170
|
+
linterGroup: ["commitlint"]
|
|
171
|
+
},
|
|
172
|
+
format: {
|
|
173
|
+
group: "Source Quality",
|
|
174
|
+
scope: "repo",
|
|
175
|
+
workflow: false,
|
|
176
|
+
host: "lint:code",
|
|
177
|
+
local: {
|
|
178
|
+
tool: "prettier",
|
|
179
|
+
args: ["--write", "."]
|
|
180
|
+
},
|
|
181
|
+
checkArgs: ["--check", "."]
|
|
182
|
+
},
|
|
183
|
+
"scan:secrets": {
|
|
184
|
+
group: "Security",
|
|
185
|
+
scope: "repo",
|
|
186
|
+
suite: "scan",
|
|
187
|
+
local: null,
|
|
188
|
+
linterGroup: ["gitleaks"]
|
|
189
|
+
},
|
|
190
|
+
"scan:code": {
|
|
191
|
+
group: "Security",
|
|
192
|
+
scope: "repo",
|
|
193
|
+
suite: "scan",
|
|
194
|
+
local: null
|
|
195
|
+
},
|
|
196
|
+
"check-tokens": {
|
|
197
|
+
group: "Security",
|
|
198
|
+
scope: "repo",
|
|
199
|
+
local: { command: "doctor secrets --verify" }
|
|
200
|
+
},
|
|
201
|
+
"doctor-tokens": {
|
|
202
|
+
group: "Security",
|
|
203
|
+
scope: "repo",
|
|
204
|
+
local: { command: "doctor tokens" }
|
|
205
|
+
},
|
|
206
|
+
build: {
|
|
207
|
+
group: "Delivery",
|
|
208
|
+
scope: "package",
|
|
209
|
+
local: { detect: [
|
|
210
|
+
{
|
|
211
|
+
when: /^tsdown\.config\.(ts|js|mjs|cjs)$/,
|
|
212
|
+
tool: "tsdown"
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
when: /^vite\.config\.(ts|js|mjs|cjs)$/,
|
|
216
|
+
tool: "vite",
|
|
217
|
+
args: ["build"]
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
when: /^rollup\.config\.(ts|js|mjs|cjs)$/,
|
|
221
|
+
tool: "rollup",
|
|
222
|
+
args: ["-c"]
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
when: /^tsconfig\.json$/,
|
|
226
|
+
tool: "tsc",
|
|
227
|
+
args: ["-b"]
|
|
228
|
+
}
|
|
229
|
+
] },
|
|
230
|
+
turbo: {
|
|
231
|
+
inputs: [
|
|
232
|
+
"src/**",
|
|
233
|
+
"package.json",
|
|
234
|
+
"tsdown.config.ts",
|
|
235
|
+
"$TURBO_ROOT$/tsdown.config.ts",
|
|
236
|
+
"vite.config.ts",
|
|
237
|
+
"rollup.config.ts",
|
|
238
|
+
"tsconfig.json"
|
|
239
|
+
],
|
|
240
|
+
outputs: ["dist/**"],
|
|
241
|
+
dependsOn: ["^build"]
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
release: {
|
|
245
|
+
group: "Delivery",
|
|
246
|
+
scope: "repo",
|
|
247
|
+
local: null,
|
|
248
|
+
preview: true
|
|
249
|
+
},
|
|
250
|
+
deploy: {
|
|
251
|
+
group: "Delivery",
|
|
252
|
+
scope: "package",
|
|
253
|
+
local: null,
|
|
254
|
+
preview: true
|
|
255
|
+
},
|
|
256
|
+
"measure:bundle": {
|
|
257
|
+
group: "Delivery",
|
|
258
|
+
scope: "repo",
|
|
259
|
+
suite: "measure",
|
|
260
|
+
local: null
|
|
261
|
+
},
|
|
262
|
+
"check-preview": {
|
|
263
|
+
group: "Delivery",
|
|
264
|
+
scope: "repo",
|
|
265
|
+
local: null
|
|
266
|
+
},
|
|
267
|
+
"deploy-preview": {
|
|
268
|
+
group: "Delivery",
|
|
269
|
+
scope: "package",
|
|
270
|
+
local: null
|
|
271
|
+
},
|
|
272
|
+
"deploy-sentinel": {
|
|
273
|
+
group: "Delivery",
|
|
274
|
+
scope: "repo",
|
|
275
|
+
local: null
|
|
276
|
+
},
|
|
277
|
+
"validate:specs": {
|
|
278
|
+
group: "Platform",
|
|
279
|
+
scope: "repo",
|
|
280
|
+
suite: "validate",
|
|
281
|
+
local: { command: "probe specs check" }
|
|
282
|
+
},
|
|
283
|
+
"validate:docs": {
|
|
284
|
+
group: "Platform",
|
|
285
|
+
scope: "repo",
|
|
286
|
+
suite: "validate",
|
|
287
|
+
local: { command: "probe docs validate" }
|
|
288
|
+
},
|
|
289
|
+
"validate:deps": {
|
|
290
|
+
group: "Platform",
|
|
291
|
+
scope: "repo",
|
|
292
|
+
suite: "validate",
|
|
293
|
+
local: { command: "probe deps check" }
|
|
294
|
+
},
|
|
295
|
+
"validate:generated": {
|
|
296
|
+
group: "Platform",
|
|
297
|
+
scope: "repo",
|
|
298
|
+
suite: "validate",
|
|
299
|
+
local: { command: "probe generated check" }
|
|
300
|
+
},
|
|
301
|
+
"validate:plugin": {
|
|
302
|
+
group: "Platform",
|
|
303
|
+
scope: "package",
|
|
304
|
+
suite: "validate",
|
|
305
|
+
workflow: false,
|
|
306
|
+
local: null
|
|
307
|
+
},
|
|
308
|
+
"measure:docs": {
|
|
309
|
+
group: "Platform",
|
|
310
|
+
scope: "repo",
|
|
311
|
+
suite: "measure",
|
|
312
|
+
local: { command: "probe docs coverage" }
|
|
313
|
+
},
|
|
314
|
+
"remind-doctor": {
|
|
315
|
+
group: "Platform",
|
|
316
|
+
scope: "repo",
|
|
317
|
+
local: null
|
|
318
|
+
},
|
|
319
|
+
"sync-repo": {
|
|
320
|
+
group: "Platform",
|
|
321
|
+
scope: "repo",
|
|
322
|
+
local: { command: "sync" }
|
|
323
|
+
},
|
|
324
|
+
"check-notify": {
|
|
325
|
+
group: "Platform",
|
|
326
|
+
scope: "repo",
|
|
327
|
+
local: null
|
|
328
|
+
},
|
|
329
|
+
"sync-secrets": {
|
|
330
|
+
group: "Platform",
|
|
331
|
+
scope: "repo",
|
|
332
|
+
local: null
|
|
333
|
+
},
|
|
334
|
+
"sync-templates": {
|
|
335
|
+
group: "Platform",
|
|
336
|
+
scope: "repo",
|
|
337
|
+
local: { command: "sync github" }
|
|
338
|
+
},
|
|
339
|
+
"reconcile-projects": {
|
|
340
|
+
group: "Platform",
|
|
341
|
+
scope: "repo",
|
|
342
|
+
local: { command: "reconcile project" }
|
|
343
|
+
},
|
|
344
|
+
"sync-issues": {
|
|
345
|
+
group: "Platform",
|
|
346
|
+
scope: "repo",
|
|
347
|
+
local: null
|
|
348
|
+
},
|
|
349
|
+
"sync-specs": {
|
|
350
|
+
group: "Knowledge",
|
|
351
|
+
scope: "repo",
|
|
352
|
+
local: { command: "sync specs" }
|
|
353
|
+
},
|
|
354
|
+
"preview-specs": {
|
|
355
|
+
group: "Knowledge",
|
|
356
|
+
scope: "repo",
|
|
357
|
+
local: null
|
|
358
|
+
},
|
|
359
|
+
"publish-wiki": {
|
|
360
|
+
group: "Knowledge",
|
|
361
|
+
scope: "repo",
|
|
362
|
+
local: { command: "sync-wiki" },
|
|
363
|
+
preview: true
|
|
364
|
+
},
|
|
365
|
+
"deploy-docs": {
|
|
366
|
+
group: "Knowledge",
|
|
367
|
+
scope: "repo",
|
|
368
|
+
local: null,
|
|
369
|
+
preview: true
|
|
370
|
+
},
|
|
371
|
+
"deploy-components": {
|
|
372
|
+
group: "Knowledge",
|
|
373
|
+
scope: "repo",
|
|
374
|
+
local: null,
|
|
375
|
+
preview: true
|
|
376
|
+
}
|
|
377
|
+
};
|
|
378
|
+
/**
|
|
379
|
+
* The order `holocron run ci` runs tasks in — cheapest / fastest signal first, so
|
|
380
|
+
* an agent or a `pre-push` hook fails early. Tasks not listed here run last, in
|
|
381
|
+
* manifest order. (The generated thin callers carry no `needs:` — cross-workflow
|
|
382
|
+
* ordering lives in `theholocron/.github` — so `holocron run ci` declares its own.)
|
|
383
|
+
*/
|
|
384
|
+
const CI_ORDER = [
|
|
385
|
+
"typecheck",
|
|
386
|
+
"lint:code",
|
|
387
|
+
"lint:editorconfig",
|
|
388
|
+
"lint:markdown",
|
|
389
|
+
"format",
|
|
390
|
+
"lint:data",
|
|
391
|
+
"scan:secrets",
|
|
392
|
+
"lint:commits",
|
|
393
|
+
"validate:specs",
|
|
394
|
+
"validate:docs",
|
|
395
|
+
"validate:deps",
|
|
396
|
+
"validate:generated",
|
|
397
|
+
"test:unit",
|
|
398
|
+
"build",
|
|
399
|
+
"lint:unused",
|
|
400
|
+
"measure:bundle",
|
|
401
|
+
"test:perf",
|
|
402
|
+
"scan:code",
|
|
403
|
+
"deploy"
|
|
404
|
+
];
|
|
405
|
+
// src/vocabulary/legacy-names/legacy-names.ts
|
|
406
|
+
/**
|
|
407
|
+
* The old dotted task names (and the workflow-only keys) and the flat ids they became — the complete map of spec
|
|
408
|
+
* `ci-flat-task-vocabulary`, "Old to new". `holocron run <old>` and `tasks:` in `holocron.config` still accept them
|
|
409
|
+
* for a window (the frozen reusables in `theholocron/.github` run `holocron run <old>` until #1216 deletes them), and
|
|
410
|
+
* a name that stood for one workflow carrying several checks maps to all of its successors, in run order.
|
|
411
|
+
*
|
|
412
|
+
* Each key is also the name of the generated workflow file, the turbo task and the `package.json` script until the
|
|
413
|
+
* later phases move those, so {@link legacyName} reads this table backwards. Removed together with the aliases in the
|
|
414
|
+
* last phase.
|
|
415
|
+
*/
|
|
416
|
+
const LEGACY_NAMES = {
|
|
417
|
+
"verification.unitTests": [{ id: "test:unit" }],
|
|
418
|
+
"verification.visualRegression": [{ id: "test:visual" }],
|
|
419
|
+
"verification.performance": [{ id: "test:perf" }],
|
|
420
|
+
"verification.typeSafety": [{ id: "typecheck" }],
|
|
421
|
+
"sourceQuality.staticAnalysis": [{ id: "lint:code" }],
|
|
422
|
+
"sourceQuality.formatting": [
|
|
423
|
+
{ id: "lint:editorconfig" },
|
|
424
|
+
{ id: "lint:markdown" },
|
|
425
|
+
{
|
|
426
|
+
id: "format",
|
|
427
|
+
passthrough: ["--check"]
|
|
428
|
+
}
|
|
429
|
+
],
|
|
430
|
+
"sourceQuality.structuredDataValidation": [{ id: "lint:data" }],
|
|
431
|
+
"sourceQuality.deadCodeAnalysis": [{ id: "lint:unused" }],
|
|
432
|
+
"platform.commitStandards": [{ id: "lint:commits" }],
|
|
433
|
+
"security.secretDetection": [{ id: "scan:secrets" }],
|
|
434
|
+
"security.codeScanning": [{ id: "scan:code" }],
|
|
435
|
+
"security.tokenExpiry": [{ id: "check-tokens" }],
|
|
436
|
+
"delivery.build": [{ id: "build" }],
|
|
437
|
+
"measure-docs": [{ id: "measure:docs" }],
|
|
438
|
+
"measure-bundle": [{ id: "measure:bundle" }],
|
|
439
|
+
"delivery.bundleSize": [{ id: "measure:bundle" }],
|
|
440
|
+
"delivery.publish": [{ id: "release" }],
|
|
441
|
+
"delivery.deploy": [{ id: "deploy" }],
|
|
442
|
+
"delivery.previewDeploy": [{ id: "deploy-preview" }],
|
|
443
|
+
"delivery.previewCheck": [{ id: "check-preview" }],
|
|
444
|
+
validate: [{ id: "validate:specs" }, { id: "validate:docs" }],
|
|
445
|
+
"platform.repoValidation": [{ id: "validate:specs" }, { id: "validate:docs" }],
|
|
446
|
+
"platform.repoSync": [{ id: "sync-repo" }],
|
|
447
|
+
"platform.syncTemplates": [{ id: "sync-templates" }],
|
|
448
|
+
"platform.notifyCheck": [{ id: "check-notify" }],
|
|
449
|
+
"knowledge.wiki": [{ id: "publish-wiki" }],
|
|
450
|
+
"knowledge.docs": [{ id: "deploy-docs" }],
|
|
451
|
+
"knowledge.components": [{ id: "deploy-components" }],
|
|
452
|
+
bookkeeping: [{ id: "label" }],
|
|
453
|
+
greetings: [{ id: "greet" }],
|
|
454
|
+
stale: [{ id: "mark-stale" }],
|
|
455
|
+
dependencies: [{ id: "update-deps" }],
|
|
456
|
+
review: [{ id: "annotate" }]
|
|
457
|
+
};
|
|
458
|
+
// src/vocabulary/legacy-name/legacy-name.ts
|
|
459
|
+
/** Each flat id and the old name that listed it (no id is listed under two). */
|
|
460
|
+
const BY_ID = new Map(Object.entries(LEGACY_NAMES).flatMap(([legacy, targets]) => targets.map(({ id }) => [id, legacy])));
|
|
461
|
+
/**
|
|
462
|
+
* The old name a flat id replaced — `test:unit` is `verification.unitTests`. It is what the generated workflow files,
|
|
463
|
+
* `turbo.json` tasks and `package.json` scripts are still called until the later phases rename them, so generators
|
|
464
|
+
* translate through it and the files do not change. `undefined` for an id that never had an old name (`preview`).
|
|
465
|
+
* `format` and the other formatting successors share the formatting workflow's name.
|
|
466
|
+
*/
|
|
467
|
+
function legacyName(id) {
|
|
468
|
+
return BY_ID.get(id);
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* The old name a flat id replaced, only when that name stood for this id alone. `format` and `lint:markdown` are halves
|
|
472
|
+
* of `sourceQuality.formatting`, so a turbo task or script of that name is not theirs to run.
|
|
473
|
+
*/
|
|
474
|
+
function ownLegacyName(id) {
|
|
475
|
+
const legacy = BY_ID.get(id);
|
|
476
|
+
return legacy !== void 0 && LEGACY_NAMES[legacy].length === 1 ? legacy : void 0;
|
|
477
|
+
}
|
|
478
|
+
// src/vocabulary/resolve-task-name/resolve-task-name.ts
|
|
479
|
+
/** A flat id: a registry task, or a workflow-only key (`label`) that only the old-name table lists. */
|
|
480
|
+
function isFlatId(name) {
|
|
481
|
+
return TASKS[name] !== void 0 || legacyName(name) !== void 0;
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* 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
|
|
485
|
+
* its hyphen compound in the script spelling, `deploy:preview`) stands for itself, an old dotted name for its
|
|
486
|
+
* successors (`sourceQuality.formatting` for three), anything else for none. A suite name is not a task and resolves to
|
|
487
|
+
* none.
|
|
488
|
+
*/
|
|
489
|
+
function resolveTaskName(name) {
|
|
490
|
+
if (isFlatId(name)) return [{ id: name }];
|
|
491
|
+
const legacy = LEGACY_NAMES[name];
|
|
492
|
+
if (legacy) return legacy;
|
|
493
|
+
const hyphenated = name.replace(":", "-");
|
|
494
|
+
return isFlatId(hyphenated) ? [{ id: hyphenated }] : [];
|
|
495
|
+
}
|
|
496
|
+
// src/vocabulary/is-task/is-task.ts
|
|
497
|
+
/** `true` when a manifest name (a flat id or an old dotted name) stands for the given flat id. */
|
|
498
|
+
function isTask(name, id) {
|
|
499
|
+
return resolveTaskName(name).some((target) => target.id === id);
|
|
500
|
+
}
|
|
501
|
+
// src/config/coerce-tasks/coerce-tasks.ts
|
|
502
|
+
/** A bare item array is shorthand for `{ tasks: [...] }`. */
|
|
503
|
+
function coerceTasks(value) {
|
|
504
|
+
if (value == null) return void 0;
|
|
505
|
+
return Array.isArray(value) ? { tasks: value } : value;
|
|
506
|
+
}
|
|
507
|
+
// src/config/load/load.ts
|
|
508
|
+
/**
|
|
509
|
+
* Resolve the task manifest for a repo: the `tasks` key of
|
|
510
|
+
* `holocron.config.*`, then a dedicated `astromech.config.*` merged on
|
|
511
|
+
* top (dedicated wins; item arrays concatenate). Returns `{}` when
|
|
512
|
+
* neither source is present.
|
|
513
|
+
*
|
|
514
|
+
* `walkUp: true` — `holocron run`/`ci` are usable from any subdirectory of
|
|
515
|
+
* a repo, not only its exact root (datapad walks up to the nearest `.git`
|
|
516
|
+
* boundary; see `@theholocron/datapad`'s own doc comment).
|
|
517
|
+
*
|
|
518
|
+
* A caller that has already loaded `holocron.config.*` passes it as
|
|
519
|
+
* `options.holocron` so it is not found and loaded again.
|
|
520
|
+
*/
|
|
521
|
+
async function loadTasksConfig(cwd, options = {}) {
|
|
522
|
+
return (await loadLayered({
|
|
523
|
+
cwd,
|
|
524
|
+
name: "astromech",
|
|
525
|
+
walkUp: true,
|
|
526
|
+
fallback: {
|
|
527
|
+
file: "holocron",
|
|
528
|
+
key: "tasks",
|
|
529
|
+
preloaded: options.holocron
|
|
530
|
+
},
|
|
531
|
+
coerce: (raw) => coerceTasks(raw)
|
|
532
|
+
}))?.config ?? {};
|
|
533
|
+
}
|
|
534
|
+
export { legacyName as a, CI_ORDER as c, resolveTaskName as i, TASKS as l, coerceTasks as n, ownLegacyName as o, isTask as r, LEGACY_NAMES as s, loadTasksConfig as t, normalizeTaskEntry as u };
|