best-review 0.5.13 → 0.6.0

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 CHANGED
@@ -29,16 +29,16 @@
29
29
  npm install -g best-review
30
30
 
31
31
  best-review init
32
- best-review review
32
+ br -r
33
33
  ```
34
34
 
35
- `best-review review` 默认审查未提交变更;如果工作区没有变更,会回退审查最近一次提交。
35
+ `br -r` 默认审查未提交变更;如果工作区没有变更,会回退审查最近一次提交。
36
36
 
37
37
  如果使用 OpenAI 兼容服务:
38
38
 
39
39
  ```bash
40
40
  best-review init --provider openai
41
- best-review review
41
+ br -r
42
42
  ```
43
43
 
44
44
  `best-review init` 会以选项式流程写入用户级 `~/.best-review/config.json`,并提示是否把 `GITLAB_TOKEN` 写入同一个用户级配置文件;直接回车可跳过。
@@ -47,58 +47,58 @@ best-review review
47
47
 
48
48
  ```bash
49
49
  # 审查未提交变更;工作区干净时审查最近一次提交
50
- best-review review
50
+ br -r
51
51
 
52
52
  # 审查 HEAD 相对 main 的变更
53
- best-review review --base main
53
+ br -r --base main
54
54
 
55
55
  # 审查指定分支相对默认分支的变更;"." 表示当前分支
56
- best-review review --branch .
57
- best-review review --branch feature/login --base main
56
+ br -r --branch .
57
+ br -r --branch feature/login --base main
58
58
 
59
59
  # 审查单个 commit 或连续多个 commit
60
- best-review review --commit HEAD
61
- best-review review --commit abc1234
62
- best-review review --commit-range HEAD~3..HEAD
60
+ br -r --commit HEAD
61
+ br -r --commit abc1234
62
+ br -r --commit-range HEAD~3..HEAD
63
63
 
64
64
  # 只审查指定文件的 Git 变更
65
- best-review review --files src/auth.ts
66
- best-review review --files src/auth.ts,src/user.ts --base main
65
+ br -r --files src/auth.ts
66
+ br -r --files src/auth.ts,src/user.ts --base main
67
67
 
68
68
  # 审查完整文件内容,不依赖 Git diff
69
- best-review review --files src/auth.ts --full
69
+ br -r --files src/auth.ts --full
70
70
 
71
71
  # 临时忽略目录或文件
