Compare commits

..

7 Commits

Author SHA1 Message Date
di-sukharev
c573edea97 0.0.7 2023-03-06 19:08:57 +08:00
di-sukharev
5282734583 * 🐛 fix(package.json): remove npm publish command from publish script
The npm publish command has been removed from the publish script. This is because the command should be run manually after bumping the version number.
2023-03-06 19:08:37 +08:00
di-sukharev
9c67a3774f 0.0.6 2023-03-06 19:08:01 +08:00
di-sukharev
deeb7cdf97 0.0.5 2023-03-06 19:07:58 +08:00
di-sukharev
fe819f0814 0.0.4 2023-03-06 19:07:56 +08:00
di-sukharev
578a30c330 0.0.3 2023-03-06 19:07:54 +08:00
di-sukharev
973a4a2843 * 🐛 fix(package.json): change cli file extension from .mjs to .cjs
*  feat(package.json): add publish script
The cli file extension has been changed from .mjs to .cjs to improve compatibility with Node.js. The publish script has been added to simplify the process of publishing a new version of the package to npm.

* 🎨 style(api.ts): remove unused import statement
* 🐛 fix(api.ts): remove setConfig function call
* 🚧 chore(api.ts): add comment to explain apiKey variable initialization
* 🚧 chore(api.ts): comment out code block that prompts user for OPENAI_API_KEY
The unused import statement for `text` function from `@clack/prompts` has been removed. The `setConfig` function call has been removed as it is not needed and was causing an error. A comment has been added to explain the initialization of the `apiKey` variable. The code block that prompts the user for `OPENAI_API_KEY` has been commented out as it is not needed and was causing an error.

* 🐛 fix(tsconfig.json): change target to ES6
The target was previously set to ESNext, which is not supported by all browsers. Changing it to ES6 ensures that the emitted JavaScript is compatible with a wider range of browsers.
2023-03-06 19:07:48 +08:00
4 changed files with 28 additions and 16 deletions

4
package-lock.json generated
View File

@@ -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",

View File

@@ -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": {

View File

@@ -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

View File

@@ -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 */