MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / handleMainCommand

Function handleMainCommand

apps/kimi-code/src/main.ts:54–84  ·  view source on GitHub ↗
(
  opts: CLIOptions,
  version: string,
)

Source from the content-addressed store, hash-verified

52}
53
54export async function handleMainCommand(
55 opts: CLIOptions,
56 version: string,
57): Promise<MainCommandOutcome> {
58 let validated: ReturnType<typeof validateOptions>;
59 try {
60 validated = validateOptions(opts);
61 } catch (error) {
62 if (error instanceof OptionConflictError) {
63 process.stderr.write(`error: ${error.message}\n`);
64 process.exit(1);
65 }
66 throw error;
67 }
68
69 const preflightResult = await runUpdatePreflight(
70 version,
71 validated.uiMode === 'print' ? { track, isTTY: false } : { track },
72 );
73 if (preflightResult === 'exit') {
74 process.exit(0);
75 }
76
77 if (validated.uiMode === 'print') {
78 await runPrompt(validated.options, version);
79 return { headlessCompleted: true };
80 }
81
82 await runShell(validated.options, version);
83 return { headlessCompleted: false };
84}
85
86/** `kimi migrate`: launch the migration screen only, then exit. */
87async function handleMigrateCommand(version: string): Promise<void> {

Callers 3

runHandleMainCommandFunction · 0.90
main.test.tsFile · 0.90
mainFunction · 0.85

Calls 6

validateOptionsFunction · 0.90
runUpdatePreflightFunction · 0.90
runPromptFunction · 0.90
runShellFunction · 0.90
writeMethod · 0.65
exitMethod · 0.65

Tested by 1

runHandleMainCommandFunction · 0.72