@agile-team/wl-skills-ui 1.11.1 → 1.13.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.
Files changed (70) hide show
  1. package/CHANGELOG.md +62 -4
  2. package/README.md +66 -43
  3. package/SKILL.md +104 -653
  4. package/bin/wl-ui.js +304 -40
  5. package/docs/ag-grid-empty-state.md +3 -3
  6. package/docs/compat-matrix.md +2 -2
  7. package/docs/governance-long-term.md +3 -2
  8. package/docs/optimization-plan-1.12.md +92 -0
  9. package/docs/split-grid-resize.md +3 -4
  10. package/docs/table-overflow-tooltip.md +9 -3
  11. package/docs/version-history.md +23 -2
  12. package/es/auto.js +3 -3
  13. package/es/{chunk-M2X7ZZBR.js → chunk-GPDL5QNR.js} +90 -17
  14. package/es/{chunk-Q62CGYZA.js → chunk-KH5UJQLR.js} +4 -4
  15. package/es/{chunk-ZZXLRRGF.js → chunk-ZDMBAIBJ.js} +31 -31
  16. package/es/common-preset.d.ts +5 -2
  17. package/es/common-preset.js +6 -6
  18. package/es/index.d.ts +2 -17
  19. package/es/index.js +4 -4
  20. package/es/presets/security.js +2 -2
  21. package/es/profiles/legacy-jh-ag.d.ts +2 -0
  22. package/es/profiles/legacy-jh-ag.js +5 -0
  23. package/es/profiles/legacy-jh-element.d.ts +2 -0
  24. package/es/profiles/legacy-jh-element.js +5 -0
  25. package/es/profiles/native-element.d.ts +2 -0
  26. package/es/profiles/native-element.js +5 -0
  27. package/es/profiles/native-jh-ag.d.ts +2 -0
  28. package/es/profiles/native-jh-ag.js +5 -0
  29. package/es/{renderers-BNvL--Ho.d.ts → profiles-DNF5Zsu3.d.ts} +20 -1
  30. package/mcp/README.md +2 -2
  31. package/mcp/server.js +213 -104
  32. package/package.json +175 -162
  33. package/reference/ag-cell-renders.ts +22 -22
  34. package/scanner/coverage.mjs +69 -33
  35. package/scanner/engine.mjs +239 -0
  36. package/scanner/exempt.mjs +1 -1
  37. package/scanner/fix.mjs +236 -147
  38. package/scanner/index.mjs +171 -162
  39. package/scanner/integration.mjs +219 -200
  40. package/scanner/report.mjs +124 -20
  41. package/scanner/rules/_shared.mjs +10 -0
  42. package/scanner/rules/button.mjs +100 -16
  43. package/scanner/rules/index.mjs +58 -5
  44. package/scanner/rules/semantic.mjs +1 -1
  45. package/scanner/ui-contract.mjs +8 -5
  46. package/skills/_flows/legacy-skin-align.md +1 -1
  47. package/skills/_flows/new-project-init.md +2 -3
  48. package/skills/_meta/_detection.md +12 -12
  49. package/skills/_meta/_registry.md +1 -1
  50. package/skills/element/el-table/SKILL.md +1 -1
  51. package/skills/ops/fix/SKILL.md +9 -6
  52. package/skills/ops/scan/SKILL.md +11 -7
  53. package/skills/runtime/style-align/SKILL.md +1 -1
  54. package/skills/vendors/ag-grid/SKILL.md +1 -1
  55. package/skills/vendors/base-table/SKILL.md +3 -3
  56. package/skills/vendors/jh-components/SKILL.md +2 -2
  57. package/skills/vendors/unknown-wrapper/SKILL.md +1 -1
  58. package/standards/architecture/01-layer-boundaries.md +28 -5
  59. package/standards/profiles-loader.mjs +121 -0
  60. package/standards/profiles.json +38 -0
  61. package/standards/rules.json +27 -6
  62. package/standards/ui/01-table.md +4 -3
  63. package/styles/presets/legacy-jh-ag.scss +4 -0
  64. package/styles/presets/legacy-jh-element.scss +4 -0
  65. package/styles/presets/native-element.scss +4 -0
  66. package/styles/vendors/_ag-grid.scss +1 -1
  67. package/styles/vendors/_base-components.scss +8 -1
  68. package/styles/vendors/_base-table.scss +15 -4
  69. package/styles/vendors/_jh-drag-row.scss +4 -0
  70. package/styles/vendors/no-ag.scss +13 -0
