@kitschpatrol/chagent 0.4.0 → 0.6.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 +5 -5
- package/dist/lib/bumpp.d.ts +1 -1
- package/dist/lib/bumpp.js +2 -2
- package/dist/lib/index.d.ts +8 -3
- package/dist/lib/index.js +2 -2
- package/dist/{lib-Byxdn2st.js → lib-BkbC8akL.js} +18 -10
- package/dist/{progress-DQtRnH1N.js → progress-BYDpiH8C.js} +1 -1
- package/dist/{review-DftIAoEl.js → review-cNqsjqhu.js} +577 -324
- package/dist/{types-B6FOOkTQ.d.ts → types-B-sACYE9.d.ts} +18 -2
- package/package.json +3 -3
- package/readme.md +14 -12
package/dist/bin/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { C as
|
|
3
|
-
import { n as assertAmendable, t as amendRelease } from "../lib-
|
|
4
|
-
import { t as createProgressLine } from "../progress-
|
|
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-cNqsjqhu.js";
|
|
3
|
+
import { n as assertAmendable, t as amendRelease } from "../lib-BkbC8akL.js";
|
|
4
|
+
import { t as createProgressLine } from "../progress-BYDpiH8C.js";
|
|
5
5
|
import { createLogger } from "lognow";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import yargs from "yargs";
|
|
@@ -144,7 +144,7 @@ try {
|
|
|
144
144
|
return true;
|
|
145
145
|
}), async (args) => {
|
|
146
146
|
if (!args.dryRun && args.interactive) assertReviewTerminal();
|
|
147
|
-
if (!args.dryRun && args.amend) await assertAmendable(args.cwd);
|
|
147
|
+
if (!args.dryRun && args.amend) await assertAmendable(args.cwd, { configFile: args.config });
|
|
148
148
|
const reporter = createReporter(args.verbose, controller.signal);
|
|
149
149
|
let plan = await reporter.track(async () => generateChangelog({
|
|
150
150
|
agent: args.agent,
|
|
@@ -177,7 +177,7 @@ try {
|
|
|
177
177
|
}
|
|
178
178
|
plan = reviewed;
|
|
179
179
|
}
|
|
180
|
-
if (args.amend) await amendRelease(plan);
|
|
180
|
+
if (args.amend) await amendRelease(plan, { configFile: args.config });
|
|
181
181
|
else await writeChangelog(plan);
|
|
182
182
|
} finally {
|
|
183
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,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as createProgressLine } from "../progress-
|
|
1
|
+
import { a as writeChangelog, g as localDate, i as generateChangelog, r as reviewChangelog, t as assertReviewTerminal, y as git } from "../review-cNqsjqhu.js";
|
|
2
|
+
import { t as createProgressLine } from "../progress-BYDpiH8C.js";
|
|
3
3
|
|
|
4
4
|
// src/lib/bumpp.ts
|
|
5
5
|
const TAG_TOKEN = /\{(version|oldVersion|tag|releaseType|major|minor|patch|date)\}/gv;
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
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-
|
|
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 RootChangelog, 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-cNqsjqhu.js";
|
|
2
|
+
import { t as amendRelease } from "../lib-BkbC8akL.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-cNqsjqhu.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.");
|
|
@@ -38,7 +38,7 @@ function createProgressLine(stream) {
|
|
|
38
38
|
tick += 1;
|
|
39
39
|
const elapsed = formatElapsed(performance.now() - started);
|
|
40
40
|
const { columns = 0 } = stream;
|
|
41
|
-
const width = columns > 0 ? Math.max(0, columns - 1 - frame.length - 2) :
|
|
41
|
+
const width = columns > 0 ? Math.max(0, columns - 1 - frame.length - 2) : 1e400;
|
|
42
42
|
const text = `${message.slice(0, Math.max(0, width - elapsed.length - 1))} ${elapsed}`.slice(0, width);
|
|
43
43
|
return `\r${styleText("magenta", frame, { stream })}${FRAME_PADDING}${text}${CLEAR_TO_LINE_END}`;
|
|
44
44
|
};
|