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

Function handlePlanCommand

apps/kimi-code/src/tui/commands/config.ts:48–72  ·  view source on GitHub ↗
(host: SlashCommandHost, args: string)

Source from the content-addressed store, hash-verified

46}
47
48export async function handlePlanCommand(host: SlashCommandHost, args: string): Promise<void> {
49 const session = host.session;
50 if (session === undefined) {
51 host.showError(NO_ACTIVE_SESSION_MESSAGE);
52 return;
53 }
54
55 const subcmd = args.trim().toLowerCase();
56 if (subcmd === 'clear') {
57 await session.clearPlan();
58 host.showNotice('Plan cleared');
59 return;
60 }
61
62 let enabled: boolean;
63 if (subcmd.length === 0) enabled = !host.state.appState.planMode;
64 else if (subcmd === 'on') enabled = true;
65 else if (subcmd === 'off') enabled = false;
66 else {
67 host.showError(`Unknown plan subcommand: ${subcmd}`);
68 return;
69 }
70
71 await applyPlanMode(host, session, enabled);
72}
73
74async function applyPlanMode(host: SlashCommandHost, session: Session, enabled: boolean): Promise<void> {
75 try {

Callers 1

Calls 4

applyPlanModeFunction · 0.85
showErrorMethod · 0.65
showNoticeMethod · 0.65
clearPlanMethod · 0.45

Tested by

no test coverage detected