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