@hamsterbase/evidra 0.3.2 → 0.4.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.
Files changed (155) hide show
  1. package/dist/sdk/conformance-rules.js +38 -24
  2. package/dist/sdk/index.d.ts +1 -1
  3. package/dist/sdk/rules.d.ts +1 -1
  4. package/dist/sdk/types-DHfARqti.d.ts +15 -0
  5. package/dist/service/cli.js +93 -57
  6. package/dist/types/modules/core/contracts/comparison.d.ts +41 -0
  7. package/dist/types/modules/core/contracts/config.d.ts +19 -0
  8. package/dist/types/modules/core/contracts/context.d.ts +6 -0
  9. package/dist/types/modules/core/contracts/functions/addCase.d.ts +128 -0
  10. package/dist/types/modules/core/contracts/functions/addTask.d.ts +14 -0
  11. package/dist/types/modules/core/contracts/functions/approve.d.ts +8 -0
  12. package/dist/types/modules/core/contracts/functions/baselineChanges.d.ts +14 -0
  13. package/dist/types/modules/core/contracts/functions/compare.d.ts +14 -0
  14. package/dist/types/modules/core/contracts/functions/compareTask.d.ts +6 -0
  15. package/dist/types/modules/core/contracts/functions/compareTasks.d.ts +18 -0
  16. package/dist/types/modules/core/contracts/functions/deleteBaselineFile.d.ts +8 -0
  17. package/dist/types/modules/core/contracts/functions/finishTask.d.ts +8 -0
  18. package/dist/types/modules/core/contracts/functions/getBaseline.d.ts +10 -0
  19. package/dist/types/modules/core/contracts/functions/getBaselineChanges.d.ts +6 -0
  20. package/dist/types/modules/core/contracts/functions/getGitChanges.d.ts +6 -0
  21. package/dist/types/modules/core/contracts/functions/getGitDiff.d.ts +8 -0
  22. package/dist/types/modules/core/contracts/functions/getTaskCase.d.ts +23 -0
  23. package/dist/types/modules/core/contracts/functions/getTaskTree.d.ts +21 -0
  24. package/dist/types/modules/core/contracts/functions/gitChanges.d.ts +25 -0
  25. package/dist/types/modules/core/contracts/functions/index.d.ts +18 -0
  26. package/dist/types/modules/core/contracts/functions/listBaselines.d.ts +5 -0
  27. package/dist/types/modules/core/contracts/functions/listRuns.d.ts +7 -0
  28. package/dist/types/modules/core/contracts/functions/listTaskSummaries.d.ts +15 -0
  29. package/dist/types/modules/core/contracts/functions/listTasks.d.ts +15 -0
  30. package/dist/types/modules/core/contracts/functions/loadConfig.d.ts +5 -0
  31. package/dist/types/modules/core/contracts/functions/readProjectInfo.d.ts +5 -0
  32. package/dist/types/modules/core/contracts/functions/readTaskReport.d.ts +6 -0
  33. package/dist/types/modules/core/contracts/functions/resolveConfig.d.ts +6 -0
  34. package/dist/types/modules/core/contracts/functions/reviewBaselineChanges.d.ts +9 -0
  35. package/dist/types/modules/core/contracts/functions/reviewCodeChanges.d.ts +9 -0
  36. package/dist/types/modules/core/contracts/functions/taskRecords.d.ts +6 -0
  37. package/dist/types/modules/core/contracts/functions/updateBaseline.d.ts +20 -0
  38. package/dist/types/modules/core/contracts/git.d.ts +14 -0
  39. package/dist/types/modules/core/contracts/imageDiffPool.d.ts +5 -0
  40. package/dist/types/modules/core/contracts/index.d.ts +30 -0
  41. package/dist/types/modules/core/contracts/internal/compare.d.ts +14 -0
  42. package/dist/types/modules/core/contracts/internal/getBaseline.d.ts +10 -0
  43. package/dist/types/modules/core/contracts/internal/listTasks.d.ts +12 -0
  44. package/dist/types/modules/core/contracts/internal/taskRecords.d.ts +6 -0
  45. package/dist/types/modules/core/contracts/internal/updateBaseline.d.ts +20 -0
  46. package/dist/types/modules/core/contracts/model.d.ts +80 -0
  47. package/dist/types/modules/core/contracts/report.d.ts +52 -0
  48. package/dist/types/modules/core/contracts/repository.d.ts +5 -0
  49. package/dist/types/modules/core/contracts/requests.d.ts +23 -0
  50. package/dist/types/modules/core/contracts/scanCases.d.ts +15 -0
  51. package/dist/types/modules/core/contracts/shared.d.ts +6 -0
  52. package/dist/types/modules/core/contracts/snapshots.d.ts +6 -0
  53. package/dist/types/modules/core/contracts/taskRecord.d.ts +76 -0
  54. package/dist/types/modules/core/implementations/Functions/addCase.d.ts +4 -0
  55. package/dist/types/modules/core/implementations/Functions/addTask.d.ts +4 -0
  56. package/dist/types/modules/core/implementations/Functions/approve.d.ts +6 -0
  57. package/dist/types/modules/core/implementations/Functions/compare.d.ts +15 -0
  58. package/dist/types/modules/core/implementations/Functions/compareTask.d.ts +3 -0
  59. package/dist/types/modules/core/implementations/Functions/compareTasks.d.ts +5 -0
  60. package/dist/types/modules/core/implementations/Functions/deleteBaselineFile.d.ts +4 -0
  61. package/dist/types/modules/core/implementations/Functions/finishTask.d.ts +4 -0
  62. package/dist/types/modules/core/implementations/Functions/getBaseline.d.ts +4 -0
  63. package/dist/types/modules/core/implementations/Functions/getBaselineChanges.d.ts +4 -0
  64. package/dist/types/modules/core/implementations/Functions/getGitChanges.d.ts +3 -0
  65. package/dist/types/modules/core/implementations/Functions/getGitDiff.d.ts +3 -0
  66. package/dist/types/modules/core/implementations/Functions/getTaskCase.d.ts +5 -0
  67. package/dist/types/modules/core/implementations/Functions/getTaskTree.d.ts +5 -0
  68. package/dist/types/modules/core/implementations/Functions/listBaselines.d.ts +3 -0
  69. package/dist/types/modules/core/implementations/Functions/listTaskSummaries.d.ts +2 -0
  70. package/dist/types/modules/core/implementations/Functions/listTasks.d.ts +4 -0
  71. package/dist/types/modules/core/implementations/Functions/loadConfig.d.ts +3 -0
  72. package/dist/types/modules/core/implementations/Functions/readProjectInfo.d.ts +3 -0
  73. package/dist/types/modules/core/implementations/Functions/readTaskReport.d.ts +3 -0
  74. package/dist/types/modules/core/implementations/Functions/resolveConfig.d.ts +9 -0
  75. package/dist/types/modules/core/implementations/Functions/reviewBaselineChanges.d.ts +4 -0
  76. package/dist/types/modules/core/implementations/Functions/reviewCodeChanges.d.ts +4 -0
  77. package/dist/types/modules/core/implementations/Functions/taskRecords.d.ts +4 -0
  78. package/dist/types/modules/core/implementations/Functions/updateBaseline.d.ts +5 -0
  79. package/dist/types/modules/core/implementations/Utils/assertNamespace.d.ts +1 -0
  80. package/dist/types/modules/core/implementations/Utils/canonical.d.ts +1 -0
  81. package/dist/types/modules/core/implementations/Utils/createTaskId.d.ts +1 -0
  82. package/dist/types/modules/core/implementations/Utils/deletionAllowed.d.ts +2 -0
  83. package/dist/types/modules/core/implementations/Utils/download.d.ts +3 -0
  84. package/dist/types/modules/core/implementations/Utils/hash.d.ts +1 -0
  85. package/dist/types/modules/core/implementations/Utils/imageDiffPool.d.ts +18 -0
  86. package/dist/types/modules/core/implementations/Utils/imageKey.d.ts +1 -0
  87. package/dist/types/modules/core/implementations/Utils/loadBaseline.d.ts +4 -0
  88. package/dist/types/modules/core/implementations/Utils/mapLimit.d.ts +1 -0
  89. package/dist/types/modules/core/implementations/Utils/observationKey.d.ts +1 -0
  90. package/dist/types/modules/core/implementations/Utils/pngSize.d.ts +4 -0
  91. package/dist/types/modules/core/implementations/Utils/readJson.d.ts +1 -0
  92. package/dist/types/modules/core/implementations/Utils/readTaskRecord.d.ts +2 -0
  93. package/dist/types/modules/core/implementations/Utils/scanCases.d.ts +9 -0
  94. package/dist/types/modules/core/implementations/Utils/taskDirectory.d.ts +1 -0
  95. package/dist/types/modules/core/implementations/Utils/toCase.d.ts +3 -0
  96. package/dist/types/modules/core/implementations/Utils/toObservation.d.ts +3 -0
  97. package/dist/types/modules/core/implementations/Utils/toSnapshot.d.ts +3 -0
  98. package/dist/types/modules/core/implementations/Utils/writeBytesAtomic.d.ts +1 -0
  99. package/dist/types/modules/core/implementations/Utils/writeJsonAtomic.d.ts +1 -0
  100. package/dist/types/modules/core/implementations/Utils/writeTextAtomic.d.ts +1 -0
  101. package/dist/types/modules/core/implementations/baselineChanges.d.ts +6 -0
  102. package/dist/types/modules/core/implementations/config.d.ts +6 -0
  103. package/dist/types/modules/core/implementations/content.d.ts +1 -0
  104. package/dist/types/modules/core/implementations/evidra.d.ts +31 -0
  105. package/dist/types/modules/core/implementations/git.d.ts +11 -0
  106. package/dist/types/modules/core/implementations/gitChanges.d.ts +29 -0
  107. package/dist/types/modules/core/implementations/index.d.ts +17 -0
  108. package/dist/types/modules/core/implementations/internal/compare.d.ts +15 -0
  109. package/dist/types/modules/core/implementations/internal/getBaseline.d.ts +4 -0
  110. package/dist/types/modules/core/implementations/internal/listTasks.d.ts +2 -0
  111. package/dist/types/modules/core/implementations/internal/taskRecords.d.ts +4 -0
  112. package/dist/types/modules/core/implementations/internal/updateBaseline.d.ts +5 -0
  113. package/dist/types/modules/core/implementations/paths.d.ts +48 -0
  114. package/dist/types/modules/core/implementations/report.d.ts +3 -0
  115. package/dist/types/modules/core/implementations/reportResources.d.ts +4 -0
  116. package/dist/types/modules/core/implementations/reportStatus.d.ts +10 -0
  117. package/dist/types/modules/core/implementations/reportTree.d.ts +5 -0
  118. package/dist/types/modules/core/implementations/repository.d.ts +10 -0
  119. package/dist/types/modules/core/implementations/requests.d.ts +13 -0
  120. package/dist/types/modules/core/implementations/snapshots.d.ts +11 -0
  121. package/dist/types/modules/core/implementations/storage/local.d.ts +3 -0
  122. package/dist/types/modules/core/implementations/storage/objects.d.ts +3 -0
  123. package/dist/types/modules/core/index.d.ts +21 -0
  124. package/dist/types/packages/sdk/src/index.d.ts +21 -0
  125. package/dist/types/packages/sdk/src/types.d.ts +9 -0
  126. package/dist/web/assets/{cssMode-BTAZgpQt.js → cssMode-CT7qaTm_.js} +1 -1
  127. package/dist/web/assets/{editor.api-CfnVkTAL.js → editor.api-CsVhWQDt.js} +1 -1
  128. package/dist/web/assets/{freemarker2-BV0isRRj.js → freemarker2-Biydhqq4.js} +1 -1
  129. package/dist/web/assets/{handlebars-CbLz4Wc3.js → handlebars-OLGn3O0q.js} +1 -1
  130. package/dist/web/assets/{html-D2xBZbJh.js → html-Cw5ATHyh.js} +1 -1
  131. package/dist/web/assets/{htmlMode-DwPRG6d4.js → htmlMode-BI1zICew.js} +1 -1
  132. package/dist/web/assets/index-C49ToWrK.js +2 -0
  133. package/dist/web/assets/{javascript-D-gNVUGD.js → javascript-BS1aYt5R.js} +1 -1
  134. package/dist/web/assets/{jsonMode-BMqe91Um.js → jsonMode-DCJhJggA.js} +1 -1
  135. package/dist/web/assets/{liquid-D6FHObSg.js → liquid-DoQa4FNY.js} +1 -1
  136. package/dist/web/assets/{lspLanguageFeatures-D6i7D2oO.js → lspLanguageFeatures-D9tA1yBW.js} +1 -1
  137. package/dist/web/assets/main-BO3J7gmH.css +2 -0
  138. package/dist/web/assets/main-Bpk1-JEL.css +1 -0
  139. package/dist/web/assets/main-DqSNHHTP.js +13 -0
  140. package/dist/web/assets/main-TbSjhXd2.js +18 -0
  141. package/dist/web/assets/{mdx-CGtrE9A8.js → mdx-CA3qWzFi.js} +1 -1
  142. package/dist/web/assets/{monaco-C3WraHAR.js → monaco-BtL7JKYj.js} +4 -4
  143. package/dist/web/assets/{python-B2ywaTtF.js → python-BrQiqC89.js} +1 -1
  144. package/dist/web/assets/{razor-zzTWj2fW.js → razor-08hjtCNT.js} +1 -1
  145. package/dist/web/assets/{tsMode-BrfjRJaR.js → tsMode-DC-2vqQt.js} +1 -1
  146. package/dist/web/assets/{typescript-xVM47PRQ.js → typescript-9DOCFqrz.js} +1 -1
  147. package/dist/web/assets/useDisplayPreference-B-z8NzSv.js +23 -0
  148. package/dist/web/assets/{workers-DEZ7PLe8.js → workers-BcFJUhLI.js} +1 -1
  149. package/dist/web/assets/{xml-kpizFTtc.js → xml-ZJo8Un2M.js} +1 -1
  150. package/dist/web/assets/{yaml-DDFZ3vPi.js → yaml-8EZC7v3K.js} +1 -1
  151. package/dist/web/index.html +1 -2
  152. package/package.json +6 -2
  153. package/dist/sdk/types-B6cBsknY.d.ts +0 -12
  154. package/dist/web/assets/index-CJuNTIx5.css +0 -2
  155. package/dist/web/assets/index-CqRUszBc.js +0 -35
