Skip to content

Commit 96de6e4

Browse files
committed
docs(README.md): update default model to gpt-4o-mini in configuration section
refactor(config.ts): improve config key descriptions and add default values
1 parent f89b4a3 commit 96de6e4

2 files changed

Lines changed: 67 additions & 13 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ OCO_TOKENS_MAX_INPUT=<max model token limit (default: 4096)>
113113
OCO_TOKENS_MAX_OUTPUT=<max response tokens (default: 500)>
114114
OCO_DESCRIPTION=<postface a message with ~3 sentences description of the changes>
115115
OCO_EMOJI=<boolean, add GitMoji>
116-
OCO_MODEL=<either 'gpt-4o', 'gpt-4', 'gpt-4-turbo', 'gpt-3.5-turbo' (default), 'gpt-3.5-turbo-0125', 'gpt-4-1106-preview', 'gpt-4-turbo-preview' or 'gpt-4-0125-preview' or any Anthropic or Ollama model or any string basically, but it should be a valid model name>
116+
OCO_MODEL=<either 'gpt-4o-mini' (default), 'gpt-4o', 'gpt-4', 'gpt-4-turbo', 'gpt-3.5-turbo', 'gpt-3.5-turbo-0125', 'gpt-4-1106-preview', 'gpt-4-turbo-preview' or 'gpt-4-0125-preview' or any Anthropic or Ollama model or any string basically, but it should be a valid model name>
117117
OCO_LANGUAGE=<locale, scroll to the bottom to see options>
118118
OCO_MESSAGE_TEMPLATE_PLACEHOLDER=<message template placeholder, default: '$msg'>
119119
OCO_PROMPT_MODULE=<either conventional-commit or @commitlint, default: conventional-commit>

src/commands/config.ts

Lines changed: 66 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -624,28 +624,52 @@ function getConfigKeyDetails(key) {
624624
};
625625
case CONFIG_KEYS.OCO_LANGUAGE:
626626
return {
627-
description: 'The language to use for commit messages',
627+
description: 'The locale to use for commit messages',
628628
values: Object.keys(i18n)
629629
};
630630
case CONFIG_KEYS.OCO_TEST_MOCK_TYPE:
631631
return {
632632
description: 'The type of test mock to use',
633633
values: ['commit-message', 'prompt-module-commitlint-config']
634634
};
635+
case CONFIG_KEYS.OCO_ONE_LINE_COMMIT:
636+
return {
637+
description: 'One line commit message',
638+
values: ['true', 'false']
639+
};
635640
case CONFIG_KEYS.OCO_DESCRIPTION:
641+
return {
642+
description: 'Postface a message with ~3 sentences description of the changes',
643+
values: ['true', 'false']
644+
};
636645
case CONFIG_KEYS.OCO_EMOJI:
646+
return {
647+
description: 'Preface a message with GitMoji',
648+
values: ['true', 'false']
649+
};
637650
case CONFIG_KEYS.OCO_WHY:
638-
case CONFIG_KEYS.OCO_ONE_LINE_COMMIT:
651+
return {
652+
description: 'Output a short description of why the changes were done after the commit message (default: false)',
653+
values: ['true', 'false']
654+
}
639655
case CONFIG_KEYS.OCO_OMIT_SCOPE:
656+
return {
657+
description: 'Do not include a scope in the commit message',
658+
values: ['true', 'false']
659+
};
640660
case CONFIG_KEYS.OCO_GITPUSH:
641661
return {
642-
description: 'Boolean flag',
662+
description: 'Push to git after commit (deprecated). If false, oco will exit after committing',
643663
values: ['true', 'false']
644664
};
645665
case CONFIG_KEYS.OCO_TOKENS_MAX_INPUT:
666+
return {
667+
description: 'Max model token limit',
668+
values: ['Any positive integer']
669+
};
646670
case CONFIG_KEYS.OCO_TOKENS_MAX_OUTPUT:
647671
return {
648-
description: 'Integer number',
672+
description: 'Max response tokens',
649673
values: ['Any positive integer']
650674
};
651675
case CONFIG_KEYS.OCO_API_KEY:
@@ -655,12 +679,12 @@ function getConfigKeyDetails(key) {
655679
};
656680
case CONFIG_KEYS.OCO_API_URL:
657681
return {
658-
description: 'Custom API URL',
682+
description: 'Custom API URL - may be used to set proxy path to OpenAI API',
659683
values: ["URL string (must start with 'http://' or 'https://')"]
660684
};
661685
case CONFIG_KEYS.OCO_MESSAGE_TEMPLATE_PLACEHOLDER:
662686
return {
663-
description: 'Template placeholder for commit messages',
687+
description: 'Message template placeholder',
664688
values: ["String (must start with $)"]
665689
};
666690
default:
@@ -678,10 +702,25 @@ function printConfigKeyHelp(param) {
678702
}
679703

680704
const details = getConfigKeyDetails(param as CONFIG_KEYS);
681-
705+
706+
let desc = details.description;
707+
let defaultValue = undefined;
708+
if (param in DEFAULT_CONFIG) {
709+
defaultValue = DEFAULT_CONFIG[param];
710+
}
711+
712+
682713
console.log(chalk.bold(`\n${param}:`));
683-
console.log(chalk.gray(` Description: ${details.description}`));
684-
714+
console.log(chalk.gray(` Description: ${desc}`));
715+
if (defaultValue !== undefined) {
716+
// Print booleans and numbers as-is, strings without quotes
717+
if (typeof defaultValue === 'string') {
718+
console.log(chalk.gray(` Default: ${defaultValue}`));
719+
} else {
720+
console.log(chalk.gray(` Default: ${defaultValue}`));
721+
}
722+
}
723+
685724
if (Array.isArray(details.values)) {
686725
console.log(chalk.gray(' Accepted values:'));
687726
details.values.forEach(value => {
@@ -700,10 +739,25 @@ function printConfigKeyHelp(param) {
700739

701740
function printAllConfigHelp() {
702741
console.log(chalk.bold('Available config parameters:'));
703-
for (const key of Object.values(CONFIG_KEYS)) {
704-
printConfigKeyHelp(key);
742+
for (const key of Object.values(CONFIG_KEYS).sort()) {
743+
const details = getConfigKeyDetails(key);
744+
// Try to get the default value from DEFAULT_CONFIG
745+
let defaultValue = undefined;
746+
if (key in DEFAULT_CONFIG) {
747+
defaultValue = DEFAULT_CONFIG[key];
748+
}
749+
750+
console.log(chalk.bold(`\n${key}:`));
751+
console.log(chalk.gray(` Description: ${details.description}`));
752+
if (defaultValue !== undefined) {
753+
if (typeof defaultValue === 'string') {
754+
console.log(chalk.gray(` Default: ${defaultValue}`));
755+
} else {
756+
console.log(chalk.gray(` Default: ${defaultValue}`));
757+
}
758+
}
705759
}
706-
console.log(chalk.gray('\nFor more help, see https://github.com/di-sukharev/opencommit'));
760+
console.log(chalk.yellow('\nUse "oco config describe [PARAMETER]" to see accepted values and more details for a specific config parameter.'));
707761
}
708762

709763
export const configCommand = command(

0 commit comments

Comments
 (0)