@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.
Files changed (51) hide show
  1. package/dist/{chunk-IWJLYYKM.js → chunk-EHJXGWTJ.js} +3 -19
  2. package/dist/{chunk-OLEHSPCO.js → chunk-GZ5XLAI5.js} +85 -17
  3. package/dist/index.cjs +1200 -0
  4. package/dist/index.d.cts +1 -0
  5. package/dist/index.js +60 -44
  6. package/dist/{reword-3MH2DYFS.js → reword-BKQ7K33J.js} +1 -1
  7. package/dist/{reword-6EWRZ6WZ.js → reword-PNW5XREC.js} +3 -1
  8. package/dist/{reword-3JBE7MPQ.js → reword-QQO7UBGM.js} +2 -0
  9. package/package.json +1 -1
  10. package/dist/chunk-2WRUFO3O.js +0 -689
  11. package/dist/chunk-2X3JJVRR.js +0 -639
  12. package/dist/chunk-7FBRAH4R.js +0 -643
  13. package/dist/chunk-7U4J2ORD.js +0 -614
  14. package/dist/chunk-CC3NIT53.js +0 -650
  15. package/dist/chunk-CLQ6OPLU.js +0 -668
  16. package/dist/chunk-F3BOAVBY.js +0 -122
  17. package/dist/chunk-FYJNHXAR.js +0 -700
  18. package/dist/chunk-H4W6AMGZ.js +0 -549
  19. package/dist/chunk-HJR5M6U7.js +0 -120
  20. package/dist/chunk-HOUMTU6H.js +0 -699
  21. package/dist/chunk-KEEMHNNS.js +0 -628
  22. package/dist/chunk-RHXNXVGI.js +0 -621
  23. package/dist/chunk-SNV4RWS4.js +0 -696
  24. package/dist/chunk-W7OC77AV.js +0 -649
  25. package/dist/chunk-WFXVVHL2.js +0 -645
  26. package/dist/chunk-YIXP5EWA.js +0 -545
  27. package/dist/chunk-YRVQGOVW.js +0 -649
  28. package/dist/chunk-ZLYMV2NJ.js +0 -644
  29. package/dist/config-C3S4LWLD.js +0 -12
  30. package/dist/config-RHGCFLHQ.js +0 -12
  31. package/dist/reword-2ASH5EH5.js +0 -212
  32. package/dist/reword-CZDYMQEV.js +0 -150
  33. package/dist/reword-D5YVSCPO.js +0 -212
  34. package/dist/reword-ESY2TLBT.js +0 -212
  35. package/dist/reword-FE5N4MGV.js +0 -150
  36. package/dist/reword-IN2D2J4H.js +0 -212
  37. package/dist/reword-JRE6KAF7.js +0 -212
  38. package/dist/reword-KIR2DMTO.js +0 -212
  39. package/dist/reword-KUE3IVBE.js +0 -212
  40. package/dist/reword-LIVSGNUN.js +0 -212
  41. package/dist/reword-MCQOCOZ2.js +0 -212
  42. package/dist/reword-NGEKVTD6.js +0 -212
  43. package/dist/reword-PEOUOAT7.js +0 -212
  44. package/dist/reword-Q7MES34W.js +0 -212
  45. package/dist/reword-T44WTP5I.js +0 -212
  46. package/dist/reword-UA3EG7DK.js +0 -212
  47. package/dist/reword-UE5IP5V3.js +0 -212
  48. package/dist/reword-VKG5G6CB.js +0 -212
  49. package/dist/reword-VRH7B6BE.js +0 -205
  50. package/dist/reword-WFCNTOEU.js +0 -203
  51. package/dist/reword-XWYWVQRZ.js +0 -212
@@ -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-GVOA4OR7.js";
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
- const messages = await runStep(
647
- "Building prompt",
648
- async () => buildRefineMessages({ originalPlan: plan, index, instructions, config })
649
- );
650
- const raw = await runStep(
651
- "Calling model",
652
- async () => provider.chat(messages, { maxTokens: config.maxTokens })
653
- );
654
- const refinedPlan = await runStep("Parsing response", async () => extractJSON(raw));
655
- refinedPlan.commits[0].title = formatCommitTitle(refinedPlan.commits[0].title, {
656
- allowGitmoji: config.style === "gitmoji" || config.style === "gitmoji-pure",
657
- mode: config.style
658
- });
659
- phased.phase("Suggested commit");
660
- phased.stop();
661
- sectionTitle("Suggested commit");
662
- renderCommitBlock({
663
- title: refinedPlan.commits[0].title,
664
- body: refinedPlan.commits[0].body,
665
- titleColor: (s) => chalk3.yellow(s)
666
- });
667
- borderLine();
668
- const ok = config.yes || (await inquirer.prompt([
669
- {
670
- type: "list",
671
- name: "ok",
672
- message: "Use the commit?",
673
- choices: [
674
- { name: "Yes", value: true },
675
- { name: "No", value: false }
676
- ],
677
- default: 0
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
- ])).ok;
680
- if (!ok) {
698
+ session.plan.commits[index] = refinedPlan.commits[0];
699
+ saveSession3(session);
681
700
  borderLine();
682
- abortMessage();
683
- return;
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-3JBE7MPQ.js");
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-CLQ6OPLU.js";
13
+ } from "./chunk-EHJXGWTJ.js";
14
14
 
15
15
  // src/workflow/reword.ts
16
16
  import chalk from "chalk";
@@ -10,7 +10,7 @@ import {
10
10
  formatCommitTitle,
11
11
  renderCommitBlock,
12
12
  sectionTitle
13
- } from "./chunk-7U4J2ORD.js";
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) {
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kud/ai-conventional-commit-cli",
3
- "version": "3.2.3",
3
+ "version": "3.2.6",
4
4
  "type": "module",
5
5
  "description": "Opinionated, style-aware AI assistant for crafting and splitting git commits (opencode-based, provider-agnostic).",
6
6
  "bin": {