AGENTS.md
Guidance for coding agents working on AlexandrAI Tools Slugify in the alexandrai-tools project.
Project overview
This guide covers src/tools/slugify/index.ts. The tool normalizes input with NFKD, strips combining marks, replaces runs of non-alphanumeric characters with a configurable separator, trims leading and trailing separators, and lowercases by default.
Primary source files
- src/tools/slugify/index.ts defines meta, SlugifyOptions, and slugify.
- src/tools/slugify/index.test.ts covers diacritics, repeated spaces, custom separators, case preservation, empty input, separator trimming, and numbers.
- src/tools/slugify/Body.astro owns browser controls.
- src/tools/slugify/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
- Default separator is hyphen.
- Default lower option is true.
- Normalize with NFKD before removing combining marks.
- Replace each run of non-alphanumeric characters with one separator.
- Escape the configured separator before using it in a trimming regular expression.
- Return an empty string for empty input.
- If non-Latin slug support is added, define how Unicode letters, digits, and percent encoding should behave.
Testing
Test diacritics, punctuation runs, leading and trailing separators, custom separator escaping, lower false, numbers, empty input, repeated whitespace, and future Unicode slug rules.
PR checklist
- npm test passes for slugify.
- 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.