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

Function formatUndoChoiceInput

apps/kimi-code/src/tui/commands/undo.ts:315–328  ·  view source on GitHub ↗
(entry: TranscriptEntry)

Source from the content-addressed store, hash-verified

313}
314
315function formatUndoChoiceInput(entry: TranscriptEntry): string {
316 if (entry.kind === 'skill_activation') {
317 const name = singleLine(
318 entry.skillName ?? entry.content.replace(/^Activated skill:\s*/, ''),
319 );
320 const args = singleLine(entry.skillArgs ?? '');
321 if (name.length === 0) return '';
322 return args.length > 0 ? `/${name} ${args}` : `/${name}`;
323 }
324 if (entry.kind === 'plugin_command' && entry.pluginCommandData !== undefined) {
325 return formatPluginCommandSlash(entry.pluginCommandData) ?? entry.content;
326 }
327 return entry.content;
328}
329
330function formatPluginCommandSlash(data: NonNullable<TranscriptEntry['pluginCommandData']>): string | undefined {
331 const name = `${data.pluginId}:${data.commandName}`;

Callers 1

createUndoChoicesFunction · 0.85

Calls 2

formatPluginCommandSlashFunction · 0.85
singleLineFunction · 0.70

Tested by

no test coverage detected