@agile-team/wl-skills-kit 2.1.2 → 2.1.4

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.
Files changed (80) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +73 -5
  3. package/bin/wl-skills.js +35 -1
  4. package/files/.github/guides/README.md +13 -13
  5. package/files/.github/guides/architecture.md +555 -555
  6. package/files/.github/guides/usage.md +166 -166
  7. package/files/.github/reports/README.md +65 -65
  8. package/files/.github/reports/SYS_DICT_INFO.md +19 -19
  9. package/files/.github/reports/SYS_MENU_INFO.md +247 -247
  10. package/files/.github/reports/SYS_PERMISSION_INFO.md +20 -20
  11. package/files/.github/reports//347/273/204/344/273/266/346/217/220/345/217/226/345/273/272/350/256/256.md +33 -33
  12. package/files/.github/reports//350/247/204/350/214/203/345/256/241/346/237/245/346/212/245/345/221/212.md +44 -44
  13. package/files/.github/skills/_compat/README.md +108 -108
  14. package/files/.github/skills/_compat/headers/agents.txt +8 -8
  15. package/files/.github/skills/_compat/headers/claude-code.txt +7 -7
  16. package/files/.github/skills/_compat/headers/cline.txt +7 -7
  17. package/files/.github/skills/_compat/headers/cursor-mdc.txt +16 -16
  18. package/files/.github/skills/_compat/headers/cursor-rules.txt +7 -7
  19. package/files/.github/skills/_compat/headers/github-copilot.txt +1 -1
  20. package/files/.github/skills/_compat/headers/kiro.txt +10 -10
  21. package/files/.github/skills/_compat/headers/trae.txt +11 -11
  22. package/files/.github/skills/_compat/headers/windsurf.txt +7 -7
  23. package/files/.github/skills/_registry.md +81 -81
  24. package/files/.github/skills/core/api-contract/SKILL.md +344 -344
  25. package/files/.github/skills/core/api-contract/USAGE.md +110 -110
  26. package/files/.github/skills/core/convention-audit/SKILL.md +189 -189
  27. package/files/.github/skills/core/convention-audit/USAGE.md +99 -99
  28. package/files/.github/skills/core/page-codegen/SKILL.md +973 -973
  29. package/files/.github/skills/core/page-codegen/USAGE.md +102 -102
  30. package/files/.github/skills/core/page-codegen/templates/_index.md +46 -46
  31. package/files/.github/skills/core/page-codegen/templates/domains/_CONTRIBUTING.md +107 -107
  32. package/files/.github/skills/core/page-codegen/templates/domains/produce/TPL-OPERATION-STATION.md +442 -442
  33. package/files/.github/skills/core/page-codegen/templates/domains/sale/README.md +26 -26
  34. package/files/.github/skills/core/page-codegen/templates/universal/TPL-CHANGE-HISTORY.md +276 -276
  35. package/files/.github/skills/core/page-codegen/templates/universal/TPL-DETAIL-TABS.md +1145 -1145
  36. package/files/.github/skills/core/page-codegen/templates/universal/TPL-DRIVEN.md +124 -124
  37. package/files/.github/skills/core/page-codegen/templates/universal/TPL-FORM-ROUTE.md +436 -436
  38. package/files/.github/skills/core/page-codegen/templates/universal/TPL-LIST.md +191 -191
  39. package/files/.github/skills/core/page-codegen/templates/universal/TPL-MASTER-DETAIL.md +148 -148
  40. package/files/.github/skills/core/page-codegen/templates/universal/TPL-RECORD-FORM.md +371 -371
  41. package/files/.github/skills/core/page-codegen/templates/universal/TPL-TREE-LIST.md +186 -186
  42. package/files/.github/skills/core/prototype-scan/SKILL.md +498 -498
  43. package/files/.github/skills/core/prototype-scan/USAGE.md +95 -95
  44. package/files/.github/skills/core/template-extract/SKILL.md +139 -139
  45. package/files/.github/skills/core/template-extract/USAGE.md +93 -93
  46. package/files/.github/skills/domain/README.md +51 -51
  47. package/files/.github/skills/ops/code-fix/SKILL.draft.md +108 -108
  48. package/files/.github/skills/sync/dict-sync/SKILL.draft.md +100 -100
  49. package/files/.github/skills/sync/menu-sync/SKILL.md +258 -258
  50. package/files/.github/skills/sync/menu-sync/USAGE.md +104 -104
  51. package/files/.github/skills/sync/menu-sync/env/env.local.json +6 -6
  52. package/files/.github/skills/sync/menu-sync/env/guide.md +83 -83
  53. package/files/.github/skills/sync/permission-sync/SKILL.draft.md +91 -91
  54. package/files/.github/standards/01-toolchain.md +57 -57
  55. package/files/.github/standards/02-code-structure.md +111 -111
  56. package/files/.github/standards/03-comments.md +53 -53
  57. package/files/.github/standards/04-coding-basics.md +33 -33
  58. package/files/.github/standards/05-logging.md +38 -38
  59. package/files/.github/standards/06-security.md +44 -44
  60. package/files/.github/standards/07-config.md +52 -52
  61. package/files/.github/standards/08-git.md +60 -60
  62. package/files/.github/standards/09-typescript.md +71 -71
  63. package/files/.github/standards/10-pinia.md +57 -57
  64. package/files/.github/standards/11-form-validation.md +81 -81
  65. package/files/.github/standards/12-base-table.md +116 -116
  66. package/files/.github/standards/13-platform-components.md +123 -123
  67. package/files/.github/standards/index.md +89 -89
  68. package/files/demo/produce/aiflow/mmwr-customer-apply-change-history/data.ts +196 -196
  69. package/files/demo/produce/aiflow/mmwr-customer-apply-change-history/index.scss +150 -150
  70. package/files/demo/produce/aiflow/mmwr-customer-apply-change-history/index.vue +79 -79
  71. package/files/docs/jh-date-range.md +257 -257
  72. package/files/docs/jh-date.md +222 -222
  73. package/files/docs/jh-dept-picker.md +190 -190
  74. package/files/docs/jh-drag-row.md +590 -590
  75. package/files/docs/jh-file-upload.md +216 -216
  76. package/files/docs/jh-picker.md +218 -218
  77. package/files/docs/jh-select.md +148 -148
  78. package/files/docs/jh-text.md +248 -248
  79. package/files/docs/jh-user-picker.md +197 -197
  80. package/package.json +2 -4
