@kud/ai-conventional-commit-cli 3.2.3 → 3.2.6
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/{chunk-IWJLYYKM.js → chunk-EHJXGWTJ.js} +3 -19
- package/dist/{chunk-OLEHSPCO.js → chunk-GZ5XLAI5.js} +85 -17
- package/dist/index.cjs +1200 -0
- package/dist/index.d.cts +1 -0
- package/dist/index.js +60 -44
- package/dist/{reword-3MH2DYFS.js → reword-BKQ7K33J.js} +1 -1
- package/dist/{reword-6EWRZ6WZ.js → reword-PNW5XREC.js} +3 -1
- package/dist/{reword-3JBE7MPQ.js → reword-QQO7UBGM.js} +2 -0
- package/package.json +1 -1
- package/dist/chunk-2WRUFO3O.js +0 -689
- package/dist/chunk-2X3JJVRR.js +0 -639
- package/dist/chunk-7FBRAH4R.js +0 -643
- package/dist/chunk-7U4J2ORD.js +0 -614
- package/dist/chunk-CC3NIT53.js +0 -650
- package/dist/chunk-CLQ6OPLU.js +0 -668
- package/dist/chunk-F3BOAVBY.js +0 -122
- package/dist/chunk-FYJNHXAR.js +0 -700
- package/dist/chunk-H4W6AMGZ.js +0 -549
- package/dist/chunk-HJR5M6U7.js +0 -120
- package/dist/chunk-HOUMTU6H.js +0 -699
- package/dist/chunk-KEEMHNNS.js +0 -628
- package/dist/chunk-RHXNXVGI.js +0 -621
- package/dist/chunk-SNV4RWS4.js +0 -696
- package/dist/chunk-W7OC77AV.js +0 -649
- package/dist/chunk-WFXVVHL2.js +0 -645
- package/dist/chunk-YIXP5EWA.js +0 -545
- package/dist/chunk-YRVQGOVW.js +0 -649
- package/dist/chunk-ZLYMV2NJ.js +0 -644
- package/dist/config-C3S4LWLD.js +0 -12
- package/dist/config-RHGCFLHQ.js +0 -12
- package/dist/reword-2ASH5EH5.js +0 -212
- package/dist/reword-CZDYMQEV.js +0 -150
- package/dist/reword-D5YVSCPO.js +0 -212
- package/dist/reword-ESY2TLBT.js +0 -212
- package/dist/reword-FE5N4MGV.js +0 -150
- package/dist/reword-IN2D2J4H.js +0 -212
- package/dist/reword-JRE6KAF7.js +0 -212
- package/dist/reword-KIR2DMTO.js +0 -212
- package/dist/reword-KUE3IVBE.js +0 -212
- package/dist/reword-LIVSGNUN.js +0 -212
- package/dist/reword-MCQOCOZ2.js +0 -212
- package/dist/reword-NGEKVTD6.js +0 -212
- package/dist/reword-PEOUOAT7.js +0 -212
- package/dist/reword-Q7MES34W.js +0 -212
- package/dist/reword-T44WTP5I.js +0 -212
- package/dist/reword-UA3EG7DK.js +0 -212
- package/dist/reword-UE5IP5V3.js +0 -212
- package/dist/reword-VKG5G6CB.js +0 -212
- package/dist/reword-VRH7B6BE.js +0 -205
- package/dist/reword-WFCNTOEU.js +0 -203
- package/dist/reword-XWYWVQRZ.js +0 -212
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
package/dist/index.js
CHANGED
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
formatCommitTitle,
|
|
17
17
|
renderCommitBlock,
|
|
18
18
|
sectionTitle
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-GZ5XLAI5.js";
|
|
20
20
|
|
|
21
21
|
// src/index.ts
|
|
22
22
|
import { Cli, Command, Option } from "clipanion";
|
|
@@ -216,15 +216,20 @@ async function runGenerate(config) {
|
|
|
216
216
|
const startedAt = Date.now();
|
|
217
217
|
const provider = new OpenCodeProvider(config.model);
|
|
218
218
|
provider.warmup();
|
|
219
|
+
try {
|
|
220
|
+
await _runGenerate(provider, config, dbg, startedAt);
|
|
221
|
+
} finally {
|
|
222
|
+
await provider.close();
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
async function _runGenerate(provider, config, dbg, startedAt) {
|
|
219
226
|
const { files, hasStagedChanges } = await getStagedFilesAndDiff();
|
|
220
227
|
dbg("staged files", { files: files.length, hasStagedChanges });
|
|
221
228
|
if (!hasStagedChanges) {
|
|
222
|
-
await provider.close();
|
|
223
229
|
console.log("No staged changes.");
|
|
224
230
|
return;
|
|
225
231
|
}
|
|
226
232
|
if (!files.length) {
|
|
227
|
-
await provider.close();
|
|
228
233
|
console.log("No diff content detected after staging. Aborting.");
|
|
229
234
|
return;
|
|
230
235
|
}
|
|
@@ -411,6 +416,13 @@ async function runSplit(config, desired) {
|
|
|
411
416
|
const startedAt = Date.now();
|
|
412
417
|
const provider = new OpenCodeProvider(config.model);
|
|
413
418
|
provider.warmup();
|
|
419
|
+
try {
|
|
420
|
+
return await _runSplit(provider, config, desired, startedAt);
|
|
421
|
+
} finally {
|
|
422
|
+
await provider.close();
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
async function _runSplit(provider, config, desired, startedAt) {
|
|
414
426
|
const { files, hasStagedChanges } = await getStagedFilesAndDiff();
|
|
415
427
|
if (!hasStagedChanges) {
|
|
416
428
|
console.log("No staged changes.");
|
|
@@ -643,49 +655,53 @@ async function runRefine(config, options) {
|
|
|
643
655
|
const phased = createPhasedSpinner(ora3);
|
|
644
656
|
const runStep = (label, fn) => phased.step(label, fn);
|
|
645
657
|
const provider = new OpenCodeProvider(config.model);
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
658
|
+
try {
|
|
659
|
+
const messages = await runStep(
|
|
660
|
+
"Building prompt",
|
|
661
|
+
async () => buildRefineMessages({ originalPlan: plan, index, instructions, config })
|
|
662
|
+
);
|
|
663
|
+
const raw = await runStep(
|
|
664
|
+
"Calling model",
|
|
665
|
+
async () => provider.chat(messages, { maxTokens: config.maxTokens })
|
|
666
|
+
);
|
|
667
|
+
const refinedPlan = await runStep("Parsing response", async () => extractJSON(raw));
|
|
668
|
+
refinedPlan.commits[0].title = formatCommitTitle(refinedPlan.commits[0].title, {
|
|
669
|
+
allowGitmoji: config.style === "gitmoji" || config.style === "gitmoji-pure",
|
|
670
|
+
mode: config.style
|
|
671
|
+
});
|
|
672
|
+
phased.phase("Suggested commit");
|
|
673
|
+
phased.stop();
|
|
674
|
+
sectionTitle("Suggested commit");
|
|
675
|
+
renderCommitBlock({
|
|
676
|
+
title: refinedPlan.commits[0].title,
|
|
677
|
+
body: refinedPlan.commits[0].body,
|
|
678
|
+
titleColor: (s) => chalk3.yellow(s)
|
|
679
|
+
});
|
|
680
|
+
borderLine();
|
|
681
|
+
const ok = config.yes || (await inquirer.prompt([
|
|
682
|
+
{
|
|
683
|
+
type: "list",
|
|
684
|
+
name: "ok",
|
|
685
|
+
message: "Use the commit?",
|
|
686
|
+
choices: [
|
|
687
|
+
{ name: "Yes", value: true },
|
|
688
|
+
{ name: "No", value: false }
|
|
689
|
+
],
|
|
690
|
+
default: 0
|
|
691
|
+
}
|
|
692
|
+
])).ok;
|
|
693
|
+
if (!ok) {
|
|
694
|
+
borderLine();
|
|
695
|
+
abortMessage();
|
|
696
|
+
return;
|
|
678
697
|
}
|
|
679
|
-
|
|
680
|
-
|
|
698
|
+
session.plan.commits[index] = refinedPlan.commits[0];
|
|
699
|
+
saveSession3(session);
|
|
681
700
|
borderLine();
|
|
682
|
-
|
|
683
|
-
|
|
701
|
+
finalSuccess({ count: 1, startedAt });
|
|
702
|
+
} finally {
|
|
703
|
+
await provider.close();
|
|
684
704
|
}
|
|
685
|
-
session.plan.commits[index] = refinedPlan.commits[0];
|
|
686
|
-
saveSession3(session);
|
|
687
|
-
borderLine();
|
|
688
|
-
finalSuccess({ count: 1, startedAt });
|
|
689
705
|
}
|
|
690
706
|
|
|
691
707
|
// src/index.ts
|
|
@@ -1063,7 +1079,7 @@ var RewordCommand = class extends Command {
|
|
|
1063
1079
|
description: "Auto-confirm commit without prompting"
|
|
1064
1080
|
});
|
|
1065
1081
|
async execute() {
|
|
1066
|
-
const { runReword } = await import("./reword-
|
|
1082
|
+
const { runReword } = await import("./reword-PNW5XREC.js");
|
|
1067
1083
|
const config = await loadConfig();
|
|
1068
1084
|
if (this.style) config.style = this.style;
|
|
1069
1085
|
if (this.model) config.model = this.model;
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
formatCommitTitle,
|
|
11
11
|
renderCommitBlock,
|
|
12
12
|
sectionTitle
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-GZ5XLAI5.js";
|
|
14
14
|
|
|
15
15
|
// src/workflow/reword.ts
|
|
16
16
|
import chalk from "chalk";
|
|
@@ -94,6 +94,8 @@ async function runReword(config, hash) {
|
|
|
94
94
|
} catch (e) {
|
|
95
95
|
phased.spinner.fail("Reword failed: " + (e?.message || e));
|
|
96
96
|
return;
|
|
97
|
+
} finally {
|
|
98
|
+
await provider.close();
|
|
97
99
|
}
|
|
98
100
|
phased.stop();
|
|
99
101
|
if (!refined || !refined.commits.length) {
|
package/package.json
CHANGED