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

Function glob

apps/sim/lib/copilot/vfs/operations.ts:223–252  ·  view source on GitHub ↗
(files: Map<string, string>, pattern: string)

Source from the content-addressed store, hash-verified

221 * Returns matching file keys and virtual directory prefixes.
222 */
223export function glob(files: Map<string, string>, pattern: string): string[] {
224 const result = new Set<string>()
225
226 const directories = new Set<string>()
227 for (const filePath of files.keys()) {
228 if (filePath.endsWith('/.folder')) {
229 directories.add(filePath.slice(0, -'/.folder'.length))
230 continue
231 }
232 const parts = filePath.split('/')
233 for (let i = 1; i < parts.length; i++) {
234 directories.add(parts.slice(0, i).join('/'))
235 }
236 }
237
238 for (const filePath of files.keys()) {
239 if (filePath.endsWith('/.folder')) continue
240 if (micromatch.isMatch(filePath, pattern, VFS_GLOB_OPTIONS)) {
241 result.add(filePath)
242 }
243 }
244
245 for (const dir of directories) {
246 if (micromatch.isMatch(dir, pattern, VFS_GLOB_OPTIONS)) {
247 result.add(dir)
248 }
249 }
250
251 return Array.from(result).sort()
252}
253
254/**
255 * Read a VFS file's content, optionally with offset and limit.

Callers 10

operations.test.tsFile · 0.90
generateIconMappingFunction · 0.85
buildToolDescriptionMapFunction · 0.85
buildTriggerRegistryFunction · 0.85
writeIntegrationsJsonFunction · 0.85
getToolInfoFunction · 0.85
getCanonicalToolDocNamesFunction · 0.85
buildFullTriggerRegistryFunction · 0.85
buildProviderColorMapFunction · 0.85
generateAllBlockDocsFunction · 0.85

Calls 2

joinMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected