AGENTS.md
Guidance for coding agents working on AlexandrAI Tools Area Converter in the alexandrai-tools project.
Project overview
This guide covers src/tools/area-converter/index.ts. The tool converts m2, km2, ft2, yd2, acre, hectare, and mi2 through a square meter factor table and returns same-unit values unchanged without rounding in pure logic.
Primary source files
- src/tools/area-converter/index.ts defines meta, AreaUnit, AREA_UNITS, TO_M2, and convert.
- src/tools/area-converter/index.test.ts covers acre to m2, hectare to m2, km2 to m2, m2 to ft2, hectare to acre, and identity conversion.
- src/tools/area-converter/Body.astro owns browser controls.
- src/tools/area-converter/i18n.ts owns localized copy.
- src/lib/tools.ts registers metadata.
Setup commands
npm install npm test npm run typecheck npm run build npm run dev
Change rules
- Use m2 as the base unit.
- Keep km2 as 1000000 m2.
- Keep ft2 as 0.09290304 m2 and yd2 as 0.83612736 m2.
- Keep acre as 4046.8564224 m2.
- Keep hectare as 10000 m2.
- Keep mi2 as 2589988.110336 m2.
- Leave display rounding outside pure convert.
Testing
Test acre to m2, hectare to m2, km2 to m2, m2 to ft2, hectare to acre, mi2 conversions, yd2 conversions, identity, zero, fractional areas, and negative values if UI permits them.
PR checklist
- npm test passes for area-converter.
- Unit constants, lookup tables, and rounding rules are covered by tests.
- Same-unit and invalid-input behavior remain documented.
- UI labels, metadata, and pure conversion logic stay in sync.