package/CHANGELOG.md CHANGED
@@ -6,6 +6,64 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [1.13.0] - 2026-09-30
10
+
11
+ ### Added
12
+
13
+ - 新增 `native-jh-ag` 能力 Profile,覆盖平台子应用终态形态:native 运行时(`defineColumns`/`renderOps` + common preset)叠加 jh/Base/C 封装组件,AG Grid 经 npm 依赖或 Module Federation 远程提供。样式入口为 `styles/presets/full`(包根 `styles` 全量写法等价认可),runtime guard 与 `legacy-jh-ag` 同集(分屏 resize + AG 空态),`runtime/auto` 作为等价 runtime 引用被 I003 接受。
14
+ - Profile 解析新增 `explicit` 语义:`.wl-skills-ui-manifest.json` 的 `profile` 字段与 `.wl-ui-profile.json`、`--profile` 参数同为显式声明来源。
15
+ - 依赖识别支持 Module Federation AG 形态:存在 `@originjs/vite-plugin-federation` 依赖时按 AG 形态给出建议(平台子应用的 AG Grid 经 `agGridApp` 远程提供,npm 依赖不可见)。
16
+ - MCP 工具的 `profile` 枚举改由 `profiles.json` 事实源动态生成(此前硬编码三处,新增 profile 后 MCP 客户端会被 schema 拒绝)。
17
+
18
+ ### 性能与内存(运行时 guard)
19
+
20
+ - `theme-lock`:mutation 回调改为仅 html/body 自身 style 改写或 body 整替时重新落锁——原先任意 DOM 批量变更都执行 62 token × 2 元素的 CSSOM 读写(繁忙页面每帧必付),并顺带消除 childList 场景的重复双写。
21
+ - `ag-grid-empty-state`:属性记录(class/aria-hidden/hidden)不再走 `scanElement` 的 DOM 查询(AG Grid 每帧改写 style/class 的高频路径从全文档查询降为 O(1),可见性与布局由 rAF 刷新统一计量);grid 断连时同步退订其独占的 root/host/body resize 监听(共享宿主有引用保护),消除微前端反复挂载/卸载的游离 DOM 强引用泄漏。
22
+ - `split-grid-resize`:支持换 document 重绑(与其余 guard 对齐,微前端销毁重建不再残留旧 document 监听);pane 断连后即时退订 resize 监听。
23
+ - `renderers`:`autoTagType` 哈希循环外提 `String(value)`(原 O(n²) 字符串分配);`warnUnknownOpType` 的 NODE_ENV 探测提到模块顶层只做一次。
24
+
25
+ ### Fixed
26
+
27
+ - 修复 fixer 与规则判定复制导致的漂移风险:`CREATE_ACTION_LABEL`、`hasTrueBooleanAttr` 收敛为单一实现(`rules/_shared.mjs` / `button.mjs` 导出),fixer 直接复用,杜绝"扫描报问题但 fix 不修"。
28
+ - 修复两份 `walkVue` 语义分叉:fixer 改用 engine 的稳定排序实现(支持单文件、目标不存在时显式报错),并从共享包默认排除清单中移除业务目录名 `SelectPopupCom`。
29
+ - 修复 Markdown 报告"按规则统计"严重度列的 R01x 序号启发式失真:改读 `rules.json` 真实 severity;`summary` 的 `bySeverity` 补齐 `suggestion`/`review` 契约键。
30
+ - 修复 AG loading 动画 SVG data-URI 中 URL 编码的旧亮蓝色(`%232254F4`/`%237A98F8`)绕过禁色门禁的问题:改用品牌 token 色阶(primary/light-3/light-8/light-9),禁色正则补 `%23` 编码变体。
31
+ - 修复 `--wk-rating-lv*` token 前缀拼写漂移:统一为 `--wl-rating-lv*`(UI 契约扫描同时容忍新旧前缀);`coverage` 的 `el-pagination → element/el-dialog` 映射补充意图注释(R011 弹窗分页路由,非错误)。
32
+
33
+ ### Changed
34
+
35
+ - **兼容承诺:严格校验只认显式声明的 Profile。** `wl-ui check` / `wl-ui all` 在未显式声明 profile 时按 1.11 兼容口径校验(全量 `styles` 入口 + 任意 runtime 引用即通过),依赖自动识别仅用于 Skill 过滤与建议输出,不再作为执法依据——修复 1.12 把存量绿灯项目判红的问题。
36
+ - `wl-ui init` 仅在显式 `--profile` 时写入/更新 `.wl-ui-profile.json` 与安装清单的 `profile` 字段;自动识别结果只打印建议(`npx wl-ui init --profile <id>`),不再落盘固化猜测。
37
+ - `R003`、`R021` 等 Base/AG 专属规则同步对 `native-jh-ag` 启用。
38
+
39
+ ## [1.12.0] - 2026-08-30
40
+
41
+ ### Added
42
+
43
+ - 新增 `native-element`、`legacy-jh-element`、`legacy-jh-ag` 三个能力 Profile,统一声明 adapter、扫描规则、SCSS preset 与 runtime guard;提供 `.wl-ui-profile.json`、`wl-ui profiles` 和自动依赖识别。
44
+ - 新增 `wl-ui-scan.summary.v1` 与可分页的 `compact.v2` 低 token 协议;规则公共字段集中在 `ruleCatalog`,CLI/MCP 支持 `limit/cursor/nextCursor`。
45
+ - 新增 R043 静态已知按钮文案到语义 icon 的确定性规则,并加入 pass/fail fixture、fixer 与一致性门禁。
46
+ - Fixer 新增 `profile/only/skip` 范围约束、逐规则改动统计和 SHA-256 `planHash`;支持预览后以 `--plan-hash` 拒绝漂移计划。
47
+ - 新增共享 `scanner/engine.mjs`,CLI 与 MCP 使用同一扫描实现;MCP 不再为每次 scan/check/fix preview 创建 Node 子进程。
48
+
49
+ ### Changed
50
+
51
+ - `standards/rules.json` 成为 category、severity、layer、vendor、Profile 和 fixability 的运行期事实源;39 条元数据与 39 个实现一一对应,14 条可修规则与 fixer 集合一致。
52
+ - AG Grid 改为显式可选 adapter:R021、AG 样式、分屏/空态 observers 只在 `legacy-jh-ag` 启用。两个非 AG Profile 的编译产物由门禁保证零 `.ag-*` 选择器。
53
+ - `installCommonPreset()` 默认使用 `native-element`;旧 `runtime/auto` 与 `styles/skin` 保留 full legacy 兼容。
54
+ - MCP scan 默认从 `compact` 改为更小的 `summary`;changed-only 范围失败默认终止,显式 `--changed-fallback full` 才允许全量。
55
+ - 单文件编辑器安装改为托管 Skill 路由块,不再拼接全量 Skill;update/clean 保留项目自有 `AGENTS.md`、`CLAUDE.md`、`.clinerules` 内容和其他 MCP server。
56
+ - CI 增加 scanner/scripts lint、TypeScript 检查、覆盖率阈值、全部 Profile SCSS 编译、非 AG 隔离、规则/Skill 引用、生成 token 同步、包内容和浏览器契约门禁,并移除安装阶段重复 build。
57
+
58
+ ### Fixed
59
+
60
+ - 修复 `verify-package` 的 `Buffer.compare` 条件恒不成立,`dist/tokens.css` 漂移现在会阻止发布。
61
+ - 修复 fixer 忽略 `--only/--skip/mode` 并无条件把 BaseTable 切到 AG Grid 的问题。
62
+ - 修复 R013 脱离规则注册表、规则实现字段与元数据不一致、coverage/MCP 推荐不存在的 Skill 路径,以及 JSON fix 输出混入文本复检日志。
63
+ - 修复单文件安装覆盖用户规则、clean 删除整份用户文件、`.mcp.json` 清理误删其他 server 的风险。
64
+ - 修复扫描路径以 target 而非项目根为基准,导致单文件报告文件名为空、标准 `src/**` 豁免无法命中的问题。
65
+ - MCP target/exempt/project 现在受 `WL_PROJECT_ROOT` 边界约束;无效 changed fallback 与无法解析的用户 `.mcp.json` 均失败关闭,不再静默扩大扫描或覆盖配置。
66
+
9
67
  ## [1.11.1] - 2026-08-26
