Skip to main content

Assistant for reviewing your code

Project description

CodeSpector

CodeSpector is a Python package designed to review code changes for quality and security issues using AI chat agents. It supports different chat agents like Codestral and ChatGPT.

Features

  • Automated code review using AI chat agents.
  • Supports multiple chat agents and models.
  • Generates detailed review reports in markdown format.
  • Configurable via environment variables and command-line options.

Installation

To install the package, use the following command:

pip install codespector
uv add codespector

Usage

Command-Line Interface

You can use the codespector command to start a code review. Below are the available options:

Usage: codespector [OPTIONS]

Options:
  --system-content TEXT       Content which used in system field for agent
                              [default: Ты код ревьювер. Отвечай на русском языке.]
  --output-dir TEXT           Select the output directory [default: codespector]
  -b, --compare-branch TEXT   Select the branch to compare the current one with
                              [default: develop]
  --chat-agent [codestral|chatgpt]
                              Choose the chat agent to use [default: codestral]
  --chat-model TEXT           Choose the chat model to use
  --chat-token TEXT           Chat agent token
  --mode [local]              Choose the mode of the application [default: local]
  --version                   Show the version and exit.
  --help                      Show this message and exit.

Example

To run a code review, use the following command:

codespector --chat-token YOUR_CHAT_TOKEN --chat-agent codestral --compare-branch develop

Configuration

You can also configure CodeSpector using environment variables. Create a .env file in the root directory of your project with the following content:

CODESPECTOR_SYSTEM_CONTENT=Ты код ревьювер. Отвечай на русском языке.
CODESPECTOR_OUTPUT_DIR=codespector
CODESPECTOR_CHAT_AGENT=codestral
CODESPECTOR_CHAT_MODEL=codestral-latest
CODESPECTOR_CHAT_TOKEN=YOUR_CHAT_TOKEN

Makefile Commands

  • lint: Run linting and formatting checks.
  • format: Format the code.
  • fix: Fix linting issues and format the code.
  • test: Run the tests.

License

This project is licensed under the MIT License. See the LICENSE file for more details.

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

codespector-0.2.0.tar.gz (23.2 kB view details)

Uploaded Source

Built Distribution

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

codespector-0.2.0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file codespector-0.2.0.tar.gz.

File metadata

  • Download URL: codespector-0.2.0.tar.gz
  • Upload date:
  • Size: 23.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for codespector-0.2.0.tar.gz
Algorithm Hash digest
SHA256 504a8f239c31ff566b538537482db42c3d40644873272786220907707f7b4f79
MD5 302c20b4b1806f8fba0e878e6253a2bb
BLAKE2b-256 8d01176277900f0dfdb059f712014f313f35c1c8545a16cff0dd3deb569d0e76

See more details on using hashes here.

Provenance

The following attestation bundles were made for codespector-0.2.0.tar.gz:

Publisher: build-publish.yml on Vladimir-Titov/codespector

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file codespector-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: codespector-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for codespector-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9f701a4e1f4223d332b10f8cd4955fca04af31db0ce240639ac03a780b0943a3
MD5 bb14900450108917deeccaf5b50a5f35
BLAKE2b-256 21e582327b91c466805e18ced6aca83ce60608db49ad5ceb9f61e0cd7d7a8380

See more details on using hashes here.

Provenance

The following attestation bundles were made for codespector-0.2.0-py3-none-any.whl:

Publisher: build-publish.yml on Vladimir-Titov/codespector

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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