MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / findImagePaths

Function findImagePaths

src/utils/image-paths.ts:37–49  ·  view source on GitHub ↗
(text: string, cwd: string)

Source from the content-addressed store, hash-verified

35
36/** Distinct, existing image file paths referenced in `text` (resolved absolute). */
37export function findImagePaths(text: string, cwd: string): string[] {
38 const out: string[] = [];
39 const seen = new Set<string>();
40 for (const m of text.matchAll(IMAGE_PATH_RE)) {
41 const abs = resolvePath(m[1]!, cwd);
42 if (seen.has(abs)) continue;
43 seen.add(abs);
44 try {
45 if (fsSync.statSync(abs).isFile()) out.push(abs);
46 } catch { /* not a real file — ignore (e.g. "logo.png" mentioned in prose) */ }
47 }
48 return out;
49}
50
51/**
52 * If `text` references existing image file(s), append a directive telling the agent to

Callers 3

annotateImagePromptFunction · 0.85
ChatInputFunction · 0.85

Calls 4

resolvePathFunction · 0.85
addMethod · 0.80
hasMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected