@spaceflow/review 0.57.0 → 0.59.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,70 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.58.0](https://github.com/Lydanne/spaceflow/compare/@spaceflow/review@0.57.0...@spaceflow/review@0.58.0) (2026-03-02)
4
+
5
+ ### 新特性
6
+
7
+ * **actions:** 增强对 Gitea 平台的环境变量支持 ([21ba3da](https://github.com/Lydanne/spaceflow/commit/21ba3daa182083ecaec0113de91caf2ab1068000))
8
+ * **actions:** 支持 Gitea 作为 Git Provider ([4c88b36](https://github.com/Lydanne/spaceflow/commit/4c88b36d97ab49a322bac571385b0e57029676ff))
9
+ * **core:** 增强对 Gitea 平台的支持并修复类型转换 ([bfbb45c](https://github.com/Lydanne/spaceflow/commit/bfbb45c521035c80f0e81f5572d5aa1b554405f7))
10
+ * **publish:** 支持 Gitea 环境变量作为 CI 配置来源 ([cd1ba77](https://github.com/Lydanne/spaceflow/commit/cd1ba778617731ef85f9851883122175a99d72ac))
11
+ * **review-summary:** 新增 defect-rate 缺陷率评分策略 ([2777f4d](https://github.com/Lydanne/spaceflow/commit/2777f4da6d364cbc801792f4fa7ac6323da5e1bc))
12
+ * **review-summary:** 新增 issue-based 评分策略并更新文档 ([b6d923e](https://github.com/Lydanne/spaceflow/commit/b6d923e060aafd0b298a39d6fdc3e2f76facf1f3))
13
+ * **review:** 支持从 Gitea Actions 事件文件解析 PR 编号 ([09e2e58](https://github.com/Lydanne/spaceflow/commit/09e2e58d84f773b8a3184feb73b90cb110993ebd))
14
+
15
+ ### 文档更新
16
+
17
+ * **docs:** 更新 review-summary 命令的 CI 配置示例 ([8b2b2c5](https://github.com/Lydanne/spaceflow/commit/8b2b2c55ed497619cbb91bd4fd2e5124b6f5ac37))
18
+ * **docs:** 更新 review-summary 命令的 CI 集成示例 ([60c5b70](https://github.com/Lydanne/spaceflow/commit/60c5b70695aa6a4c9cae1e3936670b34d5486792))
19
+ * **docs:** 更新环境变量参考文档,增加 GitLab 支持并优化 Gitea 说明 ([a02f8e0](https://github.com/Lydanne/spaceflow/commit/a02f8e0309368334bc77a331f65338435657eddb))
20
+ * **review-summary:** 更新错误信息以支持 Gitea 环境变量 ([cd02818](https://github.com/Lydanne/spaceflow/commit/cd028183fe7e14d993566e8dc49849b07d2540d9))
21
+ * **scripts:** 更新错误信息以支持 Gitea 环境变量 ([9a9d7f2](https://github.com/Lydanne/spaceflow/commit/9a9d7f20a63bea4cc13d284ed41bc9c4f4aa6595))
22
+ * **shell:** 更新错误信息以支持 Gitea 环境变量 ([72c51d7](https://github.com/Lydanne/spaceflow/commit/72c51d792c140d44d8aa3cb05666de72d170a185))
23
+ * 修复 GitHub Actions 配置示例的 Markdown 渲染问题 ([01daec5](https://github.com/Lydanne/spaceflow/commit/01daec551f2e23ab70357f88b7789897922064a7))
24
+
25
+ ### 测试用例
26
+
27
+ * **core:** 修复测试用例中的导入和模拟函数实现 ([0137d4b](https://github.com/Lydanne/spaceflow/commit/0137d4b400f272ce7f7ba74fc5b37fcc453ed717))
28
+
29
+ ### 其他修改
30
+
31
+ * **core:** released version 0.21.0 [no ci] ([7fa4381](https://github.com/Lydanne/spaceflow/commit/7fa438124cc27316ad5f37d5cbacc848ebd3b9df))
32
+ * **publish:** released version 0.45.0 [no ci] ([9bd3bbe](https://github.com/Lydanne/spaceflow/commit/9bd3bbe725a3362f762a1407c6a92a993359dfe5))
33
+ * **review-summary:** released version 0.22.0 [no ci] ([e0fde59](https://github.com/Lydanne/spaceflow/commit/e0fde59b23109f8323bd247ab2c1f553812284e1))
34
+ * **scripts:** released version 0.22.0 [no ci] ([f482504](https://github.com/Lydanne/spaceflow/commit/f48250486906016b414a7b00aabac342c1399045))
35
+ * **shell:** released version 0.22.0 [no ci] ([e716369](https://github.com/Lydanne/spaceflow/commit/e716369f57bfa20e710d354245c54d3a80e701f4))
36
+
37
+ ## [0.57.0](https://github.com/Lydanne/spaceflow/compare/@spaceflow/review@0.56.0...@spaceflow/review@0.57.0) (2026-03-02)
38
+
39
+ ### 新特性
40
+
41
+ * **core:** Gitea适配器支持通过标签名称创建Issue ([cf10eda](https://github.com/Lydanne/spaceflow/commit/cf10eda5d025c560cc0d8e3826dad40716020d5c))
42
+ * **review-summary:** commit-based 评分新增修复问题加分机制,支持从 review 模块精确提取问题统计 ([304bf81](https://github.com/Lydanne/spaceflow/commit/304bf81ab475b280ab5f4011159bc697861bddf6))
43
+ * **review-summary:** 支持为周期统计报告 Issue 配置自定义标签 ([df1cc61](https://github.com/Lydanne/spaceflow/commit/df1cc61167851ff7106104914319f43f73ba8902))
44
+ * **review-summary:** 支持通过配置文件自定义评分权重 ([53e1a37](https://github.com/Lydanne/spaceflow/commit/53e1a371288aea6ceac63b03fda99eea1739be4b))
45
+ * **review-summary:** 新增 commit-based 评分策略,支持按有效 commit 累计计分 ([111c0d6](https://github.com/Lydanne/spaceflow/commit/111c0d6b9d87d12096e0edb69a11eceff55b79c1))
46
+ * **review:** 优化问题统计展示,按 severity 分级显示 error/warn 数量 ([bcb2608](https://github.com/Lydanne/spaceflow/commit/bcb26086589a67e815db075f3001209904572926))
47
+ * **review:** 新增解决率统计指标,区分修复率和解决率的计算维度 ([436541f](https://github.com/Lydanne/spaceflow/commit/436541fce605319da562445a81242a8feb257df9))
48
+
49
+ ### 修复BUG
50
+
51
+ * **review:** 修正 PR 评论标题中的 emoji 显示问题 ([bcdc946](https://github.com/Lydanne/spaceflow/commit/bcdc9467bf7970c9acd3ea00303bcae5eaff131f))
52
+
53
+ ### 代码重构
54
+
55
+ * **review:** 抽取规则加载和问题验证逻辑为独立方法,优化代码复用性 ([7ea02ba](https://github.com/Lydanne/spaceflow/commit/7ea02ba86e369bc130c69c561195634072cc060a))
56
+
57
+ ### 文档更新
58
+
59
+ * **docs:** 为 review-summary 命令文档补充 Issue 输出配置说明 ([196fa94](https://github.com/Lydanne/spaceflow/commit/196fa94ad1ed2dbadbdcb332ef26cf1fe7fcd8d7))
60
+ * **review-summary:** 完善文档,新增时间预设、评分算法及输出示例说明 ([fb04685](https://github.com/Lydanne/spaceflow/commit/fb04685dde4157f0a1a2f8edaf1fb3c125280e27))
61
+ * **review:** 完善 review 命令文档,新增审查流程、多轮审查、问题生命周期等核心机制说明 ([d6b2a20](https://github.com/Lydanne/spaceflow/commit/d6b2a20802ab98e5ddb01937c0fe8b268c403c6f))
62
+
63
+ ### 其他修改
64
+
65
+ * **core:** released version 0.20.0 [no ci] ([b7ed239](https://github.com/Lydanne/spaceflow/commit/b7ed239455244cd96f2b59ef67886dd0bfc057a8))
66
+ * **publish:** released version 0.44.0 [no ci] ([5b29159](https://github.com/Lydanne/spaceflow/commit/5b29159b2f0129d2ce81329cf48734d3d56b226e))
67
+
3
68
  ## [0.56.0](https://github.com/Lydanne/spaceflow/compare/@spaceflow/review@0.55.0...@spaceflow/review@0.56.0) (2026-03-02)
4
69
 
5
70
  ### 新特性
package/dist/index.js CHANGED
@@ -1976,11 +1976,11 @@ class ReviewService {
1976
1976
  }
1977
1977
  }
1978
1978
  /**
1979
- * 从 GitHub Actions 事件文件中解析 PR 编号
1980
- * 在 CI 环境中,GitHub Actions 会将事件信息写入 GITHUB_EVENT_PATH 指向的文件
1979
+ * 从 CI 事件文件中解析 PR 编号
1980
+ * 在 CI 环境中,GitHub/Gitea Actions 会将事件信息写入 GITHUB_EVENT_PATH / GITEA_EVENT_PATH 指向的文件
1981
1981
  * @returns PR 编号,如果无法解析则返回 undefined
1982
1982
  */ async getPrNumberFromEvent() {
1983
- const eventPath = process.env.GITHUB_EVENT_PATH;
1983
+ const eventPath = process.env.GITHUB_EVENT_PATH || process.env.GITEA_EVENT_PATH;
1984
1984
  if (!eventPath) {
1985
1985
  return undefined;
1986
1986
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spaceflow/review",
3
- "version": "0.57.0",
3
+ "version": "0.59.0",
4
4
  "description": "Spaceflow 代码审查插件,使用 LLM 对 PR 代码进行自动审查",
5
5
  "license": "MIT",
6
6
  "author": "Lydanne",
@@ -28,7 +28,7 @@
28
28
  "@spaceflow/cli": "0.38.0"
29
29
  },
30
30
  "peerDependencies": {
31
- "@spaceflow/core": "0.20.0"
31
+ "@spaceflow/core": "0.22.0"
32
32
  },
33
33
  "spaceflow": {
34
34
  "type": "flow",
@@ -528,13 +528,14 @@ describe("ReviewService", () => {
528
528
  process.env = originalEnv;
529
529
  });
530
530
 
531
- it("should return undefined if GITHUB_EVENT_PATH is not set", async () => {
531
+ it("should return undefined if GITHUB_EVENT_PATH and GITEA_EVENT_PATH are not set", async () => {
532
532
  delete process.env.GITHUB_EVENT_PATH;
533
+ delete process.env.GITEA_EVENT_PATH;
533
534
  const prNumber = await (service as any).getPrNumberFromEvent();
534
535
  expect(prNumber).toBeUndefined();
535
536
  });
536
537
 
537
- it("should parse prNumber from event file", async () => {
538
+ it("should parse prNumber from GITHUB_EVENT_PATH", async () => {
538
539
  const mockEventPath = "/tmp/event.json";
539
540
  process.env.GITHUB_EVENT_PATH = mockEventPath;
540
541
  const mockEventContent = JSON.stringify({ pull_request: { number: 456 } });
@@ -544,6 +545,18 @@ describe("ReviewService", () => {
544
545
  const prNumber = await (service as any).getPrNumberFromEvent();
545
546
  expect(prNumber).toBe(456);
546
547
  });
548
+
549
+ it("should parse prNumber from GITEA_EVENT_PATH when GITHUB_EVENT_PATH is not set", async () => {
550
+ delete process.env.GITHUB_EVENT_PATH;
551
+ const mockEventPath = "/tmp/gitea-event.json";
552
+ process.env.GITEA_EVENT_PATH = mockEventPath;
553
+ const mockEventContent = JSON.stringify({ pull_request: { number: 789 } });
554
+
555
+ (readFile as Mock).mockResolvedValue(mockEventContent);
556
+
557
+ const prNumber = await (service as any).getPrNumberFromEvent();
558
+ expect(prNumber).toBe(789);
559
+ });
547
560
  });
548
561
 
549
562
  describe("ReviewService.runLLMReview", () => {
@@ -337,12 +337,12 @@ export class ReviewService {
337
337
  }
338
338
 
339
339
  /**
340
- * 从 GitHub Actions 事件文件中解析 PR 编号
341
- * 在 CI 环境中,GitHub Actions 会将事件信息写入 GITHUB_EVENT_PATH 指向的文件
340
+ * 从 CI 事件文件中解析 PR 编号
341
+ * 在 CI 环境中,GitHub/Gitea Actions 会将事件信息写入 GITHUB_EVENT_PATH / GITEA_EVENT_PATH 指向的文件
342
342
  * @returns PR 编号,如果无法解析则返回 undefined
343
343
  */
344
344
  protected async getPrNumberFromEvent(): Promise<number | undefined> {
345
- const eventPath = process.env.GITHUB_EVENT_PATH;
345
+ const eventPath = process.env.GITHUB_EVENT_PATH || process.env.GITEA_EVENT_PATH;
346
346
  if (!eventPath) {
347
347
  return undefined;
348
348
  }