Metadata-Version: 2.4
Name: oneport-review
Version: 1.0.0
Summary: AI-powered code review for teams without a senior engineer
Author-email: Oneport <eng@oneport.dev>
License: MIT License
        
        Copyright (c) 2025 Oneport
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://oneport.dev
Project-URL: Documentation, https://docs.oneport.dev
Project-URL: Repository, https://github.com/oneport/oneport-review
Project-URL: Issues, https://github.com/oneport/oneport-review/issues
Project-URL: Changelog, https://github.com/oneport/oneport-review/blob/main/CHANGELOG.md
Keywords: code-review,ai,static-analysis,claude,anthropic
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Quality Assurance
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: anthropic>=0.25.0
Requires-Dist: click>=8.1.0
Requires-Dist: httpx>=0.27.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: pyyaml>=6.0.0
Requires-Dist: rich>=13.0.0
Requires-Dist: gitpython>=3.1.0
Requires-Dist: platformdirs>=4.0.0
Provides-Extra: dev
Requires-Dist: pytest>=8.0.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
Requires-Dist: pytest-httpx>=0.30.0; extra == "dev"
Requires-Dist: ruff>=0.4.0; extra == "dev"
Requires-Dist: mypy>=1.10.0; extra == "dev"
Requires-Dist: types-pyyaml; extra == "dev"
Requires-Dist: types-requests; extra == "dev"
Requires-Dist: pre-commit>=3.0.0; extra == "dev"
Dynamic: license-file

# Oneport Review

> AI-powered code review for teams without a senior engineer.

[![PyPI version](https://badge.fury.io/py/oneport-review.svg)](https://pypi.org/project/oneport-review/)
[![VS Code Marketplace](https://img.shields.io/visual-studio-marketplace/v/oneport.oneport-review)](https://marketplace.visualstudio.com/items?itemName=oneport.oneport-review)
[![CI](https://github.com/oneport/oneport-review/actions/workflows/ci.yml/badge.svg)](https://github.com/oneport/oneport-review/actions)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)

Oneport reviews your pull requests and code files like a senior engineer — catching logic errors, security vulnerabilities, performance issues, and bad patterns — and returns detailed comments in plain English.

---

## Features

- **Full PR review** — not just inline autocomplete. Understands context across the entire diff.
- **Security scanning** — SQL injection, hardcoded secrets, insecure deserialization, SSRF, and more.
- **Performance analysis** — N+1 queries, unbounded loops, missing indexes, memory leaks.
- **Logic errors** — off-by-one, race conditions, missing null checks, incorrect error handling.
- **Bad patterns** — God objects, missing abstractions, copy-paste code, broken SOLID principles.
- **Plain English output** — every comment explains *what* the issue is, *why* it matters, and *how* to fix it.
- **Zero config to start** — works out of the box. Customize with `.oneportrc` when you need to.

---

## Installation

```bash
pip install oneport-review
```

Set your Anthropic API key:

```bash
export ANTHROPIC_API_KEY=sk-ant-...
```

---

## Quick Start

### Review a file

```bash
oneport review path/to/file.py
```

### Review a GitHub pull request

```bash
oneport review https://github.com/org/repo/pull/42
```

### Review staged changes

```bash
oneport review --staged
```

### Review last commit

```bash
oneport review --head
```

---

## VS Code Extension

Install from the marketplace:

```
ext install oneport.oneport-review
```

Or search **"Oneport Review"** in the VS Code Extensions panel.

Once installed:
- Open the Command Palette (`Cmd+Shift+P` / `Ctrl+Shift+P`)
- Run **Oneport: Review Current File** or **Oneport: Review Pull Request**
- Issues appear as red squiggles with hover explanations and quick-fix suggestions

---

## CI Integration (GitHub Actions)

Add to `.github/workflows/ci.yml`:

```yaml
- name: Oneport Code Review
  uses: oneport/oneport-review@v1
  with:
    github-token: ${{ secrets.GITHUB_TOKEN }}
    anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
```

Oneport will post review comments directly on the pull request.

See [docs/ci-integration.md](docs/ci-integration.md) for GitLab CI, Bitbucket Pipelines, and Jenkins.

---

## Configuration

Create a `.oneportrc` file in your project root:

```yaml
model: claude-sonnet-4-20250514
max_tokens: 4096

rules:
  ignore:
    - OPR001  # disable a specific rule
  severity:
    OPR042: warning  # downgrade a rule

ignore_paths:
  - "migrations/**"
  - "**/*.generated.py"
  - "vendor/**"

output:
  format: inline   # inline | json | github | sarif
  min_severity: warning  # info | warning | error | critical
```

See [docs/custom-rules.md](docs/custom-rules.md) for writing your own rules.

---

## Output Formats

| Format | Use case |
|--------|----------|
| `inline` | Terminal — human-readable, coloured output |
| `json` | Scripting, custom tooling |
| `github` | GitHub Checks API / PR comment format |
| `sarif` | VS Code Problems panel, GitHub Code Scanning |

```bash
oneport review file.py --format json | jq '.issues[] | select(.severity == "critical")'
```

---

## Programmatic API

```python
from oneport import review

result = review("path/to/file.py")

for issue in result.issues:
    print(f"[{issue.severity}] Line {issue.line}: {issue.message}")
    print(f"  Fix: {issue.suggestion}")
```

See [docs/api-reference.md](docs/api-reference.md) for the full API.

---

## Privacy

- Your code is sent to Anthropic's API for analysis. Review [Anthropic's privacy policy](https://www.anthropic.com/privacy).
- API keys are stored in your OS keychain (VS Code) or environment variables (CLI). Never written to disk.
- Set `ONEPORT_TELEMETRY=off` to disable all usage analytics.

---

## Contributing

```bash
git clone https://github.com/oneport/oneport-review
cd oneport-review
pip install -e ".[dev]"
make test
```

See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.

---

## License

MIT © Oneport
