MCPcopy Index your code
hub / github.com/codeaashu/claude-code / parseDirectoryListing

Function parseDirectoryListing

web/lib/api/files.ts:178–189  ·  view source on GitHub ↗
(basePath: string, text: string)

Source from the content-addressed store, hash-verified

176// ---------------------------------------------------------------------------
177
178function parseDirectoryListing(basePath: string, text: string): FileEntry[] {
179 const entries: FileEntry[] = [];
180 for (const line of text.split("\n")) {
181 const trimmed = line.trim();
182 if (!trimmed) continue;
183 const isDir = trimmed.endsWith("/");
184 const name = isDir ? trimmed.slice(0, -1) : trimmed;
185 const joinedPath = `${basePath.replace(/\/$/, "")}/${name}`;
186 entries.push({ name, path: joinedPath, type: isDir ? "directory" : "file" });
187 }
188 return entries;
189}
190
191// Matches: path/to/file.ts:42: some content
192const GREP_LINE_RE = /^([^:]+):(\d+):(.*)$/;

Callers 1

listFunction · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected