@spaceflow/review 0.40.0 → 0.41.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/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.40.0](https://github.com/Lydanne/spaceflow/compare/@spaceflow/review@0.39.0...@spaceflow/review@0.40.0) (2026-02-26)
4
+
5
+ ### 代码重构
6
+
7
+ * **cli:** 从配置文件读取扩展依赖,自动同步到 .spaceflow/package.json ([0f3a0ae](https://github.com/Lydanne/spaceflow/commit/0f3a0ae3f1e580b6fed627e29caf55d8207ece14))
8
+ * **cli:** 将 .env 加载提前至主流程最开始,确保子进程启动前环境变量已就绪 ([8851359](https://github.com/Lydanne/spaceflow/commit/88513596b52299c2f8262548fa60ec89d1c466f4))
9
+ * **cli:** 将 .spaceflow/bin/ 添加到 .gitignore,移除静态生成的入口文件 ([df01d2d](https://github.com/Lydanne/spaceflow/commit/df01d2d6a8dc647d8b067e3f529b0967b2a6eabd))
10
+ * **cli:** 改用 dynamic import 加载扩展,确保 i18n 在扩展模块执行前初始化 ([926286d](https://github.com/Lydanne/spaceflow/commit/926286d98d867a7521e7943e15d62952df35c017))
11
+ * **cli:** 重构配置和 .env 文件查找逻辑,支持从 cwd 向上遍历目录树 ([62a381b](https://github.com/Lydanne/spaceflow/commit/62a381bac340033ce0ff9c39afca82d7f8f20311))
12
+ * **config:** 将 .env 加载逻辑迁移至 shared 包,并在 CLI 壳子阶段提前加载 ([4c6b825](https://github.com/Lydanne/spaceflow/commit/4c6b825d44a98d1fec92ed6a4e17b74a79f7206d))
13
+ * **core:** 移除 ConfigReaderService,统一使用 IConfigReader 接口 ([ea9ed2b](https://github.com/Lydanne/spaceflow/commit/ea9ed2b9d35886f768eac9c6d1a50ca4fc79b67d))
14
+ * **core:** 重构 CLI 架构,将运行时逻辑迁移至 Core 包 ([6539795](https://github.com/Lydanne/spaceflow/commit/653979503d720c8a37f1731044e3c65ac2dd6e1c))
15
+ * **core:** 重构 i18n 模块结构,统一导出路径至 cli-runtime/i18n ([b49ae95](https://github.com/Lydanne/spaceflow/commit/b49ae95cf99a41a91f9018e141afb5bbfb6b8884))
16
+ * **mcp:** 移除重复的扩展加载逻辑,新增 TTY 检测避免手动运行时阻塞 ([51fb35f](https://github.com/Lydanne/spaceflow/commit/51fb35fab28c11cf8d297d7950c31a60bc4c4e2a))
17
+ * 调整构建顺序,优先构建 shared 包并排除其重复构建 ([d7cd392](https://github.com/Lydanne/spaceflow/commit/d7cd392ed6578acb1e6ee85ae2097d92d81e5efb))
18
+
19
+ ### 其他修改
20
+
21
+ * **cli:** released version 0.30.0 [no ci] ([7af2925](https://github.com/Lydanne/spaceflow/commit/7af292524349effcfc85a26cf3285dba7726b441))
22
+ * **core:** released version 0.9.0 [no ci] ([e4bd091](https://github.com/Lydanne/spaceflow/commit/e4bd091c3f3cb4ae675f4e594d0c651cea481bc5))
23
+ * **publish:** released version 0.32.0 [no ci] ([77a2800](https://github.com/Lydanne/spaceflow/commit/77a2800d9b001ebd2b502db59c9a5994e54665c9))
24
+ * **review-summary:** released version 0.9.0 [no ci] ([c1a2322](https://github.com/Lydanne/spaceflow/commit/c1a2322bb7535d15c63251ea515ee21ea7a4e1bf))
25
+ * **scripts:** released version 0.9.0 [no ci] ([8db4c68](https://github.com/Lydanne/spaceflow/commit/8db4c681b6a00bb9717f05aa809bb4e13bbb7e53))
26
+ * **shared:** released version 0.1.0 [no ci] ([243e31d](https://github.com/Lydanne/spaceflow/commit/243e31de49dbde605d5a16ec9f0d589792b9cc30))
27
+ * **shell:** released version 0.9.0 [no ci] ([b161fe1](https://github.com/Lydanne/spaceflow/commit/b161fe17aec13f59f0dbc04a7a2d392ba6740cca))
28
+
3
29
  ## [0.39.0](https://github.com/Lydanne/spaceflow/compare/@spaceflow/review@0.38.0...@spaceflow/review@0.39.0) (2026-02-26)
4
30
 
5
31
  ### 修复BUG
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spaceflow/review",
3
- "version": "0.40.0",
3
+ "version": "0.41.0",
4
4
  "description": "Spaceflow 代码审查插件,使用 LLM 对 PR 代码进行自动审查",
5
5
  "license": "MIT",
6
6
  "author": "Lydanne",
@@ -25,10 +25,10 @@
25
25
  "@vitest/coverage-v8": "^4.0.18",
26
26
  "unplugin-swc": "^1.5.9",
27
27
  "vitest": "^4.0.18",
28
- "@spaceflow/cli": "0.30.0"
28
+ "@spaceflow/cli": "0.31.0"
29
29
  },
30
30
  "peerDependencies": {
31
- "@spaceflow/core": "0.9.0"
31
+ "@spaceflow/core": "0.10.0"
32
32
  },
33
33
  "spaceflow": {
34
34
  "type": "flow",
package/src/README.md CHANGED
@@ -1,14 +1,12 @@
1
- # Review 模块
1
+ # Review 扩展
2
2
 
3
- Review 是 spaceflow 的核心模块,提供基于 LLM 的自动化代码审查功能。支持在 GitHub Actions CI 环境中运行,也可在本地命令行使用。
3
+ Review 是 Spaceflow 的核心扩展,提供基于 LLM 的自动化代码审查功能。支持在 GitHub Actions CI 环境中运行,也可在本地命令行使用。
4
4
 
5
5
  ## 目录结构
6
6
 
7
7
  ```text
8
- review/
9
- ├── index.ts # 模块导出入口
10
- ├── review.module.ts # NestJS 模块定义
11
- ├── review.command.ts # CLI 命令定义
8
+ review/src/
9
+ ├── index.ts # Extension 入口(defineExtension)
12
10
  ├── review.service.ts # 核心审查服务
13
11
  ├── review.service.spec.ts # 审查服务单元测试
14
12
  ├── issue-verify.service.ts # 历史问题验证服务
@@ -19,17 +17,16 @@ review/
19
17
  ├── parse-title-options.spec.ts # 标题解析单元测试
20
18
  ```
21
19
 
22
- ## 模块依赖
20
+ ## 依赖的共享模块
23
21
 
24
22
  ```text
25
- ReviewModule
26
- ├── ConfigModule # 配置管理
27
- ├── GitProviderModule # Git Provider 适配器
28
- ├── ClaudeSetupModule # Claude CLI 配置
29
- ├── ReviewSpecModule # 审查规范加载
30
- ├── ReviewReportModule # 审查报告格式化
31
- ├── GitSdkModule # Git 命令封装
32
- └── LlmProxyModule # LLM 统一代理(支持 OpenAI/Claude/Gemini)
23
+ review extension
24
+ ├── GitProviderService # Git 平台适配器
25
+ ├── GitSdkService # Git 命令封装
26
+ ├── LlmProxyService # LLM 统一代理(OpenAI / Claude)
27
+ ├── LoggerService # 日志系统
28
+ ├── StorageService # 缓存存储
29
+ └── ParallelService # 并行执行
33
30
  ```
34
31
 
35
32
  ## 核心功能
@@ -234,50 +231,24 @@ feat: 添加新功能 [/ai-review -l openai -v 2]
234
231
 
235
232
  ## 配置项
236
233
 
237
- 在 `spaceflow.json` 中配置:
238
-
239
- ```javascript
240
- module.exports = {
241
- review: {
242
- // LLM 模式:claude-code, openai, gemini
243
- llmMode: "openai",
244
-
245
- // 文件过滤模式
246
- includes: ["**/*.ts", "**/*.js"],
247
-
248
- // 是否验证历史问题
249
- verifyFixes: true,
250
- verifyFixesConcurrency: 10,
251
-
252
- // 删除代码分析
253
- analyzeDeletions: false,
254
- deletionAnalysisMode: "openai",
255
-
256
- // 并发和超时配置
257
- concurrency: 5,
258
- timeout: 60000,
259
- retries: 0,
260
- retryDelay: 1000,
261
-
262
- // 是否生成 PR 描述
263
- generateDescription: false,
264
-
265
- // 是否启用行级评论
266
- lineComments: false,
267
-
268
- // OpenAI 配置
269
- openai: {
270
- apiKey: "sk-xxx",
271
- baseUrl: "https://api.openai.com/v1",
272
- model: "gpt-4o",
273
- },
274
-
275
- // Claude Code 配置
276
- claudeCode: {
277
- // Claude CLI 配置
278
- },
279
- },
280
- };
234
+ `.spaceflowrc` 或 `.spaceflow/spaceflow.json` 中配置 `review` 字段:
235
+
236
+ ```json
237
+ {
238
+ "review": {
239
+ "includes": ["*/**/*.ts", "!*/**/*.spec.*", "!*/**/*.config.*"],
240
+ "references": ["./references"],
241
+ "generateDescription": true,
242
+ "autoUpdatePrTitle": false,
243
+ "lineComments": true,
244
+ "verifyFixes": true,
245
+ "analyzeDeletions": false,
246
+ "deletionAnalysisMode": "open-code",
247
+ "concurrency": 10,
248
+ "retries": 3,
249
+ "retryDelay": 1000
250
+ }
251
+ }
281
252
  ```
282
253
 
283
254
  ## 使用示例
@@ -297,7 +268,7 @@ jobs:
297
268
  steps:
298
269
  - uses: actions/checkout@v4
299
270
  - name: Review
300
- run: npx spaceflow review --ci -l openai
271
+ run: pnpm spaceflow review --ci -l openai
301
272
  env:
302
273
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
303
274
  ```
@@ -306,26 +277,26 @@ jobs:
306
277
 
307
278
  ```bash
308
279
  # 审查 PR
309
- npx spaceflow review -p 123 -l openai
280
+ spaceflow review -p 123 -l openai
310
281
 
311
282
  # 审查两个分支之间的差异
312
- npx spaceflow review -b main --head feature/xxx -l openai
283
+ spaceflow review -b main --head feature/xxx -l openai
313
284
 
314
285
  # 仅审查指定文件
315
- npx spaceflow review -f src/app.ts -l openai
286
+ spaceflow review -f src/app.ts -l openai
316
287
 
317
288
  # 详细输出
318
- npx spaceflow review -p 123 -l openai -v 2
289
+ spaceflow review -p 123 -l openai -vv
319
290
 
320
291
  # 仅分析删除代码
321
- npx spaceflow review -p 123 --deletion-only -l openai
292
+ spaceflow review -p 123 --deletion-only -l openai
322
293
  ```
323
294
 
324
295
  ## 审查规范
325
296
 
326
- 审查规范文件位于 `.spaceflow/review-spec/` 目录,使用 Markdown 格式定义规则。
297
+ 审查规范文件通过配置文件的 `review.references` 字段指定,支持本地目录和远程 Git 仓库 URL。
327
298
 
328
- 详见 [ReviewSpec 模块文档](../../shared/review-spec/README.md)。
299
+ 详见 [Review Spec 规范](/reference/review-spec)。
329
300
 
330
301
  ## 输出格式
331
302