AGENTS.md
Guidance for coding agents working on AlexandrAI Tools Remove Line Breaks in the alexandrai-tools project.
Project overview
This guide covers src/tools/remove-line-breaks/index.ts. The tool replaces CRLF, CR, and LF sequences with either a space or an empty string. It can collapse repeated spaces, trim the final block, and preserve paragraph boundaries by processing blocks separated by multiple newlines.
Primary source files
- src/tools/remove-line-breaks/index.ts defines meta, LineBreakOptions, removeLineBreaks, and processBlock.
- src/tools/remove-line-breaks/index.test.ts covers space replacement, empty replacement, collapse on and off, trim, paragraph preservation, CRLF, and empty input.
- src/tools/remove-line-breaks/Body.astro owns browser controls.
- src/tools/remove-line-breaks/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.
- Treat CRLF, CR, and LF as line breaks.
- Use a single space only when replacement is space.
- Collapse repeated spaces only when replacement is space and collapseMultiple is true.
- Preserve paragraph breaks as double newlines when keepParagraphs is true.
- Apply trim inside each processed block.
- If paragraph detection changes, update tests for three or more adjacent newlines.
Testing
Test LF, CRLF, and CR input, space replacement, empty replacement, collapse on and off, trim on and off, keepParagraphs, empty input, and multiline paragraphs with leading or trailing whitespace.
PR checklist
- npm test passes for remove-line-breaks.
- 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.