@williamthorsen/release-kit 10.4.4 → 10.5.0
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/.readyup/kits/default.js +10 -3
- package/.readyup/kits/npm-auto-publish.js +11 -3
- package/.readyup/manifest.json +11 -11
- package/CHANGELOG.md +20 -0
- package/README.md +10 -2
- package/dist/esm/assertCleanWorkingTree.d.ts +5 -0
- package/dist/esm/buildChangelogEntries.d.ts +22 -0
- package/dist/esm/buildDependencyGraph.d.ts +16 -0
- package/dist/esm/buildEmptyReleaseEntry.d.ts +8 -0
- package/dist/esm/buildReleaseSummary.d.ts +10 -0
- package/dist/esm/buildSyntheticChangelogEntry.d.ts +6 -0
- package/dist/esm/bumpVersion.d.ts +8 -0
- package/dist/esm/changelogJsonFile.d.ts +11 -0
- package/dist/esm/changelogJsonUtils.d.ts +16 -0
- package/dist/esm/changelogOverrides.d.ts +143 -0
- package/dist/esm/checkWorkTypesDrift.d.ts +25 -0
- package/dist/esm/collectPolicyViolations.d.ts +9 -0
- package/dist/esm/commitCommand.d.ts +6 -0
- package/dist/esm/compareVersions.d.ts +7 -0
- package/dist/esm/createGithubRelease.d.ts +30 -0
- package/dist/esm/createGithubReleaseCommand.d.ts +7 -0
- package/dist/esm/createTags.d.ts +5 -0
- package/dist/esm/decideRelease.d.ts +37 -0
- package/dist/esm/defaults.d.ts +25 -0
- package/dist/esm/defineConfig.d.ts +9 -0
- package/dist/esm/deleteFileIfExists.d.ts +1 -0
- package/dist/esm/deriveWorkspaceConfig.d.ts +9 -0
- package/dist/esm/detectPackageManager.d.ts +6 -0
- package/dist/esm/detectUndeclaredTagPrefixes.d.ts +18 -0
- package/dist/esm/determineBumpFromCommits.d.ts +5 -0
- package/dist/esm/determineBumpType.d.ts +12 -0
- package/dist/esm/discoverWorkspaces.d.ts +12 -0
- package/dist/esm/format.d.ts +3 -0
- package/dist/esm/formatPrivateSkip.d.ts +6 -0
- package/dist/esm/generateChangelogs.d.ts +25 -0
- package/dist/esm/getCommitsSinceTarget.d.ts +16 -0
- package/dist/esm/hasPrettierConfig.d.ts +6 -0
- package/dist/esm/help/prepareHelp.d.ts +6 -0
- package/dist/esm/init/checks.d.ts +4 -0
- package/dist/esm/init/detectRepoType.d.ts +7 -0
- package/dist/esm/init/initCommand.d.ts +6 -0
- package/dist/esm/init/parseJsonRecord.d.ts +4 -0
- package/dist/esm/init/scaffold.d.ts +3 -1
- package/dist/esm/init/templates.d.ts +13 -0
- package/dist/esm/injectReleaseNotesIntoReadme.d.ts +39 -0
- package/dist/esm/injectSection.d.ts +6 -0
- package/dist/esm/loadConfig.d.ts +46 -0
- package/dist/esm/loadValidatedConfig.d.ts +8 -0
- package/dist/esm/parseCommitMessage.d.ts +42 -0
- package/dist/esm/parseRequestedTags.d.ts +7 -0
- package/dist/esm/planReleaseNotesPreviews.d.ts +20 -0
- package/dist/esm/planVersionBump.d.ts +12 -0
- package/dist/esm/prepareCommand.d.ts +10 -0
- package/dist/esm/previewTagPrefixes.d.ts +21 -1
- package/dist/esm/propagateBumps.d.ts +15 -0
- package/dist/esm/publish.d.ts +1 -0
- package/dist/esm/publishCommand.d.ts +4 -0
- package/dist/esm/pushCommand.d.ts +4 -0
- package/dist/esm/pushRelease.d.ts +6 -0
- package/dist/esm/readCurrentVersion.d.ts +1 -0
- package/dist/esm/releaseFiles.d.ts +22 -0
- package/dist/esm/releasePlan.d.ts +23 -0
- package/dist/esm/releasePrepare.d.ts +40 -0
- package/dist/esm/releasePrepareMono.d.ts +8 -0
- package/dist/esm/releasePrepareProject.d.ts +42 -0
- package/dist/esm/renderChangelogMarkdown.d.ts +17 -0
- package/dist/esm/renderReleaseNotes.d.ts +25 -0
- package/dist/esm/reportPrepare.d.ts +14 -0
- package/dist/esm/resolveCliffConfigPath.d.ts +10 -0
- package/dist/esm/resolveCommandTags.d.ts +13 -1
- package/dist/esm/resolveReleaseNotesConfig.d.ts +14 -0
- package/dist/esm/resolveReleaseTags.d.ts +22 -0
- package/dist/esm/runGitCliff.d.ts +43 -0
- package/dist/esm/showTagPrefixesCommand.d.ts +11 -0
- package/dist/esm/stripScope.d.ts +7 -0
- package/dist/esm/sync-labels/generateCommand.d.ts +17 -0
- package/dist/esm/sync-labels/initCommand.d.ts +9 -0
- package/dist/esm/sync-labels/presets.d.ts +6 -0
- package/dist/esm/sync-labels/resolveLabels.d.ts +10 -0
- package/dist/esm/sync-labels/retiredConfig.d.ts +8 -0
- package/dist/esm/sync-labels/syncCommand.d.ts +6 -0
- package/dist/esm/sync-labels/templates.d.ts +14 -0
- package/dist/esm/sync-labels/types.d.ts +4 -0
- package/dist/esm/syncWorkTypes.d.ts +18 -0
- package/dist/esm/tagCommand.d.ts +1 -0
- package/dist/esm/typeGuards.d.ts +2 -0
- package/dist/esm/types.d.ts +293 -0
- package/dist/esm/validateConfig.d.ts +14 -1
- package/dist/esm/validateOnlyExcludesStrandedDependents.d.ts +21 -0
- package/dist/esm/validateOverridesCommand.d.ts +30 -0
- package/dist/esm/workTypesData.d.ts +27 -0
- package/dist/esm/workTypesUtils.d.ts +17 -0
- package/package.json +8 -8
package/.readyup/kits/default.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/** @noformat
|
|
1
|
+
/** @noformat -- @generated. Do not edit. Compiled by rdy. */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
export const __readyupVersion = "0.
|
|
3
|
+
export const __readyupVersion = "0.35.0";
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
// .readyup/kits/default.ts
|
|
@@ -52,7 +52,7 @@ function detectRepoType() {
|
|
|
52
52
|
|
|
53
53
|
// .readyup/kits/default.ts
|
|
54
54
|
function getMinVersion() {
|
|
55
|
-
const picked = { "version": "10.
|
|
55
|
+
const picked = { "version": "10.5.0" };
|
|
56
56
|
if (typeof picked["version"] !== "string") {
|
|
57
57
|
throw new TypeError("release-kit/package.json: 'version' must be a string");
|
|
58
58
|
}
|
|
@@ -218,6 +218,13 @@ var default_default = defineRdyKit({
|
|
|
218
218
|
check: () => !hasDevDependency("git-cliff"),
|
|
219
219
|
fix: "pnpm remove git-cliff \u2014 release-kit handles changelog generation directly"
|
|
220
220
|
},
|
|
221
|
+
{
|
|
222
|
+
name: "@changesets/cli not in devDependencies",
|
|
223
|
+
severity: "recommend",
|
|
224
|
+
quiet: true,
|
|
225
|
+
check: () => !hasDevDependency("@changesets/cli"),
|
|
226
|
+
fix: "pnpm remove @changesets/cli, then delete .changeset/ and any changeset:* scripts; release-kit supersedes changesets"
|
|
227
|
+
},
|
|
221
228
|
{
|
|
222
229
|
name: ".config/git-cliff.toml matches current template",
|
|
223
230
|
severity: "warn",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/** @noformat
|
|
1
|
+
/** @noformat -- @generated. Do not edit. Compiled by rdy. */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
export const __readyupVersion = "0.
|
|
3
|
+
export const __readyupVersion = "0.35.0";
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
// .readyup/kits/npm-auto-publish.ts
|
|
@@ -68,6 +68,9 @@ var packagesChecklist = defineRdyChecklist({
|
|
|
68
68
|
},
|
|
69
69
|
fix: 'Set "packageManager": "pnpm@..." in root package.json'
|
|
70
70
|
},
|
|
71
|
+
// Unfalsifiable on readyup 0.33 and later, where discovery reports the repo root and throws on an unreadable
|
|
72
|
+
// root package.json rather than returning an empty list. It stays for a consumer below that, whose monorepo
|
|
73
|
+
// mode returns the matched directories alone and so returns nothing when the globs match nothing.
|
|
71
74
|
{
|
|
72
75
|
name: "At least one workspace discovered",
|
|
73
76
|
check: () => discoverWorkspaces().length > 0,
|
|
@@ -86,7 +89,9 @@ var packagesChecklist = defineRdyChecklist({
|
|
|
86
89
|
// reach the registry on every run regardless of the skip. Per-outcome wording goes in the check's detail.
|
|
87
90
|
fix: 'Restore a usable npm session: log in with "npm login", or restore access to the registry, which the trusted-publisher check queries directly',
|
|
88
91
|
get checks() {
|
|
89
|
-
return discoverWorkspaces().map(
|
|
92
|
+
return discoverWorkspaces({ filter: belongsInPackagesChecklist }).map(
|
|
93
|
+
(workspace) => buildWorkspaceCheck(workspace)
|
|
94
|
+
);
|
|
90
95
|
}
|
|
91
96
|
}
|
|
92
97
|
]
|
|
@@ -95,6 +100,9 @@ var npm_auto_publish_default = defineRdyKit({
|
|
|
95
100
|
fixLocation: "inline",
|
|
96
101
|
checklists: [repoChecklist, packagesChecklist]
|
|
97
102
|
});
|
|
103
|
+
function belongsInPackagesChecklist(workspace) {
|
|
104
|
+
return !workspace.isRoot || workspace.isPackage;
|
|
105
|
+
}
|
|
98
106
|
function buildWorkspaceCheck(workspace) {
|
|
99
107
|
const displayName = workspace.name ?? "(unnamed)";
|
|
100
108
|
const pkgJsonPath = path.join(workspace.dir, "package.json");
|
package/.readyup/manifest.json
CHANGED
|
@@ -5,15 +5,15 @@
|
|
|
5
5
|
"checklists": [
|
|
6
6
|
"release-kit"
|
|
7
7
|
],
|
|
8
|
-
"esbuildVersion": "0.28.
|
|
8
|
+
"esbuildVersion": "0.28.2",
|
|
9
9
|
"inputs": [
|
|
10
10
|
{
|
|
11
|
-
"hash": "
|
|
11
|
+
"hash": "c948b179",
|
|
12
12
|
"kind": "module",
|
|
13
13
|
"path": "kits/default.ts"
|
|
14
14
|
},
|
|
15
15
|
{
|
|
16
|
-
"hash": "
|
|
16
|
+
"hash": "221d9444",
|
|
17
17
|
"kind": "inline",
|
|
18
18
|
"path": "../package.json",
|
|
19
19
|
"paths": [
|
|
@@ -38,30 +38,30 @@
|
|
|
38
38
|
],
|
|
39
39
|
"name": "default",
|
|
40
40
|
"path": "kits/default.js",
|
|
41
|
-
"readyupVersion": "0.
|
|
41
|
+
"readyupVersion": "0.35.0",
|
|
42
42
|
"source": "kits/default.ts",
|
|
43
|
-
"sourceHash": "
|
|
44
|
-
"targetHash": "
|
|
43
|
+
"sourceHash": "c948b179",
|
|
44
|
+
"targetHash": "08e4eb5a"
|
|
45
45
|
},
|
|
46
46
|
{
|
|
47
47
|
"checklists": [
|
|
48
48
|
"repo",
|
|
49
49
|
"packages"
|
|
50
50
|
],
|
|
51
|
-
"esbuildVersion": "0.28.
|
|
51
|
+
"esbuildVersion": "0.28.2",
|
|
52
52
|
"inputs": [
|
|
53
53
|
{
|
|
54
|
-
"hash": "
|
|
54
|
+
"hash": "15641d4a",
|
|
55
55
|
"kind": "module",
|
|
56
56
|
"path": "kits/npm-auto-publish.ts"
|
|
57
57
|
}
|
|
58
58
|
],
|
|
59
59
|
"name": "npm-auto-publish",
|
|
60
60
|
"path": "kits/npm-auto-publish.js",
|
|
61
|
-
"readyupVersion": "0.
|
|
61
|
+
"readyupVersion": "0.35.0",
|
|
62
62
|
"source": "kits/npm-auto-publish.ts",
|
|
63
|
-
"sourceHash": "
|
|
64
|
-
"targetHash": "
|
|
63
|
+
"sourceHash": "15641d4a",
|
|
64
|
+
"targetHash": "721e337b"
|
|
65
65
|
}
|
|
66
66
|
]
|
|
67
67
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## 10.5.0 — 2026-09-01
|
|
6
|
+
|
|
7
|
+
### 🎉 Features
|
|
8
|
+
|
|
9
|
+
- Report a consuming repo that still declares @changesets/cli (#764)
|
|
10
|
+
|
|
11
|
+
Adds a check to the default ReadyUp kit in `@williamthorsen/release-kit` that reports a repo still declaring `@changesets/cli`, the release tool superseded by release-kit. The check reports at `recommend` severity; its fix directs the consumer to remove the dependency together with the `.changeset/` directory and any `changeset:*` scripts.
|
|
12
|
+
|
|
13
|
+
### ♻️ Refactoring
|
|
14
|
+
|
|
15
|
+
- Upgrade to readyup v0.34 and exclude a private repo root from kit checks (#759)
|
|
16
|
+
|
|
17
|
+
Upgrades `readyup` to v0.34, whose `discoverWorkspaces` now reports the repo root. `release-kit`'s `npm-auto-publish` kit filters that root out unless it is publishable, so a private root is no longer listed in the kit's report.
|
|
18
|
+
|
|
19
|
+
Test suites for release-kit's ReadyUp kits have been refactored to use the patterns documented in v0.34.
|
|
20
|
+
|
|
21
|
+
- Upgrade eslint-config-typescript and mark the discards it now reports (#761)
|
|
22
|
+
|
|
23
|
+
Upgrades `@williamthorsen/eslint-config-typescript` to v12 and fixes violations surfaced by the newly added rule warning against a disposable that is discarded or that is bound to a declaration that never releases it.
|
|
24
|
+
|
|
5
25
|
## 10.4.4 — 2026-08-24
|
|
6
26
|
|
|
7
27
|
### ♻️ Refactoring
|
package/README.md
CHANGED
|
@@ -4,7 +4,15 @@ Version-bumping and changelog-generation toolkit for release workflows.
|
|
|
4
4
|
|
|
5
5
|
Provides a self-contained CLI that auto-discovers workspaces from `pnpm-workspace.yaml`, parses conventional commits, determines version bumps, updates `package.json` files, and generates changelogs from `git-cliff --context` output rendered in-process (with optional [editorial overrides](#editorial-overrides)).
|
|
6
6
|
|
|
7
|
-
<!-- section:release-notes
|
|
7
|
+
<!-- section:release-notes -->
|
|
8
|
+
## Release notes — v10.5.0 (2026-09-01)
|
|
9
|
+
|
|
10
|
+
### 🎉 Features
|
|
11
|
+
|
|
12
|
+
- Report a consuming repo that still declares @changesets/cli (#764)
|
|
13
|
+
|
|
14
|
+
Adds a check to the default ReadyUp kit in `@williamthorsen/release-kit` that reports a repo still declaring `@changesets/cli`, the release tool superseded by release-kit. The check reports at `recommend` severity; its fix directs the consumer to remove the dependency together with the `.changeset/` directory and any `changeset:*` scripts.
|
|
15
|
+
<!-- /section:release-notes -->
|
|
8
16
|
|
|
9
17
|
## Installation
|
|
10
18
|
|
|
@@ -1067,7 +1075,7 @@ If your format command does not accept file arguments, update it to one that doe
|
|
|
1067
1075
|
## Migration from changesets
|
|
1068
1076
|
|
|
1069
1077
|
1. Add `@williamthorsen/release-kit` as a dev dependency.
|
|
1070
|
-
2. Remove `@changesets/cli` from dev dependencies.
|
|
1078
|
+
2. Remove `@changesets/cli` from dev dependencies. The [default readyup kit](#readiness-checks) reports a repo that still declares it.
|
|
1071
1079
|
3. Delete the `.changeset/` directory.
|
|
1072
1080
|
4. Run `npx @williamthorsen/release-kit init` to scaffold workflow and config files.
|
|
1073
1081
|
5. Remove `changeset:*` scripts from `package.json` (no replacement needed — the CLI handles everything).
|
|
@@ -1,4 +1,26 @@
|
|
|
1
1
|
import type { GenerateChangelogOptions } from './generateChangelogs.js';
|
|
2
2
|
import type { ChangelogEntry, ReleaseConfig } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Strip cliff-template decorations from a group string, returning the bare section name.
|
|
5
|
+
*
|
|
6
|
+
* The bundled `cliff.toml.template` encodes canonical row order as a hidden HTML comment
|
|
7
|
+
* (e.g. `"<!-- 04 -->🐛 Bug fixes"`) so tera's `group_by` filter sorts groups predictably.
|
|
8
|
+
* The body template's `striptags` filter erases the comment from the rendered heading,
|
|
9
|
+
* but downstream consumers that read the raw `group` value (changelog.json titles, the
|
|
10
|
+
* dev-vs-public classifier, the drift test) see the prefix and must strip it. The trailing
|
|
11
|
+
* `stripEmojiPrefix` keeps the helper backward-compatible with consumer overrides written
|
|
12
|
+
* as bare names.
|
|
13
|
+
*/
|
|
3
14
|
export declare function stripGroupDecorations(group: string): string;
|
|
15
|
+
/**
|
|
16
|
+
* Build structured changelog entries from git history using git-cliff `--context`.
|
|
17
|
+
*
|
|
18
|
+
* Pure data: invokes git-cliff, parses its `--context` output, and returns the transformed
|
|
19
|
+
* `ChangelogEntry[]`. Performs no `changelog.json` I/O — callers persist the entries via
|
|
20
|
+
* `renderChangelogJson`.
|
|
21
|
+
*
|
|
22
|
+
* Always invokes git-cliff: dry-run is the caller's concern (it governs whether the file write happens,
|
|
23
|
+
* not whether git-cliff runs). This means dry-run exercises the full git-cliff toolchain and surfaces missing-binary,
|
|
24
|
+
* malformed-config, and template-resolution failures earlier than before.
|
|
25
|
+
*/
|
|
4
26
|
export declare function buildChangelogEntries(config: Pick<ReleaseConfig, 'cliffConfigPath' | 'changelogJson'>, tag: string, options?: GenerateChangelogOptions): ChangelogEntry[];
|
|
@@ -1,8 +1,24 @@
|
|
|
1
1
|
import type { WorkspaceConfig } from './types.js';
|
|
2
|
+
/** Reverse adjacency map from package names to their workspace dependents. */
|
|
2
3
|
export interface DependencyGraph {
|
|
4
|
+
/** Resolve a package name to its workspace `dir`. */
|
|
3
5
|
packageNameToDir: Map<string, string>;
|
|
6
|
+
/** Resolve a workspace `dir` to its package name (inverse of `packageNameToDir`). */
|
|
4
7
|
dirToPackageName: Map<string, string>;
|
|
8
|
+
/** Map a package name to the workspaces that depend on it. */
|
|
5
9
|
dependentsOf: Map<string, WorkspaceConfig[]>;
|
|
10
|
+
/**
|
|
11
|
+
* Forward adjacency: map a workspace `dir` to the set of `workspace:`-protocol package
|
|
12
|
+
* names it declares in `dependencies` or `peerDependencies`. Complement of `dependentsOf`.
|
|
13
|
+
*/
|
|
6
14
|
dependenciesOf: Map<string, Set<string>>;
|
|
7
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Build a reverse dependency graph from the workspaces' `package.json` files.
|
|
18
|
+
*
|
|
19
|
+
* Reads each workspace's primary `package.json` (first entry in `packageFiles`) to discover
|
|
20
|
+
* `workspace:` references in `dependencies` and `peerDependencies`. Returns a map from each
|
|
21
|
+
* package name to the workspaces that depend on it, enabling upward traversal from a bumped
|
|
22
|
+
* package to all its dependents.
|
|
23
|
+
*/
|
|
8
24
|
export declare function buildDependencyGraph(workspaces: readonly WorkspaceConfig[]): DependencyGraph;
|
|
@@ -1,2 +1,10 @@
|
|
|
1
1
|
import type { ChangelogEntry } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Build a synthetic changelog entry for a forced empty-range release.
|
|
4
|
+
*
|
|
5
|
+
* Produces a single `ChangelogEntry` with one `'Notes'` section (audience `'dev'`)
|
|
6
|
+
* containing a single `'Forced version bump.'` item. Used when `release-kit prepare`
|
|
7
|
+
* proceeds via `--force`, `--bump=X`, or `--set-version` against a unit with zero
|
|
8
|
+
* qualifying commits since its last tag. Pure function: no I/O.
|
|
9
|
+
*/
|
|
2
10
|
export declare function buildEmptyReleaseEntry(version: string, date: string): ChangelogEntry;
|
|
@@ -1,2 +1,12 @@
|
|
|
1
1
|
import type { PrepareResult } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Build a release commit body from a prepare result.
|
|
4
|
+
*
|
|
5
|
+
* Each released workspace with commits gets a section headed by its tag,
|
|
6
|
+
* followed by scope-stripped commit messages as bullet points. Sections
|
|
7
|
+
* are separated by blank lines. The project release (when present) is
|
|
8
|
+
* appended as a final section using the same format. Returns an empty
|
|
9
|
+
* string when no released workspaces have commits and there is no project
|
|
10
|
+
* release.
|
|
11
|
+
*/
|
|
2
12
|
export declare function buildReleaseSummary(result: Pick<PrepareResult, 'project' | 'workspaces'>): string;
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import type { ChangelogEntry } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Build a synthetic changelog entry for a propagation-only bump.
|
|
4
|
+
*
|
|
5
|
+
* Produces a single `ChangelogEntry` with one `'Dependency updates'` section (audience `'dev'`)
|
|
6
|
+
* containing one item per propagated-from dependency. Pure function: no I/O.
|
|
7
|
+
*/
|
|
2
8
|
export declare function buildSyntheticChangelogEntry(propagatedFrom: ReadonlyArray<{
|
|
3
9
|
packageName: string;
|
|
4
10
|
newVersion: string;
|
|
@@ -1,2 +1,10 @@
|
|
|
1
1
|
import type { ReleaseType } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Bumps a semver version string by the given release type.
|
|
4
|
+
*
|
|
5
|
+
* @param version - A semver version string (e.g., '1.2.3').
|
|
6
|
+
* @param releaseType - The type of release bump to apply.
|
|
7
|
+
* @returns The bumped version string.
|
|
8
|
+
* @throws If the version string is not a valid semver format.
|
|
9
|
+
*/
|
|
2
10
|
export declare function bumpVersion(version: string, releaseType: ReleaseType): string;
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
import type { ChangelogEntry, ReleaseConfig } from './types.js';
|
|
2
|
+
/** Resolve the absolute output path for the `changelog.json` file under a workspace's changelog directory. */
|
|
2
3
|
export declare function resolveChangelogJsonPath(config: Pick<ReleaseConfig, 'changelogJson'>, changelogPath: string): string;
|
|
4
|
+
/** Renders changelog entries as a `changelog.json` file's complete content, sorted newest-first. */
|
|
3
5
|
export declare function renderChangelogJson(entries: ChangelogEntry[]): string;
|
|
6
|
+
/**
|
|
7
|
+
* Merges `entries` with the on-disk entries at `filePath` and returns the merged set in
|
|
8
|
+
* newest-first order, without writing.
|
|
9
|
+
*
|
|
10
|
+
* Preserves entries that exist on disk but are absent from `entries` — load-bearing for
|
|
11
|
+
* synthetic-entry preservation across propagation runs. Reads the file when present; treats a
|
|
12
|
+
* missing or malformed file as an empty existing set, so a malformed file does not abort the
|
|
13
|
+
* release.
|
|
14
|
+
*/
|
|
4
15
|
export declare function mergeChangelogEntriesWithDisk(filePath: string, entries: ChangelogEntry[]): ChangelogEntry[];
|
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
import type { ChangelogEntry, ChangelogItem } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Type guard for `ChangelogItem` values parsed from JSON.
|
|
4
|
+
*
|
|
5
|
+
* Accepts the required `description` plus optional `body`, `breaking`, and `hash` fields. The
|
|
6
|
+
* `hash` field is shape-checked but not required — synthetic propagation entries omit it, and
|
|
7
|
+
* pre-hash `changelog.json` files are still considered valid.
|
|
8
|
+
*/
|
|
2
9
|
export declare function isChangelogItem(value: unknown): value is ChangelogItem;
|
|
10
|
+
/** Type guard for `ChangelogEntry` values parsed from JSON. */
|
|
3
11
|
export declare function isChangelogEntry(value: unknown): value is ChangelogEntry;
|
|
12
|
+
/** Extract the version from a tag by stripping the prefix up to the first digit. */
|
|
4
13
|
export declare function extractVersion(tag: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* Read and parse a changelog JSON file, returning validated entries.
|
|
16
|
+
*
|
|
17
|
+
* Returns `undefined` if the file cannot be read or does not contain a valid array.
|
|
18
|
+
* Silent on parse error — for the warn-and-treat-as-empty variant used by upsert callers,
|
|
19
|
+
* see `readExistingEntries` in `./changelogJsonFile.ts`.
|
|
20
|
+
*/
|
|
5
21
|
export declare function readChangelogEntries(filePath: string): ChangelogEntry[] | undefined;
|
|
@@ -1,53 +1,196 @@
|
|
|
1
1
|
import type { ChangelogEntry, ChangelogOverride, WorkspaceConfig } from './types.js';
|
|
2
|
+
/** Result of loading an override file: either parsed overrides or a list of structured errors. */
|
|
2
3
|
export type LoadChangelogOverridesResult = {
|
|
3
4
|
overrides: Map<string, ChangelogOverride>;
|
|
4
5
|
} | {
|
|
5
6
|
errors: string[];
|
|
6
7
|
};
|
|
8
|
+
/**
|
|
9
|
+
* Load and validate the editorial overrides file at `path`.
|
|
10
|
+
*
|
|
11
|
+
* - Missing file resolves to an empty map (no-op default; matches "absent file → unchanged behavior").
|
|
12
|
+
* - Malformed JSON, wrong top-level shape, or any per-entry validation failure surfaces as
|
|
13
|
+
* structured errors. Callers decide how to surface them.
|
|
14
|
+
*
|
|
15
|
+
* Returns either `{ overrides: Map }` on success or `{ errors: string[] }` on failure. Pure
|
|
16
|
+
* except for the single file read; performs no other I/O.
|
|
17
|
+
*/
|
|
7
18
|
export declare function loadChangelogOverrides(path: string): LoadChangelogOverridesResult;
|
|
19
|
+
/**
|
|
20
|
+
* Validate a parsed override record. Returns the parsed `Map` along with any error messages.
|
|
21
|
+
*
|
|
22
|
+
* Each error names the offending key (e.g. `overrides['abc']: 'audience' must be one of …`)
|
|
23
|
+
* so the consumer can locate it in their override file.
|
|
24
|
+
*/
|
|
8
25
|
export declare function validateChangelogOverrides(raw: unknown): {
|
|
9
26
|
overrides: Map<string, ChangelogOverride>;
|
|
10
27
|
errors: string[];
|
|
11
28
|
};
|
|
29
|
+
/**
|
|
30
|
+
* Format the standard "stale override key" warning. Callers compute the set of stale keys
|
|
31
|
+
* (keys that didn't match anywhere) and use this helper to surface them uniformly. Centralized
|
|
32
|
+
* so single-package and monorepo flows produce identical warning text.
|
|
33
|
+
*/
|
|
12
34
|
export declare function formatStaleOverrideKeyWarning(key: string): string;
|
|
35
|
+
/**
|
|
36
|
+
* Apply overrides to a `ChangelogEntry[]`, returning a new array. Pure: no mutation, no I/O.
|
|
37
|
+
*
|
|
38
|
+
* Match algorithm: each override key is treated as a string-prefix against `ChangelogItem.hash`.
|
|
39
|
+
* - 0 matches → key is recorded as unmatched in this batch (no warning emitted here).
|
|
40
|
+
* - 1 match → apply each present override field to the matched item, record key as matched.
|
|
41
|
+
* - 2+ matches → error (ambiguous prefix).
|
|
42
|
+
*
|
|
43
|
+
* `matchedKeys` lists the override keys that resolved to exactly one item in this batch.
|
|
44
|
+
* Callers are responsible for computing stale-key warnings: in a monorepo run, an override
|
|
45
|
+
* may target a commit that lives in another workspace, so the per-batch zero-match signal is
|
|
46
|
+
* insufficient on its own. Single-package and monorepo orchestrators format warnings using
|
|
47
|
+
* `formatStaleOverrideKeyWarning` after aggregating `matchedKeys` across all apply calls.
|
|
48
|
+
*
|
|
49
|
+
* v1 audience semantics:
|
|
50
|
+
* - `'skip'` removes the matched item from its containing section. Empty sections are pruned.
|
|
51
|
+
* Versions with zero sections still appear (matches existing "empty workspace" behavior).
|
|
52
|
+
* - `'all'` and `'dev'` are validated out before reaching the applier.
|
|
53
|
+
*
|
|
54
|
+
* Items without a `hash` (synthetic propagation entries) are never matched and pass through.
|
|
55
|
+
*
|
|
56
|
+
* The function does not throw; warnings/errors accumulate and are returned alongside the
|
|
57
|
+
* transformed entries so the caller decides whether to abort or log-and-continue.
|
|
58
|
+
*/
|
|
13
59
|
export declare function applyChangelogOverrides(entries: ChangelogEntry[], overrides: Map<string, ChangelogOverride>): {
|
|
14
60
|
entries: ChangelogEntry[];
|
|
15
61
|
warnings: string[];
|
|
16
62
|
errors: string[];
|
|
17
63
|
matchedKeys: string[];
|
|
18
64
|
};
|
|
65
|
+
/**
|
|
66
|
+
* Resolve the conventional override-file path for a given scope root.
|
|
67
|
+
*
|
|
68
|
+
* `scopeRoot` is the directory at which a scope's other artifacts live (e.g., `'.'` for the
|
|
69
|
+
* project, `'packages/foo'` for a workspace). The returned path is repo-relative.
|
|
70
|
+
*/
|
|
19
71
|
export declare function resolveOverridePath(scopeRoot: string): string;
|
|
72
|
+
/** Result of {@link loadOverridesForScopes}: per-scope maps plus accumulated load/validation errors. */
|
|
20
73
|
export interface LoadOverridesForScopesResult {
|
|
74
|
+
/** Project-tier (root) overrides. Empty map when the project file is absent. */
|
|
21
75
|
project: Map<string, ChangelogOverride>;
|
|
76
|
+
/** Workspace-tier overrides keyed by `workspacePath` (e.g., `'packages/foo'`). Empty map when absent. */
|
|
22
77
|
perWorkspace: Map<string, Map<string, ChangelogOverride>>;
|
|
78
|
+
/** All load and validation errors across every requested scope, prefixed with the offending file path. */
|
|
23
79
|
errors: string[];
|
|
24
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* Load and validate every requested override file in one pass.
|
|
83
|
+
*
|
|
84
|
+
* Iterates the configured scope roots, calls {@link loadChangelogOverrides} for each, and
|
|
85
|
+
* aggregates errors across all files (rather than throwing on the first failure) so a
|
|
86
|
+
* consumer who edits multiple files at once sees every problem in one report. Missing files
|
|
87
|
+
* resolve to empty maps — matches the existing single-file behavior.
|
|
88
|
+
*
|
|
89
|
+
* The caller is expected to surface a combined error when `errors.length > 0` and abort the
|
|
90
|
+
* release before any workspace begins writing.
|
|
91
|
+
*/
|
|
25
92
|
export declare function loadOverridesForScopes(scopes: {
|
|
26
93
|
project?: string;
|
|
27
94
|
workspaces?: string[];
|
|
28
95
|
}): LoadOverridesForScopesResult;
|
|
96
|
+
/**
|
|
97
|
+
* Compose root and workspace override maps into a single effective map for one workspace.
|
|
98
|
+
*
|
|
99
|
+
* Byte-equal-key shadowing: when a workspace key string-equals a root key, the workspace
|
|
100
|
+
* entry wins entirely (no field-level merge) and supplants the root entry in the result.
|
|
101
|
+
* Different-prefix keys that happen to resolve to the same commit do NOT shadow here — they
|
|
102
|
+
* fall through to the existing ambiguous-prefix error in {@link applyChangelogOverrides}.
|
|
103
|
+
*
|
|
104
|
+
* Pure: never mutates inputs.
|
|
105
|
+
*/
|
|
29
106
|
export declare function composeOverrides(rootEntries: Map<string, ChangelogOverride>, workspaceEntries: Map<string, ChangelogOverride> | undefined): Map<string, ChangelogOverride>;
|
|
107
|
+
/**
|
|
108
|
+
* Shared override-application context threaded through the per-workspace and project apply
|
|
109
|
+
* sites. Bundles the loaded per-scope maps with the run-scoped warning aggregators so each
|
|
110
|
+
* call site can both consume the maps it needs and report into the same warning channel.
|
|
111
|
+
*
|
|
112
|
+
* `globalMatchedRootKeys` tracks ROOT keys matched in any apply call. Workspace-sourced
|
|
113
|
+
* matched keys are not added here — they're tracked locally per workspace because their
|
|
114
|
+
* stale-key semantics are local (a workspace key that doesn't match in its own workspace is
|
|
115
|
+
* unambiguously stale and is warned immediately, not aggregated to end-of-run).
|
|
116
|
+
*/
|
|
30
117
|
export interface OverrideContext {
|
|
31
118
|
project: Map<string, ChangelogOverride>;
|
|
32
119
|
perWorkspace: Map<string, Map<string, ChangelogOverride>>;
|
|
33
120
|
overrideWarnings: string[];
|
|
34
121
|
globalMatchedRootKeys: Set<string>;
|
|
35
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* Load all per-scope override files (root + every workspace) in one upfront pass, validate
|
|
125
|
+
* them, and bundle the results with run-scoped warning aggregators. Aborts the release with
|
|
126
|
+
* a clear error when any file is malformed — checked-in editorial config that does not parse
|
|
127
|
+
* is a bug, and we want the prepare run to fail before any workspace begins writing.
|
|
128
|
+
*/
|
|
36
129
|
export declare function createOverrideContext(workspaces: WorkspaceConfig[]): OverrideContext;
|
|
130
|
+
/** Per-scope input to {@link validateAllChangelogOverrides}. */
|
|
37
131
|
export interface ChangelogOverrideScope {
|
|
132
|
+
/** Path to the override file (relative to the repo root). Used to load the file and to attribute findings. */
|
|
38
133
|
filePath: string;
|
|
134
|
+
/** Commit hashes in this scope's history window. Each override key is matched against these. */
|
|
39
135
|
hashes: readonly string[];
|
|
40
136
|
}
|
|
137
|
+
/** Inputs to {@link validateAllChangelogOverrides}. */
|
|
41
138
|
export interface ValidateAllChangelogOverridesInputs {
|
|
139
|
+
/**
|
|
140
|
+
* Project-tier scope (the override file at the repo root).
|
|
141
|
+
*
|
|
142
|
+
* The file at `filePath` is loaded once and used in two ways:
|
|
143
|
+
* - Its overrides are composed into every workspace's apply (root-tier overrides apply globally).
|
|
144
|
+
* - When `hashes` is provided, the project map is also applied directly to that hash universe
|
|
145
|
+
* (project release in monorepo mode, or the package's history in single-package mode).
|
|
146
|
+
*
|
|
147
|
+
* Omit when no project file exists (rare — most repos have a root file even if empty).
|
|
148
|
+
*/
|
|
42
149
|
project?: {
|
|
43
150
|
filePath: string;
|
|
44
151
|
hashes?: readonly string[];
|
|
45
152
|
};
|
|
153
|
+
/** Per-workspace scopes. Each workspace's file applies only to its own hash universe. */
|
|
46
154
|
workspaces?: readonly ChangelogOverrideScope[];
|
|
47
155
|
}
|
|
156
|
+
/** Result of {@link validateAllChangelogOverrides}: aggregated errors and warnings, each prefixed with the file path it pertains to. */
|
|
48
157
|
export interface ValidateAllChangelogOverridesResult {
|
|
49
158
|
errors: string[];
|
|
50
159
|
warnings: string[];
|
|
51
160
|
}
|
|
161
|
+
/**
|
|
162
|
+
* End-to-end health check across every override file and scope. Pure: takes already-collected
|
|
163
|
+
* hash universes and returns aggregated findings. The CLI command and any other consumer
|
|
164
|
+
* (programmatic library callers, future composite checks) wrap this with discovery and I/O.
|
|
165
|
+
*
|
|
166
|
+
* When invoked via the standard `validateOverridesCommand` entry point, each scope's
|
|
167
|
+
* `hashes` is built by `buildChangelogEntries` — the same path `release-kit prepare` walks —
|
|
168
|
+
* so the match-set is byte-equal to what `prepare` would compute. The tier asymmetry is part
|
|
169
|
+
* of that contract: workspace-tier keys are stale if they don't match in their own workspace;
|
|
170
|
+
* root-tier keys are stale only if they don't match in any scope (no workspace AND not the
|
|
171
|
+
* project release window). Library callers that construct `inputs` directly are responsible
|
|
172
|
+
* for supplying the same hash universes if they want this guarantee.
|
|
173
|
+
*
|
|
174
|
+
* Every returned string is prefixed with the relative override-file path it pertains to so
|
|
175
|
+
* consumers can locate the offending file without further structuring.
|
|
176
|
+
*/
|
|
52
177
|
export declare function validateAllChangelogOverrides(inputs: ValidateAllChangelogOverridesInputs): ValidateAllChangelogOverridesResult;
|
|
178
|
+
/**
|
|
179
|
+
* Apply the composed (root + workspace) override map to a workspace's changelog entries and
|
|
180
|
+
* report stale-key warnings tier-by-tier.
|
|
181
|
+
*
|
|
182
|
+
* The composed map is applied in a single {@link applyChangelogOverrides} call. Matched keys
|
|
183
|
+
* are demultiplexed by source via `Map.has` lookups on the original (uncomposed) maps so the
|
|
184
|
+
* stale-key semantics stay tier-aware:
|
|
185
|
+
*
|
|
186
|
+
* - Workspace-sourced keys (those present in the per-workspace map, regardless of whether
|
|
187
|
+
* the root map also has the same byte-equal key) that did NOT match are unambiguously
|
|
188
|
+
* stale in their own apply context — push an immediate stale warning naming the key.
|
|
189
|
+
* - Root-sourced matched keys (present in root, absent from this workspace's map) are added
|
|
190
|
+
* to `globalMatchedRootKeys` so the orchestrator's end-of-run loop can dedupe across
|
|
191
|
+
* batches and warn only on root keys that matched nowhere.
|
|
192
|
+
*
|
|
193
|
+
* Throws when any apply call surfaces an error (e.g. ambiguous prefix). Returns the applied
|
|
194
|
+
* result so the caller can consume `applied.entries` for downstream rendering.
|
|
195
|
+
*/
|
|
53
196
|
export declare function applyWorkspaceOverrides(newEntries: ChangelogEntry[], workspacePath: string, overrideContext: OverrideContext): ReturnType<typeof applyChangelogOverrides>;
|
|
@@ -1,11 +1,36 @@
|
|
|
1
|
+
/** URL of the upstream canonical `work-types.json` published by codeassembly. */
|
|
1
2
|
export declare const UPSTREAM_WORK_TYPES_URL = "https://raw.githubusercontent.com/williamthorsen/codeassembly/main/packages/agents/content/skills/_data/work-types.json";
|
|
3
|
+
/** Outcome of a drift check, paired with a human-readable message. */
|
|
2
4
|
export interface DriftCheckResult {
|
|
5
|
+
/**
|
|
6
|
+
* Process exit code semantics:
|
|
7
|
+
* - `0` — match (or upstream missing/transitional, with a warning).
|
|
8
|
+
* - `1` — drift detected.
|
|
9
|
+
* - `2` — network error.
|
|
10
|
+
* - `3` — schema mismatch (upstream JSON does not parse or fails the schema invariants).
|
|
11
|
+
*/
|
|
3
12
|
exitCode: 0 | 1 | 2 | 3;
|
|
4
13
|
message: string;
|
|
5
14
|
}
|
|
15
|
+
/** Minimal injection seam so unit tests can substitute a deterministic fetcher. */
|
|
6
16
|
export interface CheckWorkTypesDriftDependencies {
|
|
17
|
+
/** Absolute path of the local `work-types.json`. Defaults to the bundled file. */
|
|
7
18
|
localPath?: string;
|
|
19
|
+
/** HTTP fetcher. Defaults to global `fetch` (Node 18+). */
|
|
8
20
|
fetch?: typeof globalThis.fetch;
|
|
21
|
+
/** Override the upstream URL (used by tests; production callers should leave default). */
|
|
9
22
|
upstreamUrl?: string;
|
|
10
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Compare the bundled `work-types.json` against the upstream codeassembly canonical and
|
|
26
|
+
* report drift.
|
|
27
|
+
*
|
|
28
|
+
* Failure modes:
|
|
29
|
+
* - Network error → exit 2 with a diagnostic.
|
|
30
|
+
* - Upstream 404 → exit 0 with a transitional warning (codeassembly hasn't published the
|
|
31
|
+
* JSON yet; the check is informational while migration is in flight).
|
|
32
|
+
* - Schema mismatch → exit 3 with a diagnostic.
|
|
33
|
+
* - Drift → exit 1 with a unified-diff-style message.
|
|
34
|
+
* - Match → exit 0.
|
|
35
|
+
*/
|
|
11
36
|
export declare function checkWorkTypesDrift(dependencies?: CheckWorkTypesDriftDependencies): Promise<DriftCheckResult>;
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import type { PolicyViolationHandler } from './parseCommitMessage.js';
|
|
2
2
|
import type { PolicyViolation } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Build a fresh `policyViolations` accumulator paired with the `onPolicyViolation` callback
|
|
5
|
+
* that pushes structured entries into it.
|
|
6
|
+
*
|
|
7
|
+
* Used by all three release-prepare orchestrators (`releasePrepare`, `releasePrepareMono`,
|
|
8
|
+
* `releasePrepareProject`) to collect parser-side `!`-policy violations into a result-attachable
|
|
9
|
+
* array. Centralizing the callback shape keeps the `commitSubject` extraction rule (`firstLine
|
|
10
|
+
* post-split`) consistent across orchestrators.
|
|
11
|
+
*/
|
|
3
12
|
export declare function createPolicyViolationCollector(): {
|
|
4
13
|
violations: PolicyViolation[];
|
|
5
14
|
onPolicyViolation: PolicyViolationHandler;
|
|
@@ -1 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Return true when `target` is strictly greater than `current`, comparing major, minor, then patch.
|
|
3
|
+
*
|
|
4
|
+
* Equal versions return false. Comparison is numeric (not lexical), so `0.10.0` is greater than `0.9.0`.
|
|
5
|
+
*
|
|
6
|
+
* @throws If either version is not canonical `N.N.N` semver.
|
|
7
|
+
*/
|
|
1
8
|
export declare function isForwardVersion(current: string, target: string): boolean;
|