fixed bugs

This commit is contained in:
Hassan El Mghari
2023-02-13 15:37:41 -05:00
parent 053b10dc8a
commit 860bef86e7
2 changed files with 9 additions and 5 deletions

11
lib.js
View File

@@ -1,9 +1,10 @@
#!/usr/bin/env node #!/usr/bin/env node
const { execSync, spawn } = require("child_process");
let OPENAI_API_KEY = process.env.OPENAI_API_KEY;
import inquirer from "inquirer";
export async function main() { import { execSync } from "child_process";
import inquirer from "inquirer";
let OPENAI_API_KEY = process.env.OPENAI_API_KEY;
async function main() {
console.log("Welcome to AICommit!"); console.log("Welcome to AICommit!");
if (!OPENAI_API_KEY) { if (!OPENAI_API_KEY) {
console.error( console.error(
@@ -91,3 +92,5 @@ async function generateCommitMessage(prompt) {
return aiCommit.replace(/(\r\n|\n|\r)/gm, ""); return aiCommit.replace(/(\r\n|\n|\r)/gm, "");
} }
await main();

View File

@@ -1,11 +1,12 @@
{ {
"name": "aicommits", "name": "aicommits",
"version": "0.0.5", "version": "0.0.6",
"description": "Writes your git commit messages for you with AI", "description": "Writes your git commit messages for you with AI",
"main": "cli.js", "main": "cli.js",
"bin": { "bin": {
"aicommits": "./cli.js" "aicommits": "./cli.js"
}, },
"type": "module",
"repository": "https://github.com/Nutlope/aicommits", "repository": "https://github.com/Nutlope/aicommits",
"author": "Hassan El Mghari (@nutlope)", "author": "Hassan El Mghari (@nutlope)",
"license": "MIT", "license": "MIT",