@teamix-evo/skills 0.12.0 → 0.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.
- package/README.md +1 -1
- package/manifest.json +11 -28
- package/package.json +2 -2
- package/src/teamix-evo-code-opentrek/SKILL.md +13 -13
- package/src/teamix-evo-code-opentrek/api-layering.md +53 -44
- package/src/teamix-evo-code-opentrek/checklist.md +24 -24
- package/src/teamix-evo-code-opentrek/file-structure.md +55 -36
- package/src/teamix-evo-code-opentrek/forms-and-validation.md +17 -16
- package/src/teamix-evo-code-opentrek/reuse-first.md +6 -9
- package/src/teamix-evo-code-opentrek/testing.md +14 -14
- package/src/teamix-evo-code-uni-manager/SKILL.md +15 -15
- package/src/teamix-evo-code-uni-manager/api-layering.md +74 -58
- package/src/teamix-evo-code-uni-manager/checklist.md +28 -28
- package/src/teamix-evo-code-uni-manager/error-and-loading.md +2 -2
- package/src/teamix-evo-code-uni-manager/file-structure.md +77 -62
- package/src/teamix-evo-code-uni-manager/forms-and-validation.md +17 -15
- package/src/teamix-evo-code-uni-manager/reuse-first.md +7 -10
- package/src/teamix-evo-code-uni-manager/routing-and-codesplit.md +1 -1
- package/src/teamix-evo-code-uni-manager/testing.md +37 -37
- package/src/teamix-evo-design-opentrek/SKILL.md +41 -20
- package/src/teamix-evo-design-opentrek/boundaries.md +1 -1
- package/src/teamix-evo-design-opentrek/checklist.md +5 -5
- package/src/teamix-evo-design-opentrek/components.md +19 -19
- package/src/teamix-evo-design-opentrek/examples/standard-card-list.html +1 -1
- package/src/teamix-evo-design-opentrek/examples/standard-table-list.html +1 -1
- package/src/teamix-evo-design-opentrek/foundations.md +17 -17
- package/src/teamix-evo-design-opentrek/pages/dashboard-page/SKILL.md +18 -19
- package/src/teamix-evo-design-opentrek/pages/dashboard-page/patterns/dashboard-opentrek.md +6 -6
- package/src/teamix-evo-design-opentrek/pages/detail-page/SKILL.md +24 -25
- package/src/teamix-evo-design-opentrek/pages/detail-page/patterns/api-doc-detail.md +3 -7
- package/src/teamix-evo-design-opentrek/pages/detail-page/patterns/comparison-detail.md +3 -7
- package/src/teamix-evo-design-opentrek/pages/detail-page/patterns/monitor-detail.md +3 -7
- package/src/teamix-evo-design-opentrek/pages/detail-page/patterns/resource-detail.md +10 -10
- package/src/teamix-evo-design-opentrek/pages/form-page/SKILL.md +26 -27
- package/src/teamix-evo-design-opentrek/pages/list-page/SKILL.md +35 -36
- package/src/teamix-evo-design-opentrek/pages/list-page/_shared/item-card-spec.md +41 -32
- package/src/teamix-evo-design-opentrek/pages/list-page/patterns/card-list-opentrek.md +10 -10
- package/src/teamix-evo-design-opentrek/pages/list-page/patterns/card-list.md +23 -23
- package/src/teamix-evo-design-opentrek/pages/list-page/patterns/standard-list-opentrek.md +8 -8
- package/src/teamix-evo-design-opentrek/pages/list-page/patterns/standard-list.md +8 -8
- package/src/teamix-evo-design-opentrek/patterns/color-mapping.md +2 -2
- package/src/teamix-evo-design-opentrek/patterns/dashboard.md +1 -1
- package/src/teamix-evo-design-opentrek/patterns/detail-page.md +9 -9
- package/src/teamix-evo-design-opentrek/patterns/form-page.md +6 -6
- package/src/teamix-evo-design-opentrek/patterns/list-page.md +9 -9
- package/src/teamix-evo-design-opentrek/patterns/page-types.md +3 -3
- package/src/teamix-evo-design-opentrek/principles.md +541 -0
- package/src/teamix-evo-design-opentrek/rules/common-components.json +206 -76
- package/src/teamix-evo-design-opentrek/rules/component-specs.json +2 -2
- package/src/teamix-evo-design-opentrek/rules/design-tokens.css +223 -218
- package/src/teamix-evo-design-opentrek/rules/design-tokens.json +10 -32
- package/src/teamix-evo-design-opentrek/rules/page-frame.json +197 -193
- package/src/teamix-evo-design-opentrek/{generation-flow.md → workflow.md} +141 -22
- package/src/teamix-evo-design-uni-manager/SKILL.md +30 -6
- package/src/teamix-evo-design-uni-manager/boundaries.md +2 -2
- package/src/teamix-evo-design-uni-manager/brand.md +1 -1
- package/src/teamix-evo-design-uni-manager/checklist.md +2 -2
- package/src/teamix-evo-design-uni-manager/components.md +11 -11
- package/src/teamix-evo-design-uni-manager/foundations.md +7 -7
- package/src/teamix-evo-design-uni-manager/generation-flow.md +3 -3
- package/src/teamix-evo-manage/SKILL.md +111 -709
- package/src/teamix-evo-manage/init.md +98 -0
- package/src/teamix-evo-manage/migrate.md +100 -0
- package/src/teamix-evo-manage/rearchitect-capture-guide.md +174 -0
- package/src/teamix-evo-manage/rearchitect.md +373 -0
- package/src/teamix-evo-manage/update-component-staging.md +188 -0
- package/src/teamix-evo-manage/update-token-rename.md +126 -0
- package/src/teamix-evo-manage/update-token-treatment.md +116 -0
- package/src/teamix-evo-manage/update.md +213 -0
- package/src/teamix-evo-design-opentrek/brand.md +0 -154
- package/src/teamix-evo-design-opentrek/pages/list-page/_shared/search-combo-spec.md +0 -194
- package/src/teamix-evo-design-opentrek/philosophy.md +0 -98
- package/src/teamix-evo-design-opentrek/rules/README.md +0 -39
- package/src/teamix-evo-design-opentrek/rules/_assets/OP_AGENT RUNTIME.svg +0 -1
- package/src/teamix-evo-design-opentrek/rules/_assets/OP_AI GATEWAY.svg +0 -1
- package/src/teamix-evo-design-opentrek/rules/_assets/OP_AI STUDIO.svg +0 -1
- package/src/teamix-evo-design-opentrek/rules/_assets/OP_DEV-2.svg +0 -1
- package/src/teamix-evo-design-opentrek/rules/_assets/OP_LOGO.svg +0 -1
- package/src/teamix-evo-design-opentrek/rules/_assets/OP_OPS.svg +0 -1
- package/src/teamix-evo-design-opentrek/rules/layout-rules.json +0 -218
- package/src/teamix-evo-design-opentrek/rules/page-header-spec.md +0 -123
- package/src/teamix-evo-design-opentrek/rules/sidebar-spec.md +0 -217
- package/src/teamix-evo-upgrade/SKILL.md +0 -431
- /package/src/teamix-evo-design-opentrek/{rules/boundaries.rules.json → boundaries.json} +0 -0
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
# Sidebar 完整规格
|
|
2
|
-
|
|
3
|
-
> 适用于所有 L1/L2 页面的侧边栏框架组件。Sidebar 是全局框架组件(`page-frame.json` → `frameComponents.sidebar`),所有含 Sidebar 的页面自动继承此规范。
|
|
4
|
-
>
|
|
5
|
-
> **真相源**:
|
|
6
|
-
> - 宽度/Token → [`design-tokens.json`](./design-tokens.json) → `sidebarRules`
|
|
7
|
-
> - 框架继承 → [`page-frame.json`](./page-frame.json) → `frameComponents.sidebar`
|
|
8
|
-
> - 品牌 Logo SVG → [`_assets/`](./_assets/)
|
|
9
|
-
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
## 1. 整体容器
|
|
13
|
-
|
|
14
|
-
| 属性 | 值 | 说明 |
|
|
15
|
-
|------|------|------|
|
|
16
|
-
| position | `fixed` | 固定定位,不随内容滚动 |
|
|
17
|
-
| width | `var(--layout-sidebar-width)` (240px) | 展开态宽度 |
|
|
18
|
-
| background | `hsl(var(--sidebar))` | 即 `--gray-muted` |
|
|
19
|
-
| z-index | `100` | 高于内容层 |
|
|
20
|
-
| display | `flex` / `flex-direction: column` | 垂直排列 header + content + footer |
|
|
21
|
-
| transition | `width 0.2s ease` | 展开/收起动画 |
|
|
22
|
-
|
|
23
|
-
---
|
|
24
|
-
|
|
25
|
-
## 2. sidebar-header 容器
|
|
26
|
-
|
|
27
|
-
| 属性 | 值 | 说明 |
|
|
28
|
-
|------|------|------|
|
|
29
|
-
| height | 不固定(由内容撑开) | 禁止硬编码 56px 等固定高度 |
|
|
30
|
-
| padding | `16px 16px 0` | 顶部 16px 保证 Logo 距页面顶边距 |
|
|
31
|
-
| display | `flex` | 水平排列 Logo + 折叠按钮 |
|
|
32
|
-
| align-items | `center` | 垂直居中 |
|
|
33
|
-
| gap | `var(--gap-xs)` (4px) | Logo 与折叠按钮间距 |
|
|
34
|
-
|
|
35
|
-
---
|
|
36
|
-
|
|
37
|
-
## 3. sidebar-logo 容器
|
|
38
|
-
|
|
39
|
-
| 属性 | 值 | 说明 |
|
|
40
|
-
|------|------|------|
|
|
41
|
-
| height | `32px` | Logo 可视区域高度 |
|
|
42
|
-
| display | `flex` | 内部元素水平排列 |
|
|
43
|
-
| align-items | `center` | 垂直居中 |
|
|
44
|
-
| overflow | `hidden` | 防止内容溢出 |
|
|
45
|
-
| flex-shrink | `0` | 禁止压缩 |
|
|
46
|
-
|
|
47
|
-
---
|
|
48
|
-
|
|
49
|
-
## 4. 品牌 SVG Logo
|
|
50
|
-
|
|
51
|
-
| 属性 | 值 | 说明 |
|
|
52
|
-
|------|------|------|
|
|
53
|
-
| width | `154px` | 保持宽高比 404:84 |
|
|
54
|
-
| height | `32px` | 与容器高度一致 |
|
|
55
|
-
| viewBox | `0 0 404 84` | 原始设计稿尺寸 |
|
|
56
|
-
| 来源文件 | `OP_DEV-2.svg` | 完整品牌矢量图(默认产品) |
|
|
57
|
-
|
|
58
|
-
---
|
|
59
|
-
|
|
60
|
-
## 5. sidebar-content 区域
|
|
61
|
-
|
|
62
|
-
| 属性 | 值 | 说明 |
|
|
63
|
-
|------|------|------|
|
|
64
|
-
| flex | `1` | 占满剩余空间 |
|
|
65
|
-
| padding-top | `24px` | 导航菜单与 header 的间距 |
|
|
66
|
-
| padding-bottom | `12px` | 底部留白 |
|
|
67
|
-
| overflow-y | `auto` | 内容超出时可滚动 |
|
|
68
|
-
|
|
69
|
-
---
|
|
70
|
-
|
|
71
|
-
## 6. 收起态(Collapsed)
|
|
72
|
-
|
|
73
|
-
> 点击收起按钮后,侧栏从 240px 收窄至 68px,Logo 切换为纯图标,展开按钮置于 Logo 下方。
|
|
74
|
-
|
|
75
|
-
### 6.1 整体布局
|
|
76
|
-
|
|
77
|
-
| 属性 | 展开态 | 收起态 | 说明 |
|
|
78
|
-
|------|--------|--------|------|
|
|
79
|
-
| sidebar width | `240px` | `68px` | CSS 变量 `--layout-sidebar-width` 仅控制展开态 |
|
|
80
|
-
| transition | — | `width 0.2s ease` | 展开/收起动画 |
|
|
81
|
-
| overflow | `hidden` | `visible` | 收起态允许 flyout 溢出 |
|
|
82
|
-
|
|
83
|
-
### 6.2 sidebar-header 收起态
|
|
84
|
-
|
|
85
|
-
| 属性 | 值 | 说明 |
|
|
86
|
-
|------|------|------|
|
|
87
|
-
| padding | `16px 0 0` | 仅保留顶部间距,水平归零 |
|
|
88
|
-
| flex-direction | `column` | 垂直排列 Logo + 展开按钮 |
|
|
89
|
-
| align-items | `center` | 水平居中 |
|
|
90
|
-
|
|
91
|
-
### 6.3 收起态 Logo
|
|
92
|
-
|
|
93
|
-
| 属性 | 值 | 说明 |
|
|
94
|
-
|------|------|------|
|
|
95
|
-
| 来源文件 | `OP_LOGO.svg` | 仅图标(黑色圆角矩形 + 白色钻石图案),无产品文字 |
|
|
96
|
-
| width × height | `30px × 30px` | 适配 68px 侧栏宽度 |
|
|
97
|
-
| viewBox | `0 0 84 84` | 原始正方形画布 |
|
|
98
|
-
| 切换逻辑 | 完整 Logo 隐藏 → 收起 Logo 显示 | CSS class `.collapsed-logo` 控制 |
|
|
99
|
-
|
|
100
|
-
### 6.4 展开按钮
|
|
101
|
-
|
|
102
|
-
| 属性 | 值 | 说明 |
|
|
103
|
-
|------|------|------|
|
|
104
|
-
| 位置 | Logo 正下方 | `margin-top: 8px` |
|
|
105
|
-
| 尺寸 | `18px × 18px` | 与收起按钮一致 |
|
|
106
|
-
| 图标 | Lucide `PanelLeftOpen` | `<path d="m14 9 3 3-3 3"/>` 方向朝右 |
|
|
107
|
-
| 颜色 | `hsl(var(--muted-foreground))` | hover → `hsl(var(--gray-primary))` |
|
|
108
|
-
| 展开态可见性 | `display: none` | 仅收起态显示 |
|
|
109
|
-
|
|
110
|
-
### 6.5 收起/展开按钮对照
|
|
111
|
-
|
|
112
|
-
| 按钮 | 图标 | 可见条件 | 位置 |
|
|
113
|
-
|------|------|----------|------|
|
|
114
|
-
| 收起按钮 `.sidebar-collapse-btn` | Lucide `PanelLeftClose`(箭头朝左) | 展开态 | sidebar-header 右侧(`margin-left: auto`) |
|
|
115
|
-
| 展开按钮 `.sidebar-expand-btn` | Lucide `PanelLeftOpen`(箭头朝右) | 收起态 | Logo 下方居中 |
|
|
116
|
-
|
|
117
|
-
---
|
|
118
|
-
|
|
119
|
-
## 7. 品牌 Logo 资源清单
|
|
120
|
-
|
|
121
|
-
| 文件名 | 用途 | 存放路径 |
|
|
122
|
-
|--------|------|----------|
|
|
123
|
-
| `OP_DEV-2.svg` | 展开态完整 Logo(含 OPENTREK DEV 文字) | `rules/_assets/` |
|
|
124
|
-
| `OP_LOGO.svg` | 收起态纯图标 Logo | `rules/_assets/` |
|
|
125
|
-
| `OP_AI STUDIO.svg` | AI Studio 产品变体 | `rules/_assets/` |
|
|
126
|
-
| `OP_AGENT RUNTIME.svg` | Agent Runtime 产品变体 | `rules/_assets/` |
|
|
127
|
-
| `OP_OPS.svg` | OPS 产品变体 | `rules/_assets/` |
|
|
128
|
-
| `OP_AI GATEWAY.svg` | AI Gateway 产品变体 | `rules/_assets/` |
|
|
129
|
-
|
|
130
|
-
### 7.1 Logo 资源引用规则
|
|
131
|
-
|
|
132
|
-
品牌 Logo **必须使用** `_assets/` 目录中的 SVG 文件,禁止使用文字占位或外部图片链接。
|
|
133
|
-
|
|
134
|
-
**资源映射表**:
|
|
135
|
-
|
|
136
|
-
| 产品线 | SVG 文件 | 使用场景 |
|
|
137
|
-
|---|---|---|
|
|
138
|
-
| AI Gateway | `_assets/OP_AI GATEWAY.svg` | AI 网关相关页面 |
|
|
139
|
-
| AI Studio | `_assets/OP_AI STUDIO.svg` | AI 开发平台相关页面 |
|
|
140
|
-
| Agent Runtime | `_assets/OP_AGENT RUNTIME.svg` | Agent 运行时相关页面 |
|
|
141
|
-
| DEV | `_assets/OP_DEV-2.svg` | 开发者工具相关页面 |
|
|
142
|
-
| OPS | `_assets/OP_OPS.svg` | 运维相关页面 |
|
|
143
|
-
| 通用 Logo | `_assets/OP_LOGO.svg` | 产品线未明确时使用 |
|
|
144
|
-
|
|
145
|
-
**引用方式**:
|
|
146
|
-
- 生成页面时,根据当前产品线从上表选择对应 SVG
|
|
147
|
-
- Logo 放置在 Sidebar 品牌区域(顶部),与产品名文字并排
|
|
148
|
-
- **必须以 inline SVG 方式嵌入**(直接将 SVG path 写入 JSX/HTML),禁止用 `<img src>` 或外部引用
|
|
149
|
-
- 仅截取 SVG 的**图标部分**(viewBox `0 0 84 84`),文字(OPENTREK / AI GATEWAY)由 Sidebar 右侧 `<span>` 双行渲染
|
|
150
|
-
|
|
151
|
-
**inline SVG 实现要求**:
|
|
152
|
-
- 外层 `<rect>` 使用 `fill="currentColor"`,内层图案使用 `fill="white"` — 容器通过 `text-foreground` 类控色,自动适配主题
|
|
153
|
-
- `<clipPath>` 的 `id` 必须全局唯一(按页面命名,如 `opai-logo-clip-{page-name}`),避免同 DOM 多个 SVG id 冲突
|
|
154
|
-
- Logo 组件尺寸:`size-8`(32×32px),与 §3 sidebar-logo 容器 `height: 32px` 对齐
|
|
155
|
-
- path 数据必须来自 `_assets/` 中对应 SVG 文件的真实内容,禁止简化或自绘近似图形
|
|
156
|
-
|
|
157
|
-
**禁止项**:
|
|
158
|
-
- ❌ 使用纯文字模拟 Logo(如用 div + font-weight:bold 模拟品牌标识)
|
|
159
|
-
- ❌ 使用 Lucide/其他图标库图标占位(如 Layers、Diamond 等)
|
|
160
|
-
- ❌ 使用外部 URL 引用 Logo
|
|
161
|
-
- ❌ 使用非 `_assets/` 目录的图片资源
|
|
162
|
-
- ❌ 自绘简化 SVG path 代替真实 Logo(即使视觉近似也不允许)
|
|
163
|
-
- ❌ 多个页面使用相同的 clipPath id(会导致渲染冲突)
|
|
164
|
-
|
|
165
|
-
---
|
|
166
|
-
|
|
167
|
-
## 8. Sidebar Footer 用户信息区域
|
|
168
|
-
|
|
169
|
-
> 侧边栏底部固定的用户身份展示区域。
|
|
170
|
-
|
|
171
|
-
| 属性 | 值 | 说明 |
|
|
172
|
-
|------|------|------|
|
|
173
|
-
| padding | `12px 12px 16px 24px` | 展开态内边距 |
|
|
174
|
-
| display | `flex` | 水平排列 |
|
|
175
|
-
| align-items | `center` | 垂直居中 |
|
|
176
|
-
| gap | `var(--button-gap)` (8px) | 元素间距 |
|
|
177
|
-
|
|
178
|
-
### 8.1 头像(sidebar-avatar)
|
|
179
|
-
|
|
180
|
-
| 属性 | 值 | 说明 |
|
|
181
|
-
|------|------|------|
|
|
182
|
-
| 尺寸 | `28px × 28px` | 固定圆形 |
|
|
183
|
-
| border-radius | `50%` | 圆形 |
|
|
184
|
-
| background | `hsl(var(--sidebar-active))` | 与菜单激活态背景一致 |
|
|
185
|
-
| font-size | `var(--font-size-base)` (12px) | 头像内文字 |
|
|
186
|
-
| font-weight | `600` | 半粗体 |
|
|
187
|
-
| 内容 | 用户姓名**最后一个字** | 如「小王」→ 显示「王」 |
|
|
188
|
-
|
|
189
|
-
### 8.2 用户名(sidebar-username)
|
|
190
|
-
|
|
191
|
-
| 属性 | 值 | 说明 |
|
|
192
|
-
|------|------|------|
|
|
193
|
-
| font-size | `var(--font-size-lg)` (14px) | 用户名字号 |
|
|
194
|
-
| font-weight | `var(--font-weight-medium)` (500) | 中等字重 |
|
|
195
|
-
| color | `hsl(var(--sidebar-item))` | 与菜单项文字颜色一致 |
|
|
196
|
-
| overflow | `hidden` + `text-overflow: ellipsis` | 超长截断 |
|
|
197
|
-
| white-space | `nowrap` | 禁止换行 |
|
|
198
|
-
| 默认值 | `小王` | 占位用户名 |
|
|
199
|
-
|
|
200
|
-
### 8.3 更多按钮(sidebar-more)
|
|
201
|
-
|
|
202
|
-
| 属性 | 值 | 说明 |
|
|
203
|
-
|------|------|------|
|
|
204
|
-
| 尺寸 | `28px × 28px` | 正方形点击区域 |
|
|
205
|
-
| border-radius | `var(--radius-sm)` (4px) | 微圆角 |
|
|
206
|
-
| 图标 | 三点竖排(MoreVertical) | `<circle cx="12" cy="5/12/19" r="2"/>` |
|
|
207
|
-
| color | `hsl(var(--muted-foreground))` | hover → `hsl(var(--gray-primary))` |
|
|
208
|
-
| hover background | `hsl(var(--sidebar-hover))` | 悬停底色 |
|
|
209
|
-
|
|
210
|
-
### 8.4 收起态 Footer
|
|
211
|
-
|
|
212
|
-
| 属性 | 值 | 说明 |
|
|
213
|
-
|------|------|------|
|
|
214
|
-
| padding | `12px 10px 16px` | 收窄内边距 |
|
|
215
|
-
| justify-content | `center` | 居中显示头像 |
|
|
216
|
-
| 用户名 | `display: none` | 隐藏 |
|
|
217
|
-
| 更多按钮 | `display: none` | 隐藏 |
|
|
@@ -1,431 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: teamix-evo-upgrade
|
|
3
|
-
description: |
|
|
4
|
-
Help the user adopt token renames in `.teamix-evo/.upgrade-hints/tokens-<ts>.json` AND component source upgrades in `.teamix-evo/.upgrade-staging/{ui,biz-ui}-<ts>/` after `teamix-evo update` / `teamix-evo tokens update` / `teamix-evo switch` / `teamix-evo ui upgrade` / `teamix-evo biz-ui upgrade`. Read each hint or staging manifest, scan the project for usages or compare current vs incoming source, propose codemod / file-replace diffs, apply only after explicit user approval, then archive processed inputs.
|
|
5
|
-
TRIGGER when: user references `.teamix-evo/.upgrade-hints/`、`.teamix-evo/.upgrade-staging/`、`tokens-*.json` hint files、`ui-*` or `biz-ui-*` staging directories、phrases like "处理 token 改名"、"应用 codemod"、"扫一下 legacy token"、"升级 token 引用"、"更新 token 名"、"组件升级"、"ui-staging"、"biz-ui staging"、"apply ui staging"、"apply biz-ui staging"、"应用组件升级"、"apply token rename codemod"、"adopt token rename hints"、"scan for legacy tokens"、"token rename upgrade"、"component source upgrade"、"review ui staging diff"、"token 治理"、"tokens diagnose"、"tokens treat"、"治理计划"、".treatment-plan.md"、"baseline 锁定"、"token 反哺"、"清理 token 违规"、"token cleanup"、"lint baseline"、"降违规"、"全部治理"; AI sees output of `teamix-evo update` / `teamix-evo tokens update` / `teamix-evo switch --apply` / `teamix-evo ui upgrade` / `teamix-evo biz-ui upgrade` mentioning `💡 token rename hint:` or `staging at .teamix-evo/.upgrade-staging/...` and the user wants to follow up; AI sees output of `teamix-evo init` showing token-discipline ESLint warnings and the user wants to clean up; user opens any `.teamix-evo/.upgrade-hints/tokens-*.json` or any file under `.teamix-evo/.upgrade-staging/{ui,biz-ui}-*/` or `.teamix-evo/.treatment-plan.md`.
|
|
6
|
-
SKIP: any other lifecycle work — `init` / `update` orchestration / variant switch itself / install / uninstall / generating staging (defer to teamix-evo-manage); pure visual or design changes (defer to teamix-evo-design-<variant>); any code authoring unrelated to the rename / staging window (defer to teamix-evo-code-<variant>); refuse to auto-apply — never write source code without explicit per-file user confirmation.
|
|
7
|
-
Coordinates with: teamix-evo-manage (manage drives the upgrade flow that emits hints + staging; this skill consumes the resulting files).
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
# teamix-evo-upgrade
|
|
11
|
-
|
|
12
|
-
## 安装方式
|
|
13
|
-
|
|
14
|
-
本 skill 是 **lifecycle 工具型 skill**(消费 `.upgrade-hints/` + `.upgrade-staging/` 的通用工作流,跨 variant 共用,不携带任何业务内容),manifest 里声明 `scope: "global"`。**推荐全局安装一次**:
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
npx teamix-evo skills add teamix-evo-upgrade --scope global
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
`skills init`(项目级自举)与 `npm create teamix-evo` **不会**自动装本 skill —— bulk 模式按 scope 自动跳过(ADR 0033)。如果用户在项目级显式 `skills add teamix-evo-upgrade --scope project`,CLI 给出「推荐 global」warning 但仍装入(用户自负责),代价是后续 IDE 会同时识别全局与项目两份副本。
|
|
21
|
-
|
|
22
|
-
与 [`teamix-evo-manage`](../teamix-evo-manage/SKILL.md) 同属 lifecycle 工具,分工:manage 负责 orchestration(init / update / switch / 触发 staging 生成),本 skill 负责 staging / hints 的逐文件 hard-gate apply。
|
|
23
|
-
|
|
24
|
-
This skill consumes two complementary upgrade artefacts the CLI produces during upgrades and the consumer must adopt by hand under the ADR 0019 (project-upgrade-flow) **frozen-on-add boundary** (after first-time install via `npm create teamix-evo` / `teamix-evo init` / `ui add`, the CLI never overwrites existing files under `src/components/{ui,business}/**`; upgrades go through staging instead of in-place rewrites):
|
|
25
|
-
|
|
26
|
-
1. **Token rename hints** — `.teamix-evo/.upgrade-hints/tokens-<ts>.json` (variable-level rewrites under `src/**` + `tokens/tokens.overrides.css`).
|
|
27
|
-
2. **Component source staging** — `.teamix-evo/.upgrade-staging/{ui,biz-ui}-<ts>/` (per-component file replacements under `src/components/{ui,business}/**`, see ADR 0040 component-source-layer-upgrade-flow).
|
|
28
|
-
|
|
29
|
-
Both flows share the same shape (discover → read → propose → hard-gate confirm → archive); they only differ in the artefact they consume. Token-rename details are in part A, component-source details are in part B.
|
|
30
|
-
|
|
31
|
-
# Part A — Token rename adoption
|
|
32
|
-
|
|
33
|
-
## What is a hint file
|
|
34
|
-
|
|
35
|
-
When `teamix-evo tokens update` bumps a variant version that ships a `renames` log, or `teamix-evo switch --apply` lands on a new variant whose history contains renames, the CLI writes a single JSON file:
|
|
36
|
-
|
|
37
|
-
```
|
|
38
|
-
.teamix-evo/
|
|
39
|
-
└── .upgrade-hints/
|
|
40
|
-
└── tokens-2026-06-12T03-15-00-000Z.json
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
Schema v1 payload (every field is required except `description` per rename):
|
|
44
|
-
|
|
45
|
-
```json
|
|
46
|
-
{
|
|
47
|
-
"schemaVersion": 1,
|
|
48
|
-
"ts": "2026-06-12T03:15:00.000Z",
|
|
49
|
-
"package": "tokens",
|
|
50
|
-
"trigger": "update",
|
|
51
|
-
"fromVariant": "opentrek",
|
|
52
|
-
"toVariant": "opentrek",
|
|
53
|
-
"fromVersion": "0.5.0",
|
|
54
|
-
"toVersion": "0.6.5",
|
|
55
|
-
"renames": [
|
|
56
|
-
{
|
|
57
|
-
"sinceVersion": "0.6.0",
|
|
58
|
-
"from": "--color-old",
|
|
59
|
-
"to": "--color-new"
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
"sinceVersion": "0.6.5",
|
|
63
|
-
"from": "--space-x",
|
|
64
|
-
"to": "--space-h",
|
|
65
|
-
"description": "horizontal axis rename"
|
|
66
|
-
}
|
|
67
|
-
]
|
|
68
|
-
}
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
> `trigger` is `"update"` for version-bump hints and `"switch"` for variant-switch hints. Both consume the same way — only the framing line differs.
|
|
72
|
-
|
|
73
|
-
## Workflow (5 steps, never skip step 4)
|
|
74
|
-
|
|
75
|
-
### 1 · Discover
|
|
76
|
-
|
|
77
|
-
List every hint file under `.teamix-evo/.upgrade-hints/`. Sort newest-first by filename (the `tokens-<fs-ts>.json` ts is filesystem-safe and lexically chronological).
|
|
78
|
-
|
|
79
|
-
```bash
|
|
80
|
-
ls -1 .teamix-evo/.upgrade-hints/tokens-*.json 2>/dev/null
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
If the directory is missing or empty, tell the user:
|
|
84
|
-
|
|
85
|
-
> 当前没有待处理的 token rename hint。这通常意味着最近一次 `tokens update` / `switch` 没有跨过 rename 节点;你可以继续做你原本的事。
|
|
86
|
-
|
|
87
|
-
### 2 · Aggregate
|
|
88
|
-
|
|
89
|
-
Read each hint and aggregate the `renames` arrays into a single `from → to` map. When two hints rename the same token (rare — usually means a token was renamed twice across versions), the **newest hint wins** and the older mapping is discarded (treat the chain as resolved).
|
|
90
|
-
|
|
91
|
-
Surface a one-line summary per hint to the user:
|
|
92
|
-
|
|
93
|
-
> `tokens-…06-12T03-15-00-000Z.json` · update · opentrek 0.5.0 → 0.6.5 · 2 renames
|
|
94
|
-
|
|
95
|
-
### 3 · Scan
|
|
96
|
-
|
|
97
|
-
For each `from` token, run a project-wide search across the consumer-owned surface (never read `node_modules/` or `dist/`). The exact glob set depends on which token shape the rename targets:
|
|
98
|
-
|
|
99
|
-
| `from` shape | Where to search | Tooling |
|
|
100
|
-
| --------------------------------------------- | -------------------------------------------------------------------------- | ---------------- |
|
|
101
|
-
| CSS variable (`--color-old`) | `src/**/*.{ts,tsx,js,jsx,css,scss,md,mdx}` + `tokens/tokens.overrides.css` | grep / Grep tool |
|
|
102
|
-
| Tailwind class fragment (e.g. `bg-color-old`) | `src/**/*.{ts,tsx,jsx}` + `index.html` | grep |
|
|
103
|
-
| Token JSON path (`color.old`) | `tokens/**/*.json` if any | grep |
|
|
104
|
-
|
|
105
|
-
Explicitly exclude:
|
|
106
|
-
|
|
107
|
-
- `node_modules/**`、`dist/**`、`build/**`、`.next/**`
|
|
108
|
-
- Anything under `.teamix-evo/snapshots/**` (those are restore points, not live code)
|
|
109
|
-
- The hint file itself
|
|
110
|
-
|
|
111
|
-
For each occurrence collect: file path, 1-based line number, the matched line.
|
|
112
|
-
|
|
113
|
-
### 4 · Propose & ask (HARD GATE)
|
|
114
|
-
|
|
115
|
-
For every `from → to` rename, show a diff hunk and **ask the user per file** before touching it. Use this template:
|
|
116
|
-
|
|
117
|
-
```
|
|
118
|
-
─── tokens/tokens.overrides.css (1 occurrence) ───
|
|
119
|
-
- 12 | color: var(--color-old);
|
|
120
|
-
+ 12 | color: var(--color-new);
|
|
121
|
-
|
|
122
|
-
─── src/components/Banner.tsx (3 occurrences) ───
|
|
123
|
-
- 18 | className="text-[var(--color-old)]"
|
|
124
|
-
+ 18 | className="text-[var(--color-new)]"
|
|
125
|
-
…
|
|
126
|
-
|
|
127
|
-
应用这些修改?(y / n / per-file)
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
`per-file` lets the user pick file-by-file. Default to **no** if the user is silent. **Never auto-apply.** This is the entire reason the rename pipeline exists — ADR 0019 frozen boundary.
|
|
131
|
-
|
|
132
|
-
If the user declines a particular file, record it in your reply (`保留:src/legacy/old-page.tsx — 用户选择不替换`) so they can come back to it later.
|
|
133
|
-
|
|
134
|
-
### 5 · Archive processed hints
|
|
135
|
-
|
|
136
|
-
After (and only after) the user has either accepted or explicitly skipped every rename in a hint file, **move the hint into the archive subdirectory** so subsequent runs don't re-prompt:
|
|
137
|
-
|
|
138
|
-
```bash
|
|
139
|
-
mkdir -p .teamix-evo/.upgrade-hints/.processed
|
|
140
|
-
mv .teamix-evo/.upgrade-hints/tokens-<ts>.json .teamix-evo/.upgrade-hints/.processed/
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
Tell the user the file moved and that they can `git diff` to review the rewrites + the hint move in one shot.
|
|
144
|
-
|
|
145
|
-
> If the user wants to **defer** an entire hint (not just per-file skip), leave it in place and tell them they can re-run this skill later.
|
|
146
|
-
|
|
147
|
-
## Edge cases
|
|
148
|
-
|
|
149
|
-
| Situation | Response |
|
|
150
|
-
| --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
|
|
151
|
-
| Hint file fails JSON parse / wrong schemaVersion | Print the file path + the parse error; **do not** delete it. Suggest the user inspect or run `teamix-evo restore --list`. |
|
|
152
|
-
| `from` token literally not found in `src/**` | Tell the user the rename is "已经无影响" and ask whether to archive the hint anyway. |
|
|
153
|
-
| Multiple hint files pending | Process newest-first one hint at a time — never batch across hints (keeps the diff small and the user in control). |
|
|
154
|
-
| User says "全部接受" / "apply all" | Still show every diff before applying. Bulk-confirm is fine, **silent apply is not**. |
|
|
155
|
-
| Project has no `src/` (library / monorepo root) | Ask the user which directory to scan; default to `packages/*/src` if a `pnpm-workspace.yaml` is present. |
|
|
156
|
-
| User asks to handle an old hint that's already in `.processed/` | Read it from `.processed/`, re-run scan, and let the user decide whether to apply again or remove it permanently. |
|
|
157
|
-
|
|
158
|
-
## What this skill is NOT
|
|
159
|
-
|
|
160
|
-
- **Not** a CLI command — there is no `teamix-evo upgrade`. The CLI emits hints + staging; this skill consumes them.
|
|
161
|
-
- **Not** a token authority — only consumes the rename log declared by the upstream tokens pack (registry `TokensVariantEntry.renames`).
|
|
162
|
-
- **Not** a refactor robot — diff-then-confirm is mandatory, the user owns every byte under `src/**`.
|
|
163
|
-
- **Not** the place to discuss new token names or design decisions — those flow through the design skill.
|
|
164
|
-
|
|
165
|
-
# Part B — Component source upgrade
|
|
166
|
-
|
|
167
|
-
When `teamix-evo update` (auto-staging step), `teamix-evo ui upgrade [id]`, or `teamix-evo biz-ui upgrade [id]` runs, the CLI compares the consumer's installed component source against the latest upstream package contents and writes a **staging directory**:
|
|
168
|
-
|
|
169
|
-
```
|
|
170
|
-
.teamix-evo/.upgrade-staging/
|
|
171
|
-
└── ui-2026-06-12T12-00-00-000Z/
|
|
172
|
-
├── meta.json # UpgradeStagingManifest
|
|
173
|
-
├── button/
|
|
174
|
-
│ ├── current.tsx # what is on disk now
|
|
175
|
-
│ └── incoming.tsx # alias-rewritten upstream source
|
|
176
|
-
└── …
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
> **v1 note** — CLI does **not** pre-render `diff.unified.patch`. The schema's `diffRelPath` field is reserved for a future v2 emitter; today this skill diffs `current.tsx` against `incoming.tsx` on the fly (B4).
|
|
180
|
-
|
|
181
|
-
The CLI **never writes** into `src/components/{ui,business}/**` — frozen boundary, ADR 0019 (project-upgrade-flow) + ADR 0040 (component-source-layer-upgrade-flow). This skill is the only path to land staged changes.
|
|
182
|
-
|
|
183
|
-
## Staging manifest payload (schema v1)
|
|
184
|
-
|
|
185
|
-
```json
|
|
186
|
-
{
|
|
187
|
-
"schemaVersion": 1,
|
|
188
|
-
"ts": "2026-06-12T12:00:00.000Z",
|
|
189
|
-
"package": "ui",
|
|
190
|
-
"trigger": "ui-upgrade",
|
|
191
|
-
"fromVersion": "0.7.0",
|
|
192
|
-
"toVersion": "0.8.0",
|
|
193
|
-
"lineage": "teamix-evo",
|
|
194
|
-
"summary": {
|
|
195
|
-
"total": 4,
|
|
196
|
-
"byRisk": { "unchanged": 1, "upgradable-medium": 2, "risky": 1 }
|
|
197
|
-
},
|
|
198
|
-
"entries": [
|
|
199
|
-
{
|
|
200
|
-
"id": "button",
|
|
201
|
-
"category": "ui",
|
|
202
|
-
"current": {
|
|
203
|
-
"target": "src/components/ui/button.tsx",
|
|
204
|
-
"hash": "sha256:…",
|
|
205
|
-
"sourceLineage": "teamix-evo"
|
|
206
|
-
},
|
|
207
|
-
"incoming": {
|
|
208
|
-
"sourceVersion": "0.8.0",
|
|
209
|
-
"hash": "sha256:…",
|
|
210
|
-
"relPath": "button/incoming.tsx"
|
|
211
|
-
},
|
|
212
|
-
"diff": {
|
|
213
|
-
"riskLevel": "upgradable-medium",
|
|
214
|
-
"hints": ["new export: ButtonGroup"],
|
|
215
|
-
"filesChangedCount": 1
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
]
|
|
219
|
-
}
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
`riskLevel` values (from ADR 0040 §D3 component-source-layer-upgrade-flow):
|
|
223
|
-
|
|
224
|
-
| level | meaning | suggested handling |
|
|
225
|
-
| ------------------- | -------------------------------------------------------------------- | ----------------------------------- |
|
|
226
|
-
| `unchanged` | hash identical — nothing to do | skip silently |
|
|
227
|
-
| `upgradable-low` | single file, no new/removed exports or cva variants | batch confirm |
|
|
228
|
-
| `upgradable-medium` | new exports / new cva variants / multi-file | per-file confirm |
|
|
229
|
-
| `risky` | removed exports / removed cva variants / props rename | discuss each, surface hints |
|
|
230
|
-
| `breaking` | upstream removed the entry entirely | flag explicitly, never auto-replace |
|
|
231
|
-
| `foreign` | file exists in `src/` but no upstream / no installed manifest record | leave untouched, ask for intent |
|
|
232
|
-
|
|
233
|
-
## Workflow (5 steps, never skip step 4)
|
|
234
|
-
|
|
235
|
-
### B1 · Discover
|
|
236
|
-
|
|
237
|
-
```bash
|
|
238
|
-
ls -1d .teamix-evo/.upgrade-staging/{ui,biz-ui}-*/ 2>/dev/null | sort -r
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
If the directory is missing or empty:
|
|
242
|
-
|
|
243
|
-
> 当前没有待应用的组件升级 staging。请先跑 `teamix-evo update` / `teamix-evo ui upgrade [id]` / `teamix-evo biz-ui upgrade [id]` 生成。
|
|
244
|
-
|
|
245
|
-
### B2 · Read manifest & frame the opening line
|
|
246
|
-
|
|
247
|
-
Parse `meta.json`. Pick the opening message based on `lineage`:
|
|
248
|
-
|
|
249
|
-
| lineage | opening line template |
|
|
250
|
-
| --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
251
|
-
| `teamix-evo` | `检测到 X 个组件,其中 Y 个有变化(unchanged=A, upgradable-low=B, medium=C, risky=D, breaking=E)。准备逐个 review。` |
|
|
252
|
-
| `mixed` | `检测到 Z 个 teamix-evo 组件 + W 个未登记组件(foreign=F)。先处理可升级项,最后与你商量 foreign 组件去留。` |
|
|
253
|
-
| `shadcn-native` | `你当前是 shadcn 原生安装(未使用 teamix-evo 的资产)。升级前建议先迁移到 teamix-evo 谱系(run 「teamix-evo ui init」重新安装),或者手动对齐调谐表。是否继续详细对比?` (CLI 这种情况不会生成 staging,但用户可能手工走到这一步) |
|
|
254
|
-
| `custom-only` | (CLI skip 了,不会出现在 staging 中 — 若出现是异常,请提示用户检查) |
|
|
255
|
-
|
|
256
|
-
### B3 · Group by risk
|
|
257
|
-
|
|
258
|
-
Iterate `entries` and bucket by `riskLevel`:
|
|
259
|
-
|
|
260
|
-
- **`unchanged`** — just announce "以下组件未变,跳过" (list ids on one line).
|
|
261
|
-
- **`upgradable-low`** — ⤵️ HARD GATE:仍然逐个展示 diff + y/n,禁止合并为一次性批量确认。速度优先时可缩短 diff 显示(只展示 hints 摘要),但每个组件必须独立确认。
|
|
262
|
-
- **`upgradable-medium`** — walk one-by-one with a short hint summary, ask y/n/per-file (see B4).
|
|
263
|
-
- **`risky`** — force per-component review; spell out every `hints[]` entry verbatim before showing the diff.
|
|
264
|
-
- **`breaking`** — do **not** offer auto-replace. Tell the user upstream removed the entry, ask if they want to delete the local file or keep it as a custom component (likely a re-naming — cross-check `removedExports`).
|
|
265
|
-
- **`foreign`** — list separately ("以下组件不在 manifest 中,可能是你手工添加的"), ask whether to register, delete, or leave alone.
|
|
266
|
-
|
|
267
|
-
> **分级原则(B0)**:每个 risk level 必须独立分组展示,不得将不同 risk level 的组件混在同一批次提问。即使用户要求「全部应用」,也必须按 risk level 分组逐个展示。
|
|
268
|
-
|
|
269
|
-
### B4 · Propose & ask (HARD GATE)
|
|
270
|
-
|
|
271
|
-
For each non-unchanged entry the user has agreed to consider, render the diff with **the same template as Part A step 4** but use file replacement instead of inline rewrite. Read `current.tsx` + `incoming.tsx` and compute the diff on the fly (v1 does not pre-render `diff.unified.patch` — if the entry's `diff.diffRelPath` is set in a future schema version, prefer that file as the source of truth).
|
|
272
|
-
|
|
273
|
-
```
|
|
274
|
-
─── src/components/ui/button.tsx · risk=upgradable-medium · hints: new export: ButtonGroup ───
|
|
275
|
-
@@ -1,3 +1,5 @@
|
|
276
|
-
export const Button = (props: any) => null;
|
|
277
|
-
+
|
|
278
|
-
+export const ButtonGroup = (props: any) => null;
|
|
279
|
-
|
|
280
|
-
应用?(y / n / per-file)
|
|
281
|
-
```
|
|
282
|
-
|
|
283
|
-
Application = **copy `incoming.tsx` over the file at `current.target`**, atomically. Do not partial-merge — the staging is whole-file.
|
|
284
|
-
|
|
285
|
-
**Never auto-apply.** If the user is silent, default to no.
|
|
286
|
-
|
|
287
|
-
⚠️ HARD GATE:即使用户说 "全部接受" / "apply all",**仍然必须逐文件展示 diff**(每个组件一屏),用户看完后才写入。禁止将多个组件的 diff 合并展示或静默批量应用。
|
|
288
|
-
|
|
289
|
-
If a file's `riskLevel` is `breaking` and the user opts to delete the file, do that explicitly with a confirmed `rm` command — not silently.
|
|
290
|
-
|
|
291
|
-
### B5 · Archive staging
|
|
292
|
-
|
|
293
|
-
After every entry has either been applied or explicitly skipped:
|
|
294
|
-
|
|
295
|
-
```bash
|
|
296
|
-
mkdir -p .teamix-evo/.upgrade-staging/.processed
|
|
297
|
-
mv .teamix-evo/.upgrade-staging/<dir> .teamix-evo/.upgrade-staging/.processed/
|
|
298
|
-
```
|
|
299
|
-
|
|
300
|
-
Tell the user the directory was archived and that `git diff` will show every accepted file replacement plus the staging move in one shot.
|
|
301
|
-
|
|
302
|
-
If the user wants to **defer** the entire staging (not per-entry skip), leave it in place — they can re-run this skill later.
|
|
303
|
-
|
|
304
|
-
## Edge cases (component source)
|
|
305
|
-
|
|
306
|
-
| Situation | Response |
|
|
307
|
-
| ---------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
308
|
-
| `meta.json` parse error / wrong schemaVersion | Print the path + parse error; **do not** delete it. Suggest `teamix-evo ui upgrade` re-run or `teamix-evo restore --list`. |
|
|
309
|
-
| `current.tsx` differs from `entry.current.target` on disk | The user edited locally since CLI generated staging. Show both diffs (your edits vs incoming), let them merge by hand; do not silently overwrite. |
|
|
310
|
-
| User passes `--apply` to a CLI upgrade command | The CLI itself rejects with frozen-boundary guidance. Re-route them here. |
|
|
311
|
-
| Multiple staging directories pending | Process newest-first one staging at a time — never batch across staging dirs (different `fromVersion/toVersion`, different baseline). |
|
|
312
|
-
| User says “全部接受” / “apply all” | Still show every diff before applying. Bulk-confirm is fine, **silent apply is not**. |
|
|
313
|
-
| `lineage=mixed` with `foreign` entries | After upgradable-\* are processed, walk foreign entries one-by-one and ask: register (out of scope here — redirect to `teamix-evo ui add <id>`), delete, or leave. |
|
|
314
|
-
| User asks to handle an old staging dir that's already in `.processed/` | Read the manifest from `.processed/`, re-render diffs, decide whether to re-apply or remove permanently. |
|
|
315
|
-
|
|
316
|
-
# Part C — Token treatment pipeline
|
|
317
|
-
|
|
318
|
-
After `teamix-evo init` lands tokens + ESLint rules, the project often has pre-existing token violations (hardcoded colors, raw Tailwind scales, etc.). The CLI provides a **diagnose → treat → reflect → baseline-lock** pipeline to systematically clean them up. This skill guides the user through it.
|
|
319
|
-
|
|
320
|
-
> **Coordinates with**: Part A (token rename adoption) handles _rename_ hints from upstream version bumps; Part C handles _project-internal_ violations detected by ESLint rules.
|
|
321
|
-
|
|
322
|
-
## When to trigger
|
|
323
|
-
|
|
324
|
-
TRIGGER when: user references "token 治理"、"tokens diagnose"、"tokens treat"、"治理计划"、".treatment-plan.md"、"baseline 锁定"、"token 反哺"、"清理 token 违规"、"token cleanup"、"lint baseline"、"降违规"、AI sees output of `teamix-evo init` showing token-discipline ESLint warnings and the user wants to follow up.
|
|
325
|
-
|
|
326
|
-
SKIP: rename hints (Part A), component source upgrades (Part B), design decisions (defer to design skill).
|
|
327
|
-
|
|
328
|
-
## C1 · Diagnose
|
|
329
|
-
|
|
330
|
-
Run the diagnosis to understand the current violation landscape:
|
|
331
|
-
|
|
332
|
-
```bash
|
|
333
|
-
npx teamix-evo tokens diagnose
|
|
334
|
-
```
|
|
335
|
-
|
|
336
|
-
This produces `.teamix-evo/.treatment-plan.md` — a tiered treatment plan classifying violations into:
|
|
337
|
-
|
|
338
|
-
| Phase | Description | Automation |
|
|
339
|
-
| ---------------- | -------------------------------------------------------------- | ---------- |
|
|
340
|
-
| L1-structure | Token file structure issues (via `tokens audit`) | audit |
|
|
341
|
-
| L2-format | Color format normalisation (`hsl()` → CSS v4) | full-auto |
|
|
342
|
-
| L3-semantic-auto | Tailwind scale → semantic tokens | full-auto |
|
|
343
|
-
| L3-semantic-semi | Arbitrary values → tokens (AI-guided) | semi-auto |
|
|
344
|
-
| L3-manual | Requires human judgment (radius, border, dark mode) | manual |
|
|
345
|
-
| reflect | High-frequency color literals → project-level token candidates | analysis |
|
|
346
|
-
|
|
347
|
-
Present the plan overview to the user and ask which phases they want to tackle now.
|
|
348
|
-
|
|
349
|
-
## C2 · Treat (automated codemods)
|
|
350
|
-
|
|
351
|
-
For full-auto phases (L2 + L3-auto), run the treatment pipeline:
|
|
352
|
-
|
|
353
|
-
```bash
|
|
354
|
-
# Dry-run first (recommended)
|
|
355
|
-
npx teamix-evo tokens treat
|
|
356
|
-
|
|
357
|
-
# Apply changes
|
|
358
|
-
npx teamix-evo tokens treat --apply
|
|
359
|
-
|
|
360
|
-
# Apply + lock baseline
|
|
361
|
-
npx teamix-evo tokens treat --apply --lock-baseline
|
|
362
|
-
```
|
|
363
|
-
|
|
364
|
-
The pipeline executes 4 codemods in order:
|
|
365
|
-
|
|
366
|
-
1. `hsl-to-v4` — HSL function → CSS v4 color syntax
|
|
367
|
-
2. `hex-to-token` — hardcoded hex → semantic token reference
|
|
368
|
-
3. `tw-scale-to-semantic` — raw Tailwind color scale → semantic class
|
|
369
|
-
4. `space-to-gap` — space utility → gap utility
|
|
370
|
-
|
|
371
|
-
After execution, a treatment report is generated at `.teamix-evo/.treatment-reports/<timestamp>.md` showing per-rule before/after deltas.
|
|
372
|
-
|
|
373
|
-
### Workflow
|
|
374
|
-
|
|
375
|
-
1. **Always dry-run first** — show the user the match counts and ask for confirmation
|
|
376
|
-
2. Show the delta table from the report
|
|
377
|
-
3. If the user approves, re-run with `--apply`
|
|
378
|
-
4. Ask whether to lock the baseline (`--lock-baseline`)
|
|
379
|
-
|
|
380
|
-
## C3 · Semi-auto treatment (AI-guided)
|
|
381
|
-
|
|
382
|
-
For `L3-semantic-semi` violations (`no-arbitrary-tw-value`):
|
|
383
|
-
|
|
384
|
-
1. Read the treatment plan's L3-semi section for the list of violations
|
|
385
|
-
2. For each violation, read the file context and suggest the closest semantic token
|
|
386
|
-
3. Present a diff hunk per file (same template as Part A step 4)
|
|
387
|
-
4. **HARD GATE** — never auto-apply; get per-file confirmation
|
|
388
|
-
|
|
389
|
-
## C4 · Reflect (token 反哺)
|
|
390
|
-
|
|
391
|
-
After automated treatment, remaining `no-color-literal` violations often reveal project-specific colors not covered by the design system. Suggest the user run reflect analysis:
|
|
392
|
-
|
|
393
|
-
1. Scan remaining violations and cluster by color value + frequency
|
|
394
|
-
2. Present a table of candidates (color → suggested token name → occurrence count → files)
|
|
395
|
-
3. Colors appearing ≥ 3 times are candidates for project-level tokens
|
|
396
|
-
4. Guide the user to add chosen tokens to `tokens/tokens.overrides.css`
|
|
397
|
-
5. After adding tokens, re-run `tokens treat` to pick up the new mappings
|
|
398
|
-
|
|
399
|
-
## C5 · Baseline lock
|
|
400
|
-
|
|
401
|
-
Once the user is satisfied with the treatment level:
|
|
402
|
-
|
|
403
|
-
```bash
|
|
404
|
-
npx teamix-evo tokens treat --apply --lock-baseline
|
|
405
|
-
```
|
|
406
|
-
|
|
407
|
-
This writes `.teamix-evo/tokens-baseline.json` — a snapshot of current violation counts. Future `tokens treat` runs will compare against this baseline.
|
|
408
|
-
|
|
409
|
-
**CI integration**: add to `package.json` scripts:
|
|
410
|
-
|
|
411
|
-
```json
|
|
412
|
-
{
|
|
413
|
-
"scripts": {
|
|
414
|
-
"lint:baseline": "teamix-evo tokens treat --lock-baseline && git diff --exit-code .teamix-evo/tokens-baseline.json"
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
```
|
|
418
|
-
|
|
419
|
-
If violations exceed the locked baseline, CI fails — preventing regression.
|
|
420
|
-
|
|
421
|
-
## C6 · Edge cases
|
|
422
|
-
|
|
423
|
-
| Situation | Response |
|
|
424
|
-
| ------------------------------------------------- | -------------------------------------------------------------------------- |
|
|
425
|
-
| No ESLint config / teamix-evo rules not installed | Tell the user to run `teamix-evo init` first to set up the lint rules. |
|
|
426
|
-
| No `src/` directory | Ask which directory to scan; default to `packages/*/src` in monorepo. |
|
|
427
|
-
| Codemod not found | Skip gracefully; the pipeline only runs available codemods. |
|
|
428
|
-
| User wants to skip a phase | Respect the choice; only run requested phases. |
|
|
429
|
-
| Baseline already exists | Show current vs baseline comparison before re-locking. |
|
|
430
|
-
| Treatment report shows 0 delta | All violations are either semi-auto or manual; guide user to C3/C4. |
|
|
431
|
-
| User says "全部治理" | Run diagnose → treat --apply → reflect in sequence, but confirm each step. |
|
|
File without changes
|