@kud/ai-conventional-commit-cli 0.13.0 → 0.13.2

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 (2) hide show
  1. package/dist/index.js +12 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -31,10 +31,10 @@ 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
- return git.diff(["--cached", "--unified=3", "--no-color"]);
37
+ return git.diff(["--cached", "--unified=3", "--no-color", "-M"]);
38
38
  };
39
39
  var HUNK_HEADER_RE = /^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@ ?(.*)$/;
40
40
  var parseDiffFromRaw = (raw) => {
@@ -54,6 +54,9 @@ var parseDiffFromRaw = (raw) => {
54
54
  }
55
55
  if (line.startsWith("diff --git")) continue;
56
56
  if (line.startsWith("index ")) continue;
57
+ if (line.startsWith("similarity index ")) continue;
58
+ if (line.startsWith("rename from ")) continue;
59
+ if (line.startsWith("rename to ")) continue;
57
60
  if (/^deleted file mode /.test(line)) {
58
61
  if (currentFile) currentFile.deleted = true;
59
62
  continue;
@@ -101,8 +104,12 @@ var parseDiff = async () => {
101
104
  const parsed = parseDiffFromRaw(raw);
102
105
  if (parsed.length === 0) {
103
106
  const status = await git.status();
104
- if (status.staged.length) {
105
- return status.staged.map((f) => ({ file: f, hunks: [], additions: 0, deletions: 0 }));
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;
106
113
  }
107
114
  }
108
115
  return parsed;
@@ -127,7 +134,7 @@ var stageFiles = async (files) => {
127
134
  };
128
135
  var getStagedFiles = async () => {
129
136
  const status = await git.status();
130
- return status.staged;
137
+ return [...status.staged, ...status.renamed.map((r) => r.to)];
131
138
  };
132
139
 
133
140
  // src/style.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kud/ai-conventional-commit-cli",
3
- "version": "0.13.0",
3
+ "version": "0.13.2",
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": {