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

Function createProgram

apps/kimi-code/src/cli/commands.ts:19–143  ·  view source on GitHub ↗
(
  version: string,
  onMain: MainCommandHandler,
  onMigrate: MigrateCommandHandler,
  onPluginNodeRunner: PluginNodeRunnerHandler = () => {},
  onUpgrade: UpgradeCommandHandler = () => {},
)

Source from the content-addressed store, hash-verified

17export type UpgradeCommandHandler = () => void | Promise<void>;
18
19export function createProgram(
20 version: string,
21 onMain: MainCommandHandler,
22 onMigrate: MigrateCommandHandler,
23 onPluginNodeRunner: PluginNodeRunnerHandler = () => {},
24 onUpgrade: UpgradeCommandHandler = () => {},
25): Command {
26 const program = new Command(CLI_COMMAND_NAME)
27 .description('The Starting Point for Next-Gen Agents')
28 .version(version, '-V, --version')
29 .allowUnknownOption(false)
30 .configureHelp({ helpWidth: 100 })
31 .helpOption('-h, --help', 'Show help.')
32 .usage('[options] [command]')
33 .addHelpText('after', '\nDocumentation: https://moonshotai.github.io/kimi-code/\n');
34
35 program
36 .addOption(
37 new Option(
38 '-S, --session [id]',
39 'Resume a session. With ID: resume that session. Without ID: interactively pick.',
40 ).argParser((val: string | boolean) => (val === true ? '' : (val as string))),
41 )
42 .addOption(
43 new Option('-r, --resume [id]')
44 .hideHelp()
45 .argParser((val: string | boolean) => (val === true ? '' : (val as string))),
46 )
47 .option('-c, --continue', 'Continue the previous session for the working directory.', false)
48 .addOption(new Option('-C').hideHelp().default(false))
49 .option('-y, --yolo', 'Automatically approve all actions.', false)
50 .option('--auto', 'Start in auto permission mode.', false)
51 .addOption(
52 new Option(
53 '-m, --model <model>',
54 'LLM model alias to use for this invocation. Defaults to default_model in config.toml.',
55 ),
56 )
57 .addOption(
58 new Option(
59 '-p, --prompt <prompt>',
60 'Run one prompt non-interactively and print the response.',
61 ),
62 )
63 .addOption(
64 new Option(
65 '--output-format <format>',
66 'Output format for prompt mode. Defaults to text.',
67 ).choices(['text', 'stream-json']),
68 )
69 .addOption(
70 new Option(
71 '--skills-dir <dir>',
72 'Load skills from this directory instead of auto-discovered user and project directories. Can be repeated.',
73 )
74 .argParser((value: string, previous: string[] | undefined) => [...(previous ?? []), value])
75 .default([]),
76 )

Callers 4

parseFunction · 0.90
options.test.tsFile · 0.90
parseFunction · 0.90
mainFunction · 0.90

Calls 10

registerExportCommandFunction · 0.90
registerProviderCommandFunction · 0.90
registerAcpCommandFunction · 0.90
registerServerCommandFunction · 0.90
registerLoginCommandFunction · 0.90
registerDoctorCommandFunction · 0.90
registerVisCommandFunction · 0.90
registerMigrateCommandFunction · 0.85
errorMethod · 0.65
usageMethod · 0.45

Tested by 2

parseFunction · 0.72
parseFunction · 0.72