* Format a bash command for the ⎿ hint. Drops blank lines, collapses runs of * inline whitespace, then caps total length. Newlines are preserved so the * renderer can indent continuation lines under ⎿.
(command: string)
| 123 | * renderer can indent continuation lines under ⎿. |
| 124 | */ |
| 125 | function commandAsHint(command: string): string { |
| 126 | const cleaned = |
| 127 | '$ ' + |
| 128 | command |
| 129 | .split('\n') |
| 130 | .map(l => l.replace(/\s+/g, ' ').trim()) |
| 131 | .filter(l => l !== '') |
| 132 | .join('\n') |
| 133 | return cleaned.length > MAX_HINT_CHARS |
| 134 | ? cleaned.slice(0, MAX_HINT_CHARS - 1) + '…' |
| 135 | : cleaned |
| 136 | } |
| 137 | |
| 138 | /** |
| 139 | * Checks if a tool is a search/read operation using the tool's isSearchOrReadCommand method. |
no outgoing calls
no test coverage detected