AlexandrAI AGENTS.md
agents-md

AlexandrAI Tools Image Border Agent Guide

Agent guide for uniform border dimension math and canvas border drawing.

AGENTS.md

Guidance for coding agents working on AlexandrAI Tools Image Border in the alexandrai-tools project.

Project overview

This guide covers src/tools/image-border. borderedDims adds the border width to all four sides, increasing output width and height by twice the border. Body.astro fills the output canvas with the selected border color, draws the source image offset by the border width, and downloads image-with-border.png.

Primary source files

  • src/tools/image-border/index.ts defines meta, BorderedDims, and borderedDims.
  • src/tools/image-border/index.test.ts covers four-sided borders, zero border, zero-size images, square images, and larger images.
  • src/tools/image-border/Body.astro owns image preview, border width input, color input, canvas fill and draw, PNG download, and clear state.
  • src/tools/image-border/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

  • Add the border to all four sides.
  • Increase output width by border times two.
  • Increase output height by border times two.
  • Draw the source image at x and y equal to the border width.
  • Fill the output canvas before drawing the image.
  • Keep output as PNG.
  • If asymmetric borders are added, replace borderedDims and tests together.

Testing

Test borderedDims, zero border, large borders, negative UI input handling, color input, source image offset, output canvas dimensions, transparent inputs, PNG download, and clear-state reset.

PR checklist

  • npm test passes for image-border.
  • 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.