@dtt_siye/atool 1.2.1 → 1.3.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/VERSION +1 -1
- package/hooks/session-start +9 -12
- package/lib/export-analysis.sh +100 -0
- package/lib/install-kiro.sh +11 -6
- package/lib/install-skills.sh +16 -0
- package/lib/knowledge-graph.sh +490 -83
- package/lib/pre-scan.sh +70 -5
- package/package.json +1 -1
- package/skills/doc-standards-enforcer/SKILL.md +200 -220
- package/skills/doc-standards-enforcer/examples/valid-document-example.md +5 -5
- package/skills/doc-standards-enforcer/references/101-standards-summary.md +17 -17
- package/skills/project-analyze/SKILL.md +157 -124
- package/skills/project-analyze/phases/{phase0-discovery.md → archive/phase0-discovery.md} +6 -2
- package/skills/project-analyze/phases/{phase1-inventory.md → archive/phase1-inventory.md} +10 -0
- package/skills/project-analyze/phases/{phase2-deep-analysis.md → archive/phase2-deep-analysis.md} +20 -0
- package/skills/project-analyze/phases/{phase3-knowledge-graph.md → archive/phase3-knowledge-graph.md} +31 -0
- package/skills/project-analyze/phases/{phase3a-multi-dimensional.md → archive/phase3a-multi-dimensional.md} +13 -0
- package/skills/project-analyze/phases/{phase5-synthesis.md → archive/phase5-synthesis.md} +20 -0
- package/skills/project-analyze/phases/phase1-setup.md +182 -0
- package/skills/project-analyze/phases/phase2-understand.md +114 -0
- package/skills/project-analyze/phases/phase2.5-refine.md +284 -0
- package/skills/project-analyze/phases/phase3-graph.md +77 -0
- package/skills/project-analyze/phases/phase4-synthesize.md +241 -0
- package/skills/project-analyze/phases/phase5-export.md +207 -0
- package/skills/project-analyze/prompts/{deep-analysis-agent.md → archive/deep-analysis-agent.md} +14 -1
- package/skills/project-analyze/prompts/understand-agent.md +424 -0
- package/skills/project-analyze/rules/android.md +61 -260
- package/skills/project-analyze/rules/devops.md +61 -421
- package/skills/project-analyze/rules/generic.md +53 -221
- package/skills/project-analyze/rules/go.md +60 -275
- package/skills/project-analyze/rules/harmony.md +64 -237
- package/skills/project-analyze/rules/java.md +47 -485
- package/skills/project-analyze/rules/mobile-flutter.md +57 -292
- package/skills/project-analyze/rules/mobile-react-native.md +65 -262
- package/skills/project-analyze/rules/mobile-swift.md +58 -303
- package/skills/project-analyze/rules/python.md +50 -296
- package/skills/project-analyze/rules/rust-tauri.md +51 -217
- package/skills/project-analyze/rules/rust.md +50 -274
- package/skills/project-analyze/rules/web-nextjs.md +61 -335
- package/skills/project-analyze/rules/web-react.md +50 -272
- package/skills/project-analyze/rules/web-vue.md +58 -352
- package/skills/project-analyze/rules/web.md +55 -347
- package/skills/requirements-writer/README.md +1 -1
- package/skills/requirements-writer/SKILL.md +423 -282
- package/skills/requirements-writer/examples/prd-outline-example.md +5 -5
- package/skills/requirements-writer/templates/module-prd-template.md +15 -15
- package/skills/requirements-writer/templates/prd-outline-template.md +3 -3
- package/skills/requirements-writer/templates/user-story-template.md +23 -23
- package/skills/software-architecture/SKILL.md +318 -17
- package/templates/CLAUDE.md.android +17 -0
- package/templates/CLAUDE.md.devops +17 -0
- package/templates/CLAUDE.md.generic +17 -0
- package/templates/CLAUDE.md.go +17 -0
- package/templates/CLAUDE.md.harmony +17 -0
- package/templates/CLAUDE.md.java +17 -0
- package/templates/CLAUDE.md.mobile-flutter +17 -0
- package/templates/CLAUDE.md.mobile-react-native +17 -0
- package/templates/CLAUDE.md.mobile-swift +17 -0
- package/templates/CLAUDE.md.python +17 -0
- package/templates/CLAUDE.md.rust +17 -0
- package/templates/CLAUDE.md.rust-tauri +17 -0
- package/templates/CLAUDE.md.web +17 -0
- package/templates/cursor-rules.android.mdc +17 -0
- package/templates/cursor-rules.devops.mdc +17 -0
- package/templates/cursor-rules.generic.mdc +17 -0
- package/templates/cursor-rules.go.mdc +17 -0
- package/templates/cursor-rules.harmony.mdc +17 -0
- package/templates/cursor-rules.java.mdc +17 -0
- package/templates/cursor-rules.mobile-flutter.mdc +17 -0
- package/templates/cursor-rules.mobile-react-native.mdc +17 -0
- package/templates/cursor-rules.mobile-swift.mdc +17 -0
- package/templates/cursor-rules.python.mdc +17 -0
- package/templates/cursor-rules.rust-tauri.mdc +17 -0
- package/templates/cursor-rules.rust.mdc +17 -0
- package/templates/cursor-rules.web.mdc +17 -0
- package/templates/kiro-steering.android.md +6 -0
- package/templates/kiro-steering.devops.md +6 -0
- package/templates/kiro-steering.generic.md +6 -0
- package/templates/kiro-steering.go.md +6 -0
- package/templates/kiro-steering.harmony.md +6 -0
- package/templates/kiro-steering.java.md +6 -0
- package/templates/kiro-steering.mobile-flutter.md +6 -0
- package/templates/kiro-steering.mobile-react-native.md +6 -0
- package/templates/kiro-steering.mobile-swift.md +6 -0
- package/templates/kiro-steering.python.md +6 -0
- package/templates/kiro-steering.rust-tauri.md +6 -0
- package/templates/kiro-steering.rust.md +6 -0
- package/templates/kiro-steering.web.md +6 -0
- package/templates/shared/hard-rules.md +21 -0
- /package/skills/project-analyze/phases/{phase0.5-prescan.md → archive/phase0.5-prescan.md} +0 -0
- /package/skills/project-analyze/phases/{phase2a-l4-analysis.md → archive/phase2a-l4-analysis.md} +0 -0
- /package/skills/project-analyze/phases/{phase2b-l5-analysis.md → archive/phase2b-l5-analysis.md} +0 -0
- /package/skills/project-analyze/phases/{phase4-code-quality.md → archive/phase4-code-quality.md} +0 -0
- /package/skills/project-analyze/phases/{phase6-validation.md → archive/phase6-validation.md} +0 -0
- /package/skills/project-analyze/prompts/{code-review-agent.md → archive/code-review-agent.md} +0 -0
- /package/skills/project-analyze/prompts/{inventory-agent.md → archive/inventory-agent.md} +0 -0
- /package/skills/project-analyze/prompts/{l4-analysis-agent.md → archive/l4-analysis-agent.md} +0 -0
|
@@ -2,297 +2,75 @@
|
|
|
2
2
|
|
|
3
3
|
React 项目专属分析规则,与 `rules/web.md` 配合使用。本文件中的规则优先于 `web.md` 中的同名字段。适用于 React SPA、Next.js(App Router / Pages Router)。
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
> **编码规范**:本规则不包含编码规范内容。Phase 2.5 精炼阶段会自动加载 `web-conventions` skill 作为规范约束。
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## 模块发现策略
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
React 组件树
|
|
11
|
-
├── Pages(路由级组件)
|
|
12
|
-
├── Components(UI 组件)
|
|
13
|
-
│ ├── UI 组件(纯展示)
|
|
14
|
-
│ └── Container 组件(含逻辑)
|
|
15
|
-
├── Hooks(自定义 Hook)
|
|
16
|
-
├── Context / Store(全局状态)
|
|
17
|
-
├── Services(API 调用)
|
|
18
|
-
├── Types(TypeScript 类型)
|
|
19
|
-
└── Styles(CSS Modules / Tailwind)
|
|
20
|
-
```
|
|
9
|
+
React 项目按组件树 + Hooks + 状态管理分层发现模块边界:
|
|
21
10
|
|
|
22
|
-
|
|
11
|
+
- **页面模块**: `src/pages/` 或 `src/app/` 下每个子目录
|
|
12
|
+
- **组件模块**: `src/components/{name}/` 下 3+ 文件的子目录
|
|
13
|
+
- **状态模块**: `src/store/slices/` 或 `src/stores/` 下每个子目录
|
|
14
|
+
- **Hooks 模块**: `src/hooks/` 下每个文件
|
|
23
15
|
|
|
24
|
-
|
|
16
|
+
不视为独立模块:单文件入口(`main.tsx`, `App.tsx`)、纯导出桶文件、`utils/`/`helpers/` 目录。
|
|
25
17
|
|
|
26
|
-
|
|
27
|
-
- 组件名 + 文件路径
|
|
28
|
-
- Props TypeScript interface(完整字段定义)
|
|
29
|
-
- Children 类型
|
|
30
|
-
- 使用的自定义 Hooks(`useXxx()`)
|
|
31
|
-
- JSX Element Tree(子组件结构,1-2 层深度)
|
|
32
|
-
- 条件渲染逻辑
|
|
33
|
-
- `key` 使用模式
|
|
18
|
+
## 入口识别
|
|
34
19
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
-
|
|
39
|
-
- **Props Interface**:
|
|
40
|
-
```typescript
|
|
41
|
-
interface UserListProps {
|
|
42
|
-
/** 筛选的角色 ID */
|
|
43
|
-
roleId?: string;
|
|
44
|
-
/** 是否为只读模式 */
|
|
45
|
-
readonly?: boolean;
|
|
46
|
-
}
|
|
47
|
-
```
|
|
48
|
-
- **使用的 Hooks**:
|
|
49
|
-
| Hook | 来源 | 用途 |
|
|
50
|
-
|------|------|------|
|
|
51
|
-
| useUserStore | stores/userStore | 获取用户列表和操作方法 |
|
|
52
|
-
| usePagination | hooks/usePagination | 分页逻辑 |
|
|
53
|
-
| useDebounce | hooks/useDebounce | 搜索输入防抖 |
|
|
54
|
-
- **JSX 结构**(1 层):
|
|
55
|
-
<PageHeader title="用户管理" />
|
|
56
|
-
<SearchForm onSearch={handleSearch} />
|
|
57
|
-
{loading ? <Spin /> : <UserTable data={users} onSelect={handleSelect} />}
|
|
58
|
-
<Pagination {...paginationProps} />
|
|
59
|
-
<UserFormDialog visible={dialogVisible} onClose={handleClose} />
|
|
60
|
-
- **条件渲染**:
|
|
61
|
-
| 条件 | 渲染内容 |
|
|
62
|
-
|------|----------|
|
|
63
|
-
| loading | <Spin /> 加载动画 |
|
|
64
|
-
| users.length === 0 | <Empty description="暂无数据" /> |
|
|
65
|
-
```
|
|
20
|
+
- React Router: `src/App.tsx` 中的 `<BrowserRouter>` / `<Routes>` 结构,或 `src/routes/` 目录
|
|
21
|
+
- React.lazy + Suspense: 代码分割入口,说明哪些路由是异步加载
|
|
22
|
+
- Protected Route 模式: `<ProtectedRoute>` 或 `<RequireAuth>` 包裹的路由段
|
|
23
|
+
- Context Provider 嵌套: `_app.tsx` 或根组件中的 Provider 树(状态、主题、认证)
|
|
66
24
|
|
|
67
|
-
##
|
|
25
|
+
## 架构模式识别
|
|
68
26
|
|
|
69
|
-
|
|
27
|
+
通过文件结构判断组织模式:
|
|
70
28
|
|
|
71
|
-
|
|
29
|
+
| 特征 | 架构模式 |
|
|
30
|
+
|------|----------|
|
|
31
|
+
| `src/pages/` + `src/components/` + `src/hooks/` | 传统分层 |
|
|
32
|
+
| `src/features/{name}/{components,hooks,store}/` | Feature-based |
|
|
33
|
+
| `src/domain/` + `src/infrastructure/` | Domain-driven |
|
|
34
|
+
| `atoms/`, `molecules/`, `organisms/` | Atomic Design |
|
|
72
35
|
|
|
73
|
-
|
|
74
|
-
- Slice 名称 + Reducer 路径
|
|
75
|
-
- State 接口(所有字段 + 类型 + 初始值)
|
|
76
|
-
- Reducers(名称 + 参数 + 修改的 state)
|
|
77
|
-
- ExtraReducers(异步 Thunk 的 pending/fulfilled/rejected)
|
|
78
|
-
- Selectors(名称 + 返回类型)
|
|
36
|
+
## 数据流模式
|
|
79
37
|
|
|
80
|
-
|
|
81
|
-
```
|
|
82
|
-
### userSlice
|
|
83
|
-
- **文件**: `src/store/slices/userSlice.ts`
|
|
84
|
-
- **Reducer Path**: `'user'`
|
|
85
|
-
- **State 接口**:
|
|
86
|
-
```typescript
|
|
87
|
-
interface UserState {
|
|
88
|
-
list: UserVO[];
|
|
89
|
-
total: number;
|
|
90
|
-
current: UserVO | null;
|
|
91
|
-
loading: boolean;
|
|
92
|
-
error: string | null;
|
|
93
|
-
}
|
|
94
|
-
```
|
|
95
|
-
- **Reducers**:
|
|
96
|
-
| Reducer | 参数 | 说明 |
|
|
97
|
-
|---------|------|------|
|
|
98
|
-
| setCurrentUser | (state, action: PayloadAction<UserVO>) | 设置当前用户 |
|
|
99
|
-
| clearError | (state) | 清除错误信息 |
|
|
100
|
-
- **ExtraReducers**:
|
|
101
|
-
| Action | State 变更 |
|
|
102
|
-
|--------|-----------|
|
|
103
|
-
| fetchUsers.pending | loading = true |
|
|
104
|
-
| fetchUsers.fulfilled | list = payload.list, total = payload.total, loading = false |
|
|
105
|
-
| fetchUsers.rejected | error = payload, loading = false |
|
|
106
|
-
- **Selectors**:
|
|
107
|
-
| 名称 | 返回类型 | 说明 |
|
|
108
|
-
|------|----------|------|
|
|
109
|
-
| selectUserList | UserVO[] | 用户列表 |
|
|
110
|
-
| selectCurrentUser | UserVO \| null | 当前选中用户 |
|
|
111
|
-
```
|
|
38
|
+
**Redux Toolkit 检测**:扫描 `src/store/slices/`,识别 Slice 名称、State 接口、ExtraReducers(Thunk 异步)、Selectors。
|
|
112
39
|
|
|
113
|
-
|
|
40
|
+
**Zustand 检测**:扫描 `src/stores/*.ts`,识别 Store 名称、State 字段、Actions、persist/devtools 中间件。
|
|
114
41
|
|
|
115
|
-
|
|
42
|
+
**React Query / SWR 检测**:识别 `useQuery`/`useMutation`/`useSWR` 的 Query Key 和数据源。
|
|
116
43
|
|
|
117
|
-
|
|
118
|
-
- Store 名称 + 创建方式(`create`)
|
|
119
|
-
- State 字段(名称 + 类型)
|
|
120
|
-
- Actions(签名 + 说明)
|
|
121
|
-
- 中间件配置(persist, devtools, immer)
|
|
44
|
+
**Context API 检测**:扫描 `src/context/*.tsx`,识别 Provider 嵌套层级和 Consumer 使用位置。
|
|
122
45
|
|
|
123
|
-
|
|
124
|
-
```
|
|
125
|
-
### useAuthStore
|
|
126
|
-
- **文件**: `src/stores/authStore.ts`
|
|
127
|
-
- **State**:
|
|
128
|
-
| 字段 | 类型 | 说明 |
|
|
129
|
-
|------|------|------|
|
|
130
|
-
| token | string \| null | JWT token |
|
|
131
|
-
| user | User \| null | 当前用户 |
|
|
132
|
-
| isAuthenticated | boolean | 是否已认证 |
|
|
133
|
-
- **Actions**:
|
|
134
|
-
| Action | 签名 | 说明 |
|
|
135
|
-
|--------|------|------|
|
|
136
|
-
| login | (credentials: LoginForm) => Promise<void> | 登录 |
|
|
137
|
-
| logout | () => void | 登出 |
|
|
138
|
-
| setUser | (user: User) => void | 设置用户信息 |
|
|
139
|
-
- **中间件**: persist (key: 'auth-store', storage: localStorage)
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
## React Router 分析
|
|
46
|
+
## 分析关注点
|
|
143
47
|
|
|
144
|
-
|
|
48
|
+
- **版本检测**: React 18(Concurrent Mode/Suspense)vs React 19(Server Components/Actions)
|
|
49
|
+
- **Hooks 依赖图**: `useEffect` 依赖数组问题(过度/缺少依赖),自定义 Hook 调用链
|
|
50
|
+
- **Server vs Client 边界**: `'use client'` 边界在何处,哪些组件是纯 Server Component
|
|
51
|
+
- **Code Splitting**: `React.lazy` 入口数量及是否按路由分割
|
|
52
|
+
- **状态提升位置**: Context Provider 范围是否合理(全局 vs 局部)
|
|
145
53
|
|
|
146
|
-
|
|
147
|
-
- 路由配置(path + element + loader)
|
|
148
|
-
- 嵌套布局(Layout + Outlet)
|
|
149
|
-
- 路由参数(useParams, useSearchParams)
|
|
150
|
-
- 受保护路由(ProtectedRoute 模式)
|
|
151
|
-
- 代码分割(React.lazy + Suspense)
|
|
54
|
+
## 输出示例
|
|
152
55
|
|
|
153
|
-
**输出示例**:
|
|
154
56
|
```
|
|
155
|
-
###
|
|
156
|
-
**App Router (Next.js)**:
|
|
57
|
+
### 路由结构(App Router)
|
|
157
58
|
app/
|
|
158
|
-
├── layout.tsx
|
|
159
|
-
├── page.tsx → /
|
|
59
|
+
├── layout.tsx → RootLayout(全局 Provider)
|
|
160
60
|
├── (auth)/
|
|
161
|
-
│ ├──
|
|
162
|
-
│
|
|
163
|
-
|
|
164
|
-
├──
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
-
|
|
176
|
-
- **检查逻辑**: useAuthStore().isAuthenticated → false → 重定向
|
|
177
|
-
- **角色检查**: `<RoleGate roles={['admin']}><AdminPanel /></RoleGate>`
|
|
61
|
+
│ ├── login/page.tsx → /login(Client Component,表单交互)
|
|
62
|
+
│ └── register/page.tsx → /register
|
|
63
|
+
└── (dashboard)/
|
|
64
|
+
├── layout.tsx → DashboardLayout(侧边栏+顶栏)
|
|
65
|
+
└── dashboard/page.tsx → /dashboard(Server Component,数据预取)
|
|
66
|
+
|
|
67
|
+
### useAuthStore(Zustand)
|
|
68
|
+
- State: token (string|null), user (User|null), isAuthenticated (boolean)
|
|
69
|
+
- Actions: login(credentials), logout(), setUser(user)
|
|
70
|
+
- 中间件: persist(key: 'auth-store', storage: localStorage)
|
|
71
|
+
|
|
72
|
+
### useFetch(自定义 Hook)
|
|
73
|
+
- 签名: useFetch<T>(url, options?) → { data, loading, error, refetch }
|
|
74
|
+
- 内部依赖: axios 实例, useAuthStore (获取 token)
|
|
75
|
+
- 副作用: enabled 参数控制是否自动请求
|
|
178
76
|
```
|
|
179
|
-
|
|
180
|
-
## 自定义 Hooks 分析
|
|
181
|
-
|
|
182
|
-
**扫描文件**: `src/hooks/**/*.ts`, `src/hooks/**/*.tsx`
|
|
183
|
-
|
|
184
|
-
**提取内容**:
|
|
185
|
-
- Hook 名称 + 路径
|
|
186
|
-
- 参数签名(TypeScript 类型)
|
|
187
|
-
- 返回值签名(TypeScript 类型)
|
|
188
|
-
- 内部依赖(API 调用、其他 Hook、Context)
|
|
189
|
-
- 副作用(useEffect 中的逻辑)
|
|
190
|
-
|
|
191
|
-
**输出示例**:
|
|
192
|
-
```
|
|
193
|
-
### useFetch
|
|
194
|
-
- **路径**: `src/hooks/useFetch.ts`
|
|
195
|
-
- **签名**:
|
|
196
|
-
```typescript
|
|
197
|
-
function useFetch<T>(
|
|
198
|
-
url: string,
|
|
199
|
-
options?: {
|
|
200
|
-
params?: Record<string, string>;
|
|
201
|
-
enabled?: boolean;
|
|
202
|
-
retry?: number;
|
|
203
|
-
}
|
|
204
|
-
): {
|
|
205
|
-
data: T | null;
|
|
206
|
-
loading: boolean;
|
|
207
|
-
error: Error | null;
|
|
208
|
-
refetch: () => void;
|
|
209
|
-
}
|
|
210
|
-
```
|
|
211
|
-
- **内部依赖**: axios 实例, useAuthStore (获取 token)
|
|
212
|
-
- **副作用**: 组件挂载时自动请求;`enabled` 参数控制是否自动请求
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-
## 样式分析
|
|
216
|
-
|
|
217
|
-
### CSS Modules
|
|
218
|
-
|
|
219
|
-
**扫描文件**: `src/**/*.module.css`, `src/**/*.module.scss`
|
|
220
|
-
|
|
221
|
-
**提取内容**:
|
|
222
|
-
- CSS Module 文件列表
|
|
223
|
-
- 导出的 class 名称
|
|
224
|
-
|
|
225
|
-
### Tailwind CSS
|
|
226
|
-
|
|
227
|
-
**扫描文件**: `tailwind.config.*`, `src/**/*.tsx` 中的 Tailwind 类名
|
|
228
|
-
|
|
229
|
-
**提取内容**:
|
|
230
|
-
- 自定义颜色(`theme.extend.colors`)
|
|
231
|
-
- 自定义间距(`theme.extend.spacing`)
|
|
232
|
-
- 自定义断点(`theme.extend.screens`)
|
|
233
|
-
- 常用组件的 Tailwind 类模式
|
|
234
|
-
|
|
235
|
-
**输出示例**:
|
|
236
|
-
```
|
|
237
|
-
### Tailwind 自定义配置
|
|
238
|
-
**来源**: `tailwind.config.ts`
|
|
239
|
-
| Token | 值 | 用途 |
|
|
240
|
-
|-------|------|------|
|
|
241
|
-
| colors.primary | '#3B82F6' | 主色调 |
|
|
242
|
-
| colors.secondary | '#8B5CF6' | 辅助色 |
|
|
243
|
-
| screens.xl | '1440px' | 超大屏 |
|
|
244
|
-
| spacing.sidebar | '280px' | 侧边栏宽度 |
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
## 输出模板
|
|
248
|
-
|
|
249
|
-
### COMPONENT.md 章节结构(React 特有)
|
|
250
|
-
|
|
251
|
-
```markdown
|
|
252
|
-
# 组件文档
|
|
253
|
-
|
|
254
|
-
## Pages(页面组件)
|
|
255
|
-
按路由分组,每个页面包含:
|
|
256
|
-
- 路径 + 布局组件
|
|
257
|
-
- Props Interface
|
|
258
|
-
- 使用的 Hooks
|
|
259
|
-
- JSX 结构(1-2 层)
|
|
260
|
-
- 路由参数 / Query 参数
|
|
261
|
-
|
|
262
|
-
## Components(UI 组件)
|
|
263
|
-
### Container 组件(含业务逻辑)
|
|
264
|
-
### UI 组件(纯展示)
|
|
265
|
-
|
|
266
|
-
## Hooks
|
|
267
|
-
自定义 Hook 列表及文档
|
|
268
|
-
|
|
269
|
-
## Store 详解
|
|
270
|
-
Redux Slices / Zustand Stores 完整文档
|
|
271
|
-
|
|
272
|
-
## 路由详解
|
|
273
|
-
路由结构 + 保护逻辑 + 代码分割
|
|
274
|
-
```
|
|
275
|
-
|
|
276
|
-
## 模块边界识别
|
|
277
|
-
|
|
278
|
-
以下目录模式下的每个子目录视为独立模块(L2+ 分析时生成 MODULE-DOC.md):
|
|
279
|
-
|
|
280
|
-
| 层 | 扫描路径 | 模块判定规则 | MODULE-DOC slug 来源 |
|
|
281
|
-
|----|----------|-------------|---------------------|
|
|
282
|
-
| 页面/视图层 | `src/pages/`, `src/app/` | 每个子目录 | 目录名 kebab-case |
|
|
283
|
-
| API/服务层 | `src/services/`, `src/api/` | 每个子目录 | 目录名 kebab-case |
|
|
284
|
-
| 状态管理层 | `src/store/`, `src/stores/` | 每个子目录 | 目录名 kebab-case |
|
|
285
|
-
| 组件层 | `src/components/{name}/` | 3+ 文件的子目录 | 目录名 kebab-case |
|
|
286
|
-
| Hooks 层 | `src/hooks/` | 每个文件 | 文件名去后缀 kebab-case |
|
|
287
|
-
|
|
288
|
-
**不视为独立模块的情况**:
|
|
289
|
-
- 单文件入口(如 `main.tsx`, `App.tsx`, `index.ts`)
|
|
290
|
-
- 纯导出桶文件(`index.ts` 仅有 re-export)
|
|
291
|
-
- 工具函数目录(`utils/`, `helpers/`)— 合并为一个模块
|
|
292
|
-
|
|
293
|
-
## Token 管理
|
|
294
|
-
|
|
295
|
-
- 每个子任务分析 ≤10 个 `.tsx` 文件
|
|
296
|
-
- Store / Slice 文件单独分组
|
|
297
|
-
- 自定义 Hook 文件单独分组
|
|
298
|
-
- Context Provider 文件单独分组
|