AGENTS.md
Guidance for coding agents working on AlexandrAI Tools Running Pace in the alexandrai-tools project.
Project overview
This guide covers src/tools/running-pace. formatPace emits minute and second pace strings, formatTime emits minute-second or hour-minute-second strings, parsePace accepts a single colon-separated minutes and seconds value, and solvePace solves for pace, time, or distance from the other two positive inputs.
Primary source files
- src/tools/running-pace/index.ts defines meta, formatPace, formatTime, parsePace, SolveFor, PaceResult, and solvePace.
- src/tools/running-pace/index.test.ts covers pace formatting, time formatting, pace parsing, invalid pace strings, all three solve modes, and missing input rejection.
- src/tools/running-pace/Body.astro owns distance, time, pace, unit, and solve-mode controls.
- src/tools/running-pace/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
- Format pace as minutes and two-digit seconds.
- Only include hours in formatted time when total time is at least one hour.
- Reject pace strings without exactly one colon.
- Reject pace strings with seconds of 60 or greater.
- Return null from solvePace when required inputs are missing or non-positive.
- Round solved distance to two decimals.
- Keep unit labels separate from pure solving logic.
Testing
Test pace parsing, pace formatting, time formatting around one hour, each solve mode, non-positive values, missing inputs, distance rounding, imperial and metric labels, and UI error states.
PR checklist
- npm test passes for running-pace.
- Calculator formulas, units, and rounding rules are documented.
- Health and fitness outputs keep informational safety scope.
- UI labels, validation, and pure helper tests stay aligned.