@hamsterbase/evidra 0.11.0 → 0.12.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.
@@ -1,5 +1 @@
1
- // packages/conformance/runner/config.ts
2
- function defineConfig(config) {
3
- return config;
4
- }
5
- export { defineConfig };
1
+ export { i as defineConfig, r as defineRule, t as renderRuleDoc, n as ruleOptionsToJsonSchema } from "./runner-Dcqs9-Dm.js";
@@ -0,0 +1,108 @@
1
+ import { z } from "zod";
2
+ interface RuleResult {
3
+ name: string;
4
+ success: boolean;
5
+ messages: string;
6
+ howToFix: string;
7
+ }
8
+ interface CommonConfig {
9
+ /** 已解析的项目绝对路径。 */
10
+ readonly projectRoot: string;
11
+ }
12
+ interface RuleExample<Options = unknown> {
13
+ /** 示例参数,用于推导用法代码片段并由 optionsSchema 校验。 */
14
+ readonly options: Options;
15
+ /** 可选的场景说明。 */
16
+ readonly title?: string;
17
+ }
18
+ interface RuleDoc<Options = unknown> {
19
+ /** 规约稳定 ID(kebab-case,与文件名一致)。 */
20
+ readonly id: string;
21
+ /** 工作台展示名称。 */
22
+ readonly displayName: string;
23
+ /** 导出的工厂函数名(camelCase,用于生成用法文档)。 */
24
+ readonly exportName: string;
25
+ /** 用法示例中的导入包名,默认 '@hamsterbase/evidra/conformance-rules'。 */
26
+ readonly importFrom?: string;
27
+ /** 一句话说明规约的目标。 */
28
+ readonly summary: string;
29
+ /** 配置项 Zod Schema(用于运行时校验、类型推导与参数文档生成)。 */
30
+ readonly optionsSchema: z.ZodType;
31
+ /** 至少一个最小可用示例,用于推导用法文档。 */
32
+ readonly examples: readonly RuleExample<Options>[];
33
+ /** 可选的补充说明(检查范围、边界条件、副作用等)。 */
34
+ readonly notes?: string;
35
+ }
36
+ type RuleTask = ((commonConfig: CommonConfig) => Promise<RuleResult>) & {
37
+ /** 规约的稳定 ID,报告按此归并同一规约的配置。 */
38
+ readonly id?: string;
39
+ /** 用于在执行前展示规则名称。 */
40
+ readonly displayName?: string;
41
+ /** 相对于配置文件的 Markdown 路径,供自定义规约手写文档使用。 */
42
+ readonly readme?: string;
43
+ /** 规约元数据,存在时由框架自动推导 Markdown 文档。 */
44
+ readonly doc?: RuleDoc;
45
+ };
46
+ /** evidra.conformance.ts 的默认导出。 */
47
+ interface Config {
48
+ /** 默认配置文件所在目录;相对路径也基于配置文件所在目录。 */
49
+ projectRoot?: string;
50
+ /** 按数组顺序执行的任务函数;单个任务失败不会阻止后续任务,空数组视为通过。 */
51
+ rules: readonly RuleTask[];
52
+ }
53
+ declare function defineConfig(config: Config): Config;
54
+ interface RuleDefinition<Schema extends z.ZodType> {
55
+ /** 规约稳定 ID(kebab-case,与文件名一致)。 */
56
+ readonly id: string;
57
+ /** 工作台展示名称。 */
58
+ readonly displayName: string;
59
+ /** 导出的工厂函数名(camelCase,用于生成用法文档)。 */
60
+ readonly exportName: string;
61
+ /** 用法示例中的导入包名,默认 '@hamsterbase/evidra/conformance-rules'。 */
62
+ readonly importFrom?: string;
63
+ /** 一句话说明规约的目标。 */
64
+ readonly summary: string;
65
+ /** 配置项 Zod Schema(用于运行时校验、类型推导和参数文档生成)。 */
66
+ readonly optionsSchema: Schema;
67
+ /** 至少一个最小可用示例,用于推导用法文档。 */
68
+ readonly examples: readonly [RuleExample<z.input<Schema>>, ...RuleExample<z.input<Schema>>[]];
69
+ /** 可选的补充说明(检查范围、边界条件、副作用等)。 */
70
+ readonly notes?: string;
71
+ /** 按配置覆写工作台展示名称(例如按 options.name 区分多个实例)。 */
72
+ readonly resolveDisplayName?: (options: z.output<Schema>) => string;
73
+ /** 执行规约检查。 */
74
+ readonly run: (common: CommonConfig, options: z.output<Schema>) => Promise<RuleResult>;
75
+ }
76
+ type RuleFactory<Schema extends z.ZodType> = (...args: {} extends z.input<Schema> ? [options?: z.input<Schema>] : [options: z.input<Schema>]) => RuleTask;
77
+ type DefinedRule<Schema extends z.ZodType = z.ZodType> = RuleFactory<Schema> & {
78
+ readonly meta: RuleDoc<z.input<Schema>>;
79
+ };
80
+ /** 定义一条自描述规约:统一声明元信息、Zod 配置校验与检查实现。 */
81
+ declare function defineRule<Schema extends z.ZodType>(definition: RuleDefinition<Schema>): DefinedRule<Schema>;
82
+ interface JsonSchemaNode {
83
+ type?: string | readonly string[];
84
+ description?: string;
85
+ default?: unknown;
86
+ readOnly?: boolean;
87
+ minLength?: number;
88
+ maxLength?: number;
89
+ minimum?: number;
90
+ maximum?: number;
91
+ exclusiveMinimum?: number;
92
+ exclusiveMaximum?: number;
93
+ pattern?: string;
94
+ enum?: readonly unknown[];
95
+ const?: unknown;
96
+ items?: JsonSchemaNode;
97
+ properties?: Record<string, JsonSchemaNode>;
98
+ required?: readonly string[];
99
+ additionalProperties?: boolean | JsonSchemaNode;
100
+ anyOf?: readonly JsonSchemaNode[];
101
+ oneOf?: readonly JsonSchemaNode[];
102
+ tsType?: string;
103
+ }
104
+ /** 将规约的 Zod Schema 转换为带 tsType 元信息的 JSON Schema。 */
105
+ declare function ruleOptionsToJsonSchema(schema: z.ZodType): JsonSchemaNode;
106
+ /** 根据规约定义与 Zod Schema 自动推导工作台展示的 Markdown 文档。 */
107
+ declare function renderRuleDoc(doc: RuleDoc): string;
108
+ export { RuleDefinition as a, Config as c, RuleDoc as d, RuleExample as f, DefinedRule as i, defineConfig as l, RuleTask as m, renderRuleDoc as n, RuleFactory as o, RuleResult as p, ruleOptionsToJsonSchema as r, defineRule as s, JsonSchemaNode as t, CommonConfig as u };
@@ -1,10 +1,2 @@
1
- import { n as RuleResult, r as RuleTask, t as CommonConfig } from "./types--o0ku6ya.js";
2
- /** evidra.conformance.ts 的默认导出。 */
3
- interface Config {
4
- /** 默认配置文件所在目录;相对路径也基于配置文件所在目录。 */
5
- projectRoot?: string;
6
- /** 按数组顺序执行的任务函数;单个任务失败不会阻止后续任务,空数组视为通过。 */
7
- rules: readonly RuleTask[];
8
- }
9
- export declare function defineConfig(config: Config): Config;
10
- export type { CommonConfig, Config, RuleResult, RuleTask };
1
+ import { a as RuleDefinition, c as Config, d as RuleDoc, f as RuleExample, i as DefinedRule, l as defineConfig, m as RuleTask, n as renderRuleDoc, o as RuleFactory, p as RuleResult, r as ruleOptionsToJsonSchema, s as defineRule, t as JsonSchemaNode, u as CommonConfig } from "./index-lcSI6COn.js";
2
+ export { type CommonConfig, type Config, type DefinedRule, type JsonSchemaNode, type RuleDefinition, type RuleDoc, type RuleExample, type RuleFactory, type RuleResult, type RuleTask, defineConfig, defineRule, renderRuleDoc, ruleOptionsToJsonSchema };
@@ -1,156 +1,238 @@
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;
9
- /** Git 提交标题检查配置。 */
10
- interface CommitMessageOptions {
11
- /** 禁止的提交标题前缀,默认 ["```"];传入空数组时不限制前缀。 */
12
- forbiddenPrefixes?: readonly string[];
13
- /** 比较基准,例如 CI 中的 "origin/main";指定时仅检查 `base..HEAD`,默认使用 upstream。 */
14
- base?: string;
15
- }
16
- export declare function commitMessage(config?: CommitMessageOptions): RuleTask;
17
- /** 检查本地化 key 的默认文案冲突,以及 key、文案中的模板字符串。 */
18
- interface DuplicateLocalizationOptions {
19
- /** 递归扫描的源码目录,支持绝对路径或相对 projectRoot 的路径。 */
20
- scanRoot: string;
21
- /** 扫描时跳过的子目录及其后代,默认空;路径相对 projectRoot 解析,也支持绝对路径。 */
22
- excludeDirs?: readonly string[];
23
- /** 按目录名跳过,默认 node_modules、dist、coverage;传入时替换默认列表,隐藏目录始终跳过。 */
24
- skipDirNames?: readonly string[];
25
- /** 本地化函数名,默认 localize;仅匹配直接调用,不匹配对象成员调用。 */
26
- callName?: string;
27
- /** key 所在的参数下标,从 0 开始,默认 0。 */
28
- keyArgument?: number;
29
- /** 默认文案所在的参数下标,从 0 开始,默认 1。 */
30
- valueArgument?: number;
31
- }
32
- export declare function duplicateLocalization(config: DuplicateLocalizationOptions): RuleTask;
33
- /** 从源码同步 JSON 语言文件;会写入文件,发生更新或存在未翻译条目时检查失败。 */
34
- interface SyncLocalesOptions {
35
- /** 递归扫描的源码目录,支持绝对路径或相对 projectRoot 的路径。 */
36
- scanRoot: string;
37
- /** 扫描时跳过的子目录及其后代,默认空;路径相对 projectRoot 解析,也支持绝对路径。 */
38
- excludeDirs?: readonly string[];
39
- /** 按目录名跳过,默认 node_modules、dist、coverage;传入时替换默认列表,隐藏目录始终跳过。 */
40
- skipDirNames?: readonly string[];
41
- /** 本地化函数名,默认 localize;仅匹配直接调用,不匹配对象成员调用。 */
42
- callName?: string;
43
- /** key 所在的参数下标,从 0 开始,默认 0;非字符串字面量会被跳过。 */
44
- keyArgument?: number;
45
- /** 默认文案所在的参数下标,从 0 开始,默认 1。 */
46
- valueArgument?: number;
47
- /** 语言文件目录,支持绝对路径或相对 projectRoot 的路径;缺失时自动创建。 */
48
- localesDir: string;
49
- /** 源语言标识,例如 en-US,对应 localesDir 下的 en-US.json。 */
50
- defaultLocale: string;
51
- /** 需要同步并检查翻译的其他语言标识;不包含 defaultLocale,空数组表示仅同步源语言。 */
52
- otherLocales: readonly string[];
53
- /** 生成器元数据键,默认不写入;兼容 i18n-ease 时设为 __i18n_ease__,已有文件必须包含此键。 */
54
- metadataKey?: string;
55
- }
56
- export declare function syncLocales(config: SyncLocalesOptions): RuleTask;
57
- /** 限制带指定注释的文件只能被同一目录的文件直接导入或转导出。 */
58
- interface SameDirImportOnlyOptions {
59
- /** 递归扫描的源码目录,支持绝对路径或相对 projectRoot 的路径。 */
60
- scanRoot: string;
61
- /** 扫描时跳过的子目录及其后代,默认空;路径相对 projectRoot 解析,也支持绝对路径。 */
62
- excludeDirs?: readonly string[];
63
- /** 按目录名跳过,默认 node_modules、dist、coverage;传入时替换默认列表,隐藏目录始终跳过。 */
64
- skipDirNames?: readonly string[];
65
- /** 标记内部实现的注释文本,注释去除首尾空白后须与之完全相同,默认 @import-scope same-dir。 */
66
- marker?: string;
67
- /** 导入前缀到目录的映射,默认空;目录相对 projectRoot 解析,也支持绝对路径,例如 { "@/": "src" }。 */
68
- aliases?: Readonly<Record<string, string>>;
69
- }
70
- export declare function sameDirImportOnly(config: SameDirImportOnlyOptions): RuleTask;
71
- /** 需要检查的本地化函数调用及默认文案位置。 */
72
- interface LocalizationCall {
73
- /** 函数名,例如 localize。 */
74
- name: string;
75
- /** 默认文案所在的参数位置,从 0 开始。 */
76
- valueArgument: number;
77
- /** 是否同时匹配成员调用,例如 nls.format();默认 false,只匹配直接调用。 */
78
- member?: boolean;
79
- }
80
- /** 检查源码中本地化默认文案是否匹配禁止的字符或文本。 */
81
- interface SourceLocaleDefaultsOptions {
82
- /** 递归扫描的源码目录,支持绝对路径或相对 projectRoot 的路径。 */
83
- scanRoot: string;
84
- /** 扫描时跳过的子目录及其后代,默认空;路径相对 projectRoot 解析,也支持绝对路径。 */
85
- excludeDirs?: readonly string[];
86
- /** 按目录名跳过,默认 node_modules、dist、coverage;传入时替换默认列表,隐藏目录始终跳过。 */
87
- skipDirNames?: readonly string[];
88
- /** 需要检查的本地化调用列表;只检查指定参数中的字符串字面量,空数组表示不匹配任何调用。 */
89
- calls: readonly LocalizationCall[];
90
- /** 匹配即判为违规的正则表达式,例如 CJK_PATTERN;每次匹配独立执行,不改变传入正则的状态。 */
91
- pattern: RegExp;
92
- }
1
+ import { i as DefinedRule } from "./index-lcSI6COn.js";
2
+ import { z } from "zod";
3
+ declare const optionsSchema$9: z.ZodObject<{
4
+ baselineDir: z.ZodString;
5
+ maxDiffPixels: z.ZodNumber;
6
+ }, z.core.$strip>;
7
+ type BaselineMaxDiffPixelsOptions = z.input<typeof optionsSchema$9>;
8
+ export declare const baselineMaxDiffPixels: DefinedRule<z.ZodObject<{
9
+ baselineDir: z.ZodString;
10
+ maxDiffPixels: z.ZodNumber;
11
+ }, z.core.$strip>>;
12
+ declare const optionsSchema$8: z.ZodObject<{
13
+ forbiddenPrefixes: z.ZodDefault<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
14
+ base: z.ZodOptional<z.ZodString>;
15
+ }, z.core.$strip>;
16
+ type CommitMessageOptions = z.input<typeof optionsSchema$8>;
17
+ export declare const commitMessage: DefinedRule<z.ZodObject<{
18
+ forbiddenPrefixes: z.ZodDefault<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
19
+ base: z.ZodOptional<z.ZodString>;
20
+ }, z.core.$strip>>;
21
+ declare const optionsSchema$7: z.ZodObject<{
22
+ rulesDir: z.ZodString;
23
+ entryFile: z.ZodOptional<z.ZodString>;
24
+ }, z.core.$strip>;
25
+ type ConformanceRuleFormatOptions = z.input<typeof optionsSchema$7>;
26
+ export declare const conformanceRuleFormat: DefinedRule<z.ZodObject<{
27
+ rulesDir: z.ZodString;
28
+ entryFile: z.ZodOptional<z.ZodString>;
29
+ }, z.core.$strip>>;
30
+ declare const optionsSchema$6: z.ZodObject<{
31
+ scanRoot: z.ZodString;
32
+ excludeDirs: z.ZodDefault<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
33
+ skipDirNames: z.ZodDefault<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
34
+ callName: z.ZodDefault<z.ZodString>;
35
+ keyArgument: z.ZodDefault<z.ZodNumber>;
36
+ valueArgument: z.ZodDefault<z.ZodNumber>;
37
+ }, z.core.$strip>;
38
+ type DuplicateLocalizationOptions = z.input<typeof optionsSchema$6>;
39
+ export declare const duplicateLocalization: DefinedRule<z.ZodObject<{
40
+ scanRoot: z.ZodString;
41
+ excludeDirs: z.ZodDefault<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
42
+ skipDirNames: z.ZodDefault<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
43
+ callName: z.ZodDefault<z.ZodString>;
44
+ keyArgument: z.ZodDefault<z.ZodNumber>;
45
+ valueArgument: z.ZodDefault<z.ZodNumber>;
46
+ }, z.core.$strip>>;
47
+ declare const optionsSchema$5: z.ZodObject<{
48
+ root: z.ZodString;
49
+ name: z.ZodOptional<z.ZodString>;
50
+ entrySuffix: z.ZodDefault<z.ZodString>;
51
+ sharedDir: z.ZodDefault<z.ZodString>;
52
+ utilsDir: z.ZodDefault<z.ZodString>;
53
+ strictRoot: z.ZodDefault<z.ZodBoolean>;
54
+ sharedThreshold: z.ZodDefault<z.ZodNumber>;
55
+ }, z.core.$strip>;
56
+ type E2eScenariosStructureOptions = z.input<typeof optionsSchema$5>;
57
+ export declare const e2eScenariosStructure: DefinedRule<z.ZodObject<{
58
+ root: z.ZodString;
59
+ name: z.ZodOptional<z.ZodString>;
60
+ entrySuffix: z.ZodDefault<z.ZodString>;
61
+ sharedDir: z.ZodDefault<z.ZodString>;
62
+ utilsDir: z.ZodDefault<z.ZodString>;
63
+ strictRoot: z.ZodDefault<z.ZodBoolean>;
64
+ sharedThreshold: z.ZodDefault<z.ZodNumber>;
65
+ }, z.core.$strip>>;
66
+ declare const optionsSchema$4: z.ZodObject<{
67
+ scanRoot: z.ZodString;
68
+ excludeDirs: z.ZodDefault<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
69
+ skipDirNames: z.ZodDefault<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
70
+ marker: z.ZodDefault<z.ZodString>;
71
+ aliases: z.ZodDefault<z.ZodReadonly<z.ZodRecord<z.ZodString, z.ZodString>>>;
72
+ }, z.core.$strip>;
73
+ type SameDirImportOnlyOptions = z.input<typeof optionsSchema$4>;
74
+ export declare const sameDirImportOnly: DefinedRule<z.ZodObject<{
75
+ scanRoot: z.ZodString;
76
+ excludeDirs: z.ZodDefault<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
77
+ skipDirNames: z.ZodDefault<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
78
+ marker: z.ZodDefault<z.ZodString>;
79
+ aliases: z.ZodDefault<z.ZodReadonly<z.ZodRecord<z.ZodString, z.ZodString>>>;
80
+ }, z.core.$strip>>;
81
+ declare const optionsSchema$3: z.ZodObject<{
82
+ scanRoot: z.ZodString;
83
+ excludeDirs: z.ZodDefault<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
84
+ skipDirNames: z.ZodDefault<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
85
+ componentWrappers: z.ZodDefault<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
86
+ }, z.core.$strip>;
87
+ type SingleComponentFileOptions = z.input<typeof optionsSchema$3>;
88
+ export declare const singleComponentFile: DefinedRule<z.ZodObject<{
89
+ scanRoot: z.ZodString;
90
+ excludeDirs: z.ZodDefault<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
91
+ skipDirNames: z.ZodDefault<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
92
+ componentWrappers: z.ZodDefault<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
93
+ }, z.core.$strip>>;
94
+ declare const localizationCallSchema: z.ZodObject<{
95
+ name: z.ZodString;
96
+ valueArgument: z.ZodNumber;
97
+ member: z.ZodDefault<z.ZodBoolean>;
98
+ }, z.core.$strip>;
99
+ declare const optionsSchema$2: z.ZodObject<{
100
+ scanRoot: z.ZodString;
101
+ excludeDirs: z.ZodDefault<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
102
+ skipDirNames: z.ZodDefault<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
103
+ calls: z.ZodReadonly<z.ZodArray<z.ZodObject<{
104
+ name: z.ZodString;
105
+ valueArgument: z.ZodNumber;
106
+ member: z.ZodDefault<z.ZodBoolean>;
107
+ }, z.core.$strip>>>;
108
+ pattern: z.ZodInstanceOf<RegExp>;
109
+ }, z.core.$strip>;
110
+ type LocalizationCall = z.input<typeof localizationCallSchema>;
111
+ type SourceLocaleDefaultsOptions = z.input<typeof optionsSchema$2>;
93
112
  /** 汉字、CJK 标点和全角字符;可用于检查英文默认文案。 */
