@kud/ai-conventional-commit-cli 0.13.2 → 1.0.1
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/index.js +50 -54
- package/package.json +17 -16
package/dist/index.js
CHANGED
|
@@ -213,7 +213,7 @@ async function runValidations(candidate, plugins, ctx) {
|
|
|
213
213
|
// src/workflow/generate.ts
|
|
214
214
|
import { writeFileSync, mkdirSync, existsSync } from "fs";
|
|
215
215
|
import { join } from "path";
|
|
216
|
-
import
|
|
216
|
+
import { select } from "@inquirer/prompts";
|
|
217
217
|
async function runGenerate(config) {
|
|
218
218
|
const startedAt = Date.now();
|
|
219
219
|
if (!await ensureStagedChanges()) {
|
|
@@ -246,19 +246,21 @@ async function runGenerate(config) {
|
|
|
246
246
|
const del = f.deletions || 0;
|
|
247
247
|
totalAdd += add;
|
|
248
248
|
totalDel += del;
|
|
249
|
-
const delta = add + del;
|
|
250
|
-
const counts = chalk.green("+" + add) + " " + chalk.red("-" + del);
|
|
251
249
|
const name = f.file.length > maxName ? f.file.slice(0, maxName - 1) + "\u2026" : f.file;
|
|
252
|
-
let line = name.padEnd(maxName) + " | "
|
|
253
|
-
if (delta > 0) {
|
|
254
|
-
const barLen = Math.max(1, Math.round(delta / maxDelta * BAR_WIDTH));
|
|
255
|
-
const addPortion = Math.min(barLen, Math.round(barLen * (add / (delta || 1))));
|
|
256
|
-
const delPortion = barLen - addPortion;
|
|
257
|
-
const bar = chalk.green("+".repeat(addPortion)) + chalk.red("-".repeat(delPortion));
|
|
258
|
-
line += " " + bar;
|
|
259
|
-
}
|
|
250
|
+
let line = name.padEnd(maxName) + " | ";
|
|
260
251
|
if (f.deleted) {
|
|
261
|
-
line +=
|
|
252
|
+
line += chalk.red("[deleted]");
|
|
253
|
+
} else {
|
|
254
|
+
const delta = add + del;
|
|
255
|
+
const counts = chalk.green("+" + add) + " " + chalk.red("-" + del);
|
|
256
|
+
line += counts.padEnd(12);
|
|
257
|
+
if (delta > 0) {
|
|
258
|
+
const barLen = Math.max(1, Math.round(delta / maxDelta * BAR_WIDTH));
|
|
259
|
+
const addPortion = Math.min(barLen, Math.round(barLen * (add / (delta || 1))));
|
|
260
|
+
const delPortion = barLen - addPortion;
|
|
261
|
+
const bar = chalk.green("+".repeat(addPortion)) + chalk.red("-".repeat(delPortion));
|
|
262
|
+
line += " " + bar;
|
|
263
|
+
}
|
|
262
264
|
}
|
|
263
265
|
borderLine(line);
|
|
264
266
|
});
|
|
@@ -338,18 +340,14 @@ function saveSession(data) {
|
|
|
338
340
|
writeFileSync(join(dir, "last-session.json"), JSON.stringify(data, null, 2));
|
|
339
341
|
}
|
|
340
342
|
async function selectYesNo() {
|
|
341
|
-
const
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
name: "
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
],
|
|
350
|
-
default: 0
|
|
351
|
-
}
|
|
352
|
-
]);
|
|
343
|
+
const choice = await select({
|
|
344
|
+
message: "Use the commit?",
|
|
345
|
+
choices: [
|
|
346
|
+
{ name: "Yes", value: true },
|
|
347
|
+
{ name: "No", value: false }
|
|
348
|
+
],
|
|
349
|
+
default: true
|
|
350
|
+
});
|
|
353
351
|
return choice;
|
|
354
352
|
}
|
|
355
353
|
|
|
@@ -399,7 +397,7 @@ var clusterHunks = (files) => {
|
|
|
399
397
|
// src/workflow/split.ts
|
|
400
398
|
import { writeFileSync as writeFileSync2, mkdirSync as mkdirSync2, existsSync as existsSync2 } from "fs";
|
|
401
399
|
import { join as join2 } from "path";
|
|
402
|
-
import
|
|
400
|
+
import { select as select2 } from "@inquirer/prompts";
|
|
403
401
|
async function runSplit(config, desired) {
|
|
404
402
|
const startedAt = Date.now();
|
|
405
403
|
if (!await ensureStagedChanges()) {
|
|
@@ -432,19 +430,21 @@ async function runSplit(config, desired) {
|
|
|
432
430
|
const del = f.deletions || 0;
|
|
433
431
|
totalAdd += add;
|
|
434
432
|
totalDel += del;
|
|
435
|
-
const
|
|
436
|
-
|
|
437
|
-
let name = f.file.length > maxName ? f.file.slice(0, maxName - 1) + "\u2026" : f.file;
|
|
438
|
-
let line = name.padEnd(maxName) + " | " + counts.padEnd(12);
|
|
439
|
-
if (delta > 0) {
|
|
440
|
-
const barLen = Math.max(1, Math.round(delta / maxDelta * BAR_WIDTH));
|
|
441
|
-
const addPortion = Math.min(barLen, Math.round(barLen * (add / (delta || 1))));
|
|
442
|
-
const delPortion = barLen - addPortion;
|
|
443
|
-
const bar = chalk2.green("+".repeat(addPortion)) + chalk2.red("-".repeat(delPortion));
|
|
444
|
-
line += " " + bar;
|
|
445
|
-
}
|
|
433
|
+
const name = f.file.length > maxName ? f.file.slice(0, maxName - 1) + "\u2026" : f.file;
|
|
434
|
+
let line = name.padEnd(maxName) + " | ";
|
|
446
435
|
if (f.deleted) {
|
|
447
|
-
line +=
|
|
436
|
+
line += chalk2.red("[deleted]");
|
|
437
|
+
} else {
|
|
438
|
+
const delta = add + del;
|
|
439
|
+
const counts = chalk2.green("+" + add) + " " + chalk2.red("-" + del);
|
|
440
|
+
line += counts.padEnd(12);
|
|
441
|
+
if (delta > 0) {
|
|
442
|
+
const barLen = Math.max(1, Math.round(delta / maxDelta * BAR_WIDTH));
|
|
443
|
+
const addPortion = Math.min(barLen, Math.round(barLen * (add / (delta || 1))));
|
|
444
|
+
const delPortion = barLen - addPortion;
|
|
445
|
+
const bar = chalk2.green("+".repeat(addPortion)) + chalk2.red("-".repeat(delPortion));
|
|
446
|
+
line += " " + bar;
|
|
447
|
+
}
|
|
448
448
|
}
|
|
449
449
|
borderLine(line);
|
|
450
450
|
});
|
|
@@ -506,18 +506,14 @@ async function runSplit(config, desired) {
|
|
|
506
506
|
}
|
|
507
507
|
});
|
|
508
508
|
borderLine();
|
|
509
|
-
const
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
name: "
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
],
|
|
518
|
-
default: 0
|
|
519
|
-
}
|
|
520
|
-
]);
|
|
509
|
+
const ok = await select2({
|
|
510
|
+
message: "Use the commits?",
|
|
511
|
+
choices: [
|
|
512
|
+
{ name: "Yes", value: true },
|
|
513
|
+
{ name: "No", value: false }
|
|
514
|
+
],
|
|
515
|
+
default: true
|
|
516
|
+
});
|
|
521
517
|
if (!ok) {
|
|
522
518
|
borderLine();
|
|
523
519
|
abortMessage();
|
|
@@ -563,7 +559,7 @@ function saveSession2(data) {
|
|
|
563
559
|
// src/workflow/refine.ts
|
|
564
560
|
import chalk3 from "chalk";
|
|
565
561
|
import ora3 from "ora";
|
|
566
|
-
import
|
|
562
|
+
import inquirer from "inquirer";
|
|
567
563
|
import { readFileSync, existsSync as existsSync3, writeFileSync as writeFileSync3, mkdirSync as mkdirSync3 } from "fs";
|
|
568
564
|
import { join as join3 } from "path";
|
|
569
565
|
|
|
@@ -660,7 +656,7 @@ async function runRefine(config, options) {
|
|
|
660
656
|
titleColor: (s) => chalk3.yellow(s)
|
|
661
657
|
});
|
|
662
658
|
borderLine();
|
|
663
|
-
const { ok } = await
|
|
659
|
+
const { ok } = await inquirer.prompt([
|
|
664
660
|
{
|
|
665
661
|
type: "list",
|
|
666
662
|
name: "ok",
|
|
@@ -688,7 +684,7 @@ import { readFileSync as readFileSync2 } from "fs";
|
|
|
688
684
|
import { fileURLToPath } from "url";
|
|
689
685
|
import { dirname, join as join4 } from "path";
|
|
690
686
|
import { execa } from "execa";
|
|
691
|
-
import
|
|
687
|
+
import inquirer2 from "inquirer";
|
|
692
688
|
var __dirname = dirname(fileURLToPath(import.meta.url));
|
|
693
689
|
var pkgVersion = JSON.parse(readFileSync2(join4(__dirname, "..", "package.json"), "utf8")).version || "0.0.0";
|
|
694
690
|
var RootCommand = class extends Command {
|
|
@@ -894,7 +890,7 @@ var ModelsCommand = class extends Command {
|
|
|
894
890
|
this.context.stdout.write(stdout.trim() + "\n");
|
|
895
891
|
return;
|
|
896
892
|
}
|
|
897
|
-
const { model } = await
|
|
893
|
+
const { model } = await inquirer2.prompt([
|
|
898
894
|
{
|
|
899
895
|
name: "model",
|
|
900
896
|
type: "list",
|
|
@@ -1053,7 +1049,7 @@ var RewordCommand = class extends Command {
|
|
|
1053
1049
|
value: c.hash
|
|
1054
1050
|
}));
|
|
1055
1051
|
choices.push({ name: "Cancel", value: "__CANCEL__" });
|
|
1056
|
-
const { picked } = await
|
|
1052
|
+
const { picked } = await inquirer2.prompt([
|
|
1057
1053
|
{
|
|
1058
1054
|
type: "list",
|
|
1059
1055
|
name: "picked",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kud/ai-conventional-commit-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.1",
|
|
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": {
|
|
@@ -22,33 +22,34 @@
|
|
|
22
22
|
"commit": "cz"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@commitlint/config-conventional": "^
|
|
25
|
+
"@commitlint/config-conventional": "^20.0.0",
|
|
26
|
+
"@inquirer/prompts": "8.0.1",
|
|
26
27
|
"chalk": "^5.6.2",
|
|
27
28
|
"clipanion": "^3.2.1",
|
|
28
29
|
"cosmiconfig": "^9.0.0",
|
|
29
30
|
"execa": "^9.6.0",
|
|
30
31
|
"fast-glob": "^3.3.3",
|
|
31
|
-
"inquirer": "^
|
|
32
|
-
"keyv": "^5.5.
|
|
33
|
-
"lru-cache": "^11.2.
|
|
34
|
-
"ora": "^
|
|
32
|
+
"inquirer": "^13.0.1",
|
|
33
|
+
"keyv": "^5.5.4",
|
|
34
|
+
"lru-cache": "^11.2.2",
|
|
35
|
+
"ora": "^9.0.0",
|
|
35
36
|
"pathe": "^2.0.3",
|
|
36
|
-
"simple-git": "^3.
|
|
37
|
+
"simple-git": "^3.30.0",
|
|
37
38
|
"strip-ansi": "^7.1.2",
|
|
38
|
-
"zod": "^4.1.
|
|
39
|
+
"zod": "^4.1.12"
|
|
39
40
|
},
|
|
40
41
|
"devDependencies": {
|
|
41
42
|
"@types/inquirer": "^9.0.9",
|
|
42
|
-
"@types/node": "^24.
|
|
43
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
44
|
-
"@typescript-eslint/parser": "^8.
|
|
43
|
+
"@types/node": "^24.10.1",
|
|
44
|
+
"@typescript-eslint/eslint-plugin": "^8.47.0",
|
|
45
|
+
"@typescript-eslint/parser": "^8.47.0",
|
|
45
46
|
"cz-conventional-changelog": "^3.3.0",
|
|
46
|
-
"eslint": "^9.
|
|
47
|
+
"eslint": "^9.39.1",
|
|
47
48
|
"prettier": "^3.6.2",
|
|
48
|
-
"tsup": "^8.5.
|
|
49
|
-
"tsx": "^4.20.
|
|
50
|
-
"typescript": "^5.9.
|
|
51
|
-
"vitest": "^
|
|
49
|
+
"tsup": "^8.5.1",
|
|
50
|
+
"tsx": "^4.20.6",
|
|
51
|
+
"typescript": "^5.9.3",
|
|
52
|
+
"vitest": "^4.0.10"
|
|
52
53
|
},
|
|
53
54
|
"config": {
|
|
54
55
|
"commitizen": {
|