πŸ“„ File detail

tools/BashTool/commentLabel.ts

🧩 .tsπŸ“ 14 linesπŸ’Ύ 637 bytesπŸ“ text
← Back to All Files

🎯 Use case

This module implements the β€œBashTool” tool (Bash) β€” something the model can call at runtime alongside other agent tools. On the API surface it exposes extractBashCommentLabel β€” mainly functions, hooks, or classes. What the file header says: If the first line of a bash command is a `# comment` (not a `#!` shebang), return the comment text stripped of the `#` prefix. Otherwise undefined. Under fullscreen mode this is the non-verbose tool-use label AND the collapse-group ⎿ hint β€” it's what Claude wrote for the human to.

Generated from folder role, exports, dependency roots, and inline comments β€” not hand-reviewed for every path.

🧠 Inline summary

If the first line of a bash command is a `# comment` (not a `#!` shebang), return the comment text stripped of the `#` prefix. Otherwise undefined. Under fullscreen mode this is the non-verbose tool-use label AND the collapse-group ⎿ hint β€” it's what Claude wrote for the human to read.

πŸ“€ Exports (heuristic)

  • extractBashCommentLabel

πŸ–₯️ Source preview

/**
 * If the first line of a bash command is a `# comment` (not a `#!` shebang),
 * return the comment text stripped of the `#` prefix. Otherwise undefined.
 *
 * Under fullscreen mode this is the non-verbose tool-use label AND the
 * collapse-group ⎿ hint β€” it's what Claude wrote for the human to read.
 */
export function extractBashCommentLabel(command: string): string | undefined {
  const nl = command.indexOf('\n')
  const firstLine = (nl === -1 ? command : command.slice(0, nl)).trim()
  if (!firstLine.startsWith('#') || firstLine.startsWith('#!')) return undefined
  return firstLine.replace(/^#+\s*/, '') || undefined
}