@spaceflow/review 0.72.0 → 0.74.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 +24 -0
- package/dist/index.js +19 -2
- package/package.json +1 -1
- package/src/review.service.ts +23 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.73.0](https://github.com/Lydanne/spaceflow/compare/@spaceflow/review@0.72.0...@spaceflow/review@0.73.0) (2026-04-03)
|
|
4
|
+
|
|
5
|
+
### 修复BUG
|
|
6
|
+
|
|
7
|
+
* **review:** 在 CI 模式下为 PR 提交 review 评论 ([39a9911](https://github.com/Lydanne/spaceflow/commit/39a9911ee356e54bd4a5b219905226b9f9b6322b))
|
|
8
|
+
|
|
9
|
+
### 其他修改
|
|
10
|
+
|
|
11
|
+
* **review-summary:** released version 0.41.0 [no ci] ([49ebc70](https://github.com/Lydanne/spaceflow/commit/49ebc707ef33ff231d8a44614b6640a07462edca))
|
|
12
|
+
* **scripts:** released version 0.30.0 [no ci] ([16cb023](https://github.com/Lydanne/spaceflow/commit/16cb02382f11d77bdc3cfc156932ebc5de6a9634))
|
|
13
|
+
* **shell:** released version 0.30.0 [no ci] ([a54bc46](https://github.com/Lydanne/spaceflow/commit/a54bc4679f9682f9e9b86b655a8aadfacddceb68))
|
|
14
|
+
|
|
15
|
+
## [0.72.0](https://github.com/Lydanne/spaceflow/compare/@spaceflow/review@0.71.0...@spaceflow/review@0.72.0) (2026-04-03)
|
|
16
|
+
|
|
17
|
+
### 修复BUG
|
|
18
|
+
|
|
19
|
+
* **review:** 为 skipDuplicateWorkflow 添加错误处理以应对权限不足问题 ([6d0292d](https://github.com/Lydanne/spaceflow/commit/6d0292d20b6eba790f594c555ceb18b75ebfe253))
|
|
20
|
+
|
|
21
|
+
### 其他修改
|
|
22
|
+
|
|
23
|
+
* **core:** released version 0.28.0 [no ci] ([6baebaa](https://github.com/Lydanne/spaceflow/commit/6baebaa4cd777b6f8babcb5d8a2f25c426f8da05))
|
|
24
|
+
* **publish:** released version 0.52.0 [no ci] ([bcbc2a9](https://github.com/Lydanne/spaceflow/commit/bcbc2a97e5bdedfd728330a33f19ec9172d80f40))
|
|
25
|
+
* **review-summary:** released version 0.40.0 [no ci] ([9c5c262](https://github.com/Lydanne/spaceflow/commit/9c5c26256984c9349def2801af6e77b7013e703f))
|
|
26
|
+
|
|
3
27
|
## [0.71.0](https://github.com/Lydanne/spaceflow/compare/@spaceflow/review@0.70.0...@spaceflow/review@0.71.0) (2026-04-02)
|
|
4
28
|
|
|
5
29
|
### 新特性
|
package/dist/index.js
CHANGED
|
@@ -2349,6 +2349,12 @@ class ReviewService {
|
|
|
2349
2349
|
if (shouldLog(verbose, 1)) {
|
|
2350
2350
|
console.log("✅ 没有需要审查的文件或规则");
|
|
2351
2351
|
}
|
|
2352
|
+
// 获取上一次的审查结果以计算正确的轮次
|
|
2353
|
+
let existingResult = null;
|
|
2354
|
+
if (ci && prNumber) {
|
|
2355
|
+
existingResult = await this.getExistingReviewResult(owner, repo, prNumber);
|
|
2356
|
+
}
|
|
2357
|
+
const currentRound = (existingResult?.round ?? 0) + 1;
|
|
2352
2358
|
// 即使没有适用的规则,也为每个变更文件生成摘要
|
|
2353
2359
|
const summary = changedFiles.filter((f)=>f.filename && f.status !== "deleted").map((f)=>({
|
|
2354
2360
|
file: f.filename,
|
|
@@ -2357,14 +2363,25 @@ class ReviewService {
|
|
|
2357
2363
|
summary: applicableSpecs.length === 0 ? "无适用的审查规则" : "已跳过"
|
|
2358
2364
|
}));
|
|
2359
2365
|
const prInfo = context.generateDescription && llmMode ? await this.generatePrDescription(commits, changedFiles, llmMode, undefined, verbose) : await this.buildFallbackDescription(commits, changedFiles);
|
|
2360
|
-
|
|
2366
|
+
const result = {
|
|
2361
2367
|
success: true,
|
|
2362
2368
|
title: prInfo.title,
|
|
2363
2369
|
description: prInfo.description,
|
|
2364
2370
|
issues: [],
|
|
2365
2371
|
summary,
|
|
2366
|
-
round:
|
|
2372
|
+
round: currentRound
|
|
2367
2373
|
};
|
|
2374
|
+
// CI 模式下也需要发送 review 评论
|
|
2375
|
+
if (ci && prNumber && !dryRun) {
|
|
2376
|
+
if (shouldLog(verbose, 1)) {
|
|
2377
|
+
console.log(`💬 提交 PR 评论...`);
|
|
2378
|
+
}
|
|
2379
|
+
await this.postOrUpdateReviewComment(owner, repo, prNumber, result, verbose, autoApprove);
|
|
2380
|
+
if (shouldLog(verbose, 1)) {
|
|
2381
|
+
console.log(`✅ 评论已提交`);
|
|
2382
|
+
}
|
|
2383
|
+
}
|
|
2384
|
+
return result;
|
|
2368
2385
|
}
|
|
2369
2386
|
const headSha = pr?.head?.sha || headRef || "HEAD";
|
|
2370
2387
|
const fileContents = await this.getFileContents(owner, repo, changedFiles, commits, headSha, prNumber, verbose, isLocalMode);
|
package/package.json
CHANGED
package/src/review.service.ts
CHANGED
|
@@ -699,6 +699,14 @@ export class ReviewService {
|
|
|
699
699
|
if (shouldLog(verbose, 1)) {
|
|
700
700
|
console.log("✅ 没有需要审查的文件或规则");
|
|
701
701
|
}
|
|
702
|
+
|
|
703
|
+
// 获取上一次的审查结果以计算正确的轮次
|
|
704
|
+
let existingResult: ReviewResult | null = null;
|
|
705
|
+
if (ci && prNumber) {
|
|
706
|
+
existingResult = await this.getExistingReviewResult(owner, repo, prNumber);
|
|
707
|
+
}
|
|
708
|
+
const currentRound = (existingResult?.round ?? 0) + 1;
|
|
709
|
+
|
|
702
710
|
// 即使没有适用的规则,也为每个变更文件生成摘要
|
|
703
711
|
const summary: FileSummary[] = changedFiles
|
|
704
712
|
.filter((f) => f.filename && f.status !== "deleted")
|
|
@@ -712,14 +720,27 @@ export class ReviewService {
|
|
|
712
720
|
context.generateDescription && llmMode
|
|
713
721
|
? await this.generatePrDescription(commits, changedFiles, llmMode, undefined, verbose)
|
|
714
722
|
: await this.buildFallbackDescription(commits, changedFiles);
|
|
715
|
-
|
|
723
|
+
const result: ReviewResult = {
|
|
716
724
|
success: true,
|
|
717
725
|
title: prInfo.title,
|
|
718
726
|
description: prInfo.description,
|
|
719
727
|
issues: [],
|
|
720
728
|
summary,
|
|
721
|
-
round:
|
|
729
|
+
round: currentRound,
|
|
722
730
|
};
|
|
731
|
+
|
|
732
|
+
// CI 模式下也需要发送 review 评论
|
|
733
|
+
if (ci && prNumber && !dryRun) {
|
|
734
|
+
if (shouldLog(verbose, 1)) {
|
|
735
|
+
console.log(`💬 提交 PR 评论...`);
|
|
736
|
+
}
|
|
737
|
+
await this.postOrUpdateReviewComment(owner, repo, prNumber, result, verbose, autoApprove);
|
|
738
|
+
if (shouldLog(verbose, 1)) {
|
|
739
|
+
console.log(`✅ 评论已提交`);
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
return result;
|
|
723
744
|
}
|
|
724
745
|
|
|
725
746
|
const headSha = pr?.head?.sha || headRef || "HEAD";
|