@kitschpatrol/chagent 0.3.0 → 0.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/dist/bin/cli.js +16 -4
- package/dist/lib/bumpp.d.ts +1 -1
- package/dist/lib/bumpp.js +1 -1
- package/dist/lib/index.d.ts +8 -3
- package/dist/lib/index.js +2 -2
- package/dist/{lib-advgvAk1.js → lib-DVZXk4YE.js} +18 -10
- package/dist/{review-ClBbl31P.js → review-Bl10DPO7.js} +602 -311
- package/dist/{types-COQP1I5w.d.ts → types-B-sACYE9.d.ts} +27 -3
- package/package.json +1 -1
- package/readme.md +37 -30
package/dist/bin/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { C as version, S as maxTimeoutMinutes,
|
|
3
|
-
import { n as assertAmendable, t as amendRelease } from "../lib-
|
|
2
|
+
import { C as defaultModels, E as version, S as setLogger, T as maxTimeoutMinutes, a as writeChangelog, d as efforts, f as rootChangelogs, i as generateChangelog, n as previewChangelog, r as reviewChangelog, t as assertReviewTerminal, u as agentNames, w as defaults } from "../review-Bl10DPO7.js";
|
|
3
|
+
import { n as assertAmendable, t as amendRelease } from "../lib-DVZXk4YE.js";
|
|
4
4
|
import { t as createProgressLine } from "../progress-DQtRnH1N.js";
|
|
5
5
|
import { createLogger } from "lognow";
|
|
6
6
|
import path from "node:path";
|
|
@@ -109,6 +109,16 @@ try {
|
|
|
109
109
|
default: false,
|
|
110
110
|
description: "Amend a verified unpublished release commit and matching local tags",
|
|
111
111
|
type: "boolean"
|
|
112
|
+
}).option("root-changelog", {
|
|
113
|
+
choices: rootChangelogs,
|
|
114
|
+
defaultDescription: defaults.rootChangelog,
|
|
115
|
+
description: "Monorepo root changelog: a summary of package releases, the root package alone, or none",
|
|
116
|
+
type: "string"
|
|
117
|
+
}).option("skip-package", {
|
|
118
|
+
array: true,
|
|
119
|
+
defaultDescription: "none",
|
|
120
|
+
description: "Workspace package directory glob to leave without a changelog; repeatable",
|
|
121
|
+
type: "string"
|
|
112
122
|
}).option("github", {
|
|
113
123
|
defaultDescription: String(defaults.github),
|
|
114
124
|
description: "Enrich Git evidence using gh when available; disable with --no-github",
|
|
@@ -134,7 +144,7 @@ try {
|
|
|
134
144
|
return true;
|
|
135
145
|
}), async (args) => {
|
|
136
146
|
if (!args.dryRun && args.interactive) assertReviewTerminal();
|
|
137
|
-
if (!args.dryRun && args.amend) await assertAmendable(args.cwd);
|
|
147
|
+
if (!args.dryRun && args.amend) await assertAmendable(args.cwd, { configFile: args.config });
|
|
138
148
|
const reporter = createReporter(args.verbose, controller.signal);
|
|
139
149
|
let plan = await reporter.track(async () => generateChangelog({
|
|
140
150
|
agent: args.agent,
|
|
@@ -148,7 +158,9 @@ try {
|
|
|
148
158
|
reporter.report(message);
|
|
149
159
|
},
|
|
150
160
|
rebuild: args.rebuild,
|
|
161
|
+
rootChangelog: args.rootChangelog,
|
|
151
162
|
signal: controller.signal,
|
|
163
|
+
skipPackage: args.skipPackage,
|
|
152
164
|
timeout: args.timeout
|
|
153
165
|
}));
|
|
154
166
|
try {
|
|
@@ -165,7 +177,7 @@ try {
|
|
|
165
177
|
}
|
|
166
178
|
plan = reviewed;
|
|
167
179
|
}
|
|
168
|
-
if (args.amend) await amendRelease(plan);
|
|
180
|
+
if (args.amend) await amendRelease(plan, { configFile: args.config });
|
|
169
181
|
else await writeChangelog(plan);
|
|
170
182
|
} finally {
|
|
171
183
|
for (const diagnostic of plan.diagnostics) process.stderr.write(diagnostic + "\n");
|
package/dist/lib/bumpp.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { u as GenerateOptions } from "../types-
|
|
1
|
+
import { u as GenerateOptions } from "../types-B-sACYE9.js";
|
|
2
2
|
import { VersionBumpOptions } from "bumpp";
|
|
3
3
|
type ExecuteHook = Exclude<NonNullable<VersionBumpOptions['execute']>, string>;
|
|
4
4
|
export type BumppHookOptions = Omit<GenerateOptions, 'cwd' | 'release'> & {
|
package/dist/lib/bumpp.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as writeChangelog, g as localDate, i as generateChangelog, r as reviewChangelog, t as assertReviewTerminal, y as git } from "../review-Bl10DPO7.js";
|
|
2
2
|
import { t as createProgressLine } from "../progress-DQtRnH1N.js";
|
|
3
3
|
|
|
4
4
|
// src/lib/bumpp.ts
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
|
-
import { _ as
|
|
1
|
+
import { _ as RunSettings, a as ChangeSet, b as loadConfig, c as Evidence, d as GenerationRequest, f as GenerationResponse, g as RootChangelog, h as ReleaseSummary, i as Change, l as FileEdit, m as ReleaseRequest, n as AgentName, o as ChangelogPlan, p as ReleaseContext, r as Category, s as Effort, t as AgentAdapter, u as GenerateOptions, v as Config, y as defineConfig } from "../types-B-sACYE9.js";
|
|
2
2
|
import { ILogBasic, ILogLayer } from "lognow";
|
|
3
3
|
/** Create an adapter for an installed CLI using its existing authentication. */
|
|
4
4
|
export declare function createAgent(name: AgentName): AgentAdapter;
|
|
5
|
+
/**
|
|
6
|
+
* How to find the release's packages and tags. Repository configuration applies
|
|
7
|
+
* as it does to generation, so pass only what generation was passed.
|
|
8
|
+
*/
|
|
9
|
+
type AmendOptions = Pick<GenerateOptions, 'configFile' | 'exclude' | 'packages' | 'tagPatterns'>;
|
|
5
10
|
/**
|
|
6
11
|
* Explicitly amend an unpublished version-only release and its matching local
|
|
7
12
|
* tags.
|
|
8
13
|
*/
|
|
9
|
-
export declare function amendRelease(plan: ChangelogPlan): Promise<string>;
|
|
14
|
+
export declare function amendRelease(plan: ChangelogPlan, options?: AmendOptions): Promise<string>;
|
|
10
15
|
/** Generate reviewable edits from Git history without changing tracked files. */
|
|
11
16
|
export declare function generateChangelog(options?: GenerateOptions): Promise<ChangelogPlan>;
|
|
12
17
|
/**
|
|
@@ -28,4 +33,4 @@ export declare function reviewChangelog(plan: ChangelogPlan, options?: {
|
|
|
28
33
|
* writes.
|
|
29
34
|
*/
|
|
30
35
|
export declare function writeChangelog(plan: ChangelogPlan): Promise<string[]>;
|
|
31
|
-
export { type AgentAdapter, type AgentName, type Category, type Change, type ChangeSet, type ChangelogPlan, type Config, type Effort, type Evidence, type FileEdit, type GenerateOptions, type GenerationRequest, type GenerationResponse, type ReleaseContext, type ReleaseRequest, type ReleaseSummary, type RunSettings, defineConfig, loadConfig };
|
|
36
|
+
export { type AgentAdapter, type AgentName, type AmendOptions, type Category, type Change, type ChangeSet, type ChangelogPlan, type Config, type Effort, type Evidence, type FileEdit, type GenerateOptions, type GenerationRequest, type GenerationResponse, type ReleaseContext, type ReleaseRequest, type ReleaseSummary, type RootChangelog, type RunSettings, defineConfig, loadConfig };
|
package/dist/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as amendRelease } from "../lib-
|
|
1
|
+
import { S as setLogger, a as writeChangelog, i as generateChangelog, l as createAgent, n as previewChangelog, o as defineConfig, r as reviewChangelog, s as loadConfig } from "../review-Bl10DPO7.js";
|
|
2
|
+
import { t as amendRelease } from "../lib-DVZXk4YE.js";
|
|
3
3
|
|
|
4
4
|
export { amendRelease, createAgent, defineConfig, generateChangelog, loadConfig, previewChangelog, reviewChangelog, setLogger, writeChangelog };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { _ as
|
|
1
|
+
import { _ as manifestAt, a as writeChangelog, b as isAncestor, c as resolveConfig, h as isVersionOnlyChange, m as inspectRepository, p as LOCKFILE_PATH, s as loadConfig, v as tagVersion, x as runCommand, y as git } from "./review-Bl10DPO7.js";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { realpath } from "node:fs/promises";
|
|
4
|
+
import semver from "semver";
|
|
4
5
|
|
|
5
6
|
// src/lib/amend.ts
|
|
6
7
|
const SIGNATURE = /-----BEGIN (?:PGP|SSH) SIGNATURE-----/v;
|
|
7
|
-
const RELEASE_MESSAGE = /^(?:release\b|(?:chore|build)(?:\(release\))?:?\s*(?:release\b|v?\d))/iv;
|
|
8
|
+
const RELEASE_MESSAGE = /^(?:v?\d+\.\d+\.\d+|release\b|(?:chore|build)(?:\(release\))?:?\s*(?:release\b|v?\d))/iv;
|
|
8
9
|
async function assertUnpublished(root, head, tags) {
|
|
9
10
|
const remotes = await git(root, ["remote"]);
|
|
10
11
|
for (const remote of remotes.split("\n")) {
|
|
@@ -32,7 +33,7 @@ async function assertUnpublished(root, head, tags) {
|
|
|
32
33
|
}
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
|
-
async function inspectRelease(root, head) {
|
|
36
|
+
async function inspectRelease(root, head, options) {
|
|
36
37
|
if (await git(root, [
|
|
37
38
|
"symbolic-ref",
|
|
38
39
|
"-q",
|
|
@@ -52,8 +53,12 @@ async function inspectRelease(root, head) {
|
|
|
52
53
|
]);
|
|
53
54
|
if (!RELEASE_MESSAGE.test(subject)) throw new Error("HEAD does not have a recognizable release commit message. Use the bumpp hook for automatic release integration.");
|
|
54
55
|
await assertVersionBump(root, head);
|
|
55
|
-
const
|
|
56
|
-
const
|
|
56
|
+
const { configFile, ...overrides } = options;
|
|
57
|
+
const { exclude, packages, tagPatterns } = resolveConfig(await loadConfig(root, configFile), overrides);
|
|
58
|
+
const repository = await inspectRepository(root, {
|
|
59
|
+
exclude,
|
|
60
|
+
packages
|
|
61
|
+
});
|
|
57
62
|
const names = await git(root, [
|
|
58
63
|
"tag",
|
|
59
64
|
"--points-at",
|
|
@@ -62,7 +67,10 @@ async function inspectRelease(root, head) {
|
|
|
62
67
|
const tags = [];
|
|
63
68
|
for (const name of names.split("\n")) {
|
|
64
69
|
if (name === "") continue;
|
|
65
|
-
if (
|
|
70
|
+
if (![repository.rootPackage, ...repository.packages].some((pkg) => {
|
|
71
|
+
const version = semver.valid(pkg.version);
|
|
72
|
+
return version !== null && tagVersion(name, pkg, tagPatterns)?.version === version;
|
|
73
|
+
})) throw new Error(`HEAD also has an unrelated tag (${name}); refusing to move it.`);
|
|
66
74
|
const object = await git(root, ["rev-parse", `refs/tags/${name}`]);
|
|
67
75
|
const contents = await tagContents(root, object);
|
|
68
76
|
if (contents !== void 0 && SIGNATURE.test(contents)) throw new Error(`Tag ${name} is signed. Use the bumpp hook before tagging, or re-sign this release manually.`);
|
|
@@ -88,17 +96,17 @@ async function tagContents(root, object) {
|
|
|
88
96
|
], { cwd: root })).stdout;
|
|
89
97
|
}
|
|
90
98
|
/** Refuse an ineligible amendment before generation spends an agent session. */
|
|
91
|
-
async function assertAmendable(cwd) {
|
|
99
|
+
async function assertAmendable(cwd, options = {}) {
|
|
92
100
|
const root = await realpath(await git(cwd, ["rev-parse", "--show-toplevel"]));
|
|
93
|
-
await inspectRelease(root, await git(root, ["rev-parse", "HEAD"]));
|
|
101
|
+
await inspectRelease(root, await git(root, ["rev-parse", "HEAD"]), options);
|
|
94
102
|
}
|
|
95
103
|
/**
|
|
96
104
|
* Explicitly amend an unpublished version-only release and its matching local
|
|
97
105
|
* tags.
|
|
98
106
|
*/
|
|
99
|
-
async function amendRelease(plan) {
|
|
107
|
+
async function amendRelease(plan, options = {}) {
|
|
100
108
|
if (await git(plan.root, ["rev-parse", "HEAD"]) !== plan.head) throw new Error("HEAD changed during generation; refusing to amend.");
|
|
101
|
-
const tags = await inspectRelease(plan.root, plan.head);
|
|
109
|
+
const tags = await inspectRelease(plan.root, plan.head, options);
|
|
102
110
|
const files = await writeChangelog(plan);
|
|
103
111
|
if (files.length === 0) return plan.head;
|
|
104
112
|
if (await git(plan.root, ["rev-parse", "HEAD"]) !== plan.head) throw new Error("HEAD changed while writing changelogs; refusing to amend.");
|