@spaceflow/review 0.57.0 → 0.58.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,36 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.57.0](https://github.com/Lydanne/spaceflow/compare/@spaceflow/review@0.56.0...@spaceflow/review@0.57.0) (2026-03-02)
4
+
5
+ ### 新特性
6
+
7
+ * **core:** Gitea适配器支持通过标签名称创建Issue ([cf10eda](https://github.com/Lydanne/spaceflow/commit/cf10eda5d025c560cc0d8e3826dad40716020d5c))
8
+ * **review-summary:** commit-based 评分新增修复问题加分机制,支持从 review 模块精确提取问题统计 ([304bf81](https://github.com/Lydanne/spaceflow/commit/304bf81ab475b280ab5f4011159bc697861bddf6))
9
+ * **review-summary:** 支持为周期统计报告 Issue 配置自定义标签 ([df1cc61](https://github.com/Lydanne/spaceflow/commit/df1cc61167851ff7106104914319f43f73ba8902))
10
+ * **review-summary:** 支持通过配置文件自定义评分权重 ([53e1a37](https://github.com/Lydanne/spaceflow/commit/53e1a371288aea6ceac63b03fda99eea1739be4b))
11
+ * **review-summary:** 新增 commit-based 评分策略,支持按有效 commit 累计计分 ([111c0d6](https://github.com/Lydanne/spaceflow/commit/111c0d6b9d87d12096e0edb69a11eceff55b79c1))
12
+ * **review:** 优化问题统计展示,按 severity 分级显示 error/warn 数量 ([bcb2608](https://github.com/Lydanne/spaceflow/commit/bcb26086589a67e815db075f3001209904572926))
13
+ * **review:** 新增解决率统计指标,区分修复率和解决率的计算维度 ([436541f](https://github.com/Lydanne/spaceflow/commit/436541fce605319da562445a81242a8feb257df9))
14
+
15
+ ### 修复BUG
16
+
17
+ * **review:** 修正 PR 评论标题中的 emoji 显示问题 ([bcdc946](https://github.com/Lydanne/spaceflow/commit/bcdc9467bf7970c9acd3ea00303bcae5eaff131f))
18
+
19
+ ### 代码重构
20
+
21
+ * **review:** 抽取规则加载和问题验证逻辑为独立方法,优化代码复用性 ([7ea02ba](https://github.com/Lydanne/spaceflow/commit/7ea02ba86e369bc130c69c561195634072cc060a))
22
+
23
+ ### 文档更新
24
+
25
+ * **docs:** 为 review-summary 命令文档补充 Issue 输出配置说明 ([196fa94](https://github.com/Lydanne/spaceflow/commit/196fa94ad1ed2dbadbdcb332ef26cf1fe7fcd8d7))
26
+ * **review-summary:** 完善文档,新增时间预设、评分算法及输出示例说明 ([fb04685](https://github.com/Lydanne/spaceflow/commit/fb04685dde4157f0a1a2f8edaf1fb3c125280e27))
27
+ * **review:** 完善 review 命令文档,新增审查流程、多轮审查、问题生命周期等核心机制说明 ([d6b2a20](https://github.com/Lydanne/spaceflow/commit/d6b2a20802ab98e5ddb01937c0fe8b268c403c6f))
28
+
29
+ ### 其他修改
30
+
31
+ * **core:** released version 0.20.0 [no ci] ([b7ed239](https://github.com/Lydanne/spaceflow/commit/b7ed239455244cd96f2b59ef67886dd0bfc057a8))
32
+ * **publish:** released version 0.44.0 [no ci] ([5b29159](https://github.com/Lydanne/spaceflow/commit/5b29159b2f0129d2ce81329cf48734d3d56b226e))
33
+
3
34
  ## [0.56.0](https://github.com/Lydanne/spaceflow/compare/@spaceflow/review@0.55.0...@spaceflow/review@0.56.0) (2026-03-02)
4
35
 
5
36
  ### 新特性
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.58.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.21.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
  }