AGENTS.md
Guidance for coding agents working on AlexandrAI Tools Morse Code Translator in the alexandrai-tools project.
Project overview
This guide covers src/tools/morse-code-translator/index.ts. The tool maps uppercase letters, digits, and spaces to Morse symbols, skips unknown text characters while encoding, decodes slash-separated words and whitespace-separated letters, and returns question marks for unknown Morse code groups.
Primary source files
- src/tools/morse-code-translator/index.ts defines meta, MORSE_MAP, REVERSE_MAP, textToMorse, and morseToText.
- src/tools/morse-code-translator/index.test.ts covers SOS, digits, spaces as slash, case-insensitive encoding, empty input, decoding, word separators, and round trips.
- src/tools/morse-code-translator/Body.astro owns browser controls.
- src/tools/morse-code-translator/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
- Uppercase text before encoding.
- Map spaces to slash while encoding.
- Skip unknown characters while encoding.
- Split Morse words on slash with optional surrounding whitespace.
- Split Morse letters on whitespace.
- Return question mark for unknown Morse code groups.
- Keep supported alphabet and digit maps explicit.
Testing
Test letters, digits, spaces, lowercase input, empty input, unknown text characters, unknown Morse groups, extra whitespace, slash-separated words, and text-to-Morse-to-text round trips.
PR checklist
- npm test passes for morse-code-translator.
- Encoding, decoding, and failure behavior remain documented.
- Browser-local processing and security limits stay clear in UI copy.
- UI labels, metadata, and tests update together for behavior changes.