>_AGENT_RULES

CLI Reference

Complete command reference for @agentrules/cli.

Installation

# Run with npx
npx @agentrules/cli <command>

# Or install globally
npm install -g @agentrules/cli
agentrules <command>

Installing Presets

add

Install a preset from the registry.

agentrules add <preset> [options]

Arguments:

ArgumentDescription
presetPreset name, optionally with platform suffix and version (e.g., my-preset, my-preset.opencode, my-preset@1.0)

Options:

OptionDescription
-p, --platform <platform>Target platform: opencode, claude, cursor, codex
-V, --version <version>Install a specific version (default: latest)
-g, --globalInstall to global config directory
--dir <path>Install to a custom directory
-r, --registry <alias>Use a specific registry
-f, --forceOverwrite existing files (backs up originals to .bak)
--no-backupDon't backup files when using --force
--dry-runPreview changes without writing
--skip-conflictsSkip files that already exist

Examples:

# Basic install
agentrules add agentic-dev-starter --platform opencode

# Install globally
agentrules add agentic-dev-starter -p opencode --global

# Install specific version
agentrules add agentic-dev-starter -p opencode --version 1.0

# Using @ syntax for version
agentrules add agentic-dev-starter.opencode@1.0

# Preview without writing
agentrules add agentic-dev-starter -p opencode --dry-run

# Force overwrite (backs up existing files to .bak)
agentrules add agentic-dev-starter -p opencode --force

# Force overwrite without backups
agentrules add agentic-dev-starter -p opencode --force --no-backup

Creating Presets

init

Initialize a preset config in a platform directory.

agentrules init [directory] [options]

Arguments:

ArgumentDescription
directoryPlatform directory to initialize (default: current directory)

Options:

OptionDescription
-n, --name <name>Preset name (default: my-preset)
-t, --title <title>Display title
--description <text>Preset description
-p, --platform <platform>Target platform
-l, --license <license>License (e.g., MIT)
-f, --forceOverwrite existing config
-y, --yesAccept defaults, skip prompts

Examples:

# Initialize inside a platform directory (interactive)
cd .opencode
agentrules init

# Initialize a specific platform directory
agentrules init .claude

# Non-interactive with options
agentrules init .opencode --name my-preset --license MIT --yes

# From project root, auto-detect platform directory
agentrules init --yes

Result:

.opencode/
├── agentrules.json       # Preset config (created by init)
├── AGENTS.md             # Your config files (included in bundle)
├── commands/
│   └── review.md
└── .agentrules/          # Optional metadata folder
    ├── README.md         # Shown on registry page
    ├── LICENSE.md        # Full license text
    └── INSTALL.txt       # Shown after install

validate

Validate a preset configuration.

agentrules validate [path]

Arguments:

ArgumentDescription
pathPath to agentrules.json or directory containing it (default: current directory)

Examples:

# Validate current directory
agentrules validate

# Validate specific path
agentrules validate .opencode

Publishing Presets

login

Authenticate with the registry. Opens a browser for OAuth.

agentrules login

logout

Log out and clear stored credentials.

agentrules logout

whoami

Show the currently authenticated user.

agentrules whoami

publish

Publish a preset to the registry. Requires authentication.

agentrules publish [path] [options]

Arguments:

ArgumentDescription
pathPath to agentrules.json or directory containing it (default: current directory)

Options:

OptionDescription
-v, --version <major>Major version to publish (default: 1)
--dry-runPreview without publishing

Examples:

# Publish from inside platform directory
cd .opencode
agentrules publish

# Publish a specific preset
agentrules publish .opencode

# Publish to major version 2
agentrules publish .opencode --version 2

# Preview what would be published
agentrules publish .opencode --dry-run

unpublish

Remove a specific version of a preset from the registry. Requires authentication.

agentrules unpublish <preset> [options]

Arguments:

ArgumentDescription
presetPreset identifier (e.g., my-preset, my-preset.opencode, my-preset.opencode@1.0)

Options:

OptionDescription
-p, --platform <platform>Target platform (if not in preset string)
-V, --version <version>Version to unpublish (if not in preset string)

Examples:

# Full format: slug.platform@version
agentrules unpublish my-preset.opencode@1.0

# With flags
agentrules unpublish my-preset --platform opencode --version 1.0

# Mixed: version in string, platform as flag
agentrules unpublish my-preset@1.0 --platform opencode

Unpublished versions cannot be republished with the same version number.


Registry Management

registry list

List configured registries.

agentrules registry list

registry add

Add a custom registry.

agentrules registry add <alias> <url> [options]

Arguments:

ArgumentDescription
aliasShort name for the registry
urlRegistry URL

Options:

OptionDescription
--defaultSet as the default registry

Examples:

# Add a registry
agentrules registry add company https://registry.company.com

# Add and set as default
agentrules registry add company https://registry.company.com --default

registry remove

Remove a registry.

agentrules registry remove <alias>

registry use

Set the default registry.

agentrules registry use <alias>

registry build

Build registry artifacts from preset directories. For self-hosted registries.

agentrules registry build [options]

Options:

OptionDescription
-i, --input <path>Directory containing preset folders
-o, --out <path>Output directory for registry artifacts
-b, --bundle-base <url>URL prefix for bundle locations
-c, --compactEmit minified JSON
--validate-onlyValidate without writing files

Configuration

CLI configuration is stored at ~/.agentrules/config.json.

You can override the config directory with the AGENT_RULES_HOME environment variable.

Default config:

~/.agentrules/config.json
{
  "defaultRegistry": "main",
  "registries": {
    "main": {
      "url": "https://agentrules.directory/"
    }
  }
}

Supported Platforms

PlatformIDProject DirectoryGlobal Directory
OpenCodeopencode.opencode/~/.config/opencode
Claude Codeclaude.claude/~/.claude
Cursorcursor.cursor/~/.cursor
Codexcodex.codex/~/.codex

FAQ

On this page