@@ -1,51 +1,51 @@
1
- # domain/ — 领域专属 Skill 占位目录
2
-
3
- > **当前状态**:空目录,等待领域 Skill 沉淀。
4
-
5
- ---
6
-
7
- ## 用途
8
-
9
- `domain/` 用于存放**强业务域相关的 Skill**——这类 Skill 在其他域几乎无复用价值,但在特定业务域内高频使用。
10
-
11
- 与 `core/`(全业务通用)和 `sync/`(后端联动通用)不同,`domain/` 的 Skill 允许直接依赖领域特有的术语、流程和数据结构。
12
-
13
- ---
14
-
15
- ## 目录结构预期
16
-
17
- ```
18
- domain/
19
- ├── README.md ← 本文件
20
- ├── produce/ 生产域(如高炉计划、轧钢批次、工序流转等专属流程)
21
- │ └── ...
22
- ├── sale/ 销售域(如合同审批流、信用额度等专属流程)
23
- │ └── ...
24
- └── {其他域}/ 按需创建
25
- ```
26
-
27
- ---
28
-
29
- ## 何时在此创建新 Skill
30
-
31
- 满足以下条件时,在对应域子目录下创建新 Skill:
32
-
33
- 1. 该流程与业务域**强绑定**(换了域就完全不适用)
34
- 2. 在本域内**高频触发**(≥3 个不同功能模块会用到)
35
- 3. `core/` 里已有的 Skill **无法覆盖**(不是简单参数调整能解决的)
36
-
37
- ---
38
-
39
- ## 贡献流程
40
-
41
- 1. 在对应域子目录下创建 `{skill-name}/SKILL.md`
42
- 2. 更新 `skills/_registry.md` 启用路由表
43
- 3. 同步在 `skills/_registry.md` 的目录分级图里添加条目
44
- 4. 可选:创建 `USAGE.md` 供域内团队成员阅读
45
- 5. 参考 `kit-internal/CONTRIBUTING.md` 第三节"添加新 Skill"
46
-
47
- ---
48
-
49
- ## 扩展策略
50
-
51
- > 当 `domain/` 下某个域的 Skill 数量超过 **5 个**,或产生跨团队复用需求时,考虑将其拆为独立 npm 包(如 `@agile-team/wl-skills-produce`),本包仅保留 `core/sync/ops`。
1
+ # domain/ — 领域专属 Skill 占位目录
2
+
3
+ > **当前状态**:空目录,等待领域 Skill 沉淀。
4
+
5
+ ---
6
+
7
+ ## 用途
8
+
9
+ `domain/` 用于存放**强业务域相关的 Skill**——这类 Skill 在其他域几乎无复用价值,但在特定业务域内高频使用。
10
+
11
+ 与 `core/`(全业务通用)和 `sync/`(后端联动通用)不同,`domain/` 的 Skill 允许直接依赖领域特有的术语、流程和数据结构。
12
+
13
+ ---
14
+
15
+ ## 目录结构预期
16
+
17
+ ```
18
+ domain/
19
+ ├── README.md ← 本文件
20
+ ├── produce/ 生产域(如高炉计划、轧钢批次、工序流转等专属流程)
21
+ │ └── ...
22
+ ├── sale/ 销售域(如合同审批流、信用额度等专属流程)
23
+ │ └── ...
24
+ └── {其他域}/ 按需创建
25
+ ```
26
+
27
+ ---
28
+
29
+ ## 何时在此创建新 Skill
30
+
31
+ 满足以下条件时,在对应域子目录下创建新 Skill:
32
+
33
+ 1. 该流程与业务域**强绑定**(换了域就完全不适用)
34
+ 2. 在本域内**高频触发**(≥3 个不同功能模块会用到)
35
+ 3. `core/` 里已有的 Skill **无法覆盖**(不是简单参数调整能解决的)
36
+
37
+ ---
38
+
39
+ ## 贡献流程
40
+
41
+ 1. 在对应域子目录下创建 `{skill-name}/SKILL.md`
42
+ 2. 更新 `skills/_registry.md` 启用路由表
43
+ 3. 同步在 `skills/_registry.md` 的目录分级图里添加条目
44
+ 4. 可选:创建 `USAGE.md` 供域内团队成员阅读
45
+ 5. 参考 `kit-internal/CONTRIBUTING.md` 第三节"添加新 Skill"
46
+
47
+ ---
48
+
49
+ ## 扩展策略
50
+
51
+ > 当 `domain/` 下某个域的 Skill 数量超过 **5 个**,或产生跨团队复用需求时,考虑将其拆为独立 npm 包(如 `@agile-team/wl-skills-produce`),本包仅保留 `core/sync/ops`。
@@ -1,108 +1,108 @@
1
- ---
2
- name: code-fix
3
- description: "[PLANNED — DRAFT, not yet active] 受控自动修复 Skill 设计草稿。基于 convention-audit 报告,对单条/分组偏差执行 AI 修复,全程必须人工 review 通过 + 单测护栏。"
4
- status: planned
5
- ---
6
-
7
- # Skill: 受控自动修复(code-fix)— 草稿
8
-
9
- > ⚠️ **本文件为设计草稿(SKILL.draft.md),未启用,不参与 AI 调度。**
10
-
11
- ---
12
-
13
- ## 1. 设计目标
14
-
15
- `convention-audit` 已能产出偏差清单。`code-fix` 在此基础上提供**受控的自动修复**:
16
-
17
- - **单条修复**:选定 1 条偏差 → AI 修改 → diff 确认 → 写入
18
- - **分组修复**:选定一类偏差(如"全部缺少 :scoped")→ 批量修改 → 总体 diff → 分文件确认 → 写入
19
- - **预置修复模板**:常见偏差直接走规则,不调 AI
20
-
21
- ---
22
-
23
- ## 2. 工作流
24
-
25
- ```
26
- convention-audit 报告 (reports/AUDIT_AI_*.md)
27
-
28
-
29
- [1] 用户从报告挑选 issueId(或 issueGroup)
30
-
31
-
32
- [2] 解析 issue → 定位文件 + 行号 + 偏差类型
33
-
34
-
35
- [3] 选择修复策略:
36
- ├─ rule-based(如缺 :scoped、缺 cid 等)→ 走预置模板
37
- └─ ai-based(语义性偏差)→ 调 AI 生成 patch
38
-
39
-
40
- [4] Pre-flight 输出 diff 预览(人读)
41
-
42
-
43
- [5] 用户确认 yes/no
44
-
45
- ├─ yes → 跑 lint + typecheck(如配置)
46
- │ ├─ 通过 → 写入文件 + 输出 reports/CODE_FIX_<YYYYMMDD>.md
47
- │ └─ 失败 → 回滚 + 标记 issue "待人工"
48
-
49
- └─ no → 跳过该 issue,回到挑选界面
50
- ```
51
-
52
- ---
53
-
54
- ## 3. 受控原则(关键)
55
-
56
- | 原则 | 实现 |
57
- | ------------------- | ------------------------------------------------------------- |
58
- | **不破坏功能** | 修复前后跑 lint + typecheck,失败回滚 |
59
- | **不批量盲改** | 每个文件改完都让用户看 diff,禁止全自动跳过确认 |
60
- | **可回滚** | 修改前内存保留原始内容,输出报告含还原 patch |
61
- | **范围明确** | 只改 issue 报告里点名的行,不顺手"重构"周边 |
62
- | **AI 不生成新逻辑** | code-fix 只修偏差,**不**做功能补全(那是 page-codegen 的活) |
63
-
64
- ---
65
-
66
- ## 4. 偏差类型 → 修复策略对照
67
-
68
- | 偏差类型 | 来源 standards | 策略 | 难度 |
69
- | ----------------------------------- | ---------------------- | ---------- | ---- |
70
- | EColumn 缺 cid | data-ts.md | rule-based | 易 |
71
- | scss 文件缺 :scoped 包裹 | scss.md | rule-based | 易 |
72
- | import 路径不规范 | imports.md | rule-based | 易 |
73
- | Hook 类未继承 AbstractPageQueryHook | page.md | rule-based | 中 |
74
- | API_CONFIG URL 不符合命名约定 | api-contract.md | ai-based | 中 |
75
- | 表格列定义与 api.md 字段不一致 | api-contract + data-ts | ai-based | 难 |
76
- | 业务语义偏差(流程不对) | 多 standards 综合 | **不修复** | - |
77
-
78
- ---
79
-
80
- ## 5. 命令形态(拟定)
81
-
82
- ```
83
- "修复 reports/AUDIT_AI_*.md 中的 issue#3" → 单条
84
- "修复 reports/AUDIT_AI_*.md 中所有 scss 偏差" → 分组
85
- "修复全部 rule-based 偏差,跳过 ai-based" → 受控批量
86
- "列出可修复的 issue" → 不动手,仅列清单
87
- ```
88
-
89
- ---
90
-
91
- ## 6. 与其他 Skill 关系
92
-
93
- | Skill | 关系 |
94
- | ---------------- | --------------------------------------- |
95
- | convention-audit | **前置**:必须先有审计报告才能 code-fix |
96
- | page-codegen | 互斥:生成新页面用 codegen,不要用 fix |
97
- | template-extract | 无直接关系 |
98
-
99
- ---
100
-
101
- ## 7. 转正前的开发任务
102
-
103
- - [ ] 沉淀至少 10 个 rule-based 修复模板
104
- - [ ] 设计 patch 内联格式(diff/unified)
105
- - [ ] 决定 lint/typecheck 失败的处理(默认回滚 + 标记,无须用户决策)
106
- - [ ] PR review 集成(修复完是否自动建 PR、是否分 commit)
107
- - [ ] 防御对抗性 prompt:用户能否引导 AI 顺手改业务逻辑?应在 SKILL.md 强制约束
108
- - [ ] 灰度策略:先支持单文件、再支持单 issue 组、最后批量
1
+ ---
2
+ name: code-fix
3
+ description: "[PLANNED — DRAFT, not yet active] 受控自动修复 Skill 设计草稿。基于 convention-audit 报告,对单条/分组偏差执行 AI 修复,全程必须人工 review 通过 + 单测护栏。"
4
+ status: planned
5
+ ---
6
+
7
+ # Skill: 受控自动修复(code-fix)— 草稿
8
+
9
+ > ⚠️ **本文件为设计草稿(SKILL.draft.md),未启用,不参与 AI 调度。**
10
+
11
+ ---
12
+
13
+ ## 1. 设计目标
14
+
15
+ `convention-audit` 已能产出偏差清单。`code-fix` 在此基础上提供**受控的自动修复**:
16
+
17
+ - **单条修复**:选定 1 条偏差 → AI 修改 → diff 确认 → 写入
18
+ - **分组修复**:选定一类偏差(如"全部缺少 :scoped")→ 批量修改 → 总体 diff → 分文件确认 → 写入
19
+ - **预置修复模板**:常见偏差直接走规则,不调 AI
20
+
21
+ ---
22
+
23
+ ## 2. 工作流
24
+
25
+ ```
26
+ convention-audit 报告 (reports/AUDIT_AI_*.md)
27
+
28
+
29
+ [1] 用户从报告挑选 issueId(或 issueGroup)
30
+
31
+
32
+ [2] 解析 issue → 定位文件 + 行号 + 偏差类型
33
+
34
+
35
+ [3] 选择修复策略:
36
+ ├─ rule-based(如缺 :scoped、缺 cid 等)→ 走预置模板
37
+ └─ ai-based(语义性偏差)→ 调 AI 生成 patch
38
+
39
+
40
+ [4] Pre-flight 输出 diff 预览(人读)
41
+
42
+
43
+ [5] 用户确认 yes/no
44
+
45
+ ├─ yes → 跑 lint + typecheck(如配置)
46
+ │ ├─ 通过 → 写入文件 + 输出 reports/CODE_FIX_<YYYYMMDD>.md
47
+ │ └─ 失败 → 回滚 + 标记 issue "待人工"
48
+
49
+ └─ no → 跳过该 issue,回到挑选界面
50
+ ```
51
+
52
+ ---
53
+
54
+ ## 3. 受控原则(关键)
55
+
56
+ | 原则 | 实现 |
57
+ | ------------------- | ------------------------------------------------------------- |
58
+ | **不破坏功能** | 修复前后跑 lint + typecheck,失败回滚 |
59
+ | **不批量盲改** | 每个文件改完都让用户看 diff,禁止全自动跳过确认 |
60
+ | **可回滚** | 修改前内存保留原始内容,输出报告含还原 patch |
61
+ | **范围明确** | 只改 issue 报告里点名的行,不顺手"重构"周边 |
62
+ | **AI 不生成新逻辑** | code-fix 只修偏差,**不**做功能补全(那是 page-codegen 的活) |
63
+
64
+ ---
65
+
66
+ ## 4. 偏差类型 → 修复策略对照
67
+
68
+ | 偏差类型 | 来源 standards | 策略 | 难度 |
69
+ | ----------------------------------- | ---------------------- | ---------- | ---- |
70
+ | EColumn 缺 cid | data-ts.md | rule-based | 易 |
71
+ | scss 文件缺 :scoped 包裹 | scss.md | rule-based | 易 |
72
+ | import 路径不规范 | imports.md | rule-based | 易 |
73
+ | Hook 类未继承 AbstractPageQueryHook | page.md | rule-based | 中 |
74
+ | API_CONFIG URL 不符合命名约定 | api-contract.md | ai-based | 中 |
75
+ | 表格列定义与 api.md 字段不一致 | api-contract + data-ts | ai-based | 难 |
76
+ | 业务语义偏差(流程不对) | 多 standards 综合 | **不修复** | - |
77
+
78
+ ---
79
+
80
+ ## 5. 命令形态(拟定)
81
+
82
+ ```
83
+ "修复 reports/AUDIT_AI_*.md 中的 issue#3" → 单条
84
+ "修复 reports/AUDIT_AI_*.md 中所有 scss 偏差" → 分组
85
+ "修复全部 rule-based 偏差,跳过 ai-based" → 受控批量
86
+ "列出可修复的 issue" → 不动手,仅列清单
87
+ ```
88
+
89
+ ---
90
+
91
+ ## 6. 与其他 Skill 关系
92
+
93
+ | Skill | 关系 |
94
+ | ---------------- | --------------------------------------- |
95
+ | convention-audit | **前置**:必须先有审计报告才能 code-fix |
96
+ | page-codegen | 互斥:生成新页面用 codegen,不要用 fix |
97
+ | template-extract | 无直接关系 |
98
+
99
+ ---
100
+
101
+ ## 7. 转正前的开发任务
102
+
103
+ - [ ] 沉淀至少 10 个 rule-based 修复模板
104
+ - [ ] 设计 patch 内联格式(diff/unified)
105
+ - [ ] 决定 lint/typecheck 失败的处理(默认回滚 + 标记,无须用户决策)
106
+ - [ ] PR review 集成(修复完是否自动建 PR、是否分 commit)
107
+ - [ ] 防御对抗性 prompt:用户能否引导 AI 顺手改业务逻辑?应在 SKILL.md 强制约束
108
+ - [ ] 灰度策略:先支持单文件、再支持单 issue 组、最后批量
@@ -1,100 +1,100 @@
1
- ---
2
- name: dict-sync
3
- description: "[PLANNED — DRAFT, not yet active] 字典同步 Skill 设计草稿。机制类同 menu-sync:基于 reports/SYS_DICT_INFO.md 基线 ↔ 线上字典对比,自动补齐。"
4
- status: planned
5
- ---
6
-
7
- # Skill: 字典同步(dict-sync)— 草稿
8
-
9
- > ⚠️ **本文件为设计草稿(SKILL.draft.md),未启用,不参与 AI 调度。**
10
- > 待相关后端接口稳定后,转正为 `SKILL.md`。
11
-
12
- ---
13
-
14
- ## 1. 设计目标
15
-
16
- 页面 `data.ts` 中常使用 `logicType: BusLogicDataType.dict` 引用数据字典(如 `customer_state`、`mmwr_apply_status`)。新增页面/字段时,需要:
17
-
18
- 1. 在系统字典表中**添加新字典码**(dictCode + 描述)
19
- 2. 在字典表中**添加各项条目**(value + label + sortNo)
20
- 3. 团队基线中保存当前线上字典(review/diff 用)
21
-
22
- `dict-sync` 自动化以上 3 步。
23
-
24
- ---
25
-
26
- ## 2. 数据流
27
-
28
- ```
29
- 本地基线 后端接口 Skill 触发
30
- ───────────────────────────────────── ───────────────────────────────── ────────────────
31
- reports/SYS_DICT_INFO.md ──fetch───→ GET /sys/dict/listAll
32
- ←──compare─── POST /sys/dict/save
33
- ──upload───→ POST /sys/dictItem/batchSave ─→ "同步字典"
34
- ```
35
-
36
- ---
37
-
38
- ## 3. 三种工作模式
39
-
40
- | 模式 | 触发 | 动作 |
41
- | ----------------- | --------------------- | ----------------------------------------- |
42
- | `pull`(刷基线) | "刷新字典基线" | 从线上拉全量字典 → 写入 SYS_DICT_INFO.md |
43
- | `push`(推新增) | "同步字典 / 创建字典" | 对比 data.ts 引用的字典 vs 基线,补齐线上 |
44
- | `audit`(仅检查) | "字典审计" | 输出报告,不调接口 |
45
-
46
- ---
47
-
48
- ## 4. 配置文件
49
-
50
- `.github/skills/sync/dict-sync/env/env.local.json`(不入 git):
51
-
52
- ```json
53
- {
54
- "gatewayPath": "https://uat-api.example.com",
55
- "token": "Bearer xxx",
56
- "tenantId": "10001",
57
- "_inherit": "复用 skills/sync/menu-sync/env/env.local.json 的 token、gatewayPath 等基础配置"
58
- }
59
- ```
60
-
61
- > 实现时支持 `_inherit`:本目录无 env.local.json 时回落到 menu-sync 的同名文件。
62
-
63
- ---
64
-
65
- ## 5. 冲突处理策略
66
-
67
- | 场景 | 策略 |
68
- | -------------------------------- | -------------------------------------------- |
69
- | 本地新增字典,线上不存在 | 调用 /sys/dict/save 创建 |
70
- | 本地有的字典项,线上字典已禁用 | 询问:跳过 / 重新启用 / 视为新建 |
71
- | 本地与线上 value 相同 label 不同 | 询问:以本地为准 / 以线上为准 / 跳过 |
72
- | 线上有的字典/项,本地没有 | 仅记录日志,**不主动删除**(防误删生产数据) |
73
-
74
- ---
75
-
76
- ## 6. 与其他 Skill 联动
77
-
78
- - **page-codegen**:生成页面时如发现 data.ts 用到未在基线中的字典码,自动在生成报告中提示"运行 dict-sync 补齐"
79
- - **convention-audit**:审计 standards/data-ts.md 时,对比基线检测"字典码未定义"
80
- - **prototype-scan**:扫描原型阶段如识别出状态/枚举字段,提出字典码建议
81
-
82
- ---
83
-
84
- ## 7. 转正前的开发任务
85
-
86
- - [ ] 确认后端字典批量保存接口(save / batchSave / 字段名 / 响应外壳是否 `{code:2000,data}`)
87
- - [ ] 设计 SYS_DICT_INFO.md 自动序列化/反序列化(防 markdown 渲染破坏数据)
88
- - [ ] 实现 `_inherit` 配置回落机制
89
- - [ ] 决定字典审计严格度(必须有 enabled / sortNo / remark 等字段)
90
- - [ ] 提供 `dict-collect` Skill 或集成到 prototype-scan:从代码自动汇总字典依赖
91
- - [ ] 处理多语言字典(i18n label)
92
- - [ ] PROD 环境保护机制(推送前必须二次确认)
93
-
94
- ---
95
-
96
- ## 8. 风险与边界
97
-
98
- - **不删除**:永远不主动删除线上字典/字典项
99
- - **租户隔离**:env.local.json 的 tenantId 严格隔离
100
- - **审计日志**:每次 push 输出 `reports/DICT_SYNC_<YYYYMMDD>.md`,含调用接口列表 + 入参 + 响应 + 回滚 SQL
1
+ ---
2
+ name: dict-sync
3
+ description: "[PLANNED — DRAFT, not yet active] 字典同步 Skill 设计草稿。机制类同 menu-sync:基于 reports/SYS_DICT_INFO.md 基线 ↔ 线上字典对比,自动补齐。"
4
+ status: planned
5
+ ---
6
+
7
+ # Skill: 字典同步(dict-sync)— 草稿
8
+
9
+ > ⚠️ **本文件为设计草稿(SKILL.draft.md),未启用,不参与 AI 调度。**
10
+ > 待相关后端接口稳定后,转正为 `SKILL.md`。
11
+
12
+ ---
13
+
14
+ ## 1. 设计目标
15
+
16
+ 页面 `data.ts` 中常使用 `logicType: BusLogicDataType.dict` 引用数据字典(如 `customer_state`、`mmwr_apply_status`)。新增页面/字段时,需要:
17
+
18
+ 1. 在系统字典表中**添加新字典码**(dictCode + 描述)
19
+ 2. 在字典表中**添加各项条目**(value + label + sortNo)
20
+ 3. 团队基线中保存当前线上字典(review/diff 用)
21
+
22
+ `dict-sync` 自动化以上 3 步。
23
+
24
+ ---
25
+
26
+ ## 2. 数据流
27
+
28
+ ```
29
+ 本地基线 后端接口 Skill 触发
30
+ ───────────────────────────────────── ───────────────────────────────── ────────────────
31
+ reports/SYS_DICT_INFO.md ──fetch───→ GET /sys/dict/listAll
32
+ ←──compare─── POST /sys/dict/save
33
+ ──upload───→ POST /sys/dictItem/batchSave ─→ "同步字典"
34
+ ```
35
+
36
+ ---
37
+
38
+ ## 3. 三种工作模式
39
+
40
+ | 模式 | 触发 | 动作 |
41
+ | ----------------- | --------------------- | ----------------------------------------- |
42
+ | `pull`(刷基线) | "刷新字典基线" | 从线上拉全量字典 → 写入 SYS_DICT_INFO.md |
43
+ | `push`(推新增) | "同步字典 / 创建字典" | 对比 data.ts 引用的字典 vs 基线,补齐线上 |
44
+ | `audit`(仅检查) | "字典审计" | 输出报告,不调接口 |
45
+
46
+ ---
47
+
48
+ ## 4. 配置文件
49
+
50
+ `.github/skills/sync/dict-sync/env/env.local.json`(不入 git):
51
+
52
+ ```json
53
+ {
54
+ "gatewayPath": "https://uat-api.example.com",
55
+ "token": "Bearer xxx",
56
+ "tenantId": "10001",
57
+ "_inherit": "复用 skills/sync/menu-sync/env/env.local.json 的 token、gatewayPath 等基础配置"
58
+ }
59
+ ```
60
+
61
+ > 实现时支持 `_inherit`:本目录无 env.local.json 时回落到 menu-sync 的同名文件。
62
+
63
+ ---
64
+
65
+ ## 5. 冲突处理策略
66
+
67
+ | 场景 | 策略 |
68
+ | -------------------------------- | -------------------------------------------- |
69
+ | 本地新增字典,线上不存在 | 调用 /sys/dict/save 创建 |
70
+ | 本地有的字典项,线上字典已禁用 | 询问:跳过 / 重新启用 / 视为新建 |
71
+ | 本地与线上 value 相同 label 不同 | 询问:以本地为准 / 以线上为准 / 跳过 |
72
+ | 线上有的字典/项,本地没有 | 仅记录日志,**不主动删除**(防误删生产数据) |
73
+
74
+ ---
75
+
76
+ ## 6. 与其他 Skill 联动
77
+
78
+ - **page-codegen**:生成页面时如发现 data.ts 用到未在基线中的字典码,自动在生成报告中提示"运行 dict-sync 补齐"
79
+ - **convention-audit**:审计 standards/data-ts.md 时,对比基线检测"字典码未定义"
80
+ - **prototype-scan**:扫描原型阶段如识别出状态/枚举字段,提出字典码建议
81
+
82
+ ---
83
+
84
+ ## 7. 转正前的开发任务
85
+
86
+ - [ ] 确认后端字典批量保存接口(save / batchSave / 字段名 / 响应外壳是否 `{code:2000,data}`)
87
+ - [ ] 设计 SYS_DICT_INFO.md 自动序列化/反序列化(防 markdown 渲染破坏数据)
88
+ - [ ] 实现 `_inherit` 配置回落机制
89
+ - [ ] 决定字典审计严格度(必须有 enabled / sortNo / remark 等字段)
90
+ - [ ] 提供 `dict-collect` Skill 或集成到 prototype-scan:从代码自动汇总字典依赖
91
+ - [ ] 处理多语言字典(i18n label)
92
+ - [ ] PROD 环境保护机制(推送前必须二次确认)
93
+
94
+ ---
95
+
96
+ ## 8. 风险与边界
97
+
98
+ - **不删除**:永远不主动删除线上字典/字典项
99
+ - **租户隔离**:env.local.json 的 tenantId 严格隔离
100
+ - **审计日志**:每次 push 输出 `reports/DICT_SYNC_<YYYYMMDD>.md`,含调用接口列表 + 入参 + 响应 + 回滚 SQL