CLI Overview

The Rulebound CLI provides commands for every stage of rule enforcement: initialization, discovery, validation, generation, and CI/CD integration.

Installation

npm install -g rulebound

Usage

rulebound <command> [options]

Commands

CommandDescription
initInitialize .rulebound/ with rules directory, config, and pre-commit hook
find-rulesFind and filter rules by task, category, tags, or stack
validateValidate a plan or file against matched rules
generateGenerate agent config files (CLAUDE.md, .cursor/rules.md, copilot-instructions.md)
diffValidate git diff against rules before merge
scoreCalculate rule quality score and generate a badge
hookInstall or remove the pre-commit git hook
enforceView or update enforcement mode (advisory, moderate, strict)
ciValidate PR changes in CI/CD pipelines with GitHub Actions annotations
check-codeAnalyze source files with AST-based anti-pattern detection (tree-sitter)
watchWatch files for changes and run real-time rule + AST validation
rules listList all rules with metadata
rules show <id>Show full detail of a single rule
rules lintScore rules on quality (atomicity, completeness, clarity)
rules history <id>Show git-based version history of a rule
reviewMulti-agent review with consensus

Global Options

FlagDescription
--versionPrint version number
--helpShow help for any command

Common Options

Most commands accept these options:

FlagDescription
-d, --dir <path>Path to rules directory (overrides config)
-f, --format <type>Output format (pretty, json, github, inject)
--llmUse LLM for deep validation (requires AI SDK)

Workflow Example

# 1. Initialize
rulebound init --examples

# 2. Edit config
vim .rulebound/config.json

# 3. Add rules
vim .rulebound/rules/security/no-secrets.md

# 4. Check rule quality
rulebound score

# 5. Validate a plan
rulebound validate --plan "Add payment processing endpoint"

# 6. Generate agent configs
rulebound generate --agent claude-code

# 7. Check diff before commit
rulebound diff

# 8. Run in CI
rulebound ci --base main --format github