opencommit 2.2.9 → 2.2.10

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 CHANGED
@@ -16272,7 +16272,7 @@ function G3(t, e2) {
16272
16272
  // package.json
16273
16273
  var package_default = {
16274
16274
  name: "opencommit",
16275
- version: "2.2.9",
16275
+ version: "2.2.10",
16276
16276
  description: "Auto-generate impressive commits in 1 second. Killing lame commits with AI \u{1F92F}\u{1F52B}",
16277
16277
  keywords: [
16278
16278
  "git",
@@ -21734,9 +21734,7 @@ var OpenAi = class {
21734
21734
  max_tokens: maxTokens || 500
21735
21735
  };
21736
21736
  try {
21737
- const REQUEST_TOKENS = messages.map(
21738
- (msg) => tokenCount(msg.content) + 4
21739
- ).reduce((a2, b5) => a2 + b5, 0);
21737
+ const REQUEST_TOKENS = messages.map((msg) => tokenCount(msg.content) + 4).reduce((a2, b5) => a2 + b5, 0);
21740
21738
  if (REQUEST_TOKENS > DEFAULT_MODEL_TOKEN_LIMIT - maxTokens) {
21741
21739
  throw new Error("TOO_MUCH_TOKENS" /* tooMuchTokens */);
21742
21740
  }
@@ -21761,10 +21759,8 @@ var OpenAi = class {
21761
21759
  };
21762
21760
  var getOpenCommitLatestVersion = async () => {
21763
21761
  try {
21764
- const { data } = await axios_default.get(
21765
- "https://unpkg.com/opencommit/package.json"
21766
- );
21767
- return data.version;
21762
+ const { stdout } = await execa("npm", ["view", "opencommit", "version"]);
21763
+ return stdout;
21768
21764
  } catch (_6) {
21769
21765
  ce("Error while getting the latest version of opencommit");
21770
21766
  return void 0;
@@ -8819,7 +8819,7 @@ var require_utils5 = __commonJS({
8819
8819
  function isFunction2(val) {
8820
8820
  return toString3.call(val) === "[object Function]";
8821
8821
  }
8822
- function isStream2(val) {
8822
+ function isStream3(val) {
8823
8823
  return isObject2(val) && isFunction2(val.pipe);
8824
8824
  }
8825
8825
  function isURLSearchParams2(val) {
@@ -8902,7 +8902,7 @@ var require_utils5 = __commonJS({
8902
8902
  isFile: isFile2,
8903
8903
  isBlob: isBlob2,
8904
8904
  isFunction: isFunction2,
8905
- isStream: isStream2,
8905
+ isStream: isStream3,
8906
8906
  isURLSearchParams: isURLSearchParams2,
8907
8907
  isStandardBrowserEnv,
8908
8908
  forEach: forEach2,
@@ -12971,8 +12971,8 @@ var require_combined_stream = __commonJS({
12971
12971
  this._pipeNext(stream4);
12972
12972
  return;
12973
12973
  }
12974
- var getStream = stream4;
12975
- getStream(function(stream5) {
12974
+ var getStream2 = stream4;
12975
+ getStream2(function(stream5) {
12976
12976
  var isStreamLike = CombinedStream.isStreamLike(stream5);
12977
12977
  if (isStreamLike) {
12978
12978
  stream5.on("data", this._checkDataSize.bind(this));
@@ -23039,6 +23039,833 @@ var require_tiktoken = __commonJS({
23039
23039
  }
23040
23040
  });
23041
23041
 
23042
+ // node_modules/isexe/windows.js
23043
+ var require_windows = __commonJS({
23044
+ "node_modules/isexe/windows.js"(exports, module2) {
23045
+ module2.exports = isexe;
23046
+ isexe.sync = sync;
23047
+ var fs = require("fs");
23048
+ function checkPathExt(path, options) {
23049
+ var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
23050
+ if (!pathext) {
23051
+ return true;
23052
+ }
23053
+ pathext = pathext.split(";");
23054
+ if (pathext.indexOf("") !== -1) {
23055
+ return true;
23056
+ }
23057
+ for (var i2 = 0; i2 < pathext.length; i2++) {
23058
+ var p2 = pathext[i2].toLowerCase();
23059
+ if (p2 && path.substr(-p2.length).toLowerCase() === p2) {
23060
+ return true;
23061
+ }
23062
+ }
23063
+ return false;
23064
+ }
23065
+ function checkStat(stat, path, options) {
23066
+ if (!stat.isSymbolicLink() && !stat.isFile()) {
23067
+ return false;
23068
+ }
23069
+ return checkPathExt(path, options);
23070
+ }
23071
+ function isexe(path, options, cb) {
23072
+ fs.stat(path, function(er, stat) {
23073
+ cb(er, er ? false : checkStat(stat, path, options));
23074
+ });
23075
+ }
23076
+ function sync(path, options) {
23077
+ return checkStat(fs.statSync(path), path, options);
23078
+ }
23079
+ }
23080
+ });
23081
+
23082
+ // node_modules/isexe/mode.js
23083
+ var require_mode = __commonJS({
23084
+ "node_modules/isexe/mode.js"(exports, module2) {
23085
+ module2.exports = isexe;
23086
+ isexe.sync = sync;
23087
+ var fs = require("fs");
23088
+ function isexe(path, options, cb) {
23089
+ fs.stat(path, function(er, stat) {
23090
+ cb(er, er ? false : checkStat(stat, options));
23091
+ });
23092
+ }
23093
+ function sync(path, options) {
23094
+ return checkStat(fs.statSync(path), options);
23095
+ }
23096
+ function checkStat(stat, options) {
23097
+ return stat.isFile() && checkMode(stat, options);
23098
+ }
23099
+ function checkMode(stat, options) {
23100
+ var mod = stat.mode;
23101
+ var uid = stat.uid;
23102
+ var gid = stat.gid;
23103
+ var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
23104
+ var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
23105
+ var u2 = parseInt("100", 8);
23106
+ var g = parseInt("010", 8);
23107
+ var o2 = parseInt("001", 8);
23108
+ var ug = u2 | g;
23109
+ var ret = mod & o2 || mod & g && gid === myGid || mod & u2 && uid === myUid || mod & ug && myUid === 0;
23110
+ return ret;
23111
+ }
23112
+ }
23113
+ });
23114
+
23115
+ // node_modules/isexe/index.js
23116
+ var require_isexe = __commonJS({
23117
+ "node_modules/isexe/index.js"(exports, module2) {
23118
+ var fs = require("fs");
23119
+ var core2;
23120
+ if (process.platform === "win32" || global.TESTING_WINDOWS) {
23121
+ core2 = require_windows();
23122
+ } else {
23123
+ core2 = require_mode();
23124
+ }
23125
+ module2.exports = isexe;
23126
+ isexe.sync = sync;
23127
+ function isexe(path, options, cb) {
23128
+ if (typeof options === "function") {
23129
+ cb = options;
23130
+ options = {};
23131
+ }
23132
+ if (!cb) {
23133
+ if (typeof Promise !== "function") {
23134
+ throw new TypeError("callback not provided");
23135
+ }
23136
+ return new Promise(function(resolve, reject) {
23137
+ isexe(path, options || {}, function(er, is) {
23138
+ if (er) {
23139
+ reject(er);
23140
+ } else {
23141
+ resolve(is);
23142
+ }
23143
+ });
23144
+ });
23145
+ }
23146
+ core2(path, options || {}, function(er, is) {
23147
+ if (er) {
23148
+ if (er.code === "EACCES" || options && options.ignoreErrors) {
23149
+ er = null;
23150
+ is = false;
23151
+ }
23152
+ }
23153
+ cb(er, is);
23154
+ });
23155
+ }
23156
+ function sync(path, options) {
23157
+ try {
23158
+ return core2.sync(path, options || {});
23159
+ } catch (er) {
23160
+ if (options && options.ignoreErrors || er.code === "EACCES") {
23161
+ return false;
23162
+ } else {
23163
+ throw er;
23164
+ }
23165
+ }
23166
+ }
23167
+ }
23168
+ });
23169
+
23170
+ // node_modules/which/which.js
23171
+ var require_which = __commonJS({
23172
+ "node_modules/which/which.js"(exports, module2) {
23173
+ var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
23174
+ var path = require("path");
23175
+ var COLON = isWindows ? ";" : ":";
23176
+ var isexe = require_isexe();
23177
+ var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
23178
+ var getPathInfo = (cmd, opt) => {
23179
+ const colon = opt.colon || COLON;
23180
+ const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [
23181
+ ...isWindows ? [process.cwd()] : [],
23182
+ ...(opt.path || process.env.PATH || "").split(colon)
23183
+ ];
23184
+ const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
23185
+ const pathExt = isWindows ? pathExtExe.split(colon) : [""];
23186
+ if (isWindows) {
23187
+ if (cmd.indexOf(".") !== -1 && pathExt[0] !== "")
23188
+ pathExt.unshift("");
23189
+ }
23190
+ return {
23191
+ pathEnv,
23192
+ pathExt,
23193
+ pathExtExe
23194
+ };
23195
+ };
23196
+ var which = (cmd, opt, cb) => {
23197
+ if (typeof opt === "function") {
23198
+ cb = opt;
23199
+ opt = {};
23200
+ }
23201
+ if (!opt)
23202
+ opt = {};
23203
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
23204
+ const found = [];
23205
+ const step = (i2) => new Promise((resolve, reject) => {
23206
+ if (i2 === pathEnv.length)
23207
+ return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
23208
+ const ppRaw = pathEnv[i2];
23209
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
23210
+ const pCmd = path.join(pathPart, cmd);
23211
+ const p2 = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
23212
+ resolve(subStep(p2, i2, 0));
23213
+ });
23214
+ const subStep = (p2, i2, ii) => new Promise((resolve, reject) => {
23215
+ if (ii === pathExt.length)
23216
+ return resolve(step(i2 + 1));
23217
+ const ext = pathExt[ii];
23218
+ isexe(p2 + ext, { pathExt: pathExtExe }, (er, is) => {
23219
+ if (!er && is) {
23220
+ if (opt.all)
23221
+ found.push(p2 + ext);
23222
+ else
23223
+ return resolve(p2 + ext);
23224
+ }
23225
+ return resolve(subStep(p2, i2, ii + 1));
23226
+ });
23227
+ });
23228
+ return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
23229
+ };
23230
+ var whichSync = (cmd, opt) => {
23231
+ opt = opt || {};
23232
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
23233
+ const found = [];
23234
+ for (let i2 = 0; i2 < pathEnv.length; i2++) {
23235
+ const ppRaw = pathEnv[i2];
23236
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
23237
+ const pCmd = path.join(pathPart, cmd);
23238
+ const p2 = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
23239
+ for (let j2 = 0; j2 < pathExt.length; j2++) {
23240
+ const cur = p2 + pathExt[j2];
23241
+ try {
23242
+ const is = isexe.sync(cur, { pathExt: pathExtExe });
23243
+ if (is) {
23244
+ if (opt.all)
23245
+ found.push(cur);
23246
+ else
23247
+ return cur;
23248
+ }
23249
+ } catch (ex) {
23250
+ }
23251
+ }
23252
+ }
23253
+ if (opt.all && found.length)
23254
+ return found;
23255
+ if (opt.nothrow)
23256
+ return null;
23257
+ throw getNotFoundError(cmd);
23258
+ };
23259
+ module2.exports = which;
23260
+ which.sync = whichSync;
23261
+ }
23262
+ });
23263
+
23264
+ // node_modules/path-key/index.js
23265
+ var require_path_key = __commonJS({
23266
+ "node_modules/path-key/index.js"(exports, module2) {
23267
+ "use strict";
23268
+ var pathKey2 = (options = {}) => {
23269
+ const environment = options.env || process.env;
23270
+ const platform = options.platform || process.platform;
23271
+ if (platform !== "win32") {
23272
+ return "PATH";
23273
+ }
23274
+ return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
23275
+ };
23276
+ module2.exports = pathKey2;
23277
+ module2.exports.default = pathKey2;
23278
+ }
23279
+ });
23280
+
23281
+ // node_modules/cross-spawn/lib/util/resolveCommand.js
23282
+ var require_resolveCommand = __commonJS({
23283
+ "node_modules/cross-spawn/lib/util/resolveCommand.js"(exports, module2) {
23284
+ "use strict";
23285
+ var path = require("path");
23286
+ var which = require_which();
23287
+ var getPathKey = require_path_key();
23288
+ function resolveCommandAttempt(parsed, withoutPathExt) {
23289
+ const env2 = parsed.options.env || process.env;
23290
+ const cwd = process.cwd();
23291
+ const hasCustomCwd = parsed.options.cwd != null;
23292
+ const shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0 && !process.chdir.disabled;
23293
+ if (shouldSwitchCwd) {
23294
+ try {
23295
+ process.chdir(parsed.options.cwd);
23296
+ } catch (err) {
23297
+ }
23298
+ }
23299
+ let resolved;
23300
+ try {
23301
+ resolved = which.sync(parsed.command, {
23302
+ path: env2[getPathKey({ env: env2 })],
23303
+ pathExt: withoutPathExt ? path.delimiter : void 0
23304
+ });
23305
+ } catch (e2) {
23306
+ } finally {
23307
+ if (shouldSwitchCwd) {
23308
+ process.chdir(cwd);
23309
+ }
23310
+ }
23311
+ if (resolved) {
23312
+ resolved = path.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
23313
+ }
23314
+ return resolved;
23315
+ }
23316
+ function resolveCommand(parsed) {
23317
+ return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
23318
+ }
23319
+ module2.exports = resolveCommand;
23320
+ }
23321
+ });
23322
+
23323
+ // node_modules/cross-spawn/lib/util/escape.js
23324
+ var require_escape = __commonJS({
23325
+ "node_modules/cross-spawn/lib/util/escape.js"(exports, module2) {
23326
+ "use strict";
23327
+ var metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
23328
+ function escapeCommand(arg) {
23329
+ arg = arg.replace(metaCharsRegExp, "^$1");
23330
+ return arg;
23331
+ }
23332
+ function escapeArgument(arg, doubleEscapeMetaChars) {
23333
+ arg = `${arg}`;
23334
+ arg = arg.replace(/(\\*)"/g, '$1$1\\"');
23335
+ arg = arg.replace(/(\\*)$/, "$1$1");
23336
+ arg = `"${arg}"`;
23337
+ arg = arg.replace(metaCharsRegExp, "^$1");
23338
+ if (doubleEscapeMetaChars) {
23339
+ arg = arg.replace(metaCharsRegExp, "^$1");
23340
+ }
23341
+ return arg;
23342
+ }
23343
+ module2.exports.command = escapeCommand;
23344
+ module2.exports.argument = escapeArgument;
23345
+ }
23346
+ });
23347
+
23348
+ // node_modules/shebang-regex/index.js
23349
+ var require_shebang_regex = __commonJS({
23350
+ "node_modules/shebang-regex/index.js"(exports, module2) {
23351
+ "use strict";
23352
+ module2.exports = /^#!(.*)/;
23353
+ }
23354
+ });
23355
+
23356
+ // node_modules/shebang-command/index.js
23357
+ var require_shebang_command = __commonJS({
23358
+ "node_modules/shebang-command/index.js"(exports, module2) {
23359
+ "use strict";
23360
+ var shebangRegex = require_shebang_regex();
23361
+ module2.exports = (string = "") => {
23362
+ const match = string.match(shebangRegex);
23363
+ if (!match) {
23364
+ return null;
23365
+ }
23366
+ const [path, argument] = match[0].replace(/#! ?/, "").split(" ");
23367
+ const binary = path.split("/").pop();
23368
+ if (binary === "env") {
23369
+ return argument;
23370
+ }
23371
+ return argument ? `${binary} ${argument}` : binary;
23372
+ };
23373
+ }
23374
+ });
23375
+
23376
+ // node_modules/cross-spawn/lib/util/readShebang.js
23377
+ var require_readShebang = __commonJS({
23378
+ "node_modules/cross-spawn/lib/util/readShebang.js"(exports, module2) {
23379
+ "use strict";
23380
+ var fs = require("fs");
23381
+ var shebangCommand = require_shebang_command();
23382
+ function readShebang(command2) {
23383
+ const size = 150;
23384
+ const buffer = Buffer.alloc(size);
23385
+ let fd;
23386
+ try {
23387
+ fd = fs.openSync(command2, "r");
23388
+ fs.readSync(fd, buffer, 0, size, 0);
23389
+ fs.closeSync(fd);
23390
+ } catch (e2) {
23391
+ }
23392
+ return shebangCommand(buffer.toString());
23393
+ }
23394
+ module2.exports = readShebang;
23395
+ }
23396
+ });
23397
+
23398
+ // node_modules/cross-spawn/lib/parse.js
23399
+ var require_parse2 = __commonJS({
23400
+ "node_modules/cross-spawn/lib/parse.js"(exports, module2) {
23401
+ "use strict";
23402
+ var path = require("path");
23403
+ var resolveCommand = require_resolveCommand();
23404
+ var escape = require_escape();
23405
+ var readShebang = require_readShebang();
23406
+ var isWin = process.platform === "win32";
23407
+ var isExecutableRegExp = /\.(?:com|exe)$/i;
23408
+ var isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
23409
+ function detectShebang(parsed) {
23410
+ parsed.file = resolveCommand(parsed);
23411
+ const shebang = parsed.file && readShebang(parsed.file);
23412
+ if (shebang) {
23413
+ parsed.args.unshift(parsed.file);
23414
+ parsed.command = shebang;
23415
+ return resolveCommand(parsed);
23416
+ }
23417
+ return parsed.file;
23418
+ }
23419
+ function parseNonShell(parsed) {
23420
+ if (!isWin) {
23421
+ return parsed;
23422
+ }
23423
+ const commandFile = detectShebang(parsed);
23424
+ const needsShell = !isExecutableRegExp.test(commandFile);
23425
+ if (parsed.options.forceShell || needsShell) {
23426
+ const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
23427
+ parsed.command = path.normalize(parsed.command);
23428
+ parsed.command = escape.command(parsed.command);
23429
+ parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
23430
+ const shellCommand = [parsed.command].concat(parsed.args).join(" ");
23431
+ parsed.args = ["/d", "/s", "/c", `"${shellCommand}"`];
23432
+ parsed.command = process.env.comspec || "cmd.exe";
23433
+ parsed.options.windowsVerbatimArguments = true;
23434
+ }
23435
+ return parsed;
23436
+ }
23437
+ function parse(command2, args, options) {
23438
+ if (args && !Array.isArray(args)) {
23439
+ options = args;
23440
+ args = null;
23441
+ }
23442
+ args = args ? args.slice(0) : [];
23443
+ options = Object.assign({}, options);
23444
+ const parsed = {
23445
+ command: command2,
23446
+ args,
23447
+ options,
23448
+ file: void 0,
23449
+ original: {
23450
+ command: command2,
23451
+ args
23452
+ }
23453
+ };
23454
+ return options.shell ? parsed : parseNonShell(parsed);
23455
+ }
23456
+ module2.exports = parse;
23457
+ }
23458
+ });
23459
+
23460
+ // node_modules/cross-spawn/lib/enoent.js
23461
+ var require_enoent = __commonJS({
23462
+ "node_modules/cross-spawn/lib/enoent.js"(exports, module2) {
23463
+ "use strict";
23464
+ var isWin = process.platform === "win32";
23465
+ function notFoundError(original, syscall) {
23466
+ return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), {
23467
+ code: "ENOENT",
23468
+ errno: "ENOENT",
23469
+ syscall: `${syscall} ${original.command}`,
23470
+ path: original.command,
23471
+ spawnargs: original.args
23472
+ });
23473
+ }
23474
+ function hookChildProcess(cp, parsed) {
23475
+ if (!isWin) {
23476
+ return;
23477
+ }
23478
+ const originalEmit = cp.emit;
23479
+ cp.emit = function(name, arg1) {
23480
+ if (name === "exit") {
23481
+ const err = verifyENOENT(arg1, parsed, "spawn");
23482
+ if (err) {
23483
+ return originalEmit.call(cp, "error", err);
23484
+ }
23485
+ }
23486
+ return originalEmit.apply(cp, arguments);
23487
+ };
23488
+ }
23489
+ function verifyENOENT(status, parsed) {
23490
+ if (isWin && status === 1 && !parsed.file) {
23491
+ return notFoundError(parsed.original, "spawn");
23492
+ }
23493
+ return null;
23494
+ }
23495
+ function verifyENOENTSync(status, parsed) {
23496
+ if (isWin && status === 1 && !parsed.file) {
23497
+ return notFoundError(parsed.original, "spawnSync");
23498
+ }
23499
+ return null;
23500
+ }
23501
+ module2.exports = {
23502
+ hookChildProcess,
23503
+ verifyENOENT,
23504
+ verifyENOENTSync,
23505
+ notFoundError
23506
+ };
23507
+ }
23508
+ });
23509
+
23510
+ // node_modules/cross-spawn/index.js
23511
+ var require_cross_spawn = __commonJS({
23512
+ "node_modules/cross-spawn/index.js"(exports, module2) {
23513
+ "use strict";
23514
+ var cp = require("child_process");
23515
+ var parse = require_parse2();
23516
+ var enoent = require_enoent();
23517
+ function spawn(command2, args, options) {
23518
+ const parsed = parse(command2, args, options);
23519
+ const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
23520
+ enoent.hookChildProcess(spawned, parsed);
23521
+ return spawned;
23522
+ }
23523
+ function spawnSync(command2, args, options) {
23524
+ const parsed = parse(command2, args, options);
23525
+ const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
23526
+ result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
23527
+ return result;
23528
+ }
23529
+ module2.exports = spawn;
23530
+ module2.exports.spawn = spawn;
23531
+ module2.exports.sync = spawnSync;
23532
+ module2.exports._parse = parse;
23533
+ module2.exports._enoent = enoent;
23534
+ }
23535
+ });
23536
+
23537
+ // node_modules/signal-exit/signals.js
23538
+ var require_signals = __commonJS({
23539
+ "node_modules/signal-exit/signals.js"(exports, module2) {
23540
+ module2.exports = [
23541
+ "SIGABRT",
23542
+ "SIGALRM",
23543
+ "SIGHUP",
23544
+ "SIGINT",
23545
+ "SIGTERM"
23546
+ ];
23547
+ if (process.platform !== "win32") {
23548
+ module2.exports.push(
23549
+ "SIGVTALRM",
23550
+ "SIGXCPU",
23551
+ "SIGXFSZ",
23552
+ "SIGUSR2",
23553
+ "SIGTRAP",
23554
+ "SIGSYS",
23555
+ "SIGQUIT",
23556
+ "SIGIOT"
23557
+ );
23558
+ }
23559
+ if (process.platform === "linux") {
23560
+ module2.exports.push(
23561
+ "SIGIO",
23562
+ "SIGPOLL",
23563
+ "SIGPWR",
23564
+ "SIGSTKFLT",
23565
+ "SIGUNUSED"
23566
+ );
23567
+ }
23568
+ }
23569
+ });
23570
+
23571
+ // node_modules/signal-exit/index.js
23572
+ var require_signal_exit = __commonJS({
23573
+ "node_modules/signal-exit/index.js"(exports, module2) {
23574
+ var process3 = global.process;
23575
+ var processOk = function(process4) {
23576
+ return process4 && typeof process4 === "object" && typeof process4.removeListener === "function" && typeof process4.emit === "function" && typeof process4.reallyExit === "function" && typeof process4.listeners === "function" && typeof process4.kill === "function" && typeof process4.pid === "number" && typeof process4.on === "function";
23577
+ };
23578
+ if (!processOk(process3)) {
23579
+ module2.exports = function() {
23580
+ return function() {
23581
+ };
23582
+ };
23583
+ } else {
23584
+ assert = require("assert");
23585
+ signals = require_signals();
23586
+ isWin = /^win/i.test(process3.platform);
23587
+ EE = require("events");
23588
+ if (typeof EE !== "function") {
23589
+ EE = EE.EventEmitter;
23590
+ }
23591
+ if (process3.__signal_exit_emitter__) {
23592
+ emitter = process3.__signal_exit_emitter__;
23593
+ } else {
23594
+ emitter = process3.__signal_exit_emitter__ = new EE();
23595
+ emitter.count = 0;
23596
+ emitter.emitted = {};
23597
+ }
23598
+ if (!emitter.infinite) {
23599
+ emitter.setMaxListeners(Infinity);
23600
+ emitter.infinite = true;
23601
+ }
23602
+ module2.exports = function(cb, opts) {
23603
+ if (!processOk(global.process)) {
23604
+ return function() {
23605
+ };
23606
+ }
23607
+ assert.equal(typeof cb, "function", "a callback must be provided for exit handler");
23608
+ if (loaded === false) {
23609
+ load();
23610
+ }
23611
+ var ev = "exit";
23612
+ if (opts && opts.alwaysLast) {
23613
+ ev = "afterexit";
23614
+ }
23615
+ var remove = function() {
23616
+ emitter.removeListener(ev, cb);
23617
+ if (emitter.listeners("exit").length === 0 && emitter.listeners("afterexit").length === 0) {
23618
+ unload();
23619
+ }
23620
+ };
23621
+ emitter.on(ev, cb);
23622
+ return remove;
23623
+ };
23624
+ unload = function unload2() {
23625
+ if (!loaded || !processOk(global.process)) {
23626
+ return;
23627
+ }
23628
+ loaded = false;
23629
+ signals.forEach(function(sig) {
23630
+ try {
23631
+ process3.removeListener(sig, sigListeners[sig]);
23632
+ } catch (er) {
23633
+ }
23634
+ });
23635
+ process3.emit = originalProcessEmit;
23636
+ process3.reallyExit = originalProcessReallyExit;
23637
+ emitter.count -= 1;
23638
+ };
23639
+ module2.exports.unload = unload;
23640
+ emit = function emit2(event, code, signal) {
23641
+ if (emitter.emitted[event]) {
23642
+ return;
23643
+ }
23644
+ emitter.emitted[event] = true;
23645
+ emitter.emit(event, code, signal);
23646
+ };
23647
+ sigListeners = {};
23648
+ signals.forEach(function(sig) {
23649
+ sigListeners[sig] = function listener() {
23650
+ if (!processOk(global.process)) {
23651
+ return;
23652
+ }
23653
+ var listeners = process3.listeners(sig);
23654
+ if (listeners.length === emitter.count) {
23655
+ unload();
23656
+ emit("exit", null, sig);
23657
+ emit("afterexit", null, sig);
23658
+ if (isWin && sig === "SIGHUP") {
23659
+ sig = "SIGINT";
23660
+ }
23661
+ process3.kill(process3.pid, sig);
23662
+ }
23663
+ };
23664
+ });
23665
+ module2.exports.signals = function() {
23666
+ return signals;
23667
+ };
23668
+ loaded = false;
23669
+ load = function load2() {
23670
+ if (loaded || !processOk(global.process)) {
23671
+ return;
23672
+ }
23673
+ loaded = true;
23674
+ emitter.count += 1;
23675
+ signals = signals.filter(function(sig) {
23676
+ try {
23677
+ process3.on(sig, sigListeners[sig]);
23678
+ return true;
23679
+ } catch (er) {
23680
+ return false;
23681
+ }
23682
+ });
23683
+ process3.emit = processEmit;
23684
+ process3.reallyExit = processReallyExit;
23685
+ };
23686
+ module2.exports.load = load;
23687
+ originalProcessReallyExit = process3.reallyExit;
23688
+ processReallyExit = function processReallyExit2(code) {
23689
+ if (!processOk(global.process)) {
23690
+ return;
23691
+ }
23692
+ process3.exitCode = code || 0;
23693
+ emit("exit", process3.exitCode, null);
23694
+ emit("afterexit", process3.exitCode, null);
23695
+ originalProcessReallyExit.call(process3, process3.exitCode);
23696
+ };
23697
+ originalProcessEmit = process3.emit;
23698
+ processEmit = function processEmit2(ev, arg) {
23699
+ if (ev === "exit" && processOk(global.process)) {
23700
+ if (arg !== void 0) {
23701
+ process3.exitCode = arg;
23702
+ }
23703
+ var ret = originalProcessEmit.apply(this, arguments);
23704
+ emit("exit", process3.exitCode, null);
23705
+ emit("afterexit", process3.exitCode, null);
23706
+ return ret;
23707
+ } else {
23708
+ return originalProcessEmit.apply(this, arguments);
23709
+ }
23710
+ };
23711
+ }
23712
+ var assert;
23713
+ var signals;
23714
+ var isWin;
23715
+ var EE;
23716
+ var emitter;
23717
+ var unload;
23718
+ var emit;
23719
+ var sigListeners;
23720
+ var loaded;
23721
+ var load;
23722
+ var originalProcessReallyExit;
23723
+ var processReallyExit;
23724
+ var originalProcessEmit;
23725
+ var processEmit;
23726
+ }
23727
+ });
23728
+
23729
+ // node_modules/get-stream/buffer-stream.js
23730
+ var require_buffer_stream = __commonJS({
23731
+ "node_modules/get-stream/buffer-stream.js"(exports, module2) {
23732
+ "use strict";
23733
+ var { PassThrough: PassThroughStream } = require("stream");
23734
+ module2.exports = (options) => {
23735
+ options = { ...options };
23736
+ const { array } = options;
23737
+ let { encoding } = options;
23738
+ const isBuffer2 = encoding === "buffer";
23739
+ let objectMode = false;
23740
+ if (array) {
23741
+ objectMode = !(encoding || isBuffer2);
23742
+ } else {
23743
+ encoding = encoding || "utf8";
23744
+ }
23745
+ if (isBuffer2) {
23746
+ encoding = null;
23747
+ }
23748
+ const stream4 = new PassThroughStream({ objectMode });
23749
+ if (encoding) {
23750
+ stream4.setEncoding(encoding);
23751
+ }
23752
+ let length = 0;
23753
+ const chunks = [];
23754
+ stream4.on("data", (chunk) => {
23755
+ chunks.push(chunk);
23756
+ if (objectMode) {
23757
+ length = chunks.length;
23758
+ } else {
23759
+ length += chunk.length;
23760
+ }
23761
+ });
23762
+ stream4.getBufferedValue = () => {
23763
+ if (array) {
23764
+ return chunks;
23765
+ }
23766
+ return isBuffer2 ? Buffer.concat(chunks, length) : chunks.join("");
23767
+ };
23768
+ stream4.getBufferedLength = () => length;
23769
+ return stream4;
23770
+ };
23771
+ }
23772
+ });
23773
+
23774
+ // node_modules/get-stream/index.js
23775
+ var require_get_stream = __commonJS({
23776
+ "node_modules/get-stream/index.js"(exports, module2) {
23777
+ "use strict";
23778
+ var { constants: BufferConstants } = require("buffer");
23779
+ var stream4 = require("stream");
23780
+ var { promisify } = require("util");
23781
+ var bufferStream = require_buffer_stream();
23782
+ var streamPipelinePromisified = promisify(stream4.pipeline);
23783
+ var MaxBufferError = class extends Error {
23784
+ constructor() {
23785
+ super("maxBuffer exceeded");
23786
+ this.name = "MaxBufferError";
23787
+ }
23788
+ };
23789
+ async function getStream2(inputStream, options) {
23790
+ if (!inputStream) {
23791
+ throw new Error("Expected a stream");
23792
+ }
23793
+ options = {
23794
+ maxBuffer: Infinity,
23795
+ ...options
23796
+ };
23797
+ const { maxBuffer } = options;
23798
+ const stream5 = bufferStream(options);
23799
+ await new Promise((resolve, reject) => {
23800
+ const rejectPromise = (error) => {
23801
+ if (error && stream5.getBufferedLength() <= BufferConstants.MAX_LENGTH) {
23802
+ error.bufferedData = stream5.getBufferedValue();
23803
+ }
23804
+ reject(error);
23805
+ };
23806
+ (async () => {
23807
+ try {
23808
+ await streamPipelinePromisified(inputStream, stream5);
23809
+ resolve();
23810
+ } catch (error) {
23811
+ rejectPromise(error);
23812
+ }
23813
+ })();
23814
+ stream5.on("data", () => {
23815
+ if (stream5.getBufferedLength() > maxBuffer) {
23816
+ rejectPromise(new MaxBufferError());
23817
+ }
23818
+ });
23819
+ });
23820
+ return stream5.getBufferedValue();
23821
+ }
23822
+ module2.exports = getStream2;
23823
+ module2.exports.buffer = (stream5, options) => getStream2(stream5, { ...options, encoding: "buffer" });
23824
+ module2.exports.array = (stream5, options) => getStream2(stream5, { ...options, array: true });
23825
+ module2.exports.MaxBufferError = MaxBufferError;
23826
+ }
23827
+ });
23828
+
23829
+ // node_modules/merge-stream/index.js
23830
+ var require_merge_stream = __commonJS({
23831
+ "node_modules/merge-stream/index.js"(exports, module2) {
23832
+ "use strict";
23833
+ var { PassThrough } = require("stream");
23834
+ module2.exports = function() {
23835
+ var sources = [];
23836
+ var output = new PassThrough({ objectMode: true });
23837
+ output.setMaxListeners(0);
23838
+ output.add = add;
23839
+ output.isEmpty = isEmpty;
23840
+ output.on("unpipe", remove);
23841
+ Array.prototype.slice.call(arguments).forEach(add);
23842
+ return output;
23843
+ function add(source) {
23844
+ if (Array.isArray(source)) {
23845
+ source.forEach(add);
23846
+ return this;
23847
+ }
23848
+ sources.push(source);
23849
+ source.once("end", remove.bind(null, source));
23850
+ source.once("error", output.emit.bind(output, "error"));
23851
+ source.pipe(output, { end: false });
23852
+ return this;
23853
+ }
23854
+ function isEmpty() {
23855
+ return sources.length == 0;
23856
+ }
23857
+ function remove(source) {
23858
+ sources = sources.filter(function(it) {
23859
+ return it !== source;
23860
+ });
23861
+ if (!sources.length && output.readable) {
23862
+ output.end();
23863
+ }
23864
+ }
23865
+ };
23866
+ }
23867
+ });
23868
+
23042
23869
  // src/github-action.ts
23043
23870
  var import_core3 = __toESM(require_core(), 1);
23044
23871
  var import_github = __toESM(require_github(), 1);
@@ -23310,8 +24137,8 @@ var stripBOM = (content) => {
23310
24137
  }
23311
24138
  return content;
23312
24139
  };
23313
- var inherits = (constructor, superConstructor, props, descriptors2) => {
23314
- constructor.prototype = Object.create(superConstructor.prototype, descriptors2);
24140
+ var inherits = (constructor, superConstructor, props, descriptors3) => {
24141
+ constructor.prototype = Object.create(superConstructor.prototype, descriptors3);
23315
24142
  constructor.prototype.constructor = constructor;
23316
24143
  Object.defineProperty(constructor, "super", {
23317
24144
  value: superConstructor.prototype
@@ -23397,9 +24224,9 @@ var toCamelCase = (str) => {
23397
24224
  var hasOwnProperty = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop) => hasOwnProperty2.call(obj, prop))(Object.prototype);
23398
24225
  var isRegExp = kindOfTest("RegExp");
23399
24226
  var reduceDescriptors = (obj, reducer) => {
23400
- const descriptors2 = Object.getOwnPropertyDescriptors(obj);
24227
+ const descriptors3 = Object.getOwnPropertyDescriptors(obj);
23401
24228
  const reducedDescriptors = {};
23402
- forEach(descriptors2, (descriptor, name) => {
24229
+ forEach(descriptors3, (descriptor, name) => {
23403
24230
  if (reducer(descriptor, name, obj) !== false) {
23404
24231
  reducedDescriptors[name] = descriptor;
23405
24232
  }
@@ -26983,6 +27810,103 @@ function tokenCount(content) {
26983
27810
  return tokens.length;
26984
27811
  }
26985
27812
 
27813
+ // node_modules/execa/index.js
27814
+ var import_cross_spawn = __toESM(require_cross_spawn(), 1);
27815
+
27816
+ // node_modules/mimic-fn/index.js
27817
+ var copyProperty = (to, from, property, ignoreNonConfigurable) => {
27818
+ if (property === "length" || property === "prototype") {
27819
+ return;
27820
+ }
27821
+ if (property === "arguments" || property === "caller") {
27822
+ return;
27823
+ }
27824
+ const toDescriptor = Object.getOwnPropertyDescriptor(to, property);
27825
+ const fromDescriptor = Object.getOwnPropertyDescriptor(from, property);
27826
+ if (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) {
27827
+ return;
27828
+ }
27829
+ Object.defineProperty(to, property, fromDescriptor);
27830
+ };
27831
+ var canCopyProperty = function(toDescriptor, fromDescriptor) {
27832
+ return toDescriptor === void 0 || toDescriptor.configurable || toDescriptor.writable === fromDescriptor.writable && toDescriptor.enumerable === fromDescriptor.enumerable && toDescriptor.configurable === fromDescriptor.configurable && (toDescriptor.writable || toDescriptor.value === fromDescriptor.value);
27833
+ };
27834
+ var changePrototype = (to, from) => {
27835
+ const fromPrototype = Object.getPrototypeOf(from);
27836
+ if (fromPrototype === Object.getPrototypeOf(to)) {
27837
+ return;
27838
+ }
27839
+ Object.setPrototypeOf(to, fromPrototype);
27840
+ };
27841
+ var wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/
27842
+ ${fromBody}`;
27843
+ var toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, "toString");
27844
+ var toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, "name");
27845
+ var changeToString = (to, from, name) => {
27846
+ const withName = name === "" ? "" : `with ${name.trim()}() `;
27847
+ const newToString = wrappedToString.bind(null, withName, from.toString());
27848
+ Object.defineProperty(newToString, "name", toStringName);
27849
+ Object.defineProperty(to, "toString", { ...toStringDescriptor, value: newToString });
27850
+ };
27851
+ function mimicFunction(to, from, { ignoreNonConfigurable = false } = {}) {
27852
+ const { name } = to;
27853
+ for (const property of Reflect.ownKeys(from)) {
27854
+ copyProperty(to, from, property, ignoreNonConfigurable);
27855
+ }
27856
+ changePrototype(to, from);
27857
+ changeToString(to, from, name);
27858
+ return to;
27859
+ }
27860
+
27861
+ // node_modules/onetime/index.js
27862
+ var calledFunctions = /* @__PURE__ */ new WeakMap();
27863
+ var onetime = (function_, options = {}) => {
27864
+ if (typeof function_ !== "function") {
27865
+ throw new TypeError("Expected a function");
27866
+ }
27867
+ let returnValue;
27868
+ let callCount = 0;
27869
+ const functionName = function_.displayName || function_.name || "<anonymous>";
27870
+ const onetime2 = function(...arguments_) {
27871
+ calledFunctions.set(onetime2, ++callCount);
27872
+ if (callCount === 1) {
27873
+ returnValue = function_.apply(this, arguments_);
27874
+ function_ = null;
27875
+ } else if (options.throw === true) {
27876
+ throw new Error(`Function \`${functionName}\` can only be called once`);
27877
+ }
27878
+ return returnValue;
27879
+ };
27880
+ mimicFunction(onetime2, function_);
27881
+ calledFunctions.set(onetime2, callCount);
27882
+ return onetime2;
27883
+ };
27884
+ onetime.callCount = (function_) => {
27885
+ if (!calledFunctions.has(function_)) {
27886
+ throw new Error(`The given function \`${function_.name}\` is not wrapped by the \`onetime\` package`);
27887
+ }
27888
+ return calledFunctions.get(function_);
27889
+ };
27890
+
27891
+ // node_modules/execa/lib/kill.js
27892
+ var import_signal_exit = __toESM(require_signal_exit(), 1);
27893
+ var DEFAULT_FORCE_KILL_TIMEOUT = 1e3 * 5;
27894
+
27895
+ // node_modules/execa/lib/stream.js
27896
+ var import_get_stream = __toESM(require_get_stream(), 1);
27897
+ var import_merge_stream = __toESM(require_merge_stream(), 1);
27898
+
27899
+ // node_modules/execa/lib/promise.js
27900
+ var nativePromisePrototype = (async () => {
27901
+ })().constructor.prototype;
27902
+ var descriptors2 = ["then", "catch", "finally"].map((property) => [
27903
+ property,
27904
+ Reflect.getOwnPropertyDescriptor(nativePromisePrototype, property)
27905
+ ]);
27906
+
27907
+ // node_modules/execa/index.js
27908
+ var DEFAULT_MAX_BUFFER = 1e3 * 1e3 * 100;
27909
+
26986
27910
  // src/api.ts
26987
27911
  var config2 = getConfig();
26988
27912
  var maxTokens = config2?.OCO_OPENAI_MAX_TOKENS;
@@ -27020,9 +27944,7 @@ var OpenAi = class {
27020
27944
  max_tokens: maxTokens || 500
27021
27945
  };
27022
27946
  try {
27023
- const REQUEST_TOKENS = messages.map(
27024
- (msg) => tokenCount(msg.content) + 4
27025
- ).reduce((a2, b) => a2 + b, 0);
27947
+ const REQUEST_TOKENS = messages.map((msg) => tokenCount(msg.content) + 4).reduce((a2, b) => a2 + b, 0);
27026
27948
  if (REQUEST_TOKENS > DEFAULT_MODEL_TOKEN_LIMIT - maxTokens) {
27027
27949
  throw new Error("TOO_MUCH_TOKENS" /* tooMuchTokens */);
27028
27950
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencommit",
3
- "version": "2.2.9",
3
+ "version": "2.2.10",
4
4
  "description": "Auto-generate impressive commits in 1 second. Killing lame commits with AI 🤯🔫",
5
5
  "keywords": [
6
6
  "git",