MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / commandAsHint

Function commandAsHint

source code/utils/collapseReadSearch.ts:127–138  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

125 * renderer can indent continuation lines under ⎿.
126 */
127function commandAsHint(command: string): string {
128 const cleaned =
129 '$ ' +
130 command
131 .split('\n')
132 .map(l => l.replace(/\s+/g, ' ').trim())
133 .filter(l => l !== '')
134 .join('\n')
135 return cleaned.length > MAX_HINT_CHARS
136 ? cleaned.slice(0, MAX_HINT_CHARS - 1) + '…'
137 : cleaned
138}
139
140/**
141 * Checks if a tool is a search/read operation using the tool's isSearchOrReadCommand method.

Callers 1

collapseReadSearchGroupsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected