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

Function formatUndoChoiceLabel

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

Source from the content-addressed store, hash-verified

289}
290
291function formatUndoChoiceLabel(
292 entry: TranscriptEntry,
293): string {
294 if (entry.kind === 'skill_activation') {
295 const name = singleLine(
296 entry.skillName ?? entry.content.replace(/^Activated skill:\s*/, ''),
297 );
298 const args = singleLine(entry.skillArgs ?? '');
299 if (name.length === 0) return 'Skill: unknown';
300 return args.length > 0 ? `/${name} ${args}` : `/${name}`;
301 }
302 if (entry.kind === 'plugin_command' && entry.pluginCommandData !== undefined) {
303 return formatPluginCommandSlash(entry.pluginCommandData) ?? 'User message';
304 }
305
306 const content = singleLine(entry.content);
307 const imageCount = entry.imageAttachmentIds?.length ?? 0;
308 if (content.length > 0) return content;
309 if (imageCount > 0) {
310 return `User message (${String(imageCount)} ${imageCount === 1 ? 'image' : 'images'})`;
311 }
312 return 'User message';
313}
314
315function formatUndoChoiceInput(entry: TranscriptEntry): string {
316 if (entry.kind === 'skill_activation') {

Callers 1

createUndoChoicesFunction · 0.85

Calls 2

formatPluginCommandSlashFunction · 0.85
singleLineFunction · 0.70

Tested by

no test coverage detected