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

Function tryHandleDanceCommand

apps/kimi-code/src/tui/easter-eggs/dance.ts:228–248  ·  view source on GitHub ↗
(host: SlashCommandHost, parsed: ParsedSlashInput)

Source from the content-addressed store, hash-verified

226 * Returns true when it claimed the input.
227 */
228export function tryHandleDanceCommand(host: SlashCommandHost, parsed: ParsedSlashInput): boolean {
229 if (parsed.name !== 'dance') return false;
230 if (currentDanceController === undefined) return false;
231
232 // The status line dims the whole message, which buried the command in the
233 // hint. Paint just the command in the brand color (bold) so it reads as a
234 // command; chalk nesting resumes the dim run right after it.
235 const cmd = (text: string): string => currentTheme.boldFg('primary', text);
236
237 const sub = parsed.args.trim().toLowerCase();
238 if (sub === 'off') {
239 currentDanceController.stop();
240 } else if (sub === 'on') {
241 currentDanceController.start({ hold: true });
242 host.showStatus(`Dancing — use ${cmd('/dance off')} to turn it off.`);
243 } else {
244 currentDanceController.start({ hold: false });
245 host.showStatus(`Use ${cmd('/dance on')} to keep the rainbow on.`);
246 }
247 return true;
248}

Callers 2

dance.test.tsFile · 0.90
executeSlashCommandFunction · 0.90

Calls 4

cmdFunction · 0.70
stopMethod · 0.65
startMethod · 0.65
showStatusMethod · 0.65

Tested by

no test coverage detected