10
68
 
11
69
  ### Fixed
@@ -13,10 +71,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
13
71
  - AG Grid 空态守护导致上下分栏(`jh-drag-row`)手柄失去拖动行程:旧逻辑对分栏内所有 pane 按首次观测高度做快照并以 `min-height` 钉死,两侧地板相加约等于容器高度,分栏内任意一侧表格为空时手柄即拖不动,直到空态消失才解钉(wl-ui-produce 计划下达页实测复盘)。现只给持有空态表格的 pane 设置内容需求地板(pane 内非表格内容实测高度 + 160px 空态最小数据区),未持有空态表格的 pane 不钉死;空态提示保护、分屏根滚动、左右分栏同高语义与清理逻辑均不变。左右分栏(`drag-col`)路径零改动。
14
72
 
15
73
  ## [1.11.0] - 2026-08-24
16
-
17
- ### Fixed
18
-
19
- - AG Grid 选择列表头/行复选框横向错轴:平台定制版行 cell 不携带 `ag-checkbox-cell` 结构类,补充 `:has(.ag-selection-checkbox)` 反选兜底并清默认 widget 间距;全选框为表头 cell 直接子节点时改绝对定位居中,不强制 display、不压缩 comp-wrapper,普通表头隐藏的 select-all 节点保持不可见(produce 事故复盘,新增 5 项几何回归测试 ag-grid-selection-alignment)。
74
+
75
+ ### Fixed
76
+
77
+ - AG Grid 选择列表头/行复选框横向错轴:平台定制版行 cell 不携带 `ag-checkbox-cell` 结构类,补充 `:has(.ag-selection-checkbox)` 反选兜底并清默认 widget 间距;全选框为表头 cell 直接子节点时改绝对定位居中,不强制 display、不压缩 comp-wrapper,普通表头隐藏的 select-all 节点保持不可见(produce 事故复盘,新增 5 项几何回归测试 ag-grid-selection-alignment)。
20
78
 
