(searchToken: string)
| 127 | // locally. This keeps the query maximally specific (avoiding the 20-result |
| 128 | // cap) while never sending a partial word that kills the search. |
| 129 | function mcpQueryFor(searchToken: string): string { |
| 130 | const lastSep = Math.max( |
| 131 | searchToken.lastIndexOf('-'), |
| 132 | searchToken.lastIndexOf('_'), |
| 133 | ) |
| 134 | return lastSep > 0 ? searchToken.slice(0, lastSep) : searchToken |
| 135 | } |
| 136 | |
| 137 | // Find a cached entry whose key is a prefix of mcpQuery and still has |
| 138 | // matches for searchToken. Lets typing "c"→"cl"→"cla" reuse the "c" cache |
no test coverage detected