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