feat: add OCO_ONE_LINE_COMMIT config for enabling one line commit message (#307)

This commit is contained in:
Mouadh HSOUMI
2024-03-09 05:44:12 +01:00
committed by GitHub
parent a192441f68
commit 45dc2c4535
4 changed files with 20 additions and 1 deletions
+13 -1
View File
@@ -25,6 +25,7 @@ export enum CONFIG_KEYS {
OCO_MESSAGE_TEMPLATE_PLACEHOLDER = 'OCO_MESSAGE_TEMPLATE_PLACEHOLDER',
OCO_PROMPT_MODULE = 'OCO_PROMPT_MODULE',
OCO_AI_PROVIDER = 'OCO_AI_PROVIDER',
OCO_ONE_LINE_COMMIT = 'OCO_ONE_LINE_COMMIT'
}
export enum CONFIG_MODES {
@@ -195,6 +196,16 @@ export const configValidators = {
);
return value;
},
[CONFIG_KEYS.OCO_ONE_LINE_COMMIT](value: any) {
validateConfig(
CONFIG_KEYS.OCO_ONE_LINE_COMMIT,
typeof value === 'boolean',
'Must be true or false'
);
return value;
},
};
export type ConfigType = {
@@ -220,7 +231,8 @@ export const getConfig = (): ConfigType | null => {
OCO_MESSAGE_TEMPLATE_PLACEHOLDER:
process.env.OCO_MESSAGE_TEMPLATE_PLACEHOLDER || '$msg',
OCO_PROMPT_MODULE: process.env.OCO_PROMPT_MODULE || 'conventional-commit',
OCO_AI_PROVIDER: process.env.OCO_AI_PROVIDER || 'openai'
OCO_AI_PROVIDER: process.env.OCO_AI_PROVIDER || 'openai',
OCO_ONE_LINE_COMMIT: process.env.OCO_ONE_LINE_COMMIT === 'true' ? true : false
};
const configExists = existsSync(configPath);