72
- best-review review --ignore dist,coverage/**,fixtures/**
72
+ br -r --ignore dist,coverage/**,fixtures/**
73
73
 
74
74
  # 控制 Agent、规则、严重级别和置信度
75
- best-review review --agent security-scan
76
- best-review review --exclude-agent performance-check
77
- best-review review --rule code-security,config-security
78
- best-review review --severity critical,high
79
- best-review review --confidence 80
75
+ br -r --agent security-scan
76
+ br -r --exclude-agent performance-check
77
+ br -r --rule code-security,config-security
78
+ br -r --severity critical,high
79
+ br -r --confidence 80
80
80
 
81
81
  # 覆盖执行器或模型
82
- best-review review --executor deepseek-api --model deepseek-v4-flash
83
- best-review review --executor openai-compatible-api --model gpt-4o-mini
82
+ br -r --executor deepseek-api --model deepseek-v4-flash
83
+ br -r --executor openai-compatible-api --model gpt-4o-mini
84
84
 
85
85
  # 输出 JSON,适合 CI
86
- best-review review --base main --json
86
+ br -r --base main --json
87
87
 
88
88
  # 检查当前配置是否可以直接 review
89
89
  best-review config
90
90
  best-review doctor
91
91
 
92
92
  # 展示每个 pipeline 阶段耗时
93
- best-review review --log-steps
93
+ br -r --log-steps
94
94
 
95
95
  # 显式自动修复严重风险
96
- best-review review --fix-critical
97
- best-review review --fix-severity critical,high --fix-dry-run
98
- best-review review --fix-critical --fix-max-issues 3 --fix-patch-file ~/.best-review/fix.patch
96
+ br -r --fix-critical
97
+ br -r --fix-severity critical,high --fix-dry-run
98
+ br -r --fix-critical --fix-max-issues 3 --fix-patch-file ~/.best-review/fix.patch
99
99
 
100
100
  # GitLab MR 远程审查(默认只读)
101
- best-review review-mr https://gitlab.example.com/group/project/-/merge_requests/123
101
+ br -mr https://gitlab.example.com/group/project/-/merge_requests/123
102
102
 
103
103
  # 如需回评 MR discussion,先配置发布 token 并打开 gitlab.uploadEnabled
104
104
  br init GITLAB_TOKEN
@@ -113,7 +113,7 @@ best-review eval
113
113
  best-review eval evals/golden --min-recall 0.9 --min-precision 0.75 --max-duplicate-rate 0.25
114
114
  ```
115
115
 
116
- `package.json` 同时暴露 `br` 别名;本地已 link 后可用 `br review`。
116
+ `package.json` 同时暴露 `br` 别名;常用短命令是 `br -r`(等价于 `best-review review`)和 `br -mr`(等价于 `best-review review-mr`)。旧写法仍然可用。
117
117
 
118
118
  ## 模型服务
119
119
 
@@ -145,7 +145,7 @@ CLI --model > workflow run model > executors.<executor>.<stage>.model > llm.mode
145
145
  POST <llm.baseUrl>/chat/completions
146
146
  ```
147
147
 
148
- 执行器期望模型按 prompt 输出可解析的 `<json>...</json>` 结果。`best-review review` 和 `best-review review-mr` 会在真正审查前先检查执行器、API Key、模型配置,并发起一次轻量 Chat Completions 联通校验;失败会直接退出并给出修复建议。
148
+ 执行器期望模型按 prompt 输出可解析的 `<json>...</json>` 结果。`br -r` 和 `br -mr` 会在真正审查前先检查执行器、API Key、模型配置,并发起一次轻量 Chat Completions 联通校验;失败会直接退出并给出修复建议。
149
149
 
150
150
  旧配置中的 `opencode-cli` 会在加载时归一化为当前默认模型 API 执行器。新配置和命令行参数应使用 `deepseek-api` 或 `openai-compatible-api`。
151
151
 
@@ -374,9 +374,9 @@ best-review extends remove https://github.com/org/best-review-rules.git
374
374
  `review-mr` 会直接读取 GitLab MR diff 和远程文件内容,运行同一套 pipeline。GitLab discussion 回评属于写操作,默认关闭,需要显式开启。
375
375
 
376
376
  ```bash
377
- best-review review-mr https://gitlab.example.com/group/project/-/merge_requests/123
378
- best-review review-mr <mr-url> --agent security-scan --log-steps
379
- best-review review-mr <mr-url> --executor deepseek-api --model deepseek-v4-flash
377
+ br -mr https://gitlab.example.com/group/project/-/merge_requests/123
378
+ br -mr <mr-url> --agent security-scan --log-steps
379
+ br -mr <mr-url> --executor deepseek-api --model deepseek-v4-flash
380
380
 
381
381
  # 如需回评 MR discussion,再初始化发布 token
382
382
  br init GITLAB_TOKEN
@@ -416,13 +416,13 @@ GitLab Reporting 会优先发布行内 discussion;无法映射到 diff positio
416
416
 
417
417
  ```bash
418
418
  # 只修复 critical
419
- best-review review --fix-critical
419
+ br -r --fix-critical
420
420
 
421
421
  # 修复 critical/high,但只校验补丁,不写入文件
422
- best-review review --fix-severity critical,high --fix-dry-run
422
+ br -r --fix-severity critical,high --fix-dry-run
423
423
 
424
424
  # 限制修复数量,并保存补丁
425
- best-review review --fix-critical --fix-max-issues 3 --fix-patch-file ~/.best-review/fix.patch
425
+ br -r --fix-critical --fix-max-issues 3 --fix-patch-file ~/.best-review/fix.patch
426
426
  ```
427
427
 
428
428
  安全约束:
@@ -486,14 +486,14 @@ JSON 输出包含:
486
486
  CI 建议:
487
487
 
488
488
  ```bash
489
- best-review review --base origin/main --json
489
+ br -r --base origin/main --json
490
490
  ```
491
491
 
492
492
  当 pipeline 失败或最终存在 `critical` 问题时,CLI 会返回非 0 exit code。`high`、`medium`、`low` 默认不阻断,可由 CI 根据 JSON 自定义策略。
493
493
 
494
494
  ## Reporting
495
495
 
496
- 每次 `best-review review` 都会保存一份本地 JSON 报告,默认目录:
496
+ 每次 `br -r` 都会保存一份本地 JSON 报告,默认目录:
497
497
 
498
498
  ```text
499
499
  ~/.best-review/reports/
@@ -522,7 +522,7 @@ BEST_REVIEW_HISTORY_BRANCH=review-log
522
522
  projects/<group>/<project>/<gitlab-user>/<timestamp>-<run-id>.json
523
523
  ```
524
524
 
525
- 历史归档只上传 `best-review review` 的本地结果;`best-review review-mr` 不会上传到历史仓库。
525
+ 历史归档只上传 `br -r` 的本地结果;`br -mr` 不会上传到历史仓库。
526
526
 
527
527
  上传成功后,本地 JSON 会被删除,避免长期占用磁盘;上传失败时会保留本地文件,方便排查。
528
528
 
@@ -584,27 +584,27 @@ fixture 支持:
584
584
 
585
585
  ```bash
586
586
  # 关闭缓存
587
- BEST_REVIEW_CACHE=false best-review review
587
+ BEST_REVIEW_CACHE=false br -r
588
588
 
589
589
  # 兼容旧变量:关闭缓存
590
- BEST_REVIEW_DISABLE_CACHE=true best-review review
590
+ BEST_REVIEW_DISABLE_CACHE=true br -r
591
591
 
592
592
  # 调整 batch token 和文件数量
593
- BEST_REVIEW_BATCH_TOKENS=36000 best-review review
594
- BEST_REVIEW_MAX_FILES_PER_BATCH=20 best-review review
593
+ BEST_REVIEW_BATCH_TOKENS=36000 br -r
594
+ BEST_REVIEW_MAX_FILES_PER_BATCH=20 br -r
595
595
 
596
596
  # 使用完整 diff,不做压缩
597
- BEST_REVIEW_FULL_DIFF=true best-review review
597
+ BEST_REVIEW_FULL_DIFF=true br -r
598
598
 
599
599
  # 调整 diff 压缩上下文和单文件输入上限
600
- BEST_REVIEW_DIFF_CONTEXT_LINES=2 best-review review
601
- BEST_REVIEW_MAX_DIFF_CHARS_PER_FILE=30000 best-review review
600
+ BEST_REVIEW_DIFF_CONTEXT_LINES=2 br -r
601
+ BEST_REVIEW_MAX_DIFF_CHARS_PER_FILE=30000 br -r
602
602
 
603
603
  # 合并多个专业 Agent 为一次快速审查
604
- BEST_REVIEW_MULTI_AGENT=false best-review review
604
+ BEST_REVIEW_MULTI_AGENT=false br -r
605
605
 
606
606
  # 关闭智能规则路由
607
- BEST_REVIEW_DISABLE_SMART_ROUTING=true best-review review
607
+ BEST_REVIEW_DISABLE_SMART_ROUTING=true br -r
608
608
  ```
609
609
 
610
610
  默认缓存目录:
@@ -635,7 +635,7 @@ npm run format:check
635
635
 
636
636
  # 本地 link 后用全局命令调试
637
637
  npm run link:local
638
- best-review review --base main
638
+ br -r --base main
639
639
  ```
640
640
 
641
641
  常用源码入口: