(text: string, cwd: string)
| 35 | |
| 36 | /** Distinct, existing image file paths referenced in `text` (resolved absolute). */ |
| 37 | export 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 |
no test coverage detected