21
79
  ### Added
22
80
 
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @agile-team/wl-skills-ui
2
2
 
3
- **企业级 UI 一致性与 AI 精确治理工具包 v1.11.1** — 面向 Vue 3 + Element Plus 的设计令牌、样式皮肤、页面骨架、运行时能力、静态扫描、确定性修复、AI Skill、MCP 与脱敏 UI 模板契约。
3
+ **企业级 UI 一致性与 AI 精确治理工具包 v1.13.0** — 面向 Vue 3 + Element Plus 的设计令牌、能力 Profile、样式皮肤、页面骨架、运行时能力、静态扫描、确定性修复、AI Skill、MCP 与脱敏 UI 模板契约。
4
4
 
5
5
  它把“视觉统一、问题识别、机械修复、项目适配和样例沉淀”拆成可验证、可组合的工程能力。脚本、规则和 MCP 先完成确定性工作,AI 只处理业务语义与人工决策,从而减少重复读源码、上下文 token 和误修改。
6
6
 
@@ -13,9 +13,9 @@
13
13
  | --- | --- | --- |
14
14
  | 统一新项目视觉 | Design Tokens、Element Plus 原子样式、页面 Layout、Runtime Preset | 颜色、尺寸、间距、圆角、表格和业务状态从同一事实源产生 |
15
15
  | 低成本治理老项目 | Skin 模式、Base*/jh-*/C_*/AG Grid 兼容层、定制页豁免 | 不改封装源码也能统一大部分视觉,避免一次性重构风险 |
16
- | 阻止 UI 回归 | 38 条 R-rule、接入检查、漂移基线、Git 增量扫描、CI 门禁 | 表头/内容不共轴、按钮无图标、日期弹层全屏等问题在提交前暴露 |
17
- | 安全机械修复 | dry-run、可修复规则、修复前快照、复检与一键回滚 | 自动化只处理可证明安全的属性和 token,不让 AI 猜测批改 |
18
- | 降低 AI token | compact JSON、changed-only、组件覆盖、意图路由、13 个 MCP Tool | AI 先读取结构化事实和问题摘要,只在必要时打开局部源码 |
16
+ | 阻止 UI 回归 | 39 条 R-rule、接入检查、漂移基线、Git 增量扫描、CI 门禁 | 表头/内容不共轴、按钮无图标、日期弹层全屏等问题在提交前暴露 |
17
+ | 安全机械修复 | Profile、only/skip、dry-run 计划哈希、快照、复检与回滚 | 自动化只处理可证明安全且已批准的动作,不让 AI 猜测批改 |
18
+ | 降低 AI token | summary、compact-v2 分页、changed-only、Skill 路由、13 个 MCP Tool | AI 先读总览和结构化事实,只在必要时获取有界明细或局部源码 |
19
19
  | 沉淀领域样例 | `ui-contract` extract / validate / match | 页面转为脱敏语义 JSON,不复制整页代码、接口、字段值或原始文案 |
20
20
  | 兼容多代项目 | EP 2.2+jh-ui 与原生 EP 2.7+ DOM 契约、Vite/doctor 检查 | 支持声明有 fixture 和真实浏览器证据,不靠文档口头约定 |
21
21
  | 降低运行时开销 | Shared Observer Hub、可选 guard、幂等安装与完整卸载 | 全部 guard 共用 1 个 MutationObserver + 1 个 ResizeObserver |
