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

Function handleYoloCommand

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

Source from the content-addressed store, hash-verified

91}
92
93export async function handleYoloCommand(host: SlashCommandHost, args: string): Promise<void> {
94 const session = host.session;
95 if (session === undefined) {
96 host.showError(NO_ACTIVE_SESSION_MESSAGE);
97 return;
98 }
99
100 const subcmd = args.trim().toLowerCase();
101 const currentMode = host.state.appState.permissionMode;
102
103 if (subcmd === 'on') {
104 if (currentMode === 'yolo') {
105 host.showNotice('YOLO mode is already on');
106 return;
107 }
108 await session.setPermission('yolo');
109 host.setAppState({ permissionMode: 'yolo' });
110 host.showNotice('YOLO mode: ON', 'Workspace tools auto-approved.');
111 return;
112 }
113
114 if (subcmd === 'off') {
115 if (currentMode !== 'yolo') {
116 host.showNotice('YOLO mode is already off');
117 return;
118 }
119 await session.setPermission('manual');
120 host.setAppState({ permissionMode: 'manual' });
121 host.showNotice('YOLO mode: OFF');
122 return;
123 }
124
125 // toggle
126 if (currentMode === 'yolo') {
127 await session.setPermission('manual');
128 host.setAppState({ permissionMode: 'manual' });
129 host.showNotice('YOLO mode: OFF');
130 } else {
131 await session.setPermission('yolo');
132 host.setAppState({ permissionMode: 'yolo' });
133 host.showNotice('YOLO mode: ON', 'Workspace tools auto-approved.');
134 }
135}
136
137export async function handleAutoCommand(host: SlashCommandHost, args: string): Promise<void> {
138 const session = host.session;

Callers 1

Calls 4

showErrorMethod · 0.65
showNoticeMethod · 0.65
setAppStateMethod · 0.65
setPermissionMethod · 0.45

Tested by

no test coverage detected