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

Function annotateImagePrompt

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

Source from the content-addressed store, hash-verified

53 * inspect them with `vision_analyze`. Returns `text` unchanged when none are found.
54 */
55export 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.

Callers 3

AppFunction · 0.85
runHeadlessFunction · 0.85

Calls 2

findImagePathsFunction · 0.85
unescapeFunction · 0.85

Tested by

no test coverage detected