MCPcopy Index your code
hub / github.com/Dimillian/CodexMonitor / parseRead

Function parseRead

src/utils/threadItems.explore.ts:224–246  ·  view source on GitHub ↗
(tokens: string[])

Source from the content-addressed store, hash-verified

222}
223
224function parseRead(tokens: string[]): ExploreEntry[] | null {
225 const paths = findPathTokens(tokens).filter(Boolean);
226 if (paths.length === 0) {
227 return null;
228 }
229 const entries = paths.map((path) => {
230 const name = path.split(/[\\/]/g).filter(Boolean).pop() ?? path;
231 return name && name !== path
232 ? ({ kind: "read", label: name, detail: path } satisfies ExploreEntry)
233 : ({ kind: "read", label: path } satisfies ExploreEntry);
234 });
235 const seen = new Set<string>();
236 const deduped: ExploreEntry[] = [];
237 for (const entry of entries) {
238 const key = entry.detail ? `${entry.label}|${entry.detail}` : entry.label;
239 if (seen.has(key)) {
240 continue;
241 }
242 seen.add(key);
243 deduped.push(entry);
244 }
245 return deduped;
246}
247
248function parseList(tokens: string[]): ExploreEntry {
249 const paths = findPathTokens(tokens);

Callers 1

parseCommandSegmentFunction · 0.85

Calls 1

findPathTokensFunction · 0.85

Tested by

no test coverage detected