@@ -13,7 +13,15 @@ import { getBranchName, getStagedDiff } from '../utils/vcs.js';
1313const args = process . argv . slice ( 2 ) . filter ( arg => ! arg . startsWith ( '--pre-commit' ) ) ;
1414const [ messageFilePath , commitSource ] = args ;
1515
16- export default ( verbose = false ) =>
16+ export default (
17+ locale : string | undefined ,
18+ generate : number | undefined ,
19+ excludeFiles : string [ ] ,
20+ commitType : string | undefined ,
21+ prompt : string | undefined ,
22+ includeBody : boolean | undefined ,
23+ verbose : boolean
24+ ) =>
1725 ( async ( ) => {
1826 if ( ! messageFilePath ) {
1927 throw new KnownError ( 'Commit message file path is missing. This file should be called from the "pre-commit framework"' ) ;
@@ -34,12 +42,19 @@ export default (verbose = false) =>
3442 const consoleManager = new ConsoleManager ( ) ;
3543 consoleManager . printTitle ( ) ;
3644
37- const cliOverrides : RawConfig = { } ;
45+ const configOverrides : RawConfig = {
46+ ...( locale && { locale } ) ,
47+ ...( generate != null && { generate : generate . toString ( ) } ) ,
48+ ...( commitType && { type : commitType } ) ,
49+ ...( prompt && { systemPrompt : prompt } ) ,
50+ ...( includeBody === true && { includeBody : 'true' } ) ,
51+ } ;
52+
3853 if ( verbose ) {
39- cliOverrides . logLevel = 'verbose' ;
54+ configOverrides . logLevel = 'verbose' ;
4055 }
4156
42- const config = await getConfig ( cliOverrides ) ;
57+ const config = await getConfig ( configOverrides , excludeFiles ) ;
4358 if ( config . systemPromptPath ) {
4459 try {
4560 await fs . readFile ( path . resolve ( config . systemPromptPath ) , 'utf-8' ) ;
0 commit comments