@@ -54,7 +54,7 @@ program
5454 return ;
5555 }
5656
57- const params = {
57+ const params : any = {
5858 [ INPUT_KEYS . DEBUG ] : options . debug . toString ( ) ,
5959 [ INPUT_KEYS . SINGLE_ACTION ] : ACTIONS . VECTOR ,
6060 [ INPUT_KEYS . SINGLE_ACTION_ISSUE ] : options . issue ,
@@ -74,38 +74,38 @@ program
7474 } ,
7575 }
7676
77- logInfo (
78- boxen (
79- chalk . cyan ( '🚀 Vectorization started\n' ) +
80- chalk . gray ( `Processing code blocks on ${ gitInfo . owner } /${ gitInfo . repo } /${ options . branch } ...` ) ,
81- {
82- padding : 1 ,
83- margin : 1 ,
84- borderStyle : 'round' ,
85- borderColor : 'cyan' ,
86- title : TITLE ,
87- titleAlignment : 'center'
88- }
89- )
90- ) ;
77+ params [ INPUT_KEYS . WELCOME_TITLE ] = '🚀 Vectorization started' ;
78+ params [ INPUT_KEYS . WELCOME_MESSAGES ] = [
79+ `Processing code blocks on ${ gitInfo . owner } /${ gitInfo . repo } /${ options . branch } ...` ,
80+ ] ;
9181
9282 runLocalAction ( params ) ;
9383 } ) ;
9484
85+ /**
86+ * Run the asking AI scenario on issues or pull requests.
87+ *
88+ * For the action of asking the AI to be executed, the bot user managing the repository must be mentioned.
89+ */
9590 program
9691 . command ( 'ask-ai' )
9792 . description ( 'Ask AI' )
9893 . option ( '-i, --issue <number>' , 'Issue number to process' , '1' )
9994 . option ( '-b, --branch <name>' , 'Branch name' , 'master' )
10095 . option ( '-d, --debug' , 'Debug mode' , false )
10196 . option ( '-t, --token <token>' , 'Personal access token' , process . env . PERSONAL_ACCESS_TOKEN )
102- . option ( '-m, --model <model>' , 'OpenRouter model' , process . env . OPENROUTER_MODEL )
103- . option ( '-k, --key <key>' , 'OpenRouter API key' , process . env . OPENROUTER_API_KEY )
104- . option ( '-p, --provider <provider>' , 'OpenRouter provider' , process . env . OPENROUTER_PROVIDER_ORDER )
105- . option ( '-f, --fallback <fallback>' , 'OpenRouter fallback' , process . env . OPENROUTER_PROVIDER_ALLOW_FALLBACKS )
106- . option ( '-r, --require <require>' , 'OpenRouter require' , process . env . OPENROUTER_PROVIDER_REQUIRE_PARAMETERS )
107- . option ( '-c, --collection <collection>' , 'OpenRouter collection' , process . env . OPENROUTER_PROVIDER_DATA_COLLECTION )
108- . option ( '-q, --question <question>' , 'Question' , '' )
97+ . option ( '--question <question>' , 'Question' , '' )
98+ . option ( '--openrouter-api-key <key>' , 'OpenRouter API key' , '' )
99+ . option ( '--openrouter-model <model>' , 'OpenRouter model' , '' )
100+ . option ( '--openrouter-provider-order <provider>' , 'OpenRouter provider' , '' )
101+ . option ( '--openrouter-provider-allow-fallbacks <fallback>' , 'OpenRouter fallback' , '' )
102+ . option ( '--openrouter-provider-require-parameters <require>' , 'OpenRouter require' , '' )
103+ . option ( '--openrouter-provider-data-collection <collection>' , 'OpenRouter collection' , '' )
104+ . option ( '--openrouter-provider-ignore <ignore>' , 'OpenRouter ignore' , '' )
105+ . option ( '--openrouter-provider-quantizations <quantizations>' , 'OpenRouter quantizations' , '' )
106+ . option ( '--openrouter-provider-sort <sort>' , 'OpenRouter sort' , '' )
107+ . option ( '--ai-ignore-files <ai-ignore-files>' , 'AI ignore files' , 'dist/*,bin/*,node_modules/*,build/*' )
108+ . option ( '--include-reasoning <include-reasoning>' , 'Include reasoning' , 'false' )
109109 . action ( async ( options ) => {
110110 const gitInfo = getGitInfo ( ) ;
111111
@@ -118,18 +118,20 @@ program
118118
119119 const params : any = {
120120 [ INPUT_KEYS . DEBUG ] : options . debug . toString ( ) ,
121- [ INPUT_KEYS . SINGLE_ACTION ] : ACTIONS . ASK ,
122- [ INPUT_KEYS . SINGLE_ACTION_ISSUE ] : options . issue ,
123- [ INPUT_KEYS . SUPABASE_URL ] : process . env . SUPABASE_URL ,
124- [ INPUT_KEYS . SUPABASE_KEY ] : process . env . SUPABASE_KEY ,
125- [ INPUT_KEYS . TOKEN ] : process . env . PERSONAL_ACCESS_TOKEN ,
126- [ INPUT_KEYS . OPENROUTER_API_KEY ] : process . env . OPENROUTER_API_KEY ,
127- [ INPUT_KEYS . OPENROUTER_MODEL ] : process . env . OPENROUTER_MODEL ,
128- [ INPUT_KEYS . OPENROUTER_PROVIDER_ORDER ] : process . env . OPENROUTER_PROVIDER_ORDER ,
129- [ INPUT_KEYS . OPENROUTER_PROVIDER_ALLOW_FALLBACKS ] : process . env . OPENROUTER_PROVIDER_ALLOW_FALLBACKS ,
130- [ INPUT_KEYS . OPENROUTER_PROVIDER_REQUIRE_PARAMETERS ] : process . env . OPENROUTER_PROVIDER_REQUIRE_PARAMETERS ,
131- [ INPUT_KEYS . OPENROUTER_PROVIDER_DATA_COLLECTION ] : process . env . OPENROUTER_PROVIDER_DATA_COLLECTION ,
132- [ INPUT_KEYS . AI_IGNORE_FILES ] : 'dist/*,bin/*' ,
121+ [ INPUT_KEYS . SUPABASE_URL ] : options . supabaseUrl . length > 0 ? options . supabaseUrl : process . env . SUPABASE_URL ,
122+ [ INPUT_KEYS . SUPABASE_KEY ] : options . supabaseKey . length > 0 ? options . supabaseKey : process . env . SUPABASE_KEY ,
123+ [ INPUT_KEYS . TOKEN ] : options . token . length > 0 ? options . token : process . env . PERSONAL_ACCESS_TOKEN ,
124+ [ INPUT_KEYS . OPENROUTER_API_KEY ] : options . openrouterApiKey . length > 0 ? options . openrouterApiKey : process . env . OPENROUTER_API_KEY ,
125+ [ INPUT_KEYS . OPENROUTER_MODEL ] : options . openrouterModel . length > 0 ? options . openrouterModel : process . env . OPENROUTER_MODEL ,
126+ [ INPUT_KEYS . OPENROUTER_PROVIDER_ORDER ] : options . openrouterProviderOrder . length > 0 ? options . openrouterProviderOrder : process . env . OPENROUTER_PROVIDER_ORDER ,
127+ [ INPUT_KEYS . OPENROUTER_PROVIDER_ALLOW_FALLBACKS ] : options . openrouterProviderAllowFallbacks . length > 0 ? options . openrouterProviderAllowFallbacks : process . env . OPENROUTER_PROVIDER_ALLOW_FALLBACKS ,
128+ [ INPUT_KEYS . OPENROUTER_PROVIDER_REQUIRE_PARAMETERS ] : options . openrouterProviderRequireParameters . length > 0 ? options . openrouterProviderRequireParameters : process . env . OPENROUTER_PROVIDER_REQUIRE_PARAMETERS ,
129+ [ INPUT_KEYS . OPENROUTER_PROVIDER_DATA_COLLECTION ] : options . openrouterProviderDataCollection . length > 0 ? options . openrouterProviderDataCollection : process . env . OPENROUTER_PROVIDER_DATA_COLLECTION ,
130+ [ INPUT_KEYS . OPENROUTER_PROVIDER_IGNORE ] : options . openrouterProviderIgnore . length > 0 ? options . openrouterProviderIgnore : process . env . OPENROUTER_PROVIDER_IGNORE ,
131+ [ INPUT_KEYS . OPENROUTER_PROVIDER_QUANTIZATIONS ] : options . openrouterProviderQuantizations . length > 0 ? options . openrouterProviderQuantizations : process . env . OPENROUTER_PROVIDER_QUANTIZATIONS ,
132+ [ INPUT_KEYS . OPENROUTER_PROVIDER_SORT ] : options . openrouterProviderSort . length > 0 ? options . openrouterProviderSort : process . env . OPENROUTER_PROVIDER_SORT ,
133+ [ INPUT_KEYS . AI_IGNORE_FILES ] : options . aiIgnoreFiles . length > 0 ? options . aiIgnoreFiles : process . env . AI_IGNORE_FILES ,
134+ [ INPUT_KEYS . AI_INCLUDE_REASONING ] : options . includeReasoning . length > 0 ? options . includeReasoning : process . env . AI_INCLUDE_REASONING ,
133135 repo : {
134136 owner : gitInfo . owner ,
135137 repo : gitInfo . repo ,
@@ -144,14 +146,14 @@ program
144146 gitInfo . owner ,
145147 gitInfo . repo ,
146148 parseInt ( options . issue ) ,
147- process . env . PERSONAL_ACCESS_TOKEN ?? ''
149+ params [ INPUT_KEYS . TOKEN ] ?? ''
148150 ) ;
149151
150152 const isPullRequest = await issueRepository . isPullRequest (
151153 gitInfo . owner ,
152154 gitInfo . repo ,
153155 parseInt ( options . issue ) ,
154- process . env . PERSONAL_ACCESS_TOKEN ?? ''
156+ params [ INPUT_KEYS . TOKEN ] ?? ''
155157 ) ;
156158
157159 if ( isIssue ) {
@@ -164,28 +166,18 @@ program
164166 }
165167 } else if ( isPullRequest ) {
166168 params . eventName = 'pull_request_review_comment' ;
167- params . issue = {
169+ params . pull_request = {
168170 number : parseInt ( options . issue ) ,
169171 }
170172 params . pull_request_review_comment = {
171173 body : commentBody ,
172174 }
173175 }
174176
175- logInfo (
176- boxen (
177- chalk . cyan ( '🚀 Asking AI started\n' ) +
178- chalk . gray ( `Asking AI on ${ gitInfo . owner } /${ gitInfo . repo } /${ options . branch } ...` ) ,
179- {
180- padding : 1 ,
181- margin : 1 ,
182- borderStyle : 'round' ,
183- borderColor : 'cyan' ,
184- title : TITLE ,
185- titleAlignment : 'center'
186- }
187- )
188- ) ;
177+ params [ INPUT_KEYS . WELCOME_TITLE ] = '🚀 Asking AI started' ;
178+ params [ INPUT_KEYS . WELCOME_MESSAGES ] = [
179+ `Asking AI on ${ gitInfo . owner } /${ gitInfo . repo } /${ options . branch } ...` ,
180+ ] ;
189181
190182 runLocalAction ( params ) ;
191183 } ) ;
0 commit comments