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,308 @@
1
+ # 核心代码规范
2
+
3
+ ## 基本原则
4
+
5
+ 1. **代码可读性优先** - 清晰 > 简洁
6
+ 2. **类型安全** - 使用严格的类型系统
7
+ 3. **一致性** - 遵循统一的代码风格
8
+ 4. **可维护性** - 编写易于理解和修改的代码
9
+ 5. **注释充分** - 重要逻辑必须添加注释说明
10
+ 6. **专注代码** - 生成代码时不创建 Markdown 文档
11
+
12
+ ## 命名规范
13
+
14
+ ### 变量命名
15
+ ```typescript
16
+ // ✅ 好 - 使用驼峰命名法
17
+ const userName = 'John'
18
+ const isActive = true
19
+ const itemCount = 10
20
+
21
+ // ❌ 坏
22
+ const user_name = 'John'
23
+ const UserName = 'John'
24
+ ```
25
+
26
+ ### 常量命名
27
+ ```typescript
28
+ // ✅ 好 - 使用大写字母和下划线
29
+ const MAX_RETRY_COUNT = 3
30
+ const API_BASE_URL = 'https://api.example.com'
31
+
32
+ // ❌ 坏
33
+ const maxRetryCount = 3
34
+ ```
35
+
36
+ ### 函数命名
37
+ ```typescript
38
+ // ✅ 好 - 使用动词开头
39
+ function getUserData() { }
40
+ function validateForm() { }
41
+ function handleClick() { }
42
+
43
+ // ❌ 坏
44
+ function user() { }
45
+ function data() { }
46
+ ```
47
+
48
+ ### 类/接口命名
49
+ ```typescript
50
+ // ✅ 好 - 使用 PascalCase
51
+ interface UserProfile { }
52
+ class DataService { }
53
+ type StatusType = 'pending' | 'success'
54
+
55
+ // ❌ 坏
56
+ interface userProfile { }
57
+ class dataService { }
58
+ ```
59
+
60
+ ## 代码组织
61
+
62
+ ### 导入顺序
63
+ ```typescript
64
+ // 1. Node 内置模块
65
+ import * as path from 'path'
66
+
67
+ // 2. 第三方库
68
+ import { ref, computed } from 'vue'
69
+ import { defineStore } from 'pinia'
70
+
71
+ // 3. 项目内部模块
72
+ import { useUserStore } from '@/stores/user'
73
+ import MyComponent from '@/components/MyComponent.vue'
74
+
75
+ // 4. 类型导入(分组)
76
+ import type { User, Profile } from '@/types'
77
+ ```
78
+
79
+ ### 文件结构
80
+ ```typescript
81
+ // 1. 类型定义
82
+ interface Props { }
83
+ interface Emits { }
84
+
85
+ // 2. 常量
86
+ const DEFAULT_PAGE_SIZE = 10
87
+
88
+ // 3. 状态
89
+ const isLoading = ref(false)
90
+
91
+ // 4. 计算属性
92
+ const filteredData = computed(() => {})
93
+
94
+ // 5. 方法
95
+ function handleSubmit() {}
96
+
97
+ // 6. 生命周期
98
+ onMounted(() => {})
99
+ ```
100
+
101
+ ## 注释规范
102
+
103
+ ### 核心要求(v1.3.0 强制规则)
104
+
105
+ 1. **重要代码必须注释** - 复杂逻辑、算法、业务规则需要清晰说明
106
+ 2. **去 AI 化** - 避免使用表情符号、过度热情的语气
107
+ 3. **专业简洁** - 使用平实的技术语言,避免口语化表达
108
+ 4. **⚠️ 单行注释使用 `//`** - TypeScript/JavaScript 中,单行注释必须使用 `//`,不使用 `/** */`
109
+ 5. **注释内容有意义** - 说明为什么而非做什么,避免废话注释
110
+
111
+ ### 注释格式规范
112
+
113
+ ```typescript
114
+ // ✅ 正确:单行注释使用 //
115
+ // 使用二分查找提高性能
116
+ function binarySearch() {}
117
+
118
+ // ✅ 正确:多行注释使用 /** */
119
+ /**
120
+ * 获取用户信息
121
+ * @param userId 用户ID
122
+ * @returns 用户信息对象
123
+ */
124
+ function getUserInfo(userId: number) {}
125
+
126
+ // ❌ 错误:单行注释不要使用 /** */
127
+ /** 使用二分查找提高性能 */
128
+ function binarySearch() {}
129
+
130
+ // ❌ 错误:无意义的注释
131
+ // 创建变量
132
+ const count = 0
133
+ ```
134
+
135
+ ### 好的注释风格
136
+
137
+ ```typescript
138
+ // 使用二分查找提高性能
139
+ function binarySearch(arr: number[], target: number): number {
140
+ let left = 0
141
+ let right = arr.length - 1
142
+
143
+ // 当搜索范围有效时继续查找
144
+ while (left <= right) {
145
+ const mid = Math.floor((left + right) / 2)
146
+
147
+ if (arr[mid] === target) {
148
+ return mid
149
+ } else if (arr[mid] < target) {
150
+ left = mid + 1
151
+ } else {
152
+ right = mid - 1
153
+ }
154
+ }
155
+
156
+ return -1
157
+ }
158
+
159
+ // 缓存计算结果避免重复请求
160
+ const memoizedFetch = (() => {
161
+ const cache = new Map()
162
+
163
+ return async (url: string) => {
164
+ if (cache.has(url)) {
165
+ return cache.get(url)
166
+ }
167
+
168
+ const data = await fetch(url).then(r => r.json())
169
+ cache.set(url, data)
170
+ return data
171
+ }
172
+ })()
173
+ ```
174
+
175
+ ### 避免的注释风格
176
+
177
+ ```typescript
178
+ // ❌ 不自然 - 使用表情符号
179
+ // 🎉 太棒了!这个函数超级好用!
180
+ // ✨ 神奇的算法来啦~
181
+
182
+ // ❌ 过度热情
183
+ // 哇!这里使用了超酷的技巧!
184
+ // 注意啦!这里很重要哦~
185
+
186
+ // ❌ 只重复代码
187
+ // 创建用户
188
+ function createUser() {}
189
+
190
+ // ❌ 废话连篇
191
+ // 这个函数非常非常重要,请一定要仔细阅读
192
+ // 它做了很多很多事情,真的很厉害
193
+ ```
194
+
195
+ ### 正确的注释示例
196
+
197
+ ```typescript
198
+ // 正确:说明为什么,而非做什么
199
+ // 使用 Set 去重,避免 O(n²) 复杂度
200
+ const uniqueIds = [...new Set(ids)]
201
+
202
+ // 正确:说明业务规则
203
+ // 管理员用户跳过权限检查
204
+ if (user.role === 'admin') {
205
+ return true
206
+ }
207
+
208
+ // 正确:说明技术决策
209
+ // 使用 WeakMap 避免内存泄漏
210
+ const cache = new WeakMap()
211
+
212
+ // 正确:警告潜在问题
213
+ // 注意:此方法会修改原数组
214
+ function sortInPlace(arr: number[]) {
215
+ return arr.sort((a, b) => a - b)
216
+ }
217
+ ```
218
+
219
+ ### 函数注释
220
+ ```typescript
221
+ /**
222
+ * 获取用户信息
223
+ * @param userId 用户ID
224
+ * @returns 用户信息对象,如果不存在返回 null
225
+ */
226
+ function getUserInfo(userId: number): User | null {
227
+ // 实现逻辑...
228
+ }
229
+
230
+ // 对于简单函数,单行注释即可
231
+ // 验证邮箱格式
232
+ function isValidEmail(email: string): boolean {
233
+ return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)
234
+ }
235
+ ```
236
+
237
+ ## 文档创建规范(v1.3.0 强制规则)
238
+
239
+ ### ⚠️ 禁止行为
240
+
241
+ **生成代码时不要创建 Markdown 文档**
242
+
243
+ ```typescript
244
+ // ❌ 错误:自动创建额外的文档文件
245
+ // 不要生成:USAGE.md, GUIDE.md, CHANGES.md, NOTES.md 等
246
+
247
+ // ✅ 正确:在代码中添加充分的注释
248
+ /**
249
+ * UserService 类
250
+ *
251
+ * 提供用户相关的业务逻辑处理
252
+ * 包括用户注册、登录、信息更新等功能
253
+ */
254
+ class UserService {
255
+ // 实现...
256
+ }
257
+ ```
258
+
259
+ ### 何时可以创建文档
260
+
261
+ **仅在以下情况创建文档:**
262
+ 1. ✅ 用户明确要求创建说明文档、配置文档等
263
+ 2. ✅ 项目初始化需要 README.md
264
+ 3. ✅ 修改现有文档文件
265
+ 4. ✅ 用户明确说"生成文档"、"创建说明"等
266
+
267
+ **默认行为:**
268
+ - ❌ 不要主动创建文档
269
+ - ✅ 在代码中添加详细注释说明
270
+ - ✅ 使用 JSDoc 或 TypeDoc 格式的注释
271
+
272
+ ### 复杂逻辑注释
273
+
274
+ ```typescript
275
+ // 使用 Set 去重,提高性能(避免 O(n²) 复杂度)
276
+ const uniqueIds = [...new Set(ids)]
277
+
278
+ // ❌ 坏 - 只是重复代码
279
+ // 创建 Set 去重
280
+ const uniqueIds = [...new Set(ids)]
281
+ ```
282
+
283
+ ## 错误处理
284
+
285
+ ```typescript
286
+ // ✅ 好 - 明确的错误处理
287
+ try {
288
+ const data = await fetchData()
289
+ return data
290
+ } catch (error) {
291
+ console.error('Failed to fetch data:', error)
292
+ throw new Error(`Data fetch failed: ${error.message}`)
293
+ }
294
+
295
+ // ❌ 坏 - 吞掉错误
296
+ try {
297
+ const data = await fetchData()
298
+ } catch (error) {
299
+ // 什么都不做
300
+ }
301
+ ```
302
+
303
+ ## 性能优化原则
304
+
305
+ 1. **避免不必要的计算** - 使用 computed 缓存
306
+ 2. **按需加载** - 使用动态导入
307
+ 3. **防抖节流** - 高频事件使用防抖/节流
308
+ 4. **列表渲染** - 使用 key 优化