mta-mcp 1.0.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 (75) hide show
  1. package/README.md +818 -0
  2. package/agents/_TEMPLATE.md +153 -0
  3. package/agents/flutter.agent.md +222 -0
  4. package/agents/i18n.agent.md +78 -0
  5. package/agents/logicflow.agent.md +97 -0
  6. package/agents/vue3.agent.md +176 -0
  7. package/agents/wechat-miniprogram.agent.md +89 -0
  8. package/bin/mta.cjs +132 -0
  9. package/common/i18n.md +385 -0
  10. package/common/typescript-strict.md +186 -0
  11. package/dist/index.d.ts +64 -0
  12. package/dist/index.js +6493 -0
  13. package/dist/index.js.map +1 -0
  14. package/package.json +81 -0
  15. package/standards/README.md +194 -0
  16. package/standards/core/code-generation.md +421 -0
  17. package/standards/core/code-style.md +308 -0
  18. package/standards/core/dart-base.md +572 -0
  19. package/standards/core/mandatory-rules.md +103 -0
  20. package/standards/core/typescript-base.md +179 -0
  21. package/standards/frameworks/flutter-ui-system.md +497 -0
  22. package/standards/frameworks/flutter.md +1268 -0
  23. package/standards/frameworks/pinia.md +172 -0
  24. package/standards/frameworks/vue3-composition.md +779 -0
  25. package/standards/frameworks/wechat-miniprogram.md +2177 -0
  26. package/standards/libraries/element-plus.md +1128 -0
  27. package/standards/libraries/i18n.md +360 -0
  28. package/standards/libraries/logicflow.md +1007 -0
  29. package/standards/patterns/api-layer.md +187 -0
  30. package/standards/patterns/component-design.md +200 -0
  31. package/standards/patterns/design-system-restoration.md +570 -0
  32. package/standards/patterns/vue-api-mock-layer.md +958 -0
  33. package/standards/patterns/vue-css-nesting.md +604 -0
  34. package/standards/troubleshooting-cases/flutter/textfield-vertical-centering.md +107 -0
  35. package/standards/workflows/design-restoration-guide.md +164 -0
  36. package/standards/workflows/large-project-split.md +359 -0
  37. package/standards/workflows/problem-diagnosis.md +280 -0
  38. package/standards/workflows/textfield-centering-guide.md +157 -0
  39. package/templates/README.md +144 -0
  40. package/templates/common/types/_CONFIG.md +12 -0
  41. package/templates/common/types/api.ts +39 -0
  42. package/templates/common/types/common.ts +70 -0
  43. package/templates/config-templates/agents-section.md +9 -0
  44. package/templates/config-templates/custom-section.md +6 -0
  45. package/templates/config-templates/header.md +29 -0
  46. package/templates/config-templates/workflow-minimal.md +44 -0
  47. package/templates/copilot-instructions-mcp-optimized.md +158 -0
  48. package/templates/vue/api-layer/_CONFIG.md +145 -0
  49. package/templates/vue/api-layer/index.ts +58 -0
  50. package/templates/vue/api-layer/mock/index.ts +122 -0
  51. package/templates/vue/api-layer/modules/_template.ts +109 -0
  52. package/templates/vue/api-layer/modules/index.ts +16 -0
  53. package/templates/vue/api-layer/request.ts +279 -0
  54. package/templates/vue/api-layer/types.ts +80 -0
  55. package/troubleshooting/README.md +368 -0
  56. package/troubleshooting/USAGE_GUIDE.md +289 -0
  57. package/troubleshooting/flutter/clip-/351/230/264/345/275/261/350/243/201/345/211/252.md +244 -0
  58. package/troubleshooting/flutter/component-/351/200/232/347/224/250/345/214/226/346/217/220/345/217/226.md +269 -0
  59. package/troubleshooting/flutter/input-/345/255/227/346/256/265/347/274/272/345/244/261.md +240 -0
  60. package/troubleshooting/flutter/input-/350/276/271/346/241/206/351/227/256/351/242/230.md +236 -0
  61. package/troubleshooting/flutter/layout-/345/260/272/345/257/270/344/270/215/345/214/271/351/205/215.md +214 -0
  62. package/troubleshooting/flutter/shadow-/351/200/217/345/207/272/351/227/256/351/242/230.md +172 -0
  63. package/troubleshooting/flutter/sketch-/345/210/227/350/241/250item/345/214/272/345/237/237.md +212 -0
  64. package/troubleshooting/flutter/sketch-/345/233/276/346/240/207/345/260/272/345/257/270.md +135 -0
  65. package/troubleshooting/flutter/sketch-/345/256/214/346/225/264/346/217/220/345/217/226.md +201 -0
  66. package/troubleshooting/flutter/sketch-/345/261/236/346/200/247/346/234/252/344/275/277/347/224/250.md +139 -0
  67. package/troubleshooting/flutter/sketch-/350/203/214/346/231/257/345/261/202/351/253/230/345/272/246.md +264 -0
  68. package/troubleshooting/flutter/svg-/346/234/252/345/261/205/344/270/255.md +120 -0
  69. package/troubleshooting/flutter/svg-/351/242/234/350/211/262/345/274/202/345/270/270.md +117 -0
  70. package/troubleshooting/flutter/tabbar-/345/212/250/347/224/273/345/220/214/346/255/245.md +107 -0
  71. package/troubleshooting/flutter/withopacity-/345/274/203/347/224/250.md +81 -0
  72. package/troubleshooting/vue3/cascader-/350/257/257/346/233/277/346/215/242.md +130 -0
  73. package/troubleshooting/vue3/drawer-input-/346/240/267/345/274/217.md +181 -0
  74. package/troubleshooting/vue3/table-/347/274/226/350/276/221/345/217/226/346/266/210.md +148 -0
  75. package/troubleshooting/vue3/table-/350/276/271/346/241/206/351/227/256/351/242/230.md +178 -0
