MCPcopy
hub / github.com/yamadashy/repomix / runCli

Function runCli

src/cli/cliRun.ts:290–390  ·  view source on GitHub ↗
(directories: string[], cwd: string, options: CliOptions)

Source from the content-addressed store, hash-verified

288};
289
290export const runCli = async (directories: string[], cwd: string, options: CliOptions) => {
291 // Detect stdout mode
292 // NOTE: For compatibility, currently not detecting pipe mode
293 const isForceStdoutMode = options.output === '-';
294 if (isForceStdoutMode) {
295 options.stdout = true;
296 }
297
298 // Validate --watch conflicts early, before log level changes can suppress error messages
299 validateWatchOptions(directories, options);
300
301 // Set log level based on verbose and quiet flags
302 if (options.quiet) {
303 logger.setLogLevel(repomixLogLevels.SILENT);
304 } else if (options.verbose) {
305 logger.setLogLevel(repomixLogLevels.DEBUG);
306 } else {
307 logger.setLogLevel(repomixLogLevels.INFO);
308 }
309
310 // In stdout mode, set log level to SILENT
311 if (options.stdout) {
312 logger.setLogLevel(repomixLogLevels.SILENT);
313 }
314
315 logger.trace('directories:', directories);
316 logger.trace('cwd:', cwd);
317 logger.trace('options:', options);
318
319 if (options.mcp) {
320 const { runMcpAction } = await import('./actions/mcpAction.js');
321 return await runMcpAction();
322 }
323
324 if (options.version) {
325 const { runVersionAction } = await import('./actions/versionAction.js');
326 await runVersionAction();
327 return;
328 }
329
330 // Skip version header in stdin mode to avoid interfering with piped output from interactive tools like fzf
331 if (!options.stdin) {
332 const version = await getVersion();
333 logger.log(pc.dim(`\n📦 Repomix v${version}\n`));
334 }
335
336 if (options.init) {
337 const { runInitAction } = await import('./actions/initAction.js');
338 await runInitAction(cwd, options.global || false);
339 return;
340 }
341
342 if (options.remote) {
343 const { runRemoteAction } = await import('./actions/remoteAction.js');
344 return await runRemoteAction(options.remote, options);
345 }
346
347 // Auto-detect explicit remote URLs (https://, git@, ssh://, git://) in positional arguments

Callers 7

commanderActionEndpointFunction · 0.85
registerPackCodebaseToolFunction · 0.85
runMemoryTestFunction · 0.85
cliRun.test.tsFile · 0.85

Calls 14

validateWatchOptionsFunction · 0.85
runMcpActionFunction · 0.85
runVersionActionFunction · 0.85
getVersionFunction · 0.85
runInitActionFunction · 0.85
runRemoteActionFunction · 0.85
isExplicitRemoteUrlFunction · 0.85
runWatchActionFunction · 0.85
isValidShorthandFunction · 0.85
checkRemoteRepoExistsFunction · 0.85
runDefaultActionFunction · 0.85
setLogLevelMethod · 0.80

Tested by

no test coverage detected