@sensio-erp/commit-ai 1.0.4 → 1.0.6
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/bin/commit-ai.js +17 -15
- package/package.json +1 -1
- package/src/openai.js +1 -1
package/bin/commit-ai.js
CHANGED
|
@@ -6,8 +6,8 @@ const fs = require("fs");
|
|
|
6
6
|
const path = require("path");
|
|
7
7
|
const { generateCommit } = require("../src/openai");
|
|
8
8
|
|
|
9
|
-
if (!process.env.
|
|
10
|
-
console.error("❌
|
|
9
|
+
if (!process.env.OPENAI_API_KEY_COMMIT) {
|
|
10
|
+
console.error("❌ OPENAI_API_KEY_COMMIT não definida");
|
|
11
11
|
process.exit(1);
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -64,27 +64,29 @@ ${diff}
|
|
|
64
64
|
console.log(chalk.green("\n✨ Commit sugerido:\n"));
|
|
65
65
|
console.log(chalk.white(commitMessage));
|
|
66
66
|
console.log("\n");
|
|
67
|
-
|
|
68
|
-
const answers = await inquirer.prompt([
|
|
69
|
-
{
|
|
70
|
-
type: "editor",
|
|
71
|
-
name: "message",
|
|
72
|
-
message: "✏️ Edite o commit se quiser:",
|
|
73
|
-
default: commitMessage
|
|
74
|
-
},
|
|
67
|
+
const { confirm } = await inquirer.prompt([
|
|
75
68
|
{
|
|
76
69
|
type: "confirm",
|
|
77
70
|
name: "confirm",
|
|
78
|
-
message: "🚀
|
|
71
|
+
message: "🚀 Executar commit gerado?",
|
|
79
72
|
default: true
|
|
80
73
|
}
|
|
81
74
|
]);
|
|
82
75
|
|
|
83
|
-
|
|
76
|
+
let finalMessage = commitMessage;
|
|
84
77
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
78
|
+
// Se NÃO confirmar → abre editor
|
|
79
|
+
if (!confirm) {
|
|
80
|
+
const { message } = await inquirer.prompt([
|
|
81
|
+
{
|
|
82
|
+
type: "editor",
|
|
83
|
+
name: "message",
|
|
84
|
+
message: "✏️ Edite o commit:",
|
|
85
|
+
default: commitMessage
|
|
86
|
+
}
|
|
87
|
+
]);
|
|
88
|
+
|
|
89
|
+
finalMessage = message.trim();
|
|
88
90
|
}
|
|
89
91
|
|
|
90
92
|
commitWithMessage(finalMessage);
|
package/package.json
CHANGED