Build a Node.js npm module/CLI interface for generating ai.txt and llms.txt static files.
- Interactive CLI using inquirer for user input
- Generate ai.txt file (robots.txt-like format for AI)
- Generate llms.txt file (JSON format for LLM policies)
- Support command-line flags for customization
- Output files to specified directory (default: current working directory)
--out <dir>- Output directory (default: current working directory)--ai-only- Generate only ai.txt--llms-only- Generate only llms.txt--dry-run- Preview output without writing files--help/-h- Show help message
# ai.txt for <site_name>
# Base: <base_url>
# Contact: <contact>
# Models: <models>
# Capabilities: <capabilities>
User-agent: *
Allow: <paths>
Disallow: <paths>
Training: allow/disallow
Retention: allow/disallow
Commercial-Use: allow/disallow
Rate-Limit-RPS: <number>
{
"version": "1.0",
"site_name": "...",
"contact": "...",
"models": ["..."],
"capabilities": ["..."],
"policy": {
"allow": ["..."],
"disallow": ["..."]
},
"training": true/false,
"retention": true/false,
"commercial_use": true/false,
"rate_limit_rps": 10
}- Site name
- Base URL
- Contact information
- Allowed models (default: ["*"])
- Capabilities (chat, embed, fine_tune, crawl, train)
- Allow/disallow paths
- Training permission
- Data retention permission
- Commercial use permission
- Rate limit (requests per second)
- Node.js v20+
- ESM modules
- inquirer for interactive prompts
- Mocha + Chai for testing
- ESLint + Prettier for code quality
- ✅ Create TODO.md
- Set up package.json with dependencies
- Create directory structure (src/, tests/)
- Write tests for argument parsing
- Write tests for file generators
- Implement argument parser
- Implement ai.txt generator
- Implement llms.txt generator
- Create CLI entry point
- Add ESLint/Prettier config
- Manual testing
- Update README