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