@@ -28,6 +28,7 @@ import { detectTerminalTheme } from './utils/terminal-color-detection'
2828import { setOscDetectedTheme } from './utils/theme-system'
2929
3030import type { FileTreeNode } from '@codebuff/common/util/file'
31+ import type { AgentMode } from './utils/constants'
3132
3233const require = createRequire ( import . meta. url )
3334
@@ -82,6 +83,7 @@ type ParsedArgs = {
8283 continue : boolean
8384 continueId ?: string | null
8485 cwd ?: string
86+ initialMode ?: AgentMode
8587}
8688
8789function parseArgs ( ) : ParsedArgs {
@@ -104,6 +106,9 @@ function parseArgs(): ParsedArgs {
104106 '--cwd <directory>' ,
105107 'Set the working directory (default: current directory)' ,
106108 )
109+ . option ( '--lite' , 'Start in LITE mode' )
110+ . option ( '--max' , 'Start in MAX mode' )
111+ . option ( '--plan' , 'Start in PLAN mode' )
107112 . helpOption ( '-h, --help' , 'Show this help message' )
108113 . argument ( '[prompt...]' , 'Initial prompt to send to the agent' )
109114 . allowExcessArguments ( true )
@@ -114,6 +119,12 @@ function parseArgs(): ParsedArgs {
114119
115120 const continueFlag = options . continue
116121
122+ // Determine initial mode from flags (last flag wins if multiple specified)
123+ let initialMode : AgentMode | undefined
124+ if ( options . lite ) initialMode = 'LITE'
125+ if ( options . max ) initialMode = 'MAX'
126+ if ( options . plan ) initialMode = 'PLAN'
127+
117128 return {
118129 initialPrompt : args . length > 0 ? args . join ( ' ' ) : null ,
119130 agent : options . agent ,
@@ -124,6 +135,7 @@ function parseArgs(): ParsedArgs {
124135 ? continueFlag . trim ( )
125136 : null ,
126137 cwd : options . cwd ,
138+ initialMode,
127139 }
128140}
129141
@@ -149,6 +161,7 @@ async function main(): Promise<void> {
149161 continue : continueChat ,
150162 continueId,
151163 cwd,
164+ initialMode,
152165 } = parseArgs ( )
153166
154167 await initializeApp ( { cwd } )
@@ -245,6 +258,7 @@ async function main(): Promise<void> {
245258 fileTree = { fileTree }
246259 continueChat = { continueChat }
247260 continueChatId = { continueId ?? undefined }
261+ initialMode = { initialMode }
248262 / >
249263 )
250264 }
0 commit comments