AGENTS.md
Guidance for coding agents working on AlexandrAI Tools Number Base Converter in the alexandrai-tools project.
Project overview
This guide covers src/tools/number-base-converter/index.ts. The tool validates digits for bases two through thirty-six, treats blank input as a successful empty result, converts between bases with parseInt and a BigInt wrapper, and provides a toAllBases helper for binary, octal, decimal, and hexadecimal output.
Primary source files
- src/tools/number-base-converter/index.ts defines meta, ConvertResult, AllBasesResult, DIGITS, isValidForBase, convertBase, and toAllBases.
- src/tools/number-base-converter/index.test.ts covers decimal to hex, binary to decimal, hex to binary, invalid digits, blank input, base bounds, case-insensitive hex, decimal to octal, binary digit rejection, and toAllBases.
- src/tools/number-base-converter/Body.astro owns browser controls.
- src/tools/number-base-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
- Accept bases only from two through thirty-six.
- Treat blank input as ok true with an empty result.
- Lowercase normalized input before validation.
- Reject digits outside the source base.
- Propagate convertBase errors from toAllBases.
- Return lowercase letters for bases above ten.
- Document that the current parseInt path is not exact for arbitrarily large integers.
Testing
Test common bases, base bounds, invalid digits, uppercase letters, blank input, toAllBases, zero, large numbers near Number precision limits, arbitrarily large values if BigInt parsing is fixed, and UI error display.
PR checklist
- npm test passes for number-base-converter.
- Validation, formatting, and numeric precision behavior remain documented.
- Pure helpers stay browser-local and side-effect free.
- UI labels, metadata, and tests update together for behavior changes.