@hamsterbase/evidra 0.4.0 → 0.5.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 (158) hide show
  1. package/dist/sdk/conformance-rules.js +145 -17
  2. package/dist/sdk/index.d.ts +1 -1
  3. package/dist/sdk/rules.d.ts +9 -2
  4. package/dist/sdk/{types-DHfARqti.d.ts → types--o0ku6ya.d.ts} +6 -0
  5. package/dist/service/cli.js +134 -43
  6. package/dist/web/assets/{cssMode-CT7qaTm_.js → cssMode-DHNTOGta.js} +1 -1
  7. package/dist/web/assets/{editor.api-CsVhWQDt.js → editor.api-DrACi4Ft.js} +1 -1
  8. package/dist/web/assets/{freemarker2-Biydhqq4.js → freemarker2-BZwhuUrf.js} +1 -1
  9. package/dist/web/assets/{handlebars-OLGn3O0q.js → handlebars-dcBiTm2k.js} +1 -1
  10. package/dist/web/assets/{html-Cw5ATHyh.js → html-4uGnY1Hx.js} +1 -1
  11. package/dist/web/assets/{htmlMode-BI1zICew.js → htmlMode-BAZ2gLM_.js} +1 -1
  12. package/dist/web/assets/{index-C49ToWrK.js → index-Cp1GHnZQ.js} +2 -2
  13. package/dist/web/assets/{javascript-BS1aYt5R.js → javascript-D-sZtKfO.js} +1 -1
  14. package/dist/web/assets/{jsonMode-DCJhJggA.js → jsonMode-BLFT3pYI.js} +1 -1
  15. package/dist/web/assets/{liquid-DoQa4FNY.js → liquid-HD6sTxLL.js} +1 -1
  16. package/dist/web/assets/{lspLanguageFeatures-D9tA1yBW.js → lspLanguageFeatures-CfU_VfTV.js} +1 -1
  17. package/dist/web/assets/main-BJxJ6lK3.js +18 -0
  18. package/dist/web/assets/main-BTS_f34X.js +26 -0
  19. package/dist/web/assets/main-CAvFOBUt.css +2 -0
  20. package/dist/web/assets/{mdx-CA3qWzFi.js → mdx-BfzD71x2.js} +1 -1
  21. package/dist/web/assets/{monaco-BtL7JKYj.js → monaco-CoScar16.js} +4 -4
  22. package/dist/web/assets/{python-BrQiqC89.js → python-Dn3yZn9U.js} +1 -1
  23. package/dist/web/assets/{razor-08hjtCNT.js → razor-Bbpo3gmC.js} +1 -1
  24. package/dist/web/assets/{tsMode-DC-2vqQt.js → tsMode-CWTXIUQy.js} +1 -1
  25. package/dist/web/assets/{typescript-9DOCFqrz.js → typescript-BdGEKF1f.js} +1 -1
  26. package/dist/web/assets/useDisplayPreference-cWXttaFP.js +89 -0
  27. package/dist/web/assets/{workers-BcFJUhLI.js → workers-yymMcYwK.js} +1 -1
  28. package/dist/web/assets/{xml-ZJo8Un2M.js → xml-dxLH6b19.js} +1 -1
  29. package/dist/web/assets/{yaml-8EZC7v3K.js → yaml-DizpY2pm.js} +1 -1
  30. package/dist/web/index.html +1 -1
  31. package/package.json +3 -2
  32. package/packages/conformance/rules/baseline-max-diff-pixels/RULE.md +21 -0
  33. package/packages/conformance/rules/index.md +1 -1
  34. package/skills/evidra/SKILL.md +7 -1
  35. package/dist/types/modules/core/contracts/comparison.d.ts +0 -41
  36. package/dist/types/modules/core/contracts/config.d.ts +0 -19
  37. package/dist/types/modules/core/contracts/context.d.ts +0 -6
  38. package/dist/types/modules/core/contracts/functions/addCase.d.ts +0 -128
  39. package/dist/types/modules/core/contracts/functions/addTask.d.ts +0 -14
  40. package/dist/types/modules/core/contracts/functions/approve.d.ts +0 -8
  41. package/dist/types/modules/core/contracts/functions/baselineChanges.d.ts +0 -14
  42. package/dist/types/modules/core/contracts/functions/compare.d.ts +0 -14
  43. package/dist/types/modules/core/contracts/functions/compareTask.d.ts +0 -6
  44. package/dist/types/modules/core/contracts/functions/compareTasks.d.ts +0 -18
  45. package/dist/types/modules/core/contracts/functions/deleteBaselineFile.d.ts +0 -8
  46. package/dist/types/modules/core/contracts/functions/finishTask.d.ts +0 -8
  47. package/dist/types/modules/core/contracts/functions/getBaseline.d.ts +0 -10
  48. package/dist/types/modules/core/contracts/functions/getBaselineChanges.d.ts +0 -6
  49. package/dist/types/modules/core/contracts/functions/getGitChanges.d.ts +0 -6
  50. package/dist/types/modules/core/contracts/functions/getGitDiff.d.ts +0 -8
  51. package/dist/types/modules/core/contracts/functions/getTaskCase.d.ts +0 -23
  52. package/dist/types/modules/core/contracts/functions/getTaskTree.d.ts +0 -21
  53. package/dist/types/modules/core/contracts/functions/gitChanges.d.ts +0 -25
  54. package/dist/types/modules/core/contracts/functions/index.d.ts +0 -18
  55. package/dist/types/modules/core/contracts/functions/listBaselines.d.ts +0 -5
  56. package/dist/types/modules/core/contracts/functions/listRuns.d.ts +0 -7
  57. package/dist/types/modules/core/contracts/functions/listTaskSummaries.d.ts +0 -15
  58. package/dist/types/modules/core/contracts/functions/listTasks.d.ts +0 -15
  59. package/dist/types/modules/core/contracts/functions/loadConfig.d.ts +0 -5
  60. package/dist/types/modules/core/contracts/functions/readProjectInfo.d.ts +0 -5
  61. package/dist/types/modules/core/contracts/functions/readTaskReport.d.ts +0 -6
  62. package/dist/types/modules/core/contracts/functions/resolveConfig.d.ts +0 -6
  63. package/dist/types/modules/core/contracts/functions/reviewBaselineChanges.d.ts +0 -9
  64. package/dist/types/modules/core/contracts/functions/reviewCodeChanges.d.ts +0 -9
  65. package/dist/types/modules/core/contracts/functions/taskRecords.d.ts +0 -6
  66. package/dist/types/modules/core/contracts/functions/updateBaseline.d.ts +0 -20
  67. package/dist/types/modules/core/contracts/git.d.ts +0 -14
  68. package/dist/types/modules/core/contracts/imageDiffPool.d.ts +0 -5
  69. package/dist/types/modules/core/contracts/index.d.ts +0 -30
  70. package/dist/types/modules/core/contracts/internal/compare.d.ts +0 -14
  71. package/dist/types/modules/core/contracts/internal/getBaseline.d.ts +0 -10
  72. package/dist/types/modules/core/contracts/internal/listTasks.d.ts +0 -12
  73. package/dist/types/modules/core/contracts/internal/taskRecords.d.ts +0 -6
  74. package/dist/types/modules/core/contracts/internal/updateBaseline.d.ts +0 -20
  75. package/dist/types/modules/core/contracts/model.d.ts +0 -80
  76. package/dist/types/modules/core/contracts/report.d.ts +0 -52
  77. package/dist/types/modules/core/contracts/repository.d.ts +0 -5
  78. package/dist/types/modules/core/contracts/requests.d.ts +0 -23
  79. package/dist/types/modules/core/contracts/scanCases.d.ts +0 -15
  80. package/dist/types/modules/core/contracts/shared.d.ts +0 -6
  81. package/dist/types/modules/core/contracts/snapshots.d.ts +0 -6
  82. package/dist/types/modules/core/contracts/taskRecord.d.ts +0 -76
  83. package/dist/types/modules/core/implementations/Functions/addCase.d.ts +0 -4
  84. package/dist/types/modules/core/implementations/Functions/addTask.d.ts +0 -4
  85. package/dist/types/modules/core/implementations/Functions/approve.d.ts +0 -6
  86. package/dist/types/modules/core/implementations/Functions/compare.d.ts +0 -15
  87. package/dist/types/modules/core/implementations/Functions/compareTask.d.ts +0 -3
  88. package/dist/types/modules/core/implementations/Functions/compareTasks.d.ts +0 -5
  89. package/dist/types/modules/core/implementations/Functions/deleteBaselineFile.d.ts +0 -4
  90. package/dist/types/modules/core/implementations/Functions/finishTask.d.ts +0 -4
  91. package/dist/types/modules/core/implementations/Functions/getBaseline.d.ts +0 -4
  92. package/dist/types/modules/core/implementations/Functions/getBaselineChanges.d.ts +0 -4
  93. package/dist/types/modules/core/implementations/Functions/getGitChanges.d.ts +0 -3
  94. package/dist/types/modules/core/implementations/Functions/getGitDiff.d.ts +0 -3
  95. package/dist/types/modules/core/implementations/Functions/getTaskCase.d.ts +0 -5
  96. package/dist/types/modules/core/implementations/Functions/getTaskTree.d.ts +0 -5
  97. package/dist/types/modules/core/implementations/Functions/listBaselines.d.ts +0 -3
  98. package/dist/types/modules/core/implementations/Functions/listTaskSummaries.d.ts +0 -2
  99. package/dist/types/modules/core/implementations/Functions/listTasks.d.ts +0 -4
  100. package/dist/types/modules/core/implementations/Functions/loadConfig.d.ts +0 -3
  101. package/dist/types/modules/core/implementations/Functions/readProjectInfo.d.ts +0 -3
  102. package/dist/types/modules/core/implementations/Functions/readTaskReport.d.ts +0 -3
  103. package/dist/types/modules/core/implementations/Functions/resolveConfig.d.ts +0 -9
  104. package/dist/types/modules/core/implementations/Functions/reviewBaselineChanges.d.ts +0 -4
  105. package/dist/types/modules/core/implementations/Functions/reviewCodeChanges.d.ts +0 -4
  106. package/dist/types/modules/core/implementations/Functions/taskRecords.d.ts +0 -4
  107. package/dist/types/modules/core/implementations/Functions/updateBaseline.d.ts +0 -5
  108. package/dist/types/modules/core/implementations/Utils/assertNamespace.d.ts +0 -1
  109. package/dist/types/modules/core/implementations/Utils/canonical.d.ts +0 -1
  110. package/dist/types/modules/core/implementations/Utils/createTaskId.d.ts +0 -1
  111. package/dist/types/modules/core/implementations/Utils/deletionAllowed.d.ts +0 -2
  112. package/dist/types/modules/core/implementations/Utils/download.d.ts +0 -3
  113. package/dist/types/modules/core/implementations/Utils/hash.d.ts +0 -1
  114. package/dist/types/modules/core/implementations/Utils/imageDiffPool.d.ts +0 -18
  115. package/dist/types/modules/core/implementations/Utils/imageKey.d.ts +0 -1
  116. package/dist/types/modules/core/implementations/Utils/loadBaseline.d.ts +0 -4
  117. package/dist/types/modules/core/implementations/Utils/mapLimit.d.ts +0 -1
  118. package/dist/types/modules/core/implementations/Utils/observationKey.d.ts +0 -1
  119. package/dist/types/modules/core/implementations/Utils/pngSize.d.ts +0 -4
  120. package/dist/types/modules/core/implementations/Utils/readJson.d.ts +0 -1
  121. package/dist/types/modules/core/implementations/Utils/readTaskRecord.d.ts +0 -2
  122. package/dist/types/modules/core/implementations/Utils/scanCases.d.ts +0 -9
  123. package/dist/types/modules/core/implementations/Utils/taskDirectory.d.ts +0 -1
  124. package/dist/types/modules/core/implementations/Utils/toCase.d.ts +0 -3
  125. package/dist/types/modules/core/implementations/Utils/toObservation.d.ts +0 -3
  126. package/dist/types/modules/core/implementations/Utils/toSnapshot.d.ts +0 -3
  127. package/dist/types/modules/core/implementations/Utils/writeBytesAtomic.d.ts +0 -1
  128. package/dist/types/modules/core/implementations/Utils/writeJsonAtomic.d.ts +0 -1
  129. package/dist/types/modules/core/implementations/Utils/writeTextAtomic.d.ts +0 -1
  130. package/dist/types/modules/core/implementations/baselineChanges.d.ts +0 -6
  131. package/dist/types/modules/core/implementations/config.d.ts +0 -6
  132. package/dist/types/modules/core/implementations/content.d.ts +0 -1
  133. package/dist/types/modules/core/implementations/evidra.d.ts +0 -31
  134. package/dist/types/modules/core/implementations/git.d.ts +0 -11
  135. package/dist/types/modules/core/implementations/gitChanges.d.ts +0 -29
  136. package/dist/types/modules/core/implementations/index.d.ts +0 -17
  137. package/dist/types/modules/core/implementations/internal/compare.d.ts +0 -15
  138. package/dist/types/modules/core/implementations/internal/getBaseline.d.ts +0 -4
  139. package/dist/types/modules/core/implementations/internal/listTasks.d.ts +0 -2
  140. package/dist/types/modules/core/implementations/internal/taskRecords.d.ts +0 -4
  141. package/dist/types/modules/core/implementations/internal/updateBaseline.d.ts +0 -5
  142. package/dist/types/modules/core/implementations/paths.d.ts +0 -48
  143. package/dist/types/modules/core/implementations/report.d.ts +0 -3
  144. package/dist/types/modules/core/implementations/reportResources.d.ts +0 -4
  145. package/dist/types/modules/core/implementations/reportStatus.d.ts +0 -10
  146. package/dist/types/modules/core/implementations/reportTree.d.ts +0 -5
  147. package/dist/types/modules/core/implementations/repository.d.ts +0 -10
  148. package/dist/types/modules/core/implementations/requests.d.ts +0 -13
  149. package/dist/types/modules/core/implementations/snapshots.d.ts +0 -11
  150. package/dist/types/modules/core/implementations/storage/local.d.ts +0 -3
  151. package/dist/types/modules/core/implementations/storage/objects.d.ts +0 -3
  152. package/dist/types/modules/core/index.d.ts +0 -21
  153. package/dist/types/packages/sdk/src/index.d.ts +0 -21
  154. package/dist/types/packages/sdk/src/types.d.ts +0 -9
  155. package/dist/web/assets/main-BO3J7gmH.css +0 -2
  156. package/dist/web/assets/main-DqSNHHTP.js +0 -13
  157. package/dist/web/assets/main-TbSjhXd2.js +0 -18
  158. package/dist/web/assets/useDisplayPreference-B-z8NzSv.js +0 -23
