AGENTS.md
Guidance for coding agents working on AlexandrAI Tools Pressure Converter in the alexandrai-tools project.
Project overview
This guide covers src/tools/pressure-converter/index.ts. The tool converts Pa, kPa, bar, psi, atm, mmHg, and torr through a pascal factor table, returns identity conversions unchanged, and rounds non-identity results to seven significant figures.
Primary source files
- src/tools/pressure-converter/index.ts defines meta, UNITS, PressureUnit, TO_PA, sigFig, and convert.
- src/tools/pressure-converter/index.test.ts covers bar, atm, psi, kPa, atm to bar, torr to mmHg, and identity conversion.
- src/tools/pressure-converter/Body.astro owns browser controls.
- src/tools/pressure-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 Pa as the base unit.
- Keep bar as 100000 Pa.
- Keep atm as 101325 Pa.
- Keep psi as 6894.757293168 Pa.
- Keep mmHg and torr equal at 133.322387415 Pa.
- Round converted values with the local seven significant figure helper.
- If high-precision mode is added, keep the existing rounded default stable.
Testing
Test 1 bar to 100000 Pa, 1 atm to 101325 Pa, 1 psi to about 6894.757 Pa, 1 kPa to 1000 Pa, 1 atm to about 1.01325 bar, torr to mmHg identity-by-factor, same-unit identity, zero, and large or small numbers for sigFig behavior.
PR checklist
- npm test passes for pressure-converter.
- Conversion constants remain traceable and tested.
- Identity conversions and rounding behavior remain documented.
- UI labels, unit arrays, and pure conversion logic stay in sync.