@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.
@@ -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, extname } from "path";
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: { filename?: string }[]): ReviewSpec[] {
69
- const changedExtensions = new Set<string>();
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
  }