MCPcopy Create free account
hub / github.com/Noumena-Network/code / commandAsHint

Function commandAsHint

src/utils/collapseReadSearch.ts:138–149  ·  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

136 * renderer can indent continuation lines under ⎿.
137 */
138function 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.

Callers 1

collapseReadSearchGroupsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected