SCX Code Agent
多智能体代码审查系统,基于 LangGraph 构建。
安装
poetry install
配置
方式一:配置文件(推荐)
在项目根目录创建 .scx-code-agent.yaml:
provider:
name: deepseek
model: deepseek-v4-flash
api_key: ${LLM_API_KEY}
base_url: https://api.deepseek.com
review:
max_workers: 5
skip_dirs:
- node_modules
- .venv
custom_rules:
general:
- "本项目禁止使用 unittest,必须用 pytest"
security:
- "禁止在日志中打印用户手机号"
示例配置文件:
cp .scx-code-agent.yaml.example .scx-code-agent.yaml
方式二:环境变量
复制 .env.example 为 .env 并配置:
cp .env.example .env
配置优先级
命令行参数 > 配置文件 > 环境变量 > 默认值
使用
全量审查
# 扫描当前目录
poetry run scx-code-agent --all
# 扫描指定路径
poetry run scx-code-agent --path src/
增量审查(PR)
poetry run scx-code-agent --diff origin/main
输出选项
# 输出到文件
poetry run scx-code-agent --path src/ --output dist/report.md
# JSON 格式输出
poetry run scx-code-agent --path src/ --format json --output dist/report.json
PR 评论(CI/CD)
在 GitHub Actions 等环境中,可将审查结果发表为 PR 评论:
# 设置 GitHub Token
export GITHUB_TOKEN=ghp_xxx
# 发表 PR 评论
poetry run scx-code-agent --diff origin/main --pr-comment
环境变量:
GITHUB_TOKEN: GitHub Personal Access Token(需要repo:status权限)GITHUB_REPOSITORY: 仓库路径(可选,通常自动检测)
自定义审查规则
在配置文件的 review.custom_rules 中定义项目特定的审查规则,规则会被注入到对应专家的 prompt 中:
review:
custom_rules:
general: # 所有专家通用
- "所有函数必须有类型注解"
security: # 仅安全专家
- "禁止在日志中打印用户手机号"
architecture: # 仅架构专家
- "Service 层禁止直接 import Controller"
performance: # 仅性能专家
- "数据库查询结果集超过 100 条必须分页"
general 中的规则对所有专家生效,其余仅对对应专家生效。规则支持 ${VAR} 环境变量替换。
架构
- Coordinator: 文件收集与分发
- Security Expert: 安全审查
- Architecture Expert: 架构审查
- Performance Expert: 性能审查
- Reporter: 报告生成与格式化
Metadata
Release files for scx-code-agent 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| scx_code_agent-0.1.3.tar.gz | 26.5 kB | Without provenance | Details for scx_code_agent-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| scx_code_agent-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for scx_code_agent-0.1.3-py3-none-any.whl |
Total release size: 60.6 kB
Release files / scx_code_agent-0.1.3.tar.gz
| Download URL | scx_code_agent-0.1.3.tar.gz |
|---|---|
| Size | 26.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
be24509b5091fb3ad0be71630a27c39813d4da7555bf1dfadff694beb573a795
|
|
BLAKE2b-256 checksum How to use checksums |
b658ab41eb9a7000358d34a6b44987e3926a5b3a1f49c88007dde1cc419e0b0b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.14.5 Darwin/25.5.0
|
Release files / scx_code_agent-0.1.3-py3-none-any.whl
| Download URL | scx_code_agent-0.1.3-py3-none-any.whl |
|---|---|
| Size | 34.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
be496a2b13068860e1c2d167dac01c61b861470417b9d9e7dc235e4dfbae1d75
|
|
BLAKE2b-256 checksum How to use checksums |
78841a086ece01d869621e83c68217734be14d5e588c8521921f5a8cce721a37
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.14.5 Darwin/25.5.0
|
Security for scx-code-agent 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.