@kud/ai-conventional-commit-cli 0.13.1 → 1.0.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/index.js +39 -39
- package/package.json +16 -16
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ import crypto from "crypto";
|
|
|
31
31
|
var git = simpleGit();
|
|
32
32
|
var ensureStagedChanges = async () => {
|
|
33
33
|
const status = await git.status();
|
|
34
|
-
return status.staged.length > 0;
|
|
34
|
+
return status.staged.length > 0 || status.renamed.length > 0;
|
|
35
35
|
};
|
|
36
36
|
var getStagedDiffRaw = async () => {
|
|
37
37
|
return git.diff(["--cached", "--unified=3", "--no-color", "-M"]);
|
|
@@ -104,8 +104,12 @@ var parseDiff = async () => {
|
|
|
104
104
|
const parsed = parseDiffFromRaw(raw);
|
|
105
105
|
if (parsed.length === 0) {
|
|
106
106
|
const status = await git.status();
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
const allStaged = [
|
|
108
|
+
...status.staged.map((f) => ({ file: f, hunks: [], additions: 0, deletions: 0 })),
|
|
109
|
+
...status.renamed.map((r) => ({ file: r.to, hunks: [], additions: 0, deletions: 0 }))
|
|
110
|
+
];
|
|
111
|
+
if (allStaged.length > 0) {
|
|
112
|
+
return allStaged;
|
|
109
113
|
}
|
|
110
114
|
}
|
|
111
115
|
return parsed;
|
|
@@ -130,7 +134,7 @@ var stageFiles = async (files) => {
|
|
|
130
134
|
};
|
|
131
135
|
var getStagedFiles = async () => {
|
|
132
136
|
const status = await git.status();
|
|
133
|
-
return status.staged;
|
|
137
|
+
return [...status.staged, ...status.renamed.map((r) => r.to)];
|
|
134
138
|
};
|
|
135
139
|
|
|
136
140
|
// src/style.ts
|
|
@@ -242,19 +246,21 @@ async function runGenerate(config) {
|
|
|
242
246
|
const del = f.deletions || 0;
|
|
243
247
|
totalAdd += add;
|
|
244
248
|
totalDel += del;
|
|
245
|
-
const delta = add + del;
|
|
246
|
-
const counts = chalk.green("+" + add) + " " + chalk.red("-" + del);
|
|
247
249
|
const name = f.file.length > maxName ? f.file.slice(0, maxName - 1) + "\u2026" : f.file;
|
|
248
|
-
let line = name.padEnd(maxName) + " | "
|
|
249
|
-
if (delta > 0) {
|
|
250
|
-
const barLen = Math.max(1, Math.round(delta / maxDelta * BAR_WIDTH));
|
|
251
|
-
const addPortion = Math.min(barLen, Math.round(barLen * (add / (delta || 1))));
|
|
252
|
-
const delPortion = barLen - addPortion;
|
|
253
|
-
const bar = chalk.green("+".repeat(addPortion)) + chalk.red("-".repeat(delPortion));
|
|
254
|
-
line += " " + bar;
|
|
255
|
-
}
|
|
250
|
+
let line = name.padEnd(maxName) + " | ";
|
|
256
251
|
if (f.deleted) {
|
|
257
|
-
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
|
+
}
|
|
258
264
|
}
|
|
259
265
|
borderLine(line);
|
|
260
266
|
});
|
|
@@ -336,14 +342,10 @@ function saveSession(data) {
|
|
|
336
342
|
async function selectYesNo() {
|
|
337
343
|
const { choice } = await inquirer.prompt([
|
|
338
344
|
{
|
|
339
|
-
type: "
|
|
345
|
+
type: "confirm",
|
|
340
346
|
name: "choice",
|
|
341
347
|
message: "Use the commit?",
|
|
342
|
-
|
|
343
|
-
{ name: "Yes", value: true },
|
|
344
|
-
{ name: "No", value: false }
|
|
345
|
-
],
|
|
346
|
-
default: 0
|
|
348
|
+
default: true
|
|
347
349
|
}
|
|
348
350
|
]);
|
|
349
351
|
return choice;
|
|
@@ -428,19 +430,21 @@ async function runSplit(config, desired) {
|
|
|
428
430
|
const del = f.deletions || 0;
|
|
429
431
|
totalAdd += add;
|
|
430
432
|
totalDel += del;
|
|
431
|
-
const
|
|
432
|
-
|
|
433
|
-
let name = f.file.length > maxName ? f.file.slice(0, maxName - 1) + "\u2026" : f.file;
|
|
434
|
-
let line = name.padEnd(maxName) + " | " + counts.padEnd(12);
|
|
435
|
-
if (delta > 0) {
|
|
436
|
-
const barLen = Math.max(1, Math.round(delta / maxDelta * BAR_WIDTH));
|
|
437
|
-
const addPortion = Math.min(barLen, Math.round(barLen * (add / (delta || 1))));
|
|
438
|
-
const delPortion = barLen - addPortion;
|
|
439
|
-
const bar = chalk2.green("+".repeat(addPortion)) + chalk2.red("-".repeat(delPortion));
|
|
440
|
-
line += " " + bar;
|
|
441
|
-
}
|
|
433
|
+
const name = f.file.length > maxName ? f.file.slice(0, maxName - 1) + "\u2026" : f.file;
|
|
434
|
+
let line = name.padEnd(maxName) + " | ";
|
|
442
435
|
if (f.deleted) {
|
|
443
|
-
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
|
+
}
|
|
444
448
|
}
|
|
445
449
|
borderLine(line);
|
|
446
450
|
});
|
|
@@ -504,14 +508,10 @@ async function runSplit(config, desired) {
|
|
|
504
508
|
borderLine();
|
|
505
509
|
const { ok } = await inquirer2.prompt([
|
|
506
510
|
{
|
|
507
|
-
type: "
|
|
511
|
+
type: "confirm",
|
|
508
512
|
name: "ok",
|
|
509
513
|
message: "Use the commits?",
|
|
510
|
-
|
|
511
|
-
{ name: "Yes", value: true },
|
|
512
|
-
{ name: "No", value: false }
|
|
513
|
-
],
|
|
514
|
-
default: 0
|
|
514
|
+
default: true
|
|
515
515
|
}
|
|
516
516
|
]);
|
|
517
517
|
if (!ok) {
|
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.0",
|
|
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,33 @@
|
|
|
22
22
|
"commit": "cz"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@commitlint/config-conventional": "^
|
|
25
|
+
"@commitlint/config-conventional": "^20.0.0",
|
|
26
26
|
"chalk": "^5.6.2",
|
|
27
27
|
"clipanion": "^3.2.1",
|
|
28
28
|
"cosmiconfig": "^9.0.0",
|
|
29
29
|
"execa": "^9.6.0",
|
|
30
30
|
"fast-glob": "^3.3.3",
|
|
31
|
-
"inquirer": "^
|
|
32
|
-
"keyv": "^5.5.
|
|
33
|
-
"lru-cache": "^11.2.
|
|
34
|
-
"ora": "^
|
|
31
|
+
"inquirer": "^13.0.1",
|
|
32
|
+
"keyv": "^5.5.4",
|
|
33
|
+
"lru-cache": "^11.2.2",
|
|
34
|
+
"ora": "^9.0.0",
|
|
35
35
|
"pathe": "^2.0.3",
|
|
36
|
-
"simple-git": "^3.
|
|
36
|
+
"simple-git": "^3.30.0",
|
|
37
37
|
"strip-ansi": "^7.1.2",
|
|
38
|
-
"zod": "^4.1.
|
|
38
|
+
"zod": "^4.1.12"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/inquirer": "^9.0.9",
|
|
42
|
-
"@types/node": "^24.
|
|
43
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
44
|
-
"@typescript-eslint/parser": "^8.
|
|
42
|
+
"@types/node": "^24.10.1",
|
|
43
|
+
"@typescript-eslint/eslint-plugin": "^8.47.0",
|
|
44
|
+
"@typescript-eslint/parser": "^8.47.0",
|
|
45
45
|
"cz-conventional-changelog": "^3.3.0",
|
|
46
|
-
"eslint": "^9.
|
|
46
|
+
"eslint": "^9.39.1",
|
|
47
47
|
"prettier": "^3.6.2",
|
|
48
|
-
"tsup": "^8.5.
|
|
49
|
-
"tsx": "^4.20.
|
|
50
|
-
"typescript": "^5.9.
|
|
51
|
-
"vitest": "^
|
|
48
|
+
"tsup": "^8.5.1",
|
|
49
|
+
"tsx": "^4.20.6",
|
|
50
|
+
"typescript": "^5.9.3",
|
|
51
|
+
"vitest": "^4.0.10"
|
|
52
52
|
},
|
|
53
53
|
"config": {
|
|
54
54
|
"commitizen": {
|