Options
Version pinning, global installs, conflicts, and more.
Platform Flag
Use the --platform (or -p) flag to specify the target platform:
npx @agentrules/cli add my-rule --platform opencode
npx @agentrules/cli add my-rule -p opencodeInstalling a Specific Version
Rules use MAJOR.MINOR versioning. By default, the latest version is installed.
# With --version flag
npx @agentrules/cli add my-rule -p opencode --version 1.0
# Or use @ syntax
npx @agentrules/cli add my-rule@1.0 -p opencodeGlobal vs Project Install
By default, rules install to your current project directory.
# Project install (default) - writes to .opencode/
npx @agentrules/cli add my-rule -p opencode
# Global install (-g or --global) - writes to ~/.config/opencode
npx @agentrules/cli add my-rule -p opencode -g| Platform | Project | Global |
|---|---|---|
| OpenCode | .opencode/ | ~/.config/opencode |
| Claude | .claude/ | ~/.claude |
| Cursor | .cursor/ | ~/.cursor |
| Codex | .codex/ | ~/.codex |
Preview Before Installing
See what files would be installed without writing anything:
npx @agentrules/cli add my-rule -p opencode --dry-runHandling Conflicts
When a file already exists:
# Overwrite (backs up existing files to .bak)
npx @agentrules/cli add my-rule -p opencode --force
# Overwrite without backups
npx @agentrules/cli add my-rule -p opencode --force --no-backup
# Skip conflicting files, only add new ones
npx @agentrules/cli add my-rule -p opencode --skip-conflictsWithout these flags, the CLI shows you what conflicts exist and lets you decide.
Custom Directory
Install to a specific directory instead of the default:
npx @agentrules/cli add my-rule -p opencode --dir ./custom/pathUsing Custom Registries
By default, rules come from agentrules.directory. You can add other registries:
# Add a registry
npx @agentrules/cli registry add company https://registry.company.com
# Install from it
npx @agentrules/cli add my-rule -p opencode --registry company
# Set as default
npx @agentrules/cli registry use companyAll Options
| Option | Description |
|---|---|
-p, --platform | Target platform: opencode, claude, cursor, codex |
-V, --version | Install a specific version |
-g, --global | Install to global config directory |
--dir | Install to a custom directory |
-r, --registry | Use a specific registry |
-f, --force | Overwrite existing files (backs up to .bak) |
-y, --yes | Alias for --force |
--no-backup | Don't backup when using --force |
--dry-run | Preview without writing |
--skip-conflicts | Skip files that already exist |