@longzai-intelligence/eslint-plugin-architecture 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +190 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +23 -0
- package/dist/index.d.mts +23 -0
- package/dist/index.mjs +1 -0
- package/package.json +57 -0
package/README.md
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
# @longzai-intelligence/eslint-plugin-architecture
|
|
2
|
+
|
|
3
|
+
架构约束 ESLint 插件,提供 Clean Architecture 架构规范检查规则,用于强制执行统一的架构设计原则,确保代码结构的清晰性和可维护性。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
bun add --dev @longzai-intelligence/eslint-plugin-architecture
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 使用
|
|
12
|
+
|
|
13
|
+
### 按需加载子插件(推荐)
|
|
14
|
+
|
|
15
|
+
本插件按项目类型分为四个子插件,支持按需加载:
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
// eslint.config.ts
|
|
19
|
+
import {
|
|
20
|
+
architectureCorePlugin,
|
|
21
|
+
CORE_PLUGIN_NAME,
|
|
22
|
+
architectureDomainPlugin,
|
|
23
|
+
DOMAIN_PLUGIN_NAME,
|
|
24
|
+
architectureElectronPlugin,
|
|
25
|
+
ELECTRON_PLUGIN_NAME,
|
|
26
|
+
architectureLibraryPlugin,
|
|
27
|
+
LIBRARY_PLUGIN_NAME,
|
|
28
|
+
} from '@longzai-intelligence/eslint-plugin-architecture';
|
|
29
|
+
|
|
30
|
+
export default [
|
|
31
|
+
// 核心规则 - 所有项目
|
|
32
|
+
{
|
|
33
|
+
plugins: {
|
|
34
|
+
[CORE_PLUGIN_NAME]: architectureCorePlugin,
|
|
35
|
+
},
|
|
36
|
+
rules: {
|
|
37
|
+
[`${CORE_PLUGIN_NAME}/dependency-direction`]: 'error',
|
|
38
|
+
[`${CORE_PLUGIN_NAME}/file-naming`]: 'error',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
// Domain 规则 - 仅 domain 项目
|
|
42
|
+
{
|
|
43
|
+
plugins: {
|
|
44
|
+
[DOMAIN_PLUGIN_NAME]: architectureDomainPlugin,
|
|
45
|
+
},
|
|
46
|
+
rules: {
|
|
47
|
+
[`${DOMAIN_PLUGIN_NAME}/domain-export`]: 'error',
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
];
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### 使用完整插件(向后兼容)
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
// eslint.config.ts
|
|
57
|
+
import { architecturePlugin, PLUGIN_NAME } from '@longzai-intelligence/eslint-plugin-architecture';
|
|
58
|
+
|
|
59
|
+
export default [
|
|
60
|
+
{
|
|
61
|
+
plugins: {
|
|
62
|
+
[PLUGIN_NAME]: architecturePlugin,
|
|
63
|
+
},
|
|
64
|
+
rules: {
|
|
65
|
+
[`${PLUGIN_NAME}/dependency-direction`]: 'error',
|
|
66
|
+
[`${PLUGIN_NAME}/file-naming`]: 'error',
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
];
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## 子插件
|
|
73
|
+
|
|
74
|
+
### 核心插件 (Core)
|
|
75
|
+
|
|
76
|
+
**插件名称**: `@longzai-intelligence/architecture-core`
|
|
77
|
+
|
|
78
|
+
适用于所有项目类型的基础规则:
|
|
79
|
+
|
|
80
|
+
| 规则名称 | 说明 |
|
|
81
|
+
|---------|------|
|
|
82
|
+
| [dependency-direction](src/rules/dependency-direction/README.md) | 强制执行 Clean Architecture 的依赖方向规则 |
|
|
83
|
+
| [no-core-types-in-apps](src/rules/README.md) | 禁止在 apps 层定义核心领域类型 |
|
|
84
|
+
| [business-leak](src/rules/README.md) | 业务逻辑泄漏检查 |
|
|
85
|
+
| [file-naming](src/rules/file-naming/README.md) | 文件命名规范检查 |
|
|
86
|
+
| [require-type-suffix](src/rules/file-naming/README.md) | 文件类型后缀检查 |
|
|
87
|
+
| [no-cross-package-relative-import](src/rules/README.md) | 禁止跨包相对路径导入 |
|
|
88
|
+
| [prefer-split-export-const](src/rules/README.md) | 导出风格检查 |
|
|
89
|
+
| [require-class-suffix](src/rules/README.md) | 类名后缀检查 |
|
|
90
|
+
| [require-interface-naming](src/rules/README.md) | 接口命名规范检查 |
|
|
91
|
+
| [require-type-naming](src/rules/README.md) | types 文件接口命名规范检查 |
|
|
92
|
+
| [require-dto-naming](src/rules/README.md) | DTO 文件接口命名规范检查 |
|
|
93
|
+
| [no-class-suffix-alias](src/rules/README.md) | 禁止在 import 别名中使用 "Class" 后缀 |
|
|
94
|
+
| [implementation-export-control](src/rules/README.md) | 实现导出控制 |
|
|
95
|
+
| [no-implementation-import-in-apps](src/rules/README.md) | 禁止在 apps 层导入 implementation 包 |
|
|
96
|
+
| [domain-export-compliance](src/rules/README.md) | Domain 导出合规检查 |
|
|
97
|
+
|
|
98
|
+
### Domain 插件
|
|
99
|
+
|
|
100
|
+
**插件名称**: `@longzai-intelligence/architecture-domain`
|
|
101
|
+
|
|
102
|
+
仅适用于 domain 项目的规则:
|
|
103
|
+
|
|
104
|
+
| 规则名称 | 说明 |
|
|
105
|
+
|---------|------|
|
|
106
|
+
| [domain-export](src/rules/domain-export/README.md) | Domain 包导出规范检查 |
|
|
107
|
+
| [domain-typeorm-import](src/rules/domain-typeorm-import/README.md) | Domain TypeORM 导入规范检查 |
|
|
108
|
+
| [layer-readme-required](src/rules/README.md) | 分层目录 README 检查 |
|
|
109
|
+
| [require-domain-entities-naming](src/rules/README.md) | Domain 实体命名规范检查 |
|
|
110
|
+
|
|
111
|
+
### Electron 插件
|
|
112
|
+
|
|
113
|
+
**插件名称**: `@longzai-intelligence/architecture-electron`
|
|
114
|
+
|
|
115
|
+
仅适用于 electron 项目的规则:
|
|
116
|
+
|
|
117
|
+
| 规则名称 | 说明 |
|
|
118
|
+
|---------|------|
|
|
119
|
+
| [platform-leak](src/rules/README.md) | 平台代码泄漏检查 |
|
|
120
|
+
| [no-implementation-in-renderer](src/rules/README.md) | 禁止在 renderer 进程导入 Implementation 包 |
|
|
121
|
+
| [no-unsafe-electron-api-exposure](src/rules/README.md) | 不安全的 Electron API 暴露检查 |
|
|
122
|
+
| [no-generic-ipc-bridge-exposure](src/rules/README.md) | 禁止泛型 IPC Bridge 暴露 |
|
|
123
|
+
| [no-direct-ipcrenderer-in-preload](src/rules/README.md) | 禁止在 preload 中直接使用 ipcRenderer |
|
|
124
|
+
| [tsconfig-references](src/rules/README.md) | tsconfig references 配置检查 |
|
|
125
|
+
| [require-typed-ipc-channel](src/rules/README.md) | 禁止字符串字面量作为 IPC 通道名 |
|
|
126
|
+
| [require-expose-safe-api](src/rules/README.md) | 强制使用 exposeSafeAPI 进行 API 暴露 |
|
|
127
|
+
| [no-custom-ipc-utility](src/rules/README.md) | 禁止自定义 IPC 工具函数 |
|
|
128
|
+
| [require-unwrap-ipc-result](src/rules/README.md) | 渲染层强制使用 unwrapIPCResult |
|
|
129
|
+
|
|
130
|
+
### Library 插件
|
|
131
|
+
|
|
132
|
+
**插件名称**: `@longzai-intelligence/architecture-library`
|
|
133
|
+
|
|
134
|
+
仅适用于 library 项目的规则:
|
|
135
|
+
|
|
136
|
+
| 规则名称 | 说明 |
|
|
137
|
+
|---------|------|
|
|
138
|
+
| [test-file-placement](src/rules/test-file-placement/README.md) | 测试文件放置位置检查 |
|
|
139
|
+
| [no-non-test-files-in-tests-directory](src/rules/test-file-placement/README.md) | 禁止在 tests 目录中放置非测试文件 |
|
|
140
|
+
| [test-file-matches-source](src/rules/README.md) | 测试文件与源文件匹配检查 |
|
|
141
|
+
| [require-tsup-config-import](src/rules/README.md) | tsup 配置导入检查 |
|
|
142
|
+
| [require-tsdown-config-import](src/rules/README.md) | tsdown 配置导入检查 |
|
|
143
|
+
| [require-vitest-config-import](src/rules/README.md) | vitest 配置导入检查 |
|
|
144
|
+
| [require-eslint-config-import](src/rules/README.md) | eslint 配置导入检查 |
|
|
145
|
+
|
|
146
|
+
## 层级优先级
|
|
147
|
+
|
|
148
|
+
在 Clean Architecture 中,依赖方向应该从外层指向内层:
|
|
149
|
+
|
|
150
|
+
```
|
|
151
|
+
apps → packages/platform → packages/implementation → packages/domain → packages/types
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
| 层级 | 说明 | 优先级 |
|
|
155
|
+
|-----|------|-------|
|
|
156
|
+
| apps | 应用层 | 1(最外层) |
|
|
157
|
+
| packages/platform | 平台层 | 2 |
|
|
158
|
+
| packages/implementation | 实现层 | 3 |
|
|
159
|
+
| packages/domain / domains/* | 领域层 | 4 |
|
|
160
|
+
| packages/types | 类型层 | 5(最内层) |
|
|
161
|
+
|
|
162
|
+
**核心原则:**
|
|
163
|
+
- 外层可以依赖内层
|
|
164
|
+
- 内层不能依赖外层
|
|
165
|
+
- 同层之间可以相互依赖
|
|
166
|
+
|
|
167
|
+
## 依赖
|
|
168
|
+
|
|
169
|
+
- `eslint >= 9.0.0`
|
|
170
|
+
- `typescript >= 5.0.0`
|
|
171
|
+
- `@longzai-intelligence/eslint-utils`
|
|
172
|
+
|
|
173
|
+
## 开发
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
# 安装依赖
|
|
177
|
+
bun install
|
|
178
|
+
|
|
179
|
+
# 构建
|
|
180
|
+
bun run build
|
|
181
|
+
|
|
182
|
+
# 测试
|
|
183
|
+
bun run test
|
|
184
|
+
|
|
185
|
+
# 类型检查
|
|
186
|
+
bun run typecheck
|
|
187
|
+
|
|
188
|
+
# Lint
|
|
189
|
+
bun run lint
|
|
190
|
+
```
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`@longzai-intelligence/eslint-utils`),l=require(`node:path`);l=s(l);let u=require(`node:fs`);u=s(u);let d=require(`@typescript-eslint/utils`);const f={types:0,utils:1,"shared-kernel":2,contract:3,engine:4,platform:5,infrastructure:6,implementation:6},ee=[{pattern:/\/domains\/[^/]+\/implementation\//,layer:`implementation`},{pattern:/\/domains\/[^/]+\/contract\//,layer:`contract`},{pattern:/\/domains\/shared-kernel\//,layer:`shared-kernel`},{pattern:/\/infrastructure\//,layer:`infrastructure`},{pattern:/\/packages\/utils\//,layer:`utils`},{pattern:/\/packages\/errors\//,layer:`utils`},{pattern:/\/packages\/zod-utils\//,layer:`utils`},{pattern:/\/packages\/testing-utils\//,layer:`utils`},{pattern:/\/packages\/engine\/[^/]+\//,layer:`engine`},{pattern:/\/packages\/design-system\/primitives\//,layer:`utils`},{pattern:/\/packages\/design-system\/composites\//,layer:`implementation`},{pattern:/\/packages\/design-system\/utils\//,layer:`utils`},{pattern:/\/packages\/electron\//,layer:`implementation`},{pattern:/\/packages\/typeorm-adapter\//,layer:`implementation`},{pattern:/\/packages\/typeorm-utils\//,layer:`utils`},{pattern:/\/packages\/http-client\//,layer:`utils`},{pattern:/\/packages\/pagination\//,layer:`utils`},{pattern:/\/packages\/turbo-output-parser\//,layer:`utils`},{pattern:/\/packages\/host-contracts\//,layer:`contract`},{pattern:/\/packages\/event-bus\/contract\//,layer:`contract`},{pattern:/\/packages\/event-bus\/implementation\//,layer:`implementation`},{pattern:/\/packages\/payment\/core\//,layer:`contract`},{pattern:/\/packages\/payment\/adapters\//,layer:`implementation`},{pattern:/\/packages\/payment\/presets\//,layer:`implementation`},{pattern:/\/packages\/logger\/core\//,layer:`contract`},{pattern:/\/packages\/logger\/adapters\//,layer:`implementation`},{pattern:/\/packages\/logger\/presets\//,layer:`implementation`},{pattern:/\/packages\/react-devtools\/core\//,layer:`contract`},{pattern:/\/packages\/react-devtools\/adapters\//,layer:`implementation`},{pattern:/\/packages\/react-devtools\/ui\//,layer:`implementation`},{pattern:/\/packages\/react-devtools\/presets\//,layer:`implementation`},{pattern:/\/packages\/feed-parser\/protocol\//,layer:`contract`},{pattern:/\/packages\/feed-parser\/[^/]+\//,layer:`implementation`}],te=[{pattern:/\/src\/domain\//,layer:`contract`},{pattern:/\/src\/engine\//,layer:`engine`},{pattern:/\/src\/platform\//,layer:`platform`},{pattern:/\/src\/infrastructure\//,layer:`infrastructure`},{pattern:/\/src\/shared\//,layer:`shared-kernel`}],ne=[{pattern:/\/src\/domain\//,layer:`contract`},{pattern:/\/src\/engine\//,layer:`engine`},{pattern:/\/src\/platform\//,layer:`platform`},{pattern:/\/src\/infrastructure\//,layer:`infrastructure`},{pattern:/\/src\/shared\//,layer:`shared-kernel`}],p=new WeakMap;function re(e){let t=e.replace(/\\/g,`/`);for(let{pattern:e,layer:n}of ee)if(e.test(t))return{layer:n,priority:f[n]};return t.includes(`/apps/`)?ae(t):t.includes(`/packages/`)?oe(t):null}function ie(e,t){let n=p.get(t);if(n||(n=new Map,p.set(t,n)),n.has(e))return n.get(e);let r=re(e);return n.set(e,r),r}function ae(e){for(let{pattern:t,layer:n}of te)if(t.test(e))return{layer:n,priority:f[n]};return null}function oe(e){for(let{pattern:t,layer:n}of ne)if(t.test(e))return{layer:n,priority:f[n]};return null}const se=[{suffix:`-contract`,layer:`contract`},{suffix:`-implementation`,layer:`implementation`},{suffix:`-engine`,layer:`engine`},{suffix:`-runtime`,layer:`engine`}],ce={"@longzai-intelligence/shared-kernel":`shared-kernel`,"@longzai-intelligence/utils":`utils`,"@longzai-intelligence/error-utils":`utils`,"@longzai-intelligence/zod-utils":`utils`,"@longzai-intelligence/testing-utils":`utils`,"@longzai-intelligence/host-contracts":`contract`,"@longzai-intelligence/typeorm-adapter":`implementation`,"@longzai-intelligence/typeorm-utils":`utils`,"@longzai-intelligence/http-client":`utils`,"@longzai-intelligence/pagination":`utils`,"@longzai-intelligence/turbo-output-parser":`utils`,"@longzai-intelligence/electron":`implementation`},m=`@longzai-intelligence/`;function le(e){if(!e.startsWith(m))return null;let t=e.split(`/`)[1];if(!t)return null;let n=ce[`${m}${t}`];if(n)return{layer:n,priority:f[n]};for(let{suffix:e,layer:n}of se)if(t.endsWith(e))return{layer:n,priority:f[n]};return null}const ue={types:`类型层 (Types)`,utils:`工具层 (Utils)`,"shared-kernel":`共享内核层 (Shared Kernel)`,contract:`契约层 (Contract)`,engine:`引擎层 (Engine)`,platform:`平台层 (Platform)`,infrastructure:`基础设施层 (Infrastructure)`,implementation:`实现层 (Implementation)`};function de(e){return ue[e]}function fe(e,t){return f[e]>=f[t]}const pe={meta:{type:`problem`,docs:{description:`强制执行 Clean Architecture 的依赖方向规则`},messages:{invalidDependency:`依赖方向违规: {{currentLayer}} ({{currentLayerName}}) 不能导入 {{importLayer}} ({{importLayerName}})。依赖应该从外层指向内层,请检查导入语句。`},schema:[]},create(e){let t=e.filename,n=ie(t,e);return n?{ImportDeclaration(t){let r=t.source.value;if(typeof r!=`string`)return;let i=le(r);i&&(fe(n.layer,i.layer)||e.report({node:t,messageId:`invalidDependency`,data:{currentLayer:n.layer,currentLayerName:de(n.layer),importLayer:i.layer,importLayerName:de(i.layer)}}))}}:{}}},me=new Set(`Agent.Page.PageContent.Workspace.WorkspaceMember.User.Session.Task.Repository.Folder.SyncMetadata.SyncError.SyncErrorCode.SyncResult.SyncStatus.SyncConflictData.EntityChange.OfflineOperation.DirtyEntity.PullResult.PushResult.ApiResponse.P2PNode.ConnectionState.NetworkStatus.IMAgent.IMContact.IMConversation.IMMessage.IMGroup.IMGroupSettings`.split(`.`));function he(e){return e.replace(/\\/g,`/`).includes(`/apps/`)}function h(e){return me.has(e)}const g={meta:{type:`problem`,docs:{description:`禁止在 apps 层定义核心领域类型`},messages:{noCoreTypesInApps:`禁止在 apps 层定义核心领域类型 "{{typeName}}"。请在 packages/types 或 packages/domain 中定义此类型。`},schema:[]},create(e){let t=e.filename;return he(t)?{TSInterfaceDeclaration(t){if(!(0,c.hasIdWithName)(t))return;let n=t.id.name;h(n)&&e.report({node:t,messageId:`noCoreTypesInApps`,data:{typeName:n}})},TSTypeAliasDeclaration(t){if(!(0,c.hasIdWithName)(t))return;let n=t.id.name;h(n)&&e.report({node:t,messageId:`noCoreTypesInApps`,data:{typeName:n}})},ClassDeclaration(t){if(!(0,c.hasIdWithName)(t))return;let n=t.id.name;h(n)&&e.report({node:t,messageId:`noCoreTypesInApps`,data:{typeName:n}})}}:{}}},_={node:[`fs`,`path`,`os`,`crypto`,`child_process`,`cluster`,`dgram`,`dns`,`http`,`https`,`net`,`readline`,`stream`,`tls`,`tty`,`udp`,`url`,`util`,`v8`,`vm`,`worker_threads`,`zlib`],browser:[`window`,`document`,`navigator`,`localStorage`,`sessionStorage`,`fetch`,`XMLHttpRequest`,`WebSocket`,`Worker`,`IndexedDB`,`Blob`,`File`,`FileReader`,`URL`,`URLSearchParams`,`History`,`Location`,`Screen`,`AudioContext`,`Canvas`,`Notification`,`Performance`,`ServiceWorker`],electron:[`ipcRenderer`,`ipcMain`,`app`,`BrowserWindow`,`dialog`,`Menu`,`Tray`,`nativeImage`,`shell`,`clipboard`]},ge=new Set(_.node),_e=new Set(_.browser),ve=new Set(_.electron),ye=[/\/domains\/shared-kernel\//,/\/domains\/page-domain\//,/\/domains\/repository-domain\//,/\/domains\/agent-domain\//,/\/domains\/collab-domain\//,/\/domains\/identity-domain\//,/\/domains\/workflow-domain\//,/\/domains\/chat-domain\//,/\/domains\/workspace-domain\//];function be(e){let t=e.replace(/\\/g,`/`);return ye.some(e=>e.test(t))}function xe(e){if(e.startsWith(`node:`)||ge.has(e))return`node`;for(let t of _.node)if(e.startsWith(`${t}/`))return`node`;return null}function v(e){return _e.has(e)}function y(e){return ve.has(e)}function Se(e){return typeof e==`object`&&!!e&&`object`in e&&e.object!==null&&typeof e.object==`object`&&`type`in e.object&&`name`in e.object}function Ce(e){return typeof e==`object`&&!!e&&`name`in e&&typeof e.name==`string`}function we(e,t){if(!(0,c.isImportDeclaration)(e))return;let n=e.source.value;if(typeof n==`string`&&xe(n)){let r=n.replace(/^node:/,``);t.report({node:e,messageId:`nodeImport`,data:{moduleName:r}})}}function Te(e,t){if(Se(e)&&e.object.type===`Identifier`){let n=e.object.name;v(n)&&t.report({node:e,messageId:`browserAPI`,data:{apiName:n}}),y(n)&&t.report({node:e,messageId:`electronAPI`,data:{apiName:n}})}}function Ee(e,t){if(!Ce(e))return;let n=e.name;(v(n)||y(n))&&e.parent&&e.parent.type!==`MemberExpression`&&t.report({node:e,messageId:`globalAPI`,data:{globalName:n}})}const b={meta:{type:`problem`,docs:{description:`禁止在业务域层直接使用平台特定 API`},messages:{nodeImport:`平台代码泄漏: 业务域层禁止直接导入 Node.js 模块 '{{moduleName}}'。请通过 packages/platform 层的接口间接访问。`,browserAPI:`平台代码泄漏: 业务域层禁止直接使用浏览器 API '{{apiName}}'。请通过 packages/platform 层的接口间接访问。`,electronAPI:`平台代码泄漏: 业务域层禁止直接使用 Electron API '{{apiName}}'。请通过 packages/platform 层的接口间接访问。`,globalAPI:`平台代码泄漏: 业务域层禁止直接访问全局对象 '{{globalName}}'。请通过 packages/platform 层的接口间接访问。`},schema:[]},create(e){let t=e.filename;return be(t)?{ImportDeclaration(t){we(t,e)},MemberExpression(t){Te(t,e)},Identifier(t){Ee(t,e)}}:{}}},De=[/\/packages\/platform\//,/\/packages\/ui\//,/\/packages\/ui-kit\//,/\/packages\/engine\//,/\/packages\/utils\//,/\/packages\/types\//],Oe=[`Page`,`Repository`,`Agent`,`Workflow`,`Workspace`,`User`,`Auth`,`Session`,`Message`,`Conversation`,`Sync`,`Favorite`,`Folder`,`Team`,`Execution`,`Task`,`Step`,`Trigger`],ke=[/^validate/,/^calculate/,/^compute/,/^determine/,/^check/,/^can/,/^should/,/^isAllowed/,/^isPermitted/,/^hasPermission/,/^applyRule/,/^enforce/,/^execute/];function Ae(e){let t=e.replace(/\\/g,`/`);return De.some(e=>e.test(t))}function x(e){let t=e.charAt(0).toUpperCase()+e.slice(1);return Oe.some(e=>t.includes(e))}function je(e){return ke.some(t=>t.test(e))}function Me(e){return typeof e==`object`&&!!e&&`key`in e&&e.key!==null&&typeof e.key==`object`&&`type`in e.key&&e.key.type===`Identifier`&&`name`in e.key&&typeof e.key.name==`string`}function Ne(e){return typeof e==`object`&&!!e&&`id`in e&&e.id!==null&&typeof e.id==`object`&&`type`in e.id&&e.id.type===`Identifier`&&`name`in e.id&&typeof e.id.name==`string`&&`type`in e&&typeof e.type==`string`}function Pe(e,t){(0,c.hasIdWithName)(e)&&x(e.id.name)&&t.report({node:e,messageId:`businessClass`,data:{className:e.id.name}})}function Fe(e,t){Me(e)&&je(e.key.name)&&t.report({node:e,messageId:`businessMethod`,data:{methodName:e.key.name}})}function Ie(e,t){(0,c.hasIdWithName)(e)&&x(e.id.name)&&t.report({node:e,messageId:`businessInterface`,data:{interfaceName:e.id.name}})}function Le(e,t){Ne(e)&&x(e.id.name)&&t.report({node:e,messageId:`businessType`,data:{typeName:e.id.name}})}const Re={meta:{type:`suggestion`,docs:{description:`检测技术层中可能存在的业务逻辑`},messages:{businessClass:`业务逻辑泄漏嫌疑: 技术层发现业务相关类 '{{className}}'。业务逻辑应该放在 domains/ 层。`,businessMethod:`业务逻辑泄漏嫌疑: 技术层发现业务规则方法 '{{methodName}}'。业务规则应该放在 domains/ 层。`,businessInterface:`业务逻辑泄漏嫌疑: 技术层发现业务相关接口 '{{interfaceName}}'。业务接口应该放在 domains/ 层。`,businessType:`业务逻辑泄漏嫌疑: 技术层发现业务相关类型 '{{typeName}}'。业务类型应该放在 domains/ 层。`},schema:[]},create(e){let t=e.filename;return Ae(t)?{ClassDeclaration(t){Pe(t,e)},MethodDefinition(t){Fe(t,e)},TSInterfaceDeclaration(t){Ie(t,e)},TSTypeAliasDeclaration(t){Le(t,e)}}:{}}};function ze(e){return e.startsWith(`create`)||e.startsWith(`make`)||e.startsWith(`build`)}function Be(e){return/domains\/[^/]+\/(implementation|contract)\/src\/index\.ts$/.test(e)?`main`:/domains\/[^/]+\/(implementation|contract)\/src\/(domain|application|infrastructure)\/index\.ts$/.test(e)?`layer`:/domains\/[^/]+\/(implementation|contract)\/src\/(domain|application|infrastructure)\/\w+\/index\.ts$/.test(e)?`submodule`:`none`}function Ve(e){return e.includes(`/infrastructure/`)}const He=[],Ue=[{pattern:/^(?!create)[A-Za-z]+Repository(Drizzle|Memory|Sqlite|Mysql)$/,messageId:`forbiddenRepositoryExport`,message:`禁止导出具体仓储实现类`},{pattern:/^(?!create)[A-Za-z]*Table$/,messageId:`forbiddenTableExport`,message:`禁止导出数据库表定义`},{pattern:/[A-Za-z]+OrmEntity$/,messageId:`forbiddenOrmEntityExportFromMain`,message:`禁止从主入口导出 ORM 实体,应从 ./typeorm 入口导出`},{pattern:/[A-Z_]+_ORM_ENTITIES$/,messageId:`forbiddenEntitiesExportFromMain`,message:`禁止从主入口导出实体集合,应从 ./typeorm 入口导出`},{pattern:/[A-Za-z]+OrmMapper$/,messageId:`forbiddenOrmMapperExportFromMain`,message:`禁止从主入口导出 ORM Mapper,这是基础设施层实现细节`}],We=/^(?!create)[A-Za-z]*Schema$/,Ge=new WeakMap;function Ke(e,t,n){if(!n)return qe(e,t);let r=Ge.get(n);if(r||(r=new Map,Ge.set(n,r)),r.has(t))return r.get(t);let i=qe(e,t);return r.set(t,i),i}function qe(e,t){let n=[],r=/export\s*\*\s*from/.test(e),i=e.matchAll(/export\s+type\s+\{([^}]+)\}/g);for(let e of i){let t=e[1];if(t){let e=t.split(`,`).map(e=>{let t=e.trim().split(` as `);return t[0]?t[0].trim():``}).filter(e=>e);n.push(...e)}}let a=e.matchAll(/export\s+(?!type)\{([^}]+)\}/g);for(let e of a){let t=e[1];if(t){let e=t.split(`,`).map(e=>{let t=e.trim().split(` as `);return t[0]?t[0].trim():``}).filter(e=>e);n.push(...e)}}let o=e.matchAll(/export\s+(class|function|const|let|interface|type)\s+(\w+)/g);for(let e of o){let t=e[2];t&&n.push(t)}let s=[],c=Ve(t);if(Be(t)===`submodule`)return{usesExportStar:r,exports:n,forbiddenIssues:s};for(let e of n)if(!ze(e)){for(let{pattern:t,messageId:n}of He)t.test(e)&&s.push({messageId:n,exportName:e});for(let{pattern:t,messageId:n}of Ue)t.test(e)&&s.push({messageId:n,exportName:e});c&&We.test(e)&&s.push({messageId:`forbiddenSchemaExport`,exportName:e})}return{usesExportStar:r,exports:n,forbiddenIssues:s}}const Je={meta:{type:`problem`,docs:{description:`Domain 包导出规范:禁止 export *、禁止导出具体实现类、禁止导出数据库表和 Schema`,recommended:!0},schema:[],messages:{forbiddenExportStar:`禁止使用 export *,应使用显式导出(export { ... } 或 export type { ... })`,forbiddenRepositoryExport:`禁止导出具体仓储实现类 {{exportName}},应使用工厂函数 createXxxRepository`,forbiddenTableExport:`禁止导出数据库表定义 {{exportName}}`,forbiddenSchemaExport:`禁止导出 Schema 定义 {{exportName}}`,forbiddenOrmEntityExportFromMain:`禁止从主入口导出 ORM 实体 {{exportName}},应从 ./typeorm 入口导出`,forbiddenEntitiesExportFromMain:`禁止从主入口导出实体集合 {{exportName}},应从 ./typeorm 入口导出`,forbiddenOrmMapperExportFromMain:`禁止从主入口导出 ORM Mapper {{exportName}},这是基础设施层实现细节`}},create(e){let t=e.filename;if(Be(t)===`none`)return{};let n=e.sourceCode.text,{usesExportStar:r,forbiddenIssues:i}=Ke(n,t,e);return{Program(t){r&&e.report({node:t,messageId:`forbiddenExportStar`});for(let n of i)e.report({node:t,messageId:n.messageId,data:{exportName:n.exportName}})}}}},Ye=/@longzai-intelligence\/[^/]+\/typeorm/,Xe=/@longzai-intelligence\/[^/]+\/infrastructure\//,Ze=[/data-source\.ts$/,/data-source\.config\.ts$/,/data-source\.[a-z-]+\.ts$/,/database\.module\.ts$/,/database\.ts$/,/database\.config\.ts$/,/database\.service\.ts$/];function Qe(e){return Ze.some(t=>t.test(e))}const $e={meta:{type:`problem`,docs:{description:`Domain TypeORM 导入规范:非 DataSource 场景禁止导入 /typeorm 入口,禁止 infrastructure/* deep import`,recommended:!0},schema:[],messages:{forbiddenTypeormImport:`非 DataSource 场景禁止从 /typeorm 入口导入 ORM 实体,该入口仅供 DataSource/迁移基础设施使用`,forbiddenInfrastructureImport:`禁止 infrastructure/* deep import,应使用受控入口(主入口或 ./typeorm)`}},create(e){let t=e.filename,n=Qe(t);return{ImportDeclaration(t){if(!t.source)return;let r=t.source.value;typeof r==`string`&&(Ye.test(r)&&(n||e.report({node:t,messageId:`forbiddenTypeormImport`})),Xe.test(r)&&e.report({node:t,messageId:`forbiddenInfrastructureImport`}))}}}};function et(e){if(typeof e!=`object`||!e)return!1;let t=e;return`name`in t&&typeof t.name==`string`&&`isSpecialFile`in t&&typeof t.isSpecialFile==`function`&&`getNamingRules`in t&&typeof t.getNamingRules==`function`&&`shouldSkipTypeSuffix`in t&&typeof t.shouldSkipTypeSuffix==`function`}const tt=[{pattern:/\.service\.drizzle\.ts$/,case:`kebab-case`,description:`Drizzle Service 文件应使用 xxx.service.drizzle.ts 格式(kebab-case)`},{pattern:/\.service\.memory\.ts$/,case:`kebab-case`,description:`Memory Service 文件应使用 xxx.service.memory.ts 格式(kebab-case)`},{pattern:/\.service\.ts$/,case:`kebab-case`,description:`服务文件应使用 xxx.service.ts 格式(kebab-case)`},{pattern:/\.controller\.ts$/,case:`kebab-case`,description:`控制器文件应使用 xxx.controller.ts 格式(kebab-case)`},{pattern:/\.module\.ts$/,case:`kebab-case`,description:`模块文件应使用 xxx.module.ts 格式(kebab-case)`},{pattern:/\.repository\.drizzle\.ts$/,case:`kebab-case`,description:`Drizzle Repository 文件应使用 xxx.repository.drizzle.ts 格式(kebab-case)`},{pattern:/\.repository\.memory\.ts$/,case:`kebab-case`,description:`Memory Repository 文件应使用 xxx.repository.memory.ts 格式(kebab-case)`},{pattern:/\.repository\.interface\.ts$/,case:`kebab-case`,description:`Repository 接口文件应使用 xxx.repository.interface.ts 格式(kebab-case)`},{pattern:/\.repository\.types\.ts$/,case:`kebab-case`,description:`Repository 类型文件应使用 xxx.repository.types.ts 格式(kebab-case)`},{pattern:/\.repository\.ts$/,case:`kebab-case`,description:`Repository 文件应使用 xxx.repository.ts 格式(kebab-case)`},{pattern:/\.entity\.types\.ts$/,case:`kebab-case`,description:`Entity 类型文件应使用 xxx.entity.types.ts 格式(kebab-case)`},{pattern:/\.entity\.interface\.ts$/,case:`kebab-case`,description:`Entity 接口文件应使用 xxx.entity.interface.ts 格式(kebab-case)`},{pattern:/\.entity\.ts$/,case:`kebab-case`,description:`Entity 文件应使用 xxx.entity.ts 格式(kebab-case)`},{pattern:/\.dto\.ts$/,case:`kebab-case`,description:`DTO 文件应使用 xxx.dto.ts 格式(kebab-case)`},{pattern:/\.port\.interface\.ts$/,case:`kebab-case`,description:`Port 接口文件应使用 xxx.port.interface.ts 格式(kebab-case)`},{pattern:/\.interface\.ts$/,case:`kebab-case`,description:`接口文件应使用 xxx.interface.ts 格式(kebab-case)`},{pattern:/\.types\.ts$/,case:`kebab-case`,description:`类型文件应使用 xxx.types.ts 格式(kebab-case)`},{pattern:/\.schema\.ts$/,case:`kebab-case`,description:`Schema 文件应使用 xxx.schema.ts 格式(kebab-case)`},{pattern:/\.port\.ts$/,case:`kebab-case`,description:`Port 文件应使用 xxx.port.ts 格式(kebab-case)`},{pattern:/\.port\.adapter\.ts$/,case:`kebab-case`,description:`Port Adapter 文件应使用 xxx.port.adapter.ts 格式(kebab-case)`},{pattern:/\.adapter\.ts$/,case:`kebab-case`,description:`Adapter 文件应使用 xxx.adapter.ts 格式(kebab-case)`},{pattern:/\.events\.ts$/,case:`kebab-case`,description:`Events 文件应使用 xxx.events.ts 格式(kebab-case)`},{pattern:/\.mapper\.ts$/,case:`kebab-case`,description:`Mapper 文件应使用 xxx.mapper.ts 格式(kebab-case)`},{pattern:/\.ipc\.ts$/,case:`kebab-case`,description:`IPC 文件应使用 xxx.ipc.ts 格式(kebab-case)`},{pattern:/\.config\.ts$/,case:`kebab-case`,description:`配置文件应使用 xxx.config.ts 格式(kebab-case)`},{pattern:/\.errors\.ts$/,case:`kebab-case`,description:`错误文件应使用 xxx.errors.ts 格式(kebab-case)`},{pattern:/\.utils\.ts$/,case:`kebab-case`,description:`工具函数文件应使用 xxx.utils.ts 格式(kebab-case)`},{pattern:/\.constants\.ts$/,case:`kebab-case`,description:`常量文件应使用 xxx.constants.ts 格式(kebab-case)`},{pattern:/\.atom\.ts$/,case:`kebab-case`,description:`Atom 文件应使用 xxx.atom.ts 格式(kebab-case)`},{pattern:/\.vo\.ts$/,case:`kebab-case`,description:`值对象文件应使用 xxx.vo.ts 格式(kebab-case)`},{pattern:/\.usecase\.ts$/,case:`kebab-case`,description:`UseCase 文件应使用 xxx.usecase.ts 格式(kebab-case)`},{pattern:/\.styles\.css$/,case:`kebab-case`,description:`样式文件应使用 xxx.styles.css 格式(kebab-case)`},{pattern:/\.extension\.tsx?$/,case:`kebab-case`,description:`扩展文件应使用 xxx.extension.ts(x) 格式(kebab-case)`}],nt=[{pattern:/^use[A-Z][a-zA-Z]*\.spec\.tsx?$/,case:`camelCase`,description:`Hook 测试文件应使用 camelCase 并以 use 前缀开头(如 useChat.spec.ts)`},{pattern:/^use[A-Z][a-zA-Z]*\.test\.tsx?$/,case:`camelCase`,description:`Hook 测试文件应使用 camelCase 并以 use 前缀开头(如 useChat.test.ts)`},{pattern:/^use[A-Z][a-zA-Z]*\.types\.ts$/,case:`camelCase`,description:`Hook 类型文件应使用 camelCase 并以 use 前缀开头(如 useChat.types.ts)`},{pattern:/\.spec\.ts$/,case:`kebab-case-test`,description:`测试文件应使用 xxx.spec.ts 格式(kebab-case)`},{pattern:/\.test\.ts$/,case:`kebab-case-test`,description:`测试文件应使用 xxx.test.ts 格式(kebab-case)`},{pattern:/\.spec\.tsx$/,case:`kebab-case-test`,description:`测试文件应使用 xxx.spec.tsx 格式(kebab-case)`},{pattern:/\.test\.tsx$/,case:`kebab-case-test`,description:`测试文件应使用 xxx.test.tsx 格式(kebab-case)`},{pattern:/^use[A-Z][a-zA-Z]*\.tsx?$/,case:`camelCase`,description:`Hook 文件应使用 camelCase 并以 use 前缀开头(如 useChat.ts)`}],S={pattern:/^[A-Z][a-zA-Z]*\.tsx$/,case:`PascalCase`,description:`React 组件文件应使用 PascalCase(如 ChatPage.tsx)`};[...nt,...tt];const rt=[`index.ts`,`index.tsx`,`main.ts`,`main.tsx`,`App.tsx`,`types.ts`,`errors.ts`,`constants.ts`,`persistence.ts`,`typeorm.ts`],it=[`impl`,`functions`,`methods`,`handlers`,`classes`];function at(e){let t=e.replace(/\.tsx?$/,``);return[/s$/,/es$/,/ies$/].some(e=>e.test(t))}function ot(e){return/^v\d+(-[a-z0-9-]+)?\.ts$/.test(e)}function st(e){let t=e.replace(/\.tsx?$/,``);for(let e of it){if(t.endsWith(`.${e}`))return e;let n=t.split(`.`);if(n.length>=2&&n[n.length-1]===e)return e}return null}function ct(e){if(!e.endsWith(`.tsx`))return!1;let t=e.replace(`.tsx`,``);return/^[A-Z][a-zA-Z0-9]*$/.test(t)}function lt(e){if(!e.endsWith(`.ts`)&&!e.endsWith(`.tsx`))return!1;let t=e.replace(/\.tsx?$/,``);return/^use[A-Z][a-zA-Z0-9]*$/.test(t)}function ut(e){for(let t of[`.test.ts`,`.test.tsx`,`.spec.ts`,`.spec.tsx`])if(e.endsWith(t)){let n=t.endsWith(`.tsx`)?`.tsx`:`.ts`;return e.replace(t,n)}return e}const C={name:`base`,isSpecialFile(e){return!!(rt.includes(e)||e.endsWith(`.d.ts`)||ot(e))},getNamingRules(){return[...nt,...tt,S]},shouldSkipTypeSuffix(e){let t=ut(e);return!!(rt.includes(t)||t.endsWith(`.d.ts`)||ot(t)||ct(t)||lt(t)||!st(t)&&at(t))}},w=[`page.tsx`,`page.ts`,`layout.tsx`,`layout.ts`,`loading.tsx`,`loading.ts`,`error.tsx`,`error.ts`,`not-found.tsx`,`not-found.ts`,`template.tsx`,`template.ts`,`default.tsx`,`default.ts`,`global-error.tsx`,`global-error.ts`,`middleware.ts`,`route.ts`],dt={name:`nextjs`,isSpecialFile(e){return w.includes(e)},getNamingRules(){return[]},shouldSkipTypeSuffix(e){return w.includes(e)}},ft=[/^\[.+\]\.tsx?$/,/^_layout\.tsx?$/,/^\(.+\)\.tsx?$/],pt=[`_layout.tsx`,`_layout.ts`,`_sitemap.tsx`,`_sitemap.ts`],mt={name:`expo-router`,isSpecialFile(e){return pt.includes(e)?!0:ft.some(t=>t.test(e))},getNamingRules(){return[]},shouldSkipTypeSuffix(e){return this.isSpecialFile(e)}},ht=new Map;function T(e){ht.set(e.name,e)}T(C),T(dt),T(mt);function E(e){return/^[A-Z][a-zA-Z0-9]*$/.test(e)}function gt(e){return/^[a-z][a-zA-Z0-9]*$/.test(e)}function D(e){return/^[a-z][a-z0-9]*(-[a-z0-9]+)*$/.test(e)}function _t(e){return e.split(`.`).every(e=>D(e)&&e.length>0)}function vt(e){return e.split(`.`).every(e=>D(e)&&e.length>0)}function yt(e,t){if(e.endsWith(`.types`)&&t===`kebab-case`)return _t(e);switch(t){case`PascalCase`:return E(e);case`camelCase`:return gt(e);case`kebab-case`:return D(e);case`kebab-case-test`:return vt(e);default:return!1}}const O=new WeakMap;function k(e,t){if(!t)try{return u.default.existsSync(e)}catch{return!1}let n=O.get(t);if(n||(n=new Map,O.set(t,n)),n.has(e))return n.get(e);let r;try{r=u.default.existsSync(e)}catch{r=!1}return n.set(e,r),r}function bt(e,t,n,r){let i=t.substring(6),a=l.default.dirname(i);return k(l.default.join(e,`pages`,a===`.`?``:a,n),r)}function xt(e,t,n,r){let i=t.substring(11),a=l.default.dirname(i);return k(l.default.join(e,`components`,a===`.`?``:a,n),r)}function St(e,t,n,r){let i=t.substring(14),a=l.default.dirname(i);return k(l.default.join(e,`ui`,`components`,a===`.`?``:a,n),r)}function Ct(e,t,n,r){let i=t.substring(6),a=l.default.dirname(i);return k(l.default.join(e,`react`,a===`.`?``:a,n),r)}function wt(e,t,n){let r=e.indexOf(`/__tests__/`),i=e.substring(0,r),a=e.substring(r+11);return a.startsWith(`pages/`)?bt(i,a,t,n):a.startsWith(`components/`)?xt(i,a,t,n):a.startsWith(`ui/components/`)?St(i,a,t,n):a.startsWith(`react/`)?Ct(i,a,t,n):k(l.default.join(i,t),n)}function Tt(e,t,n){let r=e.replace(/\\/g,`/`),i=r.includes(`/__tests__/`),a=r.includes(`/components/`);if(!a&&!i||!(t.endsWith(`.test.tsx`)||t.endsWith(`.spec.tsx`)||t.endsWith(`.test.ts`)||t.endsWith(`.spec.ts`)))return!1;let o=t.replace(/\.(test|spec)\.(tsx|ts)$/,`.tsx`);return i?wt(r,o,n):a?k(l.default.join(l.default.dirname(e),o),n):!1}const A=new WeakMap;function Et(e,t){if(!t)try{return u.default.existsSync(e)}catch{return!1}let n=A.get(t);if(n||(n=new Map,A.set(t,n)),n.has(e))return n.get(e);let r;try{r=u.default.existsSync(e)}catch{r=!1}return n.set(e,r),r}function Dt(e,t,n){if(!e.replace(/\\/g,`/`).includes(`/components/`)||!t.endsWith(`.types.ts`))return!1;let r=t.replace(`.types.ts`,`.tsx`);return Et(l.default.join(l.default.dirname(e),r),n)}function Ot(e,t){if(t===S)return e.replace(/\.tsx$/,``);let n=t.pattern.source;return n.startsWith(`^`)&&n.endsWith(`$`)?n.includes(`\\.test\\.`)||n.includes(`\\.spec\\.`)?e.replace(/\.(test|spec)\.(tsx?|jsx?)$/,``):n.includes(`\\.types\\.`)?e.replace(/\.types\.ts$/,``):e.replace(/\.[^.]+$/,``):e.replace(t.pattern,``)}const j={meta:{type:`problem`,docs:{description:`强制执行文件命名规范`},messages:{invalidFileName:`文件命名违规: {{fileName}}。{{description}}`},schema:[]},create(e){let t=e.filename,n=l.default.basename(t),r=et(e.settings?.platformNamingStrategy)?e.settings.platformNamingStrategy:C;if(r.isSpecialFile(n,t)||Dt(t,n,e)&&E(n.replace(`.types.ts`,``))||Tt(t,n,e)&&E(n.replace(/\.(test|spec)\.(tsx|ts)$/,``)))return{};let i=r.getNamingRules().find(e=>e.pattern.test(n));if(!i&&n.endsWith(`.tsx`)&&(i=S),!i)return{};let a=Ot(n,i);return yt(n.endsWith(`.types.ts`)&&i.case===`kebab-case`?n.replace(/\.ts$/,``):a,i.case)||e.report({loc:{start:{line:1,column:0},end:{line:1,column:n.length}},messageId:`invalidFileName`,data:{fileName:n,description:i.description}}),{}}};function kt(e){return e.endsWith(`.types.ts`)?!0:/^[a-z][a-z0-9-]*\.[a-z][a-z0-9-]*\.tsx?$/.test(e)||/^[a-z][a-z0-9-]*\.[a-z][a-z0-9-]*\.[a-z][a-z0-9-]*\.tsx?$/.test(e)}function At(e){let t=e.replace(/\.tsx?$/,``);for(let e of it){if(t.endsWith(`.${e}`))return e;let n=t.split(`.`);if(n.length>=2&&n[n.length-1]===e)return e}return null}function jt(e){let t=[],n=e.replace(/\.tsx?$/,``);return(n.includes(`service`)||n.includes(`Service`))&&t.push(`.service.ts`),(n.includes(`controller`)||n.includes(`Controller`))&&t.push(`.controller.ts`),(n.includes(`utils`)||n.includes(`helper`)||n.includes(`Helper`))&&t.push(`.utils.ts`),(n.includes(`constant`)||n.includes(`Constant`))&&t.push(`.constants.ts`),(n.includes(`config`)||n.includes(`Config`))&&t.push(`.config.ts`),(n.includes(`atom`)||n.includes(`state`)||n.includes(`State`))&&t.push(`.atom.ts`),t.length===0&&t.push(`.utils.ts`,`.config.ts`,`.constants.ts`),t}function Mt(e){for(let t of[`.test.ts`,`.test.tsx`,`.spec.ts`,`.spec.tsx`])if(e.endsWith(t)){let n=t.endsWith(`.tsx`)?`.tsx`:`.ts`;return e.replace(t,n)}return e}const M={meta:{type:`problem`,docs:{description:`强制执行文件类型后缀规范,确保文件名明确表达其用途`},messages:{missingTypeSuffix:`文件 "{{fileName}}" 缺少类型后缀。除特殊文件外,所有文件应使用 xxx.yyy.ts 格式明确表达用途。建议: {{suggestions}}`,forbiddenSuffix:`文件 "{{fileName}}" 使用了禁止的后缀 ".{{suffix}}"。该后缀语义过于泛化,无法表达文件用途。请使用更具体的后缀,如 ".utils"、".helpers"、".service" 等。`},schema:[]},create(e){let t=e.filename,n=l.default.basename(t);if((et(e.settings?.platformNamingStrategy)?e.settings.platformNamingStrategy:C).shouldSkipTypeSuffix(n))return{};let r=Mt(n),i=At(r);if(i)return e.report({loc:{start:{line:1,column:0},end:{line:1,column:n.length}},messageId:`forbiddenSuffix`,data:{fileName:n,suffix:i}}),{};if(kt(r))return{};let a=jt(r);return e.report({loc:{start:{line:1,column:0},end:{line:1,column:n.length}},messageId:`missingTypeSuffix`,data:{fileName:n,suggestions:a.join(`, `)}}),{}}},Nt=[/\/src\/renderer\//];function Pt(e){let t=e.replace(/\\/g,`/`);return Nt.some(e=>e.test(t))}function Ft(e){if(!e.startsWith(`@longzai-intelligence/`))return!1;let t=e.split(`/`);if(t.length<2)return!1;let n=t[1];return n?n.endsWith(`-implementation`):!1}const N={meta:{type:`problem`,docs:{description:`禁止在 Electron renderer 进程中导入 Implementation 包`},messages:{implementationInRenderer:`禁止在 renderer 进程中导入 Implementation 包 "{{packageName}}"。Implementation 包包含 Node.js 特定代码,请在 main 进程中使用,或使用 Contract 包代替。`},schema:[]},create(e){let t=e.filename;return Pt(t)?{ImportDeclaration(t){let n=t.source.value;typeof n==`string`&&Ft(n)&&e.report({node:t,messageId:`implementationInRenderer`,data:{packageName:n}})}}:{}}};function It(e){return typeof e==`object`&&!!e&&`alias`in e&&typeof e.alias==`string`&&`pathPattern`in e&&typeof e.pathPattern==`string`}function Lt(e){return Array.isArray(e)&&e.every(It)}const P=[{alias:`@main`,pathPattern:`src/main`},{alias:`@preload`,pathPattern:`src/preload`},{alias:`@renderer`,pathPattern:`src/renderer/src`},{alias:`@shared`,pathPattern:`src/shared`}];function F(e,t){let n=e.replace(/\\/g,`/`);for(let e of t){let t=e.pathPattern.replace(/\\/g,`/`);if(n.includes(`/${t}/`)||n.endsWith(`/${t}`)||n.includes(`/${t}\\`))return e.alias}return null}function Rt(e,t,n){if(!t.startsWith(`.`))return null;let r=e.replace(/\\/g,`/`),i=r.lastIndexOf(`/`),a=i>0?r.substring(0,i):``;return F(l.default.resolve(a,t).replace(/\\/g,`/`),n)}function zt(e){return e.startsWith(`./`)||e.startsWith(`../`)}const I={meta:{type:`problem`,docs:{description:`禁止使用相对路径穿越不同包范围,强制使用别名导入`},messages:{noCrossPackageRelativeImport:`禁止使用相对路径跨包导入。当前文件位于 "{{currentPackage}}" 包,目标位于 "{{targetPackage}}" 包。请使用别名导入:{{targetPackage}}/...`},schema:[{type:`object`,properties:{packageBoundaries:{type:`array`,items:{type:`object`,properties:{alias:{type:`string`},pathPattern:{type:`string`}},required:[`alias`,`pathPattern`]}}},additionalProperties:!1}]},create(e){let t=e.filename,n=e.options[0],r=n&&typeof n==`object`?n:{},i=`packageBoundaries`in r&&Array.isArray(r.packageBoundaries)?r.packageBoundaries:P,a=Lt(i)?i:P,o=F(t,a);return o?{ImportDeclaration(n){let r=n.source.value;if(typeof r!=`string`||!zt(r))return;let i=Rt(t,r,a);i&&o!==i&&e.report({node:n,messageId:`noCrossPackageRelativeImport`,data:{currentPackage:o,targetPackage:i}})}}:{}}},L=[/\.test\.ts$/,/\.test\.tsx$/,/\.spec\.ts$/,/\.spec\.tsx$/],R=[`/node_modules/`,`/dist/`,`/out/`,`/.bun/`],Bt=[{segment:`/templates/`,type:`templates`},{segment:`/domains/`,type:`domains`},{segment:`/packages/`,type:`packages`},{segment:`/infrastructure/`,type:`infrastructure`}],Vt=[{segment:`/src/main/`,process:`main`},{segment:`/src/renderer/`,process:`renderer`},{segment:`/src/preload/`,process:`preload`},{segment:`/src/shared/`,process:`shared`}];function z(e){return e.replace(/\\/g,`/`)}function Ht(e){return L.some(t=>t.test(e))}function Ut(e){let t=z(e);return R.some(e=>t.includes(e))}function B(e){return e.isElectron&&e.electronProcess?`src/${e.electronProcess}/__tests__`:`src/__tests__`}function Wt(e,t){let n=z(e);return t.srcRoot?n.startsWith(`${t.srcRoot}/__tests__/`):!0}function Gt(e,t){let n=z(e),r=l.default.basename(e);if(!t.srcRoot)return`src/__tests__/${r}`;let i=n.indexOf(`/src/`);if(i===-1)return`${t.srcRoot}/__tests__/${r}`;let a=n.slice(i+5).split(`/`);if(a.length>1&&a.pop(),t.isElectron&&t.electronProcess){let e=a.indexOf(t.electronProcess);e!==-1&&a.splice(e,1)}let o=a.indexOf(`__tests__`);o!==-1&&a.splice(o,1);let s=a.join(`/`),c=B(t);return s?`${c}/${s}/${r}`:`${c}/${r}`}function Kt(e,t){let n=e.indexOf(t),r=e.slice(n+t.length).split(`/`),i=r.findIndex(e=>e===`src`);if(i!==-1)return e.slice(0,n+t.length)+r.slice(0,i+1).join(`/`);let a=t===`/domains/`&&r.length>=2?`${r[0]}/${r[1]}`:r[0];return a?e.slice(0,n+t.length+a.length)+`/src`:e.slice(0,n+t.length)+`src`}function qt(e){for(let t of Vt)if(e.includes(t.segment))return{electronProcess:t.process,srcRoot:e.slice(0,e.indexOf(t.segment))+t.segment.slice(0,-1)};return{srcRoot:``}}function Jt(e){return e.includes(`-desktop`)||e===`desktop`}function Yt(e){let t=z(e);for(let e of Bt)if(t.includes(e.segment))return{type:e.type,isElectron:!1,srcRoot:Kt(t,e.segment)};if(t.includes(`/database/`)){let e=t.indexOf(`/database/`);return{type:`database`,isElectron:!1,srcRoot:t.slice(0,e+10)+`src`}}if(!t.includes(`/apps/`))return{type:`unknown`,isElectron:!1,srcRoot:``};let n=t.indexOf(`/apps/`),r=t.slice(n+6).split(`/`)[0];if(!r)return{type:`unknown`,isElectron:!1,srcRoot:``};let i=t.slice(0,n+6+r.length)+`/src`;if(!Jt(r))return{type:`apps`,isElectron:!1,srcRoot:i};let a=qt(t);return{type:`apps`,isElectron:!0,electronProcess:a.electronProcess,srcRoot:a.srcRoot||i}}const V={meta:{type:`problem`,docs:{description:`强制测试文件放置在 src/__tests__ 目录下`},messages:{invalidTestFileLocation:`测试文件 "{{fileName}}" 必须放置在 {{expectedDir}} 目录下。当前路径: "{{currentPath}}"。建议路径: "{{suggestedPath}}"`},schema:[]},create(e){let t=e.filename,n=l.default.basename(t);if(!Ht(n)||Ut(t)||n.endsWith(`.d.ts`))return{};let r=Yt(t);if(r.type===`unknown`||Wt(t,r))return{};let i=B(r),a=Gt(t,r);return e.report({loc:{start:{line:1,column:0},end:{line:1,column:n.length}},messageId:`invalidTestFileLocation`,data:{fileName:n,expectedDir:i,currentPath:t,suggestedPath:a}}),{}}},Xt=[`**/vitest.setup.ts`,`**/jest.setup.ts`,`**/fixtures/**`,`**/helpers/**`,`**/mocks/**`,`**/__mocks__/**`,`**/*.d.ts`],Zt=[/\.test\.ts$/,/\.test\.tsx$/,/\.spec\.ts$/,/\.spec\.tsx$/];function Qt(e){return Zt.some(t=>t.test(e))}function $t(e,t){let n=t.replace(/[.+^${}()|[\]\\]/g,`\\$&`).replace(/\*\*/g,`{{DOUBLE_STAR}}`).replace(/\*/g,`[^/]*`).replace(/{{DOUBLE_STAR}}/g,`.*`);return RegExp(`^${n}$`).test(e)}function en(e,t){return t.some(t=>$t(e,t))}function tn(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function nn(e){if(typeof e!=`object`||!e)return!1;if(!(`allowPatterns`in e))return!0;let t=e.allowPatterns;return Array.isArray(t)&&tn(t)}const rn={meta:{type:`problem`,docs:{description:`禁止在 __tests__ 目录下放置非测试文件`},messages:{nonTestFileInTestsDirectory:`文件 "{{fileName}}" 位于 __tests__ 目录下但不是测试文件。测试目录应仅包含测试文件(*.test.ts, *.spec.ts)。如果是辅助文件,请移动到 src/test-helpers/ 或 src/testing/ 目录。`},schema:[{type:`object`,properties:{allowPatterns:{type:`array`,items:{type:`string`},description:`允许在 __tests__ 目录下的非测试文件 glob 模式`}},additionalProperties:!1}]},create(e){let t=[...Xt],n=e.options[0];nn(n)&&n.allowPatterns&&(t=[...Xt,...n.allowPatterns]);let r=e.filename,i=z(r),a=l.default.basename(r);return{Program(){i.includes(`/__tests__/`)&&(Qt(a)||en(i,t)||e.report({loc:{start:{line:1,column:0},end:{line:1,column:a.length}},messageId:`nonTestFileInTestsDirectory`,data:{fileName:a}}))}}}},an=[/\.test\.ts$/,/\.test\.tsx$/,/\.spec\.ts$/,/\.spec\.tsx$/],H=[`.ts`,`.tsx`],on=new Set([`node_modules`,`dist`,`out`,`.bun`,`.turbo`,`.cache`,`generated`]),sn=new WeakMap;function cn(e){return e.replace(/\\/g,`/`)}function ln(e,t){let n;try{n=u.default.readdirSync(e,{withFileTypes:!0})}catch{return}for(let r of n){let n=l.default.join(e,r.name);if(r.isDirectory()){if(on.has(r.name))continue;ln(n,t)}else r.isFile()&&t(n)}}function U(e){return L.some(t=>t.test(e))}function un(e){let t=cn(e);return R.some(e=>t.includes(e))}function dn(e){for(let t of an)if(t.test(e))return e.replace(t,``);return e}function fn(e){let t=cn(e),n=t.indexOf(`/__tests__/`);return n===-1?l.default.dirname(e):t.substring(0,n)}function pn(e,t){for(let n of H){let r=l.default.join(t,e+n);if(u.default.existsSync(r))return r}return null}function mn(e,t){let n=sn.get(e);if(n||(n=new Map,sn.set(e,n)),n.has(t))return n.get(t);let r=[];return ln(t,e=>r.push(e)),n.set(t,r),r}function hn(e,t,n,r){let i=l.default.dirname(t),a=[i,l.default.dirname(i)];for(let t of a){let n=pn(e,t);if(n)return n}let o=[n,i];for(let t of o){if(!u.default.existsSync(t))continue;let n=mn(r,t);for(let t of n){let n=l.default.basename(t);if(!U(n)){for(let r of H)if(n===e+r)return t}}}return null}function gn(e,t){let n=l.default.basename(e),r=dn(n),i=fn(e);if(hn(r,e,i,t))return{isMatch:!0,suggestion:null};let a=bn(i,e,t)[0];if(a){let e=l.default.basename(a,l.default.extname(a)),t=l.default.extname(n),r=n.includes(`.spec.`)?`.spec`:`.test`,i=t.replace(r,``);return{isMatch:!1,suggestion:e+r+i}}return{isMatch:!1,suggestion:null}}function _n(e){return U(e)||e===`index.ts`||e===`index.tsx`||e.endsWith(`.d.ts`)?!1:H.some(t=>e.endsWith(t))}function vn(e,t,n){if(u.default.existsSync(e))try{let r=u.default.readdirSync(e,{withFileTypes:!0});for(let i of r){if(!i.isFile())continue;let r=i.name;if(!_n(r))continue;let a=l.default.join(e,r);n.has(a)||(t.push(a),n.add(a))}}catch{}}function yn(e,t,n,r){if(!u.default.existsSync(e))return;let i=mn(t,e);for(let e of i)_n(l.default.basename(e))&&(r.has(e)||(n.push(e),r.add(e)))}function bn(e,t,n){let r=l.default.dirname(t),i=l.default.dirname(r),a=[],o=new Set,s=[r,i];for(let e of s)vn(e,a,o);if(a.length===0){let t=[e,r];for(let e of t)yn(e,n,a,o)}return a}const xn={meta:{type:`problem`,docs:{description:`确保测试文件名与被测试的源文件名保持一致`},messages:{testFileNotMatchSource:`测试文件 "{{testFileName}}" 未找到匹配的源文件。测试文件名应与源文件名保持一致。{{suggestion}}`},schema:[]},create(e){let t=e.filename,n=l.default.basename(t);if(!U(n)||un(t)||n.endsWith(`.d.ts`))return{};let r=gn(t,e);if(!r.isMatch){let t=r.suggestion?`建议重命名为 "${r.suggestion}"`:`请确保测试文件名与源文件名匹配(如 user.service.ts -> user.service.test.ts)`;e.report({loc:{start:{line:1,column:0},end:{line:1,column:n.length}},messageId:`testFileNotMatchSource`,data:{testFileName:n,suggestion:t}})}return{}}};function Sn(e){if(!e||typeof e!=`object`)return!1;let t=e;if(!(`type`in t)||t.type!==d.AST_NODE_TYPES.MemberExpression||!(`object`in t)||!t.object||!(`property`in t)||!t.property)return!1;let n=t.object,r=t.property;return!n||typeof n!=`object`||!r||typeof r!=`object`?!1:`type`in n&&n.type===d.AST_NODE_TYPES.Identifier&&`name`in n&&n.name===`window`&&`type`in r&&r.type===d.AST_NODE_TYPES.Identifier&&`name`in r&&r.name===`electron`}const Cn={meta:{type:`problem`,docs:{description:`禁止在 Preload 中直接暴露 @electron-toolkit/preload 的 electronAPI`},messages:{noElectronApiImport:`禁止导入 @electron-toolkit/preload 的 electronAPI。`,noExposeElectronApi:`禁止执行 contextBridge.exposeInMainWorld("electron", electronAPI)。`,noWindowElectronApi:`禁止执行 window.electron = electronAPI。`},schema:[]},create(e){return{ImportDeclaration(t){if(t.source.value===`@electron-toolkit/preload`)for(let n of t.specifiers)n.type===`ImportSpecifier`&&n.imported.type===`Identifier`&&n.imported.name===`electronAPI`&&e.report({node:n,messageId:`noElectronApiImport`})},CallExpression(t){if(t.callee.type!==`MemberExpression`||t.callee.property.type!==`Identifier`||t.callee.property.name!==`exposeInMainWorld`||t.arguments.length<2)return;let[n,r]=t.arguments;n?.type===`Literal`&&n.value===`electron`&&r?.type===`Identifier`&&r.name===`electronAPI`&&e.report({node:t,messageId:`noExposeElectronApi`})},AssignmentExpression(t){t.left.type===`MemberExpression`&&Sn(t.left)&&t.right.type===`Identifier`&&t.right.name===`electronAPI`&&e.report({node:t,messageId:`noWindowElectronApi`})}}}};function wn(e){let t=e.replace(/\\/g,`/`);return t.includes(`/src/preload/`)&&!t.includes(`/__tests__/`)}function W(e){return typeof e==`object`&&!!e}function Tn(e){if(!W(e))return null;let t=e.key;return W(t)?typeof t.name==`string`?t.name:typeof t.value==`string`?t.value:null:null}function En(e){return!W(e)||!Array.isArray(e.properties)?!1:e.properties.some(e=>{if(!W(e)||e.type!==`Property`)return!1;let t=Tn(e);return t===`on`||t===`send`||t===`invoke`})}const Dn={meta:{type:`problem`,docs:{description:`禁止在 Preload 暴露通用 ipc 桥接对象`},messages:{noIpcBridge:`禁止暴露通用 ipc 桥接对象(on/send/invoke)。请使用领域 API。`},schema:[]},create(e){return wn(e.filename)?{Property(t){Tn(t)===`ipc`&&W(t.value)&&t.value.type===`ObjectExpression`&&En(t.value)&&e.report({node:t,messageId:`noIpcBridge`})}}:{}}};function On(e){let t=e.replace(/\\/g,`/`);return t.includes(`/src/preload/`)&&!t.includes(`/__tests__/`)&&!t.includes(`/src/preload/utils/`)}const kn={meta:{type:`problem`,docs:{description:`禁止在 Preload 业务代码中直接调用 ipcRenderer`},messages:{noDirectCall:`禁止直接调用 ipcRenderer。请通过 createTypedAPI 或 invoke 封装。`},schema:[]},create(e){return On(e.filename)?{CallExpression(t){t.callee.type===`MemberExpression`&&t.callee.object.type===`Identifier`&&t.callee.object.name===`ipcRenderer`&&e.report({node:t,messageId:`noDirectCall`})}}:{}}};function G(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`Identifier`&&`name`in e&&typeof e.name==`string`}function An(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`Property`&&`value`in e&&e.value!==null&&typeof e.value==`object`&&G(e.value)}function jn(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`RestElement`&&`argument`in e&&e.argument!==null&&typeof e.argument==`object`&&G(e.argument)}function Mn(e){let t=[];if(!e||typeof e!=`object`)return t;if(G(e)&&t.push(e.name),`type`in e&&e.type===`ObjectPattern`&&`properties`in e&&Array.isArray(e.properties))for(let n of e.properties)!n||typeof n!=`object`||(An(n)?t.push(n.value.name):jn(n)&&t.push(n.argument.name));if(`type`in e&&e.type===`ArrayPattern`&&`elements`in e&&Array.isArray(e.elements))for(let n of e.elements)G(n)&&t.push(n.name);return t}function Nn(e){return`declaration`in e}function Pn(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`VariableDeclaration`&&`kind`in e&&`declarations`in e&&Array.isArray(e.declarations)}function Fn(e){if(typeof e!=`object`||!e||!(`range`in e))return!1;let t=e.range;return Array.isArray(t)&&t.length===2}function In(e,t,n){return r=>{let i=t.declaration;if(!i||!Fn(i)||!e.getTokenBefore(i))return null;let a=e.getText(i),o=n.join(`, `),s=e.getText(t).match(/^(\s*)/),c=s?s[1]:``,l=`${a}`,u=`${c}export { ${o} };`;return r.replaceText(t,`${l}\n${u}`)}}const Ln={meta:{type:`suggestion`,docs:{description:`将 export const/let/var 拆分为独立的声明和导出语句,以便 JSDoc 正确插入`,recommended:!0},fixable:`code`,schema:[],messages:{preferSplitExport:"应将 `export {{kind}} {{names}}` 拆分为独立的声明和导出语句,以便 JSDoc 正确插入注释"}},create(e){let t=e.sourceCode;return{ExportNamedDeclaration(n){if(!Nn(n)||!n.declaration||!Pn(n.declaration))return;let r=n.declaration;if(r.kind!==`const`&&r.kind!==`let`&&r.kind!==`var`)return;let i=r.declarations;if(i.length===0)return;let a=[];i.forEach(e=>{a.push(...Mn(e.id))}),a.length!==0&&e.report({node:n,messageId:`preferSplitExport`,data:{kind:r.kind,names:a.join(`, `)},fix:In(t,n,a)})}}}};function Rn(e){return typeof e==`object`&&!!e&&`name`in e&&typeof e.name==`string`&&(!(`severity`in e)||e.severity===`error`||e.severity===`warn`||e.severity===void 0)&&(!(`description`in e)||typeof e.description==`string`||e.description===void 0)}function zn(e){return Array.isArray(e)&&e.every(Rn)}function Bn(e){if(typeof e!=`object`||!e)return!1;if(!(`directories`in e))return!0;let t=e.directories;return Array.isArray(t)&&zn(t)}const Vn=[{name:`apps`,severity:`error`,description:`应用层目录`},{name:`domains`,severity:`error`,description:`领域层目录`},{name:`packages`,severity:`error`,description:`技术层目录`},{name:`infrastructure`,severity:`warn`,description:`基础设施层目录`},{name:`templates`,severity:`warn`,description:`模板层目录`},{name:`docs`,severity:`warn`,description:`文档层目录`}];function Hn(e,t){return(0,u.existsSync)((0,l.join)(e,t,`README.md`))}function Un(e){return e.cwd}const Wn=new WeakMap;function Gn(e){let t=Wn.get(e);return t||(t=new Set,Wn.set(e,t)),t}const Kn={meta:{type:`problem`,docs:{description:`检查分层目录是否包含 README.md 文件`},messages:{missingReadmeError:`分层目录 "{{directory}}" ({{description}}) 缺少 README.md 文件。分层目录必须包含 README.md 文件,阐明该层职责。`,missingReadmeWarn:`分层目录 "{{directory}}" ({{description}}) 建议添加 README.md 文件,阐明该层职责。`},schema:[{type:`object`,properties:{directories:{type:`array`,items:{type:`object`,properties:{name:{type:`string`},severity:{type:`string`,enum:[`error`,`warn`]},description:{type:`string`}},required:[`name`]}}},additionalProperties:!1}]},create(e){let t=Un(e),n=Gn(e),r=Vn,i=e.options[0];return Bn(i)&&i.directories&&(r=i.directories),{Program(i){if(!n.has(t)){n.add(t);for(let n of r){let r=n.name;if((0,u.existsSync)((0,l.join)(t,r))&&!Hn(t,r)){let t=(n.severity||`error`)===`error`?`missingReadmeError`:`missingReadmeWarn`;e.report({node:i,messageId:t,data:{directory:r,description:n.description||r}})}}}}}}},qn=[{suffix:`.service.drizzle.ts`,classSuffix:`Service`,isInterface:!1,isPrefix:!1},{suffix:`.service.memory.ts`,classSuffix:`Service`,isInterface:!1,isPrefix:!1},{suffix:`.service.ts`,classSuffix:`Service`,isInterface:!1,isPrefix:!1},{suffix:`.controller.ts`,classSuffix:`Controller`,isInterface:!1,isPrefix:!1},{suffix:`.module.ts`,classSuffix:`Module`,isInterface:!1,isPrefix:!1},{suffix:`.repository.drizzle.ts`,classSuffix:`Repository`,isInterface:!1,isPrefix:!1},{suffix:`.repository.memory.ts`,classSuffix:`Repository`,isInterface:!1,isPrefix:!1},{suffix:`.repository.interface.ts`,classSuffix:`Repository`,isInterface:!0,isPrefix:!0},{suffix:`.repository.ts`,classSuffix:`Repository`,isInterface:!1,isPrefix:!1},{suffix:`.entity.ts`,classSuffix:`Entity`,isInterface:!1,isPrefix:!1},{suffix:`.orm-entity.ts`,classSuffix:`OrmEntity`,isInterface:!1,isPrefix:!1},{suffix:`.dto.ts`,classSuffix:`DTO`,isInterface:!1,isPrefix:!1},{suffix:`.port.interface.ts`,classSuffix:`Port`,isInterface:!0,isPrefix:!0},{suffix:`.interface.ts`,classSuffix:``,isInterface:!0,isPrefix:!0},{suffix:`.port.ts`,classSuffix:`Port`,isInterface:!0,isPrefix:!1},{suffix:`.port.adapter.ts`,classSuffix:`PortAdapter`,isInterface:!1,isPrefix:!1},{suffix:`.adapter.ts`,classSuffix:`Adapter`,isInterface:!1,isPrefix:!1},{suffix:`.events.ts`,classSuffix:`Event`,isInterface:!1,isPrefix:!1},{suffix:`.mapper.ts`,classSuffix:`Mapper`,isInterface:!1,isPrefix:!1},{suffix:`.vo.ts`,classSuffix:`VO`,isInterface:!1,isPrefix:!1},{suffix:`.usecase.ts`,classSuffix:`UseCase`,isInterface:!1,isPrefix:!1},{suffix:`.errors.ts`,classSuffix:`Error`,isInterface:!1,isPrefix:!1}];function Jn(e){for(let t of qn)if(e.endsWith(t.suffix))return t;return null}function Yn(e,t){if(t.isPrefix&&t.isInterface){if(t.classSuffix){let n=t.classSuffix;return e.startsWith(`I`)&&e.endsWith(n)&&e.length>1+n.length}return e.startsWith(`I`)&&e.length>1}return t.isPrefix?e.startsWith(`I`)&&e.length>1:e.endsWith(t.classSuffix)&&e.length>t.classSuffix.length}function Xn(e){return e.isPrefix&&e.isInterface?e.classSuffix?`I${e.classSuffix}(如 IUser${e.classSuffix})`:`I 前缀(如 IUser)`:e.isPrefix?`I 前缀(如 IUser)`:`${e.classSuffix} 后缀`}function Zn(e,t,n,r){if(!(0,c.hasIdWithName)(e))return;let i=e.id.name;n.isInterface||Yn(i,n)||t.report({node:e,messageId:`invalidClassName`,data:{className:i,fileName:r,expectedFormat:Xn(n)}})}function Qn(e,t,n,r){if(!n.isInterface||!(0,c.hasIdWithName)(e))return;let i=e.id.name;Yn(i,n)||t.report({node:e,messageId:`invalidInterfaceName`,data:{interfaceName:i,fileName:r,expectedFormat:Xn(n)}})}function $n(e){let t=e.filename,n=l.default.basename(t);if(n.endsWith(`.test.ts`)||n.endsWith(`.spec.ts`))return{};let r=Jn(n);return r?{ClassDeclaration(t){Zn(t,e,r,n)},TSInterfaceDeclaration(t){Qn(t,e,r,n)}}:{}}const er={meta:{type:`problem`,docs:{description:`强制执行类名与文件类型后缀的一致性`},messages:{invalidClassName:`类名 "{{className}}" 不符合命名规范。文件 "{{fileName}}" 中的类应使用 {{expectedFormat}}`,invalidInterfaceName:`接口名 "{{interfaceName}}" 不符合命名规范。文件 "{{fileName}}" 中的接口应使用 {{expectedFormat}}`},schema:[]},create:$n},tr=[`types.ts`,`types.d.ts`],nr=[`.port.interface.ts`,`.repository.interface.ts`,`.types.ts`,`.types.d.ts`,`.events.ts`];function rr(e,t){return(0,c.hasIPrefix)(e)?!1:t.endsWith(`.dto.ts`)?(0,c.isValidDtoNameUpperCase)(e):!0}function ir(e){return e.endsWith(`.dto.ts`)?`DTO 后缀(如 UserDTO),禁止 I 前缀`:`PascalCase(如 User、UserRepository),禁止 I 前缀`}function ar(e){if(tr.includes(e))return!0;for(let t of nr)if(e.endsWith(t))return!0;return!1}function or(e){return e.endsWith(`.port.ts`)?e.replace(`.port.ts`,`.port.interface.ts`):e.endsWith(`.repository.ts`)?e.replace(`.repository.ts`,`.repository.interface.ts`):e.replace(`.ts`,`.interface.ts`)}function sr(e,t){return t.endsWith(`Dto`)?(0,c.createDtoSuffixFixer)(e,t,!0):null}function cr(e,t,n,r){if(rr(n,r))return;if((0,c.hasIPrefix)(n)){e.report({node:t,messageId:`invalidIPrefix`,data:{interfaceName:n,suggestedName:n.substring(1)},fix:(0,c.createRemoveIPrefixFixer)(t,n)});return}let i=sr(t,n);i?e.report({node:t,messageId:`invalidDtoSuffix`,data:{interfaceName:n},fix:i}):e.report({node:t,messageId:`invalidInterfaceName`,data:{interfaceName:n,expectedFormat:ir(r)}})}function lr(e,t,n,r,i){i||r.endsWith(`.dto.ts`)||e.report({node:t,messageId:`invalidFileName`,data:{fileName:r,interfaceName:n,expectedFileName:or(r)}})}function ur(e,t,n,r){if(!(0,c.hasIdWithNameAndRange)(t))return;let i=t.id.name;cr(e,t,i,n),lr(e,t,i,n,r)}function dr(e){let t=e.filename,n=l.default.basename(t);if(n.endsWith(`.test.ts`)||n.endsWith(`.spec.ts`)||ar(n))return{};let r=n.endsWith(`.interface.ts`);return{TSInterfaceDeclaration(t){ur(e,t,n,r)}}}const fr={meta:{type:`problem`,docs:{description:`强制执行接口命名规范(禁止 I 前缀,使用 PascalCase)和文件命名规范(xxx.interface.ts)`},messages:{invalidIPrefix:`接口名 "{{interfaceName}}" 使用了 I 前缀。现代 TypeScript 不推荐使用匈牙利命名法,建议使用 "{{suggestedName}}"`,invalidInterfaceName:`接口名 "{{interfaceName}}" 不符合命名规范。接口名应使用 {{expectedFormat}}`,invalidDtoSuffix:`接口名 "{{interfaceName}}" 后缀应使用 DTO(全大写)而非 Dto(驼峰式)`,invalidFileName:`包含接口 "{{interfaceName}}" 的文件 "{{fileName}}" 应命名为 "{{expectedFileName}}"`},schema:[],fixable:`code`},create:dr},pr=[`.types.ts`,`.types.d.ts`];function mr(e){return pr.some(t=>e.endsWith(t))}function hr(e){let t=e.filename,n=l.default.basename(t);return n.endsWith(`.test.ts`)||n.endsWith(`.spec.ts`)||!mr(n)?{}:{TSInterfaceDeclaration(t){if(!(0,c.hasIdWithNameAndRange)(t))return;let n=t.id.name;(0,c.hasIPrefix)(n)&&e.report({node:t,messageId:`invalidIPrefix`,data:{interfaceName:n,suggestedName:n.substring(1)},fix:(0,c.createRemoveIPrefixFixer)(t,n)})}}}const gr={meta:{type:`problem`,docs:{description:`强制执行 types 文件中的接口命名规范(禁止 I 前缀)`},messages:{invalidIPrefix:`类型文件中的接口名 "{{interfaceName}}" 使用了 I 前缀。现代 TypeScript 不推荐使用匈牙利命名法,建议使用 "{{suggestedName}}"`},schema:[],fixable:`code`},create:hr};function _r(e){return e.endsWith(`.dto.ts`)}function vr(e){return e.endsWith(`DTO`)}function yr(e){let t=e.filename,n=l.default.basename(t);return n.endsWith(`.test.ts`)||n.endsWith(`.spec.ts`)||!_r(n)?{}:{TSInterfaceDeclaration(t){if(!(0,c.hasIdWithNameAndRange)(t))return;let n=t.id.name;vr(n)?e.report({node:t,messageId:`invalidDtoSuffix`,data:{interfaceName:n},fix:(0,c.createDtoSuffixFixer)(t,n,!1)}):(0,c.isValidDtoNameCamelCase)(n)||e.report({node:t,messageId:`missingDtoSuffix`,data:{interfaceName:n}})}}}const br={meta:{type:`problem`,docs:{description:`强制执行 DTO 文件中的接口命名规范(Dto 后缀,驼峰式)`},messages:{invalidDtoSuffix:`接口名 "{{interfaceName}}" 后缀应使用 Dto(驼峰式)而非 DTO(全大写)`,missingDtoSuffix:`DTO 文件中的接口名 "{{interfaceName}}" 应以 Dto 结尾(如 UserResponseDto)`},schema:[],fixable:`code`},create:yr},K=`@longzai-intelligence/config/tsup`,xr=`definePackageConfig`,Sr=[`defineConfig`];function Cr(e){return{ImportDeclaration(t){if(!(0,c.isImportDeclaration)(t))return;let n=t.source.value;for(let r of t.specifiers){if(!(0,c.isImportSpecifier)(r))continue;let i=r.imported.name;if(Sr.includes(i)){if(n===`tsup`){e.report({node:t,messageId:`forbiddenTsupImport`,data:{importedName:i,correctExportName:xr,configPackage:K}});continue}n===K&&e.report({node:t,messageId:`forbiddenConfigImport`,data:{importedName:i,correctExportName:xr,configPackage:K}})}}}}}const wr={meta:{type:`problem`,docs:{description:`强制执行 tsup.config.ts 文件中的配置导入规范,必须使用 definePackageConfig`},messages:{forbiddenTsupImport:`禁止从 tsup 包导入 {{importedName}}。应使用 {{correctExportName}} 从 {{configPackage}} 导入`,forbiddenConfigImport:`禁止从 {{configPackage}} 导入 {{importedName}}。应使用 {{correctExportName}}`},schema:[]},create:Cr},q=`@longzai-intelligence/tsdown-config`,Tr=[`defineDomainImplementationConfig`,`defineDomainContractConfig`,`defineSharedKernelConfig`,`defineReactComponentsConfig`,`defineConfigPackageConfig`,`definePackageConfig`],Er=[`defineConfig`];function Dr(e){return{ImportDeclaration(t){if(!(0,c.isImportDeclaration)(t))return;let n=t.source.value;for(let r of t.specifiers){if(!(0,c.isImportSpecifier)(r))continue;let i=r.imported.name;if(Er.includes(i)){if(n===`tsdown`){e.report({node:t,messageId:`forbiddenTsdownImport`,data:{importedName:i,presetNames:Tr.join(`、`),configPackage:q}});continue}n===q&&e.report({node:t,messageId:`forbiddenConfigImport`,data:{importedName:i,presetNames:Tr.join(`、`),configPackage:q}})}}}}}const Or={meta:{type:`problem`,docs:{description:`强制执行 tsdown.config.ts 文件中的配置导入规范,必须使用预设函数`},messages:{forbiddenTsdownImport:`禁止从 tsdown 包导入 {{importedName}}。应使用预设函数({{presetNames}})从 {{configPackage}} 导入`,forbiddenConfigImport:`禁止从 {{configPackage}} 导入 {{importedName}}。应使用预设函数({{presetNames}})`},schema:[]},create:Dr},J=[`@longzai-intelligence/config/vitest`,`@longzai-intelligence/vitest-config`],Y=[`createBaseVitestConfig`,`createDomainVitestConfig`,`createDomainUIVitestConfig`,`createPackageVitestConfig`,`createTypeOnlyVitestConfig`,`createDesktopVitestConfig`,`createWebVitestConfig`,`defineVitestConfig`,`defineDomainVitestConfig`,`defineDomainUIVitestConfig`,`definePackageVitestConfig`,`defineTypeOnlyVitestConfig`,`defineDesktopVitestConfig`,`defineWebVitestConfig`],kr=[`defineConfig`],Ar=[`infrastructure/configs/vitest/vitest.config.ts`];function jr(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`ExportDefaultDeclaration`&&`declaration`in e&&e.declaration!==null&&typeof e.declaration==`object`}function Mr(e){return e.endsWith(`vitest.config.ts`)}function Nr(e,t,n){if(!(0,c.isImportDeclaration)(e))return;let r=e.source.value;for(let t of e.specifiers){if(!(0,c.isImportSpecifier)(t))continue;let i=t.imported.name;if(r===`vitest`&&kr.includes(i)){n.hasForbiddenImport=!0,n.forbiddenImportNode=e,n.forbiddenImportName=i;continue}J.includes(r)&&Y.includes(i)&&(n.hasValidImport=!0)}}function Pr(e,t){return!t.hasForbiddenImport||!t.forbiddenImportNode?!1:(e.report({node:t.forbiddenImportNode,messageId:`forbiddenVitestImport`,data:{importedName:t.forbiddenImportName,configPackages:J.join(` 或 `),allowedExports:Y.join(`, `)}}),!0)}function Fr(e,t,n){if(!(0,c.isCallExpressionNode)(e))return!1;let r=e.callee.name;return typeof r==`string`&&!Y.includes(r)&&!n.hasValidImport?(t.report({node:e,messageId:`invalidConfigFunction`,data:{configPackages:J.join(` 或 `),allowedExports:Y.join(`, `)}}),!0):!1}function Ir(e,t,n){return(0,c.isObjectExpressionNode)(e)?n.hasValidImport?!1:(t.report({node:e,messageId:`invalidConfigObject`,data:{configPackages:J.join(` 或 `),allowedExports:Y.join(`, `)}}),!0):!1}function Lr(e,t,n){if(!jr(e))return;n.hasExportDefault=!0;let r=e.declaration;Pr(t,n)||Fr(r,t,n)||Ir(r,t,n)}function Rr(e,t){if(!t.hasExportDefault){let t=e.sourceCode.ast;e.report({node:t,messageId:`missingConfigImport`,data:{configPackages:J.join(` 或 `),allowedExports:Y.join(`, `)}})}}function zr(e){let t=e.filename;if(!Mr(t)||(0,c.isInExcludedPath)(t,Ar))return{};let n={hasValidImport:!1,hasForbiddenImport:!1,hasExportDefault:!1,forbiddenImportNode:null,forbiddenImportName:``};return{ImportDeclaration(t){Nr(t,e,n)},ExportDefaultDeclaration(t){Lr(t,e,n)},"Program:exit"(){Rr(e,n)}}}const Br={meta:{type:`problem`,docs:{description:`强制执行 vitest.config.ts 文件中的配置导入规范,必须使用共享配置函数`},messages:{forbiddenVitestImport:`禁止从 vitest 包导入 {{importedName}}。应使用共享配置函数({{allowedExports}})从 {{configPackages}} 导入`,invalidConfigFunction:`必须使用共享配置函数({{allowedExports}})从 {{configPackages}} 导入`,missingConfigImport:`vitest.config.ts 必须使用共享配置函数({{allowedExports}})从 {{configPackages}} 导入`},schema:[]},create:zr},X=`@longzai-intelligence/config/eslint`,Z=[`createBaseConfig`,`createLibraryConfig`,`createDomainConfig`,`createReactConfig`,`createElectronConfig`,`createNextConfig`,`createArchitectureConfig`,`createServerConfig`,`createNestConfig`,`createHonoConfig`],Vr=[`baseConfig`,`libraryConfig`,`domainConfig`,`reactConfig`,`electronConfig`,`nextConfig`,`architectureConfig`,`serverConfig`,`nestConfig`,`honoConfig`,`base`,`library`,`domain`,`react`,`electron`,`next`,`architecture`,`server`,`nest`,`hono`];function Hr(e,t){e.report({node:t,messageId:`forbiddenDefaultImport`,data:{configPackage:X,allowedFunctions:Z.join(`、`)}})}function Ur(e,t){e.report({node:t,messageId:`forbiddenNamespaceImport`,data:{configPackage:X,allowedFunctions:Z.join(`、`)}})}function Wr(e,t,n){e.report({node:t,messageId:`forbiddenConfigImport`,data:{importedName:n,allowedFunctions:Z.join(`、`)}})}function Gr(e,t){e.report({node:t,messageId:`missingCreateFunction`,data:{configPackage:X,allowedFunctions:Z.join(`、`)}})}function Kr(e,t){if(!(0,c.isImportDeclaration)(t)||t.source.value!==X)return;let n=[],r=[],i=!1;for(let a of t.specifiers)if((0,c.isImportSpecifier)(a)){if((0,c.isDefaultImport)(a)){Hr(e,t),i=!0;continue}if(a.type===`ImportNamespaceSpecifier`){Ur(e,t),i=!0;continue}Vr.includes(a.imported.name)?r.push(a):Z.includes(a.imported.name)&&n.push(a)}if(!i){for(let n of r)Wr(e,t,n.imported.name);r.length===0&&n.length===0&&(t.specifiers.some(e=>(0,c.isImportSpecifier)(e)&&e.type===`ImportSpecifier`&&!Z.includes(e.imported.name)&&!Vr.includes(e.imported.name))||Gr(e,t))}}function qr(e){return{ImportDeclaration(t){Kr(e,t)}}}const Jr={meta:{type:`problem`,docs:{description:`强制执行 eslint.config.ts 文件中的配置导入规范,必须使用 createXxxConfig 函数`},messages:{forbiddenDefaultImport:`禁止从 {{configPackage}} 使用默认导入。应使用具名导入 {{allowedFunctions}} 等配置创建函数`,forbiddenNamespaceImport:`禁止从 {{configPackage}} 使用命名空间导入。应使用具名导入 {{allowedFunctions}} 等配置创建函数`,forbiddenConfigImport:`禁止从配置包导入 {{importedName}}。应使用 {{allowedFunctions}} 等配置创建函数`,missingCreateFunction:`必须从 {{configPackage}} 导入至少一个配置创建函数(如 {{allowedFunctions}})`},schema:[]},create:qr},Yr=[`./tsconfig/app.json`,`./tsconfig/node.json`,`./tsconfig/test.json`],Xr=[`app.json`,`node.json`,`test.json`,`build.json`];function Zr(e){return typeof e==`object`&&!!e&&`path`in e&&typeof e.path==`string`}function Qr(e){return Array.isArray(e)&&e.every(Zr)}function $r(e){return!(typeof e!=`object`||!e)}function ei(e){try{let t=(0,u.readFileSync)(e,`utf-8`);return JSON.parse(t)}catch{return null}}function ti(e){let t=e.map(e=>e.path);return Yr.filter(e=>!t.includes(e))}function ni(e){return e.map(e=>e.path).filter(e=>!Yr.includes(e))}const ri=new WeakMap;function ii(e,t){let n=ri.get(e);if(n||(n=new Map,ri.set(e,n)),n.has(t))return n.get(t);let r=(0,u.existsSync)(t),i={hasDir:r,missingFiles:r?ai(t):[]};return n.set(t,i),i}function ai(e){return Xr.filter(t=>!(0,u.existsSync)((0,l.join)(e,t)))}function oi(e,t,n){if(!n.references||!Qr(n.references)){e.report({node:t,messageId:`missingReferences`});return}let r=ti(n.references);r.length>0&&e.report({node:t,messageId:`missingRequiredReference`,data:{missingPath:r[0]}});let i=ni(n.references);for(let n of i)e.report({node:t,messageId:`extraReference`,data:{extraPath:n}})}function si(e,t,n){return n.files===void 0?!0:Array.isArray(n.files)?n.files.length===0?!0:(e.report({node:t,messageId:`filesMustBeEmpty`}),!1):(e.report({node:t,messageId:`filesMustBeArray`}),!1)}const ci={meta:{type:`problem`,docs:{description:`检查 tsconfig.json 是否正确使用 references 配置`},messages:{missingReferences:`tsconfig.json 必须使用 references 配置,采用目录收拢多配置模式。请添加 references 字段,包含 app.json、node.json、test.json 三个配置。`,missingRequiredReference:`tsconfig.json 的 references 缺少必需的配置: "{{missingPath}}"。references 必须包含 ./tsconfig/app.json、./tsconfig/node.json、./tsconfig/test.json。`,filesMustBeEmpty:`tsconfig.json 使用 references 时,files 必须为空数组 "[]"。请将 files 设置为空数组或移除 files 字段。`,filesMustBeArray:`tsconfig.json 使用 references 时,files 必须为数组类型。请将 files 设置为空数组 "[]"。`,missingTsconfigDirectory:`缺少 tsconfig/ 目录。请创建 tsconfig/ 目录并添加 app.json、node.json、test.json、build.json 配置文件。`,missingConfigFile:`tsconfig/ 目录缺少必需的配置文件: {{missingFiles}}。必需的配置文件包括: app.json、node.json、test.json、build.json。`,extraReference:`tsconfig.json 的 references 包含非必需的配置: "{{extraPath}}"。references 应仅包含 ./tsconfig/app.json、./tsconfig/node.json、./tsconfig/test.json。`},schema:[]},create(e){let t=e.filename;if(!t.endsWith(`tsconfig.json`)||t.includes(`tsconfig/`))return{};let n=(0,l.join)((0,l.dirname)(t),`tsconfig`);return{Program(r){let i=ei(t);if(!$r(i))return;let a=ii(e,n);if(!a.hasDir){e.report({node:r,messageId:`missingTsconfigDirectory`});return}if(a.missingFiles.length>0){e.report({node:r,messageId:`missingConfigFile`,data:{missingFiles:a.missingFiles.join(`, `)}});return}si(e,r,i)&&oi(e,r,i)}}}};function li(e){let t=e.replace(/\\/g,`/`);return t.includes(`/src/preload/`)&&!t.includes(`/__tests__/`)}const ui={meta:{type:`problem`,docs:{description:`禁止使用字符串字面量作为 IPC 通道名`},messages:{noStringLiteral:`禁止使用字符串字面量作为 IPC 通道名。请使用通道常量。`},schema:[]},create(e){return li(e.filename)?{CallExpression(t){if(t.callee.type!==`Identifier`||t.callee.name!==`invoke`||t.arguments.length===0)return;let n=t.arguments[0];n&&n.type===`Literal`&&typeof n.value==`string`&&e.report({node:n,messageId:`noStringLiteral`})},ObjectExpression(t){if(t.parent?.type===`CallExpression`&&t.parent.callee.type===`Identifier`&&t.parent.callee.name===`createTypedAPI`)for(let n of t.properties)n.type===`Property`&&n.value.type===`Literal`&&typeof n.value.value==`string`&&e.report({node:n.value,messageId:`noStringLiteral`})}}:{}}};function di(e){let t=e.replace(/\\/g,`/`);return t.endsWith(`/src/preload/index.ts`)&&!t.includes(`/__tests__/`)}function fi(e){let t=e.parent;for(;t;){if(t.type===`CallExpression`&&t.callee.type===`Identifier`&&t.callee.name===`exposeSafeAPI`)return!0;t=t.parent}return!1}const pi={meta:{type:`problem`,docs:{description:`要求使用 exposeSafeAPI 进行 API 暴露`},messages:{requireExposeSafeApi:`请使用 exposeSafeAPI 进行 API 暴露,而非直接调用 contextBridge.exposeInMainWorld。`},schema:[]},create(e){return di(e.filename)?{CallExpression(t){t.callee.type===`MemberExpression`&&t.callee.object.type===`Identifier`&&t.callee.object.name===`contextBridge`&&t.callee.property.type===`Identifier`&&t.callee.property.name===`exposeInMainWorld`&&(fi(t)||e.report({node:t,messageId:`requireExposeSafeApi`}))}}:{}}};function mi(e){let t=e.replace(/\\/g,`/`);return t.includes(`/src/preload/utils/`)&&!t.includes(`/__tests__/`)}function hi(e){return e.startsWith(`createTyped`)}const gi={meta:{type:`problem`,docs:{description:`禁止自定义 IPC 工具函数`},messages:{noCustomIPC:`禁止自定义 IPC 工具函数。请使用 @longzai-intelligence/electron/preload 提供的标准函数。`},schema:[]},create(e){return mi(e.filename)?{FunctionDeclaration(t){t.id&&hi(t.id.name)&&e.report({node:t,messageId:`noCustomIPC`})},VariableDeclaration(t){for(let n of t.declarations){if(n.id.type!==`Identifier`||!hi(n.id.name))continue;let r=n.init;r&&(r.type===`FunctionExpression`||r.type===`ArrowFunctionExpression`)&&e.report({node:t,messageId:`noCustomIPC`})}}}:{}}},_i=new Set([`unwrap`,`unwrapIPCResult`]);function vi(e){let t=e.replace(/\\/g,`/`);return t.includes(`/src/renderer/`)&&!t.includes(`/__tests__/`)&&!t.endsWith(`.test.ts`)&&!t.endsWith(`.spec.ts`)}function yi(e){if(e.type!==`CallExpression`)return!1;let{callee:t}=e;if(t.type!==`MemberExpression`)return!1;let{object:n}=t;return n.type===`MemberExpression`?n.object.type===`Identifier`&&n.object.name===`window`:!1}function bi(e){let t=e.parent;for(;t;){if(t.type===`CallExpression`&&t.callee.type===`Identifier`&&_i.has(t.callee.name))return!0;if(t.type===`CallExpression`)break;t=t.parent}return!1}const xi={meta:{type:`problem`,docs:{description:`渲染层调用 IPC API 时必须使用 unwrap 解包结果`},messages:{requireUnwrap:`渲染层调用 IPC API 时必须使用 unwrap 或 unwrapIPCResult 解包结果。`},schema:[]},create(e){return vi(e.filename)?{CallExpression(t){yi(t)&&(bi(t)||e.report({node:t,messageId:`requireUnwrap`}))}}:{}}};function Si(e){return e.endsWith(`Class`)}function Ci(e,t){if(typeof t!=`object`||!t||!(`imported`in t)||!(`local`in t)||t.local===null||typeof t.local!=`object`||!(`name`in t.local)||typeof t.local.name!=`string`||!(`range`in t.local)||!Array.isArray(t.local.range))return;let n=t.local.name,r=t.imported!==null&&typeof t.imported==`object`&&`name`in t.imported&&typeof t.imported.name==`string`?t.imported.name:n;n!==r&&Si(n)&&e.report({node:t,messageId:`noClassSuffixAlias`,data:{aliasName:n,importedName:r}})}function wi(e){return{ImportSpecifier(t){Ci(e,t)}}}const Q={meta:{type:`problem`,docs:{description:`禁止在 import 别名中使用 "Class" 后缀`},messages:{noClassSuffixAlias:`导入别名 "{{aliasName}}" 使用了 "Class" 后缀,这是不允许的命名方式。请使用更具描述性的名称,或直接使用原始名称 "{{importedName}}"`},schema:[]},create:wi},Ti=/domains\/[^/]+\/implementation\/src\/index\.ts$/,Ei=[/\.\/typeorm/,/\.\/typeorm'/,/\.\/typeorm"/];function Di(e){return Ei.some(t=>t.test(e))}const Oi={meta:{type:`problem`,docs:{description:`Implementation 包导出控制:禁止从主入口重新导出 typeorm.ts 的内容,typeorm.ts 仅供 DataSource/迁移基础设施使用`,recommended:!0},schema:[],messages:{forbiddenTypeormReExport:`禁止从主入口重新导出 typeorm.ts 的内容。typeorm.ts 是专门的持久化入口,仅供 DataSource/迁移基础设施使用,业务代码应通过主入口导入领域服务`}},create(e){let t=e.filename;return Ti.test(t)?{ExportNamedDeclaration(t){if(!t.source)return;let n=t.source.value;typeof n==`string`&&Di(n)&&e.report({node:t,messageId:`forbiddenTypeormReExport`})},ExportAllDeclaration(t){if(!t.source)return;let n=t.source.value;typeof n==`string`&&Di(n)&&e.report({node:t,messageId:`forbiddenTypeormReExport`})}}:{}}},ki={type:`suggestion`,docs:{description:`强制 domain entities 导出命名符合 {DOMAIN}_ORM_ENTITIES 规范`,recommended:!0},fixable:void 0,schema:[],messages:{invalidNaming:`entities 导出命名 "{{name}}" 不符合规范,应使用 "{{expected}}" 格式`,genericNaming:`entities 导出命名 "{{name}}" 是通用名称,应使用具体的 domain 名称 "{{expected}}"`,missingOrm:`entities 导出命名 "{{name}}" 缺少 "_ORM" 前缀,应使用 "{{expected}}"`,typoDetected:`entities 导出命名 "{{name}}" 可能存在拼写错误,应使用 "{{expected}}"`}},Ai=new Set([`DOMAIN_ENTITIES`,`ALL_ENTITIES`,`ENTITIES`]);function ji(e){let t=e.match(/\/domains\/([^/]+)\/implementation\/src\/typeorm\.ts$/);return!t||!t[1]?null:t[1].split(`-`).map(e=>e.toUpperCase()).join(`_`)}function Mi(e,t){return e.endsWith(`_ORM_ENTITIES`)?!1:e.endsWith(`_ENTITIES`)?e.replace(`_ENTITIES`,``)===t.replace(`_ORM_ENTITIES`,``):!1}function Ni(e){return Ai.has(e)}function Pi(e,t){let n=e.length,r=t.length,i=[];for(let a=0;a<=n;a++){i[a]=[];for(let n=0;n<=r;n++)a===0?i[a][n]=n:n===0?i[a][n]=a:e[a-1]===t[n-1]?i[a][n]=i[a-1][n-1]:i[a][n]=Math.min(i[a-1][n-1],i[a][n-1],i[a-1][n])+1}return i[n][r]}function Fi(e,t){let n=e.replace(`_ORM_ENTITIES`,``).replace(`_ENTITIES`,``),r=t.replace(`_ORM_ENTITIES`,``);return n===r?!1:n.toLowerCase()===r.toLowerCase()?!0:Pi(n,r)<=2}function Ii(e,t,n,r){Mi(n,r)?e.report({node:t,messageId:`missingOrm`,data:{name:n,expected:r}}):Ni(n)?e.report({node:t,messageId:`genericNaming`,data:{name:n,expected:r}}):Fi(n,r)?e.report({node:t,messageId:`typoDetected`,data:{name:n,expected:r}}):e.report({node:t,messageId:`invalidNaming`,data:{name:n,expected:r}})}function Li(e,t,n,r){if(typeof n!=`object`||!n||!(`id`in n)||n.id===null||typeof n.id!=`object`||!(`type`in n.id)||n.id.type!==`Identifier`||!(`name`in n.id)||typeof n.id.name!=`string`)return;let i=n.id.name;!i.endsWith(`_ENTITIES`)&&!i.endsWith(`_ORM_ENTITIES`)||i!==r&&Ii(e,t,i,r)}function Ri(e,t,n,r){if(typeof n!=`object`||!n||!(`exported`in n)||n.exported===null||typeof n.exported!=`object`||!(`type`in n.exported)||n.exported.type!==`Identifier`||!(`name`in n.exported)||typeof n.exported.name!=`string`)return;let i=n.exported.name;!i.endsWith(`_ENTITIES`)&&!i.endsWith(`_ORM_ENTITIES`)||i!==r&&Ii(e,t,i,r)}function zi(e,t){function n(n){if(typeof n==`object`&&n&&`declaration`in n&&n.declaration!==null&&typeof n.declaration==`object`&&`type`in n.declaration&&n.declaration.type===`VariableDeclaration`&&`declarations`in n.declaration&&Array.isArray(n.declaration.declarations))for(let r of n.declaration.declarations)Li(e,n,r,t);if(typeof n==`object`&&n&&`specifiers`in n&&Array.isArray(n.specifiers))for(let r of n.specifiers)Ri(e,n,r,t)}return n}function Bi(e){let t=e.filename;if(!t.endsWith(`typeorm.ts`))return{};let n=ji(t);return n?{ExportNamedDeclaration:zi(e,`${n}_ORM_ENTITIES`)}:{}}const Vi={meta:ki,create:Bi};function Hi(e){return e.replace(/\\/g,`/`).includes(`/apps/`)}function Ui(e){return e.endsWith(`-implementation`)}function Wi(e){return e.endsWith(`Entity`)}function Gi(e){return e.endsWith(`UseCase`)}function Ki(e){return[/PortAdapter$/,/_TOKEN$/,/^create\w+Repository$/,/^create\w+Adapter$/].some(t=>t.test(e))}const qi={noEntityImport:`禁止在 apps 层导入 Entity 类 "{{importName}}"。请使用 contract 包的 Port 接口进行操作。`,noUseCaseImport:`禁止在 apps 层导入 UseCase 类 "{{importName}}"。请使用 contract 包的 Port 接口进行操作。`,noImplementationImport:`禁止在 apps 层从 implementation 包导入 "{{importName}}"。请使用 contract 包的 Port 接口。`};function Ji(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`ImportSpecifier`}function Yi(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`Identifier`&&`name`in e&&typeof e.name==`string`}function Xi(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`Literal`&&`value`in e&&typeof e.value==`string`}function Zi(e){if(!(`imported`in e)||e.imported===null||typeof e.imported!=`object`)return null;let t=e.imported;return Yi(t)?t.name:Xi(t)?t.value:null}function Qi(e,t,n){Wi(n)?e.report({node:t,messageId:`noEntityImport`,data:{importName:n}}):Gi(n)?e.report({node:t,messageId:`noUseCaseImport`,data:{importName:n}}):Ki(n)||e.report({node:t,messageId:`noImplementationImport`,data:{importName:n}})}function $i(e,t,n){if(!Ji(t))return;let r=Zi(t);r&&Qi(e,t,r)}const ea={meta:{type:`problem`,docs:{description:`禁止在 apps 层导入 implementation 包的 Entity 和 UseCase`},messages:qi,schema:[]},create(e){let t=e.filename;return Hi(t)?{ImportDeclaration(t){if(!(`source`in t)||t.source===null||typeof t.source!=`object`||!(`type`in t.source)||t.source.type!==`Literal`||!(`value`in t.source)||typeof t.source.value!=`string`)return;let n=t.source.value;if(Ui(n)&&!(!(`specifiers`in t)||!Array.isArray(t.specifiers)))for(let r of t.specifiers)Ji(r)&&$i(e,r,n)}}:{}}};function ta(e){let t=e.replace(/\\/g,`/`);return t.includes(`/domains/`)&&t.includes(`/implementation/src/index.ts`)}function na(e){return e.endsWith(`Entity`)}function ra(e){return e.endsWith(`Repository`)&&!e.startsWith(`I`)}function ia(e){return e.endsWith(`OrmEntity`)}function aa(e){return e.endsWith(`_ORM_ENTITIES`)}function oa(e){return e.endsWith(`OrmMapper`)}function sa(e){return e.endsWith(`Schema`)}function ca(e){return`exportKind`in e&&typeof e.exportKind==`string`?e.exportKind===`value`:!0}function la(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`ExportSpecifier`}function ua(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`Identifier`&&`name`in e&&typeof e.name==`string`}function da(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`Literal`&&`value`in e&&typeof e.value==`string`}function fa(e){if(typeof e!=`object`||!e||!(`exported`in e)||e.exported===null||typeof e.exported!=`object`)return null;let t=e.exported;return ua(t)?t.name:da(t)?t.value:null}function $(e,t,n,r){e.report({node:t,messageId:n,data:{exportName:r}})}function pa(e,t,n){return na(n)&&ca(t)?($(e,t,`noEntityValueExport`,n),!0):!1}function ma(e,t,n){return ra(n)?($(e,t,`noRepositoryTypeExport`,n),!0):!1}function ha(e,t,n){return ia(n)?($(e,t,`noOrmEntityExport`,n),!0):aa(n)?($(e,t,`noOrmEntitiesExport`,n),!0):oa(n)?($(e,t,`noOrmMapperExport`,n),!0):!1}function ga(e,t,n){sa(n)&&$(e,t,`noSchemaExport`,n)}function _a(e,t,n){pa(e,t,n)||ma(e,t,n)||ha(e,t,n)||ga(e,t,n)}function va(e,t){if(!(!(`source`in t)||t.source===null||typeof t.source!=`object`||!(`type`in t.source)||t.source.type!==`Literal`||!(`value`in t.source)||typeof t.source.value!=`string`)&&!(!(`specifiers`in t)||!Array.isArray(t.specifiers)))for(let n of t.specifiers){if(!la(n))continue;let t=fa(n);t&&_a(e,n,t)}}const ya={meta:{type:`problem`,docs:{description:`检查 Domain Implementation 包的导出是否符合规范`},messages:{noEntityValueExport:'禁止从主入口值导出 Entity 类 "{{exportName}}"。请改为类型导出:`export type { {{exportName}} }` 或移除导出。',noRepositoryTypeExport:`禁止导出 Repository 类型 "{{exportName}}"。Repository 是内部实现,不应暴露给外部。请移除此导出。`,noOrmEntityExport:`禁止从主入口导出 ORM 实体 "{{exportName}}"。请创建 src/typeorm.ts 入口文件,从该入口导出 ORM 实体。`,noOrmEntitiesExport:`禁止从主入口导出 ORM 实体集合 "{{exportName}}"。请创建 src/typeorm.ts 入口文件,从该入口导出。`,noOrmMapperExport:`禁止导出 ORM Mapper "{{exportName}}"。ORM Mapper 是基础设施实现细节,不应暴露给外部。请移除此导出。`,noSchemaExport:`禁止导出 Schema 定义 "{{exportName}}"。Schema 是实现细节,应完全保留在 Domain 内部。请仅导出从 Schema 推断的类型。`},schema:[]},create(e){let t=e.filename;return ta(t)?{ExportNamedDeclaration(t){va(e,t)}}:{}}},ba=`@longzai-intelligence/architecture-core`,xa={meta:{name:ba,version:`1.0.0`},rules:{"dependency-direction":pe,"no-core-types-in-apps":g,"business-leak":Re,"file-naming":j,"require-type-suffix":M,"no-cross-package-relative-import":I,"prefer-split-export-const":Ln,"require-class-suffix":er,"require-interface-naming":fr,"require-type-naming":gr,"require-dto-naming":br,"no-class-suffix-alias":Q,"implementation-export-control":Oi,"no-implementation-import-in-apps":ea,"domain-export-compliance":ya}},Sa=`@longzai-intelligence/architecture-domain`,Ca={meta:{name:Sa,version:`1.0.0`},rules:{"domain-export":Je,"domain-typeorm-import":$e,"layer-readme-required":Kn,"require-domain-entities-naming":Vi}},wa=`@longzai-intelligence/architecture-electron`,Ta={meta:{name:wa,version:`1.0.0`},rules:{"platform-leak":b,"no-implementation-in-renderer":N,"no-unsafe-electron-api-exposure":Cn,"no-generic-ipc-bridge-exposure":Dn,"no-direct-ipcrenderer-in-preload":kn,"tsconfig-references":ci,"require-typed-ipc-channel":ui,"require-expose-safe-api":pi,"no-custom-ipc-utility":gi,"require-unwrap-ipc-result":xi}},Ea=`@longzai-intelligence/architecture-library`,Da={meta:{name:Ea,version:`1.0.0`},rules:{"test-file-placement":V,"no-non-test-files-in-tests-directory":rn,"test-file-matches-source":xn,"require-tsup-config-import":wr,"require-tsdown-config-import":Or,"require-vitest-config-import":Br,"require-eslint-config-import":Jr}},Oa=`@longzai-intelligence/architecture`,ka={meta:{name:Oa,version:`1.0.0`},rules:{"dependency-direction":pe,"no-core-types-in-apps":g,"platform-leak":b,"business-leak":Re,"domain-export":Je,"domain-typeorm-import":$e,"file-naming":j,"require-type-suffix":M,"no-implementation-in-renderer":N,"no-cross-package-relative-import":I,"test-file-placement":V,"no-non-test-files-in-tests-directory":rn,"test-file-matches-source":xn,"no-unsafe-electron-api-exposure":Cn,"no-generic-ipc-bridge-exposure":Dn,"no-direct-ipcrenderer-in-preload":kn,"prefer-split-export-const":Ln,"layer-readme-required":Kn,"require-class-suffix":er,"require-interface-naming":fr,"require-type-naming":gr,"require-dto-naming":br,"require-tsup-config-import":wr,"require-tsdown-config-import":Or,"require-vitest-config-import":Br,"require-eslint-config-import":Jr,"tsconfig-references":ci,"require-typed-ipc-channel":ui,"require-expose-safe-api":pi,"no-custom-ipc-utility":gi,"require-unwrap-ipc-result":xi,"no-class-suffix-alias":Q,"implementation-export-control":Oi,"require-domain-entities-naming":Vi,"no-implementation-import-in-apps":ea}};exports.CORE_PLUGIN_NAME=ba,exports.DOMAIN_PLUGIN_NAME=Sa,exports.ELECTRON_PLUGIN_NAME=wa,exports.LIBRARY_PLUGIN_NAME=Ea,exports.PLUGIN_NAME=Oa,exports.architectureCorePlugin=xa,exports.architectureDomainPlugin=Ca,exports.architectureElectronPlugin=Ta,exports.architectureLibraryPlugin=Da,exports.architecturePlugin=ka;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ESLint } from "eslint";
|
|
2
|
+
|
|
3
|
+
//#region src/plugins/core/index.d.ts
|
|
4
|
+
declare const CORE_PLUGIN_NAME = "@longzai-intelligence/architecture-core";
|
|
5
|
+
declare const architectureCorePlugin: ESLint.Plugin;
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/plugins/domain/index.d.ts
|
|
8
|
+
declare const DOMAIN_PLUGIN_NAME = "@longzai-intelligence/architecture-domain";
|
|
9
|
+
declare const architectureDomainPlugin: ESLint.Plugin;
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/plugins/electron/index.d.ts
|
|
12
|
+
declare const ELECTRON_PLUGIN_NAME = "@longzai-intelligence/architecture-electron";
|
|
13
|
+
declare const architectureElectronPlugin: ESLint.Plugin;
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/plugins/library/index.d.ts
|
|
16
|
+
declare const LIBRARY_PLUGIN_NAME = "@longzai-intelligence/architecture-library";
|
|
17
|
+
declare const architectureLibraryPlugin: ESLint.Plugin;
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/index.d.ts
|
|
20
|
+
declare const PLUGIN_NAME = "@longzai-intelligence/architecture";
|
|
21
|
+
declare const architecturePlugin: ESLint.Plugin;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { CORE_PLUGIN_NAME, DOMAIN_PLUGIN_NAME, ELECTRON_PLUGIN_NAME, LIBRARY_PLUGIN_NAME, PLUGIN_NAME, architectureCorePlugin, architectureDomainPlugin, architectureElectronPlugin, architectureLibraryPlugin, architecturePlugin };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ESLint } from "eslint";
|
|
2
|
+
|
|
3
|
+
//#region src/plugins/core/index.d.ts
|
|
4
|
+
declare const CORE_PLUGIN_NAME = "@longzai-intelligence/architecture-core";
|
|
5
|
+
declare const architectureCorePlugin: ESLint.Plugin;
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/plugins/domain/index.d.ts
|
|
8
|
+
declare const DOMAIN_PLUGIN_NAME = "@longzai-intelligence/architecture-domain";
|
|
9
|
+
declare const architectureDomainPlugin: ESLint.Plugin;
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/plugins/electron/index.d.ts
|
|
12
|
+
declare const ELECTRON_PLUGIN_NAME = "@longzai-intelligence/architecture-electron";
|
|
13
|
+
declare const architectureElectronPlugin: ESLint.Plugin;
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/plugins/library/index.d.ts
|
|
16
|
+
declare const LIBRARY_PLUGIN_NAME = "@longzai-intelligence/architecture-library";
|
|
17
|
+
declare const architectureLibraryPlugin: ESLint.Plugin;
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/index.d.ts
|
|
20
|
+
declare const PLUGIN_NAME = "@longzai-intelligence/architecture";
|
|
21
|
+
declare const architecturePlugin: ESLint.Plugin;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { CORE_PLUGIN_NAME, DOMAIN_PLUGIN_NAME, ELECTRON_PLUGIN_NAME, LIBRARY_PLUGIN_NAME, PLUGIN_NAME, architectureCorePlugin, architectureDomainPlugin, architectureElectronPlugin, architectureLibraryPlugin, architecturePlugin };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createDtoSuffixFixer as e,createRemoveIPrefixFixer as t,hasIPrefix as n,hasIdWithName as r,hasIdWithNameAndRange as i,isCallExpressionNode as a,isDefaultImport as o,isImportDeclaration as s,isImportSpecifier as c,isInExcludedPath as ee,isObjectExpressionNode as l,isValidDtoNameCamelCase as te,isValidDtoNameUpperCase as ne}from"@longzai-intelligence/eslint-utils";import u,{dirname as re,join as d}from"node:path";import f,{existsSync as p,readFileSync as ie}from"node:fs";import{AST_NODE_TYPES as m}from"@typescript-eslint/utils";const h={types:0,utils:1,"shared-kernel":2,contract:3,engine:4,platform:5,infrastructure:6,implementation:6},ae=[{pattern:/\/domains\/[^/]+\/implementation\//,layer:`implementation`},{pattern:/\/domains\/[^/]+\/contract\//,layer:`contract`},{pattern:/\/domains\/shared-kernel\//,layer:`shared-kernel`},{pattern:/\/infrastructure\//,layer:`infrastructure`},{pattern:/\/packages\/utils\//,layer:`utils`},{pattern:/\/packages\/errors\//,layer:`utils`},{pattern:/\/packages\/zod-utils\//,layer:`utils`},{pattern:/\/packages\/testing-utils\//,layer:`utils`},{pattern:/\/packages\/engine\/[^/]+\//,layer:`engine`},{pattern:/\/packages\/design-system\/primitives\//,layer:`utils`},{pattern:/\/packages\/design-system\/composites\//,layer:`implementation`},{pattern:/\/packages\/design-system\/utils\//,layer:`utils`},{pattern:/\/packages\/electron\//,layer:`implementation`},{pattern:/\/packages\/typeorm-adapter\//,layer:`implementation`},{pattern:/\/packages\/typeorm-utils\//,layer:`utils`},{pattern:/\/packages\/http-client\//,layer:`utils`},{pattern:/\/packages\/pagination\//,layer:`utils`},{pattern:/\/packages\/turbo-output-parser\//,layer:`utils`},{pattern:/\/packages\/host-contracts\//,layer:`contract`},{pattern:/\/packages\/event-bus\/contract\//,layer:`contract`},{pattern:/\/packages\/event-bus\/implementation\//,layer:`implementation`},{pattern:/\/packages\/payment\/core\//,layer:`contract`},{pattern:/\/packages\/payment\/adapters\//,layer:`implementation`},{pattern:/\/packages\/payment\/presets\//,layer:`implementation`},{pattern:/\/packages\/logger\/core\//,layer:`contract`},{pattern:/\/packages\/logger\/adapters\//,layer:`implementation`},{pattern:/\/packages\/logger\/presets\//,layer:`implementation`},{pattern:/\/packages\/react-devtools\/core\//,layer:`contract`},{pattern:/\/packages\/react-devtools\/adapters\//,layer:`implementation`},{pattern:/\/packages\/react-devtools\/ui\//,layer:`implementation`},{pattern:/\/packages\/react-devtools\/presets\//,layer:`implementation`},{pattern:/\/packages\/feed-parser\/protocol\//,layer:`contract`},{pattern:/\/packages\/feed-parser\/[^/]+\//,layer:`implementation`}],oe=[{pattern:/\/src\/domain\//,layer:`contract`},{pattern:/\/src\/engine\//,layer:`engine`},{pattern:/\/src\/platform\//,layer:`platform`},{pattern:/\/src\/infrastructure\//,layer:`infrastructure`},{pattern:/\/src\/shared\//,layer:`shared-kernel`}],se=[{pattern:/\/src\/domain\//,layer:`contract`},{pattern:/\/src\/engine\//,layer:`engine`},{pattern:/\/src\/platform\//,layer:`platform`},{pattern:/\/src\/infrastructure\//,layer:`infrastructure`},{pattern:/\/src\/shared\//,layer:`shared-kernel`}],ce=new WeakMap;function le(e){let t=e.replace(/\\/g,`/`);for(let{pattern:e,layer:n}of ae)if(e.test(t))return{layer:n,priority:h[n]};return t.includes(`/apps/`)?de(t):t.includes(`/packages/`)?fe(t):null}function ue(e,t){let n=ce.get(t);if(n||(n=new Map,ce.set(t,n)),n.has(e))return n.get(e);let r=le(e);return n.set(e,r),r}function de(e){for(let{pattern:t,layer:n}of oe)if(t.test(e))return{layer:n,priority:h[n]};return null}function fe(e){for(let{pattern:t,layer:n}of se)if(t.test(e))return{layer:n,priority:h[n]};return null}const pe=[{suffix:`-contract`,layer:`contract`},{suffix:`-implementation`,layer:`implementation`},{suffix:`-engine`,layer:`engine`},{suffix:`-runtime`,layer:`engine`}],me={"@longzai-intelligence/shared-kernel":`shared-kernel`,"@longzai-intelligence/utils":`utils`,"@longzai-intelligence/error-utils":`utils`,"@longzai-intelligence/zod-utils":`utils`,"@longzai-intelligence/testing-utils":`utils`,"@longzai-intelligence/host-contracts":`contract`,"@longzai-intelligence/typeorm-adapter":`implementation`,"@longzai-intelligence/typeorm-utils":`utils`,"@longzai-intelligence/http-client":`utils`,"@longzai-intelligence/pagination":`utils`,"@longzai-intelligence/turbo-output-parser":`utils`,"@longzai-intelligence/electron":`implementation`},he=`@longzai-intelligence/`;function ge(e){if(!e.startsWith(he))return null;let t=e.split(`/`)[1];if(!t)return null;let n=me[`${he}${t}`];if(n)return{layer:n,priority:h[n]};for(let{suffix:e,layer:n}of pe)if(t.endsWith(e))return{layer:n,priority:h[n]};return null}const _e={types:`类型层 (Types)`,utils:`工具层 (Utils)`,"shared-kernel":`共享内核层 (Shared Kernel)`,contract:`契约层 (Contract)`,engine:`引擎层 (Engine)`,platform:`平台层 (Platform)`,infrastructure:`基础设施层 (Infrastructure)`,implementation:`实现层 (Implementation)`};function ve(e){return _e[e]}function ye(e,t){return h[e]>=h[t]}const be={meta:{type:`problem`,docs:{description:`强制执行 Clean Architecture 的依赖方向规则`},messages:{invalidDependency:`依赖方向违规: {{currentLayer}} ({{currentLayerName}}) 不能导入 {{importLayer}} ({{importLayerName}})。依赖应该从外层指向内层,请检查导入语句。`},schema:[]},create(e){let t=e.filename,n=ue(t,e);return n?{ImportDeclaration(t){let r=t.source.value;if(typeof r!=`string`)return;let i=ge(r);i&&(ye(n.layer,i.layer)||e.report({node:t,messageId:`invalidDependency`,data:{currentLayer:n.layer,currentLayerName:ve(n.layer),importLayer:i.layer,importLayerName:ve(i.layer)}}))}}:{}}},xe=new Set(`Agent.Page.PageContent.Workspace.WorkspaceMember.User.Session.Task.Repository.Folder.SyncMetadata.SyncError.SyncErrorCode.SyncResult.SyncStatus.SyncConflictData.EntityChange.OfflineOperation.DirtyEntity.PullResult.PushResult.ApiResponse.P2PNode.ConnectionState.NetworkStatus.IMAgent.IMContact.IMConversation.IMMessage.IMGroup.IMGroupSettings`.split(`.`));function Se(e){return e.replace(/\\/g,`/`).includes(`/apps/`)}function g(e){return xe.has(e)}const _={meta:{type:`problem`,docs:{description:`禁止在 apps 层定义核心领域类型`},messages:{noCoreTypesInApps:`禁止在 apps 层定义核心领域类型 "{{typeName}}"。请在 packages/types 或 packages/domain 中定义此类型。`},schema:[]},create(e){let t=e.filename;return Se(t)?{TSInterfaceDeclaration(t){if(!r(t))return;let n=t.id.name;g(n)&&e.report({node:t,messageId:`noCoreTypesInApps`,data:{typeName:n}})},TSTypeAliasDeclaration(t){if(!r(t))return;let n=t.id.name;g(n)&&e.report({node:t,messageId:`noCoreTypesInApps`,data:{typeName:n}})},ClassDeclaration(t){if(!r(t))return;let n=t.id.name;g(n)&&e.report({node:t,messageId:`noCoreTypesInApps`,data:{typeName:n}})}}:{}}},v={node:[`fs`,`path`,`os`,`crypto`,`child_process`,`cluster`,`dgram`,`dns`,`http`,`https`,`net`,`readline`,`stream`,`tls`,`tty`,`udp`,`url`,`util`,`v8`,`vm`,`worker_threads`,`zlib`],browser:[`window`,`document`,`navigator`,`localStorage`,`sessionStorage`,`fetch`,`XMLHttpRequest`,`WebSocket`,`Worker`,`IndexedDB`,`Blob`,`File`,`FileReader`,`URL`,`URLSearchParams`,`History`,`Location`,`Screen`,`AudioContext`,`Canvas`,`Notification`,`Performance`,`ServiceWorker`],electron:[`ipcRenderer`,`ipcMain`,`app`,`BrowserWindow`,`dialog`,`Menu`,`Tray`,`nativeImage`,`shell`,`clipboard`]},Ce=new Set(v.node),we=new Set(v.browser),Te=new Set(v.electron),Ee=[/\/domains\/shared-kernel\//,/\/domains\/page-domain\//,/\/domains\/repository-domain\//,/\/domains\/agent-domain\//,/\/domains\/collab-domain\//,/\/domains\/identity-domain\//,/\/domains\/workflow-domain\//,/\/domains\/chat-domain\//,/\/domains\/workspace-domain\//];function De(e){let t=e.replace(/\\/g,`/`);return Ee.some(e=>e.test(t))}function Oe(e){if(e.startsWith(`node:`)||Ce.has(e))return`node`;for(let t of v.node)if(e.startsWith(`${t}/`))return`node`;return null}function y(e){return we.has(e)}function b(e){return Te.has(e)}function ke(e){return typeof e==`object`&&!!e&&`object`in e&&e.object!==null&&typeof e.object==`object`&&`type`in e.object&&`name`in e.object}function Ae(e){return typeof e==`object`&&!!e&&`name`in e&&typeof e.name==`string`}function je(e,t){if(!s(e))return;let n=e.source.value;if(typeof n==`string`&&Oe(n)){let r=n.replace(/^node:/,``);t.report({node:e,messageId:`nodeImport`,data:{moduleName:r}})}}function Me(e,t){if(ke(e)&&e.object.type===`Identifier`){let n=e.object.name;y(n)&&t.report({node:e,messageId:`browserAPI`,data:{apiName:n}}),b(n)&&t.report({node:e,messageId:`electronAPI`,data:{apiName:n}})}}function Ne(e,t){if(!Ae(e))return;let n=e.name;(y(n)||b(n))&&e.parent&&e.parent.type!==`MemberExpression`&&t.report({node:e,messageId:`globalAPI`,data:{globalName:n}})}const x={meta:{type:`problem`,docs:{description:`禁止在业务域层直接使用平台特定 API`},messages:{nodeImport:`平台代码泄漏: 业务域层禁止直接导入 Node.js 模块 '{{moduleName}}'。请通过 packages/platform 层的接口间接访问。`,browserAPI:`平台代码泄漏: 业务域层禁止直接使用浏览器 API '{{apiName}}'。请通过 packages/platform 层的接口间接访问。`,electronAPI:`平台代码泄漏: 业务域层禁止直接使用 Electron API '{{apiName}}'。请通过 packages/platform 层的接口间接访问。`,globalAPI:`平台代码泄漏: 业务域层禁止直接访问全局对象 '{{globalName}}'。请通过 packages/platform 层的接口间接访问。`},schema:[]},create(e){let t=e.filename;return De(t)?{ImportDeclaration(t){je(t,e)},MemberExpression(t){Me(t,e)},Identifier(t){Ne(t,e)}}:{}}},Pe=[/\/packages\/platform\//,/\/packages\/ui\//,/\/packages\/ui-kit\//,/\/packages\/engine\//,/\/packages\/utils\//,/\/packages\/types\//],Fe=[`Page`,`Repository`,`Agent`,`Workflow`,`Workspace`,`User`,`Auth`,`Session`,`Message`,`Conversation`,`Sync`,`Favorite`,`Folder`,`Team`,`Execution`,`Task`,`Step`,`Trigger`],Ie=[/^validate/,/^calculate/,/^compute/,/^determine/,/^check/,/^can/,/^should/,/^isAllowed/,/^isPermitted/,/^hasPermission/,/^applyRule/,/^enforce/,/^execute/];function Le(e){let t=e.replace(/\\/g,`/`);return Pe.some(e=>e.test(t))}function S(e){let t=e.charAt(0).toUpperCase()+e.slice(1);return Fe.some(e=>t.includes(e))}function Re(e){return Ie.some(t=>t.test(e))}function ze(e){return typeof e==`object`&&!!e&&`key`in e&&e.key!==null&&typeof e.key==`object`&&`type`in e.key&&e.key.type===`Identifier`&&`name`in e.key&&typeof e.key.name==`string`}function Be(e){return typeof e==`object`&&!!e&&`id`in e&&e.id!==null&&typeof e.id==`object`&&`type`in e.id&&e.id.type===`Identifier`&&`name`in e.id&&typeof e.id.name==`string`&&`type`in e&&typeof e.type==`string`}function Ve(e,t){r(e)&&S(e.id.name)&&t.report({node:e,messageId:`businessClass`,data:{className:e.id.name}})}function He(e,t){ze(e)&&Re(e.key.name)&&t.report({node:e,messageId:`businessMethod`,data:{methodName:e.key.name}})}function Ue(e,t){r(e)&&S(e.id.name)&&t.report({node:e,messageId:`businessInterface`,data:{interfaceName:e.id.name}})}function We(e,t){Be(e)&&S(e.id.name)&&t.report({node:e,messageId:`businessType`,data:{typeName:e.id.name}})}const C={meta:{type:`suggestion`,docs:{description:`检测技术层中可能存在的业务逻辑`},messages:{businessClass:`业务逻辑泄漏嫌疑: 技术层发现业务相关类 '{{className}}'。业务逻辑应该放在 domains/ 层。`,businessMethod:`业务逻辑泄漏嫌疑: 技术层发现业务规则方法 '{{methodName}}'。业务规则应该放在 domains/ 层。`,businessInterface:`业务逻辑泄漏嫌疑: 技术层发现业务相关接口 '{{interfaceName}}'。业务接口应该放在 domains/ 层。`,businessType:`业务逻辑泄漏嫌疑: 技术层发现业务相关类型 '{{typeName}}'。业务类型应该放在 domains/ 层。`},schema:[]},create(e){let t=e.filename;return Le(t)?{ClassDeclaration(t){Ve(t,e)},MethodDefinition(t){He(t,e)},TSInterfaceDeclaration(t){Ue(t,e)},TSTypeAliasDeclaration(t){We(t,e)}}:{}}};function Ge(e){return e.startsWith(`create`)||e.startsWith(`make`)||e.startsWith(`build`)}function w(e){return/domains\/[^/]+\/(implementation|contract)\/src\/index\.ts$/.test(e)?`main`:/domains\/[^/]+\/(implementation|contract)\/src\/(domain|application|infrastructure)\/index\.ts$/.test(e)?`layer`:/domains\/[^/]+\/(implementation|contract)\/src\/(domain|application|infrastructure)\/\w+\/index\.ts$/.test(e)?`submodule`:`none`}function Ke(e){return e.includes(`/infrastructure/`)}const qe=[],Je=[{pattern:/^(?!create)[A-Za-z]+Repository(Drizzle|Memory|Sqlite|Mysql)$/,messageId:`forbiddenRepositoryExport`,message:`禁止导出具体仓储实现类`},{pattern:/^(?!create)[A-Za-z]*Table$/,messageId:`forbiddenTableExport`,message:`禁止导出数据库表定义`},{pattern:/[A-Za-z]+OrmEntity$/,messageId:`forbiddenOrmEntityExportFromMain`,message:`禁止从主入口导出 ORM 实体,应从 ./typeorm 入口导出`},{pattern:/[A-Z_]+_ORM_ENTITIES$/,messageId:`forbiddenEntitiesExportFromMain`,message:`禁止从主入口导出实体集合,应从 ./typeorm 入口导出`},{pattern:/[A-Za-z]+OrmMapper$/,messageId:`forbiddenOrmMapperExportFromMain`,message:`禁止从主入口导出 ORM Mapper,这是基础设施层实现细节`}],Ye=/^(?!create)[A-Za-z]*Schema$/,T=new WeakMap;function Xe(e,t,n){if(!n)return E(e,t);let r=T.get(n);if(r||(r=new Map,T.set(n,r)),r.has(t))return r.get(t);let i=E(e,t);return r.set(t,i),i}function E(e,t){let n=[],r=/export\s*\*\s*from/.test(e),i=e.matchAll(/export\s+type\s+\{([^}]+)\}/g);for(let e of i){let t=e[1];if(t){let e=t.split(`,`).map(e=>{let t=e.trim().split(` as `);return t[0]?t[0].trim():``}).filter(e=>e);n.push(...e)}}let a=e.matchAll(/export\s+(?!type)\{([^}]+)\}/g);for(let e of a){let t=e[1];if(t){let e=t.split(`,`).map(e=>{let t=e.trim().split(` as `);return t[0]?t[0].trim():``}).filter(e=>e);n.push(...e)}}let o=e.matchAll(/export\s+(class|function|const|let|interface|type)\s+(\w+)/g);for(let e of o){let t=e[2];t&&n.push(t)}let s=[],c=Ke(t);if(w(t)===`submodule`)return{usesExportStar:r,exports:n,forbiddenIssues:s};for(let e of n)if(!Ge(e)){for(let{pattern:t,messageId:n}of qe)t.test(e)&&s.push({messageId:n,exportName:e});for(let{pattern:t,messageId:n}of Je)t.test(e)&&s.push({messageId:n,exportName:e});c&&Ye.test(e)&&s.push({messageId:`forbiddenSchemaExport`,exportName:e})}return{usesExportStar:r,exports:n,forbiddenIssues:s}}const D={meta:{type:`problem`,docs:{description:`Domain 包导出规范:禁止 export *、禁止导出具体实现类、禁止导出数据库表和 Schema`,recommended:!0},schema:[],messages:{forbiddenExportStar:`禁止使用 export *,应使用显式导出(export { ... } 或 export type { ... })`,forbiddenRepositoryExport:`禁止导出具体仓储实现类 {{exportName}},应使用工厂函数 createXxxRepository`,forbiddenTableExport:`禁止导出数据库表定义 {{exportName}}`,forbiddenSchemaExport:`禁止导出 Schema 定义 {{exportName}}`,forbiddenOrmEntityExportFromMain:`禁止从主入口导出 ORM 实体 {{exportName}},应从 ./typeorm 入口导出`,forbiddenEntitiesExportFromMain:`禁止从主入口导出实体集合 {{exportName}},应从 ./typeorm 入口导出`,forbiddenOrmMapperExportFromMain:`禁止从主入口导出 ORM Mapper {{exportName}},这是基础设施层实现细节`}},create(e){let t=e.filename;if(w(t)===`none`)return{};let n=e.sourceCode.text,{usesExportStar:r,forbiddenIssues:i}=Xe(n,t,e);return{Program(t){r&&e.report({node:t,messageId:`forbiddenExportStar`});for(let n of i)e.report({node:t,messageId:n.messageId,data:{exportName:n.exportName}})}}}},Ze=/@longzai-intelligence\/[^/]+\/typeorm/,Qe=/@longzai-intelligence\/[^/]+\/infrastructure\//,$e=[/data-source\.ts$/,/data-source\.config\.ts$/,/data-source\.[a-z-]+\.ts$/,/database\.module\.ts$/,/database\.ts$/,/database\.config\.ts$/,/database\.service\.ts$/];function et(e){return $e.some(t=>t.test(e))}const O={meta:{type:`problem`,docs:{description:`Domain TypeORM 导入规范:非 DataSource 场景禁止导入 /typeorm 入口,禁止 infrastructure/* deep import`,recommended:!0},schema:[],messages:{forbiddenTypeormImport:`非 DataSource 场景禁止从 /typeorm 入口导入 ORM 实体,该入口仅供 DataSource/迁移基础设施使用`,forbiddenInfrastructureImport:`禁止 infrastructure/* deep import,应使用受控入口(主入口或 ./typeorm)`}},create(e){let t=e.filename,n=et(t);return{ImportDeclaration(t){if(!t.source)return;let r=t.source.value;typeof r==`string`&&(Ze.test(r)&&(n||e.report({node:t,messageId:`forbiddenTypeormImport`})),Qe.test(r)&&e.report({node:t,messageId:`forbiddenInfrastructureImport`}))}}}};function k(e){if(typeof e!=`object`||!e)return!1;let t=e;return`name`in t&&typeof t.name==`string`&&`isSpecialFile`in t&&typeof t.isSpecialFile==`function`&&`getNamingRules`in t&&typeof t.getNamingRules==`function`&&`shouldSkipTypeSuffix`in t&&typeof t.shouldSkipTypeSuffix==`function`}const A=[{pattern:/\.service\.drizzle\.ts$/,case:`kebab-case`,description:`Drizzle Service 文件应使用 xxx.service.drizzle.ts 格式(kebab-case)`},{pattern:/\.service\.memory\.ts$/,case:`kebab-case`,description:`Memory Service 文件应使用 xxx.service.memory.ts 格式(kebab-case)`},{pattern:/\.service\.ts$/,case:`kebab-case`,description:`服务文件应使用 xxx.service.ts 格式(kebab-case)`},{pattern:/\.controller\.ts$/,case:`kebab-case`,description:`控制器文件应使用 xxx.controller.ts 格式(kebab-case)`},{pattern:/\.module\.ts$/,case:`kebab-case`,description:`模块文件应使用 xxx.module.ts 格式(kebab-case)`},{pattern:/\.repository\.drizzle\.ts$/,case:`kebab-case`,description:`Drizzle Repository 文件应使用 xxx.repository.drizzle.ts 格式(kebab-case)`},{pattern:/\.repository\.memory\.ts$/,case:`kebab-case`,description:`Memory Repository 文件应使用 xxx.repository.memory.ts 格式(kebab-case)`},{pattern:/\.repository\.interface\.ts$/,case:`kebab-case`,description:`Repository 接口文件应使用 xxx.repository.interface.ts 格式(kebab-case)`},{pattern:/\.repository\.types\.ts$/,case:`kebab-case`,description:`Repository 类型文件应使用 xxx.repository.types.ts 格式(kebab-case)`},{pattern:/\.repository\.ts$/,case:`kebab-case`,description:`Repository 文件应使用 xxx.repository.ts 格式(kebab-case)`},{pattern:/\.entity\.types\.ts$/,case:`kebab-case`,description:`Entity 类型文件应使用 xxx.entity.types.ts 格式(kebab-case)`},{pattern:/\.entity\.interface\.ts$/,case:`kebab-case`,description:`Entity 接口文件应使用 xxx.entity.interface.ts 格式(kebab-case)`},{pattern:/\.entity\.ts$/,case:`kebab-case`,description:`Entity 文件应使用 xxx.entity.ts 格式(kebab-case)`},{pattern:/\.dto\.ts$/,case:`kebab-case`,description:`DTO 文件应使用 xxx.dto.ts 格式(kebab-case)`},{pattern:/\.port\.interface\.ts$/,case:`kebab-case`,description:`Port 接口文件应使用 xxx.port.interface.ts 格式(kebab-case)`},{pattern:/\.interface\.ts$/,case:`kebab-case`,description:`接口文件应使用 xxx.interface.ts 格式(kebab-case)`},{pattern:/\.types\.ts$/,case:`kebab-case`,description:`类型文件应使用 xxx.types.ts 格式(kebab-case)`},{pattern:/\.schema\.ts$/,case:`kebab-case`,description:`Schema 文件应使用 xxx.schema.ts 格式(kebab-case)`},{pattern:/\.port\.ts$/,case:`kebab-case`,description:`Port 文件应使用 xxx.port.ts 格式(kebab-case)`},{pattern:/\.port\.adapter\.ts$/,case:`kebab-case`,description:`Port Adapter 文件应使用 xxx.port.adapter.ts 格式(kebab-case)`},{pattern:/\.adapter\.ts$/,case:`kebab-case`,description:`Adapter 文件应使用 xxx.adapter.ts 格式(kebab-case)`},{pattern:/\.events\.ts$/,case:`kebab-case`,description:`Events 文件应使用 xxx.events.ts 格式(kebab-case)`},{pattern:/\.mapper\.ts$/,case:`kebab-case`,description:`Mapper 文件应使用 xxx.mapper.ts 格式(kebab-case)`},{pattern:/\.ipc\.ts$/,case:`kebab-case`,description:`IPC 文件应使用 xxx.ipc.ts 格式(kebab-case)`},{pattern:/\.config\.ts$/,case:`kebab-case`,description:`配置文件应使用 xxx.config.ts 格式(kebab-case)`},{pattern:/\.errors\.ts$/,case:`kebab-case`,description:`错误文件应使用 xxx.errors.ts 格式(kebab-case)`},{pattern:/\.utils\.ts$/,case:`kebab-case`,description:`工具函数文件应使用 xxx.utils.ts 格式(kebab-case)`},{pattern:/\.constants\.ts$/,case:`kebab-case`,description:`常量文件应使用 xxx.constants.ts 格式(kebab-case)`},{pattern:/\.atom\.ts$/,case:`kebab-case`,description:`Atom 文件应使用 xxx.atom.ts 格式(kebab-case)`},{pattern:/\.vo\.ts$/,case:`kebab-case`,description:`值对象文件应使用 xxx.vo.ts 格式(kebab-case)`},{pattern:/\.usecase\.ts$/,case:`kebab-case`,description:`UseCase 文件应使用 xxx.usecase.ts 格式(kebab-case)`},{pattern:/\.styles\.css$/,case:`kebab-case`,description:`样式文件应使用 xxx.styles.css 格式(kebab-case)`},{pattern:/\.extension\.tsx?$/,case:`kebab-case`,description:`扩展文件应使用 xxx.extension.ts(x) 格式(kebab-case)`}],j=[{pattern:/^use[A-Z][a-zA-Z]*\.spec\.tsx?$/,case:`camelCase`,description:`Hook 测试文件应使用 camelCase 并以 use 前缀开头(如 useChat.spec.ts)`},{pattern:/^use[A-Z][a-zA-Z]*\.test\.tsx?$/,case:`camelCase`,description:`Hook 测试文件应使用 camelCase 并以 use 前缀开头(如 useChat.test.ts)`},{pattern:/^use[A-Z][a-zA-Z]*\.types\.ts$/,case:`camelCase`,description:`Hook 类型文件应使用 camelCase 并以 use 前缀开头(如 useChat.types.ts)`},{pattern:/\.spec\.ts$/,case:`kebab-case-test`,description:`测试文件应使用 xxx.spec.ts 格式(kebab-case)`},{pattern:/\.test\.ts$/,case:`kebab-case-test`,description:`测试文件应使用 xxx.test.ts 格式(kebab-case)`},{pattern:/\.spec\.tsx$/,case:`kebab-case-test`,description:`测试文件应使用 xxx.spec.tsx 格式(kebab-case)`},{pattern:/\.test\.tsx$/,case:`kebab-case-test`,description:`测试文件应使用 xxx.test.tsx 格式(kebab-case)`},{pattern:/^use[A-Z][a-zA-Z]*\.tsx?$/,case:`camelCase`,description:`Hook 文件应使用 camelCase 并以 use 前缀开头(如 useChat.ts)`}],M={pattern:/^[A-Z][a-zA-Z]*\.tsx$/,case:`PascalCase`,description:`React 组件文件应使用 PascalCase(如 ChatPage.tsx)`};[...j,...A];const N=[`index.ts`,`index.tsx`,`main.ts`,`main.tsx`,`App.tsx`,`types.ts`,`errors.ts`,`constants.ts`,`persistence.ts`,`typeorm.ts`],P=[`impl`,`functions`,`methods`,`handlers`,`classes`];function tt(e){let t=e.replace(/\.tsx?$/,``);return[/s$/,/es$/,/ies$/].some(e=>e.test(t))}function F(e){return/^v\d+(-[a-z0-9-]+)?\.ts$/.test(e)}function nt(e){let t=e.replace(/\.tsx?$/,``);for(let e of P){if(t.endsWith(`.${e}`))return e;let n=t.split(`.`);if(n.length>=2&&n[n.length-1]===e)return e}return null}function rt(e){if(!e.endsWith(`.tsx`))return!1;let t=e.replace(`.tsx`,``);return/^[A-Z][a-zA-Z0-9]*$/.test(t)}function it(e){if(!e.endsWith(`.ts`)&&!e.endsWith(`.tsx`))return!1;let t=e.replace(/\.tsx?$/,``);return/^use[A-Z][a-zA-Z0-9]*$/.test(t)}function at(e){for(let t of[`.test.ts`,`.test.tsx`,`.spec.ts`,`.spec.tsx`])if(e.endsWith(t)){let n=t.endsWith(`.tsx`)?`.tsx`:`.ts`;return e.replace(t,n)}return e}const I={name:`base`,isSpecialFile(e){return!!(N.includes(e)||e.endsWith(`.d.ts`)||F(e))},getNamingRules(){return[...j,...A,M]},shouldSkipTypeSuffix(e){let t=at(e);return!!(N.includes(t)||t.endsWith(`.d.ts`)||F(t)||rt(t)||it(t)||!nt(t)&&tt(t))}},ot=[`page.tsx`,`page.ts`,`layout.tsx`,`layout.ts`,`loading.tsx`,`loading.ts`,`error.tsx`,`error.ts`,`not-found.tsx`,`not-found.ts`,`template.tsx`,`template.ts`,`default.tsx`,`default.ts`,`global-error.tsx`,`global-error.ts`,`middleware.ts`,`route.ts`],st={name:`nextjs`,isSpecialFile(e){return ot.includes(e)},getNamingRules(){return[]},shouldSkipTypeSuffix(e){return ot.includes(e)}},ct=[/^\[.+\]\.tsx?$/,/^_layout\.tsx?$/,/^\(.+\)\.tsx?$/],lt=[`_layout.tsx`,`_layout.ts`,`_sitemap.tsx`,`_sitemap.ts`],ut={name:`expo-router`,isSpecialFile(e){return lt.includes(e)?!0:ct.some(t=>t.test(e))},getNamingRules(){return[]},shouldSkipTypeSuffix(e){return this.isSpecialFile(e)}},dt=new Map;function L(e){dt.set(e.name,e)}L(I),L(st),L(ut);function R(e){return/^[A-Z][a-zA-Z0-9]*$/.test(e)}function ft(e){return/^[a-z][a-zA-Z0-9]*$/.test(e)}function z(e){return/^[a-z][a-z0-9]*(-[a-z0-9]+)*$/.test(e)}function pt(e){return e.split(`.`).every(e=>z(e)&&e.length>0)}function mt(e){return e.split(`.`).every(e=>z(e)&&e.length>0)}function ht(e,t){if(e.endsWith(`.types`)&&t===`kebab-case`)return pt(e);switch(t){case`PascalCase`:return R(e);case`camelCase`:return ft(e);case`kebab-case`:return z(e);case`kebab-case-test`:return mt(e);default:return!1}}const gt=new WeakMap;function B(e,t){if(!t)try{return f.existsSync(e)}catch{return!1}let n=gt.get(t);if(n||(n=new Map,gt.set(t,n)),n.has(e))return n.get(e);let r;try{r=f.existsSync(e)}catch{r=!1}return n.set(e,r),r}function _t(e,t,n,r){let i=t.substring(6),a=u.dirname(i);return B(u.join(e,`pages`,a===`.`?``:a,n),r)}function vt(e,t,n,r){let i=t.substring(11),a=u.dirname(i);return B(u.join(e,`components`,a===`.`?``:a,n),r)}function yt(e,t,n,r){let i=t.substring(14),a=u.dirname(i);return B(u.join(e,`ui`,`components`,a===`.`?``:a,n),r)}function bt(e,t,n,r){let i=t.substring(6),a=u.dirname(i);return B(u.join(e,`react`,a===`.`?``:a,n),r)}function xt(e,t,n){let r=e.indexOf(`/__tests__/`),i=e.substring(0,r),a=e.substring(r+11);return a.startsWith(`pages/`)?_t(i,a,t,n):a.startsWith(`components/`)?vt(i,a,t,n):a.startsWith(`ui/components/`)?yt(i,a,t,n):a.startsWith(`react/`)?bt(i,a,t,n):B(u.join(i,t),n)}function St(e,t,n){let r=e.replace(/\\/g,`/`),i=r.includes(`/__tests__/`),a=r.includes(`/components/`);if(!a&&!i||!(t.endsWith(`.test.tsx`)||t.endsWith(`.spec.tsx`)||t.endsWith(`.test.ts`)||t.endsWith(`.spec.ts`)))return!1;let o=t.replace(/\.(test|spec)\.(tsx|ts)$/,`.tsx`);return i?xt(r,o,n):a?B(u.join(u.dirname(e),o),n):!1}const Ct=new WeakMap;function wt(e,t){if(!t)try{return f.existsSync(e)}catch{return!1}let n=Ct.get(t);if(n||(n=new Map,Ct.set(t,n)),n.has(e))return n.get(e);let r;try{r=f.existsSync(e)}catch{r=!1}return n.set(e,r),r}function Tt(e,t,n){if(!e.replace(/\\/g,`/`).includes(`/components/`)||!t.endsWith(`.types.ts`))return!1;let r=t.replace(`.types.ts`,`.tsx`);return wt(u.join(u.dirname(e),r),n)}function Et(e,t){if(t===M)return e.replace(/\.tsx$/,``);let n=t.pattern.source;return n.startsWith(`^`)&&n.endsWith(`$`)?n.includes(`\\.test\\.`)||n.includes(`\\.spec\\.`)?e.replace(/\.(test|spec)\.(tsx?|jsx?)$/,``):n.includes(`\\.types\\.`)?e.replace(/\.types\.ts$/,``):e.replace(/\.[^.]+$/,``):e.replace(t.pattern,``)}const Dt={meta:{type:`problem`,docs:{description:`强制执行文件命名规范`},messages:{invalidFileName:`文件命名违规: {{fileName}}。{{description}}`},schema:[]},create(e){let t=e.filename,n=u.basename(t),r=k(e.settings?.platformNamingStrategy)?e.settings.platformNamingStrategy:I;if(r.isSpecialFile(n,t)||Tt(t,n,e)&&R(n.replace(`.types.ts`,``))||St(t,n,e)&&R(n.replace(/\.(test|spec)\.(tsx|ts)$/,``)))return{};let i=r.getNamingRules().find(e=>e.pattern.test(n));if(!i&&n.endsWith(`.tsx`)&&(i=M),!i)return{};let a=Et(n,i);return ht(n.endsWith(`.types.ts`)&&i.case===`kebab-case`?n.replace(/\.ts$/,``):a,i.case)||e.report({loc:{start:{line:1,column:0},end:{line:1,column:n.length}},messageId:`invalidFileName`,data:{fileName:n,description:i.description}}),{}}};function Ot(e){return e.endsWith(`.types.ts`)?!0:/^[a-z][a-z0-9-]*\.[a-z][a-z0-9-]*\.tsx?$/.test(e)||/^[a-z][a-z0-9-]*\.[a-z][a-z0-9-]*\.[a-z][a-z0-9-]*\.tsx?$/.test(e)}function kt(e){let t=e.replace(/\.tsx?$/,``);for(let e of P){if(t.endsWith(`.${e}`))return e;let n=t.split(`.`);if(n.length>=2&&n[n.length-1]===e)return e}return null}function At(e){let t=[],n=e.replace(/\.tsx?$/,``);return(n.includes(`service`)||n.includes(`Service`))&&t.push(`.service.ts`),(n.includes(`controller`)||n.includes(`Controller`))&&t.push(`.controller.ts`),(n.includes(`utils`)||n.includes(`helper`)||n.includes(`Helper`))&&t.push(`.utils.ts`),(n.includes(`constant`)||n.includes(`Constant`))&&t.push(`.constants.ts`),(n.includes(`config`)||n.includes(`Config`))&&t.push(`.config.ts`),(n.includes(`atom`)||n.includes(`state`)||n.includes(`State`))&&t.push(`.atom.ts`),t.length===0&&t.push(`.utils.ts`,`.config.ts`,`.constants.ts`),t}function jt(e){for(let t of[`.test.ts`,`.test.tsx`,`.spec.ts`,`.spec.tsx`])if(e.endsWith(t)){let n=t.endsWith(`.tsx`)?`.tsx`:`.ts`;return e.replace(t,n)}return e}const Mt={meta:{type:`problem`,docs:{description:`强制执行文件类型后缀规范,确保文件名明确表达其用途`},messages:{missingTypeSuffix:`文件 "{{fileName}}" 缺少类型后缀。除特殊文件外,所有文件应使用 xxx.yyy.ts 格式明确表达用途。建议: {{suggestions}}`,forbiddenSuffix:`文件 "{{fileName}}" 使用了禁止的后缀 ".{{suffix}}"。该后缀语义过于泛化,无法表达文件用途。请使用更具体的后缀,如 ".utils"、".helpers"、".service" 等。`},schema:[]},create(e){let t=e.filename,n=u.basename(t);if((k(e.settings?.platformNamingStrategy)?e.settings.platformNamingStrategy:I).shouldSkipTypeSuffix(n))return{};let r=jt(n),i=kt(r);if(i)return e.report({loc:{start:{line:1,column:0},end:{line:1,column:n.length}},messageId:`forbiddenSuffix`,data:{fileName:n,suffix:i}}),{};if(Ot(r))return{};let a=At(r);return e.report({loc:{start:{line:1,column:0},end:{line:1,column:n.length}},messageId:`missingTypeSuffix`,data:{fileName:n,suggestions:a.join(`, `)}}),{}}},Nt=[/\/src\/renderer\//];function Pt(e){let t=e.replace(/\\/g,`/`);return Nt.some(e=>e.test(t))}function Ft(e){if(!e.startsWith(`@longzai-intelligence/`))return!1;let t=e.split(`/`);if(t.length<2)return!1;let n=t[1];return n?n.endsWith(`-implementation`):!1}const It={meta:{type:`problem`,docs:{description:`禁止在 Electron renderer 进程中导入 Implementation 包`},messages:{implementationInRenderer:`禁止在 renderer 进程中导入 Implementation 包 "{{packageName}}"。Implementation 包包含 Node.js 特定代码,请在 main 进程中使用,或使用 Contract 包代替。`},schema:[]},create(e){let t=e.filename;return Pt(t)?{ImportDeclaration(t){let n=t.source.value;typeof n==`string`&&Ft(n)&&e.report({node:t,messageId:`implementationInRenderer`,data:{packageName:n}})}}:{}}};function Lt(e){return typeof e==`object`&&!!e&&`alias`in e&&typeof e.alias==`string`&&`pathPattern`in e&&typeof e.pathPattern==`string`}function Rt(e){return Array.isArray(e)&&e.every(Lt)}const zt=[{alias:`@main`,pathPattern:`src/main`},{alias:`@preload`,pathPattern:`src/preload`},{alias:`@renderer`,pathPattern:`src/renderer/src`},{alias:`@shared`,pathPattern:`src/shared`}];function Bt(e,t){let n=e.replace(/\\/g,`/`);for(let e of t){let t=e.pathPattern.replace(/\\/g,`/`);if(n.includes(`/${t}/`)||n.endsWith(`/${t}`)||n.includes(`/${t}\\`))return e.alias}return null}function Vt(e,t,n){if(!t.startsWith(`.`))return null;let r=e.replace(/\\/g,`/`),i=r.lastIndexOf(`/`),a=i>0?r.substring(0,i):``;return Bt(u.resolve(a,t).replace(/\\/g,`/`),n)}function Ht(e){return e.startsWith(`./`)||e.startsWith(`../`)}const Ut={meta:{type:`problem`,docs:{description:`禁止使用相对路径穿越不同包范围,强制使用别名导入`},messages:{noCrossPackageRelativeImport:`禁止使用相对路径跨包导入。当前文件位于 "{{currentPackage}}" 包,目标位于 "{{targetPackage}}" 包。请使用别名导入:{{targetPackage}}/...`},schema:[{type:`object`,properties:{packageBoundaries:{type:`array`,items:{type:`object`,properties:{alias:{type:`string`},pathPattern:{type:`string`}},required:[`alias`,`pathPattern`]}}},additionalProperties:!1}]},create(e){let t=e.filename,n=e.options[0],r=n&&typeof n==`object`?n:{},i=`packageBoundaries`in r&&Array.isArray(r.packageBoundaries)?r.packageBoundaries:zt,a=Rt(i)?i:zt,o=Bt(t,a);return o?{ImportDeclaration(n){let r=n.source.value;if(typeof r!=`string`||!Ht(r))return;let i=Vt(t,r,a);i&&o!==i&&e.report({node:n,messageId:`noCrossPackageRelativeImport`,data:{currentPackage:o,targetPackage:i}})}}:{}}},Wt=[/\.test\.ts$/,/\.test\.tsx$/,/\.spec\.ts$/,/\.spec\.tsx$/],Gt=[`/node_modules/`,`/dist/`,`/out/`,`/.bun/`],Kt=[{segment:`/templates/`,type:`templates`},{segment:`/domains/`,type:`domains`},{segment:`/packages/`,type:`packages`},{segment:`/infrastructure/`,type:`infrastructure`}],qt=[{segment:`/src/main/`,process:`main`},{segment:`/src/renderer/`,process:`renderer`},{segment:`/src/preload/`,process:`preload`},{segment:`/src/shared/`,process:`shared`}];function V(e){return e.replace(/\\/g,`/`)}function Jt(e){return Wt.some(t=>t.test(e))}function Yt(e){let t=V(e);return Gt.some(e=>t.includes(e))}function Xt(e){return e.isElectron&&e.electronProcess?`src/${e.electronProcess}/__tests__`:`src/__tests__`}function Zt(e,t){let n=V(e);return t.srcRoot?n.startsWith(`${t.srcRoot}/__tests__/`):!0}function Qt(e,t){let n=V(e),r=u.basename(e);if(!t.srcRoot)return`src/__tests__/${r}`;let i=n.indexOf(`/src/`);if(i===-1)return`${t.srcRoot}/__tests__/${r}`;let a=n.slice(i+5).split(`/`);if(a.length>1&&a.pop(),t.isElectron&&t.electronProcess){let e=a.indexOf(t.electronProcess);e!==-1&&a.splice(e,1)}let o=a.indexOf(`__tests__`);o!==-1&&a.splice(o,1);let s=a.join(`/`),c=Xt(t);return s?`${c}/${s}/${r}`:`${c}/${r}`}function $t(e,t){let n=e.indexOf(t),r=e.slice(n+t.length).split(`/`),i=r.findIndex(e=>e===`src`);if(i!==-1)return e.slice(0,n+t.length)+r.slice(0,i+1).join(`/`);let a=t===`/domains/`&&r.length>=2?`${r[0]}/${r[1]}`:r[0];return a?e.slice(0,n+t.length+a.length)+`/src`:e.slice(0,n+t.length)+`src`}function en(e){for(let t of qt)if(e.includes(t.segment))return{electronProcess:t.process,srcRoot:e.slice(0,e.indexOf(t.segment))+t.segment.slice(0,-1)};return{srcRoot:``}}function tn(e){return e.includes(`-desktop`)||e===`desktop`}function nn(e){let t=V(e);for(let e of Kt)if(t.includes(e.segment))return{type:e.type,isElectron:!1,srcRoot:$t(t,e.segment)};if(t.includes(`/database/`)){let e=t.indexOf(`/database/`);return{type:`database`,isElectron:!1,srcRoot:t.slice(0,e+10)+`src`}}if(!t.includes(`/apps/`))return{type:`unknown`,isElectron:!1,srcRoot:``};let n=t.indexOf(`/apps/`),r=t.slice(n+6).split(`/`)[0];if(!r)return{type:`unknown`,isElectron:!1,srcRoot:``};let i=t.slice(0,n+6+r.length)+`/src`;if(!tn(r))return{type:`apps`,isElectron:!1,srcRoot:i};let a=en(t);return{type:`apps`,isElectron:!0,electronProcess:a.electronProcess,srcRoot:a.srcRoot||i}}const rn={meta:{type:`problem`,docs:{description:`强制测试文件放置在 src/__tests__ 目录下`},messages:{invalidTestFileLocation:`测试文件 "{{fileName}}" 必须放置在 {{expectedDir}} 目录下。当前路径: "{{currentPath}}"。建议路径: "{{suggestedPath}}"`},schema:[]},create(e){let t=e.filename,n=u.basename(t);if(!Jt(n)||Yt(t)||n.endsWith(`.d.ts`))return{};let r=nn(t);if(r.type===`unknown`||Zt(t,r))return{};let i=Xt(r),a=Qt(t,r);return e.report({loc:{start:{line:1,column:0},end:{line:1,column:n.length}},messageId:`invalidTestFileLocation`,data:{fileName:n,expectedDir:i,currentPath:t,suggestedPath:a}}),{}}},an=[`**/vitest.setup.ts`,`**/jest.setup.ts`,`**/fixtures/**`,`**/helpers/**`,`**/mocks/**`,`**/__mocks__/**`,`**/*.d.ts`],on=[/\.test\.ts$/,/\.test\.tsx$/,/\.spec\.ts$/,/\.spec\.tsx$/];function sn(e){return on.some(t=>t.test(e))}function cn(e,t){let n=t.replace(/[.+^${}()|[\]\\]/g,`\\$&`).replace(/\*\*/g,`{{DOUBLE_STAR}}`).replace(/\*/g,`[^/]*`).replace(/{{DOUBLE_STAR}}/g,`.*`);return RegExp(`^${n}$`).test(e)}function ln(e,t){return t.some(t=>cn(e,t))}function un(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function dn(e){if(typeof e!=`object`||!e)return!1;if(!(`allowPatterns`in e))return!0;let t=e.allowPatterns;return Array.isArray(t)&&un(t)}const fn={meta:{type:`problem`,docs:{description:`禁止在 __tests__ 目录下放置非测试文件`},messages:{nonTestFileInTestsDirectory:`文件 "{{fileName}}" 位于 __tests__ 目录下但不是测试文件。测试目录应仅包含测试文件(*.test.ts, *.spec.ts)。如果是辅助文件,请移动到 src/test-helpers/ 或 src/testing/ 目录。`},schema:[{type:`object`,properties:{allowPatterns:{type:`array`,items:{type:`string`},description:`允许在 __tests__ 目录下的非测试文件 glob 模式`}},additionalProperties:!1}]},create(e){let t=[...an],n=e.options[0];dn(n)&&n.allowPatterns&&(t=[...an,...n.allowPatterns]);let r=e.filename,i=V(r),a=u.basename(r);return{Program(){i.includes(`/__tests__/`)&&(sn(a)||ln(i,t)||e.report({loc:{start:{line:1,column:0},end:{line:1,column:a.length}},messageId:`nonTestFileInTestsDirectory`,data:{fileName:a}}))}}}},pn=[/\.test\.ts$/,/\.test\.tsx$/,/\.spec\.ts$/,/\.spec\.tsx$/],H=[`.ts`,`.tsx`],mn=new Set([`node_modules`,`dist`,`out`,`.bun`,`.turbo`,`.cache`,`generated`]),hn=new WeakMap;function gn(e){return e.replace(/\\/g,`/`)}function _n(e,t){let n;try{n=f.readdirSync(e,{withFileTypes:!0})}catch{return}for(let r of n){let n=u.join(e,r.name);if(r.isDirectory()){if(mn.has(r.name))continue;_n(n,t)}else r.isFile()&&t(n)}}function U(e){return Wt.some(t=>t.test(e))}function vn(e){let t=gn(e);return Gt.some(e=>t.includes(e))}function yn(e){for(let t of pn)if(t.test(e))return e.replace(t,``);return e}function bn(e){let t=gn(e),n=t.indexOf(`/__tests__/`);return n===-1?u.dirname(e):t.substring(0,n)}function xn(e,t){for(let n of H){let r=u.join(t,e+n);if(f.existsSync(r))return r}return null}function Sn(e,t){let n=hn.get(e);if(n||(n=new Map,hn.set(e,n)),n.has(t))return n.get(t);let r=[];return _n(t,e=>r.push(e)),n.set(t,r),r}function Cn(e,t,n,r){let i=u.dirname(t),a=[i,u.dirname(i)];for(let t of a){let n=xn(e,t);if(n)return n}let o=[n,i];for(let t of o){if(!f.existsSync(t))continue;let n=Sn(r,t);for(let t of n){let n=u.basename(t);if(!U(n)){for(let r of H)if(n===e+r)return t}}}return null}function wn(e,t){let n=u.basename(e),r=yn(n),i=bn(e);if(Cn(r,e,i,t))return{isMatch:!0,suggestion:null};let a=On(i,e,t)[0];if(a){let e=u.basename(a,u.extname(a)),t=u.extname(n),r=n.includes(`.spec.`)?`.spec`:`.test`,i=t.replace(r,``);return{isMatch:!1,suggestion:e+r+i}}return{isMatch:!1,suggestion:null}}function Tn(e){return U(e)||e===`index.ts`||e===`index.tsx`||e.endsWith(`.d.ts`)?!1:H.some(t=>e.endsWith(t))}function En(e,t,n){if(f.existsSync(e))try{let r=f.readdirSync(e,{withFileTypes:!0});for(let i of r){if(!i.isFile())continue;let r=i.name;if(!Tn(r))continue;let a=u.join(e,r);n.has(a)||(t.push(a),n.add(a))}}catch{}}function Dn(e,t,n,r){if(!f.existsSync(e))return;let i=Sn(t,e);for(let e of i)Tn(u.basename(e))&&(r.has(e)||(n.push(e),r.add(e)))}function On(e,t,n){let r=u.dirname(t),i=u.dirname(r),a=[],o=new Set,s=[r,i];for(let e of s)En(e,a,o);if(a.length===0){let t=[e,r];for(let e of t)Dn(e,n,a,o)}return a}const W={meta:{type:`problem`,docs:{description:`确保测试文件名与被测试的源文件名保持一致`},messages:{testFileNotMatchSource:`测试文件 "{{testFileName}}" 未找到匹配的源文件。测试文件名应与源文件名保持一致。{{suggestion}}`},schema:[]},create(e){let t=e.filename,n=u.basename(t);if(!U(n)||vn(t)||n.endsWith(`.d.ts`))return{};let r=wn(t,e);if(!r.isMatch){let t=r.suggestion?`建议重命名为 "${r.suggestion}"`:`请确保测试文件名与源文件名匹配(如 user.service.ts -> user.service.test.ts)`;e.report({loc:{start:{line:1,column:0},end:{line:1,column:n.length}},messageId:`testFileNotMatchSource`,data:{testFileName:n,suggestion:t}})}return{}}};function kn(e){if(!e||typeof e!=`object`)return!1;let t=e;if(!(`type`in t)||t.type!==m.MemberExpression||!(`object`in t)||!t.object||!(`property`in t)||!t.property)return!1;let n=t.object,r=t.property;return!n||typeof n!=`object`||!r||typeof r!=`object`?!1:`type`in n&&n.type===m.Identifier&&`name`in n&&n.name===`window`&&`type`in r&&r.type===m.Identifier&&`name`in r&&r.name===`electron`}const An={meta:{type:`problem`,docs:{description:`禁止在 Preload 中直接暴露 @electron-toolkit/preload 的 electronAPI`},messages:{noElectronApiImport:`禁止导入 @electron-toolkit/preload 的 electronAPI。`,noExposeElectronApi:`禁止执行 contextBridge.exposeInMainWorld("electron", electronAPI)。`,noWindowElectronApi:`禁止执行 window.electron = electronAPI。`},schema:[]},create(e){return{ImportDeclaration(t){if(t.source.value===`@electron-toolkit/preload`)for(let n of t.specifiers)n.type===`ImportSpecifier`&&n.imported.type===`Identifier`&&n.imported.name===`electronAPI`&&e.report({node:n,messageId:`noElectronApiImport`})},CallExpression(t){if(t.callee.type!==`MemberExpression`||t.callee.property.type!==`Identifier`||t.callee.property.name!==`exposeInMainWorld`||t.arguments.length<2)return;let[n,r]=t.arguments;n?.type===`Literal`&&n.value===`electron`&&r?.type===`Identifier`&&r.name===`electronAPI`&&e.report({node:t,messageId:`noExposeElectronApi`})},AssignmentExpression(t){t.left.type===`MemberExpression`&&kn(t.left)&&t.right.type===`Identifier`&&t.right.name===`electronAPI`&&e.report({node:t,messageId:`noWindowElectronApi`})}}}};function jn(e){let t=e.replace(/\\/g,`/`);return t.includes(`/src/preload/`)&&!t.includes(`/__tests__/`)}function G(e){return typeof e==`object`&&!!e}function Mn(e){if(!G(e))return null;let t=e.key;return G(t)?typeof t.name==`string`?t.name:typeof t.value==`string`?t.value:null:null}function Nn(e){return!G(e)||!Array.isArray(e.properties)?!1:e.properties.some(e=>{if(!G(e)||e.type!==`Property`)return!1;let t=Mn(e);return t===`on`||t===`send`||t===`invoke`})}const Pn={meta:{type:`problem`,docs:{description:`禁止在 Preload 暴露通用 ipc 桥接对象`},messages:{noIpcBridge:`禁止暴露通用 ipc 桥接对象(on/send/invoke)。请使用领域 API。`},schema:[]},create(e){return jn(e.filename)?{Property(t){Mn(t)===`ipc`&&G(t.value)&&t.value.type===`ObjectExpression`&&Nn(t.value)&&e.report({node:t,messageId:`noIpcBridge`})}}:{}}};function Fn(e){let t=e.replace(/\\/g,`/`);return t.includes(`/src/preload/`)&&!t.includes(`/__tests__/`)&&!t.includes(`/src/preload/utils/`)}const In={meta:{type:`problem`,docs:{description:`禁止在 Preload 业务代码中直接调用 ipcRenderer`},messages:{noDirectCall:`禁止直接调用 ipcRenderer。请通过 createTypedAPI 或 invoke 封装。`},schema:[]},create(e){return Fn(e.filename)?{CallExpression(t){t.callee.type===`MemberExpression`&&t.callee.object.type===`Identifier`&&t.callee.object.name===`ipcRenderer`&&e.report({node:t,messageId:`noDirectCall`})}}:{}}};function K(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`Identifier`&&`name`in e&&typeof e.name==`string`}function Ln(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`Property`&&`value`in e&&e.value!==null&&typeof e.value==`object`&&K(e.value)}function Rn(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`RestElement`&&`argument`in e&&e.argument!==null&&typeof e.argument==`object`&&K(e.argument)}function zn(e){let t=[];if(!e||typeof e!=`object`)return t;if(K(e)&&t.push(e.name),`type`in e&&e.type===`ObjectPattern`&&`properties`in e&&Array.isArray(e.properties))for(let n of e.properties)!n||typeof n!=`object`||(Ln(n)?t.push(n.value.name):Rn(n)&&t.push(n.argument.name));if(`type`in e&&e.type===`ArrayPattern`&&`elements`in e&&Array.isArray(e.elements))for(let n of e.elements)K(n)&&t.push(n.name);return t}function Bn(e){return`declaration`in e}function Vn(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`VariableDeclaration`&&`kind`in e&&`declarations`in e&&Array.isArray(e.declarations)}function Hn(e){if(typeof e!=`object`||!e||!(`range`in e))return!1;let t=e.range;return Array.isArray(t)&&t.length===2}function Un(e,t,n){return r=>{let i=t.declaration;if(!i||!Hn(i)||!e.getTokenBefore(i))return null;let a=e.getText(i),o=n.join(`, `),s=e.getText(t).match(/^(\s*)/),c=s?s[1]:``,ee=`${a}`,l=`${c}export { ${o} };`;return r.replaceText(t,`${ee}\n${l}`)}}const Wn={meta:{type:`suggestion`,docs:{description:`将 export const/let/var 拆分为独立的声明和导出语句,以便 JSDoc 正确插入`,recommended:!0},fixable:`code`,schema:[],messages:{preferSplitExport:"应将 `export {{kind}} {{names}}` 拆分为独立的声明和导出语句,以便 JSDoc 正确插入注释"}},create(e){let t=e.sourceCode;return{ExportNamedDeclaration(n){if(!Bn(n)||!n.declaration||!Vn(n.declaration))return;let r=n.declaration;if(r.kind!==`const`&&r.kind!==`let`&&r.kind!==`var`)return;let i=r.declarations;if(i.length===0)return;let a=[];i.forEach(e=>{a.push(...zn(e.id))}),a.length!==0&&e.report({node:n,messageId:`preferSplitExport`,data:{kind:r.kind,names:a.join(`, `)},fix:Un(t,n,a)})}}}};function Gn(e){return typeof e==`object`&&!!e&&`name`in e&&typeof e.name==`string`&&(!(`severity`in e)||e.severity===`error`||e.severity===`warn`||e.severity===void 0)&&(!(`description`in e)||typeof e.description==`string`||e.description===void 0)}function Kn(e){return Array.isArray(e)&&e.every(Gn)}function qn(e){if(typeof e!=`object`||!e)return!1;if(!(`directories`in e))return!0;let t=e.directories;return Array.isArray(t)&&Kn(t)}const Jn=[{name:`apps`,severity:`error`,description:`应用层目录`},{name:`domains`,severity:`error`,description:`领域层目录`},{name:`packages`,severity:`error`,description:`技术层目录`},{name:`infrastructure`,severity:`warn`,description:`基础设施层目录`},{name:`templates`,severity:`warn`,description:`模板层目录`},{name:`docs`,severity:`warn`,description:`文档层目录`}];function Yn(e,t){return p(d(e,t,`README.md`))}function Xn(e){return e.cwd}const Zn=new WeakMap;function Qn(e){let t=Zn.get(e);return t||(t=new Set,Zn.set(e,t)),t}const $n={meta:{type:`problem`,docs:{description:`检查分层目录是否包含 README.md 文件`},messages:{missingReadmeError:`分层目录 "{{directory}}" ({{description}}) 缺少 README.md 文件。分层目录必须包含 README.md 文件,阐明该层职责。`,missingReadmeWarn:`分层目录 "{{directory}}" ({{description}}) 建议添加 README.md 文件,阐明该层职责。`},schema:[{type:`object`,properties:{directories:{type:`array`,items:{type:`object`,properties:{name:{type:`string`},severity:{type:`string`,enum:[`error`,`warn`]},description:{type:`string`}},required:[`name`]}}},additionalProperties:!1}]},create(e){let t=Xn(e),n=Qn(e),r=Jn,i=e.options[0];return qn(i)&&i.directories&&(r=i.directories),{Program(i){if(!n.has(t)){n.add(t);for(let n of r){let r=n.name;if(p(d(t,r))&&!Yn(t,r)){let t=(n.severity||`error`)===`error`?`missingReadmeError`:`missingReadmeWarn`;e.report({node:i,messageId:t,data:{directory:r,description:n.description||r}})}}}}}}},er=[{suffix:`.service.drizzle.ts`,classSuffix:`Service`,isInterface:!1,isPrefix:!1},{suffix:`.service.memory.ts`,classSuffix:`Service`,isInterface:!1,isPrefix:!1},{suffix:`.service.ts`,classSuffix:`Service`,isInterface:!1,isPrefix:!1},{suffix:`.controller.ts`,classSuffix:`Controller`,isInterface:!1,isPrefix:!1},{suffix:`.module.ts`,classSuffix:`Module`,isInterface:!1,isPrefix:!1},{suffix:`.repository.drizzle.ts`,classSuffix:`Repository`,isInterface:!1,isPrefix:!1},{suffix:`.repository.memory.ts`,classSuffix:`Repository`,isInterface:!1,isPrefix:!1},{suffix:`.repository.interface.ts`,classSuffix:`Repository`,isInterface:!0,isPrefix:!0},{suffix:`.repository.ts`,classSuffix:`Repository`,isInterface:!1,isPrefix:!1},{suffix:`.entity.ts`,classSuffix:`Entity`,isInterface:!1,isPrefix:!1},{suffix:`.orm-entity.ts`,classSuffix:`OrmEntity`,isInterface:!1,isPrefix:!1},{suffix:`.dto.ts`,classSuffix:`DTO`,isInterface:!1,isPrefix:!1},{suffix:`.port.interface.ts`,classSuffix:`Port`,isInterface:!0,isPrefix:!0},{suffix:`.interface.ts`,classSuffix:``,isInterface:!0,isPrefix:!0},{suffix:`.port.ts`,classSuffix:`Port`,isInterface:!0,isPrefix:!1},{suffix:`.port.adapter.ts`,classSuffix:`PortAdapter`,isInterface:!1,isPrefix:!1},{suffix:`.adapter.ts`,classSuffix:`Adapter`,isInterface:!1,isPrefix:!1},{suffix:`.events.ts`,classSuffix:`Event`,isInterface:!1,isPrefix:!1},{suffix:`.mapper.ts`,classSuffix:`Mapper`,isInterface:!1,isPrefix:!1},{suffix:`.vo.ts`,classSuffix:`VO`,isInterface:!1,isPrefix:!1},{suffix:`.usecase.ts`,classSuffix:`UseCase`,isInterface:!1,isPrefix:!1},{suffix:`.errors.ts`,classSuffix:`Error`,isInterface:!1,isPrefix:!1}];function tr(e){for(let t of er)if(e.endsWith(t.suffix))return t;return null}function nr(e,t){if(t.isPrefix&&t.isInterface){if(t.classSuffix){let n=t.classSuffix;return e.startsWith(`I`)&&e.endsWith(n)&&e.length>1+n.length}return e.startsWith(`I`)&&e.length>1}return t.isPrefix?e.startsWith(`I`)&&e.length>1:e.endsWith(t.classSuffix)&&e.length>t.classSuffix.length}function rr(e){return e.isPrefix&&e.isInterface?e.classSuffix?`I${e.classSuffix}(如 IUser${e.classSuffix})`:`I 前缀(如 IUser)`:e.isPrefix?`I 前缀(如 IUser)`:`${e.classSuffix} 后缀`}function ir(e,t,n,i){if(!r(e))return;let a=e.id.name;n.isInterface||nr(a,n)||t.report({node:e,messageId:`invalidClassName`,data:{className:a,fileName:i,expectedFormat:rr(n)}})}function ar(e,t,n,i){if(!n.isInterface||!r(e))return;let a=e.id.name;nr(a,n)||t.report({node:e,messageId:`invalidInterfaceName`,data:{interfaceName:a,fileName:i,expectedFormat:rr(n)}})}function or(e){let t=e.filename,n=u.basename(t);if(n.endsWith(`.test.ts`)||n.endsWith(`.spec.ts`))return{};let r=tr(n);return r?{ClassDeclaration(t){ir(t,e,r,n)},TSInterfaceDeclaration(t){ar(t,e,r,n)}}:{}}const sr={meta:{type:`problem`,docs:{description:`强制执行类名与文件类型后缀的一致性`},messages:{invalidClassName:`类名 "{{className}}" 不符合命名规范。文件 "{{fileName}}" 中的类应使用 {{expectedFormat}}`,invalidInterfaceName:`接口名 "{{interfaceName}}" 不符合命名规范。文件 "{{fileName}}" 中的接口应使用 {{expectedFormat}}`},schema:[]},create:or},cr=[`types.ts`,`types.d.ts`],lr=[`.port.interface.ts`,`.repository.interface.ts`,`.types.ts`,`.types.d.ts`,`.events.ts`];function ur(e,t){return n(e)?!1:t.endsWith(`.dto.ts`)?ne(e):!0}function dr(e){return e.endsWith(`.dto.ts`)?`DTO 后缀(如 UserDTO),禁止 I 前缀`:`PascalCase(如 User、UserRepository),禁止 I 前缀`}function fr(e){if(cr.includes(e))return!0;for(let t of lr)if(e.endsWith(t))return!0;return!1}function pr(e){return e.endsWith(`.port.ts`)?e.replace(`.port.ts`,`.port.interface.ts`):e.endsWith(`.repository.ts`)?e.replace(`.repository.ts`,`.repository.interface.ts`):e.replace(`.ts`,`.interface.ts`)}function mr(t,n){return n.endsWith(`Dto`)?e(t,n,!0):null}function hr(e,r,i,a){if(ur(i,a))return;if(n(i)){e.report({node:r,messageId:`invalidIPrefix`,data:{interfaceName:i,suggestedName:i.substring(1)},fix:t(r,i)});return}let o=mr(r,i);o?e.report({node:r,messageId:`invalidDtoSuffix`,data:{interfaceName:i},fix:o}):e.report({node:r,messageId:`invalidInterfaceName`,data:{interfaceName:i,expectedFormat:dr(a)}})}function gr(e,t,n,r,i){i||r.endsWith(`.dto.ts`)||e.report({node:t,messageId:`invalidFileName`,data:{fileName:r,interfaceName:n,expectedFileName:pr(r)}})}function _r(e,t,n,r){if(!i(t))return;let a=t.id.name;hr(e,t,a,n),gr(e,t,a,n,r)}function vr(e){let t=e.filename,n=u.basename(t);if(n.endsWith(`.test.ts`)||n.endsWith(`.spec.ts`)||fr(n))return{};let r=n.endsWith(`.interface.ts`);return{TSInterfaceDeclaration(t){_r(e,t,n,r)}}}const yr={meta:{type:`problem`,docs:{description:`强制执行接口命名规范(禁止 I 前缀,使用 PascalCase)和文件命名规范(xxx.interface.ts)`},messages:{invalidIPrefix:`接口名 "{{interfaceName}}" 使用了 I 前缀。现代 TypeScript 不推荐使用匈牙利命名法,建议使用 "{{suggestedName}}"`,invalidInterfaceName:`接口名 "{{interfaceName}}" 不符合命名规范。接口名应使用 {{expectedFormat}}`,invalidDtoSuffix:`接口名 "{{interfaceName}}" 后缀应使用 DTO(全大写)而非 Dto(驼峰式)`,invalidFileName:`包含接口 "{{interfaceName}}" 的文件 "{{fileName}}" 应命名为 "{{expectedFileName}}"`},schema:[],fixable:`code`},create:vr},br=[`.types.ts`,`.types.d.ts`];function xr(e){return br.some(t=>e.endsWith(t))}function Sr(e){let r=e.filename,a=u.basename(r);return a.endsWith(`.test.ts`)||a.endsWith(`.spec.ts`)||!xr(a)?{}:{TSInterfaceDeclaration(r){if(!i(r))return;let a=r.id.name;n(a)&&e.report({node:r,messageId:`invalidIPrefix`,data:{interfaceName:a,suggestedName:a.substring(1)},fix:t(r,a)})}}}const Cr={meta:{type:`problem`,docs:{description:`强制执行 types 文件中的接口命名规范(禁止 I 前缀)`},messages:{invalidIPrefix:`类型文件中的接口名 "{{interfaceName}}" 使用了 I 前缀。现代 TypeScript 不推荐使用匈牙利命名法,建议使用 "{{suggestedName}}"`},schema:[],fixable:`code`},create:Sr};function wr(e){return e.endsWith(`.dto.ts`)}function Tr(e){return e.endsWith(`DTO`)}function Er(t){let n=t.filename,r=u.basename(n);return r.endsWith(`.test.ts`)||r.endsWith(`.spec.ts`)||!wr(r)?{}:{TSInterfaceDeclaration(n){if(!i(n))return;let r=n.id.name;Tr(r)?t.report({node:n,messageId:`invalidDtoSuffix`,data:{interfaceName:r},fix:e(n,r,!1)}):te(r)||t.report({node:n,messageId:`missingDtoSuffix`,data:{interfaceName:r}})}}}const Dr={meta:{type:`problem`,docs:{description:`强制执行 DTO 文件中的接口命名规范(Dto 后缀,驼峰式)`},messages:{invalidDtoSuffix:`接口名 "{{interfaceName}}" 后缀应使用 Dto(驼峰式)而非 DTO(全大写)`,missingDtoSuffix:`DTO 文件中的接口名 "{{interfaceName}}" 应以 Dto 结尾(如 UserResponseDto)`},schema:[],fixable:`code`},create:Er},q=`@longzai-intelligence/config/tsup`,Or=`definePackageConfig`,kr=[`defineConfig`];function Ar(e){return{ImportDeclaration(t){if(!s(t))return;let n=t.source.value;for(let r of t.specifiers){if(!c(r))continue;let i=r.imported.name;if(kr.includes(i)){if(n===`tsup`){e.report({node:t,messageId:`forbiddenTsupImport`,data:{importedName:i,correctExportName:Or,configPackage:q}});continue}n===q&&e.report({node:t,messageId:`forbiddenConfigImport`,data:{importedName:i,correctExportName:Or,configPackage:q}})}}}}}const jr={meta:{type:`problem`,docs:{description:`强制执行 tsup.config.ts 文件中的配置导入规范,必须使用 definePackageConfig`},messages:{forbiddenTsupImport:`禁止从 tsup 包导入 {{importedName}}。应使用 {{correctExportName}} 从 {{configPackage}} 导入`,forbiddenConfigImport:`禁止从 {{configPackage}} 导入 {{importedName}}。应使用 {{correctExportName}}`},schema:[]},create:Ar},J=`@longzai-intelligence/tsdown-config`,Mr=[`defineDomainImplementationConfig`,`defineDomainContractConfig`,`defineSharedKernelConfig`,`defineReactComponentsConfig`,`defineConfigPackageConfig`,`definePackageConfig`],Nr=[`defineConfig`];function Pr(e){return{ImportDeclaration(t){if(!s(t))return;let n=t.source.value;for(let r of t.specifiers){if(!c(r))continue;let i=r.imported.name;if(Nr.includes(i)){if(n===`tsdown`){e.report({node:t,messageId:`forbiddenTsdownImport`,data:{importedName:i,presetNames:Mr.join(`、`),configPackage:J}});continue}n===J&&e.report({node:t,messageId:`forbiddenConfigImport`,data:{importedName:i,presetNames:Mr.join(`、`),configPackage:J}})}}}}}const Fr={meta:{type:`problem`,docs:{description:`强制执行 tsdown.config.ts 文件中的配置导入规范,必须使用预设函数`},messages:{forbiddenTsdownImport:`禁止从 tsdown 包导入 {{importedName}}。应使用预设函数({{presetNames}})从 {{configPackage}} 导入`,forbiddenConfigImport:`禁止从 {{configPackage}} 导入 {{importedName}}。应使用预设函数({{presetNames}})`},schema:[]},create:Pr},Y=[`@longzai-intelligence/config/vitest`,`@longzai-intelligence/vitest-config`],X=[`createBaseVitestConfig`,`createDomainVitestConfig`,`createDomainUIVitestConfig`,`createPackageVitestConfig`,`createTypeOnlyVitestConfig`,`createDesktopVitestConfig`,`createWebVitestConfig`,`defineVitestConfig`,`defineDomainVitestConfig`,`defineDomainUIVitestConfig`,`definePackageVitestConfig`,`defineTypeOnlyVitestConfig`,`defineDesktopVitestConfig`,`defineWebVitestConfig`],Ir=[`defineConfig`],Lr=[`infrastructure/configs/vitest/vitest.config.ts`];function Rr(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`ExportDefaultDeclaration`&&`declaration`in e&&e.declaration!==null&&typeof e.declaration==`object`}function zr(e){return e.endsWith(`vitest.config.ts`)}function Br(e,t,n){if(!s(e))return;let r=e.source.value;for(let t of e.specifiers){if(!c(t))continue;let i=t.imported.name;if(r===`vitest`&&Ir.includes(i)){n.hasForbiddenImport=!0,n.forbiddenImportNode=e,n.forbiddenImportName=i;continue}Y.includes(r)&&X.includes(i)&&(n.hasValidImport=!0)}}function Vr(e,t){return!t.hasForbiddenImport||!t.forbiddenImportNode?!1:(e.report({node:t.forbiddenImportNode,messageId:`forbiddenVitestImport`,data:{importedName:t.forbiddenImportName,configPackages:Y.join(` 或 `),allowedExports:X.join(`, `)}}),!0)}function Hr(e,t,n){if(!a(e))return!1;let r=e.callee.name;return typeof r==`string`&&!X.includes(r)&&!n.hasValidImport?(t.report({node:e,messageId:`invalidConfigFunction`,data:{configPackages:Y.join(` 或 `),allowedExports:X.join(`, `)}}),!0):!1}function Ur(e,t,n){return l(e)?n.hasValidImport?!1:(t.report({node:e,messageId:`invalidConfigObject`,data:{configPackages:Y.join(` 或 `),allowedExports:X.join(`, `)}}),!0):!1}function Wr(e,t,n){if(!Rr(e))return;n.hasExportDefault=!0;let r=e.declaration;Vr(t,n)||Hr(r,t,n)||Ur(r,t,n)}function Gr(e,t){if(!t.hasExportDefault){let t=e.sourceCode.ast;e.report({node:t,messageId:`missingConfigImport`,data:{configPackages:Y.join(` 或 `),allowedExports:X.join(`, `)}})}}function Kr(e){let t=e.filename;if(!zr(t)||ee(t,Lr))return{};let n={hasValidImport:!1,hasForbiddenImport:!1,hasExportDefault:!1,forbiddenImportNode:null,forbiddenImportName:``};return{ImportDeclaration(t){Br(t,e,n)},ExportDefaultDeclaration(t){Wr(t,e,n)},"Program:exit"(){Gr(e,n)}}}const qr={meta:{type:`problem`,docs:{description:`强制执行 vitest.config.ts 文件中的配置导入规范,必须使用共享配置函数`},messages:{forbiddenVitestImport:`禁止从 vitest 包导入 {{importedName}}。应使用共享配置函数({{allowedExports}})从 {{configPackages}} 导入`,invalidConfigFunction:`必须使用共享配置函数({{allowedExports}})从 {{configPackages}} 导入`,missingConfigImport:`vitest.config.ts 必须使用共享配置函数({{allowedExports}})从 {{configPackages}} 导入`},schema:[]},create:Kr},Z=`@longzai-intelligence/config/eslint`,Q=[`createBaseConfig`,`createLibraryConfig`,`createDomainConfig`,`createReactConfig`,`createElectronConfig`,`createNextConfig`,`createArchitectureConfig`,`createServerConfig`,`createNestConfig`,`createHonoConfig`],Jr=[`baseConfig`,`libraryConfig`,`domainConfig`,`reactConfig`,`electronConfig`,`nextConfig`,`architectureConfig`,`serverConfig`,`nestConfig`,`honoConfig`,`base`,`library`,`domain`,`react`,`electron`,`next`,`architecture`,`server`,`nest`,`hono`];function Yr(e,t){e.report({node:t,messageId:`forbiddenDefaultImport`,data:{configPackage:Z,allowedFunctions:Q.join(`、`)}})}function Xr(e,t){e.report({node:t,messageId:`forbiddenNamespaceImport`,data:{configPackage:Z,allowedFunctions:Q.join(`、`)}})}function Zr(e,t,n){e.report({node:t,messageId:`forbiddenConfigImport`,data:{importedName:n,allowedFunctions:Q.join(`、`)}})}function Qr(e,t){e.report({node:t,messageId:`missingCreateFunction`,data:{configPackage:Z,allowedFunctions:Q.join(`、`)}})}function $r(e,t){if(!s(t)||t.source.value!==Z)return;let n=[],r=[],i=!1;for(let a of t.specifiers)if(c(a)){if(o(a)){Yr(e,t),i=!0;continue}if(a.type===`ImportNamespaceSpecifier`){Xr(e,t),i=!0;continue}Jr.includes(a.imported.name)?r.push(a):Q.includes(a.imported.name)&&n.push(a)}if(!i){for(let n of r)Zr(e,t,n.imported.name);r.length===0&&n.length===0&&(t.specifiers.some(e=>c(e)&&e.type===`ImportSpecifier`&&!Q.includes(e.imported.name)&&!Jr.includes(e.imported.name))||Qr(e,t))}}function ei(e){return{ImportDeclaration(t){$r(e,t)}}}const ti={meta:{type:`problem`,docs:{description:`强制执行 eslint.config.ts 文件中的配置导入规范,必须使用 createXxxConfig 函数`},messages:{forbiddenDefaultImport:`禁止从 {{configPackage}} 使用默认导入。应使用具名导入 {{allowedFunctions}} 等配置创建函数`,forbiddenNamespaceImport:`禁止从 {{configPackage}} 使用命名空间导入。应使用具名导入 {{allowedFunctions}} 等配置创建函数`,forbiddenConfigImport:`禁止从配置包导入 {{importedName}}。应使用 {{allowedFunctions}} 等配置创建函数`,missingCreateFunction:`必须从 {{configPackage}} 导入至少一个配置创建函数(如 {{allowedFunctions}})`},schema:[]},create:ei},ni=[`./tsconfig/app.json`,`./tsconfig/node.json`,`./tsconfig/test.json`],ri=[`app.json`,`node.json`,`test.json`,`build.json`];function ii(e){return typeof e==`object`&&!!e&&`path`in e&&typeof e.path==`string`}function ai(e){return Array.isArray(e)&&e.every(ii)}function oi(e){return!(typeof e!=`object`||!e)}function si(e){try{let t=ie(e,`utf-8`);return JSON.parse(t)}catch{return null}}function ci(e){let t=e.map(e=>e.path);return ni.filter(e=>!t.includes(e))}function li(e){return e.map(e=>e.path).filter(e=>!ni.includes(e))}const ui=new WeakMap;function di(e,t){let n=ui.get(e);if(n||(n=new Map,ui.set(e,n)),n.has(t))return n.get(t);let r=p(t),i={hasDir:r,missingFiles:r?fi(t):[]};return n.set(t,i),i}function fi(e){return ri.filter(t=>!p(d(e,t)))}function pi(e,t,n){if(!n.references||!ai(n.references)){e.report({node:t,messageId:`missingReferences`});return}let r=ci(n.references);r.length>0&&e.report({node:t,messageId:`missingRequiredReference`,data:{missingPath:r[0]}});let i=li(n.references);for(let n of i)e.report({node:t,messageId:`extraReference`,data:{extraPath:n}})}function mi(e,t,n){return n.files===void 0?!0:Array.isArray(n.files)?n.files.length===0?!0:(e.report({node:t,messageId:`filesMustBeEmpty`}),!1):(e.report({node:t,messageId:`filesMustBeArray`}),!1)}const hi={meta:{type:`problem`,docs:{description:`检查 tsconfig.json 是否正确使用 references 配置`},messages:{missingReferences:`tsconfig.json 必须使用 references 配置,采用目录收拢多配置模式。请添加 references 字段,包含 app.json、node.json、test.json 三个配置。`,missingRequiredReference:`tsconfig.json 的 references 缺少必需的配置: "{{missingPath}}"。references 必须包含 ./tsconfig/app.json、./tsconfig/node.json、./tsconfig/test.json。`,filesMustBeEmpty:`tsconfig.json 使用 references 时,files 必须为空数组 "[]"。请将 files 设置为空数组或移除 files 字段。`,filesMustBeArray:`tsconfig.json 使用 references 时,files 必须为数组类型。请将 files 设置为空数组 "[]"。`,missingTsconfigDirectory:`缺少 tsconfig/ 目录。请创建 tsconfig/ 目录并添加 app.json、node.json、test.json、build.json 配置文件。`,missingConfigFile:`tsconfig/ 目录缺少必需的配置文件: {{missingFiles}}。必需的配置文件包括: app.json、node.json、test.json、build.json。`,extraReference:`tsconfig.json 的 references 包含非必需的配置: "{{extraPath}}"。references 应仅包含 ./tsconfig/app.json、./tsconfig/node.json、./tsconfig/test.json。`},schema:[]},create(e){let t=e.filename;if(!t.endsWith(`tsconfig.json`)||t.includes(`tsconfig/`))return{};let n=d(re(t),`tsconfig`);return{Program(r){let i=si(t);if(!oi(i))return;let a=di(e,n);if(!a.hasDir){e.report({node:r,messageId:`missingTsconfigDirectory`});return}if(a.missingFiles.length>0){e.report({node:r,messageId:`missingConfigFile`,data:{missingFiles:a.missingFiles.join(`, `)}});return}mi(e,r,i)&&pi(e,r,i)}}}};function gi(e){let t=e.replace(/\\/g,`/`);return t.includes(`/src/preload/`)&&!t.includes(`/__tests__/`)}const _i={meta:{type:`problem`,docs:{description:`禁止使用字符串字面量作为 IPC 通道名`},messages:{noStringLiteral:`禁止使用字符串字面量作为 IPC 通道名。请使用通道常量。`},schema:[]},create(e){return gi(e.filename)?{CallExpression(t){if(t.callee.type!==`Identifier`||t.callee.name!==`invoke`||t.arguments.length===0)return;let n=t.arguments[0];n&&n.type===`Literal`&&typeof n.value==`string`&&e.report({node:n,messageId:`noStringLiteral`})},ObjectExpression(t){if(t.parent?.type===`CallExpression`&&t.parent.callee.type===`Identifier`&&t.parent.callee.name===`createTypedAPI`)for(let n of t.properties)n.type===`Property`&&n.value.type===`Literal`&&typeof n.value.value==`string`&&e.report({node:n.value,messageId:`noStringLiteral`})}}:{}}};function vi(e){let t=e.replace(/\\/g,`/`);return t.endsWith(`/src/preload/index.ts`)&&!t.includes(`/__tests__/`)}function yi(e){let t=e.parent;for(;t;){if(t.type===`CallExpression`&&t.callee.type===`Identifier`&&t.callee.name===`exposeSafeAPI`)return!0;t=t.parent}return!1}const bi={meta:{type:`problem`,docs:{description:`要求使用 exposeSafeAPI 进行 API 暴露`},messages:{requireExposeSafeApi:`请使用 exposeSafeAPI 进行 API 暴露,而非直接调用 contextBridge.exposeInMainWorld。`},schema:[]},create(e){return vi(e.filename)?{CallExpression(t){t.callee.type===`MemberExpression`&&t.callee.object.type===`Identifier`&&t.callee.object.name===`contextBridge`&&t.callee.property.type===`Identifier`&&t.callee.property.name===`exposeInMainWorld`&&(yi(t)||e.report({node:t,messageId:`requireExposeSafeApi`}))}}:{}}};function xi(e){let t=e.replace(/\\/g,`/`);return t.includes(`/src/preload/utils/`)&&!t.includes(`/__tests__/`)}function Si(e){return e.startsWith(`createTyped`)}const Ci={meta:{type:`problem`,docs:{description:`禁止自定义 IPC 工具函数`},messages:{noCustomIPC:`禁止自定义 IPC 工具函数。请使用 @longzai-intelligence/electron/preload 提供的标准函数。`},schema:[]},create(e){return xi(e.filename)?{FunctionDeclaration(t){t.id&&Si(t.id.name)&&e.report({node:t,messageId:`noCustomIPC`})},VariableDeclaration(t){for(let n of t.declarations){if(n.id.type!==`Identifier`||!Si(n.id.name))continue;let r=n.init;r&&(r.type===`FunctionExpression`||r.type===`ArrowFunctionExpression`)&&e.report({node:t,messageId:`noCustomIPC`})}}}:{}}},wi=new Set([`unwrap`,`unwrapIPCResult`]);function Ti(e){let t=e.replace(/\\/g,`/`);return t.includes(`/src/renderer/`)&&!t.includes(`/__tests__/`)&&!t.endsWith(`.test.ts`)&&!t.endsWith(`.spec.ts`)}function Ei(e){if(e.type!==`CallExpression`)return!1;let{callee:t}=e;if(t.type!==`MemberExpression`)return!1;let{object:n}=t;return n.type===`MemberExpression`?n.object.type===`Identifier`&&n.object.name===`window`:!1}function Di(e){let t=e.parent;for(;t;){if(t.type===`CallExpression`&&t.callee.type===`Identifier`&&wi.has(t.callee.name))return!0;if(t.type===`CallExpression`)break;t=t.parent}return!1}const Oi={meta:{type:`problem`,docs:{description:`渲染层调用 IPC API 时必须使用 unwrap 解包结果`},messages:{requireUnwrap:`渲染层调用 IPC API 时必须使用 unwrap 或 unwrapIPCResult 解包结果。`},schema:[]},create(e){return Ti(e.filename)?{CallExpression(t){Ei(t)&&(Di(t)||e.report({node:t,messageId:`requireUnwrap`}))}}:{}}};function ki(e){return e.endsWith(`Class`)}function Ai(e,t){if(typeof t!=`object`||!t||!(`imported`in t)||!(`local`in t)||t.local===null||typeof t.local!=`object`||!(`name`in t.local)||typeof t.local.name!=`string`||!(`range`in t.local)||!Array.isArray(t.local.range))return;let n=t.local.name,r=t.imported!==null&&typeof t.imported==`object`&&`name`in t.imported&&typeof t.imported.name==`string`?t.imported.name:n;n!==r&&ki(n)&&e.report({node:t,messageId:`noClassSuffixAlias`,data:{aliasName:n,importedName:r}})}function ji(e){return{ImportSpecifier(t){Ai(e,t)}}}const Mi={meta:{type:`problem`,docs:{description:`禁止在 import 别名中使用 "Class" 后缀`},messages:{noClassSuffixAlias:`导入别名 "{{aliasName}}" 使用了 "Class" 后缀,这是不允许的命名方式。请使用更具描述性的名称,或直接使用原始名称 "{{importedName}}"`},schema:[]},create:ji},Ni=/domains\/[^/]+\/implementation\/src\/index\.ts$/,Pi=[/\.\/typeorm/,/\.\/typeorm'/,/\.\/typeorm"/];function Fi(e){return Pi.some(t=>t.test(e))}const Ii={meta:{type:`problem`,docs:{description:`Implementation 包导出控制:禁止从主入口重新导出 typeorm.ts 的内容,typeorm.ts 仅供 DataSource/迁移基础设施使用`,recommended:!0},schema:[],messages:{forbiddenTypeormReExport:`禁止从主入口重新导出 typeorm.ts 的内容。typeorm.ts 是专门的持久化入口,仅供 DataSource/迁移基础设施使用,业务代码应通过主入口导入领域服务`}},create(e){let t=e.filename;return Ni.test(t)?{ExportNamedDeclaration(t){if(!t.source)return;let n=t.source.value;typeof n==`string`&&Fi(n)&&e.report({node:t,messageId:`forbiddenTypeormReExport`})},ExportAllDeclaration(t){if(!t.source)return;let n=t.source.value;typeof n==`string`&&Fi(n)&&e.report({node:t,messageId:`forbiddenTypeormReExport`})}}:{}}},Li={type:`suggestion`,docs:{description:`强制 domain entities 导出命名符合 {DOMAIN}_ORM_ENTITIES 规范`,recommended:!0},fixable:void 0,schema:[],messages:{invalidNaming:`entities 导出命名 "{{name}}" 不符合规范,应使用 "{{expected}}" 格式`,genericNaming:`entities 导出命名 "{{name}}" 是通用名称,应使用具体的 domain 名称 "{{expected}}"`,missingOrm:`entities 导出命名 "{{name}}" 缺少 "_ORM" 前缀,应使用 "{{expected}}"`,typoDetected:`entities 导出命名 "{{name}}" 可能存在拼写错误,应使用 "{{expected}}"`}},Ri=new Set([`DOMAIN_ENTITIES`,`ALL_ENTITIES`,`ENTITIES`]);function zi(e){let t=e.match(/\/domains\/([^/]+)\/implementation\/src\/typeorm\.ts$/);return!t||!t[1]?null:t[1].split(`-`).map(e=>e.toUpperCase()).join(`_`)}function Bi(e,t){return e.endsWith(`_ORM_ENTITIES`)?!1:e.endsWith(`_ENTITIES`)?e.replace(`_ENTITIES`,``)===t.replace(`_ORM_ENTITIES`,``):!1}function Vi(e){return Ri.has(e)}function Hi(e,t){let n=e.length,r=t.length,i=[];for(let a=0;a<=n;a++){i[a]=[];for(let n=0;n<=r;n++)a===0?i[a][n]=n:n===0?i[a][n]=a:e[a-1]===t[n-1]?i[a][n]=i[a-1][n-1]:i[a][n]=Math.min(i[a-1][n-1],i[a][n-1],i[a-1][n])+1}return i[n][r]}function Ui(e,t){let n=e.replace(`_ORM_ENTITIES`,``).replace(`_ENTITIES`,``),r=t.replace(`_ORM_ENTITIES`,``);return n===r?!1:n.toLowerCase()===r.toLowerCase()?!0:Hi(n,r)<=2}function Wi(e,t,n,r){Bi(n,r)?e.report({node:t,messageId:`missingOrm`,data:{name:n,expected:r}}):Vi(n)?e.report({node:t,messageId:`genericNaming`,data:{name:n,expected:r}}):Ui(n,r)?e.report({node:t,messageId:`typoDetected`,data:{name:n,expected:r}}):e.report({node:t,messageId:`invalidNaming`,data:{name:n,expected:r}})}function Gi(e,t,n,r){if(typeof n!=`object`||!n||!(`id`in n)||n.id===null||typeof n.id!=`object`||!(`type`in n.id)||n.id.type!==`Identifier`||!(`name`in n.id)||typeof n.id.name!=`string`)return;let i=n.id.name;!i.endsWith(`_ENTITIES`)&&!i.endsWith(`_ORM_ENTITIES`)||i!==r&&Wi(e,t,i,r)}function Ki(e,t,n,r){if(typeof n!=`object`||!n||!(`exported`in n)||n.exported===null||typeof n.exported!=`object`||!(`type`in n.exported)||n.exported.type!==`Identifier`||!(`name`in n.exported)||typeof n.exported.name!=`string`)return;let i=n.exported.name;!i.endsWith(`_ENTITIES`)&&!i.endsWith(`_ORM_ENTITIES`)||i!==r&&Wi(e,t,i,r)}function qi(e,t){function n(n){if(typeof n==`object`&&n&&`declaration`in n&&n.declaration!==null&&typeof n.declaration==`object`&&`type`in n.declaration&&n.declaration.type===`VariableDeclaration`&&`declarations`in n.declaration&&Array.isArray(n.declaration.declarations))for(let r of n.declaration.declarations)Gi(e,n,r,t);if(typeof n==`object`&&n&&`specifiers`in n&&Array.isArray(n.specifiers))for(let r of n.specifiers)Ki(e,n,r,t)}return n}function Ji(e){let t=e.filename;if(!t.endsWith(`typeorm.ts`))return{};let n=zi(t);return n?{ExportNamedDeclaration:qi(e,`${n}_ORM_ENTITIES`)}:{}}const Yi={meta:Li,create:Ji};function Xi(e){return e.replace(/\\/g,`/`).includes(`/apps/`)}function Zi(e){return e.endsWith(`-implementation`)}function Qi(e){return e.endsWith(`Entity`)}function $i(e){return e.endsWith(`UseCase`)}function ea(e){return[/PortAdapter$/,/_TOKEN$/,/^create\w+Repository$/,/^create\w+Adapter$/].some(t=>t.test(e))}const ta={noEntityImport:`禁止在 apps 层导入 Entity 类 "{{importName}}"。请使用 contract 包的 Port 接口进行操作。`,noUseCaseImport:`禁止在 apps 层导入 UseCase 类 "{{importName}}"。请使用 contract 包的 Port 接口进行操作。`,noImplementationImport:`禁止在 apps 层从 implementation 包导入 "{{importName}}"。请使用 contract 包的 Port 接口。`};function na(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`ImportSpecifier`}function ra(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`Identifier`&&`name`in e&&typeof e.name==`string`}function ia(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`Literal`&&`value`in e&&typeof e.value==`string`}function aa(e){if(!(`imported`in e)||e.imported===null||typeof e.imported!=`object`)return null;let t=e.imported;return ra(t)?t.name:ia(t)?t.value:null}function oa(e,t,n){Qi(n)?e.report({node:t,messageId:`noEntityImport`,data:{importName:n}}):$i(n)?e.report({node:t,messageId:`noUseCaseImport`,data:{importName:n}}):ea(n)||e.report({node:t,messageId:`noImplementationImport`,data:{importName:n}})}function sa(e,t,n){if(!na(t))return;let r=aa(t);r&&oa(e,t,r)}const ca={meta:{type:`problem`,docs:{description:`禁止在 apps 层导入 implementation 包的 Entity 和 UseCase`},messages:ta,schema:[]},create(e){let t=e.filename;return Xi(t)?{ImportDeclaration(t){if(!(`source`in t)||t.source===null||typeof t.source!=`object`||!(`type`in t.source)||t.source.type!==`Literal`||!(`value`in t.source)||typeof t.source.value!=`string`)return;let n=t.source.value;if(Zi(n)&&!(!(`specifiers`in t)||!Array.isArray(t.specifiers)))for(let r of t.specifiers)na(r)&&sa(e,r,n)}}:{}}};function la(e){let t=e.replace(/\\/g,`/`);return t.includes(`/domains/`)&&t.includes(`/implementation/src/index.ts`)}function ua(e){return e.endsWith(`Entity`)}function da(e){return e.endsWith(`Repository`)&&!e.startsWith(`I`)}function fa(e){return e.endsWith(`OrmEntity`)}function pa(e){return e.endsWith(`_ORM_ENTITIES`)}function ma(e){return e.endsWith(`OrmMapper`)}function ha(e){return e.endsWith(`Schema`)}function ga(e){return`exportKind`in e&&typeof e.exportKind==`string`?e.exportKind===`value`:!0}function _a(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`ExportSpecifier`}function va(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`Identifier`&&`name`in e&&typeof e.name==`string`}function ya(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`Literal`&&`value`in e&&typeof e.value==`string`}function ba(e){if(typeof e!=`object`||!e||!(`exported`in e)||e.exported===null||typeof e.exported!=`object`)return null;let t=e.exported;return va(t)?t.name:ya(t)?t.value:null}function $(e,t,n,r){e.report({node:t,messageId:n,data:{exportName:r}})}function xa(e,t,n){return ua(n)&&ga(t)?($(e,t,`noEntityValueExport`,n),!0):!1}function Sa(e,t,n){return da(n)?($(e,t,`noRepositoryTypeExport`,n),!0):!1}function Ca(e,t,n){return fa(n)?($(e,t,`noOrmEntityExport`,n),!0):pa(n)?($(e,t,`noOrmEntitiesExport`,n),!0):ma(n)?($(e,t,`noOrmMapperExport`,n),!0):!1}function wa(e,t,n){ha(n)&&$(e,t,`noSchemaExport`,n)}function Ta(e,t,n){xa(e,t,n)||Sa(e,t,n)||Ca(e,t,n)||wa(e,t,n)}function Ea(e,t){if(!(!(`source`in t)||t.source===null||typeof t.source!=`object`||!(`type`in t.source)||t.source.type!==`Literal`||!(`value`in t.source)||typeof t.source.value!=`string`)&&!(!(`specifiers`in t)||!Array.isArray(t.specifiers)))for(let n of t.specifiers){if(!_a(n))continue;let t=ba(n);t&&Ta(e,n,t)}}const Da={meta:{type:`problem`,docs:{description:`检查 Domain Implementation 包的导出是否符合规范`},messages:{noEntityValueExport:'禁止从主入口值导出 Entity 类 "{{exportName}}"。请改为类型导出:`export type { {{exportName}} }` 或移除导出。',noRepositoryTypeExport:`禁止导出 Repository 类型 "{{exportName}}"。Repository 是内部实现,不应暴露给外部。请移除此导出。`,noOrmEntityExport:`禁止从主入口导出 ORM 实体 "{{exportName}}"。请创建 src/typeorm.ts 入口文件,从该入口导出 ORM 实体。`,noOrmEntitiesExport:`禁止从主入口导出 ORM 实体集合 "{{exportName}}"。请创建 src/typeorm.ts 入口文件,从该入口导出。`,noOrmMapperExport:`禁止导出 ORM Mapper "{{exportName}}"。ORM Mapper 是基础设施实现细节,不应暴露给外部。请移除此导出。`,noSchemaExport:`禁止导出 Schema 定义 "{{exportName}}"。Schema 是实现细节,应完全保留在 Domain 内部。请仅导出从 Schema 推断的类型。`},schema:[]},create(e){let t=e.filename;return la(t)?{ExportNamedDeclaration(t){Ea(e,t)}}:{}}},Oa=`@longzai-intelligence/architecture-core`,ka={meta:{name:Oa,version:`1.0.0`},rules:{"dependency-direction":be,"no-core-types-in-apps":_,"business-leak":C,"file-naming":Dt,"require-type-suffix":Mt,"no-cross-package-relative-import":Ut,"prefer-split-export-const":Wn,"require-class-suffix":sr,"require-interface-naming":yr,"require-type-naming":Cr,"require-dto-naming":Dr,"no-class-suffix-alias":Mi,"implementation-export-control":Ii,"no-implementation-import-in-apps":ca,"domain-export-compliance":Da}},Aa=`@longzai-intelligence/architecture-domain`,ja={meta:{name:Aa,version:`1.0.0`},rules:{"domain-export":D,"domain-typeorm-import":O,"layer-readme-required":$n,"require-domain-entities-naming":Yi}},Ma=`@longzai-intelligence/architecture-electron`,Na={meta:{name:Ma,version:`1.0.0`},rules:{"platform-leak":x,"no-implementation-in-renderer":It,"no-unsafe-electron-api-exposure":An,"no-generic-ipc-bridge-exposure":Pn,"no-direct-ipcrenderer-in-preload":In,"tsconfig-references":hi,"require-typed-ipc-channel":_i,"require-expose-safe-api":bi,"no-custom-ipc-utility":Ci,"require-unwrap-ipc-result":Oi}},Pa=`@longzai-intelligence/architecture-library`,Fa={meta:{name:Pa,version:`1.0.0`},rules:{"test-file-placement":rn,"no-non-test-files-in-tests-directory":fn,"test-file-matches-source":W,"require-tsup-config-import":jr,"require-tsdown-config-import":Fr,"require-vitest-config-import":qr,"require-eslint-config-import":ti}},Ia=`@longzai-intelligence/architecture`,La={meta:{name:Ia,version:`1.0.0`},rules:{"dependency-direction":be,"no-core-types-in-apps":_,"platform-leak":x,"business-leak":C,"domain-export":D,"domain-typeorm-import":O,"file-naming":Dt,"require-type-suffix":Mt,"no-implementation-in-renderer":It,"no-cross-package-relative-import":Ut,"test-file-placement":rn,"no-non-test-files-in-tests-directory":fn,"test-file-matches-source":W,"no-unsafe-electron-api-exposure":An,"no-generic-ipc-bridge-exposure":Pn,"no-direct-ipcrenderer-in-preload":In,"prefer-split-export-const":Wn,"layer-readme-required":$n,"require-class-suffix":sr,"require-interface-naming":yr,"require-type-naming":Cr,"require-dto-naming":Dr,"require-tsup-config-import":jr,"require-tsdown-config-import":Fr,"require-vitest-config-import":qr,"require-eslint-config-import":ti,"tsconfig-references":hi,"require-typed-ipc-channel":_i,"require-expose-safe-api":bi,"no-custom-ipc-utility":Ci,"require-unwrap-ipc-result":Oi,"no-class-suffix-alias":Mi,"implementation-export-control":Ii,"require-domain-entities-naming":Yi,"no-implementation-import-in-apps":ca}};export{Oa as CORE_PLUGIN_NAME,Aa as DOMAIN_PLUGIN_NAME,Ma as ELECTRON_PLUGIN_NAME,Pa as LIBRARY_PLUGIN_NAME,Ia as PLUGIN_NAME,ka as architectureCorePlugin,ja as architectureDomainPlugin,Na as architectureElectronPlugin,Fa as architectureLibraryPlugin,La as architecturePlugin};
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@longzai-intelligence/eslint-plugin-architecture",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.cjs",
|
|
6
|
+
"types": "./dist/index.d.mts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": {
|
|
10
|
+
"import": "./dist/index.d.mts",
|
|
11
|
+
"require": "./dist/index.d.cts"
|
|
12
|
+
},
|
|
13
|
+
"import": "./dist/index.mjs",
|
|
14
|
+
"require": "./dist/index.cjs"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "tsdown",
|
|
22
|
+
"build:prod": "NODE_ENV=production tsdown",
|
|
23
|
+
"prepublish": "bun run build:prod",
|
|
24
|
+
"dev": "tsdown --watch",
|
|
25
|
+
"clean": "rimraf dist",
|
|
26
|
+
"test": "vitest run",
|
|
27
|
+
"test:watch": "vitest",
|
|
28
|
+
"test:coverage": "vitest run --coverage",
|
|
29
|
+
"lint": "eslint .",
|
|
30
|
+
"lint:fix": "eslint . --fix",
|
|
31
|
+
"typecheck": "bun run typecheck:app && bun run typecheck:node && bun run typecheck:test",
|
|
32
|
+
"typecheck:app": "tsc --noEmit -p tsconfig/app.json",
|
|
33
|
+
"typecheck:node": "tsc --noEmit -p tsconfig/node.json",
|
|
34
|
+
"typecheck:test": "tsc --noEmit -p tsconfig/test.json"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"eslint": "^10.0.0",
|
|
38
|
+
"typescript": "^5.9.3"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@longzai-intelligence/eslint-utils": "workspace:*",
|
|
42
|
+
"@typescript-eslint/utils": "^8.57.2"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@longzai-intelligence/eslint-config": "workspace:*",
|
|
46
|
+
"@longzai-intelligence/typescript-config": "0.0.2",
|
|
47
|
+
"@longzai-intelligence/vitest-config": "0.0.1",
|
|
48
|
+
"@types/node": "^25.5.0",
|
|
49
|
+
"rimraf": "^6.1.3",
|
|
50
|
+
"vitest": "^4.1.1",
|
|
51
|
+
"tsdown": "^0.21.7",
|
|
52
|
+
"@longzai-intelligence/tsdown-config": "0.0.1"
|
|
53
|
+
},
|
|
54
|
+
"packageManager": "bun@1.3.11",
|
|
55
|
+
"license": "UNLICENSED",
|
|
56
|
+
"module": "./dist/index.mjs"
|
|
57
|
+
}
|