coderev-cli 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +133 -117
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,140 +1,127 @@
1
- # coderev-cli — AI Code Review Agent 🚀
1
+ # coderev-cli
2
2
 
3
- > `npm install -g coderev-cli` · 账号:[@aisync](https://www.npmjs.com/~aisync)
3
+ > Multi-agent AI code review for git — parallel Security / Bug / Quality agents with confidence scoring.
4
4
 
5
- **coderev-cli** 是一个 AI 驱动的一站式代码审查工具。采用**多智能体并行审查架构**——3 个专业 Agent 同时从安全、Bug、质量维度审查代码,每个 Issue 附带置信度评分,自动过滤误报。支持 GitHub PR 集成、自动修复、git hooks、缓存、自定义规则、多语言专项审查、统计看板。
5
+ [![npm version](https://img.shields.io/npm/v/coderev-cli)](https://www.npmjs.com/package/coderev-cli)
6
6
 
7
- ## 🧠 架构:多智能体并行审查 (v0.3.0)
7
+ ---
8
8
 
9
- ```
10
- 你的代码 (git diff)
11
-
12
- ┌──────┼──────┐
13
- ▼ ▼ ▼
14
- ┌──────┐┌──────┐┌──────┐
15
- │ 🔒 ││ 🐛 ││ 📐 │
16
- │Security││ Bug ││Quality│
17
- │Auditor││Detector││Check │
18
- └──┬───┘└──┬───┘└──┬───┘
19
- │ │ │
20
- └───────┼───────┘
21
-
22
- ┌──────────┐
23
- │ 合并 & │
24
- │ 置信度评分 │
25
- │ (0-100) │
26
- └────┬─────┘
27
-
28
- 结构化审查报告
29
- ```
30
-
31
- **3 个专业 Agent 并行工作**,从不同角度审查同一份代码:
9
+ ## Install
32
10
 
33
- | Agent | 专注领域 |
34
- |-------|---------|
35
- | 🔒 Security Auditor | SQL注入、XSS、SSRF、硬编码密钥、认证缺陷 |
36
- | 🐛 Bug Detector | 空指针、竞态条件、异步问题、逻辑错误 |
37
- | 📐 Code Quality | 代码复杂度、DRY、命名规范、异常处理 |
11
+ ```bash
12
+ npm install -g coderev-cli
13
+ ```
38
14
 
39
- 每个 issue 都会计算**置信度评分 (0-100)**,低于阈值(默认 60)的自动过滤。同一问题被多个 Agent 发现时自动去重。
15
+ ---
40
16
 
41
- ## 快速上手
17
+ ## Quick Start
42
18
 
43
19
  ```bash
44
- # 1. 安装
45
- npm install -g coderev-cli
46
-
47
- # 2. 初始化项目配置
20
+ # 1. init project config
48
21
  coderev init
49
22
 
50
- # 3. 设置 API Key(二选一)
51
- export DEEPSEEK_API_KEY="sk-your-key-here" # DeepSeek
52
- export OPENAI_API_KEY="sk-your-key-here" # OpenAI
23
+ # 2. set API key (supports DeepSeek / OpenAI)
24
+ export DEEPSEEK_API_KEY="sk-xxx"
53
25
 
54
- # 4. 审查当前仓库暂存区
26
+ # 3. review staged changes
55
27
  coderev review
56
28
 
57
- # 5. 或审查两个分支间的差异
58
- coderev review --repo . --base main --head feature
59
-
60
- # 6. 或使用管道
29
+ # 4. or review a diff
61
30
  git diff main | coderev review
31
+
32
+ # 5. or review a PR
33
+ coderev review --pr owner/repo#42
62
34
  ```
63
35
 
64
- ## 🎯 CLI 选项详解
36
+ ---
65
37
 
66
- ### 审查命令
38
+ ## Architecture
67
39
 
68
- ```bash
69
- # 多智能体并行审查(默认,推荐)
70
- coderev review
40
+ ```
41
+ your code (git diff)
42
+
43
+ ┌──────┼──────┐
44
+ ▼ ▼ ▼
45
+ ┌──────┐┌──────┐┌──────┐
46
+ │ 🔒 ││ 🐛 ││ 📐 │
47
+ │Security│ Bug │Quality│
48
+ │Auditor│Detector│ Check │
49
+ └──┬───┘└──┬───┘└──┬───┘
50
+ │ │ │
51
+ └───────┼───────┘
52
+
53
+ ┌──────────┐
54
+ │ merge & │
55
+ │confidence│
56
+ │ (0-100) │
57
+ └────┬─────┘
58
+
59
+ structured report
60
+ ```
71
61
 
72
- # 提高置信度阈值(更少但更可靠的结果)
73
- coderev review --min-confidence 80
62
+ | Agent | Focus |
63
+ |-------|-------|
64
+ | 🔒 Security Audit | SQL injection, XSS, SSRF, hardcoded secrets, auth flaws |
65
+ | 🐛 Bug Detection | null pointers, race conditions, async issues, logic errors |
66
+ | 📐 Code Quality | complexity, DRY, naming, exception handling |
74
67
 
75
- # 降低阈值(更多结果,含一些误报)
76
- coderev review --min-confidence 40
68
+ Every issue gets a **confidence score (0–100)**; below threshold (default 60) is auto-filtered. Duplicates found by multiple agents are merged.
77
69
 
78
- # 单 Agent 模式(v0.2.x 传统模式,消费更低)
79
- coderev review --single
70
+ ---
80
71
 
81
- # 安全审计模式(注入 OWASP 级审查)
82
- coderev review --audit
72
+ ## CLI Reference
83
73
 
84
- # 跳过缓存强刷
85
- coderev review --no-cache
74
+ ### review
86
75
 
87
- # 输出 JSON
88
- coderev review --format json
76
+ ```bash
77
+ coderev review # parallel agents (default)
78
+ coderev review --min-confidence 80 # higher bar, fewer false positives
79
+ coderev review --single # single agent mode (v0.2 compat, cheaper)
80
+ coderev review --audit # OWASP-level security focus
81
+ coderev review --no-cache # bypass cache
82
+ coderev review --format json # JSON output
89
83
  ```
90
84
 
91
- ### 其他命令
85
+ ### fix
92
86
 
93
87
  ```bash
94
- coderev fix --file changes.diff # 自动修复
95
- coderev fix --file changes.diff --apply # 生成并应用补丁
96
- coderev hook install # 安装 git hook
97
- coderev hook install pre-commit --min-score 70
98
- coderev stats # 统计看板
99
- coderev stats week # 本周统计
100
- coderev cache status # 缓存状态
101
- coderev cache clear # 清空缓存
102
- coderev config show # 查看配置
88
+ coderev fix --file changes.diff # auto-fix suggestions
89
+ coderev fix --file changes.diff --apply # generate & apply patches
103
90
  ```
104
91
 
105
- ## 🔗 GitHub PR 审查
92
+ ### PR review
106
93
 
107
94
  ```bash
108
- coderev review --pr owner/repo#42 # 审查 PR
109
- coderev review --pr 42 # 自动检测当前仓库
110
- coderev review --pr owner/repo#42 --post # 审查 + 贴评论
111
- coderev review --pr owner/repo#42 --inline # 行内评论
112
- coderev review --pr owner/repo#42 --format json # JSON 输出
95
+ coderev review --pr owner/repo#42 # review external PR
96
+ coderev review --pr 42 # auto-detect current repo
97
+ coderev review --pr owner/repo#42 --post # review + post comment
98
+ coderev review --pr owner/repo#42 --inline # inline code comments
99
+ coderev review --pr owner/repo#42 --format json
113
100
  ```
114
101
 
115
- `--inline` 模式将每条 issue 贴在 PR 的具体代码行上,像人工 review 一样直观。
116
-
117
- ## 📝 项目上下文(.coderevhint)
102
+ ### hooks
118
103
 
119
- 在项目根目录创建 `.coderevhint` 文件,描述项目概况、架构和规范。AI 审查时会自动加载并据此调整审查重点。
104
+ ```bash
105
+ coderev hook install # install pre-commit hook
106
+ coderev hook install pre-commit --min-score 70
107
+ coderev hook install pre-push
108
+ ```
120
109
 
121
- coderev 也兼容 `CLAUDE.md` 文件,与 Claude Code 项目规范互通。
110
+ ### other
122
111
 
123
- ## 🌐 多语言专项规则
112
+ ```bash
113
+ coderev stats # dashboard
114
+ coderev stats week # weekly stats
115
+ coderev cache status # cache info
116
+ coderev cache clear # clear cache
117
+ coderev config show # show config
118
+ ```
124
119
 
125
- coderev 自动检测 diff 中的编程语言,为不同语言添加专项检查规则:
120
+ ---
126
121
 
127
- | 语言 | 检查重点 |
128
- |---|---|
129
- | JavaScript | async/await 链、== vs ===、内存泄漏、import 循环依赖 |
130
- | TypeScript | strict 模式、avoid any、泛型、类型断言 |
131
- | Python | PEP 8、except 类型、mutable 默认参数、async 用法 |
132
- | Rust | unsafe 审计、unwrap/expect、生命周期、ownership |
133
- | Go | error handling、goroutine 安全、context 传播、data race |
134
- | Java | null 处理、checked exception、== vs .equals()、线程安全 |
135
- | SQL | 注入防护、N+1 查询、索引缺失、大 IN-clause |
122
+ ## Config
136
123
 
137
- ## 🗂 配置管理
124
+ Create `.coderevrc.json` in project root:
138
125
 
139
126
  ```json
140
127
  {
@@ -150,40 +137,69 @@ coderev 自动检测 diff 中的编程语言,为不同语言添加专项检查
150
137
  {
151
138
  "name": "no-console-log",
152
139
  "severity": "warning",
153
- "message": "避免在生产代码中使用 console.log"
140
+ "message": "avoid console.log in production code"
154
141
  }
155
142
  ]
156
143
  }
157
144
  }
158
145
  ```
159
146
 
160
- 团队共享:将 `.coderevrc.json` 放入仓库根目录,全组自动读取。
147
+ Supports 8 built-in rule sets and language-specific rules for JS, TS, Python, Rust, Go, Java, SQL.
148
+
149
+ ### .coderevhint
150
+
151
+ Describe your project context. coderev reads it during review to tailor analysis. Compatible with `CLAUDE.md`.
152
+
153
+ ---
154
+
155
+ ## Git Platform Support
161
156
 
162
- ## 🔄 GitHub Actions 自动审查
157
+ | Platform | PR review | Comment posting |
158
+ |----------|-----------|-----------------|
159
+ | GitHub | ✅ | ✅ inline / summary |
160
+ | GitLab | ✅ | ✅ |
161
+ | Gitee | ✅ | ✅ |
162
+ | Bitbucket| ✅ | ✅ |
163
163
 
164
- 在工作流中使用 `coderev-review.yml`,PR 创建时自动审查并贴评论。详见 `.github/workflows/`。
164
+ ---
165
165
 
166
- ## 📁 项目结构
166
+ ## Caching
167
+
168
+ - SHA256-based diff hashing
169
+ - 24-hour TTL
170
+ - `coderev cache status` / `coderev cache clear`
171
+
172
+ ---
173
+
174
+ ## CI / GitHub Actions
175
+
176
+ Built-in workflow at `.github/workflows/coderev-review.yml` — auto-reviews every PR.
177
+
178
+ ---
179
+
180
+ ## Project Structure
167
181
 
168
182
  ```
169
183
  coderev/
170
184
  ├── src/
171
- │ ├── cli.js # CLI 入口(review/fix/hook/stats 等子命令)
172
- │ ├── reviewer.js # AI 审查核心(多智能体并行 + 置信度评分)
173
- │ ├── config.js # 配置加载
174
- │ ├── github.js # GitHub API
175
- │ ├── gitlab.js # GitLab API
176
- │ ├── gitee.js # Gitee API
177
- │ ├── bitbucket.js # Bitbucket API
178
- │ ├── cache.js # 缓存系统
179
- │ ├── rules.js # 规则引擎(8 套预定义 + 7 种语言 + 自定义)
180
- │ ├── stats.js # 统计看板
181
- │ └── coderev.test.js # 20 个单元测试
182
- ├── .github/workflows/ # GitHub Actions
183
- ├── .coderevrc.json # 配置模板
184
- ├── .coderevignore # 忽略规则
185
- ├── .coderevhint # 项目上下文
186
- └── ROADMAP.md # 路线图
185
+ │ ├── cli.js # CLI entry
186
+ │ ├── reviewer.js # multi-agent review core
187
+ │ ├── config.js # config loader
188
+ │ ├── github.js # GitHub API
189
+ │ ├── gitlab.js # GitLab API
190
+ │ ├── gitee.js # Gitee API
191
+ │ ├── bitbucket.js # Bitbucket API
192
+ │ ├── cache.js # caching
193
+ │ ├── rules.js # rule engine
194
+ │ ├── stats.js # dashboard
195
+ │ └── coderev.test.js # 20 tests
196
+ ├── .github/workflows/
197
+ ├── .coderevrc.json
198
+ ├── .coderevignore
199
+ └── .coderevhint
200
+ ```
201
+
202
+ ---
187
203
 
188
204
  ## License
189
205
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coderev-cli",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Multi-agent AI code review for git -- parallel agents with confidence scoring",
5
5
  "main": "src/index.js",
6
6
  "bin": {