@@ -1,12 +1,107 @@
1
1
  import path from "node:path";
2
+ import { glob, readFile, stat } from "node:fs/promises";
2
3
  import { promisify } from "node:util";
3
4
  import { promises } from "node:fs";
4
5
  import { execFile } from "node:child_process";
5
6
  import { parseSync } from "oxc-parser";
7
+ // packages/conformance/builtinRules.ts
8
+ /** 内置规约的稳定 ID 同时对应随包发布的文档目录。 */
9
+ const builtinRules = {
10
+ baselineMaxDiffPixels: {
11
+ id: "baseline-max-diff-pixels",
12
+ displayName: "限制基线允许差异像素"
13
+ },
14
+ commitMessage: {
15
+ id: "commit-message",
16
+ displayName: "检查提交标题"
17
+ },
18
+ duplicateLocalization: {
19
+ id: "duplicate-localization",
20
+ displayName: "检查本地化键与默认文案"
21
+ },
22
+ e2eScenariosStructure: {
23
+ id: "e2e-scenarios-structure",
24
+ displayName: "检查端到端场景结构"
25
+ },
26
+ sameDirImportOnly: {
27
+ id: "same-dir-import-only",
28
+ displayName: "限制跨目录引用"
29
+ },
30
+ singleComponentFile: {
31
+ id: "single-component-file",
32
+ displayName: "单文件单组件"
33
+ },
34
+ sourceLocaleDefaults: {
35
+ id: "source-locale-defaults",
36
+ displayName: "检查源语言默认文案"
37
+ },
38
+ syncLocales: {
39
+ id: "sync-locales",
40
+ displayName: "同步本地化文件"
41
+ },
42
+ uiScenariosStructure: {
43
+ id: "ui-scenarios-structure",
44
+ displayName: "检查界面场景结构"
45
+ }
46
+ };
47
+ // packages/conformance/rules/baseline-max-diff-pixels/index.ts
48
+ function baselineMaxDiffPixels(options) {
49
+ const rule = builtinRules.baselineMaxDiffPixels;
50
+ const task = async ({ projectRoot }) => {
51
+ const { baselineDir, maxDiffPixels } = options;
52
+ if (typeof baselineDir !== "string" || !baselineDir.trim()) throw new Error("baselineDir 必须指定基线目录");
53
+ if (!Number.isSafeInteger(maxDiffPixels) || maxDiffPixels < 0) throw new Error("maxDiffPixels 必须是非负整数");
54
+ const root = path.resolve(projectRoot, baselineDir);
55
+ if (!(await stat(root)).isDirectory()) throw new Error(`基线路径必须是目录:${root}`);
56
+ const files = [];
57
+ for await (const file of glob("**/baseline*.json", {
58
+ cwd: root,
59
+ exclude: [
60
+ "**/node_modules/**",
61
+ "**/.git/**",
62
+ "**/cache/**"
63
+ ]
64
+ })) if (/^baseline(?:-[a-f0-9]{64})?\.json$/.test(path.basename(file))) files.push(file);
65
+ files.sort();
66
+ let imageCount = 0;
67
+ const findings = [];
68
+ for (const file of files) {
69
+ const baselinePath = path.join(root, file);
70
+ const relative = path.relative(projectRoot, baselinePath);
71
+ let baseline;
72
+ try {
73
+ baseline = JSON.parse(await readFile(baselinePath, "utf8"));
74
+ } catch (error) {
75
+ findings.push(`${relative} 无法读取基线:${String(error)}`);
76
+ continue;
77
+ }
78
+ if (!Array.isArray(baseline?.snapshots)) continue;
79
+ for (const snapshot of baseline.snapshots) {
80
+ if (snapshot?.type !== "image") continue;
81
+ imageCount++;
82
+ const tolerance = snapshot.maxDiffPixels ?? 0;
83
+ const label = `${relative} / ${baseline.name || baseline.id} / ${snapshot.name || snapshot.id}`;
84
+ if (!Number.isSafeInteger(tolerance) || tolerance < 0) findings.push(`${label} 的 maxDiffPixels 无效(${String(tolerance)})`);
85
+ else if (tolerance > maxDiffPixels) findings.push(`${label} 的 maxDiffPixels 为 ${tolerance},超过上限 ${maxDiffPixels}`);
86
+ }
87
+ }
88
+ return {
89
+ name: rule.id,
90
+ success: findings.length === 0,
91
+ messages: [`检查了 ${imageCount} 张基线图片,maxDiffPixels 上限为 ${maxDiffPixels}。`, ...findings].join("\n"),
92
+ howToFix: findings.length ? "检查报告中的文件和快照。需要调整阈值时,从测试上报配置设置 maxDiffPixels,重新上报后由用户审核基线。" : ""
93
+ };
94
+ };
95
+ return Object.assign(task, {
96
+ ...rule,
97
+ readme: { builtin: rule.id }
98
+ });
99
+ }
6
100
  // packages/conformance/rules/commit-message/index.ts