@@ -31,31 +31,39 @@ pnpm add @agile-team/wl-skills-ui
31
31
  # npm i @agile-team/wl-skills-ui
32
32
  ```
33
33
 
34
- ### 2. 选择接入模式
34
+ ### 2. 选择能力 Profile
35
35
 
36
- Native 适合新项目或源码完全可控的项目,启用 L0-L4 全能力:
36
+ Profile 同时决定 vendor adapter、扫描规则、样式入口和 runtime guard。AG Grid 是可选 adapter,不再由 `BaseTable` 隐式推断。
37
+
38
+ | Profile | 样式入口 | Runtime 入口 | AG Grid |
39
+ | --- | --- | --- | --- |
40
+ | `native-element` | `styles/presets/native-element` | `runtime/profiles/native-element` | 关闭 |
41
+ | `legacy-jh-element` | `styles/presets/legacy-jh-element` | `runtime/profiles/legacy-jh-element` | 关闭 |
42
+ | `legacy-jh-ag` | `styles/presets/legacy-jh-ag` | `runtime/profiles/legacy-jh-ag` | 开启 |
43
+ | `native-jh-ag` | `styles/presets/full`(等价包根 `styles` 全量入口) | `runtime/profiles/native-jh-ag`(`runtime/auto` 同集别名) | 开启 |
44
+
45
+ > **兼容承诺(1.13 起)**:只有显式声明(`--profile` / `.wl-ui-profile.json` / 安装清单)的 profile 才驱动严格校验;依赖自动识别仅用于 Skill 过滤与建议。未声明 profile 的项目按 1.11 兼容口径校验(全量 `styles` 入口 + 任意 runtime 引用即通过),升级不会把存量绿灯判红。
46
+
47
+ Native 项目:
37
48
 
38
49
  ```scss
39
50
  // src/assets/styles/index.scss
40
- @use "@agile-team/wl-skills-ui/styles" as *;
51
+ @use "@agile-team/wl-skills-ui/styles/presets/native-element" as *;
41
52
  ```
42
53
 
43
54
  ```ts
44
55
  // src/main.ts
45
- import { installCommonPreset } from "@agile-team/wl-skills-ui/runtime/common-preset";
46
-
47
- installCommonPreset();
56
+ import "@agile-team/wl-skills-ui/runtime/profiles/native-element";
48
57
  ```
49
58
 
50
- Skin 适合封装多、改源码代价高的老项目,只接管 L0-L2 视觉层:
59
+ 不使用 AG Grid 的老项目:
51
60
 
52
61
  ```scss
53
- @use "@agile-team/wl-skills-ui/styles/presets/skin" as *;
62
+ @use "@agile-team/wl-skills-ui/styles/presets/legacy-jh-element" as *;
54
63
  ```
55
64
 
56
65
  ```ts
57
- // 自动安装主题锁、溢出提示、分屏与 AG Grid 空态保护
58
- import "@agile-team/wl-skills-ui/runtime/auto";
66
+ import "@agile-team/wl-skills-ui/runtime/profiles/legacy-jh-element";
59
67
  ```
60
68
 
61
69
  如需最早稳定 CSS 变量,可在 `index.html` 的 `<head>` 先加载:
@@ -70,12 +78,12 @@ import "@agile-team/wl-skills-ui/runtime/auto";
70
78
  ### 3. 安装 AI Skill 并验证
71
79
 
72
80
  ```bash
73
- npx wl-ui init --project . --mode native
81
+ npx wl-ui init --project . --profile native-element
74
82
  npx wl-ui check --project .