94
113
  export declare const CJK_PATTERN: RegExp;
95
- /** 本地化调用在代码中的默认文案必须使用源语言(不匹配 pattern),翻译放在语言文件中。 */
96
- export declare function sourceLocaleDefaults(options: SourceLocaleDefaultsOptions): RuleTask;
97
- /** 检查每个 TSX 文件是否最多定义一个返回 JSX 的组件。 */
98
- interface SingleComponentFileOptions {
99
- /** 递归扫描的源码目录,支持绝对路径或相对 projectRoot 的路径。 */
100
- scanRoot: string;
101
- /** 扫描时跳过的子目录及其后代,默认空;路径相对 projectRoot 解析,也支持绝对路径。 */
102
- excludeDirs?: readonly string[];
103
- /** 按目录名跳过,默认 node_modules、dist、coverage;传入时替换默认列表,隐藏目录始终跳过。 */
104
- skipDirNames?: readonly string[];
105
- /** 识别组件时使用的高阶函数名,默认 memo、forwardRef;传入时替换默认列表,直接函数和类组件仍会检查。 */
106
- componentWrappers?: readonly string[];
107
- }
108
- /** 每个 TSX 文件只定义一个返回 JSX 的组件。 */
109
- export declare function singleComponentFile(options: SingleComponentFileOptions): RuleTask;
110
- /** 检查 e2e 入口及 helper 的目录边界,禁止在入口中定义辅助函数。 */
111
- interface E2eScenariosStructureOptions {
112
- /** 场景根目录,支持绝对路径或相对 projectRoot 的路径;仅检查此目录直接包含的入口文件。 */
113
- root: string;
114
- /** 结果名,同一仓库检查多个测试根目录时用于区分,默认 e2e-scenarios-structure。 */
115
- name?: string;
116
- /** 入口文件后缀,默认 .spec.ts。 */
117
- entrySuffix?: string;
118
- /** 多个入口共用 helper 的目录名,相对 root,默认 shared。 */
119
- sharedDir?: string;
120
- /** 各入口专属 helper 的目录名,相对 root,默认 utils;入口只能导入自身同名子目录。 */
121
- utilsDir?: string;
122
- /** 是否要求 root 只包含入口文件和配置的两类 helper 目录,默认 false;隐藏条目始终跳过。 */
123
- strictRoot?: boolean;
124
- /** helper 被多少个入口使用时建议移到共用目录,默认 3;仅影响违规时的修复建议。 */
125
- sharedThreshold?: number;
126
- }
127
- /**
128
- * 场景目录结构:入口文件只组织用例,helper 放在 utils/<入口名>(专属)或 shared(共用),
129
- * 且 shared 与 utils 互不引用。
130
- */
131
- export declare function e2eScenariosStructure(options: E2eScenariosStructureOptions): RuleTask;
132
- /** 检查 UI 截图入口、指定导出与 helper 的目录边界。 */
133
- interface UiScenariosStructureOptions {
134
- /** 场景根目录,支持绝对路径或相对 projectRoot 的路径;仅检查此目录直接包含的入口文件。 */
135
- root: string;
136
- /** 结果名,同一仓库检查多个测试根目录时用于区分,默认 ui-scenarios-structure。 */
137
- name?: string;
138
- /** 入口文件后缀,默认 .ts。 */
139
- entrySuffix?: string;
140
- /** 多个入口共用 helper 的目录名,相对 root,默认 shared。 */
141
- sharedDir?: string;
142
- /** 各入口专属 helper 的目录名,相对 root,默认 utils;入口只能导入自身同名子目录。 */
143
- utilsDir?: string;
144
- /** 每个入口必须提供的具名导出,默认 lint;可导出函数或数据。只有此导出对应的顶层函数允许在入口中定义。 */
145
- exportName?: string;
146
- /** 是否要求 root 只包含入口文件和配置的两类 helper 目录,默认 true;隐藏条目始终跳过。 */
147
- strictRoot?: boolean;
148
- /** helper 被多少个入口使用时建议移到共用目录,默认 3;仅影响违规时的修复建议。 */
149
- sharedThreshold?: number;
150
- }
151
- /**
152
- * 场景目录结构:入口文件只组织用例,helper 放在 utils/<入口名>(专属)或 shared(共用),
153
- * 且 shared 与 utils 互不引用。
154
- */
155
- export declare function uiScenariosStructure(options: UiScenariosStructureOptions): RuleTask;
156
- export type { BaselineMaxDiffPixelsOptions, CommitMessageOptions, DuplicateLocalizationOptions, E2eScenariosStructureOptions, LocalizationCall, SameDirImportOnlyOptions, SingleComponentFileOptions, SourceLocaleDefaultsOptions, SyncLocalesOptions, UiScenariosStructureOptions };
114
+ export declare const sourceLocaleDefaults: DefinedRule<z.ZodObject<{
115
+ scanRoot: z.ZodString;
116
+ excludeDirs: z.ZodDefault<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
117
+ skipDirNames: z.ZodDefault<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
118
+ calls: z.ZodReadonly<z.ZodArray<z.ZodObject<{
119
+ name: z.ZodString;
120
+ valueArgument: z.ZodNumber;
121
+ member: z.ZodDefault<z.ZodBoolean>;
122
+ }, z.core.$strip>>>;
123
+ pattern: z.ZodInstanceOf<RegExp>;
124
+ }, z.core.$strip>>;
125
+ declare const optionsSchema$1: z.ZodObject<{
126
+ scanRoot: z.ZodString;
127
+ excludeDirs: z.ZodDefault<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
128
+ skipDirNames: z.ZodDefault<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
129
+ callName: z.ZodDefault<z.ZodString>;
130
+ keyArgument: z.ZodDefault<z.ZodNumber>;
131
+ valueArgument: z.ZodDefault<z.ZodNumber>;
132
+ localesDir: z.ZodString;
133
+ defaultLocale: z.ZodString;
134
+ otherLocales: z.ZodReadonly<z.ZodArray<z.ZodString>>;
135
+ metadataKey: z.ZodOptional<z.ZodString>;
136
+ }, z.core.$strip>;
137
+ type SyncLocalesOptions = z.input<typeof optionsSchema$1>;
138
+ export declare const syncLocales: DefinedRule<z.ZodObject<{
139
+ scanRoot: z.ZodString;
140
+ excludeDirs: z.ZodDefault<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
141
+ skipDirNames: z.ZodDefault<z.ZodReadonly<z.ZodArray<z.ZodString>>>;
142
+ callName: z.ZodDefault<z.ZodString>;
143
+ keyArgument: z.ZodDefault<z.ZodNumber>;
144
+ valueArgument: z.ZodDefault<z.ZodNumber>;
145
+ localesDir: z.ZodString;
146
+ defaultLocale: z.ZodString;
147
+ otherLocales: z.ZodReadonly<z.ZodArray<z.ZodString>>;
148
+ metadataKey: z.ZodOptional<z.ZodString>;
149
+ }, z.core.$strip>>;
150
+ declare const optionsSchema: z.ZodObject<{
151
+ root: z.ZodString;
152
+ name: z.ZodOptional<z.ZodString>;
153
+ entrySuffix: z.ZodDefault<z.ZodString>;
154
+ sharedDir: z.ZodDefault<z.ZodString>;
155
+ utilsDir: z.ZodDefault<z.ZodString>;
156
+ exportName: z.ZodDefault<z.ZodString>;
157
+ strictRoot: z.ZodDefault<z.ZodBoolean>;
158
+ sharedThreshold: z.ZodDefault<z.ZodNumber>;
159
+ }, z.core.$strip>;
160
+ type UiScenariosStructureOptions = z.input<typeof optionsSchema>;
161
+ export declare const uiScenariosStructure: DefinedRule<z.ZodObject<{
162
+ root: z.ZodString;
163
+ name: z.ZodOptional<z.ZodString>;
164
+ entrySuffix: z.ZodDefault<z.ZodString>;
165
+ sharedDir: z.ZodDefault<z.ZodString>;
166
+ utilsDir: z.ZodDefault<z.ZodString>;
167
+ exportName: z.ZodDefault<z.ZodString>;
168
+ strictRoot: z.ZodDefault<z.ZodBoolean>;
169
+ sharedThreshold: z.ZodDefault<z.ZodNumber>;
170
+ }, z.core.$strip>>;
171
+ /** 所有内置规约,按稳定 ID 排序,供工作台目录与文档推导使用。 */
172
+ export declare const builtinRules: readonly [DefinedRule<import("zod").ZodObject<{
173
+ baselineDir: import("zod").ZodString;
174
+ maxDiffPixels: import("zod").ZodNumber;
175
+ }, import("zod/v4/core").$strip>>, DefinedRule<import("zod").ZodObject<{
176
+ forbiddenPrefixes: import("zod").ZodDefault<import("zod").ZodReadonly<import("zod").ZodArray<import("zod").ZodString>>>;
177
+ base: import("zod").ZodOptional<import("zod").ZodString>;
178
+ }, import("zod/v4/core").$strip>>, DefinedRule<import("zod").ZodObject<{
179
+ rulesDir: import("zod").ZodString;
180
+ entryFile: import("zod").ZodOptional<import("zod").ZodString>;
181
+ }, import("zod/v4/core").$strip>>, DefinedRule<import("zod").ZodObject<{
182
+ scanRoot: import("zod").ZodString;
183
+ excludeDirs: import("zod").ZodDefault<import("zod").ZodReadonly<import("zod").ZodArray<import("zod").ZodString>>>;
184
+ skipDirNames: import("zod").ZodDefault<import("zod").ZodReadonly<import("zod").ZodArray<import("zod").ZodString>>>;
185
+ callName: import("zod").ZodDefault<import("zod").ZodString>;
186
+ keyArgument: import("zod").ZodDefault<import("zod").ZodNumber>;
187
+ valueArgument: import("zod").ZodDefault<import("zod").ZodNumber>;
188
+ }, import("zod/v4/core").$strip>>, DefinedRule<import("zod").ZodObject<{
189
+ root: import("zod").ZodString;
190
+ name: import("zod").ZodOptional<import("zod").ZodString>;
191
+ entrySuffix: import("zod").ZodDefault<import("zod").ZodString>;
192
+ sharedDir: import("zod").ZodDefault<import("zod").ZodString>;
193
+ utilsDir: import("zod").ZodDefault<import("zod").ZodString>;
194
+ strictRoot: import("zod").ZodDefault<import("zod").ZodBoolean>;
195
+ sharedThreshold: import("zod").ZodDefault<import("zod").ZodNumber>;
196
+ }, import("zod/v4/core").$strip>>, DefinedRule<import("zod").ZodObject<{
197
+ scanRoot: import("zod").ZodString;
198
+ excludeDirs: import("zod").ZodDefault<import("zod").ZodReadonly<import("zod").ZodArray<import("zod").ZodString>>>;
199
+ skipDirNames: import("zod").ZodDefault<import("zod").ZodReadonly<import("zod").ZodArray<import("zod").ZodString>>>;
200
+ marker: import("zod").ZodDefault<import("zod").ZodString>;
201
+ aliases: import("zod").ZodDefault<import("zod").ZodReadonly<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>>;
202
+ }, import("zod/v4/core").$strip>>, DefinedRule<import("zod").ZodObject<{
203
+ scanRoot: import("zod").ZodString;
204
+ excludeDirs: import("zod").ZodDefault<import("zod").ZodReadonly<import("zod").ZodArray<import("zod").ZodString>>>;
205
+ skipDirNames: import("zod").ZodDefault<import("zod").ZodReadonly<import("zod").ZodArray<import("zod").ZodString>>>;
206
+ componentWrappers: import("zod").ZodDefault<import("zod").ZodReadonly<import("zod").ZodArray<import("zod").ZodString>>>;
207
+ }, import("zod/v4/core").$strip>>, DefinedRule<import("zod").ZodObject<{
208
+ scanRoot: import("zod").ZodString;
209
+ excludeDirs: import("zod").ZodDefault<import("zod").ZodReadonly<import("zod").ZodArray<import("zod").ZodString>>>;
210
+ skipDirNames: import("zod").ZodDefault<import("zod").ZodReadonly<import("zod").ZodArray<import("zod").ZodString>>>;
211
+ calls: import("zod").ZodReadonly<import("zod").ZodArray<import("zod").ZodObject<{
212
+ name: import("zod").ZodString;
213
+ valueArgument: import("zod").ZodNumber;
214
+ member: import("zod").ZodDefault<import("zod").ZodBoolean>;
215
+ }, import("zod/v4/core").$strip>>>;
216
+ pattern: import("zod").ZodInstanceOf<RegExp>;
217
+ }, import("zod/v4/core").$strip>>, DefinedRule<import("zod").ZodObject<{
218
+ scanRoot: import("zod").ZodString;
219
+ excludeDirs: import("zod").ZodDefault<import("zod").ZodReadonly<import("zod").ZodArray<import("zod").ZodString>>>;
220
+ skipDirNames: import("zod").ZodDefault<import("zod").ZodReadonly<import("zod").ZodArray<import("zod").ZodString>>>;
221
+ callName: import("zod").ZodDefault<import("zod").ZodString>;
222
+ keyArgument: import("zod").ZodDefault<import("zod").ZodNumber>;
223
+ valueArgument: import("zod").ZodDefault<import("zod").ZodNumber>;
224
+ localesDir: import("zod").ZodString;
225
+ defaultLocale: import("zod").ZodString;
226
+ otherLocales: import("zod").ZodReadonly<import("zod").ZodArray<import("zod").ZodString>>;
227
+ metadataKey: import("zod").ZodOptional<import("zod").ZodString>;
228
+ }, import("zod/v4/core").$strip>>, DefinedRule<import("zod").ZodObject<{
229
+ root: import("zod").ZodString;
230
+ name: import("zod").ZodOptional<import("zod").ZodString>;
231
+ entrySuffix: import("zod").ZodDefault<import("zod").ZodString>;
232
+ sharedDir: import("zod").ZodDefault<import("zod").ZodString>;
233
+ utilsDir: import("zod").ZodDefault<import("zod").ZodString>;
234
+ exportName: import("zod").ZodDefault<import("zod").ZodString>;
235
+ strictRoot: import("zod").ZodDefault<import("zod").ZodBoolean>;
236
+ sharedThreshold: import("zod").ZodDefault<import("zod").ZodNumber>;
237
+ }, import("zod/v4/core").$strip>>];
238
+ export type { BaselineMaxDiffPixelsOptions, CommitMessageOptions, ConformanceRuleFormatOptions, DuplicateLocalizationOptions, E2eScenariosStructureOptions, LocalizationCall, SameDirImportOnlyOptions, SingleComponentFileOptions, SourceLocaleDefaultsOptions, SyncLocalesOptions, UiScenariosStructureOptions };