@spaceflow/review 0.81.0 → 0.82.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 +17 -0
- package/dist/index.js +798 -717
- package/package.json +2 -2
- package/src/README.md +0 -1
- package/src/changed-file-collection.ts +87 -0
- package/src/mcp/index.ts +5 -1
- package/src/prompt/issue-verify.ts +8 -3
- package/src/review-context.spec.ts +214 -0
- package/src/review-issue-filter.spec.ts +742 -0
- package/src/review-issue-filter.ts +20 -279
- package/src/review-llm.spec.ts +287 -0
- package/src/review-llm.ts +19 -23
- package/src/review-report/formatters/markdown.formatter.ts +6 -7
- package/src/review-result-model.spec.ts +35 -4
- package/src/review-result-model.ts +58 -10
- package/src/review-source-resolver.ts +636 -0
- package/src/review-spec/review-spec.service.spec.ts +5 -4
- package/src/review-spec/review-spec.service.ts +5 -15
- package/src/review.service.spec.ts +142 -1154
- package/src/review.service.ts +177 -534
- package/src/types/changed-file-collection.ts +5 -0
- package/src/types/review-source-resolver.ts +55 -0
|
@@ -7,8 +7,9 @@ import {
|
|
|
7
7
|
type RemoteRepoRef,
|
|
8
8
|
type RepositoryContent,
|
|
9
9
|
} from "@spaceflow/core";
|
|
10
|
+
import { ChangedFileCollection } from "../changed-file-collection";
|
|
10
11
|
import { readdir, readFile, mkdir, access, writeFile, unlink } from "fs/promises";
|
|
11
|
-
import { join, basename
|
|
12
|
+
import { join, basename } from "path";
|
|
12
13
|
import { homedir } from "os";
|
|
13
14
|
import { execSync, execFileSync } from "child_process";
|
|
14
15
|
import micromatch from "micromatch";
|
|
@@ -65,17 +66,8 @@ export class ReviewSpecService {
|
|
|
65
66
|
* 根据变更文件的扩展名过滤适用的规则文件
|
|
66
67
|
* 只按扩展名过滤,includes 和 override 在 LLM 审查后处理
|
|
67
68
|
*/
|
|
68
|
-
filterApplicableSpecs(specs: ReviewSpec[], changedFiles:
|
|
69
|
-
const changedExtensions =
|
|
70
|
-
|
|
71
|
-
for (const file of changedFiles) {
|
|
72
|
-
if (file.filename) {
|
|
73
|
-
const ext = extname(file.filename).slice(1).toLowerCase();
|
|
74
|
-
if (ext) {
|
|
75
|
-
changedExtensions.add(ext);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
69
|
+
filterApplicableSpecs(specs: ReviewSpec[], changedFiles: ChangedFileCollection): ReviewSpec[] {
|
|
70
|
+
const changedExtensions = changedFiles.extensions();
|
|
79
71
|
|
|
80
72
|
console.log(
|
|
81
73
|
`[filterApplicableSpecs] changedExtensions=${JSON.stringify([...changedExtensions])}, specs count=${specs.length}`,
|
|
@@ -489,9 +481,7 @@ export class ReviewSpecService {
|
|
|
489
481
|
await access(targetDir);
|
|
490
482
|
return targetDir;
|
|
491
483
|
} catch {
|
|
492
|
-
console.warn(
|
|
493
|
-
` 警告: 克隆仓库中未找到子目录 ${normalizedSubPath},改为使用仓库根目录`,
|
|
494
|
-
);
|
|
484
|
+
console.warn(` 警告: 克隆仓库中未找到子目录 ${normalizedSubPath},改为使用仓库根目录`);
|
|
495
485
|
return cacheDir;
|
|
496
486
|
}
|
|
497
487
|
}
|