MCPcopy
hub / github.com/codeaashu/claude-code / createFindGrepShellIntegration

Function createFindGrepShellIntegration

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

Source from the content-addressed store, hash-verified

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

Callers 1

Calls 3

hasEmbeddedSearchToolsFunction · 0.85
createArgv0ShellFunctionFunction · 0.85

Tested by

no test coverage detected