migrated to ts
This commit is contained in:
@@ -1 +0,0 @@
|
||||
{ "OPENAI_API_KEY": "sk-xxxxxxxxxxxxxxxxxxxxxxxxxxx" }
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,2 @@
|
||||
.env.json
|
||||
/node_modules
|
||||
package-lock.json
|
||||
|
||||
@@ -76,7 +76,7 @@ async function main() {
|
||||
});
|
||||
}
|
||||
|
||||
async function generateCommitMessage(prompt) {
|
||||
async function generateCommitMessage(prompt: string) {
|
||||
const payload = {
|
||||
model: "text-davinci-003",
|
||||
prompt,
|
||||
@@ -97,7 +97,7 @@ async function generateCommitMessage(prompt) {
|
||||
body: JSON.stringify(payload),
|
||||
});
|
||||
|
||||
const json = await response.json();
|
||||
const json: any = await response.json();
|
||||
const aiCommit = json.choices[0].text;
|
||||
|
||||
return aiCommit.replace(/(\r\n|\n|\r)/gm, "");
|
||||
11
package.json
11
package.json
@@ -2,17 +2,20 @@
|
||||
"name": "aicommits",
|
||||
"version": "0.1.4",
|
||||
"description": "Writes your git commit messages for you with AI",
|
||||
"main": "index.js",
|
||||
"main": "bin/index.js",
|
||||
"bin": {
|
||||
"aicommits": "./index.js"
|
||||
"aicommits": "bin/index.js"
|
||||
},
|
||||
"type": "module",
|
||||
"repository": "https://github.com/Nutlope/aicommits",
|
||||
"author": "Hassan El Mghari (@nutlope)",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"build": "tsc"
|
||||
},
|
||||
"dependencies": {
|
||||
"chalk": "^5.2.0",
|
||||
"inquirer": "^9.1.4",
|
||||
"node-fetch": "^3.3.0"
|
||||
"node-fetch": "^3.3.0",
|
||||
"typescript": "^4.9.5"
|
||||
}
|
||||
}
|
||||
|
||||
12
tsconfig.json
Normal file
12
tsconfig.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es2016" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
|
||||
"module": "commonjs" /* Specify what module code is generated. */,
|
||||
"outDir": "./bin" /* Specify an output folder for all emitted files. */,
|
||||
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */,
|
||||
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
|
||||
"strict": true /* Enable all strict type-checking options. */,
|
||||
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
||||
},
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
Reference in New Issue
Block a user