(text: string, cwd: string)
| 53 | * inspect them with `vision_analyze`. Returns `text` unchanged when none are found. |
| 54 | */ |
| 55 | export function annotateImagePrompt(text: string, cwd: string): string { |
| 56 | const images = findImagePaths(text, cwd); |
| 57 | if (images.length === 0) return text; |
| 58 | const list = images.map(p => ` - ${p}`).join('\n'); |
| 59 | const barePathOnly = images.length === 1 && unescape(text.trim()) === images[0]; |
| 60 | const ask = barePathOnly ? 'Describe what it shows and anything notable.' : 'Use it to answer the request above.'; |
| 61 | return ( |
| 62 | `${text}\n\n` + |
| 63 | `[QodeX detected image file(s) on disk. Call the \`vision_analyze\` tool on the EXACT ` + |
| 64 | `path(s) below (it runs on the vision model) — do not say you can't see images. ${ask}\n` + |
| 65 | `${list}\n]` |
| 66 | ); |
| 67 | } |
| 68 | |
| 69 | // A path-like token: runs of (non-space, non-backslash) OR (backslash + any char). Used to |
| 70 | // pick candidate paths out of a pasted/dropped string without splitting on escaped spaces. |
no test coverage detected