@@ -0,0 +1,570 @@
1
+ # 设计稿还原全局规范
2
+
3
+ > 跨平台通用的设计稿还原规范(Flutter / Vue / React / 小程序)
4
+ > 版本: v1.0.0 | 更新: 2026-01-20
5
+
6
+ ---
7
+
8
+ ## 🔴 核心原则
9
+
10
+ **全局样式优先检查**:在还原任何 UI 元素前,必须通过搜索检查项目是否已定义该样式,禁止直接硬编码样式值。
11
+
12
+ ---
13
+
14
+ ## 🔍 样式检查方法(通用流程)
15
+
16
+ ### 步骤 1: 测量设计稿
17
+
18
+ 从 Sketch/Figma 中测量出具体数值,例如:
19
+ - 圆角: 16px
20
+ - 按钮高度: 56px
21
+ - 颜色: #1C2B45
22
+ - 阴影: (6,6,12)
23
+
24
+ ### 步骤 2: 全局搜索该值
25
+
26
+ **不要假设文件路径**,直接在项目根目录搜索该值:
27
+
28
+ #### 方法 1: 命令行搜索(推荐)
29
+
30
+ ```bash
31
+ # 搜索数值(适用圆角、尺寸、间距)
32
+ grep -r "16" . --include="*.dart" --include="*.ts" --include="*.scss" --include="*.css"
33
+
34
+ # 搜索颜色
35
+ grep -ri "1C2B45\|1c2b45" .
36
+
37
+ # 搜索关键词(如 radius, shadow, color)
38
+ grep -ri "radius.*16\|16.*radius" .
39
+ ```
40
+
41
+ #### 方法 2: IDE 全局搜索
42
+
43
+ 1. VSCode/Android Studio: `Cmd/Ctrl + Shift + F`
44
+ 2. 搜索内容: `16` 或 `1C2B45` 或 `radius`
45
+ 3. 包含文件: `*.dart, *.ts, *.vue, *.scss`
46
+ 4. 排除目录: `node_modules, build, .git`
47
+
48
+ ### 步骤 3: 识别样式定义
49
+
50
+ 搜索结果中寻找以下模式:
51
+
52
+ #### 常量定义模式
53
+
54
+ ```dart
55
+ // Flutter
56
+ static const double borderRadius = 16;
57
+ static const double cardRadius = 16;
58
+ static const radius16 = 16.0;
59
+
60
+ // TypeScript/JavaScript
61
+ export const RADIUS_LG = 16;
62
+ const borderRadius = '16px';
63
+
64
+ // SCSS
65
+ $radius-lg: 16px;
66
+ --radius-card: 16px;
67
+ ```
68
+
69
+ #### 语义化命名模式
70
+
71
+ 常见命名规则:
72
+ - `lg`, `large`, `big` → 大尺寸
73
+ - `md`, `medium`, `base` → 中等尺寸
74
+ - `sm`, `small` → 小尺寸
75
+ - `primary`, `main`, `brand` → 主要色
76
+ - `secondary`, `accent` → 次要色
77
+ - `text-*`, `bg-*`, `border-*` → 语义化颜色
78
+
79
+ ### 步骤 4: 判断是否使用
80
+
81
+ 判断标准:
82
+ - ✅ 该值在多个文件中重复出现 → 应该有全局定义
83
+ - ✅ 找到常量定义 → 使用该常量
84
+ - ❌ 只找到硬编码 → 考虑提取为常量
85
+ - ❌ 完全找不到 → 可能是新增样式,需确认是否需建立规范
86
+
87
+ ---
88
+
89
+ ## 📐 常见样式类型检查指南
90
+
91
+ ### 1. 圆角 (Border Radius)
92
+
93
+ #### 搜索关键词
94
+ ```bash
95
+ # 搜索具体数值
96
+ grep -ri "radius.*16\|16.*radius\|borderRadius.*16" .
97
+
98
+ # 搜索变量名
99
+ grep -ri "radius\|rounded\|corner" . --include="*.dart" --include="*.ts"
100
+ ```
101
+
102
+ #### 可能的定义位置
103
+ - 常量类:`*Radius*`, `*Corner*`, `*Rounded*`
104
+ - CSS 变量:`--radius-*`, `--rounded-*`, `--border-radius-*`
105
+ - 配置对象:`theme.radius`, `config.borderRadius`
106
+
107
+ #### 常见命名模式
108
+ ```dart
109
+ // Flutter
110
+ AppRadius.lg / DesignRadius.large / borderRadiusLarge / RADIUS_16
111
+
112
+ // CSS/SCSS
113
+ --radius-lg / $radius-large / @border-radius-lg
114
+
115
+ // JS/TS
116
+ borderRadius.lg / RADIUS.LARGE / theme.radius.large
117
+ ```
118
+
119
+ ### 2. 尺寸 (Size/Height/Width)
120
+
121
+ #### 搜索关键词
122
+ ```bash
123
+ # 按钮高度
124
+ grep -ri "height.*56\|buttonHeight\|btnHeight" .
125
+
126
+ # 图标尺寸
127
+ grep -ri "iconSize\|icon.*size\|size.*icon" .
128
+
129
+ # 间距
130
+ grep -ri "spacing\|margin\|padding\|gap" .
131
+ ```
132
+
133
+ #### 可能的定义位置
134
+ - 尺寸常量:`*Size*`, `*Height*`, `*Width*`, `*Spacing*`
135
+ - 组件配置:`ButtonConfig`, `IconConfig`
136
+ - Design Token:`spacing.*`, `size.*`
137
+
138
+ #### 常见命名模式
139
+ ```dart
140
+ // 按钮
141
+ buttonHeightLarge / BTN_HEIGHT_LG / button.height.large
142
+
143
+ // 间距
144
+ spacingMedium / SPACING_16 / spacing.md / space-4
145
+
146
+ // 图标
147
+ iconSizeMedium / ICON_SIZE_24 / icon.size.md
148
+ ```
149
+
150
+ ### 3. 颜色 (Color)
151
+
152
+ #### 搜索关键词
153
+ ```bash
154
+ # 搜索色值(HEX)
155
+ grep -ri "1C2B45\|#1C2B45" .
156
+
157
+ # 搜索色值(RGB)
158
+ grep -ri "0xFF1C2B45\|rgba(28,\s*43,\s*69" .
159
+
160
+ # 搜索颜色名
161
+ grep -ri "primary\|secondary\|brand\|accent" . --include="*color*"
162
+ ```
163
+
164
+ #### 可能的定义位置
165
+ - 颜色类:`*Color*`, `*Palette*`, `*Theme*`
166
+ - CSS 变量:`--color-*`, `--bg-*`, `--text-*`
167
+ - 设计系统:`colors.*`, `palette.*`
168
+
169
+ #### 语义化颜色命名
170
+ ```
171
+ 功能色: primary, secondary, accent, brand
172
+ 状态色: success, warning, error, info, disabled
173
+ 文本色: text-primary, text-secondary, text-disabled, text-hint
174
+ 背景色: bg-primary, bg-secondary, surface, background
175
+ 边框色: border, border-light, border-dark, divider
176
+ ```
177
+
178
+ ### 4. 阴影 (Shadow/Elevation)
179
+
180
+ #### 搜索关键词
181
+ ```bash
182
+ # 搜索阴影参数
183
+ grep -ri "boxShadow\|elevation\|shadow" .
184
+
185
+ # 搜索具体参数值
186
+ grep -ri "offset.*6.*6\|blur.*12" .
187
+ ```
188
+
189
+ #### 可能的定义位置
190
+ - 阴影类:`*Shadow*`, `*Elevation*`
191
+ - CSS Mixin:`@mixin shadow`, `@mixin elevation`
192
+ - 预设对象:`shadows.*`, `elevations.*`
193
+
194
+ #### 常见命名模式
195
+ ```dart
196
+ // 层级命名
197
+ shadow1 / shadow2 / elevation1 / elevation2
198
+
199
+ // 语义命名
200
+ shadowCard / shadowButton / shadowModal / shadowNone
201
+
202
+ // 尺寸命名
203
+ shadowSm / shadowMd / shadowLg / shadowXl
204
+ ```
205
+
206
+ ### 5. 字体 (Typography)
207
+
208
+ #### 搜索关键词
209
+ ```bash
210
+ # 字号
211
+ grep -ri "fontSize.*14\|font.*14\|14px" .
212
+
213
+ # 字重
214
+ grep -ri "fontWeight\|font-weight\|w400\|w700" .
215
+
216
+ # 字体系列
217
+ grep -ri "fontFamily\|font-family" .
218
+ ```
219
+
220
+ #### 可能的定义位置
221
+ - 字体类:`*Typography*`, `*TextStyle*`, `*Font*`
222
+ - CSS 变量:`--font-size-*`, `--font-weight-*`
223
+ - 主题配置:`theme.typography`, `textStyles.*`
224
+
225
+ #### 常见命名模式
226
+ ```
227
+ // 层级命名
228
+ h1, h2, h3, h4, h5, h6
229
+
230
+ // 语义命名
231
+ headline, title, subtitle, body, caption, overline
232
+
233
+ // 尺寸命名
234
+ text-xs, text-sm, text-base, text-lg, text-xl
235
+ ```
236
+
237
+ ### 6. 渐变 (Gradient)
238
+
239
+ #### 搜索关键词
240
+ ```bash
241
+ # 线性渐变
242
+ grep -ri "linearGradient\|linear-gradient\|LinearGradient" .
243
+
244
+ # 径向渐变
245
+ grep -ri "radialGradient\|radial-gradient" .
246
+
247
+ # 渐变色值
248
+ grep -ri "gradient.*start\|gradient.*end" .
249
+ ```
250
+
251
+ #### 可能的定义位置
252
+ - 渐变对象:`*Gradient*`, `gradients.*`
253
+ - CSS 变量/Mixin:`--gradient-*`, `@mixin gradient`
254
+
255
+ ### 7. 动画/过渡 (Animation/Transition)
256
+
257
+ #### 搜索关键词
258
+ ```bash
259
+ # 动画时长
260
+ grep -ri "duration\|transition.*duration\|animationDuration" .
261
+
262
+ # 缓动函数
263
+ grep -ri "easing\|cubic-bezier\|ease-in\|ease-out" .
264
+ ```
265
+
266
+ #### 可能的定义位置
267
+ - 动画配置:`*Animation*`, `*Transition*`, `*Duration*`
268
+ - CSS 变量:`--duration-*`, `--easing-*`
269
+
270
+ ### 8. 层级 (Z-Index)
271
+
272
+ #### 搜索关键词
273
+ ```bash
274
+ grep -ri "zIndex\|z-index" .
275
+ ```
276
+
277
+ #### 常见命名
278
+ ```
279
+ zIndexModal / zIndexDropdown / zIndexTooltip / zIndexOverlay
280
+ --z-modal / --z-dropdown / z-1000, z-2000
281
+ ```
282
+
283
+ ---
284
+
285
+ ## 🚀 使用项目样式规范
286
+
287
+ ### 通用使用流程
288
+
289
+ ```
290
+ 1. 从设计稿测量 → 2. 全局搜索 → 3. 找到定义 → 4. 使用常量/变量
291
+ ```
292
+
293
+ ### Flutter 示例
294
+
295
+ ```dart
296
+ // ❌ 错误:直接硬编码
297
+ Container(
298
+ decoration: BoxDecoration(
299
+ borderRadius: BorderRadius.circular(16),
300
+ color: Color(0xFF1C2B45),
301
+ ),
302
+ height: 56,
303
+ )
304
+
305
+ // ✅ 正确:先搜索项目,找到并使用常量
306
+ // 1. 搜索: grep -r "16" lib/ | grep -i radius
307
+ // 2. 发现: AppRadius.lg = 16 (在 lib/theme/app_radius.dart)
308
+ // 3. 使用常量:
309
+ import 'package:app/theme/app_radius.dart';
310
+ import 'package:app/theme/app_colors.dart';
311
+ import 'package:app/theme/app_sizes.dart';
312
+
313
+ Container(
314
+ decoration: BoxDecoration(
315
+ borderRadius: BorderRadius.circular(AppRadius.lg),
316
+ color: AppColors.textPrimary,
317
+ ),
318
+ height: AppSizes.buttonHeightCTA,
319
+ )
320
+ ```
321
+
322
+ ### Vue / React 示例
323
+
324
+ ```vue
325
+ <template>
326
+ <div class="card">
327
+ <button class="btn-cta">提交</button>
328
+ </div>
329
+ </template>
330
+
331
+ <style scoped lang="scss">
332
+ // ❌ 错误:直接硬编码
333
+ .card {
334
+ border-radius: 16px;
335
+ box-shadow: 0 6px 12px rgba(0,0,0,0.1);
336
+ height: 56px;
337
+ }
338
+
339
+ // ✅ 正确:先搜索项目 CSS 变量或 SCSS 变量
340
+ // 1. 搜索: grep -r "--radius\|$radius" src/
341
+ // 2. 发现: --radius-card: 16px (在 src/styles/variables.css)
342
+ // 3. 使用变量:
343
+ .card {
344
+ border-radius: var(--radius-card);
345
+ box-shadow: var(--shadow-card);
346
+ height: var(--button-height-lg);
347
+ }
348
+ </style>
349
+ ```
350
+
351
+ ### 小程序示例
352
+
353
+ ```javascript
354
+ // ❌ 错误:直接硬编码
355
+ <view style="border-radius: 16px; height: 56px;">
356
+
357
+ // ✅ 正确:先搜索配置文件
358
+ // 1. 搜索: grep -r "16" config/
359
+ // 2. 发现: RADIUS_LG = 16 (在 config/design.js)
360
+ // 3. 使用配置:
361
+ import { RADIUS_LG, BUTTON_HEIGHT_LG } from '@/config/design'
362
+
363
+ <view style="border-radius: {{RADIUS_LG}}rpx; height: {{BUTTON_HEIGHT_LG}}rpx;">
364
+ ```
365
+
366
+
367
+ ---
368
+
369
+ ## ⚠️ 强制要求
370
+
371
+ ### 禁止假设文件路径
372
+
373
+ ```dart
374
+ // ❌ 禁止:假设样式定义在固定路径
375
+ import 'package:app/core/themes/design_constants.dart'; // 不确定是否存在
376
+
377
+ // ✅ 正确:先搜索确认
378
+ // 1. 搜索: grep -r "DesignRadius\|AppRadius\|RADIUS" lib/
379
+ // 2. 找到实际路径: lib/constants/app_theme.dart
380
+ // 3. 导入正确路径
381
+ import 'package:app/constants/app_theme.dart';
382
+ ```
383
+
384
+ ### 禁止跳过搜索直接硬编码
385
+
386
+ ```dart
387
+ // ❌ 禁止流程
388
+ 测量设计稿: 16px → 直接写: BorderRadius.circular(16)
389
+
390
+ // ✅ 正确流程
391
+ 测量设计稿: 16px
392
+
393
+ 搜索项目: grep -r "16" lib/ | grep -i "radius"
394
+
395
+ 找到定义: AppRadius.medium = 16 (或找不到)
396
+
397
+ 使用常量: BorderRadius.circular(AppRadius.medium)
398
+ (或提出是否需要新建常量)
399
+ ```
400
+
401
+ ### 必须搜索整个项目
402
+
403
+ 不要只搜索特定目录,项目可能有不同的组织结构:
404
+
405
+ ```bash
406
+ # ❌ 禁止:只搜索固定目录
407
+ grep -r "radius" lib/core/themes/
408
+
409
+ # ✅ 正确:搜索整个项目
410
+ grep -r "radius" . --include="*.dart"
411
+
412
+ # 常用搜索范围
413
+ lib/ # Flutter 主代码
414
+ src/ # Vue/React 主代码
415
+ app/ # 某些项目的主代码
416
+ config/ # 配置文件
417
+ constants/ # 常量定义
418
+ theme/ # 主题定义
419
+ styles/ # 样式文件
420
+ utils/ # 工具函数
421
+ ```
422
+
423
+ ### 处理搜索无结果的情况
424
+
425
+ 如果搜索不到该值的常量定义:
426
+
427
+ 1. **扩大搜索范围** - 搜索相近值(如 16 → 搜索 15-18)
428
+ 2. **搜索语义名称** - 搜索 `large`, `medium`, `card` 等
429
+ 3. **检查是否有统一管理** - 搜索 `theme`, `config`, `constants`
430
+ 4. **询问是否需要提取** - 该值在设计稿中多处出现,应提取为常量吗?
431
+ 5. **说明原因后硬编码** - 如确实是特殊场景,添加注释说明
432
+
433
+ ```dart
434
+ // ✅ 可接受的硬编码(特殊场景+注释)
435
+ BorderRadius.circular(13) // 特殊圆角值,仅此处使用,已与设计确认
436
+ ```
437
+
438
+
439
+ ---
440
+
441
+ ## 📋 设计稿还原检查清单
442
+
443
+ ### ⭐ 核心检查(必须完成)
444
+
445
+ - [ ] 已从设计稿测量出具体数值(圆角/尺寸/颜色等)
446
+ - [ ] 已在项目中全局搜索该数值
447
+ - [ ] 已查看搜索结果,确认是否有常量定义
448
+ - [ ] 已决定使用常量或合理硬编码(特殊场景)
449
+
450
+ ### 📝 详细检查清单
451
+
452
+ #### 圆角检查
453
+ - [ ] 已搜索: `grep -ri "radius.*[测量值]\|[测量值].*radius" .`
454
+ - [ ] 确认使用: `AppRadius.*` / `--radius-*` / `theme.radius.*`
455
+
456
+ #### 尺寸检查
457
+ - [ ] 已搜索: `grep -ri "height.*[测量值]\|width.*[测量值]" .`
458
+ - [ ] 确认使用: 按钮/图标/间距相关常量
459
+
460
+ #### 颜色检查
461
+ - [ ] 已搜索色值: `grep -ri "[色值HEX]" .`
462
+ - [ ] 已搜索语义名: `grep -ri "primary\|secondary\|brand" .`
463
+ - [ ] 确认使用: 颜色常量而非硬编码色值
464
+
465
+ #### 阴影检查
466
+ - [ ] 已搜索: `grep -ri "shadow\|elevation" .`
467
+ - [ ] 确认使用: 预设阴影而非手写参数
468
+
469
+ #### 字体检查
470
+ - [ ] 已搜索字号: `grep -ri "fontSize.*[测量值]" .`
471
+ - [ ] 已搜索字重: `grep -ri "fontWeight\|w[400|700]" .`
472
+ - [ ] 确认使用: 字体相关常量
473
+
474
+ ### 🚫 反面检查(确保避免)
475
+
476
+ - [ ] 未跳过搜索直接硬编码
477
+ - [ ] 未假设文件路径(而是搜索确认)
478
+ - [ ] 未只搜索固定目录(而是搜索全项目)
479
+ - [ ] 未忽略搜索到的现有常量定义
480
+
481
+ ---
482
+
483
+ ## 🔍 实用搜索技巧
484
+
485
+ ### 高效搜索命令
486
+
487
+ ```bash
488
+ # 1. 按数值搜索(精确)
489
+ grep -r "16" . --include="*.dart" --include="*.ts" --include="*.scss"
490
+
491
+ # 2. 按数值范围搜索(模糊)
492
+ grep -rE "1[4-8]" . --include="*.dart" # 搜索 14-18
493
+
494
+ # 3. 按关键词+数值搜索(组合)
495
+ grep -ri "radius.*16\|16.*radius" .
496
+
497
+ # 4. 按文件类型搜索
498
+ grep -r "radius" . --include="*{theme,constant,config,style}*"
499
+
500
+ # 5. 排除目录搜索(提高速度)
501
+ grep -r "radius" . --exclude-dir={node_modules,build,.git,dist}
502
+
503
+ # 6. 查看上下文(了解用法)
504
+ grep -r "AppRadius" . -A 3 -B 3 # 显示前后3行
505
+ ```
506
+
507
+ ### VSCode 搜索技巧
508
+
509
+ 1. **正则搜索**: 勾选 `.*` 图标,搜索 `radius.*(16|1[4-8])`
510
+ 2. **文件包含**: `*.dart, *.ts, *.vue, *.scss`
511
+ 3. **文件排除**: `**/node_modules, **/build, **/.git`
512
+ 4. **全词匹配**: 搜索 `\bradius\b` 而非 `radius`
513
+ 5. **大小写敏感**: 根据项目命名规范调整
514
+
515
+ ### 搜索结果分析
516
+
517
+ ```
518
+ 搜索结果示例:
519
+ lib/theme/app_radius.dart:10: static const double lg = 16;
520
+ lib/screens/home.dart:45: borderRadius: BorderRadius.circular(16),
521
+ lib/components/card.dart:23: final radius = 16.0;
522
+
523
+ 分析:
524
+ ✅ 第1条: 这是常量定义,应该使用它
525
+ ❌ 第2-3条: 这是硬编码,应该改用第1条的常量
526
+ ```
527
+
528
+ ---
529
+
530
+ ## 💡 项目无全局样式时的处理
531
+
532
+ 如果搜索整个项目都找不到样式规范定义:
533
+
534
+ ### 方案1: 创建全局样式文件(推荐)
535
+
536
+ ```dart
537
+ // 1. 创建文件(根据项目结构选择合适位置)
538
+ // Flutter: lib/config/design_constants.dart
539
+ // Vue: src/config/design-tokens.ts
540
+
541
+ // 2. 提取常量
542
+ abstract class DesignConstants {
543
+ // 从设计稿测量的常用值
544
+ static const double radiusCard = 16;
545
+ static const double buttonHeightLarge = 56;
546
+ static const Color primaryColor = Color(0xFF1C2B45);
547
+ }
548
+
549
+ // 3. 逐步迁移硬编码
550
+ ```
551
+
552
+ ### 方案2: 暂时硬编码+注释
553
+
554
+ ```dart
555
+ // 项目暂无设计系统,待后续统一重构
556
+ BorderRadius.circular(16) // TODO: 提取为 DesignConstants.radiusCard
557
+ ```
558
+
559
+ ### 方案3: 咨询团队
560
+
561
+ 在团队协作项目中,应先与团队确认:
562
+ - 是否计划建立设计系统?
563
+ - 样式规范是否有文档说明?
564
+ - 是否应该提取常量还是保持硬编码?
565
+
566
+ ---
567
+
568
+ **维护团队**: MTA工作室
569
+ **适用范围**: Flutter / Vue / React / 小程序 / 任何 UI 还原场景
570
+ **核心理念**: 通过全局搜索发现项目现有规范,避免硬编码和假设