MCPcopy Create free account
hub / github.com/cloudflare/agents / findInTree

Function findInTree

packages/shell/src/extras.ts:110–137  ·  view source on GitHub ↗
(
  root: string,
  ops: TreeOps,
  options: StateFindOptions = {}
)

Source from the content-addressed store, hash-verified

108}
109
110export async function findInTree(
111 root: string,
112 ops: TreeOps,
113 options: StateFindOptions = {}
114): Promise<StateFindEntry[]> {
115 const results: StateFindEntry[] = [];
116 const matcher =
117 options.pathPattern !== undefined ? globToRegex(options.pathPattern) : null;
118 const nameMatcher =
119 options.name !== undefined ? globToRegex(options.name) : null;
120 const types = Array.isArray(options.type)
121 ? new Set(options.type)
122 : options.type
123 ? new Set([options.type])
124 : null;
125 await visitFind(
126 root,
127 root,
128 0,
129 ops,
130 options,
131 matcher,
132 nameMatcher,
133 types,
134 results
135 );
136 return results;
137}
138
139export function detectFile(
140 path: string,

Callers 1

findMethod · 0.90

Calls 2

visitFindFunction · 0.85
globToRegexFunction · 0.70

Tested by

no test coverage detected