75
- npx wl-ui scan --target src --output compact
83
+ npx wl-ui scan --target src --output summary
76
84
  ```
77
85
 
78
- 老项目将 `native` 改为 `skin`。`init` 会识别已存在的 AI 编辑器目录并安装对应规则;`update`、`diff`、`doctor` 和 `clean --dry-run` 负责后续生命周期。
86
+ 老项目选择 `legacy-jh-element` 或 `legacy-jh-ag`;平台子应用(native 运行时 + jh/Base 封装 + 联邦 AG Grid)选择 `native-jh-ag`。`init` 仅在显式 `--profile` 时写入 `.wl-ui-profile.json`,自动识别只打印建议;单文件编辑器只维护带边界标记的轻量 Skill 路由块,不覆盖项目自有 `AGENTS.md / CLAUDE.md / .clinerules` 内容。`update`、`diff`、`doctor` 和 `clean --dry-run` 负责后续生命周期。
79
87
 
80
88
  ## 能力地图
81
89
 
@@ -89,12 +97,14 @@ npx wl-ui scan --target src --output compact
89
97
 
90
98
  Vendor 覆盖顺序是:`Base* > jh-* > C_*/c_* > AG Grid > custom wrappers`。越靠前越接近项目事实源,通用兜底不得覆盖已识别的专用结构。
91
99
 
92
- 包提供两种组合:
100
+ 旧 `native/skin` 参数仍作为兼容别名;新接入应使用 Profile:
93
101
 
94
- | 模式 | 层级 | 适用场景 | 边界 |
102
+ | Profile | 层级 | 适用场景 | 边界 |
95
103
  | --- | --- | --- | --- |
96
- | `native` | L0-L4 | 新项目、可渐进重构项目 | 可使用 Layout 与 Runtime 统一代码结构 |
97
- | `skin` | L0-L2 | 老项目、第三方封装无源码 | 只做视觉对齐,不擅自改页面布局与业务逻辑 |
104
+ | `native-element` | L0/L1/L3/L4 | 新项目、可渐进重构项目 | 不加载 legacy vendor 与 AG Grid |
105
+ | `legacy-jh-element` | L0-L2 | Base/jh/C 老项目,Element 表格 | 编译产物不含 `.ag-*` 选择器,不启动 AG observer |
106
+ | `legacy-jh-ag` | L0-L2 | 明确使用 AG Grid 的老项目 | 启用 AG 样式、R021、分屏和空态 guard |
107
+ | `native-jh-ag` | L0-L4 | 平台子应用终态:native 运行时叠 jh/Base 封装,AG 经联邦或 npm | full 样式全集 + Base/AG 规则(R003/R021)+ 分屏与空态 guard |
98
108
 
99
109
  ## 分别使用各项能力
100
110
 
@@ -104,6 +114,9 @@ Vendor 覆盖顺序是:`Base* > jh-* > C_*/c_* > AG Grid > custom wrappers`。
104
114
 
105
115
  ```scss
106
116
  @use "@agile-team/wl-skills-ui/styles" as *; // 完整 L0-L3
117
+ @use "@agile-team/wl-skills-ui/styles/presets/native-element" as *; // 无 legacy/AG
118
+ @use "@agile-team/wl-skills-ui/styles/presets/legacy-jh-element" as *; // legacy,无 AG
119
+ @use "@agile-team/wl-skills-ui/styles/presets/legacy-jh-ag" as *; // legacy + AG
107
120
  @use "@agile-team/wl-skills-ui/styles/presets/skin" as *; // 老项目 L0-L2
108
121
  @use "@agile-team/wl-skills-ui/styles/presets/element-only" as *; // L0-L1
109
122
  @use "@agile-team/wl-skills-ui/styles/presets/tokens-only" as *; // 仅 L0
