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

Function handleSwarmCommand

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

Source from the content-addressed store, hash-verified

13import type { SlashCommandHost } from './dispatch';
14
15export async function handleSwarmCommand(host: SlashCommandHost, args: string): Promise<void> {
16 if (host.session === undefined) {
17 host.showError(NO_ACTIVE_SESSION_MESSAGE);
18 return;
19 }
20
21 const prompt = args.trim();
22 const mode = swarmModeSubcommand(prompt);
23 if (mode !== undefined) {
24 await applySwarmMode(host, mode, `/swarm ${prompt}`);
25 return;
26 }
27
28 if (prompt.length === 0) {
29 await applySwarmMode(host, !host.state.appState.swarmMode, '/swarm');
30 return;
31 }
32
33 if (host.state.appState.model.trim().length === 0) {
34 host.showError(LLM_NOT_SET_MESSAGE);
35 return;
36 }
37
38 if (host.state.appState.permissionMode === 'manual') {
39 showSwarmStartPermissionPrompt(host, `/swarm ${prompt}`, 'Swarm task not started.', (choice) =>
40 startSwarmWithPermission(host, prompt, choice),
41 );
42 return;
43 }
44
45 await startSwarmTask(host, prompt);
46}
47
48function showSwarmStartPermissionPrompt(
49 host: SlashCommandHost,

Callers 2

swarm.test.tsFile · 0.85

Calls 6

swarmModeSubcommandFunction · 0.85
applySwarmModeFunction · 0.85
startSwarmWithPermissionFunction · 0.85
startSwarmTaskFunction · 0.85
showErrorMethod · 0.65

Tested by

no test coverage detected