MCPcopy Index your code
hub / github.com/simstudioai/sim / pathWithinGrepScope

Function pathWithinGrepScope

apps/sim/lib/copilot/vfs/operations.ts:115–125  ·  view source on GitHub ↗
(filePath: string, scope: string)

Source from the content-addressed store, hash-verified

113 * keeping "what we materialize" identical to "what grep filters in".
114 */
115export function pathWithinGrepScope(filePath: string, scope: string): boolean {
116 const scopeUsesStarOrQuestionGlob = /[*?]/.test(scope)
117 if (scopeUsesStarOrQuestionGlob) {
118 return micromatch.isMatch(filePath, scope, VFS_GLOB_OPTIONS)
119 }
120 const base = scope.replace(/\/+$/, '')
121 if (base === '') {
122 return true
123 }
124 return filePath === base || filePath.startsWith(`${base}/`)
125}
126
127/**
128 * Regex search over VFS file contents using ECMAScript `RegExp` syntax.

Callers 1

grepFunction · 0.85

Calls 2

testMethod · 0.80
replaceMethod · 0.65

Tested by

no test coverage detected