@agile-team/wl-skills-kit 1.2.1 → 2.1.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.
- package/CHANGELOG.md +120 -0
- package/README.md +169 -366
- package/bin/wl-skills.js +149 -43
- package/files/.github/copilot-instructions.md +104 -43
- package/files/.github/guides/README.md +13 -0
- package/files/.github/guides/architecture.md +555 -0
- package/files/.github/guides/usage.md +166 -0
- package/files/.github/reports/README.md +65 -0
- package/files/.github/reports/SYS_DICT_INFO.md +19 -0
- package/files/.github/reports/SYS_PERMISSION_INFO.md +20 -0
- package/files/.github/reports//347/273/204/344/273/266/346/217/220/345/217/226/345/273/272/350/256/256.md +33 -0
- package/files/.github/reports//350/247/204/350/214/203/345/256/241/346/237/245/346/212/245/345/221/212.md +44 -0
- package/files/.github/skills/_compat/README.md +108 -0
- package/files/.github/skills/_compat/editors.json +61 -0
- package/files/.github/skills/_compat/headers/agents.txt +8 -0
- package/files/.github/skills/_compat/headers/claude-code.txt +7 -0
- package/files/.github/skills/_compat/headers/cline.txt +7 -0
- package/files/.github/skills/_compat/headers/cursor-mdc.txt +16 -0
- package/files/.github/skills/_compat/headers/cursor-rules.txt +7 -0
- package/files/.github/skills/_compat/headers/github-copilot.txt +1 -0
- package/files/.github/skills/_compat/headers/kiro.txt +10 -0
- package/files/.github/skills/_compat/headers/trae.txt +11 -0
- package/files/.github/skills/_compat/headers/windsurf.txt +7 -0
- package/files/.github/skills/_registry.md +81 -0
- package/files/.github/skills/{api-contract → core/api-contract}/SKILL.md +126 -29
- package/files/.github/skills/core/api-contract/USAGE.md +110 -0
- package/files/.github/skills/core/convention-audit/SKILL.md +189 -0
- package/files/.github/skills/core/convention-audit/USAGE.md +99 -0
- package/files/.github/skills/{page-codegen → core/page-codegen}/SKILL.md +64 -21
- package/files/.github/skills/core/page-codegen/USAGE.md +102 -0
- package/files/.github/skills/core/page-codegen/templates/_index.md +46 -0
- package/files/.github/skills/core/page-codegen/templates/domains/_CONTRIBUTING.md +107 -0
- package/files/.github/skills/{page-codegen → core/page-codegen/templates/domains/produce}/TPL-OPERATION-STATION.md +442 -442
- package/files/.github/skills/core/page-codegen/templates/domains/sale/README.md +26 -0
- package/files/.github/skills/{page-codegen → core/page-codegen/templates/universal}/TPL-DETAIL-TABS.md +94 -39
- package/files/.github/skills/{page-codegen → core/page-codegen/templates/universal}/TPL-DRIVEN.md +124 -124
- package/files/.github/skills/core/prototype-scan/USAGE.md +95 -0
- package/files/.github/skills/core/template-extract/SKILL.md +139 -0
- package/files/.github/skills/core/template-extract/USAGE.md +93 -0
- package/files/.github/skills/domain/README.md +51 -0
- package/files/.github/skills/ops/code-fix/SKILL.draft.md +108 -0
- package/files/.github/skills/sync/dict-sync/SKILL.draft.md +100 -0
- package/files/.github/skills/{menu-sync → sync/menu-sync}/SKILL.md +258 -258
- package/files/.github/skills/sync/menu-sync/USAGE.md +104 -0
- package/files/.github/skills/{menu-sync → sync/menu-sync}/env/guide.md +83 -83
- package/files/.github/skills/sync/permission-sync/SKILL.draft.md +91 -0
- package/files/.github/standards/01-toolchain.md +57 -0
- package/files/.github/standards/02-code-structure.md +111 -0
- package/files/.github/standards/03-comments.md +53 -0
- package/files/.github/standards/04-coding-basics.md +33 -0
- package/files/.github/standards/05-logging.md +38 -0
- package/files/.github/standards/06-security.md +44 -0
- package/files/.github/standards/07-config.md +52 -0
- package/files/.github/standards/08-git.md +60 -0
- package/files/.github/standards/09-typescript.md +71 -0
- package/files/.github/standards/10-pinia.md +57 -0
- package/files/.github/standards/11-form-validation.md +81 -0
- package/files/.github/standards/12-base-table.md +116 -0
- package/files/.github/standards/13-platform-components.md +123 -0
- package/files/.github/standards/index.md +89 -0
- package/files/demo/produce/aiflow/mmwr-customer-apply-change-history/data.ts +196 -196
- package/files/demo/produce/aiflow/mmwr-customer-apply-change-history/index.scss +150 -150
- package/files/demo/produce/aiflow/mmwr-customer-apply-change-history/index.vue +79 -79
- package/files/docs/jh-date-range.md +257 -257
- package/files/docs/jh-date.md +222 -222
- package/files/docs/jh-dept-picker.md +190 -190
- package/files/docs/jh-drag-row.md +590 -590
- package/files/docs/jh-file-upload.md +216 -216
- package/files/docs/jh-picker.md +218 -218
- package/files/docs/jh-select.md +148 -148
- package/files/docs/jh-text.md +248 -248
- package/files/docs/jh-user-picker.md +197 -197
- package/package.json +4 -1
- package/files/.github/docs/menu-sync-design.md +0 -264
- package/files/.github/docs/use-skill.md +0 -382
- package/files/.github/docs/wl-skills-kit.md +0 -266
- package/files/.github/skills/convention-extract/SKILL.md +0 -236
- /package/files/.github/{docs → reports}/SYS_MENU_INFO.md +0 -0
- /package/files/.github/skills/{page-codegen → core/page-codegen/templates/universal}/TPL-CHANGE-HISTORY.md +0 -0
- /package/files/.github/skills/{page-codegen → core/page-codegen/templates/universal}/TPL-FORM-ROUTE.md +0 -0
- /package/files/.github/skills/{page-codegen → core/page-codegen/templates/universal}/TPL-LIST.md +0 -0
- /package/files/.github/skills/{page-codegen → core/page-codegen/templates/universal}/TPL-MASTER-DETAIL.md +0 -0
- /package/files/.github/skills/{page-codegen → core/page-codegen/templates/universal}/TPL-RECORD-FORM.md +0 -0
- /package/files/.github/skills/{page-codegen → core/page-codegen/templates/universal}/TPL-TREE-LIST.md +0 -0
- /package/files/.github/skills/{prototype-scan → core/prototype-scan}/SKILL.md +0 -0
- /package/files/.github/skills/{menu-sync → sync/menu-sync}/env/env.local.json +0 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# 使用指南:convention-audit(规范审计)
|
|
2
|
+
|
|
3
|
+
> **谁读这个文档**:团队成员(主要前端、code reviewer)
|
|
4
|
+
> **AI 触发文件**:同目录 `SKILL.md`
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## 这个 Skill 解决什么问题
|
|
9
|
+
|
|
10
|
+
对**指定文件/目录**或**全量项目**跑一遍 13 条 standards 检查,输出:
|
|
11
|
+
|
|
12
|
+
1. **AI 自查报告**(reports/AUDIT*AI*\*.md)— 给 AI 看的,含修复建议
|
|
13
|
+
2. **人读摘要报告**(reports/AUDIT*HUMAN*\*.md)— 给团队 review 用的,含通过率/Top 偏差
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 何时使用
|
|
18
|
+
|
|
19
|
+
- code review 前自检
|
|
20
|
+
- 接手老页面,想知道偏差有多大
|
|
21
|
+
- 重构大模块前,先量化欠债
|
|
22
|
+
- PR 卡住找原因(哪条规范没过)
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## 触发关键词
|
|
27
|
+
|
|
28
|
+
`规范审计` / `代码审计` / `规范检查` / `对齐规范` / `规范偏差`
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## 标准对话示例
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
你:审计 src/views/produce/aiflow/mmwr-customer-archive/ 这个页面
|
|
36
|
+
AI:[Pre-flight]
|
|
37
|
+
审计目标:1 个页面(4 个文件)
|
|
38
|
+
应用规范:13 条 standards
|
|
39
|
+
输出:
|
|
40
|
+
- reports/AUDIT_AI_mmwr-customer-archive_20260426.md
|
|
41
|
+
- reports/AUDIT_HUMAN_mmwr-customer-archive_20260426.md
|
|
42
|
+
[扫描中...]
|
|
43
|
+
完成。13 条标准通过 11 条,2 条需关注:
|
|
44
|
+
⚠ standards/data-ts.md - EColumn.cid 缺失 1 处
|
|
45
|
+
⚠ standards/scss.md - 全局样式污染(缺 :scoped)
|
|
46
|
+
详见 reports/。
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## 输出物结构
|
|
52
|
+
|
|
53
|
+
### AI 自查报告(详细)
|
|
54
|
+
|
|
55
|
+
按规范逐条列:
|
|
56
|
+
|
|
57
|
+
- ✅ 通过:simple count
|
|
58
|
+
- ⚠ 偏差:文件路径 + 行号 + 偏差描述 + 修复建议(含代码片段)
|
|
59
|
+
- ❌ 严重:阻断性问题
|
|
60
|
+
|
|
61
|
+
### 人读摘要
|
|
62
|
+
|
|
63
|
+
- 总体通过率
|
|
64
|
+
- Top 5 偏差类型
|
|
65
|
+
- 最严重的 3 个文件
|
|
66
|
+
- 修复优先级建议(高/中/低)
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## 团队使用流程
|
|
71
|
+
|
|
72
|
+
1. **PR 自检**:作者先跑一遍审计,修掉高优先级再提 PR
|
|
73
|
+
2. **CR 辅助**:reviewer 看人读摘要快速定位
|
|
74
|
+
3. **季度健康度**:每季度跑一次全量审计,跟踪趋势
|
|
75
|
+
4. **新人培训**:让新人审计自己写的页面,对照标准学
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## 常见踩坑
|
|
80
|
+
|
|
81
|
+
| 现象 | 原因 | 解法 |
|
|
82
|
+
| ------------------------------------ | -------------------------------------- | --------------------------------------- |
|
|
83
|
+
| 审计跑很久(> 10 分钟) | 一次性审了上千文件 | 缩小范围到模块或页面级 |
|
|
84
|
+
| 偏差数据"漂移"(同代码两次结果不同) | AI 模型版本不同 | 锁定 IDE 模型版本,或以 AI 自查报告为准 |
|
|
85
|
+
| 误报字典字段未定义 | 字典在 reports/SYS_DICT_INFO.md 但跨域 | 在 standards/data-ts.md 里允许跨域字典 |
|
|
86
|
+
| Pre-flight 没声明 | AI 跳过了门控 | 显式说"按 SKILL.md 执行 Pre-flight" |
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## FAQ
|
|
91
|
+
|
|
92
|
+
**Q:审计结果可以自动修复吗?**
|
|
93
|
+
A:单个偏差可以让 AI 修,但**不要让它批量自动改**。建议:人工挑 review 通过的,逐个让 AI 改。code-fix Skill(PLANNED)将提供受控自动修复。
|
|
94
|
+
|
|
95
|
+
**Q:两份报告为什么要分开?**
|
|
96
|
+
A:AI 报告冗长(含每行修复建议),人读摘要简洁(只看趋势/优先级)。两者读者不同。
|
|
97
|
+
|
|
98
|
+
**Q:自定义规范怎么加?**
|
|
99
|
+
A:往 `.github/standards/` 加一份 `*.md`,更新 `standards/index.md`,convention-audit 自动 pickup。
|
|
@@ -5,7 +5,53 @@ description: "Use when: generating complete Vue 3 page code (index.vue + data.ts
|
|
|
5
5
|
|
|
6
6
|
# Skill: 页面代码生成(page-codegen)
|
|
7
7
|
|
|
8
|
-
基于《页面清单》+
|
|
8
|
+
基于《页面清单》+ 原型信息,生成符合项目规范的完整 Vue 3 页面代码。
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Pre-flight 规范声明(执行前必须输出)
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
🚀 已触发技能 page-codegen/SKILL.md → 页面代码生成:4文件 + 模板调度 + 前置检查
|
|
16
|
+
✅ 已读取 templates/_index.md → 模板注册表,匹配 → {TPL路径}
|
|
17
|
+
✅ 已读取 templates/{universal|domains/xxx}/TPL-XXX.md → {当前模板说明}
|
|
18
|
+
✅ 已读取 standards/index.md → 规范门控(任务类型 A:生成新页面)
|
|
19
|
+
✅ 已读取 standards/02-code-structure.md → 4文件原则 + 三段式 + script 9段顺序
|
|
20
|
+
✅ 已读取 standards/12-base-table.md → AGGrid必用 + cid命名规范
|
|
21
|
+
✅ 已读取 standards/13-platform-components.md → 平台组件对照表 + docs前置读取清单
|
|
22
|
+
✅ 已读取 docs/{涉及的jh-*文档} → 当前页涉及组件的使用规范
|
|
23
|
+
✅ 工具链检测:.prettierrc.js ✓ eslint.config.ts ✓ .husky/ ✓ [全部就绪]
|
|
24
|
+
✅ cid 已生成:{value}({首字母缩写说明})
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**工具链失败时(红叉 + 暂停)**:
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
❌ 工具链检测失败:未找到 .prettierrc.js / eslint.config.ts / .husky/
|
|
31
|
+
→ 请执行:npx @robot-admin/git-standards init
|
|
32
|
+
→ 或联系 CHENY(工号 409322)解决
|
|
33
|
+
→ ⛔ 代码生成已暂停,修复后重新触发
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**生成完成摘要(生成结束后输出)**:
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
📦 本次生成完成
|
|
40
|
+
────────────────────────────────────────────────
|
|
41
|
+
✅ src/views/.../{页面}/index.vue
|
|
42
|
+
✅ src/views/.../{页面}/data.ts
|
|
43
|
+
✅ src/views/.../{页面}/index.scss
|
|
44
|
+
✅ src/views/.../{页面}/api.md
|
|
45
|
+
✅ reports/SYS_MENU_INFO.md → 已追加菜单条目
|
|
46
|
+
────────────────────────────────────────────────
|
|
47
|
+
📌 后续步骤:
|
|
48
|
+
1. 在 router/pages.ts 注册路由
|
|
49
|
+
2. 提交:git cz(禁止直接 git commit)
|
|
50
|
+
3. 可选:触发 convention-audit 扫描本次生成文件
|
|
51
|
+
────────────────────────────────────────────────
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
---
|
|
9
55
|
|
|
10
56
|
## 前置检查
|
|
11
57
|
|
|
@@ -44,7 +90,7 @@ src/views/[域]/[模块]/[子模块]/[kebab-case-目录名]/
|
|
|
44
90
|
附加输出:
|
|
45
91
|
|
|
46
92
|
- `pages.ts` 注册片段
|
|
47
|
-
- **`SYS_MENU_INFO.md`** —
|
|
93
|
+
- **`reports/SYS_MENU_INFO.md`** — 集中式菜单配置,**追加写入**(见下方 §SYS_MENU_INFO 生成规则)
|
|
48
94
|
- `mock/[页面kebab-name].ts`(项目根目录 `mock/` 下,`vite-plugin-mock` 自动加载,与 api.md 的 URL 和字段完全一致)
|
|
49
95
|
|
|
50
96
|
---
|
|
@@ -818,18 +864,14 @@ import { BaseQueryItemDesc } from "@jhlc/common-core/src/components/form/base-qu
|
|
|
818
864
|
|
|
819
865
|
## SYS_MENU_INFO 生成规则(所有模板通用)
|
|
820
866
|
|
|
821
|
-
page-codegen
|
|
822
|
-
|
|
823
|
-
### 写入模式确认(必须询问用户)
|
|
867
|
+
page-codegen 生成页面代码后,**必须追加写入菜单配置信息到 `reports/SYS_MENU_INFO.md`**。
|
|
824
868
|
|
|
825
|
-
|
|
869
|
+
### 写入策略(默认追加,不覆盖)
|
|
826
870
|
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
| **覆盖模式** | 清空已有内容,只写入本次生成的菜单 | 首个模块 / 上次生成失败需要重来 |
|
|
830
|
-
| **追加模式** | 保留已有内容,在末尾追加本次生成的菜单 | 第二个、第三个模块接续生成 |
|
|
871
|
+
- **默认为追加模式**:保留已有内容,在末尾追加本次生成的菜单。避免覆盖团队之前累积的菜单记录。
|
|
872
|
+
- **如需重置**:用户明确说“覆盖”才走覆盖逻辑。
|
|
831
873
|
|
|
832
|
-
> AI
|
|
874
|
+
> AI 询问示例(仅当用户意图不明时):`本次生成了 N 个页面的菜单配置,默认追加到 reports/SYS_MENU_INFO.md,是否需要覆盖已有内容?`
|
|
833
875
|
|
|
834
876
|
### 生成模板
|
|
835
877
|
|
|
@@ -917,14 +959,15 @@ SYS_MENU_INFO.md 是 menu-sync Skill 的输入数据源:
|
|
|
917
959
|
|
|
918
960
|
| 交互模式 | 文件 | 适用场景 | 典型参考页面 |
|
|
919
961
|
|---|---|---|---|
|
|
920
|
-
| LIST | TPL-LIST.md | 标准查询+工具栏+表格+分页 | mmwr-customer-archive |
|
|
921
|
-
| MASTER_DETAIL | TPL-MASTER-DETAIL.md | jh-drag-row 主从表,双击联动 | ompt-ht-plan-order |
|
|
922
|
-
| TREE_LIST | TPL-TREE-LIST.md | 左侧 C_Tree + 右侧列表 | — |
|
|
923
|
-
| DETAIL_TABS | TPL-DETAIL-TABS.md | C_Splitter 上Tab表单+下子表 | add-demo / domestic-trade-order |
|
|
924
|
-
| FORM_ROUTE | TPL-FORM-ROUTE.md | 复杂表单独立路由(非弹窗) | mmwr-customer-apply-add-form |
|
|
925
|
-
| CHANGE_HISTORY | TPL-CHANGE-HISTORY.md | 左历史时间线+右变更详情 | mmwr-customer-apply-change-history |
|
|
926
|
-
| RECORD_FORM | TPL-RECORD-FORM.md | BaseQuery选主记录+Form+Table无分页 | mmsm-convert-progress |
|
|
927
|
-
| OPERATION_STATION | TPL-OPERATION-STATION.md | 工序站点操作(待处理↔已处理+操作表单) | mmwr-rolling-management |
|
|
928
|
-
|
|
929
|
-
> **配置驱动模板页**(ResultQueryTemplate / FinishingAchievementTemplate 等):见 TPL-DRIVEN.md,仅需生成 config 对象,不套用以上模板。
|
|
962
|
+
| LIST | templates/universal/TPL-LIST.md | 标准查询+工具栏+表格+分页 | mmwr-customer-archive |
|
|
963
|
+
| MASTER_DETAIL | templates/universal/TPL-MASTER-DETAIL.md | jh-drag-row 主从表,双击联动 | ompt-ht-plan-order |
|
|
964
|
+
| TREE_LIST | templates/universal/TPL-TREE-LIST.md | 左侧 C_Tree + 右侧列表 | — |
|
|
965
|
+
| DETAIL_TABS | templates/universal/TPL-DETAIL-TABS.md | C_Splitter 上Tab表单+下子表 | add-demo / domestic-trade-order |
|
|
966
|
+
| FORM_ROUTE | templates/universal/TPL-FORM-ROUTE.md | 复杂表单独立路由(非弹窗) | mmwr-customer-apply-add-form |
|
|
967
|
+
| CHANGE_HISTORY | templates/universal/TPL-CHANGE-HISTORY.md | 左历史时间线+右变更详情 | mmwr-customer-apply-change-history |
|
|
968
|
+
| RECORD_FORM | templates/universal/TPL-RECORD-FORM.md | BaseQuery选主记录+Form+Table无分页 | mmsm-convert-progress |
|
|
969
|
+
| OPERATION_STATION | templates/domains/produce/TPL-OPERATION-STATION.md | 工序站点操作(待处理↔已处理+操作表单) | mmwr-rolling-management |
|
|
970
|
+
|
|
971
|
+
> **配置驱动模板页**(ResultQueryTemplate / FinishingAchievementTemplate 等):见 templates/universal/TPL-DRIVEN.md,仅需生成 config 对象,不套用以上模板。
|
|
972
|
+
> **领域模板查询**:完整路径以 `templates/_index.md` 注册表为准,新增领域模板见 `templates/domains/_CONTRIBUTING.md`。
|
|
930
973
|
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# 使用指南:page-codegen(页面代码生成)
|
|
2
|
+
|
|
3
|
+
> **谁读这个文档**:团队成员(主要前端)
|
|
4
|
+
> **AI 触发文件**:同目录 `SKILL.md`
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## 这个 Skill 解决什么问题
|
|
9
|
+
|
|
10
|
+
基于《页面清单》+ `api.md`,**自动生成符合项目规范的 Vue 页面**(4 文件骨架:data.ts / index.vue / index.scss / api.md),并跑一遍内部规范自检(Pre-flight + 完成摘要)。
|
|
11
|
+
|
|
12
|
+
生成出来的代码**满足 13 条 standards**,无需手工改语法/命名。
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## 何时使用
|
|
17
|
+
|
|
18
|
+
- 已完成 prototype-scan + api-contract,需要批量生成页面代码
|
|
19
|
+
- 复用相同模板做新页面(基于 templates/domains/)
|
|
20
|
+
- 教新人时希望"按一键就能看到合规示例"
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## 触发关键词
|
|
25
|
+
|
|
26
|
+
`生成页面` / `创建页面` / `代码生成` / `vue 页面` / `按原型生成` / `帮我生成`
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## 标准对话示例
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
你:基于 reports/PROTOTYPE_SCAN_客户管理_20260426.md 和各页面的 api.md,生成全部 7 个页面代码
|
|
34
|
+
AI:[Pre-flight]
|
|
35
|
+
将创建 7 个目录到 src/views/produce/aiflow/
|
|
36
|
+
每个目录包含:data.ts / index.vue / index.scss / api.md(已存在则跳过)
|
|
37
|
+
模板基线:templates/domains/produce/customer/
|
|
38
|
+
13 条 standards 自检通过项预估:
|
|
39
|
+
✓ AbstractPageQueryHook 正确继承
|
|
40
|
+
✓ EColumn 元数据完备
|
|
41
|
+
✓ pageRef 命名规范
|
|
42
|
+
✓ scoped scss
|
|
43
|
+
⚠ 待确认:customerStatus 字典 logicValue 名
|
|
44
|
+
[生成中... 8 分钟]
|
|
45
|
+
完成摘要:
|
|
46
|
+
- 新建 7 个页面共 28 个文件
|
|
47
|
+
- 5 处需要人工 review(详见报告)
|
|
48
|
+
- 输出报告:reports/PAGE_CODEGEN_客户管理_20260426.md
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## 输出物
|
|
54
|
+
|
|
55
|
+
每个页面目录:
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
src/views/<域>/<模块>/<子模块>/<page-name>/
|
|
59
|
+
├── data.ts EColumn 定义、API_CONFIG、Hook 类
|
|
60
|
+
├── index.vue template + script + import data.ts
|
|
61
|
+
├── index.scss 页面专属样式(已 :deep / scoped 包好)
|
|
62
|
+
└── api.md (由 api-contract 生成,codegen 不覆盖)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
外加生成报告:`.github/reports/PAGE_CODEGEN_<模块>_<YYYYMMDD>.md`
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## 模板复用机制
|
|
70
|
+
|
|
71
|
+
`page-codegen` 读取 `templates/` 下两个层级:
|
|
72
|
+
|
|
73
|
+
- **`templates/universal/`**:跨业务通用骨架(LIST / MASTER_DETAIL / TREE_LIST)
|
|
74
|
+
- **`templates/domains/<域>/<场景>/`**:领域专属(如 produce/customer/、sale/order/)
|
|
75
|
+
|
|
76
|
+
**优先级**:domain 命中则用 domain,未命中回落 universal。
|
|
77
|
+
|
|
78
|
+
> 想沉淀新模板?用 `template-extract` Skill 从已有页面抽取。
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## 常见踩坑
|
|
83
|
+
|
|
84
|
+
| 现象 | 原因 | 解法 |
|
|
85
|
+
| ----------------------------------- | -------------------------------------- | --------------------------------------------------- |
|
|
86
|
+
| 生成出来的页面 console 报字典查不到 | 字典还没在 reports/SYS_DICT_INFO.md 中 | 先跑 `dict-sync` 拉取,或手动补 dict |
|
|
87
|
+
| 表单弹窗未加 v-loading | api.md 没标记 save/update 为耗时操作 | 在 api.md 接口清单中加 `**预计耗时:> 2s**` 标记 |
|
|
88
|
+
| `EColumn` 字段缺 `width` | 模板默认不指定 width | 模板里手动加,或选用 `templates/domains/` 下的成品 |
|
|
89
|
+
| AGGrid cid 重复 | 多页面同时生成时随机数撞了 | cid 已用 `{首字母缩写}-{Unix秒后6位}`,理论极低概率 |
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## FAQ
|
|
94
|
+
|
|
95
|
+
**Q:生成完了但 build 报错?**
|
|
96
|
+
A:跑一下 `convention-audit` Skill,会扫出 13 条规范偏差并给出修复建议。
|
|
97
|
+
|
|
98
|
+
**Q:能否只生成 data.ts 不生成 index.vue?**
|
|
99
|
+
A:可以,告诉 AI"只生成 data.ts"。但通常一起生成,因为它们字段必须对齐。
|
|
100
|
+
|
|
101
|
+
**Q:能否覆盖已有页面?**
|
|
102
|
+
A:默认不覆盖。需要明确说"覆盖现有 src/views/xxx/" + AI 会让你二次确认。
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# 模板注册表(page-codegen 模板单一数据源)
|
|
2
|
+
|
|
3
|
+
> AI 在生成页面前,**先读取本文件**,定位匹配的 TPL 路径,再读取该 TPL。
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 通用模板(与业务域无关)
|
|
8
|
+
|
|
9
|
+
| 交互模式 | TPL 路径 | 适用场景 |
|
|
10
|
+
| --------------- | ------------------------------------------- | --------------------------------------- |
|
|
11
|
+
| LIST | `templates/universal/TPL-LIST.md` | 标准列表页(查询+工具栏+表格+分页) |
|
|
12
|
+
| FORM_ROUTE | `templates/universal/TPL-FORM-ROUTE.md` | 复杂表单独立路由页(多 Tab / 多子表) |
|
|
13
|
+
| MASTER_DETAIL | `templates/universal/TPL-MASTER-DETAIL.md` | 主从表页(jh-drag-row 上下分栏) |
|
|
14
|
+
| TREE_LIST | `templates/universal/TPL-TREE-LIST.md` | 左树右列表页(C_Splitter 布局) |
|
|
15
|
+
| DETAIL_TABS | `templates/universal/TPL-DETAIL-TABS.md` | 详情 Tab 页(上方表单 + 下方 Tab 子表) |
|
|
16
|
+
| CHANGE_HISTORY | `templates/universal/TPL-CHANGE-HISTORY.md` | 变更历史比对页(时间线 + 字段差异) |
|
|
17
|
+
| RECORD_FORM | `templates/universal/TPL-RECORD-FORM.md` | 录入型实绩页(无分页,查询 + 内联表单) |
|
|
18
|
+
| TEMPLATE_DRIVEN | `templates/universal/TPL-DRIVEN.md` | 配置驱动识别参考(非代码生成模板) |
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## 领域专属模板
|
|
23
|
+
|
|
24
|
+
### produce(生产域)
|
|
25
|
+
|
|
26
|
+
| 模板 | TPL 路径 | 适用场景 |
|
|
27
|
+
| ----------------- | ---------------------------------------------------- | ----------------------------------- |
|
|
28
|
+
| OPERATION_STATION | `templates/domains/produce/TPL-OPERATION-STATION.md` | 工序操作站(双清单联动 + 内联表单) |
|
|
29
|
+
|
|
30
|
+
### sale(销售域)
|
|
31
|
+
|
|
32
|
+
> 暂无领域专属模板。可通过 `template-extract` Skill 从现有页面提取并贡献。
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## 选择规则
|
|
37
|
+
|
|
38
|
+
1. AI 优先匹配通用模板(universal/)
|
|
39
|
+
2. 若用户明确指定领域且通用模板不适用,匹配 `domains/{domain}/`
|
|
40
|
+
3. 若都不匹配,反问用户描述更详细的交互模式,或建议使用 template-extract 先提取标杆页面
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## 贡献新模板
|
|
45
|
+
|
|
46
|
+
使用 `template-extract` Skill 从现有项目页面自动提取,详见 `templates/domains/_CONTRIBUTING.md`。
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# 领域模板贡献规范
|
|
2
|
+
|
|
3
|
+
> 如何向 `domains/` 贡献领域专属模板。
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 何时贡献领域模板
|
|
8
|
+
|
|
9
|
+
✅ **建议提取**的场景:
|
|
10
|
+
|
|
11
|
+
- 同一业务域内 **3+ 个页面**遵循相同的非标准交互模式
|
|
12
|
+
- 该模式无法通过通用模板(`universal/`)覆盖
|
|
13
|
+
- 标杆页面已稳定运行,业务字段已成熟
|
|
14
|
+
|
|
15
|
+
❌ **不建议提取**的场景:
|
|
16
|
+
|
|
17
|
+
- 该模式未来 6 个月可能频繁变化
|
|
18
|
+
- 仅 1~2 个页面使用
|
|
19
|
+
- 通用模板稍加配置即可满足
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 推荐方式:使用 template-extract Skill
|
|
24
|
+
|
|
25
|
+
最低门槛,**全 AI 辅助**:
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
开发者:触发模板提取,目标页:src/views/produce/.../mmwr-rolling-management/
|
|
29
|
+
|
|
30
|
+
AI: 1. 读取目标页 4 文件(index.vue + data.ts + index.scss + api.md)
|
|
31
|
+
2. 自动识别交互模式,对比已有 TPL,输出识别结论
|
|
32
|
+
3. 反问 3 个问题:领域归属 / 模板命名 / 脱敏需求
|
|
33
|
+
4. 生成标准 TPL 文件
|
|
34
|
+
5. 写入 domains/{domain}/
|
|
35
|
+
6. 自动更新 templates/_index.md
|
|
36
|
+
7. 输出后续提交步骤
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
详见 `skills/core/template-extract/SKILL.md`。
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## TPL 文件格式规范
|
|
44
|
+
|
|
45
|
+
每个领域模板必须包含以下章节:
|
|
46
|
+
|
|
47
|
+
```markdown
|
|
48
|
+
# {TPL_NAME}:{中文名}
|
|
49
|
+
|
|
50
|
+
> **适用场景**:(一句话场景描述)
|
|
51
|
+
> **识别特征**:(原型/详设中如何识别本模式)
|
|
52
|
+
> **布局核心**:(关键组件 / 布局方式)
|
|
53
|
+
> **⚠️ 重要约束**:(与通用模板的核心区别)
|
|
54
|
+
> **参考标杆**:`src/views/.../{kebab-page-name}/`
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## 识别规则
|
|
59
|
+
|
|
60
|
+
(5 条以内的明确判定条件)
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## 代码模板
|
|
65
|
+
|
|
66
|
+
### index.vue
|
|
67
|
+
|
|
68
|
+
(完整可运行代码,使用占位符 `[资源名]` `[服务缩写]`)
|
|
69
|
+
|
|
70
|
+
### data.ts
|
|
71
|
+
|
|
72
|
+
(同上)
|
|
73
|
+
|
|
74
|
+
### index.scss
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## 注意事项
|
|
79
|
+
|
|
80
|
+
(陷阱 / 易错点 / 性能提示)
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## 命名规范
|
|
86
|
+
|
|
87
|
+
- TPL 文件名:`TPL-{ALL-CAPS-KEBAB}.md`
|
|
88
|
+
示例:`TPL-OPERATION-STATION.md`、`TPL-BATCH-INSPECT.md`
|
|
89
|
+
- 模板标识符:与文件名一致,全大写下划线
|
|
90
|
+
示例:`OPERATION_STATION`、`BATCH_INSPECT`
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## 提交流程
|
|
95
|
+
|
|
96
|
+
1. 通过 `template-extract` Skill 生成 TPL 文件
|
|
97
|
+
2. 人工 review 生成的内容(脱敏 / 占位符 / 注意事项)
|
|
98
|
+
3. 提交 PR:`feat(template): 新增领域模板 TPL-XXX`
|
|
99
|
+
4. CHENY 评审合入
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## 模板维护
|
|
104
|
+
|
|
105
|
+
- 标杆页面变更 → 同步更新 TPL(保持模板与实际代码一致)
|
|
106
|
+
- 模板使用频率低于预期 → 评估是否归档或合并到通用模板
|
|
107
|
+
- 通过 `convention-audit` 定期对比各 TPL 标杆页面与最新规范的一致性
|