@theholocron/astromech 5.0.0-alpha.24 → 5.0.0-alpha.241

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,99 @@
1
+ import { QualifiedConfig } from "@commitlint/types";
2
+ //#region src/lint/alex-config/alex-config.d.ts
3
+ /**
4
+ * The org's canonical `alex` (inclusive-language) config, as raw parsed
5
+ * data rather than the pre-rendered file strings `createRcConfig()`/
6
+ * `createIgnoreConfig()` produce for `holocron repo setup` to write into a
7
+ * repo's own `.alexrc.json`/`.alexignore`.
8
+ *
9
+ * `.alexrc.json` is explicitly "generated by `holocron repo setup` — do not
10
+ * edit manually" (this repo's own `AGENTS.md`) — the real source of truth
11
+ * is this JSON file, one canonical copy, not each repo's synced one. A
12
+ * central Sentinel check (holocron#769/#793) reads it directly rather
13
+ * than fetching each repo's own copy via the Contents API — the same "one
14
+ * config, not N copies" reasoning `@theholocron/commitlint-config` already
15
+ * established for commit-message linting.
16
+ */
17
+ declare const ALEX_CONFIG: {
18
+ allow: string[];
19
+ };
20
+ //#endregion
21
+ //#region src/lint/alex-ignore-patterns/alex-ignore-patterns.d.ts
22
+ /**
23
+ * Glob-ish path patterns `alex` skips. Kept as a literal here rather than
24
+ * importing `../templates/configs/alexjs/alexignore` directly — that file
25
+ * (like `commit-msg`/`pre-push`) is deliberately extensionless, matching
26
+ * the real filename `holocron repo setup` writes, which ECMAScript's own
27
+ * module resolution (`moduleResolution: "nodenext"`) can't import across
28
+ * a package boundary without an extension. Keep in sync with that file by
29
+ * hand; it changes rarely.
30
+ */
31
+ declare const ALEX_IGNORE_PATTERNS: string[];
32
+ //#endregion
33
+ //#region src/lint/editorconfig-checker-exclude/editorconfig-checker-exclude.d.ts
34
+ /**
35
+ * The paths editorconfig-checker skips, read from the same
36
+ * `editorconfig-checker.json` template `holocron repo setup` writes as a repo's
37
+ * `.editorconfig-checker.json` — so Sentinel's central editorconfig check
38
+ * (holocron#927) excludes exactly what CI's editorconfig-checker does, from
39
+ * one source.
40
+ *
41
+ * The exclusion that matters most is `\.md$` / `\.mdx$`: the generated
42
+ * `.editorconfig` gives every file tab indentation, but
43
+ * `@theholocron/prettier-config` formats markdown with spaces, so a README's
44
+ * indented code example would fail one tool or the other. Markdown is left
45
+ * to prettier and markdownlint.
46
+ *
47
+ * Each entry is a regular-expression source, matched against a
48
+ * repo-relative path, as editorconfig-checker itself treats them.
49
+ */
50
+ declare const EDITORCONFIG_CHECKER_EXCLUDE: readonly string[];
51
+ //#endregion
52
+ //#region src/lint/is-editorconfig-excluded/is-editorconfig-excluded.d.ts
53
+ /** `true` when `path` matches any {@link EDITORCONFIG_CHECKER_EXCLUDE} pattern. */
54
+ declare function isEditorConfigExcluded(path: string): boolean;
55
+ //#endregion
56
+ //#region src/lint/lint-message/lint-message.type.d.ts
57
+ interface CommitMessageViolation {
58
+ /** Rule name, e.g. `"subject-empty"`. */
59
+ rule: string;
60
+ /** commitlint's own message for the failure, e.g. `"subject may not be empty"`. */
61
+ message: string;
62
+ }
63
+ //#endregion
64
+ //#region src/lint/lint-message/lint-message.d.ts
65
+ declare function lintCommitMessage(message: string, loaded: QualifiedConfig): Promise<CommitMessageViolation[]>;
66
+ //#endregion
67
+ //#region src/lint/lint-commit-msg-file/lint-commit-msg-file.type.d.ts
68
+ interface LintCommitMsgFileResult {
69
+ valid: boolean;
70
+ violations: CommitMessageViolation[];
71
+ }
72
+ //#endregion
73
+ //#region src/lint/lint-commit-msg-file/lint-commit-msg-file.d.ts
74
+ declare function lintCommitMsgFile(filePath: string, cwd?: string): Promise<LintCommitMsgFileResult>;
75
+ //#endregion
76
+ //#region src/lint/prettier-ignore-patterns/prettier-ignore-patterns.d.ts
77
+ /**
78
+ * The org's canonical prettier ignore-pattern list for a central Sentinel
79
+ * check (holocron#769/#819) — the `PRETTIER_CONFIG` object itself doesn't
80
+ * need a home here, since `@theholocron/prettier-config`'s default export
81
+ * already *is* one canonical, importable config (the same "one config,
82
+ * not N copies" reasoning `@theholocron/commitlint-config` established for
83
+ * commit-message linting, and `ALEX_CONFIG` established for inclusive
84
+ * language) — only the ignore list is a Sentinel-specific decision that
85
+ * belongs alongside `ALEX_IGNORE_PATTERNS`, not inside the config package.
86
+ *
87
+ * Reuses `ALEX_IGNORE_PATTERNS`' own entries (`.github/*`, `CHANGELOG.md`,
88
+ * `LICENSE` all independently confirmed to fail a real `prettier.check()`
89
+ * today — machine-generated or unparseable content, same reasoning that
90
+ * excluded them from alex), plus `pnpm-lock.yaml` — prettier-specific
91
+ * (alex never reads a lockfile, but prettier would try to reformat it):
92
+ * machine-written by pnpm's own writer, and not gitignored (lockfiles are
93
+ * tracked), so prettier picks it up by default. Reformatting it
94
+ * fights every subsequent `pnpm install` (this repo's own `.prettierignore`
95
+ * already excludes it for that exact reason).
96
+ */
97
+ declare const PRETTIER_IGNORE_PATTERNS: string[];
98
+ //#endregion
99
+ export { ALEX_CONFIG, ALEX_IGNORE_PATTERNS, type CommitMessageViolation, EDITORCONFIG_CHECKER_EXCLUDE, type LintCommitMsgFileResult, PRETTIER_IGNORE_PATTERNS, isEditorConfigExcluded, lintCommitMessage, lintCommitMsgFile };
@@ -0,0 +1,143 @@
1
+ import { n as alexrc_default, t as editorconfig_checker_default } from "../editorconfig-checker-DPejtR5z.mjs";
2
+ import { readFile } from "node:fs/promises";
3
+ import load from "@commitlint/load";
4
+ import lint from "@commitlint/lint";
5
+ //#region src/lint/alex-config/alex-config.ts
6
+ /**
7
+ * The org's canonical `alex` (inclusive-language) config, as raw parsed
8
+ * data rather than the pre-rendered file strings `createRcConfig()`/
9
+ * `createIgnoreConfig()` produce for `holocron repo setup` to write into a
10
+ * repo's own `.alexrc.json`/`.alexignore`.
11
+ *
12
+ * `.alexrc.json` is explicitly "generated by `holocron repo setup` — do not
13
+ * edit manually" (this repo's own `AGENTS.md`) — the real source of truth
14
+ * is this JSON file, one canonical copy, not each repo's synced one. A
15
+ * central Sentinel check (holocron#769/#793) reads it directly rather
16
+ * than fetching each repo's own copy via the Contents API — the same "one
17
+ * config, not N copies" reasoning `@theholocron/commitlint-config` already
18
+ * established for commit-message linting.
19
+ */
20
+ const ALEX_CONFIG = alexrc_default;
21
+ //#endregion
22
+ //#region src/lint/alex-ignore-patterns/alex-ignore-patterns.ts
23
+ /**
24
+ * Glob-ish path patterns `alex` skips. Kept as a literal here rather than
25
+ * importing `../templates/configs/alexjs/alexignore` directly — that file
26
+ * (like `commit-msg`/`pre-push`) is deliberately extensionless, matching
27
+ * the real filename `holocron repo setup` writes, which ECMAScript's own
28
+ * module resolution (`moduleResolution: "nodenext"`) can't import across
29
+ * a package boundary without an extension. Keep in sync with that file by
30
+ * hand; it changes rarely.
31
+ */
32
+ const ALEX_IGNORE_PATTERNS = [
33
+ ".github/*",
34
+ "CHANGELOG.md",
35
+ "LICENSE"
36
+ ];
37
+ //#endregion
38
+ //#region src/lint/editorconfig-checker-exclude/editorconfig-checker-exclude.ts
39
+ /**
40
+ * The paths editorconfig-checker skips, read from the same
41
+ * `editorconfig-checker.json` template `holocron repo setup` writes as a repo's
42
+ * `.editorconfig-checker.json` — so Sentinel's central editorconfig check
43
+ * (holocron#927) excludes exactly what CI's editorconfig-checker does, from
44
+ * one source.
45
+ *
46
+ * The exclusion that matters most is `\.md$` / `\.mdx$`: the generated
47
+ * `.editorconfig` gives every file tab indentation, but
48
+ * `@theholocron/prettier-config` formats markdown with spaces, so a README's
49
+ * indented code example would fail one tool or the other. Markdown is left
50
+ * to prettier and markdownlint.
51
+ *
52
+ * Each entry is a regular-expression source, matched against a
53
+ * repo-relative path, as editorconfig-checker itself treats them.
54
+ */
55
+ const EDITORCONFIG_CHECKER_EXCLUDE = editorconfig_checker_default.Exclude;
56
+ //#endregion
57
+ //#region src/lint/is-editorconfig-excluded/is-editorconfig-excluded.ts
58
+ /** `true` when `path` matches any {@link EDITORCONFIG_CHECKER_EXCLUDE} pattern. */
59
+ function isEditorConfigExcluded(path) {
60
+ return EDITORCONFIG_CHECKER_EXCLUDE.some((pattern) => new RegExp(pattern).test(path));
61
+ }
62
+ //#endregion
63
+ //#region src/lint/lint-message/lint-message.ts
64
+ /**
65
+ * Lints one commit message string against an already-loaded commitlint
66
+ * config. The genuinely environment-independent half of commit-message
67
+ * linting (holocron#789) — *obtaining* a `QualifiedConfig` differs by
68
+ * caller (Sentinel isolates itself from any ambient config since it runs
69
+ * standalone, away from a real repo checkout; `lintCommitMsgFile` below
70
+ * lets cosmiconfig discover the invoking repo's own
71
+ * `commitlint.config.*`, matching `commitlint --edit`'s own contract) —
72
+ * but linting one message against a loaded config is identical either way.
73
+ *
74
+ * Real `@commitlint/lint` — the same programmatic API `@commitlint/cli`
75
+ * itself uses internally — never a reimplementation of commitlint's rules.
76
+ */
77
+ /** `parserPreset.parserOpts`, if the loaded config sets one — same lookup `@commitlint/cli`'s own `selectParserOpts()` does. */
78
+ function selectParserOpts(parserPreset) {
79
+ return parserPreset?.parserOpts;
80
+ }
81
+ async function lintCommitMessage(message, loaded) {
82
+ const opts = {
83
+ /* istanbul ignore next -- see comment above */
84
+ parserOpts: selectParserOpts(loaded.parserPreset) ?? {},
85
+ plugins: loaded.plugins,
86
+ /* istanbul ignore next -- see comment above */
87
+ ignores: loaded.ignores ?? [],
88
+ defaultIgnores: loaded.defaultIgnores !== false
89
+ };
90
+ const outcome = await lint(message, loaded.rules, opts);
91
+ if (outcome.valid) return [];
92
+ return outcome.errors.map((error) => ({
93
+ rule: error.name,
94
+ message: error.message
95
+ }));
96
+ }
97
+ //#endregion
98
+ //#region src/lint/lint-commit-msg-file/lint-commit-msg-file.ts
99
+ /**
100
+ * `holocron run lint commit-msg <file>` — a real programmatic replacement for
101
+ * shelling out to `commitlint --edit "$1"` from `.husky/commit-msg`
102
+ * (holocron#789). Matches that CLI's own contract exactly: `file` is a
103
+ * path to the commit message being written (the arg git's `commit-msg`
104
+ * hook passes as `$1`), no `--config` override needed — `@commitlint/load`
105
+ * runs from `cwd` with no seed, so cosmiconfig's own normal upward search
106
+ * discovers the invoking repo's real `commitlint.config.*` file, exactly
107
+ * as `commitlint --edit` (no `--config` flag) already does today. Unlike
108
+ * Sentinel's `loadIsolatedConfig()`, no isolation is needed here — this
109
+ * runs inside a real repo checkout with a real `node_modules`, not
110
+ * standalone on a server.
111
+ */
112
+ async function lintCommitMsgFile(filePath, cwd = process.cwd()) {
113
+ const violations = await lintCommitMessage(await readFile(filePath, "utf8"), await load({}, { cwd }));
114
+ return {
115
+ valid: violations.length === 0,
116
+ violations
117
+ };
118
+ }
119
+ //#endregion
120
+ //#region src/lint/prettier-ignore-patterns/prettier-ignore-patterns.ts
121
+ /**
122
+ * The org's canonical prettier ignore-pattern list for a central Sentinel
123
+ * check (holocron#769/#819) — the `PRETTIER_CONFIG` object itself doesn't
124
+ * need a home here, since `@theholocron/prettier-config`'s default export
125
+ * already *is* one canonical, importable config (the same "one config,
126
+ * not N copies" reasoning `@theholocron/commitlint-config` established for
127
+ * commit-message linting, and `ALEX_CONFIG` established for inclusive
128
+ * language) — only the ignore list is a Sentinel-specific decision that
129
+ * belongs alongside `ALEX_IGNORE_PATTERNS`, not inside the config package.
130
+ *
131
+ * Reuses `ALEX_IGNORE_PATTERNS`' own entries (`.github/*`, `CHANGELOG.md`,
132
+ * `LICENSE` all independently confirmed to fail a real `prettier.check()`
133
+ * today — machine-generated or unparseable content, same reasoning that
134
+ * excluded them from alex), plus `pnpm-lock.yaml` — prettier-specific
135
+ * (alex never reads a lockfile, but prettier would try to reformat it):
136
+ * machine-written by pnpm's own writer, and not gitignored (lockfiles are
137
+ * tracked), so prettier picks it up by default. Reformatting it
138
+ * fights every subsequent `pnpm install` (this repo's own `.prettierignore`
139
+ * already excludes it for that exact reason).
140
+ */
141
+ const PRETTIER_IGNORE_PATTERNS = [...ALEX_IGNORE_PATTERNS, "pnpm-lock.yaml"];
142
+ //#endregion
143
+ export { ALEX_CONFIG, ALEX_IGNORE_PATTERNS, EDITORCONFIG_CHECKER_EXCLUDE, PRETTIER_IGNORE_PATTERNS, isEditorConfigExcluded, lintCommitMessage, lintCommitMsgFile };
@@ -0,0 +1,55 @@
1
+ import { loadLayered } from "@theholocron/datapad";
2
+ //#region src/config/schema/schema.ts
3
+ /**
4
+ * The `tasks` config shape — the single manifest of what a repo runs.
5
+ * Read from a dedicated `astromech.config.*` file or the `tasks` key of
6
+ * `holocron.config.*` (see {@link loadTasksConfig}).
7
+ *
8
+ * Runtime validation is the loader's job, not this type's — the type only
9
+ * describes what an author writes.
10
+ */
11
+ /** Normalise a `TaskConfigItem` to a full {@link TaskEntry} with defaults applied. */
12
+ function normalizeTaskEntry(item) {
13
+ return {
14
+ ci: true,
15
+ local: true,
16
+ ...typeof item === "string" ? { name: item } : item
17
+ };
18
+ }
19
+ //#endregion
20
+ //#region src/config/coerce-tasks/coerce-tasks.ts
21
+ /** A bare item array is shorthand for `{ tasks: [...] }`. */
22
+ function coerceTasks(value) {
23
+ if (value == null) return void 0;
24
+ return Array.isArray(value) ? { tasks: value } : value;
25
+ }
26
+ //#endregion
27
+ //#region src/config/load/load.ts
28
+ /**
29
+ * Resolve the task manifest for a repo: the `tasks` key of
30
+ * `holocron.config.*`, then a dedicated `astromech.config.*` merged on
31
+ * top (dedicated wins; item arrays concatenate). Returns `{}` when
32
+ * neither source is present.
33
+ *
34
+ * `walkUp: true` — `holocron run`/`ci` are usable from any subdirectory of
35
+ * a repo, not only its exact root (datapad walks up to the nearest `.git`
36
+ * boundary; see `@theholocron/datapad`'s own doc comment).
37
+ *
38
+ * A caller that has already loaded `holocron.config.*` passes it as
39
+ * `options.holocron` so it is not found and loaded again.
40
+ */
41
+ async function loadTasksConfig(cwd, options = {}) {
42
+ return (await loadLayered({
43
+ cwd,
44
+ name: "astromech",
45
+ walkUp: true,
46
+ fallback: {
47
+ file: "holocron",
48
+ key: "tasks",
49
+ preloaded: options.holocron
50
+ },
51
+ coerce: (raw) => coerceTasks(raw)
52
+ }))?.config ?? {};
53
+ }
54
+ //#endregion
55
+ export { coerceTasks as n, normalizeTaskEntry as r, loadTasksConfig as t };
@@ -0,0 +1,94 @@
1
+ import { defineConfig } from "@theholocron/semantic-release-config";
2
+ //#region src/release/commit-files/commit-files.d.ts
3
+ /** Runs `git` with `args` in `cwd`, feeding it `input` on stdin, and returns stdout. */
4
+ type GitRun = (args: string[], input: string, cwd: string) => string;
5
+ /**
6
+ * The repo-relative files each of `hashes` changed, from one
7
+ * `git diff-tree --stdin` call. A commit that changes nothing (or a merge
8
+ * commit) maps to `[]`. Paths come back verbatim, not quoted, whatever they
9
+ * contain.
10
+ */
11
+ declare function commitFiles(cwd: string, hashes: readonly string[], run?: GitRun): Map<string, string[]>;
12
+ //#endregion
13
+ //#region src/release/release.type.d.ts
14
+ /** The slice of a semantic-release commit this module reads. */
15
+ interface ReleaseCommit {
16
+ /** Full commit hash. */
17
+ hash: string;
18
+ [key: string]: unknown;
19
+ }
20
+ /** The slice of a semantic-release plugin context this module reads; everything else passes through untouched. */
21
+ interface ReleaseContext {
22
+ cwd?: string;
23
+ commits?: ReleaseCommit[];
24
+ [key: string]: unknown;
25
+ }
26
+ /** A semantic-release plugin step that looks at commits. */
27
+ type CommitStep = "analyzeCommits" | "generateNotes";
28
+ type StepFn = (pluginConfig: unknown, context: ReleaseContext) => unknown;
29
+ /** A plugin module that implements `Step`. */
30
+ type StepPlugin<Step extends CommitStep> = Partial<Record<Step, StepFn>>;
31
+ //#endregion
32
+ //#region src/release/folder-scoped/folder-scoped.type.d.ts
33
+ interface FolderScopedDeps {
34
+ /** Loads a plugin module by specifier. Defaults to a dynamic `import()`. */
35
+ load?: (specifier: string) => Promise<unknown>;
36
+ /** Lists the files each commit changed. Defaults to `git diff-tree`. */
37
+ listFiles?: typeof commitFiles;
38
+ }
39
+ //#endregion
40
+ //#region src/release/folder-scoped/folder-scoped.d.ts
41
+ /**
42
+ * An inline semantic-release plugin that runs `step` of the stock plugin
43
+ * (`@semantic-release/commit-analyzer` for `analyzeCommits`,
44
+ * `@semantic-release/release-notes-generator` for `generateNotes`) over only
45
+ * the commits that changed a file at or under `paths`.
46
+ *
47
+ * After a monorepo import, `lastTag..HEAD` spans every folder's commits, so an
48
+ * unscoped analyzer would release a folder for a commit that never touched it.
49
+ * The wrapped plugin is loaded on first use, so it only needs to be installed
50
+ * where a release actually runs. Commits are listed with one `git diff-tree`
51
+ * call, in `context.cwd`.
52
+ */
53
+ declare function folderScoped<Step extends CommitStep>(step: Step, paths: readonly string[], { load, listFiles }?: FolderScopedDeps): StepPlugin<Step>;
54
+ //#endregion
55
+ //#region src/release/group-release-config/group-release-config.type.d.ts
56
+ /** What `defineConfig()` from `@theholocron/semantic-release-config` accepts. */
57
+ type DefineConfigOptions = NonNullable<Parameters<typeof defineConfig>[0]>;
58
+ interface GroupReleaseOptions extends DefineConfigOptions {
59
+ /**
60
+ * The version group: a folder of the repo (`clients`, `observability`, `cli`) that
61
+ * releases on its own. It prefixes the tags (`clients-v1.43.2`) and the release commit.
62
+ */
63
+ group: string;
64
+ /** Repo-relative folders whose commits release this group. Defaults to `[group]`. */
65
+ paths?: readonly string[];
66
+ /** The group's changelog. Defaults to `<group>/CHANGELOG.md`. */
67
+ changelogFile?: string;
68
+ }
69
+ //#endregion
70
+ //#region src/release/group-release-config/group-release-config.d.ts
71
+ /**
72
+ * A semantic-release config that releases one version group of a monorepo,
73
+ * built on the org's `defineConfig()` so its rules, notes layout and plugin
74
+ * order stay the same:
75
+ *
76
+ * - tags are `<group>-v<version>`, so each group finds its own last release;
77
+ * - the commit analyzer and notes generator see only commits that touched the
78
+ * group's `paths` ({@link folderScoped});
79
+ * - the changelog, the release commit's assets and its message are the group's.
80
+ *
81
+ * Run one `semantic-release` per group. Cross-group dependencies resolve from
82
+ * the registry, so `paths` is the group's folder unless more is listed.
83
+ */
84
+ declare function groupReleaseConfig(options: GroupReleaseOptions): object;
85
+ //#endregion
86
+ //#region src/release/in-scope/in-scope.d.ts
87
+ /**
88
+ * Whether any of `files` (repo-relative, `/`-separated) sits at or under one of
89
+ * `paths` (repo-relative folders). `clients` matches `clients/http/x.ts` but
90
+ * not `clients-old/x.ts`.
91
+ */
92
+ declare function inScope(files: readonly string[], paths: readonly string[]): boolean;
93
+ //#endregion
94
+ export { type CommitStep, type DefineConfigOptions, type FolderScopedDeps, GitRun, type GroupReleaseOptions, type ReleaseCommit, type ReleaseContext, type StepPlugin, commitFiles, folderScoped, groupReleaseConfig, inScope };
@@ -0,0 +1,135 @@
1
+ import { execFileSync } from "node:child_process";
2
+ import { defineConfig } from "@theholocron/semantic-release-config";
3
+ //#region src/release/commit-files/commit-files.ts
4
+ const defaultGitRun = (args, input, cwd) => execFileSync("git", args, {
5
+ cwd,
6
+ input,
7
+ encoding: "utf8",
8
+ maxBuffer: 268435456
9
+ });
10
+ /**
11
+ * The repo-relative files each of `hashes` changed, from one
12
+ * `git diff-tree --stdin` call. A commit that changes nothing (or a merge
13
+ * commit) maps to `[]`. Paths come back verbatim, not quoted, whatever they
14
+ * contain.
15
+ */
16
+ function commitFiles(cwd, hashes, run = defaultGitRun) {
17
+ const files = new Map(hashes.map((hash) => [hash, []]));
18
+ if (hashes.length === 0) return files;
19
+ const out = run([
20
+ "-c",
21
+ "core.quotePath=false",
22
+ "diff-tree",
23
+ "--stdin",
24
+ "--name-only",
25
+ "-r",
26
+ "--root"
27
+ ], `${hashes.join("\n")}\n`, cwd);
28
+ let current;
29
+ for (const line of out.split("\n")) {
30
+ if (line === "") continue;
31
+ const known = files.get(line);
32
+ if (known) current = known;
33
+ else current?.push(line);
34
+ }
35
+ return files;
36
+ }
37
+ //#endregion
38
+ //#region src/release/in-scope/in-scope.ts
39
+ /**
40
+ * Whether any of `files` (repo-relative, `/`-separated) sits at or under one of
41
+ * `paths` (repo-relative folders). `clients` matches `clients/http/x.ts` but
42
+ * not `clients-old/x.ts`.
43
+ */
44
+ function inScope(files, paths) {
45
+ const folders = paths.map((path) => path.replace(/^\.\//, "").replace(/\/+$/, ""));
46
+ return files.some((file) => folders.some((folder) => file === folder || file.startsWith(`${folder}/`)));
47
+ }
48
+ //#endregion
49
+ //#region src/release/folder-scoped/folder-scoped.ts
50
+ /** The semantic-release plugin that implements each commit-reading step. */
51
+ const MODULES = {
52
+ analyzeCommits: "@semantic-release/commit-analyzer",
53
+ generateNotes: "@semantic-release/release-notes-generator"
54
+ };
55
+ /**
56
+ * An inline semantic-release plugin that runs `step` of the stock plugin
57
+ * (`@semantic-release/commit-analyzer` for `analyzeCommits`,
58
+ * `@semantic-release/release-notes-generator` for `generateNotes`) over only
59
+ * the commits that changed a file at or under `paths`.
60
+ *
61
+ * After a monorepo import, `lastTag..HEAD` spans every folder's commits, so an
62
+ * unscoped analyzer would release a folder for a commit that never touched it.
63
+ * The wrapped plugin is loaded on first use, so it only needs to be installed
64
+ * where a release actually runs. Commits are listed with one `git diff-tree`
65
+ * call, in `context.cwd`.
66
+ */
67
+ function folderScoped(step, paths, { load = (specifier) => import(specifier), listFiles = commitFiles } = {}) {
68
+ const scoped = async (pluginConfig, context) => {
69
+ const inner = await load(MODULES[step]);
70
+ const { commits = [], cwd = process.cwd() } = context;
71
+ const files = listFiles(cwd, commits.map((commit) => commit.hash));
72
+ const inFolder = commits.filter((commit) => inScope(files.get(commit.hash) ?? [], paths));
73
+ return inner[step]?.(pluginConfig, {
74
+ ...context,
75
+ commits: inFolder
76
+ });
77
+ };
78
+ return { [step]: scoped };
79
+ }
80
+ //#endregion
81
+ //#region src/release/group-release-config/group-release-config.ts
82
+ const GROUP = /^[a-z][a-z0-9-]*$/;
83
+ /**
84
+ * A semantic-release config that releases one version group of a monorepo,
85
+ * built on the org's `defineConfig()` so its rules, notes layout and plugin
86
+ * order stay the same:
87
+ *
88
+ * - tags are `<group>-v<version>`, so each group finds its own last release;
89
+ * - the commit analyzer and notes generator see only commits that touched the
90
+ * group's `paths` ({@link folderScoped});
91
+ * - the changelog, the release commit's assets and its message are the group's.
92
+ *
93
+ * Run one `semantic-release` per group. Cross-group dependencies resolve from
94
+ * the registry, so `paths` is the group's folder unless more is listed.
95
+ */
96
+ function groupReleaseConfig(options) {
97
+ const { group, paths = [group], changelogFile = `${group}/CHANGELOG.md`, assets, ...rest } = options;
98
+ if (!GROUP.test(group)) throw new TypeError(`release group must be a lowercase folder name like "clients", got ${JSON.stringify(group)}`);
99
+ if (paths.length === 0) throw new TypeError(`release group ${JSON.stringify(group)} needs at least one path`);
100
+ const base = defineConfig({
101
+ ...rest,
102
+ assets: assets ?? [
103
+ changelogFile,
104
+ `${group}/**/package.json`,
105
+ "!**/node_modules/**"
106
+ ]
107
+ });
108
+ const scope = (entry) => {
109
+ const [name, config] = Array.isArray(entry) ? entry : [entry, void 0];
110
+ switch (name) {
111
+ case "@semantic-release/commit-analyzer": return [folderScoped("analyzeCommits", paths), config];
112
+ case "@semantic-release/release-notes-generator": return [folderScoped("generateNotes", paths), config];
113
+ case "@semantic-release/changelog": return [name, {
114
+ ...config,
115
+ changelogFile
116
+ }];
117
+ case "@semantic-release/git": return [name, {
118
+ ...config,
119
+ message: groupMessage(config?.["message"], group)
120
+ }];
121
+ default: return entry;
122
+ }
123
+ };
124
+ return {
125
+ ...base,
126
+ tagFormat: `${group}-v\${version}`,
127
+ plugins: base.plugins.map(scope)
128
+ };
129
+ }
130
+ /** `chore(release): <version> …` becomes `chore(release): <group> <version> …`. */
131
+ function groupMessage(message, group) {
132
+ return message.replace(/^chore\(release\): /, `chore(release): ${group} `);
133
+ }
134
+ //#endregion
135
+ export { commitFiles, folderScoped, groupReleaseConfig, inScope };
@@ -1,18 +1,10 @@
1
- //#region src/config/schema.d.ts
2
- /**
3
- * The `tasks` config shape — the single manifest of what a repo runs.
4
- * Read from a dedicated `astromech.config.*` file or the `tasks` key of
5
- * `holocron.config.*` (see {@link loadTasksConfig}).
6
- *
7
- * Runtime validation is the loader's job, not this type's — the type only
8
- * describes what an author writes.
9
- */
1
+ //#region src/config/schema/schema.type.d.ts
10
2
  interface TaskEntry {
11
3
  /** Registry task name — `verification.unitTests`, `sourceQuality.staticAnalysis`, `delivery.build`, … */
12
4
  name: string;
13
5
  /**
14
6
  * Emit a `.github/workflows/<name>.yml` thin caller and include the task
15
- * in `holocron ci`. Default `true`.
7
+ * in `holocron run ci`. Default `true`.
16
8
  */
17
9
  ci?: boolean;
18
10
  /**
@@ -24,7 +16,7 @@ interface TaskEntry {
24
16
  /**
25
17
  * The task's CI check context (from `WORKFLOW_CHECK_CONTEXTS`) is a
26
18
  * required status check in branch protection (`astromech.requiredChecks()`)
27
- * and part of `holocron ci`'s default run.
19
+ * and part of `holocron run ci`'s default run.
28
20
  */
29
21
  required?: boolean;
30
22
  /** Per-repo overrides on the same channel the reusable workflow reads. */
@@ -40,6 +32,15 @@ interface TaskEntry {
40
32
  turbo?: {
41
33
  /** Extra env vars turbo hashes into this task's cache key, appended to the registry default (empty when the task has none). */
42
34
  passThroughEnv?: string[];
35
+ /**
36
+ * Extra input globs appended to the registry default's `inputs`
37
+ * (holocron#845) — for a package whose layout the registry's
38
+ * `"src/**"` default doesn't cover (e.g. a flat-layout package with
39
+ * no `src/` directory at all). Appended, not replaced: the
40
+ * registry's other inputs (`package.json`, `tsdown.config.ts`, …)
41
+ * stay tracked without needing to be repeated here.
42
+ */
43
+ inputs?: string[];
43
44
  };
44
45
  }
45
46
  /** A task is either its bare name (all defaults) or an entry object. */
@@ -52,18 +53,18 @@ interface TasksConfig {
52
53
  /**
53
54
  * The command the synced `"holocron"` `package.json` script runs. Default
54
55
  * `"holocron"` (the installed bin). The source repo overrides it to run
55
- * its own build, e.g. `"node packages/cli/dist/cli.mjs"`.
56
+ * its own build, e.g. `"node cli/cli/dist/cli.mjs"`.
56
57
  */
57
58
  holocronScript?: string;
58
59
  /**
59
60
  * Required status-check contexts not backed by a task — codecov gates,
60
61
  * a bundle-build check, … Appended to `astromech.requiredChecks()` after the
61
- * `required`-task contexts. (`DCO` is prepended by `holocron setup` itself.)
62
+ * `required`-task contexts. (`DCO` is prepended by `holocron repo setup` itself.)
62
63
  */
63
64
  extraRequiredChecks?: string[];
64
65
  /**
65
- * Git hooks `holocron setup` installs. `true` / `{ prePush: true }` writes
66
- * `.husky/pre-push` (runs `holocron ci`); `false` / `{ prePush: false }`
66
+ * Git hooks `holocron repo setup` installs. `true` / `{ prePush: true }` writes
67
+ * `.husky/pre-push` (runs `holocron run ci`); `false` / `{ prePush: false }`
67
68
  * opts out. Omitted → on for `protection: "strict"` repos, off otherwise.
68
69
  * When enabled, `packageScripts()` also emits `prepare: "husky"`.
69
70
  */
@@ -71,7 +72,5 @@ interface TasksConfig {
71
72
  prePush?: boolean;
72
73
  };
73
74
  }
74
- /** Normalise a `TaskConfigItem` to a full {@link TaskEntry} with defaults applied. */
75
- declare function normalizeTaskEntry(item: TaskConfigItem): Required<Pick<TaskEntry, "name" | "ci" | "local">> & TaskEntry;
76
75
  //#endregion
77
- export { normalizeTaskEntry as i, TaskEntry as n, TasksConfig as r, TaskConfigItem as t };
76
+ export { TaskEntry as n, TasksConfig as r, TaskConfigItem as t };