ai-tree
v0.3.0
Published
Unified CLI to manage AI editor rules and MCP configs (Cursor, Windsurf, Copilot, Kiro, Codeium, Codex, VSCode, Zed, OpenCode).
Downloads
13
Maintainers
Readme
ai-tree
Unified CLI to manage AI editor rules and MCP configs from a single source of truth. It generates and keeps in sync config files for Cursor, Windsurf, Copilot, Kiro, Codeium, Codex, VSCode, Zed, and OpenCode.
Why
- Single file to edit: Update
ai-rules.jsonand sync everywhere. - Repeatable: Idempotent
applyregenerates the same outputs. - Portable: Zero runtime deps; tiny TypeScript CLI.
Install
Until this is published to npm, clone the repo locally:
npm i
npm run buildWhen published, you’ll be able to run:
npx ai-tree --helpQuickstart
# 1) Initialize central config and scaffold all tool files
npx ai-tree init
# 2) Edit the single source of truth
$EDITOR ai-rules.json
# 3) Re-apply changes everywhere
npx ai-tree applyCommands
- init: Create
ai-rules.json(if missing) and generate all outputs. - apply: Regenerate tool configs from
ai-rules.json. - list: Show files managed by this tool.
- clean: Remove generated files.
- doctor: Check expected directories and basic health.
Run npx ai-tree help to see usage.
Handling existing files safely
You might already have AI-related files (e.g. .cursor/mcp.json, .kiro/**, .vscode/mcp.json) before running this tool. To avoid surprises:
- Create a short-lived branch and run
ai-tree initthere first. - The generator is idempotent and only writes when content changes; however, if the generated content differs, it will overwrite that file.
- README is protected via
files.READMEwith modesappend | overwrite | skipto prevent clobbering your project docs. .gitignoreis updated with an ai-tree managed block duringinitto ignore generated artifacts.- Recommended workflow:
- Commit your current repository state.
- Run
ai-tree initin a branch. - Review the diff and copy any important pieces from existing configs into
ai-rules.jsonas needed. - Run
ai-tree applyand merge once you're satisfied.
Notes:
- Global overwrite/backup/skip policies and a
--dry-runpreview are planned. For now, rely on branching and reviewing diffs for safety.
Configuration
All behavior is driven by ai-rules.json:
{
"version": 1,
"project": { "name": "my-repo", "description": "AI assistants unified rules" },
"rules": {
"global": ["Be precise"],
"coding": ["Use meaningful names"]
},
"files": {
"README": "append", // Readme mode: avoids accidental overwrites; choose "append"|"overwrite"|"skip" (true behaves like overwrite)
"AGENT": true,
"CONVENTIONS": true
},
"mcpServers": {
"enableExamples": true,
"servers": [
{ "id": "repo-fs", "command": "node", "args": ["-e", "console.log('placeholder')"] }
]
}
}What gets generated
Examples (depending on your config):
.github/copilot-instructions.md.cursor/rules/instructions.mdc,.cursor/mcp.json.windsurf/rules/instructions.md,.codeium/windsurf/mcp_config.json.kiro/steering/instructions.md,.kiro/settings/mcp.json.codex/config.toml,.vscode/mcp.json,.zed/settings.json.windsurfrules,opencode.json,AGENT.md,CONVENTIONS.md
All of these are safe to delete and re-generate with ai-tree apply.
Contributing
Thanks for helping improve ai-tree! A few quick guidelines:
- Prereqs: Node >= 16.14
- Setup:
npm inpm run build- Run locally via
node dist/cli.js <command>
- Branching: use short, descriptive branches like
feat/windsurf-syncorfix/mcp-json. - Commits: follow Conventional Commits (
feat:,fix:,docs:,refactor:...). - Style: TypeScript, strict mode. Prefer clear names and early returns.
- Testing: if you add or change generators, include a small repo fixture or sample to exercise it manually.
- PRs: keep them focused and include a short description of the change and any migration notes.
License
MIT
