AGENTS.md
Guidance for coding agents working on AlexandrAI Tools Image Blur in the alexandrai-tools project.
Project overview
This guide covers src/tools/image-blur. clampBlur constrains blur radius to zero through a configurable max with one hundred as the default. Body.astro draws the source image into an output canvas at native dimensions with a blur filter, resets the filter, and downloads blurred.png.
Primary source files
- src/tools/image-blur/index.ts defines meta and clampBlur.
- src/tools/image-blur/index.test.ts covers in-range values, below-zero clamping, default max clamping, custom max clamping, exact zero, and exact max.
- src/tools/image-blur/Body.astro owns image preview, blur input, canvas filter output, PNG download, and clear state.
- src/tools/image-blur/i18n.ts owns localized labels.
- src/lib/tools.ts registers the tool metadata.
Setup commands
npm install npm test npm run typecheck npm run build npm run dev
Change rules
- Clamp blur radius before constructing the canvas filter.
- Default the maximum blur radius to one hundred pixels.
- Respect a custom max when the helper is reused.
- Draw output at native image dimensions.
- Reset ctx.filter to none after drawing.
- Keep output as PNG.
- Keep original preview and transformed output canvases separate.
Testing
Test clampBlur boundaries, custom max behavior, zero blur, maximum blur, negative UI input, output canvas dimensions, filter reset, PNG download, and clear-state reset.
PR checklist
- npm test passes for image-blur.
- Canvas processing stays browser-local and deterministic enough for tests.
- Pure helper behavior, UI controls, and i18n labels stay aligned.
- Download format, filename, and reset behavior are covered.