@@ -65,21 +65,27 @@ function loadBaseURL(): string {
6565}
6666
6767// Save command line settings to user settings file
68- async function saveCommandLineSettings ( apiKey ?: string , baseURL ?: string ) : Promise < void > {
68+ async function saveCommandLineSettings (
69+ apiKey ?: string ,
70+ baseURL ?: string
71+ ) : Promise < void > {
6972 try {
7073 const manager = getSettingsManager ( ) ;
7174
7275 // Update with command line values
7376 if ( apiKey ) {
74- manager . updateUserSetting ( ' apiKey' , apiKey ) ;
77+ manager . updateUserSetting ( " apiKey" , apiKey ) ;
7578 console . log ( "✅ API key saved to ~/.grok/user-settings.json" ) ;
7679 }
7780 if ( baseURL ) {
78- manager . updateUserSetting ( ' baseURL' , baseURL ) ;
81+ manager . updateUserSetting ( " baseURL" , baseURL ) ;
7982 console . log ( "✅ Base URL saved to ~/.grok/user-settings.json" ) ;
8083 }
8184 } catch ( error ) {
82- console . warn ( "⚠️ Could not save settings to file:" , error instanceof Error ? error . message : "Unknown error" ) ;
85+ console . warn (
86+ "⚠️ Could not save settings to file:" ,
87+ error instanceof Error ? error . message : "Unknown error"
88+ ) ;
8389 }
8490}
8591
@@ -307,6 +313,7 @@ program
307313 "A conversational AI CLI tool powered by Grok with text editor capabilities"
308314 )
309315 . version ( "1.0.1" )
316+ . argument ( "[message]" , "Initial message to send to Grok" )
310317 . option ( "-d, --directory <dir>" , "set working directory" , process . cwd ( ) )
311318 . option ( "-k, --api-key <key>" , "Grok API key (or set GROK_API_KEY env var)" )
312319 . option (
@@ -315,7 +322,7 @@ program
315322 )
316323 . option (
317324 "-m, --model <model>" ,
318- "AI model to use (e.g., gemini-2.5-pro , grok-4-latest) (or set GROK_MODEL env var)"
325+ "AI model to use (e.g., grok-code-fast-1 , grok-4-latest) (or set GROK_MODEL env var)"
319326 )
320327 . option (
321328 "-p, --prompt <prompt>" ,
@@ -326,7 +333,7 @@ program
326333 "maximum number of tool execution rounds (default: 400)" ,
327334 "400"
328335 )
329- . action ( async ( options ) => {
336+ . action ( async ( message , options ) => {
330337 if ( options . directory ) {
331338 try {
332339 process . chdir ( options . directory ) ;
@@ -360,7 +367,13 @@ program
360367
361368 // Headless mode: process prompt and exit
362369 if ( options . prompt ) {
363- await processPromptHeadless ( options . prompt , apiKey , baseURL , model , maxToolRounds ) ;
370+ await processPromptHeadless (
371+ options . prompt ,
372+ apiKey ,
373+ baseURL ,
374+ model ,
375+ maxToolRounds
376+ ) ;
364377 return ;
365378 }
366379
@@ -370,7 +383,9 @@ program
370383
371384 ensureUserSettingsDirectory ( ) ;
372385
373- render ( React . createElement ( ChatInterface , { agent } ) ) ;
386+ render (
387+ React . createElement ( ChatInterface , { agent, initialMessage : message } )
388+ ) ;
374389 } catch ( error : any ) {
375390 console . error ( "❌ Error initializing Grok CLI:" , error . message ) ;
376391 process . exit ( 1 ) ;
@@ -393,7 +408,7 @@ gitCommand
393408 )
394409 . option (
395410 "-m, --model <model>" ,
396- "AI model to use (e.g., gemini-2.5-pro , grok-4-latest) (or set GROK_MODEL env var)"
411+ "AI model to use (e.g., grok-code-fast-1 , grok-4-latest) (or set GROK_MODEL env var)"
397412 )
398413 . option (
399414 "--max-tool-rounds <rounds>" ,
0 commit comments