* feat(CommandsEnum.ts): add COMMANDS enum

* refactor(api.ts): use CONFIG_MODES enum from config.ts
* refactor(config.ts): use COMMANDS and CONFIG_MODES enums, extract validateConfig function
* feat(config.ts): add CONFIG_MODES enum and refactor configCommand function to use it

* refactor(githook.ts): import COMMANDS enum from CommandsEnum.js file
This commit is contained in:
di-sukharev
2023-03-11 00:23:30 +08:00
parent e76db8276b
commit 33491486bb
4 changed files with 17 additions and 6 deletions

View File

@@ -5,7 +5,7 @@ import {
OpenAIApi
} from 'openai';
import { getConfig } from './commands/config';
import { CONFIG_MODES, getConfig } from './commands/config';
const config = getConfig();
@@ -13,7 +13,7 @@ let apiKey = config?.OPENAI_API_KEY;
const [command, mode] = process.argv.slice(2);
if (!apiKey && command !== 'config' && mode !== 'set') {
if (!apiKey && command !== 'config' && mode !== CONFIG_MODES.set) {
intro('opencommit');
outro(