@@ -144,16 +157,17 @@ const columns = defineColumns([
144
157
 
145
158
  ### Runtime Guard 与共享观察器
146
159
 
147
- 默认调用保持向后兼容,四类保护全部开启:
160
+ `installUiRuntimeGuards()` 与旧 `runtime/auto` 为兼容入口,仍开启全部保护;新项目应使用显式 Profile。`installCommonPreset()` 默认使用 `native-element`,不会启动 AG Grid observer:
148
161
 
149
162
  ```ts
150
163
  import {
151
164
  getObserverHubStats,
152
165
  installUiRuntimeGuards,
166
+ installUiRuntimeProfile,
153
167
  uninstallUiRuntimeGuards,
154
168
  } from "@agile-team/wl-skills-ui/runtime";
155
169
 
156
- installUiRuntimeGuards();
170
+ installUiRuntimeProfile("native-element");
157
171
  console.log(getObserverHubStats(document));
158
172
 
159
173
  // 微前端或轻量页面可只启用需要的保护
@@ -176,17 +190,22 @@ Observer Hub 按 Document/Window 隔离:全部 guard 开启时仍只有一个
176
190
  # 人工阅读
177
191
  npx wl-ui scan --target src --output markdown --outFile report.md
178
192
 
179
- # AI/MCP 默认格式:按文件压缩公共字段
180
- npx wl-ui scan --target src --output compact
193
+ # AI/MCP 默认先取总览,不包含逐条问题
194
+ npx wl-ui scan --target src --output summary
195
+
196
+ # 按需取有界明细:规则公共字段只出现一次,可用 nextCursor 翻页
197
+ npx wl-ui scan --target src --output compact-v2 --limit 50 --cursor 0
181
198
 
182
- # PR 只扫 Git 变更;范围失败会明确提示并安全回退全量
183
- npx wl-ui scan --target src --changed --base origin/main --output compact
199
+ # PR 只扫 Git 变更;范围失败默认终止,避免意外全量输出
200
+ npx wl-ui scan --target src --changed --base origin/main --output summary
201
+ # 只有明确接受全量时才加:--changed-fallback full
184
202
 
185
203
  # 只看指定层、vendor 或规则
186
204
  npx wl-ui scan --target src --mode skin --layer L0,L1,L2
187
205
  npx wl-ui scan --target src --vendor "jh-*,AG Grid"
188
206
  npx wl-ui scan --target src --only R001,R005,R041,R042
189
207
  npx wl-ui scan --target src --skip R031-R037
208
+ npx wl-ui rules describe R043
190
209
  ```
191
210
 
192
211
  SFC 解析器有三种模式:
@@ -203,10 +222,10 @@ SFC 解析器有三种模式:
203
222
 
204
223
  ```bash
205
224
  # 一定先预览
206
- npx wl-ui fix --target src --dry-run
225
+ npx wl-ui fix --target src --profile native-element --only R001,R006,R043 --dry-run --output json
207
226
 
208
- # 执行确定性修复;默认先创建 .wl-snapshot
209
- npx wl-ui fix --target src
227
+ # 使用预览返回的 planHash 执行同一计划;默认先创建 .wl-snapshot
228
+ npx wl-ui fix --target src --profile native-element --only R001,R006,R043 --plan-hash <hash>
210
229
 
211
230
  # 复检与回滚
212
231
  npx wl-ui scan --target src --fail-on-error
@@ -219,7 +238,7 @@ npx wl-ui audit --target src --output json --refresh-baseline
219
238
  npx wl-ui drift --baseline .wl-baseline.json --current current.json --fail-on-error
220
239
  ```
221
240
 
222
- Fixer 只处理规则目录中声明 `autoFixable` 且已实现的机械变换。涉及业务语义、布局重构、动态 icon 或操作权限的规则只报告,不自动猜测。
241
+ Fixer 只处理规则目录中声明 `autoFixable` 且已实现的机械变换,并让 `profile / only / skip` 同时约束预览、写入和复检。静态已知按钮文案由 R043 的确定映射修复;动态或未知语义仍归 R005 人工确认。计划哈希不一致时拒绝写入。
223
242
 
224
243
  ### AI Skill
225
244
 
@@ -227,7 +246,7 @@ Fixer 只处理规则目录中声明 `autoFixable` 且已实现的机械变换
227
246
 
228
247
  ```text
229
248
  用 wl-ui 的 legacy-skin-align 流程统一这个老项目,只处理 L0-L2。
230
- 扫描当前 PR 的 UI 变更,先给 compact 摘要,不修改代码。
249
+ 扫描当前 PR 的 UI 变更,先给 summary,不修改代码。
231
250
  检查这个列表页的表格中心轴、small 图标按钮和日期弹层边界。
232
251
  把这个成熟页面提取为 produce 领域的脱敏 ui-contract,并匹配已有模板。
233
252
  ```
@@ -235,7 +254,7 @@ Fixer 只处理规则目录中声明 `autoFixable` 且已实现的机械变换
235
254
  生命周期命令:
236
255
 
237
256
  ```bash
238
- npx wl-ui init --project . --editor all --mode native
257
+ npx wl-ui init --project . --editor all --profile native-element
239
258
  npx wl-ui update --project . --force
240
259
  npx wl-ui diff --project .
241
260
  npx wl-ui doctor --project . --print-overrides
@@ -341,9 +360,8 @@ Schema 见 [`standards/ui-contract.schema.json`](standards/ui-contract.schema.js
341
360
  ### 新项目从零接入
342
361
 
343
362
  ```text
344
- wl-ui init --mode native
345
- → 导入完整 styles
346
- → installCommonPreset
363
+ wl-ui init --profile native-element
364
+ → 导入 native-element styles/runtime
347
365
  → defineColumns + renderOps
348
366
  → wl-ui check
349
367
  → wl-ui scan --parser sfc
@@ -354,9 +372,9 @@ wl-ui init --mode native
354
372
 
355
373
  ```text
356
374
  wl_ui_detect_skin / wl-ui doctor
357
- → wl-ui init --mode skin
358
- → 导入 skin.scss + runtime/auto
359
- → scan --mode skin --output compact
375
+ → wl-ui init --profile legacy-jh-element(或 legacy-jh-ag)
376
+ → 导入对应 profile styles/runtime
377
+ → scan --profile <id> --output summary
360
378
  → fix --dry-run
361
379
  → 用户确认后 fix
362
380
  → 浏览器契约复查 Picker、Table、AG Grid
@@ -366,14 +384,15 @@ wl_ui_detect_skin / wl-ui doctor
366
384
 
367
385
  ```text
368
386
  wl_ui_route_intent
369
- → wl_ui_scan(changedOnly=true, output=compact, parser=auto)
387
+ → wl_ui_scan(changedOnly=true, output=summary, parser=auto)
370
388
  → wl_ui_recommend_flow
371
- → AI 只读取命中的局部文件
389
+ → wl_ui_scan(output=compact-v2, limit=50) 获取有界明细
390
+ → AI 只读取命中的局部文件与 Skill
372
391
  → wl_ui_fix_dry_run
373
392
  → 用户确认后 CLI 修复与复扫
374
393
  ```
375
394
 
376
- 上一轮实测 compact 报告从 44,148 bytes 降到 15,934 bytes,减少约 63.9%;真实节省会随问题重复度变化。更重要的是 changed-only、规则过滤和 ui-contract 让 AI 不再默认读取整项目源码。
395
+ `summary` 不携带逐条描述;`compact-v2` 把 severity/category/suggestion 收进一次性的 `ruleCatalog`,并用 cursor/limit 控制明细上限。单文件编辑器的安装产物也从全量 Skill 拼接改成按需路由。三者共同避免 AI 默认读取整份报告、整套 Skill 或整项目源码。
377
396
 
378
397
  ### 成熟页面沉淀与复用
379
398
 
@@ -410,6 +429,8 @@ npx wl-ui doctor --project . --print-overrides
410
429
 
411
430
  完整矩阵见 [`docs/compat-matrix.md`](docs/compat-matrix.md)。不要在未升级 jh-ui 的情况下单独把集团 EP 2.2 组合升级到社区新版;DOM 假设不同,尤其会影响 input wrapper、表单状态和复合控件。
412
431
 
432
+ 本轮的分类模型、门禁、token 预算与 AG Grid 替换路径见 [`docs/optimization-plan-1.12.md`](docs/optimization-plan-1.12.md),长期分层边界见 [`standards/architecture/01-layer-boundaries.md`](standards/architecture/01-layer-boundaries.md)。
433
+
413
434
  ## CLI 速查
414
435
 
415
436
  | 命令 | 用途 |
@@ -423,6 +444,8 @@ npx wl-ui doctor --project . --print-overrides
423
444
  | `wl-ui drift` | 基线与当前问题漂移 |
424
445
  | `wl-ui exempt init` | 生成定制页豁免候选,需人工审核 |
425
446
  | `wl-ui contract` | extract/validate/match 脱敏 UI 契约 |
447
+ | `wl-ui rules list/describe` | 查询规则事实源,不读取整份规则文档 |
448
+ | `wl-ui profiles` | 列出 adapter/style/runtime 组合 |
426
449
  | `wl-ui add-preset/add-vendor` | 在消费项目脚手架扩展文件 |
427
450
  | `wl-ui-mcp` | 启动 stdio MCP Server |
428
451
 
@@ -449,7 +472,7 @@ npx wl-ui doctor --project . --print-overrides
449
472
 
450
473
  ## 版本与进一步阅读
451
474
 
452
- 当前 v1.11.1:修复空态守护按初始快照钉死上下分栏全部 pane 导致手柄失去拖动行程的问题,空态表格仍保留内容需求地板。v1.11.0 新增精确 SFC 解析、低 token 增量扫描、共享 Observer Hub、领域 ui-contract、13 个 MCP Tool、日期弹层全屏防护、表格全轴居中与 small 图标按钮确定性治理。
475
+ 当前 v1.13.0:新增 `native-jh-ag` 混合形态 Profile(平台子应用终态:native 运行时 + jh/Base 封装 + 联邦/npm AG Grid)、严格校验仅认显式声明的兼容承诺、init 自动识别只建议不落盘、联邦 AG 依赖识别。v1.12.0:显式 UI Profile 与 AG adapter 解耦、规则/修复器一致性门禁、R043 确定性 icon 修复、共享 CLI/MCP 扫描引擎、summary/compact-v2 分页协议、fix 计划哈希,以及不覆盖项目内容的托管 Skill 路由块。
453
476
 
454
477
  - [版本摘要](docs/version-history.md)
455
478
  - [完整 Changelog](CHANGELOG.md)