Skip to main content

Supercharge your Gerrit workflow with LLM-powered code reviews and fixes

Project description

clerrit

PyPI version

clerrit is a CLI tool which bridges Gerrit Code Review with Claude Code.

The current features are, for a given change and patchset:

  • Review a Gerrit change using Claude Code, identifying bugs, security issues, edge cases, style problems, and missing error handling:

    $ clerrit review 18263
    

    This command only shows a code review report in Claude Code, helping you write your actual review comments on Gerrit. It doesn't send anything to Gerrit.

  • Address Gerrit code review comments by having Claude Code fix the issues based on reviewer feedback:

    $ clerrit fix 2439
    

    Claude Code fixes the code locally without running git add, git commit, or such. It doesn't send anything to Gerrit.

    Your typical workflow after having reviewed the changes would be something like:

    $ git add -u
    $ git commit --amend --no-edit
    $ git review
    

    You can also use the --no-fetch option to avoid creating a new branch for the fix: just work in your current tree as is.

  • Delete all local clerrit-* branches created by the review and fix commands:

    $ clerrit clean
    

clerrit is meant to assist reviewers and developers, not to replace them.

Try it now!

  • Make clerrit review the latest patchset of change 27362 using the review remote of the current Git repository:

    $ uvx clerrit review 27362 --md
    

    You'll end up in Claude Code performing a code review, providing raw Markdown comments for specific files and line numbers.

  • Make clerrit address the code review of the latest patchset of change 1189 using the review remote of the current Git repository:

    $ uvx clerrit fix 1189
    

    You'll end up in Claude Code fixing the code to address the review comments.

See clerrit --help to learn more.

Examples

  • Review latest patchset of change 15753:

    $ clerrit review 15753
    
  • Review patchset 3 of change 15753:

    $ clerrit review 15753 3
    
  • Review with raw Markdown output for Gerrit comments:

    $ clerrit review 15753 --md
    
  • Review using a custom remote instead of the default review:

    $ clerrit review 15753 --remote=gerrit
    
  • Review with extra context for Claude Code:

    $ clerrit review 15753 --extra-prompt='Focus on memory safety.'
    
  • Fix the latest patchset, addressing the review comments of the last patchset:

    $ clerrit fix 8472
    
  • Fix a specific patchset:

    $ clerrit fix 8472 2
    
  • Fix the latest patchset, addressing the review comments of all the patchsets, and don't create a new branch:

    $ clerrit fix 8472 all --no-fetch
    
  • Fix with extra context for Claude Code:

    $ clerrit fix 8472 --extra-prompt='Do NOT take into account the comments of Jérémie.'
    
  • Fix using a specific Claude Code model:

    $ clerrit fix 8472 --model=sonnet
    
  • Fix in YOLO mode:

    $ clerrit fix 8472 all --permission-mode=acceptEdits
    
  • Clean up all local clerrit-* branches:

    $ clerrit clean
    

What clerrit does

  • review command:

    1. Fetches the patchset from the Gerrit remote.

    2. Creates a temporary local branch with the change.

    3. Launches Claude Code with a prompt to analyze the latest commit for bugs, security issues, edge cases, style problems, and missing error handling.

      If a CONTRIBUTING.adoc, CONTRIBUTING.md, or CONTRIBUTING.rst file exists and there's no CLAUDE.md file, mentions it as context.

  • fix command:

    1. Without the --no-fetch option:

      1. Fetches the patchset from the Gerrit remote.

      2. Creates a temporary local branch with the change.

    2. Queries the Gerrit server via SSH to retrieve all review comments for the patchset(s).

    3. Launches Claude Code with the comments and instructions to fix the reported issues (without staging, committing, or creating new files, unless requested).

  • clean command:

    • Finds all local branches matching clerrit-* and deletes them, skipping the current branch if applicable.

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

clerrit-0.6.0.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

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

clerrit-0.6.0-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file clerrit-0.6.0.tar.gz.

File metadata

  • Download URL: clerrit-0.6.0.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for clerrit-0.6.0.tar.gz
Algorithm Hash digest
SHA256 cb7c82a4e4de7e2ccab6169cfae8245c977613a20a82bc4d629d7fb8f13f0076
MD5 3a455d5cede68064579cc070b5b70b89
BLAKE2b-256 6b5922202f8edae5afc97fd6a0910f7ae86bf3bcd9fd9ac76e4761cdb58f92ea

See more details on using hashes here.

File details

Details for the file clerrit-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: clerrit-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 11.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for clerrit-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ab3f4b3e5e3393c90cdb33c61fe7df6537390aa753b9e74c3a2271e0a07b0102
MD5 7f81f1eefa6b53b3932c162130f3c805
BLAKE2b-256 38679482a29b8f163190d49b28e192f927a45217e6fa31616fbe2aa2e8a7014b

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