@agile-team/wl-skills-kit 2.4.1 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,322 +1,361 @@
1
- # 产品化前端编码指令
2
-
3
- > 本文件由 AI 编辑器自动加载(VS Code Copilot / Cursor / Windsurf 等),确保生成代码符合项目规范。
4
- > **前置要求**:AI 首次进入项目时,建议先阅读 `README.md` 了解产品化架构全景。后续对话中依赖本文件的规范约定即可,无需重复扫描。
5
-
6
- ## 架构
7
-
8
- - Vue 3.2 + Vite + TypeScript(strict: false)
9
- - Module Federation **子应用**,路由/权限/布局/Store 从主应用 `main` 远程加载
10
- - UI:Element Plus + @jhlc/jh-ui + @jhlc/common-core
11
- - 样式:Windi CSS + SCSS
12
- - 状态:Pinia
13
- - 页面注册:`vite/plugins/shared/pages.ts` 通过 `gProd()` / `gSale()` 声明
14
- - 菜单路由配置:后端菜单表是唯一数据源。pages.ts 注册组件后,需在系统管理后台 → 菜单管理 → 新增菜单。批量新增页面时可用后端 batchImport 接口,详见 `.github/skills/sync/menu-sync/SKILL.md`
15
-
16
- ## 页面标准结构(三文件分离 + 接口契约)
17
-
18
- ```
19
- src/views/[域]/[模块]/[子模块]/[kebab-case目录]/
20
- ├── index.vue ← 纯模板+解构,不写业务逻辑
21
- ├── data.ts ← AbstractPageQueryHook 类 + API_CONFIG
22
- ├── index.scss ← 页面样式(可为空)
23
- └── api.md ← 接口约定(前端预留 + 后端出接口依据)
24
- ```
25
-
26
- 弹窗组件处理策略:
27
-
28
- - **通用弹窗**(新增/编辑表单,2+ 页面可复用)→ 提取到 `src/components/local/c_xxxModal/`
29
- - **极个性弹窗**(仅单页面使用,c_modal 无法满足)→ 放在页面 `components/xxxModal.vue`
30
-
31
- ## data.ts 核心模式
32
-
33
- > 配置化驱动,通过 `API_CONFIG` + `class extends AbstractPageQueryHook` 实现零 API 层开发。
34
- > 基类内置 `getAction`/`postAction`/`putAction`/`deleteAction`/`actionBatch` 等 HTTP 方法(详见 `docs/request.md`),标准 CRUD 无需独立 API 文件。
35
-
36
- ```typescript
37
- import { AbstractPageQueryHook } from "@jhlc/common-core/src/page-hooks/page-query-hook.ts";
38
- import { BaseQueryItemDesc } from "@jhlc/common-core/src/components/form/base-query/type.ts";
39
- import { ActionButtonDesc } from "@jhlc/common-core/src/components/toolbar/type.ts";
40
- import { TableColumnDesc } from "@jhlc/common-core/src/components/table/base-table/type.ts";
41
- import { BusLogicDataType } from "@jhlc/types/src/logical-data";
42
- import { getAction, postAction } from "@jhlc/common-core/src/api/action";
43
-
44
- export const API_CONFIG = {
45
- list: "/[服务缩写]/[资源名]/list",
46
- remove: "/[服务缩写]/[资源名]/remove",
47
- getById: "/[服务缩写]/[资源名]/getById",
48
- save: "/[服务缩写]/[资源名]/save",
49
- update: "/[服务缩写]/[资源名]/update",
50
- export: "/[服务缩写]/[资源名]/export"
51
- } as const;
52
-
53
- export function createPage(addModalRef?: any) {
54
- let Page = new (class extends AbstractPageQueryHook {
55
- constructor() {
56
- super({ url: { list: API_CONFIG.list, remove: API_CONFIG.remove } });
57
- }
58
- queryDef(): BaseQueryItemDesc<any>[] {
59
- return [
60
- { name: "fieldName", label: "字段名", placeholder: "请输入" },
61
- {
62
- name: "status",
63
- label: "状态",
64
- logicType: BusLogicDataType.dict,
65
- logicValue: "dictCode"
66
- }
67
- ];
68
- }
69
- toolbarDef(): ActionButtonDesc[] {
70
- return [
71
- {
72
- name: "primary",
73
- label: "新增",
74
- plain: true,
75
- onClick: () => addModalRef?.value?.open()
76
- }
77
- ];
78
- }
79
- columnsDef(): TableColumnDesc<any>[] {
80
- return [
81
- { type: "selection" },
82
- { type: "index" },
83
- {
84
- label: "字段名",
85
- name: "fieldName",
86
- minWidth: 120,
87
- sortable: true,
88
- filterable: true
89
- },
90
- {
91
- label: "状态",
92
- name: "status",
93
- minWidth: 100,
94
- logicType: BusLogicDataType.dict,
95
- logicValue: "dictCode",
96
- sortable: true,
97
- filterable: true
98
- }
99
- ];
100
- }
101
- })();
102
- return Page.create() as any;
103
- }
104
- ```
105
-
106
- ## index.vue 标准模板
107
-
108
- ```vue
109
- <template>
110
- <div class="app-container app-page-container">
111
- <BaseQuery
112
- :form="queryParam"
113
- :items="queryItems"
114
- @select="select"
115
- @reset="select"
116
- />
117
- <BaseToolbar :items="toolbars" />
118
- <BaseTable ref="tableRef" :data="list" :columns="columns" showToolbar />
119
- <jh-pagination
120
- v-show="page.total && page.total > 0"
121
- :total="page.total || 0"
122
- v-model:currentPage="page.current"
123
- v-model:pageSize="page.size"
124
- @current-change="select"
125
- @size-change="select"
126
- />
127
- </div>
128
- </template>
129
-
130
- <script setup lang="ts">
131
- import { createPage } from "./data";
132
-
133
- const Page = createPage();
134
- const {
135
- tableRef,
136
- page,
137
- queryParam,
138
- list,
139
- queryItems,
140
- columns,
141
- toolbars,
142
- select
143
- } = Page;
144
-
145
- onMounted(() => select());
146
- </script>
147
-
148
- <style scoped lang="scss">
149
- @import "./index.scss";
150
- </style>
151
- ```
152
-
153
- ## 命名规范
154
-
155
- | 位置 | 规范 | 示例 |
156
- | ------------ | ----------------------- | -------------------------------- |
157
- | 目录/路由 | kebab-case | `ompt-mill-plan/` |
158
- | pages.ts | `["kebab名", "中文名"]` | `["ompt-mill-plan", "轧钢计划"]` |
159
- | 字段名 | camelCase | `orderNo`, `planStatus` |
160
- | logicValue | camelCase | `planStatus`, `plineCode` |
161
- | 全局组件 | `C_PascalCase/` | `C_Tree/` |
162
- | 局部公共组件 | `c_camelCase/` | `c_modal/`、`c_detailPanel/` |
163
- | 页面私有组件 | camelCase | `addModal.vue`(仅极个性弹窗) |
164
-
165
- ## 平台组件速查
166
-
167
- | 用途 | 组件 | 来源 |
168
- | -------- | -------------- | -------------------------------- |
169
- | 查询区 | BaseQuery | @jhlc/common-core |
170
- | 工具栏 | BaseToolbar | @jhlc/common-core |
171
- | 表格 | BaseTable | @jhlc/common-core |
172
- | 分页 | jh-pagination | @jhlc/jh-ui |
173
- | 上下分栏 | jh-drag-row | @jhlc/jh-ui |
174
- | 下拉选择 | jh-select | @jhlc/jh-ui(dict 属性自动加载) |
175
- | 单日期 | jh-date | @jhlc/jh-ui |
176
- | 日期范围 | jh-date-range | @jhlc/jh-ui |
177
- | 用户选择 | jh-user-picker | @jhlc/jh-ui |
178
- | 部门选择 | jh-dept-picker | @jhlc/jh-ui |
179
- | 文件上传 | jh-file-upload | @jhlc/jh-ui |
180
- | 文本翻译 | jh-text | @jhlc/jh-ui |
181
- | 左右分割 | C_Splitter | src/components/global |
182
- | 树形面板 | C_Tree | src/components/global |
183
-
184
- ## 组件提取策略
185
-
186
- | 场景 | 位置 | 命名 |
187
- | ------------------------- | ------------------------------------- | ----------------------- |
188
- | 3+ 页面复用 | `src/components/global/C_PascalCase/` | 全局自动注册 |
189
- | 2+ 页面复用(如通用弹窗) | `src/components/local/c_camelCase/` | 按需导入,如 `c_modal/` |
190
- | 仅单页面使用 | 页面 `components/xxxModal.vue` | 仅当 c_modal 无法满足时 |
191
-
192
- ## 禁止事项
193
-
194
- - index.vue 中写业务逻辑(逻辑全在 data.ts)
195
- - 使用 Vuex(用 Pinia)
196
- - `::v-deep` / `/deep/`(用 `:deep()`)
197
- - 直接用 axios(用 getAction/postAction)
198
- - ❌ 手写查询表单/工具栏/分页(用 BaseQuery/BaseToolbar/jh-pagination)
199
- - ❌ 每个页面重复写弹窗组件(优先用 `c_modal` 等局部公共组件)
200
-
201
-
202
- ---
203
-
204
- ## 规范门控(standards/index.md 懒加载)
205
-
206
- > ⚠️ 本节为**强制约定**,所有 AI 编辑器/模型都必须遵守。
207
-
208
- 完整 13 条编码规范拆分在 `.github/standards/01 ~ 13.md`,由 `standards/index.md` 提供任务类型 → 规范子集映射,**按需加载,不全量读取**。
209
-
210
- | 任务类型 | 必读规范 |
211
- | --------------------- | ------------------------------------------------- |
212
- | A. 生成新页面 | 01, 02, 03, 04, 05, 06, 07, 09, 10, 11, 12, 13 |
213
- | B. 修改/重构现有代码 | 02, 04, 05, 06, 09, 10, 12, 13 |
214
- | C. 规范审计 | 全部 01 ~ 13 |
215
- | D. 模板提取 | 02, 03, 09, 12, 13 |
216
- | E. 数据同步(菜单等) | 04, 05, 07 |
217
- | F. Git/分支/提交 | 08 |
218
-
219
- **执行任何代码生成或改动前**:
220
- 1. `read_file` 加载 `standards/index.md` 确认任务类型
221
- 2. 按映射读取对应 `standards/0X-*.md`
222
- 3. Pre-flight 声明中列出已加载文件
223
-
224
- ---
225
-
226
- ## AI Skills 自动调度
227
-
228
- 完整触发词与 Skill 路径见 `skills/_registry.md`(**单一数据源**,不在此处重复)。
229
-
230
- | Skill 名 | 状态 | 一句话说明 |
231
- | -------------------- | -------- | --------------------------------------- |
232
- | prototype-scan | ✅ 启用 | 原型/详设 → page-spec JSON |
233
- | api-contract | 启用 | 生成 api.md 接口约定 |
234
- | page-codegen | ✅ 启用 | 页面骨架 + 模板调度 + 菜单追加 |
235
- | menu-sync | 启用 | reports/SYS_MENU_INFO → 后端菜单接口 |
236
- | convention-audit | ✅ 启用 | 13 条规范扫描 + 偏差报告 + 提取建议 |
237
- | template-extract | ✅ 启用 | 现有页面 → 领域模板沉淀 |
238
- | dict-sync | ✅ 启用 | 字典数据同步 |
239
- | permission-sync | 启用 | 角色+授权+动作权限同步(MCP) |
240
- | code-fix | ✅ 启用 | 自动整改 🟢🟡 等级偏差 |
241
-
242
- **执行规则**:
243
-
244
- 1. 用户消息匹配 `_registry.md` 触发词 `read_file` 加载对应 SKILL.md
245
- 2. SKILL.md 中标注的"必读 standards"按 standards/index.md 映射加载
246
- 3. SKILL.md 指示下输出 **Pre-flight 声明**(强制)
247
-
248
- ---
249
-
250
- ## Pre-flight 声明(强制约定式输出)
251
-
252
- 每次 Skill 触发时,**必须先输出**以下结构的 Pre-flight 声明,再开始执行:
253
-
254
- ```
255
- 🚀 已触发技能 {skill-name}/SKILL.md → {一句话用途}
256
- ✅ 已读取 standards/index.md → 规范门控
257
- 已读取 standards/{相关条目} → {一句话说明}
258
- ✅ 已读取 {其他必要文档} → {说明}
259
- ✅ 工具链检测:{各项 ✓ / ✗}
260
- ✅ {其他前置检查项,如 cid 生成等}
261
- ```
262
-
263
- **工具链检测失败必须暂停**:
264
-
265
- ```
266
- 工具链检测失败:未找到 {缺失文件}
267
- 请执行:npx @robot-admin/git-standards init
268
- → 或联系 CHENY(工号 409322)解决
269
- 任务已暂停,修复后重新触发
270
- ```
271
-
272
- ---
273
-
274
- ## 报告类文件(reports/)
275
-
276
- AI 生成的所有报告类文件统一写入 `.github/reports/`,**全部追加不覆盖**。
277
-
278
- | 文件 | 写入方 | 读取方 |
279
- | --------------------------------- | ------------------ | --------------------- |
280
- | `reports/SYS_MENU_INFO.md` | page-codegen | menu-sync |
281
- | `reports/SYS_DICT_INFO.md` | dict-collect | dict-sync |
282
- | `reports/SYS_PERMISSION_INFO.md` [PLANNED] | permission-collect | permission-sync |
283
- | `reports/规范审查报告.md` | convention-audit | 人工 code-fix |
284
- | `reports/组件提取建议.md` | convention-audit | 人工 template-extract |
285
-
286
- 详见 `reports/README.md`。
287
-
288
- ---
289
-
290
- ## 组件文档按需查阅
291
-
292
- 生成代码时如需了解组件用法,按需读取以下文档(不要全量加载):
293
-
294
- | 主题 | 文档路径 |
295
- | ----------------------------------- | ----------------------------------------------------- |
296
- | BaseQuery / BaseTable / BaseToolbar | `src/components/remote/{BaseXxx}/README.md` |
297
- | jh-* 平台组件 | `docs/jh-{name}.md` |
298
- | c_formModal / c_listModal 等 | `src/components/local/{c_xxx}/README.md` |
299
- | AbstractPageQueryHook 最佳实践 | `docs/page-query-hook-best-practices.md` |
300
- | HTTP 请求工具 | `docs/request.md` |
301
-
302
- > 详细对照表与"何时必读哪个文档"见 `standards/13-platform-components.md`。
303
-
304
- ---
305
-
306
- ## 领域样例参考
307
-
308
- 首次生成某类页面时,可读取 `demo/` 下对应样例:
309
-
310
- | 模板类型 | 样例路径 |
311
- | --------------------- | ------------------------------------------------------- |
312
- | LIST | `demo/produce/aiflow/mmwr-customer-archive/` |
313
- | FORM_ROUTE | `demo/produce/aiflow/mmwr-customer-apply-add-form/` |
314
- | CHANGE_HISTORY | `demo/produce/aiflow/mmwr-customer-apply-change-history/` |
315
- | DETAIL_TABS | `demo/produce/aiflow/mmwr-customer-detail/` |
316
- | MASTER_DETAIL | `demo/sale/demo/metallurgical-spec/` |
317
-
318
- ---
319
-
320
- > 📚 完整指南:`.github/guides/usage.md`
321
- > 🏗️ 架构设计:`.github/guides/architecture.md`
322
- > 🔧 维护者文档:`kit-internal/`(仓库内,不安装到业务项目)
1
+ # 产品化前端编码指令
2
+
3
+ > 本文件由 AI 编辑器自动加载(VS Code Copilot / Cursor / Windsurf 等),确保生成代码符合项目规范。
4
+ > **前置要求**:AI 首次进入项目时,建议先阅读 `README.md` 了解产品化架构全景。后续对话中依赖本文件的规范约定即可,无需重复扫描。
5
+
6
+ ## 架构
7
+
8
+ - Vue 3.2 + Vite + TypeScript(strict: false)
9
+ - Module Federation **子应用**,路由/权限/布局/Store 从主应用 `main` 远程加载
10
+ - UI:Element Plus + @jhlc/jh-ui + @jhlc/common-core
11
+ - 样式:Windi CSS + SCSS
12
+ - 状态:Pinia
13
+ - 页面注册:`vite/plugins/shared/pages.ts` 通过 `gProd()` / `gSale()` 声明
14
+ - 菜单路由配置:后端菜单表是唯一数据源。pages.ts 注册组件后,需在系统管理后台 → 菜单管理 → 新增菜单。批量新增页面时可用后端 batchImport 接口,详见 `.github/skills/sync/menu-sync/SKILL.md`
15
+
16
+ ## 页面标准结构(三文件分离 + 接口契约)
17
+
18
+ ```
19
+ src/views/[域]/[模块]/[子模块]/[kebab-case目录]/
20
+ ├── index.vue ← 纯模板+解构,不写业务逻辑
21
+ ├── data.ts ← AbstractPageQueryHook 类 + API_CONFIG
22
+ ├── index.scss ← 页面样式(可为空)
23
+ └── api.md ← 接口约定(前端预留 + 后端出接口依据)
24
+ ```
25
+
26
+ 弹窗组件处理策略:
27
+
28
+ - **通用弹窗**(新增/编辑表单,2+ 页面可复用)→ 提取到 `src/components/local/c_xxxModal/`
29
+ - **极个性弹窗**(仅单页面使用,c_modal 无法满足)→ 放在页面 `components/xxxModal.vue`
30
+
31
+ ## data.ts 核心模式
32
+
33
+ > 配置化驱动,通过 `API_CONFIG` + `class extends AbstractPageQueryHook` 实现零 API 层开发。
34
+ > 基类内置 `getAction`/`postAction`/`putAction`/`deleteAction`/`actionBatch` 等 HTTP 方法(详见 `docs/request.md`),标准 CRUD 无需独立 API 文件。
35
+
36
+ ```typescript
37
+ import { AbstractPageQueryHook } from "@jhlc/common-core/src/page-hooks/page-query-hook.ts";
38
+ import { BaseQueryItemDesc } from "@jhlc/common-core/src/components/form/base-query/type.ts";
39
+ import { ActionButtonDesc } from "@jhlc/common-core/src/components/toolbar/type.ts";
40
+ import { TableColumnDesc } from "@jhlc/common-core/src/components/table/base-table/type.ts";
41
+ import { BusLogicDataType } from "@jhlc/types/src/logical-data";
42
+ import { getAction, postAction } from "@jhlc/common-core/src/api/action";
43
+
44
+ export const API_CONFIG = {
45
+ list: "/[服务缩写]/[资源名]/list",
46
+ remove: "/[服务缩写]/[资源名]/remove",
47
+ getById: "/[服务缩写]/[资源名]/getById",
48
+ save: "/[服务缩写]/[资源名]/save",
49
+ update: "/[服务缩写]/[资源名]/update",
50
+ export: "/[服务缩写]/[资源名]/export"
51
+ } as const;
52
+
53
+ export function createPage(addModalRef?: any) {
54
+ let Page = new (class extends AbstractPageQueryHook {
55
+ constructor() {
56
+ super({ url: { list: API_CONFIG.list, remove: API_CONFIG.remove } });
57
+ }
58
+ queryDef(): BaseQueryItemDesc<any>[] {
59
+ return [
60
+ { name: "fieldName", label: "字段名", placeholder: "请输入" },
61
+ {
62
+ name: "status",
63
+ label: "状态",
64
+ logicType: BusLogicDataType.dict,
65
+ logicValue: "dictCode"
66
+ }
67
+ ];
68
+ }
69
+ toolbarDef(): ActionButtonDesc[] {
70
+ return [
71
+ {
72
+ name: "primary",
73
+ label: "新增",
74
+ plain: true,
75
+ onClick: () => addModalRef?.value?.open()
76
+ }
77
+ ];
78
+ }
79
+ columnsDef(): TableColumnDesc<any>[] {
80
+ return [
81
+ { type: "selection" },
82
+ { type: "index" },
83
+ {
84
+ label: "字段名",
85
+ name: "fieldName",
86
+ minWidth: 120,
87
+ sortable: true,
88
+ filterable: true
89
+ },
90
+ {
91
+ label: "状态",
92
+ name: "status",
93
+ minWidth: 100,
94
+ logicType: BusLogicDataType.dict,
95
+ logicValue: "dictCode",
96
+ sortable: true,
97
+ filterable: true
98
+ }
99
+ ];
100
+ }
101
+ })();
102
+ return Page.create() as any;
103
+ }
104
+ ```
105
+
106
+ ## index.vue 标准模板
107
+
108
+ ```vue
109
+ <template>
110
+ <div class="app-container app-page-container">
111
+ <BaseQuery
112
+ :form="queryParam"
113
+ :items="queryItems"
114
+ @select="select"
115
+ @reset="select"
116
+ />
117
+ <BaseToolbar :items="toolbars" />
118
+ <BaseTable
119
+ ref="tableRef"
120
+ render-type="agGrid"
121
+ :cid="TABLE_CID"
122
+ :data="list"
123
+ :columns="columns"
124
+ showToolbar
125
+ />
126
+ <jh-pagination
127
+ v-show="page.total && page.total > 0"
128
+ :total="page.total || 0"
129
+ v-model:currentPage="page.current"
130
+ v-model:pageSize="page.size"
131
+ @current-change="select"
132
+ @size-change="select"
133
+ />
134
+ </div>
135
+ </template>
136
+
137
+ <script setup lang="ts">
138
+ import { createPage, TABLE_CID } from "./data";
139
+
140
+ const Page = createPage();
141
+ const {
142
+ tableRef,
143
+ page,
144
+ queryParam,
145
+ list,
146
+ queryItems,
147
+ columns,
148
+ toolbars,
149
+ select
150
+ } = Page;
151
+
152
+ onMounted(() => select());
153
+ </script>
154
+
155
+ <style scoped lang="scss">
156
+ @import "./index.scss";
157
+ </style>
158
+ ```
159
+
160
+ ## 命名规范
161
+
162
+ | 位置 | 规范 | 示例 |
163
+ | ------------ | ----------------------- | -------------------------------- |
164
+ | 目录/路由 | kebab-case | `ompt-mill-plan/` |
165
+ | pages.ts | `["kebab名", "中文名"]` | `["ompt-mill-plan", "轧钢计划"]` |
166
+ | 字段名 | camelCase | `orderNo`, `planStatus` |
167
+ | logicValue | camelCase | `planStatus`, `plineCode` |
168
+ | 全局组件 | `C_PascalCase/` | `C_Tree/` |
169
+ | 局部公共组件 | `c_camelCase/` | `c_modal/`、`c_detailPanel/` |
170
+ | 页面私有组件 | camelCase | `addModal.vue`(仅极个性弹窗) |
171
+
172
+ ## 平台组件速查
173
+
174
+ | 用途 | 组件 | 来源 |
175
+ | -------- | -------------- | -------------------------------- |
176
+ | 查询区 | BaseQuery | @jhlc/common-core |
177
+ | 工具栏 | BaseToolbar | @jhlc/common-core |
178
+ | 表格 | BaseTable | @jhlc/common-core |
179
+ | 分页 | jh-pagination | @jhlc/jh-ui |
180
+ | 上下分栏 | jh-drag-row | @jhlc/jh-ui |
181
+ | 下拉选择 | jh-select | @jhlc/jh-ui(dict 属性自动加载) |
182
+ | 单日期 | jh-date | @jhlc/jh-ui |
183
+ | 日期范围 | jh-date-range | @jhlc/jh-ui |
184
+ | 用户选择 | jh-user-picker | @jhlc/jh-ui |
185
+ | 部门选择 | jh-dept-picker | @jhlc/jh-ui |
186
+ | 文件上传 | jh-file-upload | @jhlc/jh-ui |
187
+ | 文本翻译 | jh-text | @jhlc/jh-ui |
188
+ | 左右分割 | C_Splitter | src/components/global |
189
+ | 树形面板 | C_Tree | src/components/global |
190
+
191
+ ## 组件提取策略
192
+
193
+ | 场景 | 位置 | 命名 |
194
+ | ------------------------- | ------------------------------------- | ----------------------- |
195
+ | 3+ 页面复用 | `src/components/global/C_PascalCase/` | 全局自动注册 |
196
+ | 2+ 页面复用(如通用弹窗) | `src/components/local/c_camelCase/` | 按需导入,如 `c_modal/` |
197
+ | 仅单页面使用 | 页面 `components/xxxModal.vue` | 仅当 c_modal 无法满足时 |
198
+
199
+ ## 禁止事项
200
+
201
+ - ❌ index.vue 中写业务逻辑(逻辑全在 data.ts)
202
+ - ❌ 使用 Vuex(用 Pinia)
203
+ - ❌ `::v-deep` / `/deep/`(用 `:deep()`)
204
+ - ❌ 直接用 axios(用 getAction/postAction)
205
+ - ❌ 手写查询表单/工具栏/分页(用 BaseQuery/BaseToolbar/jh-pagination)
206
+ - 每个页面重复写弹窗组件(优先用 `c_modal` 等局部公共组件)
207
+
208
+
209
+ ---
210
+
211
+ ## 规范门控(standards/index.md 懒加载)
212
+
213
+ > ⚠️ 本节为**强制约定**,所有 AI 编辑器/模型都必须遵守。
214
+
215
+ 完整 13 条编码规范拆分在 `.github/standards/01 ~ 13.md`,由 `standards/index.md` 提供任务类型 → 规范子集映射,**按需加载,不全量读取**。
216
+
217
+ | 任务类型 | 必读规范 |
218
+ | --------------------- | ------------------------------------------------- |
219
+ | A. 生成新页面 | 01, 02, 03, 04, 05, 06, 07, 09, 10, 11, 12, 13 |
220
+ | B. 修改/重构现有代码 | 02, 04, 05, 06, 09, 10, 12, 13 |
221
+ | C. 规范审计 | 全部 01 ~ 13 |
222
+ | D. 模板提取 | 02, 03, 09, 12, 13 |
223
+ | E. 数据同步(菜单等) | 04, 05, 07 |
224
+ | F. Git/分支/提交 | 08 |
225
+
226
+ **执行任何代码生成或改动前**:
227
+ 1. 先 `read_file` 加载 `standards/index.md` 确认任务类型
228
+ 2. 按映射读取对应 `standards/0X-*.md`
229
+ 3. 在 Pre-flight 声明中列出已加载文件
230
+
231
+ ---
232
+
233
+ ## AI Skills 自动调度
234
+
235
+ 完整触发词与 Skill 路径见 `skills/_registry.md`(**单一数据源**,不在此处重复)。
236
+
237
+ ### Intent Router(自然语言智能识别)
238
+
239
+ 用户不需要记住 Skill 名。只要消息包含以下任一语义,AI 必须自动路由到对应 Skill:
240
+
241
+ | 用户自然表达 | 自动触发 |
242
+ | ------------ | -------- |
243
+ | 生成页面 / 做个页面 / 列表页 / 管理页 / 台账 / 根据原型 / 根据截图 / 补页面 | `page-codegen`,必要时先 `prototype-scan` + `api-contract` |
244
+ | mock / 假数据 / 后端没好 / 先能跑 / 联调前 | `page-codegen` mock-first 规则 |
245
+ | 菜单 / 注册页面 / 点击进不来 / 同步菜单 / 补菜单 | `menu-sync` + `route-check` |
246
+ | 风格 / 样式不生效 / skills-ui / 操作列 / 状态标签 / AGGrid | `page-codegen` + `wk-skills-ui runtime` + `doctor-ui` |
247
+ | 规范检查 / 体检 / 接手项目 / 偏差 | `convention-audit` 或 CLI `validate` |
248
+
249
+ 页面生成类任务命中后,必须读取:
250
+
251
+ 1. `.github/skills/core/page-codegen/SKILL.md`
252
+ 2. `.github/skills/core/page-codegen/templates/_index.md`
253
+ 3. 匹配的 `TPL-*.md`
254
+ 4. `.github/standards/12-base-table.md`
255
+ 5. 如涉及菜单,读取 `.github/skills/sync/menu-sync/SKILL.md`
256
+
257
+ ### 页面模板硬约束
258
+
259
+ 生成业务表格时,必须同时满足:
260
+
261
+ - 使用 `AbstractPageQueryHook + BaseQuery + BaseToolbar + BaseTable + jh-pagination`
262
+ - `BaseTable` 显式 `render-type="agGrid"`
263
+ - `BaseTable` 绑定全局唯一 `cid` / `:cid`
264
+ - 列定义使用 `@agile-team/wk-skills-ui/runtime` 的 `defineColumns()`
265
+ - 操作列使用 `renderOps()`,禁止 `operations: []`
266
+ - 保留 `common-core` 平台骨架,不得生搬硬套 `wk-skills-ui` 通用模板里的 `usePageHook/el-form/el-pagination`
267
+ - 生成后建议运行 `wl-skills validate-page <页面目录>` 和 `wl-skills doctor-ui`
268
+
269
+ | Skill 名 | 状态 | 一句话说明 |
270
+ | -------------------- | -------- | --------------------------------------- |
271
+ | prototype-scan | ✅ 启用 | 原型/详设 → page-spec JSON |
272
+ | api-contract | ✅ 启用 | 生成 api.md 接口约定 |
273
+ | page-codegen | ✅ 启用 | 页面骨架 + 模板调度 + 菜单追加 |
274
+ | menu-sync | ✅ 启用 | reports/SYS_MENU_INFO → 后端菜单接口 |
275
+ | convention-audit | ✅ 启用 | 13 条规范扫描 + 偏差报告 + 提取建议 |
276
+ | template-extract | ✅ 启用 | 现有页面 → 领域模板沉淀 |
277
+ | dict-sync | ✅ 启用 | 字典数据同步 |
278
+ | permission-sync | ✅ 启用 | 角色+授权+动作权限同步(MCP) |
279
+ | code-fix | 启用 | 自动整改 🟢🟡 等级偏差 |
280
+
281
+ **执行规则**:
282
+
283
+ 1. 用户消息匹配 `_registry.md` 触发词用 `read_file` 加载对应 SKILL.md
284
+ 2. SKILL.md 中标注的"必读 standards"按 standards/index.md 映射加载
285
+ 3. 在 SKILL.md 指示下输出 **Pre-flight 声明**(强制)
286
+
287
+ ---
288
+
289
+ ## Pre-flight 声明(强制约定式输出)
290
+
291
+ 每次 Skill 触发时,**必须先输出**以下结构的 Pre-flight 声明,再开始执行:
292
+
293
+ ```
294
+ 🚀 已触发技能 {skill-name}/SKILL.md → {一句话用途}
295
+ 已读取 standards/index.md → 规范门控
296
+ 已读取 standards/{相关条目} → {一句话说明}
297
+ 已读取 {其他必要文档} → {说明}
298
+ 工具链检测:{各项 / }
299
+ {其他前置检查项,如 cid 生成等}
300
+ ```
301
+
302
+ **工具链检测失败必须暂停**:
303
+
304
+ ```
305
+ ❌ 工具链检测失败:未找到 {缺失文件}
306
+ 请执行:npx @robot-admin/git-standards init
307
+ → 或联系 CHENY(工号 409322)解决
308
+ 任务已暂停,修复后重新触发
309
+ ```
310
+
311
+ ---
312
+
313
+ ## 报告类文件(reports/)
314
+
315
+ AI 生成的所有报告类文件统一写入 `.github/reports/`,**全部追加不覆盖**。
316
+
317
+ | 文件 | 写入方 | 读取方 |
318
+ | --------------------------------- | ------------------ | --------------------- |
319
+ | `reports/SYS_MENU_INFO.md` | page-codegen | menu-sync |
320
+ | `reports/SYS_DICT_INFO.md` | dict-collect | dict-sync |
321
+ | `reports/SYS_PERMISSION_INFO.md` [PLANNED] | permission-collect | permission-sync |
322
+ | `reports/规范审查报告.md` | convention-audit | 人工 → code-fix |
323
+ | `reports/组件提取建议.md` | convention-audit | 人工 → template-extract |
324
+
325
+ 详见 `reports/README.md`。
326
+
327
+ ---
328
+
329
+ ## 组件文档按需查阅
330
+
331
+ 生成代码时如需了解组件用法,按需读取以下文档(不要全量加载):
332
+
333
+ | 主题 | 文档路径 |
334
+ | ----------------------------------- | ----------------------------------------------------- |
335
+ | BaseQuery / BaseTable / BaseToolbar | `src/components/remote/{BaseXxx}/README.md` |
336
+ | jh-* 平台组件 | `docs/jh-{name}.md` |
337
+ | c_formModal / c_listModal 等 | `src/components/local/{c_xxx}/README.md` |
338
+ | AbstractPageQueryHook 最佳实践 | `docs/page-query-hook-best-practices.md` |
339
+ | HTTP 请求工具 | `docs/request.md` |
340
+
341
+ > 详细对照表与"何时必读哪个文档"见 `standards/13-platform-components.md`。
342
+
343
+ ---
344
+
345
+ ## 领域样例参考
346
+
347
+ 首次生成某类页面时,可读取 `demo/` 下对应样例:
348
+
349
+ | 模板类型 | 样例路径 |
350
+ | --------------------- | ------------------------------------------------------- |
351
+ | LIST | `demo/produce/aiflow/mmwr-customer-archive/` |
352
+ | FORM_ROUTE | `demo/produce/aiflow/mmwr-customer-apply-add-form/` |
353
+ | CHANGE_HISTORY | `demo/produce/aiflow/mmwr-customer-apply-change-history/` |
354
+ | DETAIL_TABS | `demo/produce/aiflow/mmwr-customer-detail/` |
355
+ | MASTER_DETAIL | `demo/sale/demo/metallurgical-spec/` |
356
+
357
+ ---
358
+
359
+ > 📚 完整指南:`.github/guides/usage.md`
360
+ > 🏗️ 架构设计:`.github/guides/architecture.md`
361
+ > 🔧 维护者文档:`kit-internal/`(仓库内,不安装到业务项目)