best-review 0.5.7 → 0.5.8
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 +20 -46
- package/dist/best-review.cjs +219 -217
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -56,6 +56,11 @@ best-review review --base main
|
|
|
56
56
|
best-review review --branch .
|
|
57
57
|
best-review review --branch feature/login --base main
|
|
58
58
|
|
|
59
|
+
# 审查单个 commit 或连续多个 commit
|
|
60
|
+
best-review review --commit HEAD
|
|
61
|
+
best-review review --commit abc1234
|
|
62
|
+
best-review review --commit-range HEAD~3..HEAD
|
|
63
|
+
|
|
59
64
|
# 只审查指定文件的 Git 变更
|
|
60
65
|
best-review review --files src/auth.ts
|
|
61
66
|
best-review review --files src/auth.ts,src/user.ts --base main
|
|
@@ -282,6 +287,8 @@ flowchart LR
|
|
|
282
287
|
关键行为:
|
|
283
288
|
|
|
284
289
|
- `filterReviewableDiffs()` 默认跳过二进制、生成物、文档和命中排除规则的文件。
|
|
290
|
+
- 本地 review 支持未提交变更、`--base/--head`、`--branch`、`--commit`、`--commit-range`、`--files` 和 `--full`;互斥或不完整的参数组合会在进入 pipeline 前直接拒绝。
|
|
291
|
+
- `--commit <ref>` 等价于比较 `<ref>^` 和 `<ref>`;`--commit-range <oldest>..<newest>` 会包含两端 commit,要求 `<oldest>` 是 `<newest>` 的祖先。
|
|
285
292
|
- 本地 review 会补充变更文件全文和一层相对依赖上下文,避免模型只看 diff。
|
|
286
293
|
- diff 输入默认压缩,只保留 hunk 行号、变更行和少量上下文。
|
|
287
294
|
- 默认是多 Agent 独立审查;设置 `BEST_REVIEW_MULTI_AGENT=false` 可把多个专业 Agent 合并成一次快速审查。
|
|
@@ -457,85 +464,52 @@ best-review review --base origin/main --json
|
|
|
457
464
|
|
|
458
465
|
## Reporting
|
|
459
466
|
|
|
460
|
-
每次 review
|
|
467
|
+
每次 `best-review review` 都会保存一份本地 JSON 报告,默认目录:
|
|
461
468
|
|
|
462
469
|
```text
|
|
463
470
|
~/.best-review/reports/
|
|
464
471
|
```
|
|
465
472
|
|
|
466
|
-
|
|
473
|
+
报告包含仓库信息、模型、风险结论、质量评分、最终问题和 diff 摘要。默认不保存完整 diff。
|
|
467
474
|
|
|
468
|
-
|
|
475
|
+
如果想把本地 review 结果归档到 Git 仓库,开启历史归档并配置自己的仓库地址:
|
|
469
476
|
|
|
470
|
-
```
|
|
477
|
+
```bash
|
|
478
|
+
BEST_REVIEW_HISTORY=true
|
|
471
479
|
BEST_REVIEW_HISTORY_REMOTE=git@git.example.com:team/review-history.git
|
|
480
|
+
BEST_REVIEW_HISTORY_BRANCH=review-log
|
|
472
481
|
```
|
|
473
482
|
|
|
474
|
-
|
|
483
|
+
上传后的文件会按项目和 GitLab 用户分组:
|
|
475
484
|
|
|
476
485
|
```text
|
|
477
486
|
projects/<group>/<project>/<gitlab-user>/<timestamp>-<run-id>.json
|
|
478
487
|
```
|
|
479
488
|
|
|
480
|
-
|
|
489
|
+
历史归档只上传 `best-review review` 的本地结果;`best-review review-mr` 不会上传到历史仓库。
|
|
481
490
|
|
|
482
|
-
|
|
491
|
+
上传成功后,本地 JSON 会被删除,避免长期占用磁盘;上传失败时会保留本地文件,方便排查。
|
|
483
492
|
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
配置上报:
|
|
493
|
+
也可以通过用户级 `~/.best-review/config.json` 配置:
|
|
487
494
|
|
|
488
495
|
```json
|
|
489
496
|
{
|
|
490
497
|
"reporting": {
|
|
491
|
-
"
|
|
492
|
-
"url": "https://efficiency.example.com/api/ai-review/usages",
|
|
493
|
-
"token": "replace-with-token",
|
|
494
|
-
"includeDiffs": false,
|
|
495
|
-
"failOnError": false,
|
|
496
|
-
"historyEnabled": false,
|
|
498
|
+
"historyEnabled": true,
|
|
497
499
|
"historyRemote": "git@git.example.com:team/review-history.git",
|
|
498
500
|
"historyBranch": "review-log"
|
|
499
501
|
}
|
|
500
502
|
}
|
|
501
503
|
```
|
|
502
504
|
|
|
503
|
-
|
|
505
|
+
如果还需要把报告 POST 到内部效能系统,再配置 Reporting URL:
|
|
504
506
|
|
|
505
507
|
```bash
|
|
506
|
-
BEST_REVIEW_REPORT_DIR=$HOME/.best-review/reports
|
|
507
508
|
BEST_REVIEW_REPORT_URL=https://efficiency.example.com/api/ai-review/usages
|
|
508
509
|
BEST_REVIEW_REPORT_TOKEN=replace-with-token
|
|
509
|
-
BEST_REVIEW_REPORT_INCLUDE_DIFFS=false
|
|
510
|
-
BEST_REVIEW_REPORT_FAIL_ON_ERROR=false
|
|
511
|
-
```
|
|
512
|
-
|
|
513
|
-
审查历史仓库相关环境变量:
|
|
514
|
-
|
|
515
|
-
```bash
|
|
516
|
-
# 显式开启本地 review 历史归档;默认关闭
|
|
517
|
-
BEST_REVIEW_HISTORY=true
|
|
518
|
-
|
|
519
|
-
# 如需覆盖配置并关闭历史归档
|
|
520
|
-
BEST_REVIEW_HISTORY=false
|
|
521
|
-
|
|
522
|
-
# 审查历史仓库地址,启用历史归档时必须显式设置
|
|
523
|
-
BEST_REVIEW_HISTORY_REMOTE=git@git.example.com:team/review-history.git
|
|
524
|
-
|
|
525
|
-
# 审查历史分支;默认 review-log
|
|
526
|
-
BEST_REVIEW_HISTORY_BRANCH=review-log
|
|
527
|
-
|
|
528
|
-
# 覆盖临时 clone 目录;默认在 ~/.best-review/tmp 下创建并自动清理
|
|
529
|
-
BEST_REVIEW_HISTORY_TMP_DIR=$HOME/.best-review/tmp
|
|
530
|
-
|
|
531
|
-
# 显式指定归档使用的 GitLab 用户名
|
|
532
|
-
BEST_REVIEW_GITLAB_USER=alice
|
|
533
|
-
|
|
534
|
-
# HTTPS 远端认证可使用 GITLAB_TOKEN;如需覆盖 Git 用户名可单独设置
|
|
535
|
-
BEST_REVIEW_HISTORY_GIT_USERNAME=alice
|
|
536
510
|
```
|
|
537
511
|
|
|
538
|
-
|
|
512
|
+
默认上报失败不会阻断 review。CI 里想让上报失败直接失败,可以设置 `BEST_REVIEW_REPORT_FAIL_ON_ERROR=true`。
|
|
539
513
|
|
|
540
514
|
## 审查质量评测
|
|
541
515
|
|