mirror of
https://github.com/di-sukharev/opencommit.git
synced 2026-01-12 23:28:16 -05:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c573edea97 | ||
|
|
5282734583 | ||
|
|
9c67a3774f | ||
|
|
deeb7cdf97 | ||
|
|
fe819f0814 | ||
|
|
578a30c330 | ||
|
|
973a4a2843 |
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "open-commit",
|
||||
"version": "0.0.2",
|
||||
"version": "0.0.7",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "open-commit",
|
||||
"version": "0.0.2",
|
||||
"version": "0.0.7",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@clack/prompts": "^0.6.1",
|
||||
|
||||
11
package.json
11
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "opencommit",
|
||||
"version": "0.0.2",
|
||||
"version": "0.0.7",
|
||||
"description": "AI generates conventional commits with mind-blowing accuracy.",
|
||||
"keywords": [
|
||||
"git",
|
||||
@@ -12,8 +12,8 @@
|
||||
],
|
||||
"main": "cli.js",
|
||||
"bin": {
|
||||
"opencommit": "./out/cli.mjs",
|
||||
"oc": "./out/cli.mjs"
|
||||
"opencommit": "./out/cli.cjs",
|
||||
"oc": "./out/cli.cjs"
|
||||
},
|
||||
"repository": {
|
||||
"url": "https://github.com/di-sukharev/opencommit"
|
||||
@@ -34,9 +34,10 @@
|
||||
},
|
||||
"scripts": {
|
||||
"watch": "npm run -S build -- --sourcemap --watch",
|
||||
"start": "node ./out/cli.mjs",
|
||||
"start": "node ./out/cli.cjs",
|
||||
"dev": "ts-node ./src/cli.ts",
|
||||
"build": "rimraf out && esbuild ./src/cli.ts --bundle --outfile=out/cli.mjs --format=esm --platform=node",
|
||||
"build": "rimraf out && esbuild ./src/cli.ts --bundle --outfile=out/cli.cjs --format=cjs --platform=node",
|
||||
"publish": "npm version patch",
|
||||
"lint": "eslint src --ext ts && tsc --noEmit"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
27
src/api.ts
27
src/api.ts
@@ -1,4 +1,4 @@
|
||||
import { intro, outro, text } from '@clack/prompts';
|
||||
import { intro, outro } from '@clack/prompts';
|
||||
import {
|
||||
ChatCompletionRequestMessage,
|
||||
ChatCompletionResponseMessage,
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
OpenAIApi
|
||||
} from 'openai';
|
||||
|
||||
import { CONFIG_KEYS, getConfig, setConfig } from './commands/config';
|
||||
import { getConfig } from './commands/config';
|
||||
|
||||
const config = getConfig();
|
||||
|
||||
@@ -14,15 +14,26 @@ let apiKey = config?.OPENAI_API_KEY;
|
||||
|
||||
if (!apiKey) {
|
||||
intro('opencommit');
|
||||
const apiKey = await text({
|
||||
message: 'input your OPENAI_API_KEY'
|
||||
});
|
||||
|
||||
setConfig([[CONFIG_KEYS.OPENAI_API_KEY as string, apiKey as any]]);
|
||||
|
||||
outro('OPENAI_API_KEY is set');
|
||||
outro(
|
||||
'OPENAI_API_KEY is not set, please run `oc config set OPENAI_API_KEY=<your token>`'
|
||||
);
|
||||
outro(
|
||||
'For help Look into README https://github.com/di-sukharev/opencommit#setup'
|
||||
);
|
||||
}
|
||||
|
||||
// if (!apiKey) {
|
||||
// intro('opencommit');
|
||||
// const apiKey = await text({
|
||||
// message: 'input your OPENAI_API_KEY'
|
||||
// });
|
||||
|
||||
// setConfig([[CONFIG_KEYS.OPENAI_API_KEY as string, apiKey as any]]);
|
||||
|
||||
// outro('OPENAI_API_KEY is set');
|
||||
// }
|
||||
|
||||
class OpenAi {
|
||||
private openAiApiConfiguration = new OpenAiApiConfiguration({
|
||||
apiKey: apiKey
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
/* Language and Environment */
|
||||
"target": "ESNext" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
|
||||
"lib": [
|
||||
"ESNext"
|
||||
"ES6"
|
||||
] /* Specify a set of bundled library declaration files that describe the target runtime environment. */,
|
||||
|
||||
/* Modules */
|
||||
|
||||
Reference in New Issue
Block a user