Metadata-Version: 2.4
Name: reviewmind
Version: 0.1.0
Summary: Local code scanner and CLI for ReviewMind - enforce code review rules before commits
Author-email: ReviewMind <hello@reviewmind.ai>
License: MIT
Project-URL: Homepage, https://reviewmind.ai
Project-URL: Repository, https://github.com/reviewmind/reviewmind-cli
Project-URL: Documentation, https://docs.reviewmind.ai
Project-URL: Bug Tracker, https://github.com/reviewmind/reviewmind-cli/issues
Keywords: code-review,static-analysis,pre-commit,linting,ast
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Quality Assurance
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: typer>=0.12.0
Requires-Dist: httpx>=0.27.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: rich>=13.0.0
Requires-Dist: PyYAML>=6.0
Requires-Dist: pathspec>=0.12.0
Provides-Extra: dev
Requires-Dist: pytest>=8.0.0; extra == "dev"
Requires-Dist: pytest-cov>=5.0.0; extra == "dev"
Requires-Dist: black>=24.0.0; extra == "dev"
Requires-Dist: ruff>=0.4.0; extra == "dev"

# 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

```bash
pip install reviewmind
```

Or with [pipx](https://pipx.pypa.io/):

```bash
pipx install reviewmind
```

---

## Quick Start

### 1. Authenticate with your ReviewMind account

```bash
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

```bash
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

```bash
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](https://reviewmind.ai) (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

```python
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:

```yaml
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

```bash
git clone https://github.com/jayantsingh924/reviewmind-cli
cd reviewmind-cli
pip install -e ".[dev]"
pytest
```

---

## 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)
