create-ai-agents-docs is a Node.js CLI tool (ESM, no build step) that scaffolds AI agent-friendly documentation into any repository or folder, using a built-in or external template. It is published to npm as create-ai-agents-docs and invoked via npx create-ai-agents-docs.
The entry point is bin/create-ai-agents-docs.js. All logic lives in lib/. Tests are flat in test/ (no subdirectories).
bin/
create-ai-agents-docs.js – CLI entry point
lib/
cli.js – argument parsing (parseArgs)
copy-template.js – file copying logic (copyTemplate)
fetch-template.js – GitHub/local template fetching (fetchTemplate)
prompt.js – interactive prompting (prompt)
resolve-template.js – template resolution: name → path → URL (resolveTemplate)
templates/
default/ – built-in default template
template.json – template metadata, variables, hooks, ignore list
test/ – unit and integration tests
docs/
build.mjs – converts README.md → docs/dist/index.html
template.html – HTML/CSS template for the documentation site
- ESM only. All files use
import/export. Norequire(). No.mjsextensions needed because"type": "module"is set inpackage.json. - No build step. Source runs directly. Do not add transpilation.
- Zero runtime dependencies. Use only Node.js built-ins (
fs/promises,child_process,path,readline,os,node:test). Do not add runtime dependencies without a strong reason. - Node 20+ only. Use the built-in test runner (
node:test),fs.cp,util.parseArgs, and other Node 20 APIs freely.
- Built-in template names (e.g.
default) — always take precedence - Local filesystem paths — if the value starts with
./,../, or/ - Remote GitHub URLs — if the value starts with
https://
npm test # all tests
npm run test:coverage # all tests with LCOV coverage report (coverage/lcov.info)- Tests must not require any external service, API key, or network access.
- Use
os.tmpdir()for any temp files; clean up inafter()hooks. - Always run
npm testafter making changes and fix failures before finishing.
Run npm run format before committing. Prettier config: 2-space indent, single quotes, no semicolons, 100-char line width, trailing commas.
ESLint enforces: no-unused-vars, no-undef, eqeqeq, no-var, prefer-const.
Write no comments unless the reason is non-obvious. No JSDoc. No multi-line comment blocks.
Each commit must be atomic — one logical change, tests passing.
Format: <type>: <what changed> (feat / fix / test / refactor / docs / chore). No period. Under 72 chars.
- Run
npm run buildto verify the project builds cleanly (tests + lint + format check). - Update
README.mdandAGENTS.mdto reflect any changes to the public interface, architecture, or key constraints.
- Do not add runtime dependencies. Check if a Node.js built-in covers the need first.
- Do not add a build step or transpilation.
- Do not use
console.login library modules except as deliberate user-facing progress output. Errors shouldthrow. - Do not swallow errors silently. Catch only when there is a meaningful recovery or fallback.
- Do not overwrite existing files in the target directory unless
--forceis passed.