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:
--chat-token TEXT Chat agent token [env var: CODESPECTOR_CHAT_TOKEN]
--chat-model TEXT Choose the chat model to use [env var: CODESPECTOR_CHAT_MODEL]
--chat-agent TEXT Choose the chat agent to use (codestral, chatgpt, deepseek)
or set your own [env var: CODESPECTOR_CHAT_AGENT]
-b, --compare-branch TEXT Select the branch to compare the current one with
--output-dir TEXT Select the output directory [default: codespector]
[env var: CODESPECTOR_OUTPUT_DIR]
--system-content TEXT Content which used in system field for agent
[env var: CODESPECTOR_SYSTEM_CONTENT]
--prompt-content TEXT Prompt content which included to review prompt
[env var: CODESPECTOR_PROMPT_CONTENT]
--result-file TEXT Set file for saving the result
[env var: CODESPECTOR_RESULT_FILE]
--exclude-file-ext LIST Exclude file extensions from the review
[env var: CODESPECTOR_EXCLUDE_FILE_EXT]
--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 --result-file result.md --system-content "system content" --prompt-content "prompt content"
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_CHAT_TOKEN=your_token
CODESPECTOR_OUTPUT_DIR=codespector
CODESPECTOR_SYSTEM_CONTENT="Ты код ревьювер. Отвечай на русском"
CODESPECTOR_PROMPT_CONTENT="Оцени код на безопасноть, соблюдение лучших техник"
CODESPECTOR_RESULT_FILE="result.md"
CODESPECTOR_CHAT_AGENT=codestral
CODESPECTOR_CHAT_MODEL=your_model
CODESPECTOR_EXCLUDE_FILE_EXT=.pyc,.pyo
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file codespector-1.0.0.tar.gz.
File metadata
- Download URL: codespector-1.0.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ec474fe22c5e420e4d701563174f25d0767ce716ee0fc2ff23979daf86bd7a85
|
|
| MD5 |
df22ca9e8d3f8420d6a5c87f525c4c04
|
|
| BLAKE2b-256 |
8780dea167b532dd4443bd21193834f42c175be69741e0f3a95d960750bec521
|
Provenance
The following attestation bundles were made for codespector-1.0.0.tar.gz:
Publisher:
build-publish.yml on Vladimir-Titov/codespector
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
codespector-1.0.0.tar.gz -
Subject digest:
ec474fe22c5e420e4d701563174f25d0767ce716ee0fc2ff23979daf86bd7a85 - Sigstore transparency entry: 203720693
- Sigstore integration time:
-
Permalink:
Vladimir-Titov/codespector@8f1c435bb55edf574b0d6c2d0758fa364a27016b -
Branch / Tag:
refs/tags/1.0.0 - Owner: https://github.com/Vladimir-Titov
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build-publish.yml@8f1c435bb55edf574b0d6c2d0758fa364a27016b -
Trigger Event:
release
-
Statement type:
File details
Details for the file codespector-1.0.0-py3-none-any.whl.
File metadata
- Download URL: codespector-1.0.0-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d916c3fc07f12a3d2d4f2c99d972a9156317c302c0888f7a13546391fc729d5e
|
|
| MD5 |
fcf2b89829f58d2482593487ba4e76d6
|
|
| BLAKE2b-256 |
09972c4c9f8e618845bcc877bae30a41b3681ded7fe3b1f8b2a5d3fbb44cb434
|
Provenance
The following attestation bundles were made for codespector-1.0.0-py3-none-any.whl:
Publisher:
build-publish.yml on Vladimir-Titov/codespector
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
codespector-1.0.0-py3-none-any.whl -
Subject digest:
d916c3fc07f12a3d2d4f2c99d972a9156317c302c0888f7a13546391fc729d5e - Sigstore transparency entry: 203720695
- Sigstore integration time:
-
Permalink:
Vladimir-Titov/codespector@8f1c435bb55edf574b0d6c2d0758fa364a27016b -
Branch / Tag:
refs/tags/1.0.0 - Owner: https://github.com/Vladimir-Titov
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build-publish.yml@8f1c435bb55edf574b0d6c2d0758fa364a27016b -
Trigger Event:
release
-
Statement type: