* 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)
| 136 | * renderer can indent continuation lines under ⎿. |
| 137 | */ |
| 138 | function commandAsHint(command: string): string { |
| 139 | const cleaned = |
| 140 | '$ ' + |
| 141 | command |
| 142 | .split('\n') |
| 143 | .map(l => l.replace(/\s+/g, ' ').trim()) |
| 144 | .filter(l => l !== '') |
| 145 | .join('\n') |
| 146 | return cleaned.length > MAX_HINT_CHARS |
| 147 | ? cleaned.slice(0, MAX_HINT_CHARS - 1) + '…' |
| 148 | : cleaned |
| 149 | } |
| 150 | |
| 151 | /** |
| 152 | * Checks if a tool is a search/read operation using the tool's isSearchOrReadCommand method. |
no outgoing calls
no test coverage detected