opencommit 1.1.33 → 1.1.35
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/out/cli.cjs +30 -15
- package/package.json +1 -1
package/out/cli.cjs
CHANGED
|
@@ -39,17 +39,17 @@ var require_ini = __commonJS({
|
|
|
39
39
|
opt = opt || /* @__PURE__ */ Object.create(null);
|
|
40
40
|
opt.whitespace = opt.whitespace === true;
|
|
41
41
|
}
|
|
42
|
-
const
|
|
42
|
+
const separator2 = opt.whitespace ? " = " : "=";
|
|
43
43
|
for (const k6 of Object.keys(obj)) {
|
|
44
44
|
const val = obj[k6];
|
|
45
45
|
if (val && Array.isArray(val)) {
|
|
46
46
|
for (const item of val) {
|
|
47
|
-
out += safe(k6 + "[]") +
|
|
47
|
+
out += safe(k6 + "[]") + separator2 + safe(item) + eol;
|
|
48
48
|
}
|
|
49
49
|
} else if (val && typeof val === "object") {
|
|
50
50
|
children.push(k6);
|
|
51
51
|
} else {
|
|
52
|
-
out += safe(k6) +
|
|
52
|
+
out += safe(k6) + separator2 + safe(val) + eol;
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
if (opt.section && out.length) {
|
|
@@ -539,8 +539,8 @@ var require_path_key = __commonJS({
|
|
|
539
539
|
"use strict";
|
|
540
540
|
var pathKey2 = (options = {}) => {
|
|
541
541
|
const environment = options.env || process.env;
|
|
542
|
-
const
|
|
543
|
-
if (
|
|
542
|
+
const platform2 = options.platform || process.platform;
|
|
543
|
+
if (platform2 !== "win32") {
|
|
544
544
|
return "PATH";
|
|
545
545
|
}
|
|
546
546
|
return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
|
|
@@ -15763,7 +15763,7 @@ function G3(t, e2) {
|
|
|
15763
15763
|
// package.json
|
|
15764
15764
|
var package_default = {
|
|
15765
15765
|
name: "opencommit",
|
|
15766
|
-
version: "1.1.
|
|
15766
|
+
version: "1.1.34",
|
|
15767
15767
|
description: "GPT CLI to auto-generate impressive commits in 1 second. Killing lame commits with AI \u{1F92F}\u{1F52B}",
|
|
15768
15768
|
keywords: [
|
|
15769
15769
|
"git",
|
|
@@ -17187,9 +17187,9 @@ var import_node_url = __toESM(require("node:url"), 1);
|
|
|
17187
17187
|
function pathKey(options = {}) {
|
|
17188
17188
|
const {
|
|
17189
17189
|
env: env2 = process.env,
|
|
17190
|
-
platform = process.platform
|
|
17190
|
+
platform: platform2 = process.platform
|
|
17191
17191
|
} = options;
|
|
17192
|
-
if (
|
|
17192
|
+
if (platform2 !== "win32") {
|
|
17193
17193
|
return "PATH";
|
|
17194
17194
|
}
|
|
17195
17195
|
return Object.keys(env2).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
|
|
@@ -18152,8 +18152,23 @@ ${lockFiles.join(
|
|
|
18152
18152
|
|
|
18153
18153
|
// src/commands/githook.ts
|
|
18154
18154
|
var import_fs3 = require("fs");
|
|
18155
|
+
var platform = process.platform;
|
|
18156
|
+
var separator = "";
|
|
18157
|
+
switch (platform) {
|
|
18158
|
+
case "win32":
|
|
18159
|
+
separator = import_path2.default.sep;
|
|
18160
|
+
break;
|
|
18161
|
+
case "darwin":
|
|
18162
|
+
separator = "";
|
|
18163
|
+
break;
|
|
18164
|
+
case "linux":
|
|
18165
|
+
separator = "";
|
|
18166
|
+
break;
|
|
18167
|
+
default:
|
|
18168
|
+
throw new Error(`Unsupported platform: ${platform}`);
|
|
18169
|
+
}
|
|
18155
18170
|
var HOOK_NAME = "prepare-commit-msg";
|
|
18156
|
-
var SYMLINK_URL = import_path2.default.join(
|
|
18171
|
+
var SYMLINK_URL = import_path2.default.join(separator, ".git", "hooks", HOOK_NAME);
|
|
18157
18172
|
var isHookCalled = process.argv[1].endsWith(`${SYMLINK_URL}`);
|
|
18158
18173
|
var isHookExists = (0, import_fs3.existsSync)(SYMLINK_URL);
|
|
18159
18174
|
var hookCommand = G3(
|
|
@@ -21182,7 +21197,7 @@ var generateCommitMessageWithChatCompletion = async (diff) => {
|
|
|
21182
21197
|
return { error: "INTERNAL_ERROR" /* internalError */ };
|
|
21183
21198
|
}
|
|
21184
21199
|
};
|
|
21185
|
-
function getMessagesPromisesByChangesInFile(fileDiff,
|
|
21200
|
+
function getMessagesPromisesByChangesInFile(fileDiff, separator2, maxChangeLength) {
|
|
21186
21201
|
const hunkHeaderSeparator = "@@ ";
|
|
21187
21202
|
const [fileHeader, ...fileDiffByLines] = fileDiff.split(hunkHeaderSeparator);
|
|
21188
21203
|
const mergedChanges = mergeDiffs(
|
|
@@ -21194,28 +21209,28 @@ function getMessagesPromisesByChangesInFile(fileDiff, separator, maxChangeLength
|
|
|
21194
21209
|
);
|
|
21195
21210
|
const commitMsgsFromFileLineDiffs = lineDiffsWithHeader.map((lineDiff) => {
|
|
21196
21211
|
const messages = generateCommitMessageChatCompletionPrompt(
|
|
21197
|
-
|
|
21212
|
+
separator2 + lineDiff
|
|
21198
21213
|
);
|
|
21199
21214
|
return api.generateCommitMessage(messages);
|
|
21200
21215
|
});
|
|
21201
21216
|
return commitMsgsFromFileLineDiffs;
|
|
21202
21217
|
}
|
|
21203
21218
|
function getCommitMsgsPromisesFromFileDiffs(diff, maxDiffLength) {
|
|
21204
|
-
const
|
|
21205
|
-
const diffByFiles = diff.split(
|
|
21219
|
+
const separator2 = "diff --git ";
|
|
21220
|
+
const diffByFiles = diff.split(separator2).slice(1);
|
|
21206
21221
|
const mergedFilesDiffs = mergeDiffs(diffByFiles, maxDiffLength);
|
|
21207
21222
|
const commitMessagePromises = [];
|
|
21208
21223
|
for (const fileDiff of mergedFilesDiffs) {
|
|
21209
21224
|
if (tokenCount(fileDiff) >= maxDiffLength) {
|
|
21210
21225
|
const messagesPromises = getMessagesPromisesByChangesInFile(
|
|
21211
21226
|
fileDiff,
|
|
21212
|
-
|
|
21227
|
+
separator2,
|
|
21213
21228
|
maxDiffLength
|
|
21214
21229
|
);
|
|
21215
21230
|
commitMessagePromises.push(...messagesPromises);
|
|
21216
21231
|
} else {
|
|
21217
21232
|
const messages = generateCommitMessageChatCompletionPrompt(
|
|
21218
|
-
|
|
21233
|
+
separator2 + fileDiff
|
|
21219
21234
|
);
|
|
21220
21235
|
commitMessagePromises.push(api.generateCommitMessage(messages));
|
|
21221
21236
|
}
|