A Node.js CLI tool to generate ai.txt, llms.txt, robots.txt, and humans.txt files for your website or application.
- π€ Generate
ai.txt(robots.txt-like format for AI) - π Generate
llms.txt(JSON format in.well-known/directory) - π€ Generate
robots.txt(web crawler rules) - π₯ Generate
humans.txt(team credits and site info) - π― Interactive CLI with sensible defaults
- βοΈ Flexible command-line options
- π§ͺ Fully tested with Mocha + Chai (23 passing tests)
- β¨ Modern ESM JavaScript (Node.js 20+)
pnpm add -g @profullstack/ai-dot-txtpnpm add -D @profullstack/ai-dot-txtgit clone <repository-url>
cd ai-dot-txt
pnpm installRun the CLI and answer the prompts:
aidottxtaidottxt [options]--out <dir>- Output directory (default: current directory)--ai-only- Generate onlyai.txt--llms-only- Generate onlyllms.txt(in.well-known/)--robots-only- Generate onlyrobots.txt--humans-only- Generate onlyhumans.txt--dry-run- Preview output without writing files--help, -h- Show help message
Generate both files in current directory:
aidottxtGenerate in a specific directory:
aidottxt --out ./publicPreview without writing files:
aidottxt --dry-runGenerate only ai.txt:
aidottxt --ai-only --out ./distGenerate only llms.txt:
aidottxt --llms-onlyGenerate only robots.txt and humans.txt:
aidottxt --robots-only --humans-onlyLocated at the root of your output directory. Format:
# ai.txt for My Site
# Base: https://example.com
# Contact: mailto:[email protected]
# Models: *
# Capabilities: chat, embed, fine_tune, crawl, train
User-agent: *
Allow: /*
Training: allow
Retention: allow
Commercial-Use: allow
Rate-Limit-RPS: 10
Located at .well-known/llms.txt. Format:
{
"version": "1.0",
"site_name": "My Site",
"contact": "mailto:[email protected]",
"models": ["*"],
"capabilities": ["chat", "embed", "fine_tune", "crawl", "train"],
"policy": {
"allow": ["/*"],
"disallow": []
},
"training": true,
"retention": true,
"commercial_use": true,
"rate_limit_rps": 10
}Located at the root of your output directory. Format:
User-agent: *
Allow: /api/*
Allow: /docs/*
Disallow: /admin/*
Disallow: /private/*
Crawl-delay: 1
Sitemap: https://example.com/sitemap.xml
Located at the root of your output directory. Format:
/* TEAM */
Developer: John Doe
Contact: https://github.com/johndoe
Designer: Jane Smith
Contact: https://twitter.com/janesmith
/* THANKS */
Open Source Community
Coffee
/* SITE */
Last update: 2024/01/01
Language: English
Standards: HTML5
Components: Node.js, JavaScript
You can also use this package programmatically:
import { buildAiTxt, buildLlmsJson } from "@profullstack/ai-dot-txt";
const config = {
siteName: "My Site",
baseUrl: "https://example.com",
contact: "mailto:[email protected]",
models: ["gpt-4", "claude-3"],
capabilities: ["chat", "embed"],
allowPaths: ["/api/*", "/docs/*"],
disallowPaths: ["/admin/*"],
training: "allow",
retention: "allow",
commercialUse: "disallow",
rateLimitRps: 10,
};
// Generate ai.txt content
const aiTxtContent = buildAiTxt(config);
// Generate llms.txt content
const llmsTxtContent = buildLlmsJson(config);When running interactively, you'll be prompted for:
- Site Name: Your website or application name
- Base URL: Your public base URL
- Contact: Contact information (email, URL, etc.)
- Models: Comma-separated list of allowed AI models (use
*for all) - Capabilities: Select from: chat, embed, fine_tune, crawl, train
- Allow Paths: Comma-separated paths to allow (e.g.,
/*,/api/*) - Disallow Paths: Comma-separated paths to disallow (e.g.,
/admin/*) - Training Permission: Allow or disallow AI training on your content
- Retention Permission: Allow or disallow data retention
- Commercial Use: Allow or disallow commercial use of your content
- Rate Limit: Requests per second limit
pnpm installpnpm testpnpm lintpnpm lint:fixpnpm format.
βββ src/
β βββ args.js # CLI argument parser
β βββ generators.js # File content generators
β βββ cli.js # Main CLI entry point
β βββ index.js # Programmatic API exports
βββ tests/
β βββ args.test.js # Argument parser tests
β βββ generators.test.js # Generator tests
βββ package.json
βββ eslint.config.js
βββ .prettierrc
βββ README.md
- Node.js >= 20.0.0
- pnpm (recommended) or npm
MIT
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch
- Write tests for your changes
- Ensure all tests pass (
pnpm test) - Ensure code is linted (
pnpm lint) - Submit a pull request
This project follows several web standards and specifications:
- humans.txt - See humans.txt for team and site information
- robots.txt - Standard for web robots
- llms.txt - LLM-friendly documentation format
- ai.txt - AI agent interaction specification
Profullstack, Inc.