@theholocron/astromech 5.0.0-alpha.35 → 5.0.0-alpha.350
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +184 -70
- package/dist/config/index.d.mts +52 -8
- package/dist/config/index.mjs +26 -23
- package/dist/editorconfig-checker-HPpphHhI.mjs +39 -0
- package/dist/index.d.mts +1045 -525
- package/dist/index.mjs +3678 -1408
- package/dist/lint/index.d.mts +106 -0
- package/dist/lint/index.mjs +156 -0
- package/dist/load-JBbqioIt.mjs +477 -0
- package/dist/repo-validation/index.d.mts +300 -0
- package/dist/repo-validation/index.mjs +541 -0
- package/dist/{schema-D01VYg43.d.mts → schema.type-BfeI4AnM.d.mts} +27 -17
- package/dist/upgrade/index.d.mts +126 -0
- package/dist/upgrade/index.mjs +283 -0
- package/package.json +47 -21
- package/dist/schema-Cf5dfaDO.mjs +0 -11
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# `@theholocron/astromech`
|
|
2
2
|
|
|
3
3
|
The Holocron task runner. One **task manifest** per repo, and every
|
|
4
|
-
derived surface comes from it: `holocron run` (local), `holocron ci` (the
|
|
4
|
+
derived surface comes from it: `holocron run` (local), `holocron run ci` (the
|
|
5
5
|
CI suite run locally), the generated GitHub Actions workflows, the
|
|
6
6
|
`package.json` scripts, and the branch-protection required-checks list.
|
|
7
7
|
|
|
@@ -24,69 +24,80 @@ import { createAstromech } from "@theholocron/astromech";
|
|
|
24
24
|
|
|
25
25
|
const astromech = createAstromech({ cwd });
|
|
26
26
|
|
|
27
|
-
const report = astromech.run("
|
|
27
|
+
const report = astromech.run("test:unit", { passthrough: ["--watch"] });
|
|
28
28
|
// → { status: "ok" | "fail" | "skip" | "dry-run" | "unknown", command?, message? }
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
### `holocron run <task>` resolution
|
|
32
32
|
|
|
33
|
-
`holocron run
|
|
34
|
-
turbo vs pnpm vs npm, or which runner
|
|
33
|
+
`holocron run test:unit` runs your unit tests, `holocron run test` the whole `test` suite — you don't tell it
|
|
34
|
+
turbo vs pnpm vs npm, or which runner. The words are joined with `:` and the longest match against the registry wins
|
|
35
|
+
(`test unit` is `test:unit`, `deploy preview` is `deploy-preview`); what is left is the `[job]` argument. A suite
|
|
36
|
+
(`test`, `lint`, `scan`) is declared by the `suite` field of its leaves in the registry and runs the leaves the repo's
|
|
37
|
+
`tasks:` lists, in registry order; `format` is its own verb (prettier only; writes, `--check` reads). The old dotted
|
|
38
|
+
names (`LEGACY_NAMES`) are accepted in `tasks:` and by `run`, with a deprecation notice on stderr:
|
|
35
39
|
|
|
36
|
-
```
|
|
40
|
+
```text
|
|
37
41
|
1. turbo.json defines the task → turbo run <task>
|
|
38
42
|
2. package.json has a <task> script → <detected pm> run <task>
|
|
39
|
-
(a "holocron run …" thin caller is skipped — no recursion
|
|
40
|
-
|
|
43
|
+
(a "holocron run …" thin caller is skipped — no recursion; so is the root script generated from the
|
|
44
|
+
registry's own command, which step 3 runs itself)
|
|
45
|
+
3. the registry has a local runner → <tool> <args> (`test:unit` is `vitest run --coverage`)
|
|
41
46
|
3b. the task is a linterGroup → each resolved linter, run natively
|
|
42
|
-
4.
|
|
43
|
-
5.
|
|
44
|
-
6. unknown task → error, exit 1
|
|
47
|
+
4. known task, nothing to run → "no <task> task", exit 0 (exit 1 with --required)
|
|
48
|
+
5. unknown task → error, exit 1
|
|
45
49
|
```
|
|
46
50
|
|
|
47
51
|
## Intent → technology
|
|
48
52
|
|
|
49
53
|
Tasks are named by **intent**, not by tool — a repo declares
|
|
50
|
-
`
|
|
51
|
-
|
|
54
|
+
`test:unit`, not `vitest`. (The dotted names such as `verification.unitTests` are the old spelling; they still <!-- holocron-allow-old-name -->
|
|
55
|
+
work as aliases, see `LEGACY_NAMES`, but nothing generated uses them for a repo on flat ids.)
|
|
56
|
+
The table below is the full
|
|
57
|
+
registry (`TASKS` in `src/registry/registry.ts`): every task name astromech knows,
|
|
52
58
|
what it actually runs, and why. Tool names never appear in
|
|
53
59
|
`holocron.config.ts` — they're an implementation detail this table
|
|
54
60
|
documents, not a naming convention repos need to follow.
|
|
55
61
|
|
|
56
|
-
| Task
|
|
57
|
-
|
|
|
58
|
-
| `
|
|
59
|
-
| `
|
|
60
|
-
| `
|
|
61
|
-
| `
|
|
62
|
-
| `
|
|
63
|
-
| `
|
|
64
|
-
| `
|
|
65
|
-
| `
|
|
66
|
-
| `
|
|
67
|
-
| `
|
|
68
|
-
| `
|
|
69
|
-
| `
|
|
70
|
-
| `
|
|
71
|
-
| `
|
|
72
|
-
| `
|
|
73
|
-
| `
|
|
74
|
-
| `
|
|
75
|
-
| `
|
|
76
|
-
| `
|
|
77
|
-
| `
|
|
62
|
+
| Task | Runs | Notes |
|
|
63
|
+
| ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
|
|
64
|
+
| `test:unit` | vitest | always runs with coverage: `vitest run --coverage`, there is no flag |
|
|
65
|
+
| `typecheck` | tsc | `tsc --noEmit` |
|
|
66
|
+
| `test:perf` | Lighthouse CI | only runs with a `lighthouse.config.*` present |
|
|
67
|
+
| `lint:code` | eslint, actionlint, git-merge-conflict-markers | a `linterGroup` — see below |
|
|
68
|
+
| `lint:editorconfig`, `lint:markdown` | editorconfig-checker, markdownlint-cli2 | each is a `linterGroup` of one tool |
|
|
69
|
+
| `format` | prettier | writes by default, `--check` is read-only; no workflow of its own |
|
|
70
|
+
| `lint:data` | yamllint | |
|
|
71
|
+
| `lint:unused` | knip | |
|
|
72
|
+
| `scan:secrets` | gitleaks | |
|
|
73
|
+
| `scan:code` | CodeQL | no local equivalent — CI only |
|
|
74
|
+
| `check-tokens` | `holocron doctor tokens` | scheduled daily in CI; fails on a rejected token or one with 7 days or fewer left; never part of `run ci` |
|
|
75
|
+
| `build` | tsdown / vite / rollup / tsc, detected from the repo's own config file, or `package.json`'s own `dependencies`/`devDependencies` if that config file isn't there | |
|
|
76
|
+
| `release` | semantic-release | no local equivalent — CI only; carries `preview` (npm dist-tags) |
|
|
77
|
+
| `deploy` | Cloudflare Pages / Vercel | no local equivalent — CI only; carries `preview` |
|
|
78
|
+
| `measure-bundle` | bundle-size upload to Codecov | no local equivalent — CI only |
|
|
79
|
+
| `check-preview` | `holocron monitoring check <url>` against the PR's own Vercel preview URL | no local equivalent — CI only; triggered by `deployment_status`, not `push`/`pull_request` |
|
|
80
|
+
| `check-notify` | _(none — manual workflow)_ | posts a labelled test message to every notification channel; fails per channel that does not work |
|
|
81
|
+
| `sync-repo` | `holocron repo sync` | keeps generated files current |
|
|
82
|
+
| `lint:commits` | commitlint | no local equivalent — enforced by the `commit-msg` hook locally, over the PR's commit range in CI |
|
|
83
|
+
| `validate:specs` | `holocron probe specs check` | spec/ADR frontmatter — a leaf of the `validate` suite, not a linter |
|
|
84
|
+
| `validate:docs` | `holocron probe docs presence` | docs presence, warns only — a leaf of the `validate` suite, not a linter |
|
|
85
|
+
| `publish-wiki` | Fern | publishes `docs/wiki/*.md` — not a sync, a publish; carries `preview` |
|
|
86
|
+
| `deploy-docs` | Astro build | the docs site itself; carries `preview` (defaults on) |
|
|
87
|
+
| `deploy-components` | Storybook build | a browsable component catalog — "Storybook" is the tool, not the intent; carries `preview` (defaults on) |
|
|
78
88
|
|
|
79
89
|
**`preview` is a cross-cutting feature, not a namespace.** npm has staging
|
|
80
90
|
dist-tags, Cloudflare/Vercel do per-PR preview deploys, Fern previews
|
|
81
91
|
docs — none of these earn their own task or verb; it's one capability any
|
|
82
92
|
publish/deploy-shaped task can carry, toggled via that task's `with:`.
|
|
83
93
|
|
|
84
|
-
**`linterGroup` tasks** (`
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
94
|
+
**`linterGroup` tasks** (`lint:code`) bundle more than one tool under a single
|
|
95
|
+
required check. Each tool is still gated by its own detection rule — e.g.
|
|
96
|
+
`eslint` runs when either a local `eslint.config.*` is present, or the
|
|
97
|
+
package has no local file but `@theholocron/eslint-config` resolves
|
|
98
|
+
(the same shared-config splice the `tool`/`detect` runner path uses) — the
|
|
88
99
|
`tool name → detection rule → local binary` mapping lives in one place,
|
|
89
|
-
`src/linters.ts`. A repo's choice of which of these run is
|
|
100
|
+
`src/tasks/run/linters/linters.ts`. A repo's choice of which of these run is based on which
|
|
90
101
|
tasks it includes in `tasks: [...]`, same as any other task.
|
|
91
102
|
|
|
92
103
|
**No super-linter.** Each task above runs its own tool directly, through
|
|
@@ -106,9 +117,9 @@ import { defineConfig } from "@theholocron/astromech/config";
|
|
|
106
117
|
|
|
107
118
|
export default defineConfig({
|
|
108
119
|
tasks: [
|
|
109
|
-
"
|
|
110
|
-
{ name: "
|
|
111
|
-
{ name: "
|
|
120
|
+
"typecheck",
|
|
121
|
+
{ name: "test:unit", required: true, with: { "run-coverage": true } },
|
|
122
|
+
{ name: "scan:code", ci: true, local: false }, // CI-only
|
|
112
123
|
],
|
|
113
124
|
});
|
|
114
125
|
```
|
|
@@ -116,10 +127,13 @@ export default defineConfig({
|
|
|
116
127
|
`loadTasksConfig(cwd)` resolves the manifest: the `tasks` key of
|
|
117
128
|
`holocron.config.*` (a bare item array), then a dedicated
|
|
118
129
|
`astromech.config.*` merged on top (dedicated wins; arrays concatenate).
|
|
130
|
+
`mergeTasksLayers(parentTasks, dedicated)` is that merge step on its own,
|
|
131
|
+
for callers that load the two sources some other way (Sentinel reads them
|
|
132
|
+
through the GitHub API).
|
|
119
133
|
|
|
120
134
|
| `TaskEntry` field | Effect |
|
|
121
135
|
| ------------------------ | ----------------------------------------------------------- |
|
|
122
|
-
| `ci` (default `true`) | emit the CI workflow; include in `holocron ci`
|
|
136
|
+
| `ci` (default `true`) | emit the CI workflow; include in `holocron run ci` |
|
|
123
137
|
| `local` (default `true`) | write the `package.json` script; `holocron run` resolves it |
|
|
124
138
|
| `local: false` | `holocron run <name>` → "CI-only task", exit 0 |
|
|
125
139
|
| `required` | the task's check context is a required status check |
|
|
@@ -127,7 +141,7 @@ export default defineConfig({
|
|
|
127
141
|
|
|
128
142
|
Top-level keys: `syncScripts: false` disables the `package.json` script
|
|
129
143
|
writes entirely; `holocronScript` sets the command the synced `"holocron"`
|
|
130
|
-
script runs (default `"holocron"`).
|
|
144
|
+
script runs (default `"holocron"`) and the one the generated git hooks call.
|
|
131
145
|
|
|
132
146
|
### Generated surfaces
|
|
133
147
|
|
|
@@ -135,8 +149,9 @@ script runs (default `"holocron"`).
|
|
|
135
149
|
const astromech = createAstromech({ cwd, config, orgContext: { org, domain } });
|
|
136
150
|
|
|
137
151
|
astromech.thinCallers(); // Map<"<name>.yml", yaml> — one per templated, ci-enabled task
|
|
138
|
-
astromech.packageScripts(); // { holocron: "holocron", "
|
|
139
|
-
astromech.requiredChecks(); // ["
|
|
152
|
+
astromech.packageScripts(); // single package: { holocron: "holocron", "test:unit": "holocron run test unit --", … }; workspace: { "test:unit": "turbo run test:unit", … }
|
|
153
|
+
astromech.requiredChecks(true); // ["ci / Required checks", "DCO"] — branch-protection contexts (false: "DCO", then the per-task contexts, then extras)
|
|
154
|
+
astromech.aggregateCaller(); // the thin caller of the `ci` aggregate check, or null when nothing is required
|
|
140
155
|
astromech.codecovConfig(existing); // codecov.yml content — merges into `existing`, or scaffolds fresh when null
|
|
141
156
|
astromech.ci({ scope: "required" }); // CiReport — run the gating checks locally, in CI order
|
|
142
157
|
```
|
|
@@ -145,33 +160,64 @@ astromech.ci({ scope: "required" }); // CiReport — run the gating checks local
|
|
|
145
160
|
the same resolution as `run()`, in `CI_ORDER`, and returns `{ status, jobs }`.
|
|
146
161
|
A `required` task whose local runner can't run is a failure — **except** a
|
|
147
162
|
task that's genuinely CI-only (`local: null`, or a `linterGroup` whose every
|
|
148
|
-
member lacks a local binary entirely, like `
|
|
149
|
-
which is reported skipped even when required. `holocron ci` sets the
|
|
163
|
+
member lacks a local binary entirely, like `lint:commits`),
|
|
164
|
+
which is reported skipped even when required. `holocron run ci` sets the
|
|
150
165
|
process exit code from `status`.
|
|
151
166
|
|
|
152
167
|
`thinCallers()` returns the raw `.github/workflows/*.yml` content (no
|
|
153
|
-
generated-by header — the caller prefixes its own). `
|
|
154
|
-
`
|
|
168
|
+
generated-by header — the caller prefixes its own). `deploy` /
|
|
169
|
+
`deploy-docs` / `deploy-components` with `preview:` produce the
|
|
155
170
|
combined push-to-Pages / PR-to-preview workflow —
|
|
156
|
-
`
|
|
171
|
+
`deploy-docs`/`deploy-components` default `preview` on, since
|
|
157
172
|
neither has a plain-production-only fallback template.
|
|
158
173
|
`packageScripts()` emits the `holocron` entry (`holocronScript ?? "holocron"`)
|
|
159
|
-
plus
|
|
174
|
+
plus the scripts `scriptsFor(config, registry, { monorepo })` computes; it skips
|
|
160
175
|
`local: false` entries and tasks with no local runner at all, and returns
|
|
161
|
-
`{}` when `syncScripts: false` or there is no config.
|
|
176
|
+
`{}` when `syncScripts: false` or there is no config. The same function backs `repo sync`, which merges the result with
|
|
177
|
+
`mergeScripts()`, and `probe generated check`, which fails on a root script that differs and on a script that breaks the
|
|
178
|
+
rules of `checkPackageScripts()`.
|
|
179
|
+
|
|
180
|
+
#### Scripts and `turbo.json`
|
|
181
|
+
|
|
182
|
+
`scriptsFor()` is the one rule for what a root script calls (spec `ci-flat-task-vocabulary`):
|
|
183
|
+
|
|
184
|
+
| Repo | Package-scoped leaf (`build`, `test:unit`) | Repo-scoped leaf (`lint:markdown`, `format`) | Suite (`test`, `lint`) |
|
|
185
|
+
| ---------------------------------------------- | ------------------------------------------ | --------------------------------------------- | ------------------------- |
|
|
186
|
+
| a pnpm workspace with a generated `turbo.json` | `turbo run <key>` | the tool's own command (`prettier --write .`) | `turbo run <suite>` |
|
|
187
|
+
| a single package | `holocron run <words> --` | `holocron run <words> --` | `holocron run <suite> --` |
|
|
188
|
+
|
|
189
|
+
A leaf with no local command (`scan:code`, `lint:commits`, `release`, a holocron subcommand) has no script in a
|
|
190
|
+
workspace. `holocron` may not be built on a fresh clone while turbo is an ordinary devDependency, which is why a
|
|
191
|
+
workspace calls turbo directly. In a workspace `turboConfig()` also writes each suite as a task with no script that
|
|
192
|
+
`dependsOn` its leaves, and a `//#<id>` root task (`cache: false`, since it reads every package's files) for each
|
|
193
|
+
repo-scoped leaf that belongs to a suite, which is how a suite reaches the root tool. A package's own leaf script holds the
|
|
194
|
+
real tool command and never calls turbo or `holocron run`, and no package carries a script named like a suite.
|
|
195
|
+
|
|
196
|
+
The key a package-scoped leaf has in `turbo.json`, and so the name of its script in every package, **follows how the
|
|
197
|
+
manifest spells the task**: `{ name: "test:unit" }` gives `test:unit`, `{ name: "test:unit" }` keeps
|
|
198
|
+
`test:unit`. A repo's packages hold scripts in the vocabulary its `tasks:` list speaks, so rewriting the list
|
|
199
|
+
to flat ids is what moves its keys, and the package scripts with them (`taskKey()`).
|
|
162
200
|
|
|
163
201
|
### Required checks
|
|
164
202
|
|
|
165
|
-
`requiredChecks()`
|
|
166
|
-
|
|
167
|
-
by `CI_ORDER`, then `config.extraRequiredChecks` (codecov gates, …),
|
|
168
|
-
|
|
169
|
-
names that job directly (`"
|
|
170
|
-
Conclusion` fan-in
|
|
203
|
+
`requiredChecks(aggregate)` is the branch-protection required-status-check list. With the `ci` aggregate (the repo
|
|
204
|
+
contains it, see below) it is `["ci / Required checks", "DCO"]`. Without it, it is `"DCO"`, then every `{ required: true }` task's check
|
|
205
|
+
context, ordered by `CI_ORDER`, then `config.extraRequiredChecks` (codecov gates, …), de-duplicated. Most tasks are
|
|
206
|
+
single always-run jobs now, so their context
|
|
207
|
+
names that job directly (`"typecheck / Run tsc --noEmit"`) — the `… /
|
|
208
|
+
Conclusion` fan-in job inside a workflow is only used where a task genuinely has
|
|
171
209
|
several conditionally-run jobs feeding one check
|
|
172
|
-
(`
|
|
173
|
-
|
|
174
|
-
|
|
210
|
+
(`test:unit`). `holocron repo setup`
|
|
211
|
+
applies the list for `protection: "strict"` repos. Policy-free — manifest only.
|
|
212
|
+
|
|
213
|
+
### The `ci` aggregate
|
|
214
|
+
|
|
215
|
+
`aggregateChecks(config)` derives what the reusable `ci.yml` (in `ci/workflows/`) waits on, from the same list: the
|
|
216
|
+
`expected` ids are the part before `/` of each required task's context and of each `extraRequiredChecks` entry that
|
|
217
|
+
is not a `codecov/` status (the hand-written `Generated files / Check` becomes `Generated files`), and `statuses` are
|
|
218
|
+
the `codecov/` entries. `aggregateCaller()` renders the `pull_request` caller, whose job `ci` calls the reusable's `Required checks` job.
|
|
219
|
+
`holocron repo sync` writes it only in the repo that contains the reusables. The ids are today's check names; the later
|
|
220
|
+
rename changes them here and costs no ruleset edit.
|
|
175
221
|
|
|
176
222
|
### `codecov.yml`
|
|
177
223
|
|
|
@@ -183,18 +229,39 @@ came from), same manifest-derived category as `thinCallers()`. Pass the
|
|
|
183
229
|
current file's content (or `null`) and it either merges the
|
|
184
230
|
`individual_components` list in (preserving everything else in the file —
|
|
185
231
|
thresholds, flags, custom rules) or scaffolds a fresh file from the base
|
|
186
|
-
template. `holocron setup` writes the result via the `source` capability;
|
|
232
|
+
template. `holocron repo setup` writes the result via the `source` capability;
|
|
187
233
|
this method never touches the filesystem beyond reading `packages/*` and
|
|
188
234
|
`apps/*` under `cwd`.
|
|
189
235
|
|
|
236
|
+
## Release-time deploys — `deployOnRelease`
|
|
237
|
+
|
|
238
|
+
Deploys the workspace packages whose manifest declares it (holocron#930):
|
|
239
|
+
|
|
240
|
+
```ts
|
|
241
|
+
// packages/<app>/holocron.config.ts
|
|
242
|
+
tasks: [{ name: "deploy", with: { on: "release", channel: "alpha" } }];
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
`holocron deploy on-release --channel=<alpha|main> --from=<previous release commit> --to=<release commit>`
|
|
246
|
+
(or `deployOnRelease()` from `@theholocron/astromech`) deploys each such package
|
|
247
|
+
when the release is on its `channel` (default `main`, the stable release;
|
|
248
|
+
set `alpha` for prereleases) and changes the package or one of its `workspace:*` dependencies
|
|
249
|
+
(`with.paths` overrides that), once npm serves the release's new dependency
|
|
250
|
+
versions, by running `pnpm --filter <package> deploy`. A package
|
|
251
|
+
that doesn't apply to the release is skipped; a deploy that fails exits
|
|
252
|
+
non-zero. The shared `release` workflow runs it as a separate `deploy`
|
|
253
|
+
job after the release job (opt in with `deploy-on-release: true`), so a deploy
|
|
254
|
+
is its own re-runnable check. A `deploy` task with `on: "release"`
|
|
255
|
+
generates no workflow.
|
|
256
|
+
|
|
190
257
|
## Development
|
|
191
258
|
|
|
192
|
-
| Script
|
|
193
|
-
|
|
|
194
|
-
| `pnpm run
|
|
195
|
-
| `pnpm run
|
|
196
|
-
| `pnpm run
|
|
197
|
-
| `pnpm run
|
|
259
|
+
| Script | Description |
|
|
260
|
+
| -------------------- | ------------------------------------------- |
|
|
261
|
+
| `pnpm run build` | Bundle with tsdown |
|
|
262
|
+
| `pnpm run test:unit` | Run the vitest suite (always with coverage) |
|
|
263
|
+
| `pnpm run typecheck` | `tsc --noEmit` |
|
|
264
|
+
| `pnpm run lint:code` | ESLint |
|
|
198
265
|
|
|
199
266
|
## Releases
|
|
200
267
|
|
|
@@ -202,4 +269,51 @@ Automated via semantic-release. See [CHANGELOG.md](../../CHANGELOG.md).
|
|
|
202
269
|
|
|
203
270
|
## Documentation
|
|
204
271
|
|
|
205
|
-
<https://theholocron.
|
|
272
|
+
<https://docs.theholocron.dev/holocron/>
|
|
273
|
+
|
|
274
|
+
## Lint — `@theholocron/astromech/lint`
|
|
275
|
+
|
|
276
|
+
The lint tools' own data and checks, in a subpath so the runner and the
|
|
277
|
+
config surface don't pull `@commitlint/*` in:
|
|
278
|
+
|
|
279
|
+
- `lintCommitMsgFile(file, cwd)` / `lintCommitMessage(message, config)` —
|
|
280
|
+
what `holocron run lint commit-msg <file>` (the `commit-msg` hook) runs.
|
|
281
|
+
- `ALEX_CONFIG`, `ALEX_IGNORE_PATTERNS`, `PRETTIER_IGNORE_PATTERNS`,
|
|
282
|
+
`EDITORCONFIG_CHECKER_EXCLUDE` and `isEditorConfigExcluded(path)` — read
|
|
283
|
+
from the same templates `holocron repo setup` writes, so Sentinel's central
|
|
284
|
+
checks skip exactly what each repo's own CI skips.
|
|
285
|
+
|
|
286
|
+
The root entry also exports the config-file generators `holocron repo setup`
|
|
287
|
+
writes (`createEditorconfig`, `createAlexrc`, `createPrePush`, …) and
|
|
288
|
+
`createHeader`.
|
|
289
|
+
|
|
290
|
+
## Repo validation — `@theholocron/astromech/repo-validation`
|
|
291
|
+
|
|
292
|
+
The rules of the `validate:specs` and `validate:docs` checks, once, as pure functions over plain data (changed files, commit
|
|
293
|
+
subjects, the PR description, a manifest) that return findings. They do no git, no filesystem and no network, so the two
|
|
294
|
+
interfaces that run them only supply the data: the CLI (`holocron probe docs presence` and `holocron probe specs check`, the two leaves of
|
|
295
|
+
the `validate` suite) from git and the filesystem, and [Sentinel](https://docs.theholocron.dev/holocron/sentinel/) from the
|
|
296
|
+
webhook and the GitHub API (#929).
|
|
297
|
+
|
|
298
|
+
- Docs presence: `isFeat(subjects)`, `packageOf(file, readPackage)`, `pageNames(dir)`, `hasDocsSignal(dir, changedFiles, addedCommentLines)`,
|
|
299
|
+
`isAddedDocComment(line)`, `parseSkipDocs(text)` (the `[skip docs] <reason>` marker) and
|
|
300
|
+
`evaluateDocsPresence({ packages, changedFiles, addedCommentLines, skip })`, which sorts a feature's packages into
|
|
301
|
+
those to warn about and those a marker excused.
|
|
302
|
+
- ADRs and specs: `checkSpecs(files)` takes `{ path, text }` pairs and returns `{ fileCount, findings }`, skipping a path that
|
|
303
|
+
is neither an ADR nor a spec; underneath it are `classifySpecPath(path)`, `parseFrontmatter(text)`,
|
|
304
|
+
`validateAdr(path, text)`, `validateSpec(path, text)` and `isValidIsoDate(value)`, and the folders and status sets
|
|
305
|
+
(`ADR_DIR`, `SPEC_DIRS`, `ADR_STATUSES`, `SPEC_STATUSES`). A `SpecFinding` is an `error` (fails the check) or a
|
|
306
|
+
`warning` (never does), with the file, the field's line and the rule.
|
|
307
|
+
|
|
308
|
+
## Upgrade — `@theholocron/astromech/upgrade`
|
|
309
|
+
|
|
310
|
+
The repo-agnostic machinery behind `holocron repo upgrade`, in a subpath so the CLI and any other tool can use it.
|
|
311
|
+
|
|
312
|
+
- `runUpgradeNode({ to, from?, cwd?, dryRun?, extra?, logger? })` walks the repo and rewrites every Node.js major pin:
|
|
313
|
+
`engines.node`, an exact `@types/node`, `.nvmrc`, `.node-version`, workflow `node-version:`, Dockerfile
|
|
314
|
+
`FROM node:` and `.tool-versions`. `from` is read from `.nvmrc` or `engines.node` when omitted. It never throws:
|
|
315
|
+
a failure is `{ status: "fail", message }`. Underneath are `patchPackageJson`, `patchYaml`, `patchPinFile`,
|
|
316
|
+
`patchDockerfile`, `patchToolVersions` and `detectNodeMajor`.
|
|
317
|
+
- `fetchLatestFromNpm(pkg)` resolves a package's `latest` dist-tag from the npm registry, or `null` on any failure.
|
|
318
|
+
|
|
319
|
+
What counts as a Holocron pin (`@theholocron/*`) and the `holocron.config.ts` migration stay in `@theholocron/cli`.
|
package/dist/config/index.d.mts
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { n as TaskEntry, r as TasksConfig, t as TaskConfigItem } from "../schema.type-BfeI4AnM.mjs";
|
|
2
|
+
import { Loaded } from "@theholocron/datapad";
|
|
3
|
+
/**
|
|
4
|
+
* The `tasks` config shape — the single manifest of what a repo runs.
|
|
5
|
+
* Read from a dedicated `astromech.config.*` file or the `tasks` key of
|
|
6
|
+
* `holocron.config.*` (see {@link loadTasksConfig}).
|
|
7
|
+
*
|
|
8
|
+
* Runtime validation is the loader's job, not this type's — the type only
|
|
9
|
+
* describes what an author writes.
|
|
10
|
+
*/
|
|
11
|
+
/** Normalise a `TaskConfigItem` to a full {@link TaskEntry} with defaults applied. */
|
|
12
|
+
export declare function normalizeTaskEntry(item: TaskConfigItem): Required<Pick<TaskEntry, "name" | "ci" | "local">> & TaskEntry;
|
|
3
13
|
/**
|
|
4
14
|
* Typed identity helper for `astromech.config.ts`:
|
|
5
15
|
*
|
|
@@ -11,15 +21,49 @@ import { i as normalizeTaskEntry, n as TaskEntry, r as TasksConfig, t as TaskCon
|
|
|
11
21
|
* });
|
|
12
22
|
* ```
|
|
13
23
|
*/
|
|
14
|
-
declare const defineConfig: <C extends TasksConfig>(config: C) => C;
|
|
15
|
-
|
|
16
|
-
|
|
24
|
+
export declare const defineConfig: <C extends TasksConfig>(config: C) => C;
|
|
25
|
+
/**
|
|
26
|
+
* The `tasks` value in each source. A dedicated `astromech.config.*`
|
|
27
|
+
* default-exports the full {@link TasksConfig} object; the `tasks` key of
|
|
28
|
+
* `holocron.config.*` is the bare item array (it mirrors the old
|
|
29
|
+
* `workflows` key). Either form is accepted from either source.
|
|
30
|
+
*/
|
|
31
|
+
type TasksInput = TasksConfig | TaskConfigItem[];
|
|
32
|
+
interface LoadTasksConfigOptions {
|
|
33
|
+
/**
|
|
34
|
+
* The `holocron.config.*` the caller has already loaded (`null`: it looked and
|
|
35
|
+
* there is none), so it isn't found and loaded a second time. Leave it unset
|
|
36
|
+
* to have `loadTasksConfig` find it itself.
|
|
37
|
+
*/
|
|
38
|
+
holocron?: Loaded<object> | null;
|
|
39
|
+
}
|
|
17
40
|
/**
|
|
18
41
|
* Resolve the task manifest for a repo: the `tasks` key of
|
|
19
42
|
* `holocron.config.*`, then a dedicated `astromech.config.*` merged on
|
|
20
43
|
* top (dedicated wins; item arrays concatenate). Returns `{}` when
|
|
21
44
|
* neither source is present.
|
|
45
|
+
*
|
|
46
|
+
* `walkUp: true` — `holocron run`/`ci` are usable from any subdirectory of
|
|
47
|
+
* a repo, not only its exact root (datapad walks up to the nearest `.git`
|
|
48
|
+
* boundary; see `@theholocron/datapad`'s own doc comment).
|
|
49
|
+
*
|
|
50
|
+
* A caller that has already loaded `holocron.config.*` passes it as
|
|
51
|
+
* `options.holocron` so it is not found and loaded again.
|
|
52
|
+
*/
|
|
53
|
+
export declare function loadTasksConfig(cwd: string, options?: LoadTasksConfigOptions): Promise<TasksConfig>;
|
|
54
|
+
/**
|
|
55
|
+
* The same layering as {@link loadTasksConfig}, for callers that load the two
|
|
56
|
+
* sources some other way (Sentinel reads them from the GitHub API, not
|
|
57
|
+
* from disk, holocron#916): `holocron.config.*`'s `tasks` value first,
|
|
58
|
+
* then a dedicated `astromech.config.*`'s default export merged on top.
|
|
59
|
+
* Either may be `undefined` (source absent); returns `{}` when both are.
|
|
60
|
+
*/
|
|
61
|
+
export declare function mergeTasksLayers(parentTasks: TasksInput | undefined, dedicated: TasksInput | undefined): TasksConfig;
|
|
62
|
+
/**
|
|
63
|
+
* The version groups a repo releases on their own: the folder names listed under `groups`
|
|
64
|
+
* in its `delivery.publish` task. This is what the generated publish workflow reads, so a
|
|
65
|
+
* release config that asks here stays in step with it instead of keeping a second list.
|
|
66
|
+
* `[]` for a repo that releases as one.
|
|
22
67
|
*/
|
|
23
|
-
declare function
|
|
24
|
-
|
|
25
|
-
export { type TaskConfigItem, type TaskEntry, type TasksConfig, defineConfig, loadTasksConfig, normalizeTaskEntry };
|
|
68
|
+
export declare function releaseGroups(config: Pick<TasksConfig, "tasks">): string[];
|
|
69
|
+
export type { TaskConfigItem, TaskEntry, TasksConfig };
|
package/dist/config/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as normalizeTaskEntry } from "../
|
|
2
|
-
import { createDefineConfig,
|
|
3
|
-
|
|
1
|
+
import { n as coerceTasks, r as isTask, t as loadTasksConfig, u as normalizeTaskEntry } from "../load-JBbqioIt.mjs";
|
|
2
|
+
import { createDefineConfig, mergeLayers } from "@theholocron/datapad";
|
|
3
|
+
// src/config/define/define.ts
|
|
4
4
|
/**
|
|
5
5
|
* Typed identity helper for `astromech.config.ts`:
|
|
6
6
|
*
|
|
@@ -13,27 +13,30 @@ import { createDefineConfig, loadConfigFile, mergeConfig } from "@theholocron/da
|
|
|
13
13
|
* ```
|
|
14
14
|
*/
|
|
15
15
|
const defineConfig = createDefineConfig();
|
|
16
|
-
|
|
17
|
-
//#region src/config/load.ts
|
|
16
|
+
// src/config/merge-tasks-layers/merge-tasks-layers.ts
|
|
18
17
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
18
|
+
* The same layering as {@link loadTasksConfig}, for callers that load the two
|
|
19
|
+
* sources some other way (Sentinel reads them from the GitHub API, not
|
|
20
|
+
* from disk, holocron#916): `holocron.config.*`'s `tasks` value first,
|
|
21
|
+
* then a dedicated `astromech.config.*`'s default export merged on top.
|
|
22
|
+
* Either may be `undefined` (source absent); returns `{}` when both are.
|
|
23
23
|
*/
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
cwd,
|
|
27
|
-
name: "astromech"
|
|
28
|
-
});
|
|
29
|
-
return [coerce((await loadConfigFile({
|
|
30
|
-
cwd,
|
|
31
|
-
name: "holocron"
|
|
32
|
-
}))?.config.tasks), coerce(dedicated?.config)].filter((layer) => layer !== void 0).reduce((acc, layer) => mergeConfig(acc, layer), {});
|
|
24
|
+
function mergeTasksLayers(parentTasks, dedicated) {
|
|
25
|
+
return mergeLayers([coerceTasks(parentTasks), coerceTasks(dedicated)]) ?? {};
|
|
33
26
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
27
|
+
// src/config/release-groups/release-groups.ts
|
|
28
|
+
/**
|
|
29
|
+
* The version groups a repo releases on their own: the folder names listed under `groups`
|
|
30
|
+
* in its `delivery.publish` task. This is what the generated publish workflow reads, so a
|
|
31
|
+
* release config that asks here stays in step with it instead of keeping a second list.
|
|
32
|
+
* `[]` for a repo that releases as one.
|
|
33
|
+
*/
|
|
34
|
+
function releaseGroups(config) {
|
|
35
|
+
const groups = (config.tasks ?? []).map(normalizeTaskEntry).find((entry) => isTask(entry.name, "release"))?.with?.["groups"];
|
|
36
|
+
if (!Array.isArray(groups)) return [];
|
|
37
|
+
return groups.flatMap((group) => {
|
|
38
|
+
const name = typeof group === "string" ? group : group?.name;
|
|
39
|
+
return typeof name === "string" ? [name] : [];
|
|
40
|
+
});
|
|
37
41
|
}
|
|
38
|
-
|
|
39
|
-
export { defineConfig, loadTasksConfig, normalizeTaskEntry };
|
|
42
|
+
export { defineConfig, loadTasksConfig, mergeTasksLayers, normalizeTaskEntry, releaseGroups };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// src/templates/configs/alexjs/alexrc.json
|
|
2
|
+
var alexrc_default = { allow: [
|
|
3
|
+
"dead",
|
|
4
|
+
"execute",
|
|
5
|
+
"execution",
|
|
6
|
+
"executes",
|
|
7
|
+
"failure",
|
|
8
|
+
"failures",
|
|
9
|
+
"hook",
|
|
10
|
+
"hooks",
|
|
11
|
+
"husky",
|
|
12
|
+
"period"
|
|
13
|
+
] };
|
|
14
|
+
// src/templates/configs/editorconfig-checker/editorconfig-checker.json
|
|
15
|
+
var editorconfig_checker_default = {
|
|
16
|
+
Verbose: false,
|
|
17
|
+
Format: "",
|
|
18
|
+
Debug: false,
|
|
19
|
+
IgnoreDefaults: false,
|
|
20
|
+
SpacesAfterTabs: false,
|
|
21
|
+
NoColor: false,
|
|
22
|
+
Exclude: [
|
|
23
|
+
"(^|.+/)LICENSE$",
|
|
24
|
+
"^public/.*",
|
|
25
|
+
"\\.md$",
|
|
26
|
+
"\\.mdx$"
|
|
27
|
+
],
|
|
28
|
+
AllowedContentTypes: [],
|
|
29
|
+
PassedFiles: [],
|
|
30
|
+
Disable: {
|
|
31
|
+
"EndOfLine": false,
|
|
32
|
+
"Indentation": false,
|
|
33
|
+
"InsertFinalNewline": false,
|
|
34
|
+
"TrimTrailingWhitespace": false,
|
|
35
|
+
"IndentSize": false,
|
|
36
|
+
"MaxLineLength": false
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
export { alexrc_default as n, editorconfig_checker_default as t };
|