opencommit 1.0.11 → 1.0.13

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/out/cli.cjs +27 -26
  2. package/package.json +1 -1
package/out/cli.cjs CHANGED
@@ -651,12 +651,12 @@ var require_readShebang = __commonJS({
651
651
  "use strict";
652
652
  var fs3 = require("fs");
653
653
  var shebangCommand = require_shebang_command();
654
- function readShebang(command) {
654
+ function readShebang(command2) {
655
655
  const size = 150;
656
656
  const buffer = Buffer.alloc(size);
657
657
  let fd;
658
658
  try {
659
- fd = fs3.openSync(command, "r");
659
+ fd = fs3.openSync(command2, "r");
660
660
  fs3.readSync(fd, buffer, 0, size, 0);
661
661
  fs3.closeSync(fd);
662
662
  } catch (e2) {
@@ -706,7 +706,7 @@ var require_parse = __commonJS({
706
706
  }
707
707
  return parsed;
708
708
  }
709
- function parse(command, args, options) {
709
+ function parse(command2, args, options) {
710
710
  if (args && !Array.isArray(args)) {
711
711
  options = args;
712
712
  args = null;
@@ -714,12 +714,12 @@ var require_parse = __commonJS({
714
714
  args = args ? args.slice(0) : [];
715
715
  options = Object.assign({}, options);
716
716
  const parsed = {
717
- command,
717
+ command: command2,
718
718
  args,
719
719
  options,
720
720
  file: void 0,
721
721
  original: {
722
- command,
722
+ command: command2,
723
723
  args
724
724
  }
725
725
  };
@@ -786,14 +786,14 @@ var require_cross_spawn = __commonJS({
786
786
  var cp = require("child_process");
787
787
  var parse = require_parse();
788
788
  var enoent = require_enoent();
789
- function spawn(command, args, options) {
790
- const parsed = parse(command, args, options);
789
+ function spawn(command2, args, options) {
790
+ const parsed = parse(command2, args, options);
791
791
  const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
792
792
  enoent.hookChildProcess(spawned, parsed);
793
793
  return spawned;
794
794
  }
795
- function spawnSync(command, args, options) {
796
- const parsed = parse(command, args, options);
795
+ function spawnSync(command2, args, options) {
796
+ const parsed = parse(command2, args, options);
797
797
  const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
798
798
  result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
799
799
  return result;
@@ -15412,7 +15412,7 @@ function G3(t, e2) {
15412
15412
  // package.json
15413
15413
  var package_default = {
15414
15414
  name: "opencommit",
15415
- version: "1.0.10",
15415
+ version: "1.0.12",
15416
15416
  description: "GPT CLI to auto-generate impressive commits in 1 second. Killing lame commits with AI \u{1F92F}\u{1F52B}",
15417
15417
  keywords: [
15418
15418
  "git",
@@ -16280,19 +16280,19 @@ var configCommand = G3(
16280
16280
  async (argv) => {
16281
16281
  ae("opencommit \u2014 config");
16282
16282
  try {
16283
- const { mode, keyValues } = argv._;
16284
- if (mode === "get") {
16283
+ const { mode: mode2, keyValues } = argv._;
16284
+ if (mode2 === "get") {
16285
16285
  const config3 = getConfig() || {};
16286
16286
  for (const key of keyValues) {
16287
16287
  ce(`${key}=${config3[key]}`);
16288
16288
  }
16289
- } else if (mode === "set") {
16289
+ } else if (mode2 === "set") {
16290
16290
  await setConfig(
16291
16291
  keyValues.map((keyValue) => keyValue.split("="))
16292
16292
  );
16293
16293
  } else {
16294
16294
  throw new Error(
16295
- `Unsupported mode: ${mode}. Valid modes are: "set" and "get"`
16295
+ `Unsupported mode: ${mode2}. Valid modes are: "set" and "get"`
16296
16296
  );
16297
16297
  }
16298
16298
  } catch (error) {
@@ -16843,7 +16843,7 @@ var makeError = ({
16843
16843
  error,
16844
16844
  signal,
16845
16845
  exitCode,
16846
- command,
16846
+ command: command2,
16847
16847
  escapedCommand,
16848
16848
  timedOut,
16849
16849
  isCanceled,
@@ -16855,7 +16855,7 @@ var makeError = ({
16855
16855
  const signalDescription = signal === void 0 ? void 0 : signalsByName[signal].description;
16856
16856
  const errorCode = error && error.code;
16857
16857
  const prefix = getErrorPrefix({ timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled });
16858
- const execaMessage = `Command ${prefix}: ${command}`;
16858
+ const execaMessage = `Command ${prefix}: ${command2}`;
16859
16859
  const isError = Object.prototype.toString.call(error) === "[object Error]";
16860
16860
  const shortMessage = isError ? `${execaMessage}
16861
16861
  ${error.message}` : execaMessage;
@@ -16867,7 +16867,7 @@ ${error.message}` : execaMessage;
16867
16867
  error = new Error(message);
16868
16868
  }
16869
16869
  error.shortMessage = shortMessage;
16870
- error.command = command;
16870
+ error.command = command2;
16871
16871
  error.escapedCommand = escapedCommand;
16872
16872
  error.exitCode = exitCode;
16873
16873
  error.signal = signal;
@@ -17145,7 +17145,7 @@ var handleOutput = (options, value, error) => {
17145
17145
  };
17146
17146
  function execa(file, args, options) {
17147
17147
  const parsed = handleArguments(file, args, options);
17148
- const command = joinCommand(file, args);
17148
+ const command2 = joinCommand(file, args);
17149
17149
  const escapedCommand = getEscapedCommand(file, args);
17150
17150
  validateTimeout(parsed.options);
17151
17151
  let spawned;
@@ -17158,7 +17158,7 @@ function execa(file, args, options) {
17158
17158
  stdout: "",
17159
17159
  stderr: "",
17160
17160
  all: "",
17161
- command,
17161
+ command: command2,
17162
17162
  escapedCommand,
17163
17163
  parsed,
17164
17164
  timedOut: false,
@@ -17186,7 +17186,7 @@ function execa(file, args, options) {
17186
17186
  stdout,
17187
17187
  stderr,
17188
17188
  all,
17189
- command,
17189
+ command: command2,
17190
17190
  escapedCommand,
17191
17191
  parsed,
17192
17192
  timedOut,
@@ -17199,7 +17199,7 @@ function execa(file, args, options) {
17199
17199
  throw returnedError;
17200
17200
  }
17201
17201
  return {
17202
- command,
17202
+ command: command2,
17203
17203
  escapedCommand,
17204
17204
  exitCode: 0,
17205
17205
  stdout,
@@ -17268,8 +17268,8 @@ var hookCommand = G3(
17268
17268
  const HOOK_URL = __filename;
17269
17269
  try {
17270
17270
  await assertGitRepo();
17271
- const { setUnset: mode } = argv._;
17272
- if (mode === "set") {
17271
+ const { setUnset: mode2 } = argv._;
17272
+ if (mode2 === "set") {
17273
17273
  ae(`setting opencommit as '${HOOK_NAME}' hook`);
17274
17274
  if (isHookExists) {
17275
17275
  let realPath;
@@ -17290,7 +17290,7 @@ var hookCommand = G3(
17290
17290
  await import_promises.default.chmod(SYMLINK_URL, 493);
17291
17291
  return ce(`${source_default.green("\u2714")} Hook set`);
17292
17292
  }
17293
- if (mode === "unset") {
17293
+ if (mode2 === "unset") {
17294
17294
  ae(`unsetting opencommit as '${HOOK_NAME}' hook`);
17295
17295
  if (!isHookExists) {
17296
17296
  return ce(
@@ -17307,7 +17307,7 @@ var hookCommand = G3(
17307
17307
  return ce(`${source_default.green("\u2714")} Hook is removed`);
17308
17308
  }
17309
17309
  throw new Error(
17310
- `unsupported mode: ${mode}. Supported modes are: 'set' or 'unset'`
17310
+ `unsupported mode: ${mode2}. Supported modes are: 'set' or 'unset'`
17311
17311
  );
17312
17312
  } catch (error) {
17313
17313
  ce(`${source_default.red("\u2716")} ${error}`);
@@ -17326,7 +17326,8 @@ var import_openai2 = __toESM(require_dist(), 1);
17326
17326
  var import_openai = __toESM(require_dist(), 1);
17327
17327
  var config = getConfig();
17328
17328
  var apiKey = config?.OPENAI_API_KEY;
17329
- if (!apiKey) {
17329
+ var [command, mode] = process.argv.slice(2);
17330
+ if (!apiKey && command !== "config" && mode !== "set") {
17330
17331
  ae("opencommit");
17331
17332
  ce(
17332
17333
  "OPENAI_API_KEY is not set, please run `oc config set OPENAI_API_KEY=<your token>`"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencommit",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
4
4
  "description": "GPT CLI to auto-generate impressive commits in 1 second. Killing lame commits with AI 🤯🔫",
5
5
  "keywords": [
6
6
  "git",