@spaceflow/review 0.38.0 → 0.40.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 +28 -0
- package/dist/index.js +5 -8
- package/package.json +3 -3
- package/src/index.ts +1 -9
- package/src/review.service.spec.ts +2 -7
- package/src/review.service.ts +4 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.39.0](https://github.com/Lydanne/spaceflow/compare/@spaceflow/review@0.38.0...@spaceflow/review@0.39.0) (2026-02-26)
|
|
4
|
+
|
|
5
|
+
### 修复BUG
|
|
6
|
+
|
|
7
|
+
* **cli:** 自动安装扩展时根据命令行参数动态设置 verbose 级别 ([d2da6f5](https://github.com/Lydanne/spaceflow/commit/d2da6f5eb30425e48bb4fd924c73bb9237a437ab))
|
|
8
|
+
|
|
9
|
+
### 其他修改
|
|
10
|
+
|
|
11
|
+
* **cli:** released version 0.29.0 [no ci] ([5fd87d3](https://github.com/Lydanne/spaceflow/commit/5fd87d31511d13d4937b1b1a247ad8a322d6fc9c))
|
|
12
|
+
* **publish:** released version 0.31.0 [no ci] ([e928d60](https://github.com/Lydanne/spaceflow/commit/e928d6061e05c03fc92303a246b2563a5100740b))
|
|
13
|
+
* **review-summary:** released version 0.8.0 [no ci] ([0e73a97](https://github.com/Lydanne/spaceflow/commit/0e73a97b035692b0fe7f59e36585cffccf6c6854))
|
|
14
|
+
* **scripts:** released version 0.8.0 [no ci] ([efea246](https://github.com/Lydanne/spaceflow/commit/efea246fe1bbd8815c7af44e8fd40df57a0219d6))
|
|
15
|
+
* **shell:** released version 0.8.0 [no ci] ([607b93b](https://github.com/Lydanne/spaceflow/commit/607b93bd911e3da102a73dd4513a4733b40c8672))
|
|
16
|
+
|
|
17
|
+
## [0.38.0](https://github.com/Lydanne/spaceflow/compare/@spaceflow/review@0.37.0...@spaceflow/review@0.38.0) (2026-02-26)
|
|
18
|
+
|
|
19
|
+
### 修复BUG
|
|
20
|
+
|
|
21
|
+
* **cli:** 修复扩展自动安装逻辑,优化 npm 包名解析 ([0271dd4](https://github.com/Lydanne/spaceflow/commit/0271dd48e0169ae5055cfab28e0656e777de10f4))
|
|
22
|
+
|
|
23
|
+
### 其他修改
|
|
24
|
+
|
|
25
|
+
* **cli:** released version 0.28.0 [no ci] ([944de26](https://github.com/Lydanne/spaceflow/commit/944de26607e91123818bad469ee7b7487473de5f))
|
|
26
|
+
* **publish:** released version 0.30.0 [no ci] ([2010489](https://github.com/Lydanne/spaceflow/commit/2010489a0d3cddb9ada1c0fc4e833cdeb0c1e706))
|
|
27
|
+
* **review-summary:** released version 0.7.0 [no ci] ([21aced5](https://github.com/Lydanne/spaceflow/commit/21aced5a10fd522122e5f2c6f4ce3a318b80dff2))
|
|
28
|
+
* **scripts:** released version 0.7.0 [no ci] ([6392c03](https://github.com/Lydanne/spaceflow/commit/6392c03e2c8dc9376ae24baaa3ef3fc62be9c762))
|
|
29
|
+
* **shell:** released version 0.7.0 [no ci] ([da9dd6b](https://github.com/Lydanne/spaceflow/commit/da9dd6b07b0cfc807a20fecaa84418c90fc97b7b))
|
|
30
|
+
|
|
3
31
|
## [0.37.0](https://github.com/Lydanne/spaceflow/compare/@spaceflow/review@0.36.0...@spaceflow/review@0.37.0) (2026-02-26)
|
|
4
32
|
|
|
5
33
|
### 代码重构
|
package/dist/index.js
CHANGED
|
@@ -1009,7 +1009,6 @@ const REVIEW_SCHEMA = {
|
|
|
1009
1009
|
class ReviewService {
|
|
1010
1010
|
gitProvider;
|
|
1011
1011
|
config;
|
|
1012
|
-
configReader;
|
|
1013
1012
|
reviewSpecService;
|
|
1014
1013
|
llmProxyService;
|
|
1015
1014
|
reviewReportService;
|
|
@@ -1017,10 +1016,9 @@ class ReviewService {
|
|
|
1017
1016
|
deletionImpactService;
|
|
1018
1017
|
gitSdk;
|
|
1019
1018
|
llmJsonPut;
|
|
1020
|
-
constructor(gitProvider, config,
|
|
1019
|
+
constructor(gitProvider, config, reviewSpecService, llmProxyService, reviewReportService, issueVerifyService, deletionImpactService, gitSdk){
|
|
1021
1020
|
this.gitProvider = gitProvider;
|
|
1022
1021
|
this.config = config;
|
|
1023
|
-
this.configReader = configReader;
|
|
1024
1022
|
this.reviewSpecService = reviewSpecService;
|
|
1025
1023
|
this.llmProxyService = llmProxyService;
|
|
1026
1024
|
this.reviewReportService = reviewReportService;
|
|
@@ -1049,7 +1047,7 @@ class ReviewService {
|
|
|
1049
1047
|
});
|
|
1050
1048
|
}
|
|
1051
1049
|
async getContextFromEnv(options) {
|
|
1052
|
-
const reviewConf = this.
|
|
1050
|
+
const reviewConf = this.config.getPluginConfig("review");
|
|
1053
1051
|
const ciConf = this.config.get("ci");
|
|
1054
1052
|
const repository = ciConf?.repository;
|
|
1055
1053
|
if (options.ci) {
|
|
@@ -1476,7 +1474,7 @@ class ReviewService {
|
|
|
1476
1474
|
}
|
|
1477
1475
|
// 如果文件有变更,将该文件的历史问题标记为无效
|
|
1478
1476
|
// 简化策略:避免复杂的行号更新逻辑
|
|
1479
|
-
const reviewConf = this.
|
|
1477
|
+
const reviewConf = this.config.getPluginConfig("review");
|
|
1480
1478
|
if (reviewConf.invalidateChangedFiles !== "off" && reviewConf.invalidateChangedFiles !== "keep") {
|
|
1481
1479
|
existingIssues = await this.invalidateIssuesForChangedFiles(existingIssues, pr?.head?.sha, owner, repo, verbose);
|
|
1482
1480
|
}
|
|
@@ -2413,7 +2411,7 @@ ${fileChanges || "无"}`;
|
|
|
2413
2411
|
}
|
|
2414
2412
|
async postOrUpdateReviewComment(owner, repo, prNumber, result, verbose) {
|
|
2415
2413
|
// 获取配置
|
|
2416
|
-
const reviewConf = this.
|
|
2414
|
+
const reviewConf = this.config.getPluginConfig("review");
|
|
2417
2415
|
// 如果配置启用且有 AI 生成的标题,只在第一轮审查时更新 PR 标题
|
|
2418
2416
|
if (reviewConf.autoUpdatePrTitle && result.title && result.round === 1) {
|
|
2419
2417
|
try {
|
|
@@ -5203,14 +5201,13 @@ const extension = defineExtension({
|
|
|
5203
5201
|
process.exit(1);
|
|
5204
5202
|
}
|
|
5205
5203
|
const gitProvider = ctx.getService("gitProvider");
|
|
5206
|
-
const configReader = ctx.getService("config");
|
|
5207
5204
|
const llmProxy = ctx.hasService("llmProxy") ? ctx.getService("llmProxy") : undefined;
|
|
5208
5205
|
const gitSdk = ctx.hasService("gitSdk") ? ctx.getService("gitSdk") : undefined;
|
|
5209
5206
|
const reviewSpecService = new ReviewSpecService(gitProvider);
|
|
5210
5207
|
const reviewReportService = new ReviewReportService();
|
|
5211
5208
|
const issueVerifyService = new IssueVerifyService(llmProxy, reviewSpecService);
|
|
5212
5209
|
const deletionImpactService = new DeletionImpactService(llmProxy, gitProvider);
|
|
5213
|
-
const reviewService = new ReviewService(gitProvider, ctx.config,
|
|
5210
|
+
const reviewService = new ReviewService(gitProvider, ctx.config, reviewSpecService, llmProxy, reviewReportService, issueVerifyService, deletionImpactService, gitSdk);
|
|
5214
5211
|
const reviewOptions = {
|
|
5215
5212
|
dryRun: !!options?.dryRun,
|
|
5216
5213
|
ci: !!options?.ci,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spaceflow/review",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.40.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.
|
|
28
|
+
"@spaceflow/cli": "0.30.0"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"@spaceflow/core": "0.
|
|
31
|
+
"@spaceflow/core": "0.9.0"
|
|
32
32
|
},
|
|
33
33
|
"spaceflow": {
|
|
34
34
|
"type": "flow",
|
package/src/index.ts
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import "./locales";
|
|
2
2
|
import { defineExtension, t } from "@spaceflow/core";
|
|
3
|
-
import type {
|
|
4
|
-
GitProviderService,
|
|
5
|
-
ConfigReaderService,
|
|
6
|
-
LlmProxyService,
|
|
7
|
-
GitSdkService,
|
|
8
|
-
LLMMode,
|
|
9
|
-
} from "@spaceflow/core";
|
|
3
|
+
import type { GitProviderService, LlmProxyService, GitSdkService, LLMMode } from "@spaceflow/core";
|
|
10
4
|
import { parseVerbose } from "@spaceflow/core";
|
|
11
5
|
import { reviewSchema, type AnalyzeDeletionsMode } from "./review.config";
|
|
12
6
|
import { ReviewService } from "./review.service";
|
|
@@ -65,7 +59,6 @@ export const extension = defineExtension({
|
|
|
65
59
|
}
|
|
66
60
|
|
|
67
61
|
const gitProvider = ctx.getService<GitProviderService>("gitProvider");
|
|
68
|
-
const configReader = ctx.getService<ConfigReaderService>("config");
|
|
69
62
|
const llmProxy = ctx.hasService("llmProxy")
|
|
70
63
|
? ctx.getService<LlmProxyService>("llmProxy")
|
|
71
64
|
: (undefined as unknown as LlmProxyService);
|
|
@@ -81,7 +74,6 @@ export const extension = defineExtension({
|
|
|
81
74
|
const reviewService = new ReviewService(
|
|
82
75
|
gitProvider,
|
|
83
76
|
ctx.config,
|
|
84
|
-
configReader,
|
|
85
77
|
reviewSpecService,
|
|
86
78
|
llmProxy,
|
|
87
79
|
reviewReportService,
|
|
@@ -49,7 +49,6 @@ describe("ReviewService", () => {
|
|
|
49
49
|
let mockDeletionImpactService: any;
|
|
50
50
|
let mockGitSdkService: any;
|
|
51
51
|
let mockLlmProxyService: any;
|
|
52
|
-
let mockConfigReaderService: any;
|
|
53
52
|
|
|
54
53
|
beforeEach(() => {
|
|
55
54
|
vi.clearAllMocks();
|
|
@@ -80,6 +79,8 @@ describe("ReviewService", () => {
|
|
|
80
79
|
|
|
81
80
|
configService = {
|
|
82
81
|
get: vi.fn(),
|
|
82
|
+
getPluginConfig: vi.fn().mockReturnValue({}),
|
|
83
|
+
registerSchema: vi.fn(),
|
|
83
84
|
};
|
|
84
85
|
|
|
85
86
|
mockReviewSpecService = {
|
|
@@ -140,15 +141,9 @@ describe("ReviewService", () => {
|
|
|
140
141
|
getAvailableAdapters: vi.fn().mockReturnValue(["claude-code", "openai"]),
|
|
141
142
|
};
|
|
142
143
|
|
|
143
|
-
mockConfigReaderService = {
|
|
144
|
-
getPluginConfig: vi.fn().mockReturnValue({}),
|
|
145
|
-
getSystemConfig: vi.fn().mockReturnValue({}),
|
|
146
|
-
};
|
|
147
|
-
|
|
148
144
|
service = new ReviewService(
|
|
149
145
|
gitProvider as any,
|
|
150
146
|
configService as any,
|
|
151
|
-
mockConfigReaderService as any,
|
|
152
147
|
mockReviewSpecService as any,
|
|
153
148
|
mockLlmProxyService as any,
|
|
154
149
|
mockReviewReportService as any,
|
package/src/review.service.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
|
-
ConfigReaderService,
|
|
3
2
|
GitProviderService,
|
|
4
3
|
PullRequest,
|
|
5
4
|
PullRequestCommit,
|
|
6
5
|
ChangedFile,
|
|
7
6
|
CreatePullReviewComment,
|
|
8
7
|
REVIEW_STATE,
|
|
9
|
-
CiConfig,
|
|
8
|
+
type CiConfig,
|
|
10
9
|
type LLMMode,
|
|
11
10
|
LlmProxyService,
|
|
12
11
|
logStreamEvent,
|
|
@@ -145,7 +144,6 @@ export class ReviewService {
|
|
|
145
144
|
constructor(
|
|
146
145
|
protected readonly gitProvider: GitProviderService,
|
|
147
146
|
protected readonly config: IConfigReader,
|
|
148
|
-
protected readonly configReader: ConfigReaderService,
|
|
149
147
|
protected readonly reviewSpecService: ReviewSpecService,
|
|
150
148
|
protected readonly llmProxyService: LlmProxyService,
|
|
151
149
|
protected readonly reviewReportService: ReviewReportService,
|
|
@@ -171,7 +169,7 @@ export class ReviewService {
|
|
|
171
169
|
}
|
|
172
170
|
|
|
173
171
|
async getContextFromEnv(options: ReviewOptions): Promise<ReviewContext> {
|
|
174
|
-
const reviewConf = this.
|
|
172
|
+
const reviewConf = this.config.getPluginConfig<ReviewConfig>("review");
|
|
175
173
|
const ciConf = this.config.get<CiConfig>("ci");
|
|
176
174
|
const repository = ciConf?.repository;
|
|
177
175
|
|
|
@@ -705,7 +703,7 @@ export class ReviewService {
|
|
|
705
703
|
|
|
706
704
|
// 如果文件有变更,将该文件的历史问题标记为无效
|
|
707
705
|
// 简化策略:避免复杂的行号更新逻辑
|
|
708
|
-
const reviewConf = this.
|
|
706
|
+
const reviewConf = this.config.getPluginConfig<ReviewConfig>("review");
|
|
709
707
|
if (
|
|
710
708
|
reviewConf.invalidateChangedFiles !== "off" &&
|
|
711
709
|
reviewConf.invalidateChangedFiles !== "keep"
|
|
@@ -1864,7 +1862,7 @@ ${fileChanges || "无"}`;
|
|
|
1864
1862
|
verbose?: VerboseLevel,
|
|
1865
1863
|
): Promise<void> {
|
|
1866
1864
|
// 获取配置
|
|
1867
|
-
const reviewConf = this.
|
|
1865
|
+
const reviewConf = this.config.getPluginConfig<ReviewConfig>("review");
|
|
1868
1866
|
|
|
1869
1867
|
// 如果配置启用且有 AI 生成的标题,只在第一轮审查时更新 PR 标题
|
|
1870
1868
|
if (reviewConf.autoUpdatePrTitle && result.title && result.round === 1) {
|