AGENTS.md
Guidance for coding agents working on AlexandrAI Tools Gitignore Generator in the alexandrai-tools project.
Project overview
This guide covers src/tools/gitignore-generator/index.ts. The tool exposes explicit template sections for Node, Python, macOS, Windows, VSCode, and Java, ignores unknown template keys, preserves comments and blank structural lines, deduplicates actual ignore rules, inserts a blank line between sections, and trims trailing blank lines.
Primary source files
- src/tools/gitignore-generator/index.ts defines meta, TEMPLATES, TEMPLATE_KEYS, and buildGitignore.
- src/tools/gitignore-generator/index.test.ts covers Node, Python, macOS, unknown keys, overlapping rule dedupe, empty selection, and multiple selected templates.
- src/tools/gitignore-generator/Body.astro owns browser controls.
- src/tools/gitignore-generator/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
- Keep template sections explicit and reviewable.
- Ignore unknown template keys without throwing.
- Always include comments and blank lines as structure.
- Deduplicate non-comment rule lines across selected sections.
- Insert one blank line between sections.
- Trim trailing blank lines from final output.
- If templates expand, update tests for overlapping rules and key ordering.
Testing
Test every template key, unknown keys, empty selection, multi-template output, duplicate rules, comment preservation, blank-line trimming, order stability, and UI copy/download behavior.
PR checklist
- npm test passes for gitignore-generator.
- Generated output shape, escaping, and invalid-input behavior remain documented.
- Browser-local generation stays free of hidden network calls.
- UI labels, metadata, and tests update together for behavior changes.