Skip to main content

AI-powered code review for teams without a senior engineer

Project description

Oneport Review

The AI code reviewer that lives in your pull requests — reviews every PR line-by-line, proposes one-click fixes, briefs your reviewers, answers questions in-thread, and learns your team's standards.

PyPI version CI License: MIT

What happens on every PR

Once the two workflow files are in your repo, every pull request gets:

  1. An inline review — findings appear as per-line comments in the Files Changed tab, exactly where a human reviewer would put them. Security holes, logic bugs, performance traps, bad patterns — each explained in plain English with why it matters.
  2. One-click fixes — when Oneport is confident in the exact repair, the comment carries a committable suggestion. Reviewer clicks Commit suggestion, done.
  3. A briefing comment — a high-level summary of what the PR does, a per-file walkthrough table, and a Mermaid diagram of how the changed pieces interact. Updated in place on every push (never spams the timeline). Your human reviewers start oriented instead of cold.
  4. A conversation partner — reply @oneport why is this a problem? under any finding and it answers in-thread, with the diff and full thread as context. Push back; if you're right, it concedes. If you're not, it shows you the failing case.
  5. A memory — reply @oneport remember: never use naive datetimes and it commits the rule to .oneport/guidelines.md on the PR branch. Every future review enforces it. The reviewer gets more yours over time.
  6. A merge gate — error/critical findings fail the check (severity thresholds configurable), so the red X does the arguing for you.

And it scales like a real reviewer:

  • Incremental — pushed three more commits? Only those get re-reviewed (a hidden marker in the last review is the state; the PR is the database). --full forces a fresh look.
  • No PR too big — oversized diffs split on file boundaries into multiple deep review passes, merged into one review. No token-limit faceplants, no shallow skims.
  • Linter-fused — if ruff/bandit are installed, their findings feed the model as hints to confirm or reject: linter exhaustiveness plus LLM judgment.
  • Whole-file vision — the model sees the full, line-numbered content of changed files, not just diff hunks, so findings account for surrounding code.
  • ignore_paths that worksmigrations/**, vendor/**, **/*.generated.py never reach the model (or your token bill).

Your code goes to exactly one place — the Anthropic API, on your own key. No middleman server, no training on your code, telemetry off by default. The full story fits on one page: PRIVACY.md.


Setup in 2 minutes (GitHub)

pip install oneport-review
  1. Add your ANTHROPIC_API_KEY as a repository secret (Settings → Secrets and variables → Actions).
  2. Copy the two workflows from examples/workflows into .github/workflows/:

Open a PR. That's it.

CLI — review before anyone sees it

# Either key works — Gemini has a free tier (aistudio.google.com/apikey):
export ANTHROPIC_API_KEY=sk-ant-...    # Claude
export GEMINI_API_KEY=AIza...          # or Gemini (auto-selects gemini-2.5-flash)

oneport review --staged                                  # what you're about to commit
oneport review --head                                    # your last commit
oneport review src/auth.py                               # any file
oneport review https://github.com/org/repo/pull/42       # any PR, in your terminal
oneport review https://github.com/org/repo/pull/42 --post  # ...and post it as an inline review
oneport summarize https://github.com/org/repo/pull/42 --post  # post the briefing comment

Exit code 1 on error/critical findings, so every command drops straight into scripts and CI.

Block bad commits before they exist

oneport install-hooks

Installs a git pre-commit hook that reviews staged changes and blocks the commit on blocking findings (ONEPORT_SKIP=1 git commit ... to bypass once). Using the pre-commit framework? A hook definition ships in .pre-commit-hooks.yaml.


Teach it your team's standards

Three ways, same result — rules land in .oneport/guidelines.md, version-controlled in your repo, enforced on every review like the built-in catalog:

# from the terminal
oneport learn "never use print() in library code, use logging"
# from a PR thread
@oneport remember: all public functions need docstrings with examples
<!-- or just edit .oneport/guidelines.md — it's plain markdown -->
- API handlers must validate ownership before any DB write

Built-in rules are configurable too — .oneportrc:

model: claude-sonnet-4-20250514

rules:
  ignore: [OPR042]          # disable a rule
  severity:
    OPR020: critical        # N+1 queries block merges in this repo

output:
  format: inline            # inline | json | github | sarif
  min_severity: warning

oneport rules list shows the whole catalog: security (SQLi, hardcoded secrets, SSRF, path traversal, command injection...), performance (N+1, sync-in-async, unbounded queries...), logic (races, off-by-one, swallowed exceptions...), and architecture patterns.


Output formats

Format Use case
inline Terminal — coloured, human-readable, shows suggested fixes
json Scripting — includes a blocking field for CI decisions
github GitHub Checks API annotation payloads
sarif VS Code Problems panel, GitHub Code Scanning
oneport review file.py --format json | jq '.issues[] | select(.severity == "critical")'

Programmatic API

from oneport import review

result = review("path/to/file.py")
for issue in result.issues:
    print(f"[{issue.severity}] Line {issue.line}: {issue.message}")
    if issue.fix:
        print(f"  Committable fix:\n{issue.fix}")

VS Code

Search "Oneport Review" in the Extensions panel — findings appear as squiggles with hover explanations. SARIF output also plugs into any SARIF-aware editor tooling.


GitLab & Bitbucket

oneport review accepts GitLab MR and Bitbucket PR URLs today (terminal output). Inline comment posting for both is on the roadmap; GitHub is the deepest integration.

Privacy

Short version: your code goes to the Anthropic API on your key and nowhere else; the only local artifact is a cache you can wipe with oneport cache clear; telemetry is off unless you explicitly turn it on. Long version, written for your security team: PRIVACY.md.

Contributing

git clone https://github.com/Bitxn/oneport-review
cd oneport-review
pip install -e ".[dev]"
pytest

License

MIT © Oneport

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

oneport_review-1.2.0.tar.gz (65.7 kB view details)

Uploaded Source

Built Distribution

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

oneport_review-1.2.0-py3-none-any.whl (72.9 kB view details)

Uploaded Python 3

File details

Details for the file oneport_review-1.2.0.tar.gz.

File metadata

  • Download URL: oneport_review-1.2.0.tar.gz
  • Upload date:
  • Size: 65.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.0

File hashes

Hashes for oneport_review-1.2.0.tar.gz
Algorithm Hash digest
SHA256 6ecfad5f6640e75207f74f6c774769d2ecf6598570ea4ad81b728b76f067db65
MD5 9670fdff959ad13734ad123b47fcadfe
BLAKE2b-256 95d8b6f524a0e0e9760ab3b50e7c74cd07ea401346d8ba68557389b86dc2257f

See more details on using hashes here.

File details

Details for the file oneport_review-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: oneport_review-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 72.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.0

File hashes

Hashes for oneport_review-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 89d9d06fd3051576d4ec2a1429cc8d9100302903b205c166f489539c84145c75
MD5 00d75a671fa3357a605bd1ff655d12df
BLAKE2b-256 e4ad045a35da822483a1fbad923697ff028eeef16702e2c32c173f7062bed0e2

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