jayantsingh924/reviewmind-cli

GitHub: jayantsingh924/reviewmind-cli

Stars: 4 | Forks: 1

# ReviewMind CLI 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](https://pipx.pypa.io/): pipx install reviewmind ## Quick Start ### Local, no-account start pip install reviewmind reviewmind init reviewmind check `reviewmind init` scans the current codebase and creates a local `rules.yml` with starter rules. If you have not authenticated yet, `reviewmind check` automatically uses that local file. ### GitHub Actions Add this workflow to `.github/workflows/reviewmind.yml`: name: ReviewMind on: pull_request: jobs: reviewmind: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - uses: reviewmind/reviewmind-action@v1 with: init: "true" all-files: "true" For team rules, pass a CLI token: - uses: reviewmind/reviewmind-action@v1 with: token: ${{ secrets.REVIEWMIND_TOKEN }} ### SaaS/team start #### 1. Authenticate with GitHub reviewmind login This opens `https://github.com/login/device` in your browser and shows a short code in the terminal. Enter the code on GitHub, approve the app, and the CLI authenticates automatically — no tokens to copy or paste. After approval you'll be prompted to pick which repository ReviewMind should enforce rules on. #### 2. Set up the pre-commit hook cd your-project reviewmind setup Installs a pre-commit hook that automatically runs `reviewmind check` before every `git commit`. #### 3. Run a manual scan reviewmind check #### 4. Verify your setup reviewmind doctor Checks authentication, backend connectivity, and config directory permissions. ## 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](https://reviewmind.ai) (GitHub PR scanning) ### Engine Capabilities | Feature | Status | |---|---| | Regex pattern matching | ✅ | | Python AST scanning | ✅ | | JavaScript / TypeScript AST | ✅ | | Agentic LLM Semantic Scan | ✅ (via Gemini) | | SARIF export | ✅ | | Ignore config (`.reviewmind.yml`) | ✅ | | Column-precise highlights | ✅ | | Fingerprint deduplication | ✅ | ### Using the engine directly from reviewmind import AnalysisEngine, 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` | `http://localhost:8080/api` | Backend API URL | | `REVIEWMIND_GITHUB_CLIENT_ID` | *(bundled)* | Override the GitHub OAuth App client ID | | `REVIEWMIND_SKIP` | `false` | Set to `true` or `1` to bypass ReviewMind pre-commit execution | | `REVIEWMIND_HOOK_PROFILE` | *(none)* | Only run rules belonging to a profile (`security`, `error`, `warning`, `style` or custom keyword) | | `REVIEWMIND_DISABLED_HOOKS` | *(none)* | Comma-separated list of rule codes/IDs (e.g. `RM001,RM002`) to disable/skip | | `GEMINI_API_KEY` | *(none)* | Local Gemini API key used by the `agentic` evaluator engine | Authentication is handled via GitHub OAuth Device Flow during `reviewmind login`. The GitHub token is stored in `~/.reviewmind/config.json` and sent as the `x-cli-token` header in all API requests. ## License MIT — see [LICENSE](LICENSE) ## Links - 🌐 [ReviewMind SaaS Platform](https://reviewmind.ai) — Full dashboard, GitHub App, team management - 📖 [Documentation](https://docs.reviewmind.ai) - 🐛 [Issue Tracker](https://github.com/jayantsingh924/reviewmind-cli/issues)