7
101
  const execFileAsync = promisify(execFile);
8
102
  function commitMessage(config = {}) {
9
- const ruleName = "commit-message";
103
+ const rule = builtinRules.commitMessage;
104
+ const ruleName = rule.id;
10
105
  const task = async (common) => {
11
106
  const { commits, scope } = await collectCommitSubjects(common.projectRoot, config.base);
12
107
  const violations = commits.filter((commit) => (config.forbiddenPrefixes ?? ["```"]).some((prefix) => commit.subject.startsWith(prefix)));
@@ -29,7 +124,10 @@ function commitMessage(config = {}) {
29
124
  howToFix: "修改对应提交 message,移除禁止的前缀。"
30
125
  };
31
126
  };
32
- return Object.assign(task, { displayName: ruleName });
127
+ return Object.assign(task, {
128
+ ...rule,
129
+ readme: { builtin: rule.id }
130
+ });
33
131
  }
34
132
  async function collectCommitSubjects(repoRoot, base) {
35
133
  const upstream = base ?? await readUpstream(repoRoot);
@@ -83,7 +181,8 @@ const SKIP_AST_KEYS$6 = /* @__PURE__ */ new Set([
83
181
  "trailingComments"
84
182
  ]);
85
183
  function duplicateLocalization(config) {
86
- const ruleName = "duplicate-localization";
184
+ const rule = builtinRules.duplicateLocalization;
185
+ const ruleName = rule.id;
87
186
  const task = async (common) => {
88
187
  const options = {
89
188
  ...config,
@@ -152,7 +251,10 @@ function duplicateLocalization(config) {
152
251
  howToFix: success ? "" : "Replace template literals with string literals, and unify duplicate keys to share a single default message."
153
252
  };
154
253
  };
155
- return Object.assign(task, { displayName: ruleName });
254
+ return Object.assign(task, {
255
+ ...rule,
256
+ readme: { builtin: rule.id }
257
+ });
156
258
  }
157
259
  async function collectSourceFiles$2(root, excludeDirs, skipDirNames = [
158
260
  "node_modules",
@@ -249,7 +351,8 @@ const SKIP_AST_KEYS$5 = /* @__PURE__ */ new Set([
249
351
  "trailingComments"
250
352
  ]);
251
353
  function syncLocales(config) {
252
- const ruleName = "sync-locales";
354
+ const rule = builtinRules.syncLocales;
355
+ const ruleName = rule.id;
253
356
  const task = async (common) => {
254
357
  const options = {
255
358
  ...config,
@@ -313,7 +416,10 @@ function syncLocales(config) {
313
416
  howToFix: howToFix.join(" ")
314
417
  };
315
418
  };
316
- return Object.assign(task, { displayName: ruleName });
419
+ return Object.assign(task, {
420
+ ...rule,
421
+ readme: { builtin: rule.id }
422
+ });
317
423
  }
318
424
  function mergeDefaultLocale(oldConfig, newLocale, metadataKey) {
319
425
  const result = {};
@@ -454,7 +560,8 @@ const ESM_SOURCE_EXTENSIONS = {
454
560
  ".jsx": [".tsx"]
455
561
  };
456
562
  function sameDirImportOnly(config) {
457
- const ruleName = "same-dir-import-only";
563
+ const rule = builtinRules.sameDirImportOnly;
564
+ const ruleName = rule.id;
458
565
  const task = async (common) => {
459
566
  const marker = config.marker ?? "@import-scope same-dir";
460
567
  const aliases = Object.entries(config.aliases ?? {}).sort(([a], [b]) => b.length - a.length).map(([prefix, target]) => [prefix, path.resolve(common.projectRoot, target)]);
@@ -503,7 +610,10 @@ function sameDirImportOnly(config) {
503
610
  howToFix: `Only import files marked with '${marker}' from files in the same directory, or move shared API into an unmarked file.`
504
611
  };
505
612
  };
506
- return Object.assign(task, { displayName: ruleName });
613
+ return Object.assign(task, {
614
+ ...rule,
615
+ readme: { builtin: rule.id }
616
+ });
507
617
  }
508
618
  async function collectSourceFiles(root, excludeDirs, skipDirNames = [
509
619
  "node_modules",
@@ -730,7 +840,8 @@ function formatLocation$3(repoRoot, file, line) {
730
840
  const CJK_PATTERN = /[\u4e00-\u9fff\u3400-\u4dbf\u3000-\u303f\uff00-\uffef]/;
731
841
  /** 本地化调用在代码中的默认文案必须使用源语言(不匹配 pattern),翻译放在语言文件中。 */
732
842
  function sourceLocaleDefaults(options) {
733
- const ruleName = "source-locale-defaults";
843
+ const rule = builtinRules.sourceLocaleDefaults;
844
+ const ruleName = rule.id;
734
845
  const task = async (context) => {
735
846
  const files = await collectFiles$3(context.projectRoot, options, [".ts", ".tsx"]);
736
847
  const findings = [];
@@ -764,7 +875,10 @@ function sourceLocaleDefaults(options) {
764
875
  howToFix: "默认文案改用源语言,其他语言的翻译写入语言文件。"
765
876
  };
766
877
  };
767
- return Object.assign(task, { displayName: ruleName });
878
+ return Object.assign(task, {
879
+ ...rule,
880
+ readme: { builtin: rule.id }
881
+ });
768
882
  }
769
883
  function matchCall(calls, callee) {
770
884
  if (!callee) return void 0;
@@ -885,7 +999,8 @@ function formatLocation$2(repoRoot, file, line) {
885
999
  // packages/conformance/rules/single-component-file/index.ts
886
1000
  /** 每个 TSX 文件只定义一个返回 JSX 的组件。 */
887
1001
  function singleComponentFile(options) {
888
- const ruleName = "single-component-file";
1002
+ const rule = builtinRules.singleComponentFile;
1003
+ const ruleName = rule.id;
889
1004
  const task = async (context) => {
890
1005
  const wrappers = new Set(options.componentWrappers ?? ["memo", "forwardRef"]);
891
1006
  const files = await collectFiles$2(context.projectRoot, options, [".tsx"]);
@@ -919,7 +1034,10 @@ function singleComponentFile(options) {
919
1034
  howToFix: "把多出的组件移到各自的 TSX 文件,每个文件只保留一个组件。"
920
1035
  };
921
1036
  };
922
- return Object.assign(task, { displayName: ruleName });
1037
+ return Object.assign(task, {
1038
+ ...rule,
1039
+ readme: { builtin: rule.id }
1040
+ });
923
1041
  }
924
1042
  function readComponentName(node, wrappers) {
925
1043
  if (node.type === "FunctionDeclaration" || node.type === "ClassDeclaration") {
@@ -1064,7 +1182,8 @@ function formatLocation$1(repoRoot, file, line) {
1064
1182
  * 且 shared 与 utils 互不引用。
1065
1183
  */
1066
1184
  function e2eScenariosStructure(options) {
1067
- const ruleName = options.name ?? "e2e-scenarios-structure";
1185
+ const rule = builtinRules.e2eScenariosStructure;
1186
+ const ruleName = options.name ?? rule.id;
1068
1187
  const task = async (context) => {
1069
1188
  const repoRoot = context.projectRoot;
1070
1189
  const entrySuffix = options.entrySuffix ?? ".spec.ts";
@@ -1160,7 +1279,11 @@ function e2eScenariosStructure(options) {
1160
1279
  howToFix: success ? "" : `helper 移出入口文件:被 ${threshold} 个及以上入口使用的放到 ${sharedName},其余放到 ${utilsName}/<入口名>;${sharedName} 与 ${utilsName} 不要互相引用。`
1161
1280
  };
1162
1281
  };
1163
- return Object.assign(task, { displayName: ruleName });
1282
+ return Object.assign(task, {
1283
+ ...rule,
1284
+ displayName: options.name ?? rule.displayName,
1285
+ readme: { builtin: rule.id }
1286
+ });
1164
1287
  }
1165
1288
  function readFunctionName$1(node) {
1166
1289
  if (node.type === "FunctionDeclaration") return readName$1(node.id) ?? "匿名函数";
@@ -1300,7 +1423,8 @@ function formatLocation(repoRoot, file, line) {
1300
1423
  * 且 shared 与 utils 互不引用。
1301
1424
  */
1302
1425
  function uiScenariosStructure(options) {
1303
- const ruleName = options.name ?? "ui-scenarios-structure";
1426
+ const rule = builtinRules.uiScenariosStructure;
1427
+ const ruleName = options.name ?? rule.id;
1304
1428
  const task = async (context) => {
1305
1429
  const repoRoot = context.projectRoot;
1306
1430
  const entrySuffix = options.entrySuffix ?? ".ts";
@@ -1399,7 +1523,11 @@ function uiScenariosStructure(options) {
1399
1523
  howToFix: success ? "" : `helper 移出入口文件:被 ${threshold} 个及以上入口使用的放到 ${sharedName},其余放到 ${utilsName}/<入口名>;${sharedName} 与 ${utilsName} 不要互相引用。`
1400
1524
  };
1401
1525
  };
1402
- return Object.assign(task, { displayName: ruleName });
1526
+ return Object.assign(task, {
1527
+ ...rule,
1528
+ displayName: options.name ?? rule.displayName,
1529
+ readme: { builtin: rule.id }
1530
+ });
1403
1531
  }
1404
1532
  function readFunctionName(node) {
1405
1533
  if (node.type === "FunctionDeclaration") return readName(node.id) ?? "匿名函数";
@@ -1465,4 +1593,4 @@ function collectImports(source, prefix) {
1465
1593
  }
1466
1594
  return imports;
1467
1595
  }
1468
- export { CJK_PATTERN, commitMessage, duplicateLocalization, e2eScenariosStructure, sameDirImportOnly, singleComponentFile, sourceLocaleDefaults, syncLocales, uiScenariosStructure };
1596
+ export { CJK_PATTERN, baselineMaxDiffPixels, commitMessage, duplicateLocalization, e2eScenariosStructure, sameDirImportOnly, singleComponentFile, sourceLocaleDefaults, syncLocales, uiScenariosStructure };
@@ -1,4 +1,4 @@
1
- import { n as RuleResult, r as RuleTask, t as CommonConfig } from "./types-DHfARqti.js";
1
+ import { n as RuleResult, r as RuleTask, t as CommonConfig } from "./types--o0ku6ya.js";
2
2
  /** evidra.conformance.ts 的默认导出。 */
3
3
  interface Config {
4
4
  /** 默认配置文件所在目录;相对路径也基于配置文件所在目录。 */
@@ -1,4 +1,11 @@
1
- import { r as RuleTask } from "./types-DHfARqti.js";
1
+ import { r as RuleTask } from "./types--o0ku6ya.js";
2
+ interface BaselineMaxDiffPixelsOptions {
3
+ /** 基线文件目录,支持绝对路径或相对 projectRoot 的路径。 */
4
+ baselineDir: string;
5
+ /** 每张基线图片允许配置的最大差异像素数。 */
6
+ maxDiffPixels: number;
7
+ }
8
+ export declare function baselineMaxDiffPixels(options: BaselineMaxDiffPixelsOptions): RuleTask;
2
9
  /** Git 提交标题检查配置。 */
3
10
  interface CommitMessageOptions {
4
11
  /** 禁止的提交标题前缀,默认 ["```"];传入空数组时不限制前缀。 */
@@ -146,4 +153,4 @@ interface UiScenariosStructureOptions {
146
153
  * 且 shared 与 utils 互不引用。
147
154
  */
148
155
  export declare function uiScenariosStructure(options: UiScenariosStructureOptions): RuleTask;
149
- export type { CommitMessageOptions, DuplicateLocalizationOptions, E2eScenariosStructureOptions, LocalizationCall, SameDirImportOnlyOptions, SingleComponentFileOptions, SourceLocaleDefaultsOptions, SyncLocalesOptions, UiScenariosStructureOptions };
156
+ export type { BaselineMaxDiffPixelsOptions, CommitMessageOptions, DuplicateLocalizationOptions, E2eScenariosStructureOptions, LocalizationCall, SameDirImportOnlyOptions, SingleComponentFileOptions, SourceLocaleDefaultsOptions, SyncLocalesOptions, UiScenariosStructureOptions };
@@ -9,7 +9,13 @@ interface CommonConfig {
9
9
  readonly projectRoot: string;
10
10
  }
11
11
  type RuleTask = ((commonConfig: CommonConfig) => Promise<RuleResult>) & {
12
+ /** 规约的稳定 ID,报告按此归并同一规约的配置。 */
13
+ readonly id?: string;
12
14
  /** 用于在执行前展示规则名称。 */
13
15
  readonly displayName?: string;
16
+ /** 相对于配置文件的 Markdown 路径,或内置规约文档的目录名。 */
17
+ readonly readme?: string | {
18
+ readonly builtin: string;
19
+ };
14
20
  };
15
21
  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 path34 from "node:path";
3
+ import path35 from "node:path";
4
4
 
5
5
  // modules/core/implementations/Functions/resolveConfig.ts
6
6
  import path3 from "node:path";
@@ -1493,15 +1493,15 @@ async function worktreeSide(repo, file) {
1493
1493
  const relative = path18.relative(repo, parent);
1494
1494
  if (relative === ".." || relative.startsWith(`..${path18.sep}`) || path18.isAbsolute(relative))
1495
1495
  throw new Error("\u6587\u4EF6\u4E0D\u5728\u4ED3\u5E93\u5185");
1496
- const stat4 = await lstat(absolute);
1497
- if (stat4.isSymbolicLink()) return { mode: "120000", hash: hash(await readlink(absolute)) };
1498
- if (stat4.isDirectory()) {
1496
+ const stat5 = await lstat(absolute);
1497
+ if (stat5.isSymbolicLink()) return { mode: "120000", hash: hash(await readlink(absolute)) };
1498
+ if (stat5.isDirectory()) {
1499
1499
  const commit = (await git(absolute, ["rev-parse", "HEAD"])).trim();
1500
1500
  return { mode: "160000", hash: hash(`Subproject commit ${commit}
1501
1501
  `) };
1502
1502
  }
1503
1503
  return {
1504
- mode: stat4.mode & 73 ? "100755" : "100644",
1504
+ mode: stat5.mode & 73 ? "100755" : "100644",
1505
1505
  hash: await fileDigest(absolute)
1506
1506
  };
1507
1507
  }
@@ -2017,12 +2017,12 @@ async function getGitDiff(input) {
2017
2017
  const relative = path24.relative(repo, parent);
2018
2018
  if (relative === ".." || relative.startsWith(`..${path24.sep}`) || path24.isAbsolute(relative))
2019
2019
  throw new Error("\u6587\u4EF6\u4E0D\u5728\u4ED3\u5E93\u5185");
2020
- const stat4 = await lstat2(absolute);
2021
- if (stat4.isSymbolicLink()) modified = await readlink2(absolute);
2022
- else if (stat4.isDirectory())
2020
+ const stat5 = await lstat2(absolute);
2021
+ if (stat5.isSymbolicLink()) modified = await readlink2(absolute);
2022
+ else if (stat5.isDirectory())
2023
2023
  modified = `Subproject commit ${(await git(absolute, ["rev-parse", "HEAD"])).trim()}
2024
2024
  `;
2025
- else if (stat4.size > MAX_BYTES) tooLarge = true;
2025
+ else if (stat5.size > MAX_BYTES) tooLarge = true;
2026
2026
  else modified = await readFile10(absolute, "utf8");
2027
2027
  }
2028
2028
  const isBinary = original.includes("\0") || modified.includes("\0");
@@ -2652,11 +2652,30 @@ import process2 from "node:process";
2652
2652
  // packages/service/src/server.ts
2653
2653
  import { serve } from "@hono/node-server";
2654
2654
  import { serveStatic } from "@hono/node-server/serve-static";
2655
- import { Hono } from "hono";
2655
+ import { Hono as Hono2 } from "hono";
2656
+ import { existsSync as existsSync2 } from "node:fs";
2657
+ import { stat as stat3 } from "node:fs/promises";
2658
+ import path32 from "node:path";
2659
+ import { z as z27 } from "zod";
2660
+
2661
+ // packages/service/src/conformance.ts
2656
2662
  import { existsSync } from "node:fs";
2657
- import { stat as stat2 } from "node:fs/promises";
2663
+ import { readFile as readFile12, realpath as realpath3, stat as stat2 } from "node:fs/promises";
2658
2664
  import path31 from "node:path";
2659
- import { z as z27 } from "zod";
2665
+ import { Hono } from "hono";
2666
+
2667
+ // packages/conformance/builtinRules.ts
2668
+ var builtinRules = {
2669
+ baselineMaxDiffPixels: { id: "baseline-max-diff-pixels", displayName: "\u9650\u5236\u57FA\u7EBF\u5141\u8BB8\u5DEE\u5F02\u50CF\u7D20" },
2670
+ commitMessage: { id: "commit-message", displayName: "\u68C0\u67E5\u63D0\u4EA4\u6807\u9898" },
2671
+ duplicateLocalization: { id: "duplicate-localization", displayName: "\u68C0\u67E5\u672C\u5730\u5316\u952E\u4E0E\u9ED8\u8BA4\u6587\u6848" },
2672
+ e2eScenariosStructure: { id: "e2e-scenarios-structure", displayName: "\u68C0\u67E5\u7AEF\u5230\u7AEF\u573A\u666F\u7ED3\u6784" },
2673
+ sameDirImportOnly: { id: "same-dir-import-only", displayName: "\u9650\u5236\u8DE8\u76EE\u5F55\u5F15\u7528" },
2674
+ singleComponentFile: { id: "single-component-file", displayName: "\u5355\u6587\u4EF6\u5355\u7EC4\u4EF6" },
2675
+ sourceLocaleDefaults: { id: "source-locale-defaults", displayName: "\u68C0\u67E5\u6E90\u8BED\u8A00\u9ED8\u8BA4\u6587\u6848" },
2676
+ syncLocales: { id: "sync-locales", displayName: "\u540C\u6B65\u672C\u5730\u5316\u6587\u4EF6" },
2677
+ uiScenariosStructure: { id: "ui-scenarios-structure", displayName: "\u68C0\u67E5\u754C\u9762\u573A\u666F\u7ED3\u6784" }
2678
+ };
2660
2679
 
2661
2680
  // packages/conformance/runner/load.ts
2662
2681
  import { access as access2 } from "node:fs/promises";
@@ -2687,14 +2706,92 @@ async function loadConformanceConfig(directory) {
2687
2706
  return { projectRoot, rules: config.rules };
2688
2707
  }
2689
2708
 
2709
+ // packages/service/src/conformance.ts
2710
+ var builtinDirectory = [
2711
+ path31.resolve(import.meta.dirname, "../../conformance/rules"),
2712
+ path31.resolve(import.meta.dirname, "../../packages/conformance/rules")
2713
+ ].find((directory) => existsSync(directory));
2714
+ var catalog = Object.values(builtinRules);
2715
+ async function listRules(root) {
2716
+ const config = await loadConformanceConfig(root);
2717
+ const entries2 = /* @__PURE__ */ new Map();
2718
+ for (const [index, task] of (config?.rules ?? []).entries()) {
2719
+ const builtin = typeof task.readme === "object" ? task.readme?.builtin : void 0;
2720
+ const id = builtin || task.id?.trim() || task.name || `rule-${index + 1}`;
2721
+ if (entries2.has(id)) continue;
2722
+ const bundled = catalog.find((rule) => rule.id === id);
2723
+ entries2.set(id, {
2724
+ id,
2725
+ displayName: task.displayName?.trim() || bundled?.displayName || task.name || `\u81EA\u5B9A\u4E49\u89C4\u7EA6 ${index + 1}`,
2726
+ enabled: true,
2727
+ readme: task.readme ?? (bundled && { builtin: bundled.id })
2728
+ });
2729
+ }
2730
+ const rules = config ? Array.from(entries2.values(), (entry) => entry.displayName) : null;
2731
+ for (const rule of catalog) {
2732
+ if (!entries2.has(rule.id)) {
2733
+ entries2.set(rule.id, { ...rule, enabled: false, readme: { builtin: rule.id } });
2734
+ }
2735
+ }
2736
+ return { rules, entries: entries2 };
2737
+ }
2738
+ function isWithin(directory, file) {
2739
+ const relative = path31.relative(directory, file);
2740
+ return relative !== ".." && !relative.startsWith(`..${path31.sep}`) && !path31.isAbsolute(relative);
2741
+ }
2742
+ async function resolveMarkdown(directory, file) {
2743
+ if (path31.isAbsolute(file) || path31.extname(file).toLowerCase() !== ".md") return null;
2744
+ const candidate = path31.resolve(directory, file);
2745
+ if (!isWithin(directory, candidate)) return null;
2746
+ try {
2747
+ const resolved = await realpath3(candidate);
2748
+ if (!isWithin(await realpath3(directory), resolved) || !(await stat2(resolved)).isFile())
2749
+ return null;
2750
+ return resolved;
2751
+ } catch (error) {
2752
+ if (["ENOENT", "ENOTDIR"].includes(error.code ?? "")) return null;
2753
+ throw error;
2754
+ }
2755
+ }
2756
+ async function resolveReadme(root, readme) {
2757
+ if (typeof readme === "string") return resolveMarkdown(root, readme);
2758
+ if (!readme || !builtinDirectory) return null;
2759
+ return await resolveMarkdown(builtinDirectory, path31.join(readme.builtin, "README.md")) ?? resolveMarkdown(builtinDirectory, path31.join(readme.builtin, "RULE.md"));
2760
+ }
2761
+ function createConformanceRoutes(root) {
2762
+ const app = new Hono();
2763
+ app.get("/", async (context) => {
2764
+ const { rules, entries: entries2 } = await listRules(root);
2765
+ return context.json({
2766
+ rules,
2767
+ entries: await Promise.all(
2768
+ Array.from(entries2.values(), async ({ readme, ...entry }) => ({
2769
+ ...entry,
2770
+ hasReadme: !!await resolveReadme(root, readme)
2771
+ }))
2772
+ )
2773
+ });
2774
+ });
2775
+ app.get("/readme", async (context) => {
2776
+ const id = context.req.query("rule");
2777
+ const { entries: entries2 } = await listRules(root);
2778
+ const rule = id ? entries2.get(id) : void 0;
2779
+ if (!rule) return context.json({ error: "\u627E\u4E0D\u5230\u6307\u5B9A\u89C4\u7EA6" }, 404);
2780
+ const readme = await resolveReadme(root, rule.readme);
2781
+ const markdown = readme ? await readFile12(readme, "utf8") : null;
2782
+ return context.json({ markdown });
2783
+ });
2784
+ return app;
2785
+ }
2786
+
2690
2787
  // packages/service/src/server.ts
2691
2788
  function defaultWebDist() {
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;
2789
+ const fromSource = path32.resolve(import.meta.dirname, "../../../dist/web");
2790
+ const fromBundle = path32.resolve(import.meta.dirname, "../../dist/web");
2791
+ return [fromSource, fromBundle].find((directory) => existsSync2(path32.join(directory, "index.html"))) ?? fromSource;
2695
2792
  }
2696
2793
  async function startServer(options) {
2697
- const root = path31.resolve(options.repoRoot);
2794
+ const root = path32.resolve(options.repoRoot);
2698
2795
  await loadConfig({ repoRoot: root });
2699
2796
  const webDist = options.webDist ?? defaultWebDist();
2700
2797
  const app = createApp(root, webDist);
@@ -2723,7 +2820,7 @@ async function startServer(options) {
2723
2820
  };
2724
2821
  }
2725
2822
  function createApp(root, webDist) {
2726
- const app = new Hono();
2823
+ const app = new Hono2();
2727
2824
  app.onError((error, context) => {
2728
2825
  const status = error instanceof z27.ZodError ? 400 : error.statusCode ?? 500;
2729
2826
  return context.json({ error: String(error.message ?? error) }, status);
@@ -2736,13 +2833,7 @@ function createApp(root, webDist) {
2736
2833
  "/api/project",
2737
2834
  async (context) => context.json(await readProjectInfo({ repoRoot: root }))
2738
2835
  );
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
- });
2836
+ app.route("/api/conformance", createConformanceRoutes(root));
2746
2837
  app.get(
2747
2838
  "/api/changelog",
2748
2839
  async (context) => context.json(await listChangelogCommits({ repoRoot: root }))
@@ -2851,12 +2942,12 @@ function createApp(root, webDist) {
2851
2942
  await next();
2852
2943
  const filePath = context.get("staticFile");
2853
2944
  if (!filePath) return;
2854
- const stats = await stat2(filePath);
2945
+ const stats = await stat3(filePath);
2855
2946
  context.header(
2856
2947
  "ETag",
2857
2948
  `W/"${stats.size.toString(16)}-${stats.mtimeMs.toString(16)}-${stats.ctimeMs.toString(16)}"`
2858
2949
  );
2859
- const relativePath = path31.relative(webDist, filePath).split(path31.sep).join("/");
2950
+ const relativePath = path32.relative(webDist, filePath).split(path32.sep).join("/");
2860
2951
  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);
2861
2952
  context.header("Cache-Control", immutable ? "public, max-age=31536000, immutable" : "no-cache");
2862
2953
  if (context.res.status !== 200 || !["GET", "HEAD"].includes(context.req.method)) return;
@@ -2896,7 +2987,7 @@ function createApp(root, webDist) {
2896
2987
  await next();
2897
2988
  });
2898
2989
  app.get("*", serveStatic({ root: webDist, ...staticOptions }));
2899
- app.get("*", (context, next) => path31.extname(context.req.path) ? context.notFound() : next());
2990
+ app.get("*", (context, next) => path32.extname(context.req.path) ? context.notFound() : next());
2900
2991
  app.get("*", serveStatic({ root: webDist, path: "index.html", ...staticOptions }));
2901
2992
  app.get("*", (context) => context.text("\u62A5\u544A UI \u5C1A\u672A\u6784\u5EFA\uFF1A\u8BF7\u5148\u8FD0\u884C pnpm build", 404));
2902
2993
  return app;
@@ -2925,45 +3016,45 @@ async function startWorkbench(options) {
2925
3016
  }
2926
3017
 
2927
3018
  // packages/service/src/init.ts
2928
- import { mkdir as mkdir3, readFile as readFile12, stat as stat3, writeFile as writeFile3 } from "node:fs/promises";
2929
- import path32 from "node:path";
3019
+ import { mkdir as mkdir3, readFile as readFile13, stat as stat4, writeFile as writeFile3 } from "node:fs/promises";
3020
+ import path33 from "node:path";
2930
3021
  async function initProject(directory) {
2931
- const root = path32.resolve(directory);
3022
+ const root = path33.resolve(directory);
2932
3023
  await mkdir3(root, { recursive: true });
2933
3024
  const messages = [];
2934
3025
  async function create(file, content) {
2935
3026
  try {
2936
3027
  await writeFile3(file, content, { flag: "wx" });
2937
- messages.push(`\u5DF2\u521B\u5EFA ${path32.relative(root, file)}`);
3028
+ messages.push(`\u5DF2\u521B\u5EFA ${path33.relative(root, file)}`);
2938
3029
  } catch (error) {
2939
3030
  if (error.code !== "EEXIST") throw error;
2940
- messages.push(`\u5DF2\u4FDD\u7559 ${path32.relative(root, file)}`);
3031
+ messages.push(`\u5DF2\u4FDD\u7559 ${path33.relative(root, file)}`);
2941
3032
  }
2942
3033
  }
2943
- const skill = await readFile12(
2944
- path32.resolve(import.meta.dirname, "../../../skills/evidra/SKILL.md"),
3034
+ const skill = await readFile13(
3035
+ path33.resolve(import.meta.dirname, "../../../skills/evidra/SKILL.md"),
2945
3036
  "utf8"
2946
3037
  );
2947
3038
  let injected = false;
2948
3039
  for (const agent of [".claude", ".codex"]) {
2949
3040
  let exists = false;
2950
3041
  try {
2951
- exists = (await stat3(path32.join(root, agent))).isDirectory();
3042
+ exists = (await stat4(path33.join(root, agent))).isDirectory();
2952
3043
  } catch (error) {
2953
3044
  if (error.code !== "ENOENT") throw error;
2954
3045
  }
2955
3046
  if (!exists) continue;
2956
3047
  injected = true;
2957
- const target = path32.join(root, agent, "skills/evidra");
3048
+ const target = path33.join(root, agent, "skills/evidra");
2958
3049
  await mkdir3(target, { recursive: true });
2959
- await create(path32.join(target, "SKILL.md"), skill);
3050
+ await create(path33.join(target, "SKILL.md"), skill);
2960
3051
  }
2961
3052
  if (!injected) messages.push("\u672A\u53D1\u73B0 .claude \u6216 .codex \u6587\u4EF6\u5939\uFF0C\u672A\u6CE8\u5165\u4EFB\u4F55 skill\u3002");
2962
3053
  return messages;
2963
3054
  }
2964
3055
 
2965
3056
  // packages/conformance/runner/cli.ts
2966
- import path33 from "node:path";
3057
+ import path34 from "node:path";
2967
3058
 
2968
3059
  // packages/conformance/runner/run.ts
2969
3060
  async function runner(common, tasks) {
@@ -3002,14 +3093,14 @@ function printResults(results) {
3002
3093
  async function runConformance(directory) {
3003
3094
  const config = await loadConformanceConfig(directory);
3004
3095
  if (!config)
3005
- throw new Error(`\u65E0\u6CD5\u8BFB\u53D6\u914D\u7F6E\u6587\u4EF6\uFF1A${path33.resolve(directory, "evidra.conformance.ts")}`);
3096
+ throw new Error(`\u65E0\u6CD5\u8BFB\u53D6\u914D\u7F6E\u6587\u4EF6\uFF1A${path34.resolve(directory, "evidra.conformance.ts")}`);
3006
3097
  return printResults(await runner({ projectRoot: config.projectRoot }, config.rules));
3007
3098
  }
3008
3099
 
3009
3100
  // packages/service/src/cli.ts
3010
3101
  var cli = cac("evidra");
3011
3102
  cli.command("init [path]", "\u590D\u5236 skill \u5230\u9879\u76EE\uFF0C\u9ED8\u8BA4\u5F53\u524D\u76EE\u5F55").action(async (target) => {
3012
- const root = path34.resolve(target ?? process.cwd());
3103
+ const root = path35.resolve(target ?? process.cwd());
3013
3104
  console.log(`\u521D\u59CB\u5316 Evidra\uFF1A${root}`);
3014
3105
  for (const message of await initProject(root)) console.log(message);
3015
3106
  });
@@ -3018,14 +3109,14 @@ cli.command("start", "\u542F\u52A8\u5DE5\u4F5C\u53F0\uFF0C\u670D\u52A1\u5728\u52
3018
3109
  if (!Number.isInteger(port) || port < 1 || port > 65535)
3019
3110
  throw new Error("\u7AEF\u53E3\u5FC5\u987B\u662F 1\u201365535 \u7684\u6574\u6570");
3020
3111
  await startWorkbench({
3021
- repoRoot: path34.resolve(options.repo ?? process.env.TEST_REPORT_REPO ?? process.cwd()),
3112
+ repoRoot: path35.resolve(options.repo ?? process.env.TEST_REPORT_REPO ?? process.cwd()),
3022
3113
  port
3023
3114
  });
3024
3115
  });
3025
3116
  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) => {
3026
3117
  if (!options.taskId) throw new Error("\u8BF7\u63D0\u4F9B --task-id");
3027
3118
  const result = await compareTask({
3028
- repoRoot: path34.resolve(options.repo ?? process.cwd()),
3119
+ repoRoot: path35.resolve(options.repo ?? process.cwd()),
3029
3120
  taskId: options.taskId
3030
3121
  });
3031
3122
  console.log(JSON.stringify(options.full ? result : result.summary, null, 2));
@@ -3035,7 +3126,7 @@ cli.command("compare-tasks", "\u6BD4\u8F83\u4E24\u4E2A\u4EFB\u52A1\u7684\u7528\u
3035
3126
  if (!options.baseTaskId) throw new Error("\u8BF7\u63D0\u4F9B --base-task-id");
3036
3127
  if (!options.taskId) throw new Error("\u8BF7\u63D0\u4F9B --task-id");
3037
3128
  const result = await compareTasks({
3038
- repoRoot: path34.resolve(options.repo ?? process.cwd()),
3129
+ repoRoot: path35.resolve(options.repo ?? process.cwd()),
3039
3130
  baseTaskId: options.baseTaskId,
3040
3131
  taskId: options.taskId
3041
3132
  });
@@ -1 +1 @@
1
- import{m as e}from"./editor.api-CsVhWQDt.js";import{t}from"./workers-BcFJUhLI.js";import{_ as n,a as r,c as i,d as a,f as o,g as s,h as c,i as l,l as u,m as d,n as f,o as p,p as m,r as h,s as g,t as _,u as v,v as y}from"./lspLanguageFeatures-D9tA1yBW.js";var b=12e4,x=class{constructor(e){this._defaults=e,this._worker=null,this._client=null,this._idleCheckInterval=window.setInterval(()=>this._checkIfIdle(),3e4),this._lastUsedTime=0,this._configChangeListener=this._defaults.onDidChange(()=>this._stopWorker())}_stopWorker(){this._worker&&=(this._worker.dispose(),null),this._client=null}dispose(){clearInterval(this._idleCheckInterval),this._configChangeListener.dispose(),this._stopWorker()}_checkIfIdle(){this._worker&&Date.now()-this._lastUsedTime>b&&this._stopWorker()}_getClient(){return this._lastUsedTime=Date.now(),this._client||=(this._worker=t({moduleId:`vs/language/css/cssWorker`,createWorker:()=>new Worker(new URL(`/assets/css.worker-DwfUZ3fB.js`,``+import.meta.url),{type:`module`}),label:this._defaults.languageId,createData:{options:this._defaults.options,languageId:this._defaults.languageId}}),this._worker.getProxy()),this._client}getLanguageServiceWorker(...e){let t;return this._getClient().then(e=>{t=e}).then(t=>{if(this._worker)return this._worker.withSyncedResources(e)}).then(e=>t)}};function S(t){let n=[],s=[],c=new x(t);n.push(c);let g=(...e)=>c.getLanguageServiceWorker(...e);function y(){let{languageId:n,modeConfiguration:c}=t;w(s),c.completionItems&&s.push(e.registerCompletionItemProvider(n,new _(g,[`/`,`-`,`:`]))),c.hovers&&s.push(e.registerHoverProvider(n,new a(g))),c.documentHighlights&&s.push(e.registerDocumentHighlightProvider(n,new p(g))),c.definitions&&s.push(e.registerDefinitionProvider(n,new f(g))),c.references&&s.push(e.registerReferenceProvider(n,new o(g))),c.documentSymbols&&s.push(e.registerDocumentSymbolProvider(n,new u(g))),c.rename&&s.push(e.registerRenameProvider(n,new m(g))),c.colors&&s.push(e.registerColorProvider(n,new l(g))),c.foldingRanges&&s.push(e.registerFoldingRangeProvider(n,new v(g))),c.diagnostics&&s.push(new h(n,g,t.onDidChange)),c.selectionRanges&&s.push(e.registerSelectionRangeProvider(n,new d(g))),c.documentFormattingEdits&&s.push(e.registerDocumentFormattingEditProvider(n,new r(g))),c.documentRangeFormattingEdits&&s.push(e.registerDocumentRangeFormattingEditProvider(n,new i(g)))}return y(),n.push(C(s)),C(n)}function C(e){return{dispose:()=>w(e)}}function w(e){for(;e.length;)e.pop().dispose()}export{_ as CompletionAdapter,f as DefinitionAdapter,h as DiagnosticsAdapter,l as DocumentColorAdapter,r as DocumentFormattingEditProvider,p as DocumentHighlightAdapter,g as DocumentLinkAdapter,i as DocumentRangeFormattingEditProvider,u as DocumentSymbolAdapter,v as FoldingRangeAdapter,a as HoverAdapter,o as ReferenceAdapter,m as RenameAdapter,d as SelectionRangeAdapter,x as WorkerManager,c as fromPosition,s as fromRange,S as setupMode,n as toRange,y as toTextEdit};
1
+ import{m as e}from"./editor.api-DrACi4Ft.js";import{t}from"./workers-yymMcYwK.js";import{_ as n,a as r,c as i,d as a,f as o,g as s,h as c,i as l,l as u,m as d,n as f,o as p,p as m,r as h,s as g,t as _,u as v,v as y}from"./lspLanguageFeatures-CfU_VfTV.js";var b=12e4,x=class{constructor(e){this._defaults=e,this._worker=null,this._client=null,this._idleCheckInterval=window.setInterval(()=>this._checkIfIdle(),3e4),this._lastUsedTime=0,this._configChangeListener=this._defaults.onDidChange(()=>this._stopWorker())}_stopWorker(){this._worker&&=(this._worker.dispose(),null),this._client=null}dispose(){clearInterval(this._idleCheckInterval),this._configChangeListener.dispose(),this._stopWorker()}_checkIfIdle(){this._worker&&Date.now()-this._lastUsedTime>b&&this._stopWorker()}_getClient(){return this._lastUsedTime=Date.now(),this._client||=(this._worker=t({moduleId:`vs/language/css/cssWorker`,createWorker:()=>new Worker(new URL(`/assets/css.worker-DwfUZ3fB.js`,``+import.meta.url),{type:`module`}),label:this._defaults.languageId,createData:{options:this._defaults.options,languageId:this._defaults.languageId}}),this._worker.getProxy()),this._client}getLanguageServiceWorker(...e){let t;return this._getClient().then(e=>{t=e}).then(t=>{if(this._worker)return this._worker.withSyncedResources(e)}).then(e=>t)}};function S(t){let n=[],s=[],c=new x(t);n.push(c);let g=(...e)=>c.getLanguageServiceWorker(...e);function y(){let{languageId:n,modeConfiguration:c}=t;w(s),c.completionItems&&s.push(e.registerCompletionItemProvider(n,new _(g,[`/`,`-`,`:`]))),c.hovers&&s.push(e.registerHoverProvider(n,new a(g))),c.documentHighlights&&s.push(e.registerDocumentHighlightProvider(n,new p(g))),c.definitions&&s.push(e.registerDefinitionProvider(n,new f(g))),c.references&&s.push(e.registerReferenceProvider(n,new o(g))),c.documentSymbols&&s.push(e.registerDocumentSymbolProvider(n,new u(g))),c.rename&&s.push(e.registerRenameProvider(n,new m(g))),c.colors&&s.push(e.registerColorProvider(n,new l(g))),c.foldingRanges&&s.push(e.registerFoldingRangeProvider(n,new v(g))),c.diagnostics&&s.push(new h(n,g,t.onDidChange)),c.selectionRanges&&s.push(e.registerSelectionRangeProvider(n,new d(g))),c.documentFormattingEdits&&s.push(e.registerDocumentFormattingEditProvider(n,new r(g))),c.documentRangeFormattingEdits&&s.push(e.registerDocumentRangeFormattingEditProvider(n,new i(g)))}return y(),n.push(C(s)),C(n)}function C(e){return{dispose:()=>w(e)}}function w(e){for(;e.length;)e.pop().dispose()}export{_ as CompletionAdapter,f as DefinitionAdapter,h as DiagnosticsAdapter,l as DocumentColorAdapter,r as DocumentFormattingEditProvider,p as DocumentHighlightAdapter,g as DocumentLinkAdapter,i as DocumentRangeFormattingEditProvider,u as DocumentSymbolAdapter,v as FoldingRangeAdapter,a as HoverAdapter,o as ReferenceAdapter,m as RenameAdapter,d as SelectionRangeAdapter,x as WorkerManager,c as fromPosition,s as fromRange,S as setupMode,n as toRange,y as toTextEdit};