AGENTS.md
Guidance for coding agents working on AlexandrAI Tools Remove Extra Spaces in the alexandrai-tools project.
Project overview
This guide covers src/tools/remove-extra-spaces/index.ts. The tool splits text into lines, optionally collapses runs of ordinary spaces, trims each line, removes blank lines, rejoins with newline characters, and optionally trims the final result.
Primary source files
- src/tools/remove-extra-spaces/index.ts defines meta, ExtraSpaceOptions, and removeExtraSpaces.
- src/tools/remove-extra-spaces/index.test.ts covers collapse, line trimming, blank-line removal, final trim, all-options-off behavior, empty input, and collapse-only behavior.
- src/tools/remove-extra-spaces/Body.astro owns browser controls.
- src/tools/remove-extra-spaces/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
- Return empty input unchanged.
- Only collapse runs of ordinary space characters when collapseSpaces is true.
- Keep trimLines separate from whole-result trimEnds.
- Remove blank lines only after any requested line trimming has run.
- Preserve newline boundaries unless removeBlankLines changes the line list.
- Keep all-options-off behavior byte-for-byte unchanged for normal strings.
- If tabs or Unicode spaces become collapsible, document and test the expanded whitespace policy.
Testing
Test every option alone, all options together, all options off, blank lines with spaces, tabs, empty input, final edge trimming, and order-sensitive combinations such as trimLines before removeBlankLines.
PR checklist
- npm test passes for remove-extra-spaces.
- Browser-local text processing remains browser-local.
- Existing option defaults and edge-case semantics stay documented.
- UI copy, metadata, and tests are updated together for behavior changes.