Download src/tools/BashTool/commentLabel.ts from chenbhao/codev: direct link, hf CLI and curl.
- Browser
- Download file 637 Bytes
-
https://huggingface.co/chenbhao/codev/resolve/main/src/tools/BashTool/commentLabel.ts
- Command line
-
hf download hf://chenbhao/codev/src/tools/BashTool/commentLabel.ts
-
curl -L -o commentLabel.ts https://huggingface.co/chenbhao/codev/resolve/main/src/tools/BashTool/commentLabel.ts
637 Bytes
| /** | |
| * 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 | |
| } | |