@airuleshub/cli
v3.0.3
Published
Install AI rules from airuleshub.com into your AI agent config files
Downloads
865
Maintainers
Readme
@airuleshub/cli
Install AI rules from airuleshub.com directly into your AI agent config files.
Quick Start
# Install a single rule
npx @airuleshub/cli add nextjs-clean-arch
# Install multiple rules at once ✨ new in v3
npx @airuleshub/cli add nextjs-clean-arch strict-react-typescript-rules postgresql-drizzle-performance-rulesThe CLI will:
- Fetch the rule(s) from airuleshub.com in a single batch request
- Auto-detect your AI agents (Cursor, Claude Code, Windsurf, etc.)
- Show an interactive multi-select prompt — once for all rules
- Install each rule into the correct config file for each selected agent
Commands
add <slugs...> (recommended)
Agent-aware installation with interactive agent selection. Accepts one or more rule slugs.
npx @airuleshub/cli add <slug> [slug2 slug3 ...] [options]Options:
| Flag | Description |
| --------------------- | ------------------------------------------------------- |
| --agent <ids> | Comma-separated agent IDs to install into (skip prompt) |
| -y, --yes | Skip all prompts, overwrite automatically (CI mode) |
| --dry-run | Preview what would be installed without writing files |
| -f, --format <type> | File format: md | json | yaml (default: md) |
| --cwd <path> | Working directory (default: current directory) |
Examples:
# Interactive — auto-detects your agents
npx @airuleshub/cli add nextjs-clean-arch
# Multiple rules in one command
npx @airuleshub/cli add nextjs-clean-arch strict-react-typescript-rules
# Target specific agents
npx @airuleshub/cli add nextjs-clean-arch --agent cursor,claude
# Multiple rules into specific agents
npx @airuleshub/cli add rule-a rule-b --agent cursor,claude,windsurf
# CI mode — no prompts, auto-overwrite
npx @airuleshub/cli add nextjs-clean-arch --yes --agent cursor
# Preview only (no files written)
npx @airuleshub/cli add nextjs-clean-arch rule-b --dry-runinstall [slugs...] (legacy — backward compatible)
Installs rules into the legacy ./airules directory:
npx @airuleshub/cli install nextjs-clean-archSupported Agents
| Agent ID | Display Name | Install Path (single rule) |
| ----------- | --------------- | --------------------------------- |
| cursor | Cursor | .cursor/.cursorrules |
| claude | Claude Code | .claude/CLAUDE.md |
| windsurf | Windsurf | .windsurf/windsurfrules.md |
| vscode | VS Code Copilot | .vscode/ai-rules.md |
| copilot | GitHub Copilot | .github/copilot-instructions.md |
| jetbrains | JetBrains AI | .idea/ai-rules.md |
| zed | Zed AI | .zed/ai-rules.md |
| neovim | Neovim AI | .config/nvim/ai-rules.md |
| continue | Continue.dev | .continue/config.json |
| gemini | Gemini CLI | .gemini/gemini-rules.md |
| codeium | Codeium | .codeium/rules.md |
| tabnine | Tabnine | .tabnine/ai-rules.md |
| qoder | Qoder | .qoder/rules.md |
| roo | Roo Code | .roo/rules.md |
| opencode | OpenCode | .opencode/rules.md |
| kilocode | Kilo Code | .kilocode/rules.md |
| trae | Trae | .trae/rules.md |
| adal | Adal | .adal/rules.md |
| skills | Agent Skills | .agents/skills/<slug>.md |
Note: When installing multiple rules, each rule gets its own slug-named file per agent (e.g.
.cursor/rule-name.md) so rules never overwrite each other.
UX Flow
Agent Auto-Detection
The CLI scans your project for known agent configuration directories:
- 1 agent detected → Confirms with a single Y/n prompt, then installs
- Multiple detected → Shows multi-select with detected agents pre-selected
- None detected → Shows full registry list for manual selection
Agent selection is always asked once, regardless of how many rules you're installing.
Single Rule — File Already Exists
When the target config file already exists you'll see a full prompt:
⚠ File exists: .cursor/.cursorrules
❯ Overwrite
Backup & Replace ← saves .cursorrules.bak-YYYYMMDD-HHMM first
Save as new file → rule-name.md
Skip
CancelMultiple Rules — File Already Exists
When installing multiple rules and any slug files already exist, a focused prompt is shown once for all conflicts:
⚠ 4 files already exist:
• .cursor/rule-a.md
• .claude/rule-a.md
• .cursor/rule-b.md
• .claude/rule-b.md
❯ Overwrite all
Save all as new files
CancelNew File Naming — Automatic Counter
If you choose "Save as new file" / "Save all as new files" and the slug file itself already exists, a counter suffix is appended automatically until a free name is found:
rule-name.md ← exists
rule-name-1.md ← exists
rule-name-2.md ← free ✓ → written hereDry Run
Preview exactly what would be written without touching any files:
npx @airuleshub/cli add nextjs-clean-arch rule-b --dry-run━ nextjs-clean-arch
────────────────────────────────────────────
Dry Run — No files written
────────────────────────────────────────────
Would install:
• Cursor → .cursor/nextjs-clean-arch.md
• Claude Code → .claude/nextjs-clean-arch.md
━ rule-b
────────────────────────────────────────────
Dry Run — No files written
────────────────────────────────────────────
Would install:
• Cursor → .cursor/rule-b.md
• Claude Code → .claude/rule-b.mdMonorepo Support
When a workspace (pnpm-workspace.yaml or "workspaces" in package.json) is detected, you'll be prompted:
Install rule at:
❯ Current package
Workspace rootCI / Non-Interactive Mode
Use --yes to skip all prompts:
npx @airuleshub/cli add rule-a rule-b --yes --agent cursor,claudeThis will:
- Skip agent selection (requires
--agentor auto-detected agents) - Overwrite existing files automatically
- Exit without any confirmations
Security
- Slug names are sanitized to prevent path traversal
- All paths are resolved with
path.resolve - Cross-platform: supports Windows and Unix
Development
# Install dependencies
npm install
# Run in development mode
npm run dev -- add <slug>
# Build
npm run build
# Run tests
npm testChangelog
v3.0.0
- Multi-rule installs —
addnow accepts multiple slugs in one command - Batch API fetch — all slugs fetched in a single request
- Per-slug files — multiple rules each get their own
<slug>.mdfile per agent (no overwrite collisions) - Single overwrite prompt — conflict resolution asked once for all rules combined
- Simplified conflict prompt for multi-rule mode (Overwrite all / Save all as new files / Cancel)
- Auto counter suffix — "Save as new file" produces
rule-1.md,rule-2.md, … if the base name is taken
v2.0.0
- Agent-aware
addcommand with interactive multi-select - Auto-detection of 19 AI agents
- Monorepo support
- Dry-run mode
- Backup & Replace option
v1.x
- Legacy
installcommand (writes to./airules/)
License
ISC © Nikunj Borad