@@ -6,14 +6,15 @@ import { parseSync } from "oxc-parser";
6
6
  // packages/conformance/rules/commit-message/index.ts
7
7
  const execFileAsync = promisify(execFile);
8
8
  function commitMessage(config = {}) {
9
- return async (common) => {
9
+ const ruleName = "commit-message";
10
+ const task = async (common) => {
10
11
  const { commits, scope } = await collectCommitSubjects(common.projectRoot, config.base);
11
12
  const violations = commits.filter((commit) => (config.forbiddenPrefixes ?? ["```"]).some((prefix) => commit.subject.startsWith(prefix)));
12
13
  const lines = [`扫描${scope} ${commits.length} 个提交 message。`];
13
14
  if (violations.length === 0) {
14
15
  lines.push("未发现以禁止的前缀开头的提交 message。");
15
16
  return {
16
- name: "commit-message",
17
+ name: ruleName,
17
18
  success: true,
18
19
  messages: lines.join("\n"),
19
20
  howToFix: ""
@@ -22,12 +23,13 @@ function commitMessage(config = {}) {
22
23
  lines.push(`发现 ${violations.length} 个提交 message 以禁止的前缀开头:`);
23
24
  for (const violation of violations) lines.push(` - ${violation.hash.slice(0, 7)} ${violation.subject}`);
24
25
  return {
25
- name: "commit-message",
26
+ name: ruleName,
26
27
  success: false,
27
28
  messages: lines.join("\n"),
28
29
  howToFix: "修改对应提交 message,移除禁止的前缀。"
29
30
  };
30
31
  };
32
+ return Object.assign(task, { displayName: ruleName });
31
33
  }
32
34
  async function collectCommitSubjects(repoRoot, base) {
33
35
  const upstream = base ?? await readUpstream(repoRoot);
@@ -81,7 +83,8 @@ const SKIP_AST_KEYS$6 = /* @__PURE__ */ new Set([
81
83
  "trailingComments"
82
84
  ]);
83
85
  function duplicateLocalization(config) {
84
- return async (common) => {
86
+ const ruleName = "duplicate-localization";
87
+ const task = async (common) => {
85
88
  const options = {
86
89
  ...config,
87
90
  repoRoot: common.projectRoot,
@@ -143,12 +146,13 @@ function duplicateLocalization(config) {
143
146
  }
144
147
  if (success) lines.push("No duplicate localization keys found.");
145
148
  return {
146
- name: "duplicate-localization",
149
+ name: ruleName,
147
150
  success,
148
151
  messages: lines.join("\n"),
149
152
  howToFix: success ? "" : "Replace template literals with string literals, and unify duplicate keys to share a single default message."
150
153
  };
151
154
  };
155
+ return Object.assign(task, { displayName: ruleName });
152
156
  }
153
157
  async function collectSourceFiles$2(root, excludeDirs, skipDirNames = [
154
158
  "node_modules",
@@ -245,7 +249,8 @@ const SKIP_AST_KEYS$5 = /* @__PURE__ */ new Set([
245
249
  "trailingComments"
246
250
  ]);
247
251
  function syncLocales(config) {
248
- return async (common) => {
252
+ const ruleName = "sync-locales";
253
+ const task = async (common) => {
249
254
  const options = {
250
255
  ...config,
251
256
  repoRoot: common.projectRoot,
@@ -302,12 +307,13 @@ function syncLocales(config) {
302
307
  }
303
308
  if (hasUntranslatedKeys) howToFix.push("Translate the listed key(s) in non-default locale files, then run the check again.");
304
309
  return {
305
- name: "sync-locales",
310
+ name: ruleName,
306
311
  success,
307
312
  messages: lines.join("\n"),
308
313
  howToFix: howToFix.join(" ")
309
314
  };
310
315
  };
316
+ return Object.assign(task, { displayName: ruleName });
311
317
  }
312
318
  function mergeDefaultLocale(oldConfig, newLocale, metadataKey) {
313
319
  const result = {};
@@ -448,7 +454,8 @@ const ESM_SOURCE_EXTENSIONS = {
448
454
  ".jsx": [".tsx"]
449
455
  };
450
456
  function sameDirImportOnly(config) {
451
- return async (common) => {
457
+ const ruleName = "same-dir-import-only";
458
+ const task = async (common) => {
452
459
  const marker = config.marker ?? "@import-scope same-dir";
453
460
  const aliases = Object.entries(config.aliases ?? {}).sort(([a], [b]) => b.length - a.length).map(([prefix, target]) => [prefix, path.resolve(common.projectRoot, target)]);
454
461
  const options = {
@@ -478,7 +485,7 @@ function sameDirImportOnly(config) {
478
485
  if (violations.length === 0) {
479
486
  lines.push("No cross-directory imports of protected files found.");
480
487
  return {
481
- name: "same-dir-import-only",
488
+ name: ruleName,
482
489
  success: true,
483
490
  messages: lines.join("\n"),
484
491
  howToFix: ""
@@ -490,12 +497,13 @@ function sameDirImportOnly(config) {
490
497
  lines.push(` protected file: ${path.relative(options.repoRoot, violation.target)}`);
491
498
  }
492
499
  return {
493
- name: "same-dir-import-only",
500
+ name: ruleName,
494
501
  success: false,
495
502
  messages: lines.join("\n"),
496
503
  howToFix: `Only import files marked with '${marker}' from files in the same directory, or move shared API into an unmarked file.`
497
504
  };
498
505
  };
506
+ return Object.assign(task, { displayName: ruleName });
499
507
  }
500
508
  async function collectSourceFiles(root, excludeDirs, skipDirNames = [
501
509
  "node_modules",
@@ -722,7 +730,8 @@ function formatLocation$3(repoRoot, file, line) {
722
730
  const CJK_PATTERN = /[\u4e00-\u9fff\u3400-\u4dbf\u3000-\u303f\uff00-\uffef]/;
723
731
  /** 本地化调用在代码中的默认文案必须使用源语言(不匹配 pattern),翻译放在语言文件中。 */
724
732
  function sourceLocaleDefaults(options) {
725
- return async (context) => {
733
+ const ruleName = "source-locale-defaults";
734
+ const task = async (context) => {
726
735
  const files = await collectFiles$3(context.projectRoot, options, [".ts", ".tsx"]);
727
736
  const findings = [];
728
737
  for (const file of files) {
@@ -741,7 +750,7 @@ function sourceLocaleDefaults(options) {
741
750
  if (findings.length === 0) {
742
751
  lines.push("未发现违规文案。");
743
752
  return {
744
- name: "source-locale-defaults",
753
+ name: ruleName,
745
754
  success: true,
746
755
  messages: lines.join("\n"),
747
756
  howToFix: ""
@@ -749,12 +758,13 @@ function sourceLocaleDefaults(options) {
749
758
  }
750
759
  lines.push(`发现 ${findings.length} 处违规文案:`, ...findings);
751
760
  return {
752
- name: "source-locale-defaults",
761
+ name: ruleName,
753
762
  success: false,
754
763
  messages: lines.join("\n"),
755
764
  howToFix: "默认文案改用源语言,其他语言的翻译写入语言文件。"
756
765
  };
757
766
  };
767
+ return Object.assign(task, { displayName: ruleName });
758
768
  }
759
769
  function matchCall(calls, callee) {
760
770
  if (!callee) return void 0;
@@ -875,7 +885,8 @@ function formatLocation$2(repoRoot, file, line) {
875
885
  // packages/conformance/rules/single-component-file/index.ts
876
886
  /** 每个 TSX 文件只定义一个返回 JSX 的组件。 */
877
887
  function singleComponentFile(options) {
878
- return async (context) => {
888
+ const ruleName = "single-component-file";
889
+ const task = async (context) => {
879
890
  const wrappers = new Set(options.componentWrappers ?? ["memo", "forwardRef"]);
880
891
  const files = await collectFiles$2(context.projectRoot, options, [".tsx"]);
881
892
  const findings = [];
@@ -894,7 +905,7 @@ function singleComponentFile(options) {
894
905
  if (findings.length === 0) {
895
906
  lines.push("未发现包含多个组件的 TSX 文件。");
896
907
  return {
897
- name: "single-component-file",
908
+ name: ruleName,
898
909
  success: true,
899
910
  messages: lines.join("\n"),
900
911
  howToFix: ""
@@ -902,12 +913,13 @@ function singleComponentFile(options) {
902
913
  }
903
914
  lines.push("以下 TSX 文件包含多个组件:", ...findings);
904
915
  return {
905
- name: "single-component-file",
916
+ name: ruleName,
906
917
  success: false,
907
918
  messages: lines.join("\n"),
908
919
  howToFix: "把多出的组件移到各自的 TSX 文件,每个文件只保留一个组件。"
909
920
  };
910
921
  };
922
+ return Object.assign(task, { displayName: ruleName });
911
923
  }
912
924
  function readComponentName(node, wrappers) {
913
925
  if (node.type === "FunctionDeclaration" || node.type === "ClassDeclaration") {
@@ -1052,12 +1064,12 @@ function formatLocation$1(repoRoot, file, line) {
1052
1064
  * 且 shared 与 utils 互不引用。
1053
1065
  */
1054
1066
  function e2eScenariosStructure(options) {
1055
- return async (context) => {
1067
+ const ruleName = options.name ?? "e2e-scenarios-structure";
1068
+ const task = async (context) => {
1056
1069
  const repoRoot = context.projectRoot;
1057
1070
  const entrySuffix = options.entrySuffix ?? ".spec.ts";
1058
1071
  const strictRoot = options.strictRoot ?? false;
1059
1072
  const root = path.resolve(repoRoot, options.root);
1060
- const name = options.name ?? "e2e-scenarios-structure";
1061
1073
  const sharedName = options.sharedDir ?? "shared";
1062
1074
  const utilsName = options.utilsDir ?? "utils";
1063
1075
  const threshold = options.sharedThreshold ?? 3;
@@ -1068,7 +1080,7 @@ function e2eScenariosStructure(options) {
1068
1080
  const violations = [];
1069
1081
  const entries = await readDirIfExists$1(root);
1070
1082
  if (!entries) return {
1071
- name,
1083
+ name: ruleName,
1072
1084
  success: false,
1073
1085
  messages: `场景根目录不存在:${path.relative(repoRoot, root)}`,
1074
1086
  howToFix: "确认传入的场景根目录路径。"
@@ -1142,12 +1154,13 @@ function e2eScenariosStructure(options) {
1142
1154
  if (success) lines.push("未发现结构违规。");
1143
1155
  else lines.push(`发现 ${violations.filter((line) => line.startsWith(" - ")).length} 处违规:`, ...violations);
1144
1156
  return {
1145
- name,
1157
+ name: ruleName,
1146
1158
  success,
1147
1159
  messages: lines.join("\n"),
1148
1160
  howToFix: success ? "" : `helper 移出入口文件:被 ${threshold} 个及以上入口使用的放到 ${sharedName},其余放到 ${utilsName}/<入口名>;${sharedName} 与 ${utilsName} 不要互相引用。`
1149
1161
  };
1150
1162
  };
1163
+ return Object.assign(task, { displayName: ruleName });
1151
1164
  }
1152
1165
  function readFunctionName$1(node) {
1153
1166
  if (node.type === "FunctionDeclaration") return readName$1(node.id) ?? "匿名函数";
@@ -1287,13 +1300,13 @@ function formatLocation(repoRoot, file, line) {
1287
1300
  * 且 shared 与 utils 互不引用。
1288
1301
  */
1289
1302
  function uiScenariosStructure(options) {
1290
- return async (context) => {
1303
+ const ruleName = options.name ?? "ui-scenarios-structure";
1304
+ const task = async (context) => {
1291
1305
  const repoRoot = context.projectRoot;
1292
1306
  const entrySuffix = options.entrySuffix ?? ".ts";
1293
1307
  const strictRoot = options.strictRoot ?? true;
1294
1308
  const exportName = options.exportName ?? "lint";
1295
1309
  const root = path.resolve(repoRoot, options.root);
1296
- const name = options.name ?? "ui-scenarios-structure";
1297
1310
  const sharedName = options.sharedDir ?? "shared";
1298
1311
  const utilsName = options.utilsDir ?? "utils";
1299
1312
  const threshold = options.sharedThreshold ?? 3;
@@ -1304,7 +1317,7 @@ function uiScenariosStructure(options) {
1304
1317
  const violations = [];
1305
1318
  const entries = await readDirIfExists(root);
1306
1319
  if (!entries) return {
1307
- name,
1320
+ name: ruleName,
1308
1321
  success: false,
1309
1322
  messages: `场景根目录不存在:${path.relative(repoRoot, root)}`,
1310
1323
  howToFix: "确认传入的场景根目录路径。"
@@ -1380,12 +1393,13 @@ function uiScenariosStructure(options) {
1380
1393
  if (success) lines.push("未发现结构违规。");
1381
1394
  else lines.push(`发现 ${violations.filter((line) => line.startsWith(" - ")).length} 处违规:`, ...violations);
1382
1395
  return {
1383
- name,
1396
+ name: ruleName,
1384
1397
  success,
1385
1398
  messages: lines.join("\n"),
1386
1399
  howToFix: success ? "" : `helper 移出入口文件:被 ${threshold} 个及以上入口使用的放到 ${sharedName},其余放到 ${utilsName}/<入口名>;${sharedName} 与 ${utilsName} 不要互相引用。`
1387
1400
  };
1388
1401
  };
1402
+ return Object.assign(task, { displayName: ruleName });
1389
1403
  }
1390
1404
  function readFunctionName(node) {
1391
1405
  if (node.type === "FunctionDeclaration") return readName(node.id) ?? "匿名函数";
@@ -1,4 +1,4 @@
1
- import { n as RuleResult, r as RuleTask, t as CommonConfig } from "./types-B6cBsknY.js";
1
+ import { n as RuleResult, r as RuleTask, t as CommonConfig } from "./types-DHfARqti.js";
2
2
  /** evidra.conformance.ts 的默认导出。 */
3
3
  interface Config {
4
4
  /** 默认配置文件所在目录;相对路径也基于配置文件所在目录。 */
@@ -1,4 +1,4 @@
1
- import { r as RuleTask } from "./types-B6cBsknY.js";
1
+ import { r as RuleTask } from "./types-DHfARqti.js";
2
2
  /** Git 提交标题检查配置。 */
3
3
  interface CommitMessageOptions {
4
4
  /** 禁止的提交标题前缀,默认 ["```"];传入空数组时不限制前缀。 */
@@ -0,0 +1,15 @@
1
+ interface RuleResult {
2
+ name: string;
3
+ success: boolean;
4
+ messages: string;
5
+ howToFix: string;
6
+ }
7
+ interface CommonConfig {
8
+ /** 已解析的项目绝对路径。 */
9
+ readonly projectRoot: string;
10
+ }
11
+ type RuleTask = ((commonConfig: CommonConfig) => Promise<RuleResult>) & {
12
+ /** 用于在执行前展示规则名称。 */
13
+ readonly displayName?: string;
14
+ };
15
+ export { RuleResult as n, RuleTask as r, CommonConfig as t };
@@ -1,6 +1,6 @@
1
1
  // packages/service/src/cli.ts
2
2
  import { cac } from "cac";
3
- import path33 from "node:path";
3
+ import path34 from "node:path";
4
4
 
5
5
  // modules/core/implementations/Functions/resolveConfig.ts
6
6
  import path3 from "node:path";
@@ -1652,11 +1652,11 @@ async function currentBaseline(root, namespace) {
1652
1652
  ])
1653
1653
  );
1654
1654
  }
1655
- var definition = (snapshot) => ({
1655
+ var definition = (snapshot, imageKey = snapshot.key) => ({
1656
1656
  id: snapshot.id,
1657
1657
  name: snapshot.name,
1658
1658
  type: snapshot.type,
1659
- content: snapshot.type === "image" ? snapshot.key : snapshot.body,
1659
+ content: snapshot.type === "image" ? imageKey : snapshot.body,
1660
1660
  language: snapshot.language,
1661
1661
  contentType: snapshot.contentType,
1662
1662
  width: snapshot.width,
@@ -1766,13 +1766,28 @@ async function getBaselineChanges(input) {
1766
1766
  )
1767
1767
  );
1768
1768
  for (const entry of entries2) {
1769
+ const { baseline, current, change } = entry.item;
1770
+ let screenshotKeyOnly = change === "modified" && baseline?.name === current?.name && canonical(baseline?.treePath) === canonical(current?.treePath);
1771
+ let hasScreenshotKeyChange = false;
1769
1772
  for (const snapshot of entry.item.snapshots) {
1773
+ if (snapshot.change === "same") continue;
1770
1774
  if (snapshot.baseline?.type === "image" && snapshot.current?.type === "image" && snapshot.baseline.key !== snapshot.current.key) {
1771
- const file = await prepareImageDiff(root, snapshot.baseline, snapshot.current);
1772
- snapshot.diffFile = path20.relative(reportDir, file).split(path20.sep).join("/");
1773
- snapshot.diffUrl = reportStaticUrl(reportDir, file);
1775
+ const { file, diffPixels } = await prepareImageDiff(
1776
+ root,
1777
+ snapshot.baseline,
1778
+ snapshot.current
1779
+ );
1780
+ if (file) {
1781
+ snapshot.diffFile = path20.relative(reportDir, file).split(path20.sep).join("/");
1782
+ snapshot.diffUrl = reportStaticUrl(reportDir, file);
1783
+ }
1784
+ hasScreenshotKeyChange = true;
1785
+ screenshotKeyOnly &&= diffPixels === 0 && canonical(definition(snapshot.baseline)) === canonical(definition(snapshot.current, snapshot.baseline.key));
1786
+ } else {
1787
+ screenshotKeyOnly = false;
1774
1788
  }
1775
1789
  }
1790
+ if (screenshotKeyOnly && hasScreenshotKeyChange) entry.screenshotKeyOnly = true;
1776
1791
  }
1777
1792
  return {
1778
1793
  ref,
@@ -1793,13 +1808,13 @@ async function prepareImageDiff(root, before, after) {
1793
1808
  "comparisons",
1794
1809
  version(["git", before.key, after.key])
1795
1810
  );
1796
- const index = path20.join(directory, "diff-v2.json");
1811
+ const index = path20.join(directory, "diff-v3.json");
1797
1812
  const cached = await readJson(index);
1798
1813
  try {
1799
1814
  if (cached) {
1800
- const file2 = path20.join(directory, cached);
1801
- await readFile9(file2);
1802
- return file2;
1815
+ const file2 = cached.filename && path20.join(directory, cached.filename);
1816
+ if (file2) await readFile9(file2);
1817
+ return { file: file2, diffPixels: cached.diffPixels };
1803
1818
  }
1804
1819
  } catch (error) {
1805
1820
  if (error.code !== "ENOENT") throw error;
@@ -1812,12 +1827,12 @@ async function prepareImageDiff(root, before, after) {
1812
1827
  PNG2.bitblt(x, left, 0, 0, x.width, x.height, 0, 0);
1813
1828
  PNG2.bitblt(y, right, 0, 0, y.width, y.height, 0, 0);
1814
1829
  const result = localImageDiff(PNG2.sync.write(left), PNG2.sync.write(right));
1815
- if (!result.png) throw new Error("\u65E0\u6CD5\u751F\u6210\u56FE\u7247\u5DEE\u5F02");
1816
- const filename = `diff-${hash(result.png)}.png`;
1817
- const file = path20.join(directory, filename);
1818
- await writeBytesAtomic(file, result.png);
1819
- await writeJsonAtomic(index, filename);
1820
- return file;
1830
+ const diffPixels = x.width === y.width && x.height === y.height ? result.diffPixels : void 0;
1831
+ const filename = result.png && `diff-${hash(result.png)}.png`;
1832
+ const file = filename && path20.join(directory, filename);
1833
+ if (file && result.png) await writeBytesAtomic(file, result.png);
1834
+ await writeJsonAtomic(index, { filename, diffPixels });
1835
+ return { file, diffPixels };
1821
1836
  }
1822
1837
 
1823
1838
  // modules/core/implementations/Functions/reviewBaselineChanges.ts
@@ -2640,15 +2655,46 @@ import { serveStatic } from "@hono/node-server/serve-static";
2640
2655
  import { Hono } from "hono";
2641
2656
  import { existsSync } from "node:fs";
2642
2657
  import { stat as stat2 } from "node:fs/promises";
2643
- import path30 from "node:path";
2658
+ import path31 from "node:path";
2644
2659
  import { z as z27 } from "zod";
2660
+
2661
+ // packages/conformance/runner/load.ts
2662
+ import { access as access2 } from "node:fs/promises";
2663
+ import path30 from "node:path";
2664
+ import { pathToFileURL } from "node:url";
2665
+ import { tsImport } from "tsx/esm/api";
2666
+ async function loadConformanceConfig(directory) {
2667
+ const file = path30.resolve(directory, "evidra.conformance.ts");
2668
+ try {
2669
+ await access2(file);
2670
+ } catch (error) {
2671
+ if (error.code === "ENOENT") return null;
2672
+ throw new Error(`\u65E0\u6CD5\u8BFB\u53D6\u914D\u7F6E\u6587\u4EF6\uFF1A${file}`, { cause: error });
2673
+ }
2674
+ let config;
2675
+ try {
2676
+ const loaded = (await tsImport(pathToFileURL(file).href, import.meta.url)).default;
2677
+ config = loaded?.__esModule ? loaded.default : loaded;
2678
+ } catch (error) {
2679
+ throw new Error(
2680
+ `\u52A0\u8F7D\u914D\u7F6E\u5931\u8D25 ${file}\uFF1A${error instanceof Error ? error.message : String(error)}`
2681
+ );
2682
+ }
2683
+ if (!config || !Array.isArray(config.rules) || config.rules.some((task) => typeof task !== "function") || config.projectRoot !== void 0 && typeof config.projectRoot !== "string") {
2684
+ throw new Error(`${file} \u5FC5\u987B\u9ED8\u8BA4\u5BFC\u51FA { projectRoot?: string, rules: RuleTask[] }`);
2685
+ }
2686
+ const projectRoot = path30.resolve(path30.dirname(file), config.projectRoot ?? ".");
2687
+ return { projectRoot, rules: config.rules };
2688
+ }
2689
+
2690
+ // packages/service/src/server.ts
2645
2691
  function defaultWebDist() {
2646
- const fromSource = path30.resolve(import.meta.dirname, "../../../dist/web");
2647
- const fromBundle = path30.resolve(import.meta.dirname, "../../dist/web");
2648
- return [fromSource, fromBundle].find((directory) => existsSync(path30.join(directory, "index.html"))) ?? fromSource;
2692
+ const fromSource = path31.resolve(import.meta.dirname, "../../../dist/web");
2693
+ const fromBundle = path31.resolve(import.meta.dirname, "../../dist/web");
2694
+ return [fromSource, fromBundle].find((directory) => existsSync(path31.join(directory, "index.html"))) ?? fromSource;
2649
2695
  }
2650
2696
  async function startServer(options) {
2651
- const root = path30.resolve(options.repoRoot);
2697
+ const root = path31.resolve(options.repoRoot);
2652
2698
  await loadConfig({ repoRoot: root });
2653
2699
  const webDist = options.webDist ?? defaultWebDist();
2654
2700
  const app = createApp(root, webDist);
@@ -2690,6 +2736,13 @@ function createApp(root, webDist) {
2690
2736
  "/api/project",
2691
2737
  async (context) => context.json(await readProjectInfo({ repoRoot: root }))
2692
2738
  );
2739
+ app.get("/api/conformance", async (context) => {
2740
+ const config = await loadConformanceConfig(root);
2741
+ const rules = config ? config.rules.map(
2742
+ (task, index) => task.displayName?.trim() || task.name || `rule[${index + 1}]`
2743
+ ) : null;
2744
+ return context.json({ rules });
2745
+ });
2693
2746
  app.get(
2694
2747
  "/api/changelog",
2695
2748
  async (context) => context.json(await listChangelogCommits({ repoRoot: root }))
@@ -2803,7 +2856,7 @@ function createApp(root, webDist) {
2803
2856
  "ETag",
2804
2857
  `W/"${stats.size.toString(16)}-${stats.mtimeMs.toString(16)}-${stats.ctimeMs.toString(16)}"`
2805
2858
  );
2806
- const relativePath = path30.relative(webDist, filePath).split(path30.sep).join("/");
2859
+ const relativePath = path31.relative(webDist, filePath).split(path31.sep).join("/");
2807
2860
  const immutable = context.req.path.startsWith("/report-static/") && /(?:^|[-/])[a-f0-9]{64}\.png$/.test(context.req.path) || !context.req.path.startsWith("/report-static/") && /^assets\/.+-[\w-]{8,}\.[\w.]+$/.test(relativePath);
2808
2861
  context.header("Cache-Control", immutable ? "public, max-age=31536000, immutable" : "no-cache");
2809
2862
  if (context.res.status !== 200 || !["GET", "HEAD"].includes(context.req.method)) return;
@@ -2843,7 +2896,7 @@ function createApp(root, webDist) {
2843
2896
  await next();
2844
2897
  });
2845
2898
  app.get("*", serveStatic({ root: webDist, ...staticOptions }));
2846
- app.get("*", (context, next) => path30.extname(context.req.path) ? context.notFound() : next());
2899
+ app.get("*", (context, next) => path31.extname(context.req.path) ? context.notFound() : next());
2847
2900
  app.get("*", serveStatic({ root: webDist, path: "index.html", ...staticOptions }));
2848
2901
  app.get("*", (context) => context.text("\u62A5\u544A UI \u5C1A\u672A\u6784\u5EFA\uFF1A\u8BF7\u5148\u8FD0\u884C pnpm build", 404));
2849
2902
  return app;
@@ -2873,47 +2926,44 @@ async function startWorkbench(options) {
2873
2926
 
2874
2927
  // packages/service/src/init.ts
2875
2928
  import { mkdir as mkdir3, readFile as readFile12, stat as stat3, writeFile as writeFile3 } from "node:fs/promises";
2876
- import path31 from "node:path";
2929
+ import path32 from "node:path";
2877
2930
  async function initProject(directory) {
2878
- const root = path31.resolve(directory);
2931
+ const root = path32.resolve(directory);
2879
2932
  await mkdir3(root, { recursive: true });
2880
2933
  const messages = [];
2881
2934
  async function create(file, content) {
2882
2935
  try {
2883
2936
  await writeFile3(file, content, { flag: "wx" });
2884
- messages.push(`\u5DF2\u521B\u5EFA ${path31.relative(root, file)}`);
2937
+ messages.push(`\u5DF2\u521B\u5EFA ${path32.relative(root, file)}`);
2885
2938
  } catch (error) {
2886
2939
  if (error.code !== "EEXIST") throw error;
2887
- messages.push(`\u5DF2\u4FDD\u7559 ${path31.relative(root, file)}`);
2940
+ messages.push(`\u5DF2\u4FDD\u7559 ${path32.relative(root, file)}`);
2888
2941
  }
2889
2942
  }
2890
2943
  const skill = await readFile12(
2891
- path31.resolve(import.meta.dirname, "../../../skills/evidra/SKILL.md"),
2944
+ path32.resolve(import.meta.dirname, "../../../skills/evidra/SKILL.md"),
2892
2945
  "utf8"
2893
2946
  );
2894
2947
  let injected = false;
2895
2948
  for (const agent of [".claude", ".codex"]) {
2896
2949
  let exists = false;
2897
2950
  try {
2898
- exists = (await stat3(path31.join(root, agent))).isDirectory();
2951
+ exists = (await stat3(path32.join(root, agent))).isDirectory();
2899
2952
  } catch (error) {
2900
2953
  if (error.code !== "ENOENT") throw error;
2901
2954
  }
2902
2955
  if (!exists) continue;
2903
2956
  injected = true;
2904
- const target = path31.join(root, agent, "skills/evidra");
2957
+ const target = path32.join(root, agent, "skills/evidra");
2905
2958
  await mkdir3(target, { recursive: true });
2906
- await create(path31.join(target, "SKILL.md"), skill);
2959
+ await create(path32.join(target, "SKILL.md"), skill);
2907
2960
  }
2908
2961
  if (!injected) messages.push("\u672A\u53D1\u73B0 .claude \u6216 .codex \u6587\u4EF6\u5939\uFF0C\u672A\u6CE8\u5165\u4EFB\u4F55 skill\u3002");
2909
2962
  return messages;
2910
2963
  }
2911
2964
 
2912
2965
  // packages/conformance/runner/cli.ts
2913
- import { access as access2 } from "node:fs/promises";
2914
- import path32 from "node:path";
2915
- import { pathToFileURL } from "node:url";
2916
- import { tsImport } from "tsx/esm/api";
2966
+ import path33 from "node:path";
2917
2967
 
2918
2968
  // packages/conformance/runner/run.ts
2919
2969
  async function runner(common, tasks) {
@@ -2950,30 +3000,16 @@ function printResults(results) {
2950
3000
 
2951
3001
  // packages/conformance/runner/cli.ts
2952
3002
  async function runConformance(directory) {
2953
- const file = path32.resolve(directory, "evidra.conformance.ts");
2954
- await access2(file).catch(() => {
2955
- throw new Error(`\u65E0\u6CD5\u8BFB\u53D6\u914D\u7F6E\u6587\u4EF6\uFF1A${file}`);
2956
- });
2957
- let config;
2958
- try {
2959
- const loaded = (await tsImport(pathToFileURL(file).href, import.meta.url)).default;
2960
- config = loaded?.__esModule ? loaded.default : loaded;
2961
- } catch (error) {
2962
- throw new Error(
2963
- `\u52A0\u8F7D\u914D\u7F6E\u5931\u8D25 ${file}\uFF1A${error instanceof Error ? error.message : String(error)}`
2964
- );
2965
- }
2966
- if (!config || !Array.isArray(config.rules) || config.rules.some((task) => typeof task !== "function") || config.projectRoot !== void 0 && typeof config.projectRoot !== "string") {
2967
- throw new Error(`${file} \u5FC5\u987B\u9ED8\u8BA4\u5BFC\u51FA { projectRoot?: string, rules: RuleTask[] }`);
2968
- }
2969
- const projectRoot = path32.resolve(path32.dirname(file), config.projectRoot ?? ".");
2970
- return printResults(await runner({ projectRoot }, config.rules));
3003
+ const config = await loadConformanceConfig(directory);
3004
+ if (!config)
3005
+ throw new Error(`\u65E0\u6CD5\u8BFB\u53D6\u914D\u7F6E\u6587\u4EF6\uFF1A${path33.resolve(directory, "evidra.conformance.ts")}`);
3006
+ return printResults(await runner({ projectRoot: config.projectRoot }, config.rules));
2971
3007
  }
2972
3008
 
2973
3009
  // packages/service/src/cli.ts
2974
3010
  var cli = cac("evidra");
2975
3011
  cli.command("init [path]", "\u590D\u5236 skill \u5230\u9879\u76EE\uFF0C\u9ED8\u8BA4\u5F53\u524D\u76EE\u5F55").action(async (target) => {
2976
- const root = path33.resolve(target ?? process.cwd());
3012
+ const root = path34.resolve(target ?? process.cwd());
2977
3013
  console.log(`\u521D\u59CB\u5316 Evidra\uFF1A${root}`);
2978
3014
  for (const message of await initProject(root)) console.log(message);
2979
3015
  });
@@ -2982,14 +3018,14 @@ cli.command("start", "\u542F\u52A8\u5DE5\u4F5C\u53F0\uFF0C\u670D\u52A1\u5728\u52
2982
3018
  if (!Number.isInteger(port) || port < 1 || port > 65535)
2983
3019
  throw new Error("\u7AEF\u53E3\u5FC5\u987B\u662F 1\u201365535 \u7684\u6574\u6570");
2984
3020
  await startWorkbench({
2985
- repoRoot: path33.resolve(options.repo ?? process.env.TEST_REPORT_REPO ?? process.cwd()),
3021
+ repoRoot: path34.resolve(options.repo ?? process.env.TEST_REPORT_REPO ?? process.cwd()),
2986
3022
  port
2987
3023
  });
2988
3024
  });
2989
3025
  cli.command("compare", "\u8C03\u7528 core \u6BD4\u8F83\u4EFB\u52A1\u548C\u57FA\u7EBF\uFF0C\u8F93\u51FA summary").option("--repo <path>", "\u4ED3\u5E93\u8DEF\u5F84\uFF0C\u9ED8\u8BA4\u5F53\u524D\u76EE\u5F55").option("--task-id <id>", "\u4EFB\u52A1 ID").option("--full", "\u8F93\u51FA\u5B8C\u6574\u6BD4\u8F83\u7ED3\u679C").action(async (options) => {
2990
3026
  if (!options.taskId) throw new Error("\u8BF7\u63D0\u4F9B --task-id");
2991
3027
  const result = await compareTask({
2992
- repoRoot: path33.resolve(options.repo ?? process.cwd()),
3028
+ repoRoot: path34.resolve(options.repo ?? process.cwd()),
2993
3029
  taskId: options.taskId
2994
3030
  });
2995
3031
  console.log(JSON.stringify(options.full ? result : result.summary, null, 2));
@@ -2999,7 +3035,7 @@ cli.command("compare-tasks", "\u6BD4\u8F83\u4E24\u4E2A\u4EFB\u52A1\u7684\u7528\u
2999
3035
  if (!options.baseTaskId) throw new Error("\u8BF7\u63D0\u4F9B --base-task-id");
3000
3036
  if (!options.taskId) throw new Error("\u8BF7\u63D0\u4F9B --task-id");
3001
3037
  const result = await compareTasks({
3002
- repoRoot: path33.resolve(options.repo ?? process.cwd()),
3038
+ repoRoot: path34.resolve(options.repo ?? process.cwd()),
3003
3039
  baseTaskId: options.baseTaskId,
3004
3040
  taskId: options.taskId
3005
3041
  });
@@ -0,0 +1,41 @@
1
+ import type { BaselineCase, Case, Snapshot } from './model.js';
2
+ export type Change = 'added' | 'modified' | 'deleted' | 'same' | 'unavailable';
3
+ export interface SnapshotDiff {
4
+ id: string;
5
+ change: Change;
6
+ current?: Snapshot;
7
+ baseline?: Snapshot;
8
+ /** 内容(文本/像素)是否一致;change 还包含名称、布局等元数据比较。 */
9
+ contentSame?: boolean;
10
+ diffPixels?: number;
11
+ maxDiffPixels?: number;
12
+ /** 相对 reportDir 的差异图路径。 */
13
+ diffFile?: string;
14
+ /** 差异图绝对路径,供本地调用方使用。 */
15
+ diffUrl?: string;
16
+ }
17
+ export interface CaseDiff {
18
+ id: string;
19
+ change: Change;
20
+ current?: Case;
21
+ baseline?: BaselineCase;
22
+ baselineHash?: string;
23
+ snapshots: SnapshotDiff[];
24
+ }
25
+ export interface ComparisonSummary {
26
+ added: number;
27
+ modified: number;
28
+ deleted: number;
29
+ same: number;
30
+ unavailable: number;
31
+ }
32
+ export interface Comparison {
33
+ taskId: string;
34
+ namespace: string;
35
+ /** 当前基线的稳定版本,用于审批冲突检测。 */
36
+ baselineVersion: string;
37
+ /** 是否允许把缺失用例/快照作为删除项。 */
38
+ deletionAllowed: boolean;
39
+ cases: CaseDiff[];
40
+ summary: ComparisonSummary;
41
+ }
@@ -0,0 +1,19 @@
1
+ import { z } from 'zod';
2
+ export declare const NamespaceSchema: z.ZodObject<{
3
+ id: z.ZodString;
4
+ name: z.ZodString;
5
+ }, z.core.$strip>;
6
+ export declare const ConfigSchema: z.ZodObject<{
7
+ reportDir: z.ZodOptional<z.ZodString>;
8
+ namespaces: z.ZodArray<z.ZodObject<{
9
+ id: z.ZodString;
10
+ name: z.ZodString;
11
+ }, z.core.$strip>>;
12
+ }, z.core.$strip>;
13
+ export type Config = {
14
+ reportDir: string;
15
+ namespaces: Array<{
16
+ id: string;
17
+ name: string;
18
+ }>;
19
+ };
@@ -0,0 +1,6 @@
1
+ export interface FileStorage {
2
+ /** 确保资源已落盘,返回本地绝对路径。 */
3
+ localPath?(key: string): Promise<string>;
4
+ upload(key: string, body: Uint8Array): Promise<void>;
5
+ download(key: string): Promise<Uint8Array>;
6
+ }