MCPcopy Index your code
hub / github.com/Noumena-Network/code / createFindGrepShellIntegration

Function createFindGrepShellIntegration

src/utils/bash/ShellSnapshot.ts:154–180  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

152 * Returns null if embedded search tools are not available in this build.
153 */
154export function createFindGrepShellIntegration(): string | null {
155 if (!hasEmbeddedSearchTools()) {
156 return null
157 }
158 const binaryPath = embeddedSearchToolsBinaryPath()
159 return [
160 // User shell configs may define aliases like `alias find=gfind` or
161 // `alias grep=ggrep` (common on macOS with Homebrew GNU tools). The
162 // snapshot sources user aliases before these function definitions, and
163 // bash expands aliases before function lookup — so a renaming alias
164 // would silently bypass the embedded bfs/ugrep dispatch. Clear them first
165 // (same fix the rg integration uses).
166 'unalias find 2>/dev/null || true',
167 'unalias grep 2>/dev/null || true',
168 createArgv0ShellFunction('find', 'bfs', binaryPath, [
169 '-regextype',
170 'findutils-default',
171 ]),
172 createArgv0ShellFunction('grep', 'ugrep', binaryPath, [
173 '-G',
174 '--ignore-files',
175 '--hidden',
176 '-I',
177 ...VCS_DIRECTORIES_TO_EXCLUDE.map(d => `--exclude-dir=${d}`),
178 ]),
179 ].join('\n')
180}
181
182function getConfigFile(shellPath: string): string {
183 const fileName = shellPath.includes('zsh')

Callers 1

Calls 3

hasEmbeddedSearchToolsFunction · 0.85
createArgv0ShellFunctionFunction · 0.85

Tested by

no test coverage detected