coderev-cli 1.0.1 → 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.
- package/README.md +133 -117
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,140 +1,127 @@
|
|
|
1
|
-
# coderev-cli
|
|
1
|
+
# coderev-cli
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> Multi-agent AI code review for git — parallel Security / Bug / Quality agents with confidence scoring.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[](https://www.npmjs.com/package/coderev-cli)
|
|
6
6
|
|
|
7
|
-
|
|
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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
| 🐛 Bug Detector | 空指针、竞态条件、异步问题、逻辑错误 |
|
|
37
|
-
| 📐 Code Quality | 代码复杂度、DRY、命名规范、异常处理 |
|
|
11
|
+
```bash
|
|
12
|
+
npm install -g coderev-cli
|
|
13
|
+
```
|
|
38
14
|
|
|
39
|
-
|
|
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
|
-
#
|
|
51
|
-
export DEEPSEEK_API_KEY="sk-
|
|
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
|
-
#
|
|
26
|
+
# 3. review staged changes
|
|
55
27
|
coderev review
|
|
56
28
|
|
|
57
|
-
#
|
|
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
|
-
|
|
36
|
+
---
|
|
65
37
|
|
|
66
|
-
|
|
38
|
+
## Architecture
|
|
67
39
|
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
|
|
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
|
-
|
|
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
|
-
|
|
79
|
-
coderev review --single
|
|
70
|
+
---
|
|
80
71
|
|
|
81
|
-
|
|
82
|
-
coderev review --audit
|
|
72
|
+
## CLI Reference
|
|
83
73
|
|
|
84
|
-
|
|
85
|
-
coderev review --no-cache
|
|
74
|
+
### review
|
|
86
75
|
|
|
87
|
-
|
|
88
|
-
coderev review
|
|
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
|
-
|
|
92
|
+
### PR review
|
|
106
93
|
|
|
107
94
|
```bash
|
|
108
|
-
coderev review --pr owner/repo#42 #
|
|
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
|
|
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
|
-
|
|
116
|
-
|
|
117
|
-
## 📝 项目上下文(.coderevhint)
|
|
102
|
+
### hooks
|
|
118
103
|
|
|
119
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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": "
|
|
140
|
+
"message": "avoid console.log in production code"
|
|
154
141
|
}
|
|
155
142
|
]
|
|
156
143
|
}
|
|
157
144
|
}
|
|
158
145
|
```
|
|
159
146
|
|
|
160
|
-
|
|
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
|
-
|
|
157
|
+
| Platform | PR review | Comment posting |
|
|
158
|
+
|----------|-----------|-----------------|
|
|
159
|
+
| GitHub | ✅ | ✅ inline / summary |
|
|
160
|
+
| GitLab | ✅ | ✅ |
|
|
161
|
+
| Gitee | ✅ | ✅ |
|
|
162
|
+
| Bitbucket| ✅ | ✅ |
|
|
163
163
|
|
|
164
|
-
|
|
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
|
|
172
|
-
│ ├── reviewer.js
|
|
173
|
-
│ ├── config.js
|
|
174
|
-
│ ├── github.js
|
|
175
|
-
│ ├── gitlab.js
|
|
176
|
-
│ ├── gitee.js
|
|
177
|
-
│ ├── bitbucket.js
|
|
178
|
-
│ ├── cache.js
|
|
179
|
-
│ ├── rules.js
|
|
180
|
-
│ ├── stats.js
|
|
181
|
-
│ └── coderev.test.js # 20
|
|
182
|
-
├── .github/workflows/
|
|
183
|
-
├── .coderevrc.json
|
|
184
|
-
├── .coderevignore
|
|
185
|
-
|
|
186
|
-
|
|
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
|
|