AGENTS.md
Guidance for coding agents working on AlexandrAI Tools Paint Calculator in the alexandrai-tools project.
Project overview
This guide covers src/tools/paint-calculator. calcPaint sums wall width times height, subtracts standard door and window areas based on square metres or square feet, clamps net area to zero, multiplies paint volume by coats, divides by coverage, and rounds can count upward.
Primary source files
- src/tools/paint-calculator/index.ts defines meta, AreaUnit, VolumeUnit, PaintInput, PaintResult, standard deductions, and calcPaint.
- src/tools/paint-calculator/index.test.ts covers basic paint need, coats, door and window deductions, zero floor, can rounding, invalid coverage, and multiple walls.
- src/tools/paint-calculator/Body.astro owns wall rows, door/window counts, coats, coverage, can size, units, and result display.
- src/tools/paint-calculator/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
- Return zeros when coats, coverage, or can size are not positive.
- Calculate gross area as the sum of width times height for all walls.
- Use metric deductions when areaUnit is sqm.
- Use imperial deductions when areaUnit is sqft.
- Clamp net area to zero after deductions.
- Calculate paint needed as net area divided by coverage times coats.
- Round cansNeeded upward with Math.ceil.
Testing
Test metric and imperial deductions, multiple walls, zero floor, invalid coats, invalid coverage, invalid can size, high door/window counts, can rounding, and displayed unit labels.
PR checklist
- npm test passes for paint-calculator.
- Calculator formulas, units, and rounding expectations are documented.
- Currency and display formatting remain outside pure helpers.
- Invalid-input behavior is covered by tests and UI validation.