MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / parseArgs

Function parseArgs

cli/src/index.tsx:108–186  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

106}
107
108function parseArgs(): ParsedArgs {
109 const program = new Command()
110
111 if (IS_FREEBUFF) {
112 // Freebuff: simplified CLI - no prompt args, no agent override, no clear-logs
113 program
114 .name('freebuff')
115 .description('Freebuff - Free AI coding assistant')
116 .version(loadPackageVersion(), '-v, --version', 'Print the CLI version')
117 .option(
118 '--continue [conversation-id]',
119 'Continue from a previous conversation (optionally specify a conversation id)',
120 )
121 .option(
122 '--cwd <directory>',
123 'Set the working directory (default: current directory)',
124 )
125 .addHelpText('after', '\nCommands:\n login Log in to your account')
126 .helpOption('-h, --help', 'Show this help message')
127 .parse(process.argv)
128 } else {
129 // Codebuff: full CLI with all options
130 program
131 .name('codebuff')
132 .description('Codebuff CLI - AI-powered coding assistant')
133 .version(loadPackageVersion(), '-v, --version', 'Print the CLI version')
134 .option(
135 '--agent <agent-id>',
136 'Run a specific agent id (skips loading local .agents overrides)',
137 )
138 .option('--clear-logs', 'Remove any existing CLI log files before starting')
139 .option(
140 '--continue [conversation-id]',
141 'Continue from a previous conversation (optionally specify a conversation id)',
142 )
143 .option(
144 '--cwd <directory>',
145 'Set the working directory (default: current directory)',
146 )
147 .option('--lite', 'Start in LITE mode')
148 .option('--free', 'Start in LITE mode (deprecated alias)')
149 .option('--max', 'Start in MAX mode')
150 .option('--plan', 'Start in PLAN mode')
151 .addHelpText('after', '\nCommands:\n login Log in to your account\n publish Publish agents to the registry')
152 .helpOption('-h, --help', 'Show this help message')
153 .argument('[prompt...]', 'Initial prompt to send to the agent')
154 .allowExcessArguments(true)
155 .parse(process.argv)
156 }
157
158 const options = program.opts()
159 const args = program.args
160
161 const continueFlag = options.continue
162
163 // Determine initial mode from flags (last flag wins if multiple specified)
164 // Freebuff always uses LITE mode
165 let initialMode: AgentMode | undefined

Callers 1

mainFunction · 0.70

Calls 2

loadPackageVersionFunction · 0.85
parseMethod · 0.80

Tested by

no test coverage detected