opencommit 2.0.1 → 2.0.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/out/cli.cjs +14 -5
  2. package/package.json +1 -1
package/out/cli.cjs CHANGED
@@ -16076,7 +16076,7 @@ function G3(t, e2) {
16076
16076
  // package.json
16077
16077
  var package_default = {
16078
16078
  name: "opencommit",
16079
- version: "2.0.0",
16079
+ version: "2.0.1",
16080
16080
  description: "GPT CLI to auto-generate impressive commits in 1 second. Killing lame commits with AI \u{1F92F}\u{1F52B}",
16081
16081
  keywords: [
16082
16082
  "git",
@@ -17195,8 +17195,8 @@ var source_default = chalk;
17195
17195
  // src/i18n/en.json
17196
17196
  var en_default = {
17197
17197
  localLanguage: "english",
17198
- commitFix: "fix(server.ts): change port variable case from lowercase port to uppercase PORT",
17199
- commitFeat: "feat(server.ts): add support for process.env.PORT environment variable",
17198
+ commitFix: "fix(server.ts): change port variable case from lowercase port to uppercase PORT to improve semantics",
17199
+ commitFeat: "feat(server.ts): add support for process.env.PORT environment variable to be able to run app on a configurable port",
17200
17200
  commitDescription: "The port variable is now named PORT, which improves consistency with the naming conventions as PORT is a constant. Support for an environment variable allows the application to be more flexible as it can now run on any available port specified via the process.env.PORT environment variable."
17201
17201
  };
17202
17202
 
@@ -17452,6 +17452,14 @@ var configValidators = {
17452
17452
  `${value} is not supported yet`
17453
17453
  );
17454
17454
  return value;
17455
+ },
17456
+ ["model" /* model */](value) {
17457
+ validateConfig(
17458
+ "OPENAI_BASE_PATH" /* OPENAI_BASE_PATH */,
17459
+ value === "gpt-3.5-turbo" || value === "gpt-4",
17460
+ `${value} is not supported yet, use 'gpt-4' or 'gpt-3.5-turbo' (default)`
17461
+ );
17462
+ return value;
17455
17463
  }
17456
17464
  };
17457
17465
  var configPath = (0, import_path.join)((0, import_os.homedir)(), ".opencommit");
@@ -21440,6 +21448,7 @@ if (!apiKey && command !== "config" && mode !== "set" /* set */) {
21440
21448
  );
21441
21449
  process.exit(1);
21442
21450
  }
21451
+ var MODEL = config?.model || "gpt-3.5-turbo";
21443
21452
  var OpenAi = class {
21444
21453
  openAiApiConfiguration = new import_openai.Configuration({
21445
21454
  apiKey
@@ -21454,7 +21463,7 @@ var OpenAi = class {
21454
21463
  generateCommitMessage = async (messages) => {
21455
21464
  try {
21456
21465
  const { data } = await this.openAI.createChatCompletion({
21457
- model: "gpt-3.5-turbo",
21466
+ model: MODEL,
21458
21467
  messages,
21459
21468
  temperature: 0,
21460
21469
  top_p: 0.1,
@@ -21518,7 +21527,7 @@ var translation = i18n[config2?.language || "en"];
21518
21527
  var INIT_MESSAGES_PROMPT = [
21519
21528
  {
21520
21529
  role: import_openai2.ChatCompletionRequestMessageRoleEnum.System,
21521
- content: `You are to act as the author of a commit message in git. Your mission is to create clean and comprehensive commit messages in the conventional commit convention and explain why a change was done. I'll send you an output of 'git diff --staged' command, and you convert it into a commit message.
21530
+ content: `You are to act as the author of a commit message in git. Your mission is to create clean and comprehensive commit messages in the conventional commit convention and explain WHAT were the changes and WHY the changes were done. I'll send you an output of 'git diff --staged' command, and you convert it into a commit message.
21522
21531
  ${config2?.emoji ? "Use GitMoji convention to preface the commit." : "Do not preface the commit with anything."}
21523
21532
  ${config2?.description ? `Add a short description of WHY the changes are done after the commit message. Don't start it with "This commit", just describe the changes.` : "Don't add any descriptions to the commit, only commit message."}
21524
21533
  Use the present tense. Lines must not be longer than 74 characters. Use ${translation.localLanguage} to answer.`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencommit",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "GPT CLI to auto-generate impressive commits in 1 second. Killing lame commits with AI 🤯🔫",
5
5
  "keywords": [
6
6
  "git",