{"id":51026887,"url":"https://github.com/gitstq/ai-code-reviewer","last_synced_at":"2026-06-21T20:02:29.952Z","repository":{"id":356302069,"uuid":"1231914215","full_name":"gitstq/ai-code-reviewer","owner":"gitstq","description":"🤖 轻量级AI代码审查工具 - Intelligent Code Review CLI | 多LLM支持 · 零依赖 · 本地优先","archived":false,"fork":false,"pushed_at":"2026-05-07T12:11:19.000Z","size":22,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-07T14:20:45.935Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gitstq.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-07T12:08:24.000Z","updated_at":"2026-05-07T12:11:32.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/gitstq/ai-code-reviewer","commit_stats":null,"previous_names":["gitstq/ai-code-reviewer"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/gitstq/ai-code-reviewer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitstq%2Fai-code-reviewer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitstq%2Fai-code-reviewer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitstq%2Fai-code-reviewer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitstq%2Fai-code-reviewer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gitstq","download_url":"https://codeload.github.com/gitstq/ai-code-reviewer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitstq%2Fai-code-reviewer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34623906,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-21T02:00:05.568Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-21T20:02:29.071Z","updated_at":"2026-06-21T20:02:29.939Z","avatar_url":"https://github.com/gitstq.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🤖 AI Code Reviewer\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Python-3.8+-blue.svg\" alt=\"Python 3.8+\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/License-MIT-green.svg\" alt=\"License: MIT\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Platform-Linux%20%7C%20macOS%20%7C%20Windows-lightgrey.svg\" alt=\"Platform\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cb\u003e🌐 多语言文档\u003c/b\u003e |\n  \u003ca href=\"README.zh-CN.md\"\u003e简体中文\u003c/a\u003e |\n  \u003ca href=\"README.zh-TW.md\"\u003e繁體中文\u003c/a\u003e |\n  \u003ca href=\"README.md\"\u003eEnglish\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\n## 🎉 项目介绍\n\n**AI Code Reviewer** 是一款轻量级、智能化的代码审查 CLI 工具，专为开发者打造。它能够自动检测代码中的安全漏洞、质量问题、性能瓶颈，并通过 AI 提供专业的改进建议。\n\n### 灵感来源\n\n本项目灵感来源于 GitHub Trending 上的热门代码审查工具，但我们进行了**完全独立自研**，专注于以下差异化优势：\n- 🔒 **本地优先** - 代码不上传云端，保护您的代码隐私\n- ⚡ **零依赖核心** - 纯 Python 标准库实现核心功能\n- 🧠 **多 LLM 支持** - 支持 OpenAI、Claude、Ollama、DeepSeek 等多种 AI 后端\n- 📊 **增量审查** - 仅审查 Git 变更，节省时间和 API 成本\n\n---\n\n## ✨ 核心特性\n\n| 特性 | 描述 | 状态 |\n|------|------|------|\n| 🔐 **安全漏洞检测** | 自动检测 OWASP Top 10 安全漏洞、硬编码密钥、SQL 注入等 | ✅ |\n| 📏 **代码质量分析** | 检测代码异味、过长函数、未使用导入等问题 | ✅ |\n| ⚡ **性能优化建议** | 识别性能瓶颈，提供优化建议 | ✅ |\n| 🤖 **AI 智能审查** | 支持 GPT-4、Claude、本地 Ollama 等多种 LLM | ✅ |\n| 📈 **增量审查** | 仅审查 Git diff 变更，节省 API 调用 | ✅ |\n| 📄 **多格式报告** | 支持 Terminal、Markdown、JSON、SARIF 格式 | ✅ |\n| 🎨 **精美终端界面** | 使用 Rich 库打造美观的终端输出 | ✅ |\n| 🔌 **多语言支持** | Python、JavaScript、TypeScript、Java、Go、Rust 等 | ✅ |\n\n---\n\n## 🚀 快速开始\n\n### 环境要求\n\n- **Python**: 3.8 或更高版本\n- **操作系统**: Linux、macOS、Windows\n\n### 安装步骤\n\n#### 方式一：通过 pip 安装（推荐）\n\n```bash\npip install ai-code-reviewer\n```\n\n#### 方式二：从源码安装\n\n```bash\ngit clone https://github.com/gitstq/ai-code-reviewer.git\ncd ai-code-reviewer\npip install -r requirements.txt\npip install -e .\n```\n\n#### 方式三：直接运行\n\n```bash\ngit clone https://github.com/gitstq/ai-code-reviewer.git\ncd ai-code-reviewer/src\npython cli.py --help\n```\n\n### 配置 API 密钥\n\n```bash\n# OpenAI\nexport OPENAI_API_KEY=\"your-openai-api-key\"\n\n# Anthropic Claude\nexport ANTHROPIC_API_KEY=\"your-anthropic-api-key\"\n\n# DeepSeek\nexport DEEPSEEK_API_KEY=\"your-deepseek-api-key\"\n\n# Ollama（本地运行，无需 API 密钥）\nollama run codellama\n```\n\n---\n\n## 📖 详细使用指南\n\n### 1️⃣ 基础代码分析\n\n分析单个文件：\n```bash\nai-review analyze ./src/main.py\n```\n\n分析整个目录：\n```bash\nai-review analyze ./src --format markdown --output report.md\n```\n\n### 2️⃣ AI 智能审查\n\n使用 OpenAI GPT-4 审查代码：\n```bash\nai-review review ./src/main.py --provider openai\n```\n\n使用本地 Ollama：\n```bash\nai-review review ./src/main.py --provider ollama --model codellama\n```\n\n流式输出：\n```bash\nai-review review ./src/main.py --provider openai --stream\n```\n\n### 3️⃣ 增量审查（Git Diff）\n\n审查当前工作区的变更：\n```bash\nai-review diff .\n```\n\n审查与指定分支的差异：\n```bash\nai-review diff . --base main\n```\n\n### 4️⃣ 生成不同格式报告\n\n```bash\n# Markdown 报告\nai-review analyze ./src --format markdown --output report.md\n\n# JSON 报告（适合 CI/CD 集成）\nai-review analyze ./src --format json --output report.json\n\n# SARIF 报告（GitHub/GitLab 兼容）\nai-review analyze ./src --format sarif --output report.sarif\n```\n\n### 5️⃣ 查看配置\n\n```bash\nai-review config\n```\n\n---\n\n## 💡 设计思路与迭代规划\n\n### 技术选型原因\n\n| 技术 | 选型原因 |\n|------|----------|\n| **Python** | 生态丰富，开发效率高，适合 CLI 工具 |\n| **Click** | 成熟的 Python CLI 框架，支持丰富的命令行特性 |\n| **Rich** | 打造精美的终端界面，提升用户体验 |\n| **GitPython** | 便捷的 Git 操作，支持增量审查 |\n\n### 架构设计\n\n```\nai-code-reviewer/\n├── src/\n│   ├── core/\n│   │   ├── analyzer.py      # 代码分析引擎\n│   │   ├── llm_client.py    # LLM 客户端抽象\n│   │   └── reporter.py      # 报告生成器\n│   ├── rules/               # 检测规则库\n│   └── cli.py               # 命令行接口\n```\n\n### 后续迭代计划\n\n- [ ] **v1.1.0** - 支持更多编程语言（C++、C#、Ruby）\n- [ ] **v1.2.0** - 自定义规则配置\n- [ ] **v1.3.0** - IDE 插件（VS Code、JetBrains）\n- [ ] **v1.4.0** - CI/CD 集成优化\n- [ ] **v2.0.0** - Web 界面版本\n\n---\n\n## 📦 打包与部署指南\n\n### 本地开发\n\n```bash\n# 创建虚拟环境\npython -m venv venv\nsource venv/bin/activate  # Linux/macOS\n# 或 venv\\Scripts\\activate  # Windows\n\n# 安装依赖\npip install -r requirements.txt\npip install -e \".[all]\"\n\n# 运行测试\npython -m pytest tests/\n```\n\n### 打包发布\n\n```bash\n# 构建分发包\npython setup.py sdist bdist_wheel\n\n# 上传到 PyPI\ntwine upload dist/*\n```\n\n---\n\n## 🤝 贡献指南\n\n我们欢迎所有形式的贡献！\n\n### 提交 Issue\n\n- 使用清晰的标题描述问题\n- 提供复现步骤\n- 附上相关代码片段和错误日志\n\n### 提交 PR\n\n1. Fork 本仓库\n2. 创建特性分支 (`git checkout -b feature/amazing-feature`)\n3. 提交更改 (`git commit -m 'feat: add amazing feature'`)\n4. 推送到分支 (`git push origin feature/amazing-feature`)\n5. 创建 Pull Request\n\n### 代码规范\n\n- 遵循 PEP 8 规范\n- 使用 Black 格式化代码\n- 添加适当的注释和文档\n\n---\n\n## 📄 开源协议\n\n本项目采用 [MIT License](LICENSE) 开源协议。\n\n---\n\n\u003cp align=\"center\"\u003e\n  Made with ❤️ by \u003ca href=\"https://github.com/gitstq\"\u003elongxiaokong\u003c/a\u003e\n\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgitstq%2Fai-code-reviewer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgitstq%2Fai-code-reviewer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgitstq%2Fai-code-reviewer/lists"}