mta-mcp 2.14.0 → 2.16.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/agents/_TEMPLATE.md +153 -0
- package/agents/flutter.agent.md +118 -155
- package/agents/i18n.agent.md +50 -105
- package/agents/logicflow.agent.md +55 -1525
- package/agents/vue3.agent.md +84 -248
- package/agents/wechat-miniprogram.agent.md +48 -950
- package/dist/index.js +391 -443
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/standards/core/mandatory-rules.md +103 -0
- package/standards/frameworks/flutter.md +78 -0
- package/standards/libraries/logicflow.md +1007 -0
- package/standards/troubleshooting-cases/flutter/textfield-vertical-centering.md +107 -0
- package/standards/workflows/design-restoration-guide.md +164 -0
- package/standards/workflows/problem-diagnosis.md +68 -0
- package/standards/workflows/textfield-centering-guide.md +157 -0
- package/templates/config-templates/agents-section.md +9 -0
- package/templates/config-templates/custom-section.md +6 -0
- package/templates/config-templates/header.md +29 -0
- package/templates/config-templates/workflow-minimal.md +44 -0
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
# Agent 开发模板
|
|
2
|
+
|
|
3
|
+
> 所有 Agent 必须采用"规范获取指引"模式
|
|
4
|
+
> 版本: v1.0.0 | 创建日期: 2026-01-16
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## 🎯 设计原则
|
|
9
|
+
|
|
10
|
+
**Agent 的职责是引导 AI 获取规范,而不是嵌入完整规范。**
|
|
11
|
+
|
|
12
|
+
| 应该包含 | 不应该包含 |
|
|
13
|
+
|----------|------------|
|
|
14
|
+
| MCP 工具调用示例 | 完整的代码示例 |
|
|
15
|
+
| 规范 ID 列表 | 详细的规则说明 |
|
|
16
|
+
| 简要提示(10-20行) | 大段代码块 |
|
|
17
|
+
| 问题诊断指引 | 常用模式的完整实现 |
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## 📋 标准结构
|
|
22
|
+
|
|
23
|
+
```markdown
|
|
24
|
+
# [框架/技术] 开发代理
|
|
25
|
+
|
|
26
|
+
> 此 Agent 引导 AI 通过 MCP 工具获取 npm 包中的详细规范
|
|
27
|
+
> 版本: vX.X.X | 最后更新: YYYY-MM-DD
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## 🔴 问题诊断优先(最高优先级)
|
|
32
|
+
|
|
33
|
+
**当用户描述任何问题时,必须首先调用:**
|
|
34
|
+
|
|
35
|
+
\`\`\`
|
|
36
|
+
troubleshoot({ problem: "用户描述的问题" })
|
|
37
|
+
\`\`\`
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## 📚 规范获取指引
|
|
42
|
+
|
|
43
|
+
**⚠️ 核心原则:写代码前,必须先通过 MCP 工具获取规范!**
|
|
44
|
+
|
|
45
|
+
### 按文件类型获取
|
|
46
|
+
|
|
47
|
+
| 场景 | MCP 调用 |
|
|
48
|
+
|------|----------|
|
|
49
|
+
| xxx 文件 | \`get_standard_by_id({ id: 'xxx-standard' })\` |
|
|
50
|
+
|
|
51
|
+
### 按使用的库获取
|
|
52
|
+
|
|
53
|
+
| 库 | MCP 调用 |
|
|
54
|
+
|----|----------|
|
|
55
|
+
| xxx-lib | \`get_standard_by_id({ id: 'xxx-lib' })\` |
|
|
56
|
+
|
|
57
|
+
### 智能获取(推荐)
|
|
58
|
+
|
|
59
|
+
\`\`\`
|
|
60
|
+
get_compact_standards({ currentFile: "当前文件路径" })
|
|
61
|
+
\`\`\`
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## 🎯 快速提示
|
|
66
|
+
|
|
67
|
+
> 以下是简要提示,**详细规范请通过上述 MCP 工具获取**
|
|
68
|
+
|
|
69
|
+
### 必须遵守(3-5条)
|
|
70
|
+
|
|
71
|
+
- ✅ 规则1
|
|
72
|
+
- ✅ 规则2
|
|
73
|
+
|
|
74
|
+
### 禁止(3-5条)
|
|
75
|
+
|
|
76
|
+
- ❌ 禁止1
|
|
77
|
+
- ❌ 禁止2
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## 📋 可用规范列表
|
|
82
|
+
|
|
83
|
+
通过 \`get_standard_by_id({ id: 'xxx' })\` 获取:
|
|
84
|
+
|
|
85
|
+
- \`standard-id-1\` - 描述
|
|
86
|
+
- \`standard-id-2\` - 描述
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
**维护团队**: MTA工作室
|
|
91
|
+
**设计理念**: Agent 只提供获取指引,详细规范由 MCP 工具从 npm 包动态获取
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## ✅ 检查清单
|
|
97
|
+
|
|
98
|
+
新建 Agent 时,确保:
|
|
99
|
+
|
|
100
|
+
- [ ] 第一节是"问题诊断优先"
|
|
101
|
+
- [ ] 第二节是"规范获取指引"(包含 MCP 调用表格)
|
|
102
|
+
- [ ] "快速提示"不超过 20 行
|
|
103
|
+
- [ ] 没有大段代码示例(超过 10 行的代码块)
|
|
104
|
+
- [ ] 列出了所有可用的规范 ID
|
|
105
|
+
- [ ] 文件总行数不超过 150 行
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## 🚫 反面示例
|
|
110
|
+
|
|
111
|
+
```markdown
|
|
112
|
+
# ❌ 错误:嵌入完整规范
|
|
113
|
+
|
|
114
|
+
## Vue 3 规范
|
|
115
|
+
|
|
116
|
+
### Composition API
|
|
117
|
+
|
|
118
|
+
\`\`\`vue
|
|
119
|
+
<script setup lang="ts">
|
|
120
|
+
import { ref, computed, onMounted } from 'vue'
|
|
121
|
+
|
|
122
|
+
// 30 行完整代码示例...
|
|
123
|
+
</script>
|
|
124
|
+
\`\`\`
|
|
125
|
+
|
|
126
|
+
### 表单处理
|
|
127
|
+
|
|
128
|
+
\`\`\`typescript
|
|
129
|
+
// 又是 20 行完整代码...
|
|
130
|
+
\`\`\`
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
```markdown
|
|
134
|
+
# ✅ 正确:指引获取
|
|
135
|
+
|
|
136
|
+
## 📚 规范获取指引
|
|
137
|
+
|
|
138
|
+
| 场景 | MCP 调用 |
|
|
139
|
+
|------|----------|
|
|
140
|
+
| Vue 组件 | \`get_standard_by_id({ id: 'vue3-composition' })\` |
|
|
141
|
+
|
|
142
|
+
## 🎯 快速提示
|
|
143
|
+
|
|
144
|
+
- ✅ 使用 Composition API
|
|
145
|
+
- ✅ Props 必须定义类型
|
|
146
|
+
- ❌ 禁止 Options API
|
|
147
|
+
|
|
148
|
+
> 详细规范请通过 MCP 工具获取
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
**此模板适用于所有 Agent,包括现有的和未来添加的。**
|
package/agents/flutter.agent.md
CHANGED
|
@@ -1,210 +1,173 @@
|
|
|
1
|
-
# Flutter
|
|
1
|
+
# Flutter 开发代理
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> 此 Agent 引导 AI 通过 MCP 工具获取 npm 包中的详细规范
|
|
4
|
+
> 版本: v3.1.0 | 最后更新: 2026-01-19
|
|
5
|
+
|
|
6
|
+
---
|
|
4
7
|
|
|
5
8
|
## 🔴 问题诊断优先(最高优先级)
|
|
6
9
|
|
|
7
|
-
|
|
10
|
+
**当用户描述任何问题时,必须首先调用:**
|
|
8
11
|
|
|
9
12
|
```
|
|
10
|
-
|
|
11
|
-
在尝试任何解决方案前,必须先调用:
|
|
12
|
-
|
|
13
|
-
mcp_mta_troubleshoot({ problem: "用户描述的问题" })
|
|
14
|
-
|
|
15
|
-
案例库包含经过验证的解决方案,可避免 6-10 轮无效尝试。
|
|
13
|
+
troubleshoot({ problem: "用户描述的问题" })
|
|
16
14
|
```
|
|
17
15
|
|
|
18
16
|
### 已收录的问题类型
|
|
19
17
|
|
|
20
|
-
| 问题类型 |
|
|
21
|
-
|
|
22
|
-
| 阴影透出/容器变暗 | shadow
|
|
23
|
-
| 布局尺寸不匹配 | layout
|
|
24
|
-
| 阴影被裁剪 | clip
|
|
25
|
-
|
|
|
26
|
-
|
|
|
27
|
-
|
|
|
28
|
-
| 图标尺寸提取错误 | sketch-图标尺寸 | sketch, icon, group, shape |
|
|
29
|
-
| 属性定义但未使用 | sketch-属性未使用 | property, unused |
|
|
30
|
-
| 输入框边框异常 | input-边框问题 | input, border, focus |
|
|
31
|
-
| withOpacity弃用 | withopacity-弃用 | opacity, deprecated |
|
|
18
|
+
| 问题类型 | 关键词 |
|
|
19
|
+
|----------|--------|
|
|
20
|
+
| 阴影透出/容器变暗 | shadow, transparency, neumorphism |
|
|
21
|
+
| 布局尺寸不匹配 | layout, size, spacing |
|
|
22
|
+
| 阴影被裁剪 | clip, shadow, clipBehavior |
|
|
23
|
+
| SVG 颜色/居中问题 | svg, color, viewbox |
|
|
24
|
+
| 输入框边框异常 | input, border, focus |
|
|
25
|
+
| **TextField 垂直居中** | textfield, placeholder, 居中, 光标, 输入框 |
|
|
32
26
|
|
|
33
27
|
---
|
|
34
28
|
|
|
35
|
-
##
|
|
36
|
-
|
|
37
|
-
你是一位 Flutter 和 Dart 开发专家,精通:
|
|
38
|
-
- **Dart 语言** - 空安全、异步编程、模式匹配
|
|
39
|
-
- **Flutter 框架** - Widget 系统、状态管理、导航
|
|
40
|
-
- **Material Design 3** - 现代 UI/UX 设计
|
|
41
|
-
- **跨平台开发** - iOS、Android、Web、Desktop
|
|
42
|
-
|
|
43
|
-
---
|
|
44
|
-
|
|
45
|
-
## ⚠️ 强制工作流
|
|
46
|
-
|
|
47
|
-
### Step 0: 问题诊断(遇到问题时)
|
|
29
|
+
## ⚠️ TextField 垂直居中(高频问题)
|
|
48
30
|
|
|
49
|
-
|
|
50
|
-
# 用户描述了问题?立即调用:
|
|
51
|
-
troubleshoot({ problem: "阴影透出来了,容器比设计稿暗" })
|
|
52
|
-
|
|
53
|
-
# 返回匹配的案例后,获取完整方案:
|
|
54
|
-
get_troubleshooting_case({ framework: "flutter", caseId: "shadow-透出问题" })
|
|
55
|
-
```
|
|
31
|
+
> 此问题曾导致 15+ 轮对话才修复,必须一步到位
|
|
56
32
|
|
|
57
|
-
###
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
# Dart 代码
|
|
62
|
-
get_relevant_standards({ fileType: "dart" })
|
|
63
|
-
→ 加载: standards/core/dart-base.md
|
|
33
|
+
### 问题特征
|
|
34
|
+
- placeholder 和输入内容位置不一致
|
|
35
|
+
- 光标位置偏上/偏下
|
|
36
|
+
- 修改一个问题引发另一个问题
|
|
64
37
|
|
|
65
|
-
|
|
66
|
-
get_relevant_standards({ fileType: "dart", imports: ["flutter"] })
|
|
67
|
-
→ 加载: standards/frameworks/flutter.md
|
|
38
|
+
### 正确方案(直接使用)
|
|
68
39
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
40
|
+
```dart
|
|
41
|
+
Container(
|
|
42
|
+
height: 36, // 设计稿容器高度
|
|
43
|
+
alignment: Alignment.center, // 关键1
|
|
44
|
+
child: TextField(
|
|
45
|
+
style: TextStyle(fontSize: 14, height: 1.43), // 关键2: 行高 = 文本高度÷字号
|
|
46
|
+
decoration: InputDecoration(
|
|
47
|
+
hintStyle: TextStyle(fontSize: 14, height: 1.43), // 关键3: 必须与style一致
|
|
48
|
+
contentPadding: EdgeInsets.zero, // 关键4
|
|
49
|
+
isDense: true, // 关键5
|
|
50
|
+
),
|
|
51
|
+
),
|
|
52
|
+
)
|
|
75
53
|
```
|
|
76
|
-
# 状态管理
|
|
77
|
-
get_relevant_standards({ imports: ["riverpod"], scenario: "状态管理" })
|
|
78
|
-
|
|
79
|
-
# API 调用
|
|
80
|
-
get_relevant_standards({ scenario: "API 调用" })
|
|
81
|
-
→ 加载: standards/patterns/api-layer.md
|
|
82
54
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
55
|
+
### 禁止事项
|
|
56
|
+
- ❌ `style.height` ≠ `hintStyle.height`
|
|
57
|
+
- ❌ 同时用 `textAlignVertical` 和 `height`
|
|
58
|
+
- ❌ 用 `strutStyle + forceStrutHeight`
|
|
59
|
+
- ❌ 反复调整 `contentPadding` 试错
|
|
87
60
|
|
|
88
61
|
---
|
|
89
62
|
|
|
90
|
-
##
|
|
91
|
-
|
|
92
|
-
### Widget 开发
|
|
93
|
-
- 使用组合优于继承
|
|
94
|
-
- 区分 StatelessWidget 和 StatefulWidget
|
|
95
|
-
- 使用 const 构造函数优化性能
|
|
96
|
-
- 避免 build 方法中创建对象
|
|
63
|
+
## 📚 规范获取指引
|
|
97
64
|
|
|
98
|
-
|
|
99
|
-
- 区分瞬时状态和应用状态
|
|
100
|
-
- 使用现代方案(Provider、Riverpod、Bloc)
|
|
101
|
-
- 避免状态重复
|
|
65
|
+
**⚠️ 核心原则:写代码前,必须先通过 MCP 工具获取规范!**
|
|
102
66
|
|
|
103
|
-
###
|
|
67
|
+
### 按文件类型获取
|
|
104
68
|
|
|
105
|
-
|
|
|
106
|
-
|
|
107
|
-
|
|
|
108
|
-
|
|
|
109
|
-
|
|
|
69
|
+
| 场景 | MCP 调用 |
|
|
70
|
+
|------|----------|
|
|
71
|
+
| Dart 代码 | `get_standard_by_id({ id: 'dart-base' })` |
|
|
72
|
+
| Flutter Widget | `get_standard_by_id({ id: 'flutter' })` |
|
|
73
|
+
| UI Token 系统 | `get_standard_by_id({ id: 'flutter-ui-system' })` |
|
|
110
74
|
|
|
111
|
-
|
|
75
|
+
### 按场景获取
|
|
112
76
|
|
|
113
|
-
|
|
77
|
+
| 场景 | MCP 调用 |
|
|
78
|
+
|------|----------|
|
|
79
|
+
| 状态管理 | `get_standard_by_id({ id: 'riverpod' })` |
|
|
80
|
+
| API 调用 | `get_standard_by_id({ id: 'api-layer' })` |
|
|
81
|
+
| 组件设计 | `get_standard_by_id({ id: 'component-design' })` |
|
|
114
82
|
|
|
115
|
-
###
|
|
116
|
-
|
|
117
|
-
```dart
|
|
118
|
-
// ❌ 禁止
|
|
119
|
-
Container(color: Color(0xFF3B82F6), padding: EdgeInsets.all(16))
|
|
83
|
+
### 智能获取(推荐)
|
|
120
84
|
|
|
121
|
-
// ✅ 正确
|
|
122
|
-
Container(color: $c.primary, padding: EdgeInsets.all($s.md))
|
|
123
85
|
```
|
|
86
|
+
// 根据当前文件自动匹配
|
|
87
|
+
get_compact_standards({ currentFile: "xxx.dart" })
|
|
124
88
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
- `$s` - 间距 (AppSpacing)
|
|
129
|
-
- `$r` - 圆角 (AppRadius)
|
|
130
|
-
- `$shadow` - 阴影 (AppShadows)
|
|
89
|
+
// 获取多个规范
|
|
90
|
+
get_standard_by_id({ ids: ['flutter', 'flutter-ui-system'] })
|
|
91
|
+
```
|
|
131
92
|
|
|
132
93
|
---
|
|
133
94
|
|
|
134
|
-
##
|
|
135
|
-
|
|
136
|
-
### 核心原则
|
|
137
|
-
|
|
138
|
-
1. **一次性提取所有属性** - 使用完整样式提取脚本,不要分散查询
|
|
139
|
-
2. **精确坐标** - 从 Sketch 读取精确的 x, y, width, height
|
|
140
|
-
3. **图标用 SVG** - 禁止使用近似的 Material Icons
|
|
141
|
-
4. **检查内部尺寸** - 图标取 Shape 尺寸,不是 Group 尺寸
|
|
142
|
-
|
|
143
|
-
### 遇到问题时
|
|
95
|
+
## 🎯 快速提示
|
|
144
96
|
|
|
145
|
-
|
|
97
|
+
> 以下是简要提示,**详细规范请通过上述 MCP 工具获取**
|
|
146
98
|
|
|
147
|
-
|
|
148
|
-
# 阴影效果不对
|
|
149
|
-
troubleshoot({ problem: "新拟态阴影透出来了" })
|
|
99
|
+
### 必须遵守
|
|
150
100
|
|
|
151
|
-
|
|
152
|
-
|
|
101
|
+
- ✅ 使用 Token 系统(`$c`, `$t`, `$s`, `$r`)
|
|
102
|
+
- ✅ 使用 const 构造函数优化性能
|
|
103
|
+
- ✅ 区分 StatelessWidget 和 StatefulWidget
|
|
104
|
+
- ✅ 组合优于继承
|
|
153
105
|
|
|
154
|
-
|
|
155
|
-
troubleshoot({ problem: "TabBar切换时颜色变化太快" })
|
|
156
|
-
```
|
|
106
|
+
### 禁止
|
|
157
107
|
|
|
158
|
-
|
|
108
|
+
- ❌ 硬编码颜色/尺寸(如 `Color(0xFF3B82F6)`)
|
|
109
|
+
- ❌ 在 build 方法中创建对象
|
|
110
|
+
- ❌ 直接使用 setState 管理复杂状态
|
|
159
111
|
|
|
160
|
-
|
|
112
|
+
### Token 快捷方式
|
|
161
113
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
├── presentation/ # 表现层(screens, widgets, providers, theme)
|
|
170
|
-
└── l10n/ # 国际化
|
|
171
|
-
```
|
|
114
|
+
| 快捷方式 | 用途 |
|
|
115
|
+
|----------|------|
|
|
116
|
+
| `$c` | 颜色 (AppColors) |
|
|
117
|
+
| `$t` | 文字样式 (AppTypography) |
|
|
118
|
+
| `$s` | 间距 (AppSpacing) |
|
|
119
|
+
| `$r` | 圆角 (AppRadius) |
|
|
120
|
+
| `$shadow` | 阴影 (AppShadows) |
|
|
172
121
|
|
|
173
122
|
---
|
|
174
123
|
|
|
175
|
-
##
|
|
176
|
-
|
|
177
|
-
- [ ] 使用 `const` 构造函数
|
|
178
|
-
- [ ] 提取不变的子 Widget
|
|
179
|
-
- [ ] 使用 `ListView.builder` 处理长列表
|
|
180
|
-
- [ ] 使用 `cached_network_image` 缓存图片
|
|
181
|
-
- [ ] 在 `dispose` 中清理动画资源
|
|
182
|
-
- [ ] 使用 `RepaintBoundary` 隔离重绘
|
|
124
|
+
## 📋 可用规范列表
|
|
183
125
|
|
|
184
|
-
|
|
126
|
+
通过 `get_standard_by_id({ id: 'xxx' })` 获取:
|
|
185
127
|
|
|
186
|
-
|
|
128
|
+
**核心规范**
|
|
129
|
+
- `dart-base` - Dart 语言基础规范
|
|
130
|
+
- `flutter` - Flutter 框架规范
|
|
131
|
+
- `flutter-ui-system` - UI Token 系统
|
|
187
132
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
| 网络请求 | dio, retrofit |
|
|
192
|
-
| 本地存储 | hive, isar, shared_preferences |
|
|
193
|
-
| 导航 | go_router, auto_route |
|
|
194
|
-
| UI | flutter_svg, cached_network_image, shimmer |
|
|
195
|
-
| 工具 | freezed, json_serializable |
|
|
133
|
+
**模式规范**
|
|
134
|
+
- `api-layer` - API 层封装模式
|
|
135
|
+
- `component-design` - 组件设计模式
|
|
196
136
|
|
|
197
137
|
---
|
|
198
138
|
|
|
199
|
-
##
|
|
139
|
+
## 🎨 设计稿还原强制规范
|
|
140
|
+
|
|
141
|
+
> ⚠️ 使用 Sketch/Figma MCP 时必须遵守
|
|
142
|
+
|
|
143
|
+
### 强制要求:完整读取选中元素及其所有子集
|
|
144
|
+
|
|
145
|
+
```javascript
|
|
146
|
+
// 正确:一次性获取容器+所有子元素的完整信息
|
|
147
|
+
function extractComplete(element) {
|
|
148
|
+
// 1. 容器信息
|
|
149
|
+
console.log(`容器: ${element.frame.width}x${element.frame.height}`);
|
|
150
|
+
|
|
151
|
+
// 2. 所有子元素信息(关键!)
|
|
152
|
+
element.layers.forEach(child => {
|
|
153
|
+
console.log(`子元素: ${child.name}`);
|
|
154
|
+
console.log(` 位置: Y=${child.frame.y}px`);
|
|
155
|
+
console.log(` 尺寸: ${child.frame.width}x${child.frame.height}`);
|
|
156
|
+
if (child.type === 'Text') {
|
|
157
|
+
console.log(` 字号: ${child.style.fontSize}px`);
|
|
158
|
+
console.log(` 行高: ${child.frame.height / child.style.fontSize}`);
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
```
|
|
200
163
|
|
|
201
|
-
|
|
202
|
-
-
|
|
203
|
-
-
|
|
204
|
-
-
|
|
205
|
-
-
|
|
164
|
+
### 禁止事项
|
|
165
|
+
- ❌ 只读容器属性,忽略内部元素位置
|
|
166
|
+
- ❌ 每次只查一个属性,分散多轮获取
|
|
167
|
+
- ❌ 假设"差不多"而不验证精确像素值
|
|
168
|
+
- ❌ 用"试错法"调整参数
|
|
206
169
|
|
|
207
170
|
---
|
|
208
171
|
|
|
209
172
|
**维护团队**: MTA工作室
|
|
210
|
-
|
|
173
|
+
**设计理念**: Agent 只提供获取指引,详细规范由 MCP 工具从 npm 包动态获取
|
package/agents/i18n.agent.md
CHANGED
|
@@ -1,133 +1,78 @@
|
|
|
1
|
-
|
|
2
|
-
description: '国际化 (i18n) 专用代理 - 零硬编码文本'
|
|
3
|
-
tags: ['i18n', 'vue', 'react']
|
|
4
|
-
tools: ['edit', 'search', 'usages', 'vscodeAPI', 'problems', 'runSubagent']
|
|
5
|
-
---
|
|
1
|
+
# 国际化 (i18n) 开发代理
|
|
6
2
|
|
|
7
|
-
|
|
3
|
+
> 此 Agent 引导 AI 通过 MCP 工具获取 npm 包中的详细规范
|
|
4
|
+
> 版本: v3.0.0 | 最后更新: 2026-01-16
|
|
8
5
|
|
|
9
|
-
|
|
6
|
+
---
|
|
10
7
|
|
|
11
|
-
##
|
|
8
|
+
## 🔴 问题诊断优先(最高优先级)
|
|
12
9
|
|
|
13
|
-
|
|
10
|
+
**当用户描述任何问题时,必须首先调用:**
|
|
14
11
|
|
|
15
12
|
```
|
|
16
|
-
|
|
13
|
+
troubleshoot({ problem: "用户描述的问题" })
|
|
17
14
|
```
|
|
18
15
|
|
|
19
|
-
|
|
20
|
-
```
|
|
21
|
-
get_relevant_standards({ scenario: "国际化" })
|
|
22
|
-
```
|
|
16
|
+
---
|
|
23
17
|
|
|
24
|
-
##
|
|
18
|
+
## 📚 规范获取指引
|
|
25
19
|
|
|
26
|
-
|
|
27
|
-
2. **键名规范** - 点分层级 (`common.save`)
|
|
28
|
-
3. **参数化** - 动态内容用插值,不拼接
|
|
29
|
-
4. **回退机制** - 提供默认语言
|
|
20
|
+
**⚠️ 核心原则:添加任何用户可见文本前,必须先获取规范!**
|
|
30
21
|
|
|
31
|
-
|
|
22
|
+
### 按框架获取
|
|
32
23
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
<el-table-column :label="$t('user.profile.name')" />
|
|
45
|
-
|
|
46
|
-
<!-- 参数插值 -->
|
|
47
|
-
<p>{{ $t('message.deleteConfirm', { name: userName }) }}</p>
|
|
48
|
-
|
|
49
|
-
<!-- ❌ 坏 -->
|
|
50
|
-
<el-button>保存</el-button>
|
|
51
|
-
</template>
|
|
24
|
+
| 框架 | MCP 调用 |
|
|
25
|
+
|------|----------|
|
|
26
|
+
| Vue + vue-i18n | `get_standard_by_id({ id: 'i18n' })` |
|
|
27
|
+
| Vue 3 组件 | `get_standard_by_id({ id: 'vue3-composition' })` |
|
|
28
|
+
| React | `get_standard_by_id({ id: 'react-i18n' })` |
|
|
29
|
+
|
|
30
|
+
### 智能获取(推荐)
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
// 根据当前文件自动匹配
|
|
34
|
+
get_compact_standards({ currentFile: "xxx.vue", scenario: "国际化" })
|
|
52
35
|
```
|
|
53
36
|
|
|
54
|
-
|
|
37
|
+
---
|
|
55
38
|
|
|
56
|
-
|
|
57
|
-
import { ElMessage } from 'element-plus'
|
|
39
|
+
## 🎯 快速提示
|
|
58
40
|
|
|
59
|
-
|
|
60
|
-
ElMessage.success($t('message.saveSuccess'))
|
|
41
|
+
> 以下是简要提示,**详细规范请通过上述 MCP 工具获取**
|
|
61
42
|
|
|
62
|
-
|
|
63
|
-
ElMessage.warning($t('message.deleteConfirm', { name: user.name }))
|
|
43
|
+
### 必须遵守
|
|
64
44
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
45
|
+
- ✅ 零硬编码 - 所有用户可见文本使用 `$t()`
|
|
46
|
+
- ✅ 键名规范 - 点分层级 (`common.save`)
|
|
47
|
+
- ✅ 参数化 - 动态内容用插值,不拼接
|
|
68
48
|
|
|
69
|
-
|
|
49
|
+
### 禁止
|
|
70
50
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
pending: $t('status.pending'),
|
|
75
|
-
success: $t('status.success'),
|
|
76
|
-
error: $t('status.error')
|
|
77
|
-
}
|
|
51
|
+
- ❌ 硬编码中文/英文
|
|
52
|
+
- ❌ 字符串拼接: `'删除' + name + '吗?'`
|
|
53
|
+
- ❌ 重复的翻译键
|
|
78
54
|
|
|
79
|
-
|
|
80
|
-
{{ { 0: $t('type.input'), 1: $t('type.output') }[row.type] }}
|
|
55
|
+
### 快速示例
|
|
81
56
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
```
|
|
57
|
+
```vue
|
|
58
|
+
<!-- ✅ 正确 -->
|
|
59
|
+
<el-button>{{ $t('common.save') }}</el-button>
|
|
60
|
+
<el-table-column :label="$t('user.name')" />
|
|
88
61
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
```typescript
|
|
92
|
-
const rules = {
|
|
93
|
-
name: [
|
|
94
|
-
{
|
|
95
|
-
required: true,
|
|
96
|
-
message: $t('validation.required', {
|
|
97
|
-
field: $t('user.profile.name')
|
|
98
|
-
}),
|
|
99
|
-
trigger: 'blur'
|
|
100
|
-
}
|
|
101
|
-
]
|
|
102
|
-
}
|
|
62
|
+
<!-- ❌ 错误 -->
|
|
63
|
+
<el-button>保存</el-button>
|
|
103
64
|
```
|
|
104
65
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
```typescript
|
|
108
|
-
const handleDelete = async (row: User) => {
|
|
109
|
-
try {
|
|
110
|
-
await ElMessageBox.confirm(
|
|
111
|
-
$t('message.deleteConfirm', { name: row.name }),
|
|
112
|
-
$t('common.warning'),
|
|
113
|
-
{
|
|
114
|
-
confirmButtonText: $t('common.confirm'),
|
|
115
|
-
cancelButtonText: $t('common.cancel'),
|
|
116
|
-
type: 'warning'
|
|
117
|
-
}
|
|
118
|
-
)
|
|
119
|
-
// 执行删除
|
|
120
|
-
} catch (err) {
|
|
121
|
-
// 用户取消
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
```
|
|
66
|
+
---
|
|
125
67
|
|
|
126
|
-
##
|
|
68
|
+
## 📋 可用规范列表
|
|
127
69
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
-
|
|
131
|
-
-
|
|
70
|
+
通过 `get_standard_by_id({ id: 'xxx' })` 获取:
|
|
71
|
+
|
|
72
|
+
- `i18n` - Vue 国际化完整规范
|
|
73
|
+
- `vue3-composition` - Vue 3 规范(含 i18n 章节)
|
|
74
|
+
|
|
75
|
+
---
|
|
132
76
|
|
|
133
|
-
|
|
77
|
+
**维护团队**: MTA工作室
|
|
78
|
+
**设计理念**: Agent 只提供获取指引,详细规范由 MCP 工具从 npm 包动态获取
|