Skip to main content

Local code scanner and CLI for ReviewMind - enforce code review rules before commits

Project description

ReviewMind CLI

Enforce your team's code review rules before they reach GitHub.

ReviewMind turns recurring PR review comments into automated, enforceable rules. This CLI runs those rules locally on your staged files before every commit — catching violations before they ever open a pull request.


How It Works

Your team writes a PR comment: "Don't use eval() — use safe_parse instead"
         ↓
ReviewMind extracts an enforceable rule (on the SaaS dashboard)
         ↓
Rule is approved by your team lead
         ↓
reviewmind CLI enforces it on every future commit — locally, instantly

Installation

pip install reviewmind

Or with pipx:

pipx install reviewmind

Quick Start

1. Authenticate with your ReviewMind account

reviewmind config --token YOUR_CLI_TOKEN

Get your CLI token from Profile → CLI Token on the ReviewMind dashboard.

2. Set up pre-commit hook for your repo

cd your-project
reviewmind setup

This installs a pre-commit hook that automatically runs reviewmind check before every git commit.

3. Run a manual scan

reviewmind check

Example Output

ReviewMind scanning 3 staged files...

  src/auth.py
  ❌ [RM001] Dangerous Eval Usage — Line 12, Col 4
     Using eval() is dangerous. Use safe_parse_json() instead.

  src/utils.py
  ⚠️  [RM004] Direct Print Statement — Line 8
     Use the logger instead of print().

─────────────────────────────────────────────
2 violations found. Commit blocked.
Run `reviewmind check --fix` to apply AI suggestions.

Engine — Open Source Core

This repository contains the core scanning engine used by both:

  • This CLI (local pre-commit scanning)
  • ReviewMind SaaS (GitHub PR scanning)

Engine Capabilities

Feature Status
Regex pattern matching
Python AST scanning
JavaScript / TypeScript AST
SARIF export
Ignore config (.reviewmind.yml)
Column-precise highlights
Fingerprint deduplication

Using the engine directly

from reviewmind_engine import AnalysisEngine
from reviewmind_engine.engine_rule import EngineRule

rules = [
    EngineRule(
        rule_code="RM001",
        title="No eval()",
        check_type="regex",
        check_pattern=r"eval\(",
        check_language="python",
        severity="error",
        what_is_wrong="eval() is dangerous",
        what_is_correct="Use safe_parse_json()",
    )
]

engine = AnalysisEngine(rules=rules)

findings = engine.run_scan([
    {
        "filename": "src/main.py",
        "content": open("src/main.py").read(),
        "added_lines": {10, 11, 12},  # lines changed in this commit
    }
])

for f in findings:
    print(f"{f.rule_code} | {f.file_path}:{f.line} | {f.message}")

Configuration

Create .reviewmind.yml in your repo root to ignore paths:

ignore:
  - "tests/**"
  - "migrations/**"
  - "generated/**"
  - "*.min.js"

Environment Variables

Variable Default Description
REVIEWMIND_API_URL https://api.reviewmind.ai Backend API URL
REVIEWMIND_TOKEN CLI auth token (or use reviewmind config)

Contributing

Contributions are welcome! This is the open source engine — feel free to:

  • Add new language evaluators
  • Improve AST detection patterns
  • Fix bugs and improve test coverage
git clone https://github.com/jayantsingh924/reviewmind-cli
cd reviewmind-cli
pip install -e ".[dev]"
pytest

License

MIT — see LICENSE


Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

reviewmind-0.1.0.tar.gz (16.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

reviewmind-0.1.0-py3-none-any.whl (18.6 kB view details)

Uploaded Python 3

File details

Details for the file reviewmind-0.1.0.tar.gz.

File metadata

  • Download URL: reviewmind-0.1.0.tar.gz
  • Upload date:
  • Size: 16.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for reviewmind-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bcc6fa598594a4c62669dc1a5bc7d20c80553e8042d4b4e3d0569d4ed251cb80
MD5 f5ec0677c705b102ba3cd6cae4ec05ce
BLAKE2b-256 a70579fb60ba959737bef257b07a326b6308a75c9362acaa26477cd3db4f90b0

See more details on using hashes here.

File details

Details for the file reviewmind-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: reviewmind-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 18.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for reviewmind-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d102d85d3190464b4c035a5b501fa841ecd2e19e37396b499d9f12bc50bc9a06
MD5 ac720cea2bf2e40844d5ef99154a0947
BLAKE2b-256 af6a70c746ec2f0e5108a52ff0120ef2ee94e49e163a3e5c9ee4580200ecc32e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page