refactor(types): move shared types from renderer to shared directory

- Move type definitions from src/renderer/src/types/ to src/shared/types/
- Add @shared/* path alias to tsconfig.node.json and tsconfig.web.json
- Update all imports from @renderer/types/* to @shared/types/*
- Update AGENTS.md with new directory structure and path alias

This fixes architecture violation where main/preload processes imported
from renderer directory. Types are now properly shared across all processes.
This commit is contained in:
2026-03-12 12:57:21 +08:00
parent 1e9a01b6c1
commit 0945d7f0b2
22 changed files with 41 additions and 41 deletions

View File

@@ -38,13 +38,14 @@ src/
├── preload/ # Preload 脚本
│ ├── index.ts # 暴露 API 到渲染进程
│ └── index.d.ts # 类型声明
├── shared/ # 跨进程共享代码
│ └── types/ # 共享类型定义
└── renderer/ # React 渲染进程
└── src/
├── main.tsx # React 入口
├── App.tsx # 根组件
├── components/ # React 组件
── stores/ # Zustand Stores
└── types/ # TypeScript 类型
── stores/ # Zustand Stores
```
## 3. 路径别名
@@ -54,7 +55,7 @@ src/
| `@renderer/*` | `src/renderer/src/*` |
| `@main/*` | `src/main/*` |
| `@preload/*` | `src/preload/*` |
| `@shared/*` | `src/shared/*` |
## 4. 代码风格
### 导入顺序