source dump of claude code
at main 13 lines 637 B view raw
1/** 2 * If the first line of a bash command is a `# comment` (not a `#!` shebang), 3 * return the comment text stripped of the `#` prefix. Otherwise undefined. 4 * 5 * Under fullscreen mode this is the non-verbose tool-use label AND the 6 * collapse-group ⎿ hint — it's what Claude wrote for the human to read. 7 */ 8export function extractBashCommentLabel(command: string): string | undefined { 9 const nl = command.indexOf('\n') 10 const firstLine = (nl === -1 ? command : command.slice(0, nl)).trim() 11 if (!firstLine.startsWith('#') || firstLine.startsWith('#!')) return undefined 12 return firstLine.replace(/^#+\s*/, '') || undefined 13}