Review Policy CLI - AI-powered code review with policy-as-code
npm install @nihal1983/cliAI-powered code review with policy-as-code. Define review policies in CODE-POLICY.md and get intelligent, context-aware code reviews.
``bash`
npm install -g @nihal1983/cli
`bash1. Configure API keys (one-time)
review-policy config setup
Template System (New!)
Generate professional policies from industry-standard templates:
`bash
List available templates
review-policy list-templatesShow template details
review-policy show-template owasp-top-10-2025Interactive wizard
review-policy compose --interactiveDirect composition
review-policy compose \
--templates basic,owasp-top-10-2025,google-typescript-style \
--persona security-auditor \
--output CODE-POLICY.md
`$3
Security:
- OWASP Top 10 2025
- HIPAA Security Compliance
- PCI DSS 4.0
- SOC 2 Security Controls
Code Style:
- Google Python Style Guide
- Google TypeScript Style Guide
Application Types:
- Frontend Development
- Backend/API
- Microservices
- Infrastructure as Code (Terraform AWS)
Personas:
- Product-Minded Engineer (balanced)
- Security Auditor (strict)
- Performance Expert (optimization-focused)
- Mentoring Coach (educational)
Features
✅ Policy-as-Code - Define review rules in YAML format
✅ Template System - Generate policies from 13 authoritative templates
✅ AI-Powered Reviews - Context-aware code analysis
✅ Multi-Persona - Choose AI reviewer personality
✅ Compliance Ready - OWASP, HIPAA, PCI DSS, SOC 2 templates
✅ CLI & Dashboard - Use from terminal or web UI
Commands
$3
`bash
Interactive setup (recommended)
review-policy config setupManual configuration
review-policy config set # Set API key
review-policy config get # View key (masked)
review-policy config list # List all keys
review-policy config delete # Remove key
review-policy config path # Show config file location
`Supported keys:
-
ANTHROPIC_API_KEY - Anthropic Claude API key
- OPENAI_API_KEY - OpenAI GPT API key
- GITHUB_TOKEN - GitHub Personal Access TokenConfig file location:
~/.review-policy/config.json$3
`bash
Initialize new policy
review-policy init [--force]Validate policy syntax
review-policy validate [--policy CODE-POLICY.md]Compose from templates
review-policy compose [options]
-t, --templates Comma-separated template IDs
-p, --persona Reviewer persona
-o, --output Output file (default: CODE-POLICY.md)
-i, --interactive Launch interactive wizard
--validate Validate generated policy (default: true)List templates
review-policy list-templatesShow template details
review-policy show-template
`$3
`bash
Scan repository context
review-policy scanReview pull request
review-policy review-pr Index repository for knowledge graph
review-policy index-repoInitialize knowledge graph
review-policy init-knowledge-graph
`$3
`bash
Create workspace
review-policy workspace create List workspaces
review-policy workspace listAnalyze baseline
review-policy analyze-baseline [options]
`Example Workflows
$3
`bash
review-policy compose \
--templates frontend,soc2-security-controls,google-typescript-style \
--persona base-business-context \
--output CODE-POLICY.md
`$3
`bash
review-policy compose \
--templates backend-api,hipaa-security-compliance,owasp-top-10-2025,google-python-style \
--persona security-auditor \
--output CODE-POLICY.md
`$3
`bash
review-policy compose \
--templates basic,google-typescript-style \
--persona junior-mentor \
--output CODE-POLICY.md
`CODE-POLICY.md Format
`yaml
---
meta:
version: "2.0"
enforcement_level: "BLOCK"
Inherit from a persona
extends:
- base-business-context
Compose multiple templates
compose:
- owasp-top-10-2025
- google-typescript-styleAgent configuration
agent:
persona: "Product-Minded Engineer"
focus_areas:
- "Web Application Security"
- "TypeScript Code Style"
---Your policy rules here
`Environment Variables
`bash
API Configuration
ANTHROPIC_API_KEY=sk-ant-...
OPENAI_API_KEY=sk-...Database
DATABASE_URL=postgresql://...GitHub Integration
GITHUB_TOKEN=ghp_...
`Development
`bash
Build
npm run buildTest
npm testLocal development
npm link
review-policy --help
``MIT
- Documentation: https://github.com/nihal1983/review-policy
- Issues: https://github.com/nihal1983/review-policy/issues
- Community: https://github.com/nihal1983/review-policy/discussions