@spaceflow/review-summary 0.27.0 → 0.29.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 +38 -0
- package/package.json +3 -3
- package/src/review-summary.service.ts +23 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,43 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.28.0](https://github.com/Lydanne/spaceflow/compare/@spaceflow/review-summary@0.27.0...@spaceflow/review-summary@0.28.0) (2026-03-02)
|
|
4
|
+
|
|
5
|
+
### 代码重构
|
|
6
|
+
|
|
7
|
+
* **review:** 优化问题验证逻辑,将 resolved 状态纳入有效性判断 ([1e2302d](https://github.com/Lydanne/spaceflow/commit/1e2302d81cd0f653d606483ef6c9138143ca6d60))
|
|
8
|
+
|
|
9
|
+
### 代码格式
|
|
10
|
+
|
|
11
|
+
* 格式化代码并更新 Prettier 忽略规则 ([baed10e](https://github.com/Lydanne/spaceflow/commit/baed10e7cd91fda1285d7e2e0019d291cb563055))
|
|
12
|
+
|
|
13
|
+
### 其他修改
|
|
14
|
+
|
|
15
|
+
* **core:** released version 0.23.0 [no ci] ([07a2d7d](https://github.com/Lydanne/spaceflow/commit/07a2d7d51223aeb98161f91fa931b4cb63b03cda))
|
|
16
|
+
* **publish:** released version 0.47.0 [no ci] ([3f59345](https://github.com/Lydanne/spaceflow/commit/3f593450066c9138adac5b101edb8057a5de1ff6))
|
|
17
|
+
* **review:** released version 0.60.0 [no ci] ([a3d381c](https://github.com/Lydanne/spaceflow/commit/a3d381ced314e95135a0a13d4ee1ff1cb72b465d))
|
|
18
|
+
* **scripts:** released version 0.25.0 [no ci] ([88292c0](https://github.com/Lydanne/spaceflow/commit/88292c07b7787bcd4492c8b88cfb516b3e81d9be))
|
|
19
|
+
* **shell:** released version 0.25.0 [no ci] ([fc78e10](https://github.com/Lydanne/spaceflow/commit/fc78e10a0bab04d575867732b922a2a1989a594e))
|
|
20
|
+
|
|
21
|
+
## [0.27.0](https://github.com/Lydanne/spaceflow/compare/@spaceflow/review-summary@0.26.0...@spaceflow/review-summary@0.27.0) (2026-03-02)
|
|
22
|
+
|
|
23
|
+
### 代码重构
|
|
24
|
+
|
|
25
|
+
* **core:** 统一插件配置中的 'extensions' 为 'skills' ([50646a0](https://github.com/Lydanne/spaceflow/commit/50646a061f66ec6935c66199d78915b9d7896bd3))
|
|
26
|
+
|
|
27
|
+
### 文档更新
|
|
28
|
+
|
|
29
|
+
* **docs:** 统一扩展类型命名:extension 改为 skill ([96db479](https://github.com/Lydanne/spaceflow/commit/96db47948981c0c2b5860c2835f86dec77736cf0))
|
|
30
|
+
* 更新 MCP 架构为 Meta-tool 代理模式并统一导出类型命名 ([f60c53b](https://github.com/Lydanne/spaceflow/commit/f60c53b103f24e8a4123e4c4ec850885cb40f7d7))
|
|
31
|
+
* 简化 MCP 工具声明方式并完善扩展系统文档 ([9cdcab9](https://github.com/Lydanne/spaceflow/commit/9cdcab986559bd34c75e48b6c380c74516adb05c))
|
|
32
|
+
|
|
33
|
+
### 其他修改
|
|
34
|
+
|
|
35
|
+
* **core:** released version 0.22.0 [no ci] ([68aa47d](https://github.com/Lydanne/spaceflow/commit/68aa47df425eb9d1ceac1237fee3cc1b29de668f))
|
|
36
|
+
* **publish:** released version 0.46.0 [no ci] ([68ebfc3](https://github.com/Lydanne/spaceflow/commit/68ebfc32bfb5b39354947f08b73306b5f8512fdf))
|
|
37
|
+
* **review:** released version 0.59.0 [no ci] ([afb7e5c](https://github.com/Lydanne/spaceflow/commit/afb7e5c469820cb201e7f24ab47abfd33300668a))
|
|
38
|
+
* **scripts:** released version 0.24.0 [no ci] ([717de65](https://github.com/Lydanne/spaceflow/commit/717de6571faa2cb24f04b7493e7fd6d8404f2bd5))
|
|
39
|
+
* **shell:** released version 0.24.0 [no ci] ([5694d19](https://github.com/Lydanne/spaceflow/commit/5694d193f9207e41e840d9ebaa5a43e3527e6af8))
|
|
40
|
+
|
|
3
41
|
## [0.26.0](https://github.com/Lydanne/spaceflow/compare/@spaceflow/review-summary@0.25.0...@spaceflow/review-summary@0.26.0) (2026-03-02)
|
|
4
42
|
|
|
5
43
|
### 修复BUG
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spaceflow/review-summary",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.0",
|
|
4
4
|
"description": "Spaceflow 审查统计命令,根据时间范围统计 PR 贡献情况,按人员汇总并排序",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Lydanne",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"main": "./dist/index.js",
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"micromatch": "^4.0.8",
|
|
19
|
-
"@spaceflow/review": "0.
|
|
19
|
+
"@spaceflow/review": "0.61.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/micromatch": "^4.0.9",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@spaceflow/cli": "0.38.0"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
|
-
"@spaceflow/core": "0.
|
|
27
|
+
"@spaceflow/core": "0.23.0"
|
|
28
28
|
},
|
|
29
29
|
"spaceflow": {
|
|
30
30
|
"type": "flow",
|
|
@@ -85,7 +85,9 @@ export class PeriodSummaryService {
|
|
|
85
85
|
const ciConf = this.config.get<CiConfig>("ci");
|
|
86
86
|
const repository = ciConf?.repository;
|
|
87
87
|
if (!repository) {
|
|
88
|
-
throw new Error(
|
|
88
|
+
throw new Error(
|
|
89
|
+
"缺少仓库配置,请通过 --repository 参数或环境变量 GITHUB_REPOSITORY / GITEA_REPOSITORY 指定",
|
|
90
|
+
);
|
|
89
91
|
}
|
|
90
92
|
const parts = repository.split("/");
|
|
91
93
|
owner = parts[0];
|
|
@@ -165,7 +167,9 @@ export class PeriodSummaryService {
|
|
|
165
167
|
const allFiles = await this.gitProvider.getPullRequestFiles(owner, repo, pr.number!);
|
|
166
168
|
const files =
|
|
167
169
|
includes.length > 0
|
|
168
|
-
? allFiles.filter((f) =>
|
|
170
|
+
? allFiles.filter((f) =>
|
|
171
|
+
micromatch.isMatch(f.filename ?? "", includes, { matchBase: true }),
|
|
172
|
+
)
|
|
169
173
|
: allFiles;
|
|
170
174
|
changedFiles = files.length;
|
|
171
175
|
for (const file of files) {
|
|
@@ -206,7 +210,14 @@ export class PeriodSummaryService {
|
|
|
206
210
|
fixedErrors: number;
|
|
207
211
|
fixedWarns: number;
|
|
208
212
|
}> {
|
|
209
|
-
const empty = {
|
|
213
|
+
const empty = {
|
|
214
|
+
issueCount: 0,
|
|
215
|
+
fixedCount: 0,
|
|
216
|
+
errorCount: 0,
|
|
217
|
+
warnCount: 0,
|
|
218
|
+
fixedErrors: 0,
|
|
219
|
+
fixedWarns: 0,
|
|
220
|
+
};
|
|
210
221
|
try {
|
|
211
222
|
const comments = await this.gitProvider.listIssueComments(owner, repo, prNumber);
|
|
212
223
|
// 优先从 review 模块嵌入的结构化数据中精确提取
|
|
@@ -253,9 +264,7 @@ export class PeriodSummaryService {
|
|
|
253
264
|
/**
|
|
254
265
|
* 回退:从评论文本正则提取问题统计(兼容无结构化数据的旧评论)
|
|
255
266
|
*/
|
|
256
|
-
protected extractIssueStatsFromText(
|
|
257
|
-
comments: { body?: string }[],
|
|
258
|
-
): {
|
|
267
|
+
protected extractIssueStatsFromText(comments: { body?: string }[]): {
|
|
259
268
|
issueCount: number;
|
|
260
269
|
fixedCount: number;
|
|
261
270
|
errorCount: number;
|
|
@@ -291,9 +300,14 @@ export class PeriodSummaryService {
|
|
|
291
300
|
/**
|
|
292
301
|
* 统计 PR 中有效 commit 数量(逐 commit 获取行数判断)
|
|
293
302
|
*/
|
|
294
|
-
protected async countValidCommits(
|
|
303
|
+
protected async countValidCommits(
|
|
304
|
+
owner: string,
|
|
305
|
+
repo: string,
|
|
306
|
+
prNumber: number,
|
|
307
|
+
): Promise<number> {
|
|
295
308
|
const config = this.getStrategyConfig();
|
|
296
|
-
const minLines =
|
|
309
|
+
const minLines =
|
|
310
|
+
config.commitBasedWeights?.minCommitLines ?? DEFAULT_COMMIT_BASED_WEIGHTS.minCommitLines;
|
|
297
311
|
try {
|
|
298
312
|
const commits = await this.gitProvider.getPullRequestCommits(owner, repo, prNumber);
|
|
299
313
|
let validCount = 0;
|
|
@@ -531,9 +545,7 @@ export class PeriodSummaryService {
|
|
|
531
545
|
protected sortUserStats(userMap: Map<string, UserStats>): UserStats[] {
|
|
532
546
|
const config = this.getStrategyConfig();
|
|
533
547
|
if (config.strategy === "defect-rate") {
|
|
534
|
-
return Array.from(userMap.values()).sort(
|
|
535
|
-
(a, b) => (a.defectRate ?? 0) - (b.defectRate ?? 0),
|
|
536
|
-
);
|
|
548
|
+
return Array.from(userMap.values()).sort((a, b) => (a.defectRate ?? 0) - (b.defectRate ?? 0));
|
|
537
549
|
}
|
|
538
550
|
return Array.from(userMap.values()).sort((a, b) => b.score - a.score);
|
|
539
551
|
}
|