mta-mcp 2.17.0 → 3.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.
- package/agents/flutter.agent.md +23 -64
- package/agents/mta.agent.md +226 -0
- package/agents/vue3.agent.md +24 -0
- package/agents/wechat-miniprogram.agent.md +23 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -4
- package/standards/mcp-tools/sketch-mcp.md +497 -0
- package/standards/patterns/design-system-restoration.md +570 -0
- package/standards/syntax-mapping.md +256 -0
- package/standards/workflows/design-restoration.md +401 -0
- package/templates/README.md +14 -0
- package/templates/design-measurement/README.md +81 -0
- package/templates/design-measurement/component-measurement.js +52 -0
- package/templates/design-measurement/gap-measurement.js +79 -0
- package/templates/design-measurement/style-extraction.js +109 -0
- package/common/i18n.md +0 -385
- package/common/typescript-strict.md +0 -186
- package/troubleshooting/README.md +0 -368
- package/troubleshooting/USAGE_GUIDE.md +0 -289
- package/troubleshooting/flutter/clip-/351/230/264/345/275/261/350/243/201/345/211/252.md +0 -244
- package/troubleshooting/flutter/input-/345/255/227/346/256/265/347/274/272/345/244/261.md +0 -240
- package/troubleshooting/flutter/input-/350/276/271/346/241/206/351/227/256/351/242/230.md +0 -236
- package/troubleshooting/flutter/layout-/345/260/272/345/257/270/344/270/215/345/214/271/351/205/215.md +0 -214
- package/troubleshooting/flutter/shadow-/351/200/217/345/207/272/351/227/256/351/242/230.md +0 -172
- package/troubleshooting/flutter/sketch-/345/210/227/350/241/250item/345/214/272/345/237/237.md +0 -212
- package/troubleshooting/flutter/sketch-/345/233/276/346/240/207/345/260/272/345/257/270.md +0 -135
- package/troubleshooting/flutter/sketch-/345/256/214/346/225/264/346/217/220/345/217/226.md +0 -201
- package/troubleshooting/flutter/sketch-/345/261/236/346/200/247/346/234/252/344/275/277/347/224/250.md +0 -139
- package/troubleshooting/flutter/sketch-/350/203/214/346/231/257/345/261/202/351/253/230/345/272/246.md +0 -264
- package/troubleshooting/flutter/svg-/346/234/252/345/261/205/344/270/255.md +0 -120
- package/troubleshooting/flutter/svg-/351/242/234/350/211/262/345/274/202/345/270/270.md +0 -117
- package/troubleshooting/flutter/tabbar-/345/212/250/347/224/273/345/220/214/346/255/245.md +0 -107
- package/troubleshooting/flutter/withopacity-/345/274/203/347/224/250.md +0 -81
- package/troubleshooting/vue3/cascader-/350/257/257/346/233/277/346/215/242.md +0 -130
- package/troubleshooting/vue3/drawer-input-/346/240/267/345/274/217.md +0 -181
- package/troubleshooting/vue3/table-/347/274/226/350/276/221/345/217/226/346/266/210.md +0 -148
- package/troubleshooting/vue3/table-/350/276/271/346/241/206/351/227/256/351/242/230.md +0 -178
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
# TypeScript 严格模式指南
|
|
2
|
-
|
|
3
|
-
适用于所有需要高质量类型安全的 TypeScript 项目
|
|
4
|
-
|
|
5
|
-
## 🎯 核心原则
|
|
6
|
-
|
|
7
|
-
1. **零 any**: 绝不使用 `any` 类型,使用 `unknown` 或具体类型
|
|
8
|
-
2. **严格空检查**: 启用 `strictNullChecks`,明确处理 `null`/`undefined`
|
|
9
|
-
3. **完整类型定义**: 所有函数参数、返回值、变量都有明确类型
|
|
10
|
-
4. **类型推断优先**: 让 TypeScript 推断简单类型,复杂类型显式声明
|
|
11
|
-
|
|
12
|
-
## 📝 tsconfig.json 配置
|
|
13
|
-
|
|
14
|
-
```json
|
|
15
|
-
{
|
|
16
|
-
"compilerOptions": {
|
|
17
|
-
"strict": true,
|
|
18
|
-
"noImplicitAny": true,
|
|
19
|
-
"strictNullChecks": true,
|
|
20
|
-
"strictFunctionTypes": true,
|
|
21
|
-
"strictBindCallApply": true,
|
|
22
|
-
"strictPropertyInitialization": true,
|
|
23
|
-
"noImplicitThis": true,
|
|
24
|
-
"alwaysStrict": true,
|
|
25
|
-
"noUnusedLocals": true,
|
|
26
|
-
"noUnusedParameters": true,
|
|
27
|
-
"noImplicitReturns": true,
|
|
28
|
-
"noFallthroughCasesInSwitch": true
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## ✅ 最佳实践
|
|
34
|
-
|
|
35
|
-
### 类型定义
|
|
36
|
-
```typescript
|
|
37
|
-
// ✅ 好
|
|
38
|
-
interface User {
|
|
39
|
-
id: number
|
|
40
|
-
name: string
|
|
41
|
-
email?: string // 可选属性
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function getUser(id: number): Promise<User | null> {
|
|
45
|
-
// ...
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// ❌ 坏
|
|
49
|
-
function getUser(id: any): any {
|
|
50
|
-
// ...
|
|
51
|
-
}
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
### 空值处理
|
|
55
|
-
```typescript
|
|
56
|
-
// ✅ 好
|
|
57
|
-
const user: User | null = await getUser(1)
|
|
58
|
-
if (user) {
|
|
59
|
-
console.log(user.name)
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// 或使用可选链
|
|
63
|
-
console.log(user?.name)
|
|
64
|
-
|
|
65
|
-
// ❌ 坏
|
|
66
|
-
const user = await getUser(1)
|
|
67
|
-
console.log(user.name) // 可能报错
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
### 联合类型
|
|
71
|
-
```typescript
|
|
72
|
-
// ✅ 好
|
|
73
|
-
type Status = 'pending' | 'success' | 'error'
|
|
74
|
-
|
|
75
|
-
function handleStatus(status: Status) {
|
|
76
|
-
switch (status) {
|
|
77
|
-
case 'pending': return 'Loading...'
|
|
78
|
-
case 'success': return 'Done!'
|
|
79
|
-
case 'error': return 'Failed!'
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// ❌ 坏
|
|
84
|
-
function handleStatus(status: string) {
|
|
85
|
-
// 失去类型约束
|
|
86
|
-
}
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
### 泛型使用
|
|
90
|
-
```typescript
|
|
91
|
-
// ✅ 好
|
|
92
|
-
function fetchData<T>(url: string): Promise<T> {
|
|
93
|
-
return fetch(url).then(res => res.json())
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
interface Product {
|
|
97
|
-
id: number
|
|
98
|
-
name: string
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
const products = await fetchData<Product[]>('/api/products')
|
|
102
|
-
|
|
103
|
-
// ❌ 坏
|
|
104
|
-
function fetchData(url: string): Promise<any> {
|
|
105
|
-
return fetch(url).then(res => res.json())
|
|
106
|
-
}
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
## ⚠️ 禁止模式
|
|
110
|
-
|
|
111
|
-
- ❌ `any` 类型
|
|
112
|
-
- ❌ 类型断言 `as any`
|
|
113
|
-
- ❌ `@ts-ignore` / `@ts-nocheck`
|
|
114
|
-
- ❌ 隐式 any (`noImplicitAny: false`)
|
|
115
|
-
- ❌ 非空断言 `!` (除非确定安全)
|
|
116
|
-
|
|
117
|
-
## 📋 代码审查清单
|
|
118
|
-
|
|
119
|
-
- [ ] 所有函数有明确的参数类型和返回值类型
|
|
120
|
-
- [ ] 没有使用 `any` 类型
|
|
121
|
-
- [ ] 正确处理可能为 `null`/`undefined` 的值
|
|
122
|
-
- [ ] 使用联合类型而非宽泛的 `string`/`number`
|
|
123
|
-
- [ ] 复杂对象有接口定义
|
|
124
|
-
- [ ] 泛型使用恰当
|
|
125
|
-
|
|
126
|
-
## 🔧 常见场景
|
|
127
|
-
|
|
128
|
-
### API 响应处理
|
|
129
|
-
```typescript
|
|
130
|
-
interface ApiResponse<T> {
|
|
131
|
-
success: boolean
|
|
132
|
-
data?: T
|
|
133
|
-
error?: string
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
async function callApi<T>(endpoint: string): Promise<ApiResponse<T>> {
|
|
137
|
-
try {
|
|
138
|
-
const response = await fetch(endpoint)
|
|
139
|
-
const data = await response.json()
|
|
140
|
-
return { success: true, data }
|
|
141
|
-
} catch (error) {
|
|
142
|
-
return {
|
|
143
|
-
success: false,
|
|
144
|
-
error: error instanceof Error ? error.message : 'Unknown error'
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
### 类型守卫
|
|
151
|
-
```typescript
|
|
152
|
-
function isUser(obj: unknown): obj is User {
|
|
153
|
-
return (
|
|
154
|
-
typeof obj === 'object' &&
|
|
155
|
-
obj !== null &&
|
|
156
|
-
'id' in obj &&
|
|
157
|
-
'name' in obj
|
|
158
|
-
)
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
const data: unknown = await fetchData()
|
|
162
|
-
if (isUser(data)) {
|
|
163
|
-
console.log(data.name) // TypeScript 知道 data 是 User
|
|
164
|
-
}
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
---
|
|
168
|
-
|
|
169
|
-
## ⚠️ 重要:配置文件管理
|
|
170
|
-
|
|
171
|
-
### Copilot 配置 .gitignore
|
|
172
|
-
|
|
173
|
-
**推荐做法:**将自动生成的 `.github/copilot-instructions.md` 添加到 `.gitignore`
|
|
174
|
-
|
|
175
|
-
```gitignore
|
|
176
|
-
# Copilot 配置(自动生成)
|
|
177
|
-
.github/copilot-instructions.md
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
**适用项目:**
|
|
181
|
-
- TypeScript 应用(React、Vue、Angular)
|
|
182
|
-
- Node.js 后端服务
|
|
183
|
-
- TypeScript 工具库
|
|
184
|
-
- 所有使用 TypeScript 的项目
|
|
185
|
-
|
|
186
|
-
**详细指南**: 参考 [Copilot .gitignore 通用指南](../docs/guides/COPILOT_GITIGNORE_GUIDE.md)
|
|
@@ -1,368 +0,0 @@
|
|
|
1
|
-
# 故障排除案例库
|
|
2
|
-
|
|
3
|
-
> 基于真实项目经验总结的问题解决方案,通过 MCP 工具让 AI 快速获取经验
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## 🎯 定位与职责
|
|
8
|
-
|
|
9
|
-
### Troubleshooting vs Standards
|
|
10
|
-
|
|
11
|
-
| 维度 | Troubleshooting(问题解决) | Standards(编码规范) |
|
|
12
|
-
|------|---------------------------|---------------------|
|
|
13
|
-
| **用途** | 解决具体问题和错误 | 定义编码风格和最佳实践 |
|
|
14
|
-
| **使用时机** | 遇到错误、异常、效果不符 | 编写新功能、参考推荐写法 |
|
|
15
|
-
| **内容** | 完整解决方案 + 错误路线 | 禁止模式 + 推荐写法 |
|
|
16
|
-
| **示例** | "阴影透出问题如何解决" | "如何使用 Token 系统" |
|
|
17
|
-
| **MCP 工具** | `troubleshoot()` | `get_relevant_standards()` |
|
|
18
|
-
|
|
19
|
-
**简单判断**:
|
|
20
|
-
- 有明确的"问题" → **Troubleshooting**
|
|
21
|
-
- 需要"规范"指导 → **Standards**
|
|
22
|
-
|
|
23
|
-
---
|
|
24
|
-
|
|
25
|
-
## 🎯 核心理念
|
|
26
|
-
|
|
27
|
-
**问题是避免不了的,但踩过的坑不应该重复踩!**
|
|
28
|
-
|
|
29
|
-
### 旧流程(低效)
|
|
30
|
-
1. AI 猜测方案 A → 失败 → 2-3 轮对话
|
|
31
|
-
2. AI 猜测方案 B → 失败 → 2-3 轮对话
|
|
32
|
-
3. 用户提示"去 troubleshooting 看看" → 成功
|
|
33
|
-
4. **浪费 6-10 轮对话**
|
|
34
|
-
|
|
35
|
-
### 新流程(高效)
|
|
36
|
-
1. AI 调用 `troubleshoot` 工具 → 直接获得验证方案 → **1 轮解决!**
|
|
37
|
-
|
|
38
|
-
---
|
|
39
|
-
|
|
40
|
-
## 🚀 MCP 工具
|
|
41
|
-
|
|
42
|
-
### `troubleshoot` - 语义化查询(推荐 ⭐)
|
|
43
|
-
|
|
44
|
-
直接传入问题描述,系统自动识别框架和提取关键词:
|
|
45
|
-
|
|
46
|
-
```typescript
|
|
47
|
-
// AI 直接传入用户描述
|
|
48
|
-
troubleshoot({
|
|
49
|
-
problem: "Flutter 新拟态阴影透出来了,容器比设计稿暗"
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
// 系统自动:
|
|
53
|
-
// 1. 检测框架 → Flutter
|
|
54
|
-
// 2. 提取关键词 → [shadow, 阴影, 新拟态, neumorphism]
|
|
55
|
-
// 3. 搜索匹配案例
|
|
56
|
-
// 4. 返回排序后的结果(包含预览摘要和应避免的错误路线)
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
**返回示例**:
|
|
60
|
-
```json
|
|
61
|
-
{
|
|
62
|
-
"detectedFramework": "flutter",
|
|
63
|
-
"extractedKeywords": ["shadow", "阴影", "新拟态"],
|
|
64
|
-
"cases": [
|
|
65
|
-
{
|
|
66
|
-
"caseId": "shadow-透出问题",
|
|
67
|
-
"title": "Flutter 阴影透出问题",
|
|
68
|
-
"score": 70,
|
|
69
|
-
"preview": "根本原因:BoxDecoration 的阴影是画在透明底上...",
|
|
70
|
-
"wrongApproaches": ["降低阴影透明度 → 无效,颜色会变淡"]
|
|
71
|
-
}
|
|
72
|
-
]
|
|
73
|
-
}
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
### `query_troubleshooting_cases` - 精确查询
|
|
77
|
-
|
|
78
|
-
当需要指定框架或关键词时使用:
|
|
79
|
-
|
|
80
|
-
```typescript
|
|
81
|
-
query_troubleshooting_cases({
|
|
82
|
-
framework: "flutter",
|
|
83
|
-
keywords: ["shadow", "transparency"],
|
|
84
|
-
errorMessage: "阴影透出来了"
|
|
85
|
-
})
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
### `get_troubleshooting_case` - 获取完整方案
|
|
89
|
-
|
|
90
|
-
```typescript
|
|
91
|
-
get_troubleshooting_case({
|
|
92
|
-
framework: "flutter",
|
|
93
|
-
caseId: "shadow-透出问题"
|
|
94
|
-
})
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
### `list_troubleshooting_cases` - 列出所有案例
|
|
98
|
-
|
|
99
|
-
```typescript
|
|
100
|
-
list_troubleshooting_cases({ framework: "flutter" })
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
---
|
|
104
|
-
|
|
105
|
-
## 📚 案例清单
|
|
106
|
-
|
|
107
|
-
### Flutter (13 个案例)
|
|
108
|
-
|
|
109
|
-
| 案例ID | 问题类型 | 关键词 |
|
|
110
|
-
|--------|----------|--------|
|
|
111
|
-
| shadow-透出问题 | 阴影透出/容器变暗 | shadow, transparency, neumorphism |
|
|
112
|
-
| clip-阴影裁剪 | 阴影被裁剪 | clip, clipBehavior |
|
|
113
|
-
| layout-尺寸不匹配 | 布局尺寸偏移 | layout, size, spacing |
|
|
114
|
-
| input-边框问题 | 输入框边框异常 | input, border, focus |
|
|
115
|
-
| input-字段缺失 | 组件字段缺失 | property, field |
|
|
116
|
-
| tabbar-动画同步 | TabBar动画不同步 | animation, tabbar, color |
|
|
117
|
-
| svg-颜色异常 | SVG颜色不对 | svg, color, colorfilter |
|
|
118
|
-
| svg-未居中 | SVG未居中 | svg, viewbox, center |
|
|
119
|
-
| sketch-图标尺寸 | 图标尺寸提取错误 | sketch, icon, group, shape |
|
|
120
|
-
| sketch-属性未使用 | 属性定义但未使用 | property, unused |
|
|
121
|
-
| sketch-背景层高度 | Frame与_background高度差异 | sketch, frame, background, height, _bg |
|
|
122
|
-
| sketch-列表item区域 | 列表首尾item高度不一致 | sketch, list, menu, padding, divider |
|
|
123
|
-
| withopacity-弃用 | withOpacity弃用警告 | opacity, deprecated |
|
|
124
|
-
|
|
125
|
-
### Vue3 (1 个案例)
|
|
126
|
-
|
|
127
|
-
| 案例ID | 问题类型 | 关键词 |
|
|
128
|
-
|--------|----------|--------|
|
|
129
|
-
| table-边框问题 | Element Plus表格边框 | table, border, css |
|
|
130
|
-
|
|
131
|
-
---
|
|
132
|
-
|
|
133
|
-
## 📝 案例格式规范
|
|
134
|
-
|
|
135
|
-
每个案例文件需包含以下结构:
|
|
136
|
-
|
|
137
|
-
```markdown
|
|
138
|
-
# {问题标题}
|
|
139
|
-
|
|
140
|
-
> **问题标签**: `tag1`, `tag2`, `tag3`
|
|
141
|
-
> **框架**: Flutter / Vue3 / React
|
|
142
|
-
> **严重程度**: 低/中等/高
|
|
143
|
-
|
|
144
|
-
---
|
|
145
|
-
|
|
146
|
-
## 🔍 问题识别
|
|
147
|
-
|
|
148
|
-
### 用户描述关键词
|
|
149
|
-
- "xxx"
|
|
150
|
-
- "yyy"
|
|
151
|
-
|
|
152
|
-
### 问题特征
|
|
153
|
-
- [ ] 特征1
|
|
154
|
-
- [ ] 特征2
|
|
155
|
-
|
|
156
|
-
---
|
|
157
|
-
|
|
158
|
-
## 🎯 核心原理
|
|
159
|
-
|
|
160
|
-
**根本原因**:...
|
|
161
|
-
|
|
162
|
-
---
|
|
163
|
-
|
|
164
|
-
## ✅ 正确解决方案
|
|
165
|
-
|
|
166
|
-
### 方案代码
|
|
167
|
-
\`\`\`dart
|
|
168
|
-
// 正确代码示例
|
|
169
|
-
\`\`\`
|
|
170
|
-
|
|
171
|
-
---
|
|
172
|
-
|
|
173
|
-
## ❌ 常见错误排查路线(避免重复)
|
|
174
|
-
|
|
175
|
-
| 尝试方向 | 为什么无效 | 浪费时间 |
|
|
176
|
-
|----------|-----------|---------|
|
|
177
|
-
| xxx | xxx | 1-2 轮 |
|
|
178
|
-
|
|
179
|
-
---
|
|
180
|
-
|
|
181
|
-
## 📁 适用场景
|
|
182
|
-
|
|
183
|
-
- ✅ 场景1
|
|
184
|
-
- ✅ 场景2
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
---
|
|
188
|
-
|
|
189
|
-
## 🔧 添加新案例
|
|
190
|
-
|
|
191
|
-
1. 在对应框架目录创建 `.md` 文件(如 `flutter/新问题.md`)
|
|
192
|
-
2. 按照上述格式编写内容
|
|
193
|
-
3. 确保包含 `问题标签` 行(用于匹配)
|
|
194
|
-
4. 运行 `npm run build` 重新构建
|
|
195
|
-
5. 测试查询是否能正确匹配
|
|
196
|
-
|
|
197
|
-
---
|
|
198
|
-
|
|
199
|
-
**版本**: v2.15.0
|
|
200
|
-
**案例总数**: 14 个
|
|
201
|
-
**最后更新**: 2026-01-19
|
|
202
|
-
|
|
203
|
-
---
|
|
204
|
-
|
|
205
|
-
## 📖 Agent 工作流程
|
|
206
|
-
|
|
207
|
-
Agent(如 flutter.agent.md、vue3.agent.md)被精简为引导文档,核心职责:
|
|
208
|
-
|
|
209
|
-
1. **检测问题** - 识别用户描述的是问题还是功能需求
|
|
210
|
-
2. **调用 troubleshoot** - 如果是问题,先查询案例库
|
|
211
|
-
3. **应用方案** - 使用验证过的解决方案
|
|
212
|
-
4. **加载规范** - 如果是新功能,加载编码规范
|
|
213
|
-
|
|
214
|
-
**Agent 精简效果**:
|
|
215
|
-
- flutter.agent.md: 1240 行 → 195 行(**-84%**)
|
|
216
|
-
- vue3.agent.md: 591 行 → 285 行(**-52%**)
|
|
217
|
-
|
|
218
|
-
详细方案和代码示例都迁移到了 troubleshooting 案例中。
|
|
219
|
-
|
|
220
|
-
---
|
|
221
|
-
|
|
222
|
-
## 📚 当前可用案例
|
|
223
|
-
|
|
224
|
-
### Flutter
|
|
225
|
-
|
|
226
|
-
| 案例 | 问题类型 | 关键词 | 节省时间 | 状态 |
|
|
227
|
-
|------|---------|--------|---------|------|
|
|
228
|
-
| [shadow-透出问题](./flutter/shadow-透出问题.md) | UI渲染 | shadow, neumorphism, transparency | 6-10轮 | ✅ |
|
|
229
|
-
| [layout-尺寸不匹配](./flutter/layout-尺寸不匹配.md) | 布局偏差 | layout, sizing, design-spec | 4-7轮 | ✅ |
|
|
230
|
-
| [input-字段缺失](./flutter/input-字段缺失.md) | 组件配置 | component, props, missing-field | 2-4轮 | ✅ |
|
|
231
|
-
| [clip-阴影裁剪](./flutter/clip-阴影裁剪.md) | 布局裁剪 | clip, shadow, overflow | 7-11轮 | ✅ |
|
|
232
|
-
| [input-边框问题](./flutter/input-边框问题.md) | 主题冲突 | textfield, border, focus | 6-9轮 | ✅ |
|
|
233
|
-
|
|
234
|
-
**总计**: 5 个案例,节省 25-41 轮对话
|
|
235
|
-
|
|
236
|
-
### Vue 3 + Element Plus
|
|
237
|
-
|
|
238
|
-
| 案例 | 问题类型 | 关键词 | 节省时间 | 状态 |
|
|
239
|
-
|------|---------|--------|---------|------|
|
|
240
|
-
| [table-边框问题](./vue3/table-边框问题.md) | 样式冲突 | table, border, css-conflict | 6-10轮 | ✅ |
|
|
241
|
-
|
|
242
|
-
**总计**: 1 个案例
|
|
243
|
-
|
|
244
|
-
---
|
|
245
|
-
|
|
246
|
-
## 🎯 匹配算法优化(v2.13.0)
|
|
247
|
-
|
|
248
|
-
### 评分维度(总分100+)
|
|
249
|
-
|
|
250
|
-
1. **标签匹配** (40分) - 关键词出现在案例标签中
|
|
251
|
-
2. **标题匹配** (30分) - 关键词出现在案例标题中
|
|
252
|
-
3. **问题类型匹配** (15分) - 关键词与问题分类相关
|
|
253
|
-
4. **错误信息匹配** (30分) - 用户描述与案例内容相似度
|
|
254
|
-
5. **精确标签奖励** (+15分/个) - 关键词与标签完全一致
|
|
255
|
-
|
|
256
|
-
### 智能过滤阈值
|
|
257
|
-
|
|
258
|
-
- **基础**: 分数≥10
|
|
259
|
-
- **有错误信息**: 分数≥5(更宽松)
|
|
260
|
-
- **关键词≥3个**: 分数≥15(更严格)
|
|
261
|
-
|
|
262
|
-
### 预览优化
|
|
263
|
-
|
|
264
|
-
优先级顺序:
|
|
265
|
-
1. "核心原理"章节
|
|
266
|
-
2. "问题原因"章节
|
|
267
|
-
3. "问题识别"章节
|
|
268
|
-
4. 文档开头非空内容
|
|
269
|
-
|
|
270
|
-
---
|
|
271
|
-
|
|
272
|
-
## ✍️ 贡献案例
|
|
273
|
-
|
|
274
|
-
### 案例格式规范
|
|
275
|
-
|
|
276
|
-
每个案例文件应包含:
|
|
277
|
-
|
|
278
|
-
```markdown
|
|
279
|
-
# 问题标题
|
|
280
|
-
|
|
281
|
-
> **问题标签**: `tag1`, `tag2`
|
|
282
|
-
> **框架**: Flutter/Vue3/React
|
|
283
|
-
> **严重程度**: 低/中/高
|
|
284
|
-
|
|
285
|
-
## 🔍 问题识别
|
|
286
|
-
- 自动检测特征(代码模式)
|
|
287
|
-
- 用户描述关键词
|
|
288
|
-
- 问题特征 checklist
|
|
289
|
-
|
|
290
|
-
## ❌ 常见错误排查路线
|
|
291
|
-
- 列出无效的尝试方向
|
|
292
|
-
- 说明为什么无效
|
|
293
|
-
- 估算浪费的时间
|
|
294
|
-
|
|
295
|
-
## ✅ 正确解决方案
|
|
296
|
-
- 核心原理
|
|
297
|
-
- 完整代码
|
|
298
|
-
- 使用示例
|
|
299
|
-
|
|
300
|
-
## 📋 适用场景
|
|
301
|
-
## 🔗 相关案例
|
|
302
|
-
```
|
|
303
|
-
|
|
304
|
-
### 提交流程
|
|
305
|
-
|
|
306
|
-
1. 在项目中遇到需要多轮对话才解决的问题
|
|
307
|
-
2. 整理问题特征、错误路线、正确方案
|
|
308
|
-
3. 按照格式创建 Markdown 文件
|
|
309
|
-
4. 提交到对应框架目录
|
|
310
|
-
|
|
311
|
-
---
|
|
312
|
-
|
|
313
|
-
## 🤖 技术实现
|
|
314
|
-
|
|
315
|
-
### MCP 工具定义
|
|
316
|
-
|
|
317
|
-
```typescript
|
|
318
|
-
{
|
|
319
|
-
name: 'query_troubleshooting_cases',
|
|
320
|
-
description: '根据问题特征查询相关的故障排除案例',
|
|
321
|
-
inputSchema: {
|
|
322
|
-
type: 'object',
|
|
323
|
-
properties: {
|
|
324
|
-
framework: {
|
|
325
|
-
type: 'string',
|
|
326
|
-
enum: ['flutter', 'vue3', 'react', 'common']
|
|
327
|
-
},
|
|
328
|
-
keywords: {
|
|
329
|
-
type: 'array',
|
|
330
|
-
items: { type: 'string' },
|
|
331
|
-
description: '问题关键词,如 shadow, layout, i18n'
|
|
332
|
-
},
|
|
333
|
-
errorMessage: {
|
|
334
|
-
type: 'string',
|
|
335
|
-
description: '错误信息或用户描述'
|
|
336
|
-
},
|
|
337
|
-
codePattern: {
|
|
338
|
-
type: 'string',
|
|
339
|
-
description: '问题代码片段'
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
```
|
|
345
|
-
|
|
346
|
-
### 匹配算法
|
|
347
|
-
|
|
348
|
-
1. **关键词匹配** - 计算用户输入与案例标签的重合度
|
|
349
|
-
2. **错误信息匹配** - 搜索案例中的错误特征
|
|
350
|
-
3. **代码模式匹配** - 使用正则匹配已知问题代码
|
|
351
|
-
4. **相关性排序** - 按匹配度返回最相关的 3-5 个案例
|
|
352
|
-
|
|
353
|
-
---
|
|
354
|
-
|
|
355
|
-
## 📊 效果统计
|
|
356
|
-
|
|
357
|
-
通过引入故障排除案例库,预计可以:
|
|
358
|
-
|
|
359
|
-
- **减少对话轮数**: 平均每个问题减少 4-6 轮
|
|
360
|
-
- **提高解决率**: 首次建议成功率从 30% → 70%
|
|
361
|
-
- **知识复用**: 避免重复踩坑
|
|
362
|
-
- **降低 Token 消耗**: 精准推荐减少无效尝试
|
|
363
|
-
|
|
364
|
-
---
|
|
365
|
-
|
|
366
|
-
**维护者**: MTA工作室
|
|
367
|
-
**创建日期**: 2026-01-16
|
|
368
|
-
**版本**: v1.0
|