mcp-probe-kit 3.2.0 → 3.3.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 (104) hide show
  1. package/README.md +10 -0
  2. package/build/lib/__tests__/memory-orchestration.unit.test.js +88 -0
  3. package/build/lib/__tests__/memory-payload.unit.test.js +35 -0
  4. package/build/lib/__tests__/quality-constraints.unit.test.d.ts +1 -0
  5. package/build/lib/__tests__/quality-constraints.unit.test.js +54 -0
  6. package/build/lib/__tests__/spec-validator.unit.test.js +106 -74
  7. package/build/lib/agents-md-template.js +32 -32
  8. package/build/lib/cursor-history-client.d.ts +54 -0
  9. package/build/lib/cursor-history-client.js +240 -0
  10. package/build/lib/quality-constraints.d.ts +54 -0
  11. package/build/lib/quality-constraints.js +155 -0
  12. package/build/lib/skill-bridge.js +12 -12
  13. package/build/lib/spec-validator.js +16 -3
  14. package/build/lib/template-loader.js +83 -23
  15. package/build/resources/ui-ux-data/guidelines/vercel-web-interface.json +1632 -1632
  16. package/build/resources/ui-ux-data/metadata.json +30 -30
  17. package/build/resources/ui-ux-data/shadcn/blocks.json +2541 -2541
  18. package/build/resources/ui-ux-data/shadcn/components.json +997 -997
  19. package/build/resources/ui-ux-data/themes/presets.json +483 -483
  20. package/build/tools/__tests__/cursor-history.unit.test.d.ts +1 -0
  21. package/build/tools/__tests__/cursor-history.unit.test.js +38 -0
  22. package/build/tools/check_spec.js +16 -16
  23. package/build/tools/code_insight.js +41 -41
  24. package/build/tools/code_review.js +11 -4
  25. package/build/tools/cursor_read_conversation.d.ts +7 -0
  26. package/build/tools/cursor_read_conversation.js +36 -0
  27. package/build/tools/fix_bug.js +161 -161
  28. package/build/tools/gencommit.js +60 -60
  29. package/build/tools/init_project_context.js +432 -432
  30. package/build/tools/start_product.js +1 -1
  31. package/build/tools/start_ui.js +17 -0
  32. package/build/tools/ui-ux-tools.d.ts +3 -0
  33. package/build/tools/ui-ux-tools.js +302 -290
  34. package/build/utils/__tests__/vercel-guidelines-sync.unit.test.js +12 -12
  35. package/build/utils/design-reasoning-engine.d.ts +2 -0
  36. package/build/utils/design-reasoning-engine.js +3 -0
  37. package/build/utils/themes-sync.js +8 -8
  38. package/package.json +3 -2
  39. package/build/resources/index.d.ts +0 -4
  40. package/build/resources/index.js +0 -4
  41. package/build/resources/tool-params-guide.d.ts +0 -571
  42. package/build/resources/tool-params-guide.js +0 -488
  43. package/build/tools/analyze_project.d.ts +0 -1
  44. package/build/tools/analyze_project.js +0 -527
  45. package/build/tools/check_deps.d.ts +0 -13
  46. package/build/tools/check_deps.js +0 -204
  47. package/build/tools/convert.d.ts +0 -13
  48. package/build/tools/convert.js +0 -599
  49. package/build/tools/css_order.d.ts +0 -13
  50. package/build/tools/css_order.js +0 -81
  51. package/build/tools/debug.d.ts +0 -13
  52. package/build/tools/debug.js +0 -131
  53. package/build/tools/design2code.d.ts +0 -20
  54. package/build/tools/design2code.js +0 -426
  55. package/build/tools/detect_shell.d.ts +0 -6
  56. package/build/tools/detect_shell.js +0 -151
  57. package/build/tools/explain.d.ts +0 -13
  58. package/build/tools/explain.js +0 -390
  59. package/build/tools/fix.d.ts +0 -13
  60. package/build/tools/fix.js +0 -303
  61. package/build/tools/gen_mock.d.ts +0 -22
  62. package/build/tools/gen_mock.js +0 -269
  63. package/build/tools/gen_skill.d.ts +0 -13
  64. package/build/tools/gen_skill.js +0 -560
  65. package/build/tools/genapi.d.ts +0 -13
  66. package/build/tools/genapi.js +0 -174
  67. package/build/tools/genchangelog.d.ts +0 -13
  68. package/build/tools/genchangelog.js +0 -250
  69. package/build/tools/gendoc.d.ts +0 -13
  70. package/build/tools/gendoc.js +0 -232
  71. package/build/tools/genpr.d.ts +0 -13
  72. package/build/tools/genpr.js +0 -194
  73. package/build/tools/genreadme.d.ts +0 -13
  74. package/build/tools/genreadme.js +0 -626
  75. package/build/tools/gensql.d.ts +0 -13
  76. package/build/tools/gensql.js +0 -320
  77. package/build/tools/genui.d.ts +0 -13
  78. package/build/tools/genui.js +0 -803
  79. package/build/tools/init_component_catalog.d.ts +0 -22
  80. package/build/tools/init_component_catalog.js +0 -809
  81. package/build/tools/init_setting.d.ts +0 -13
  82. package/build/tools/init_setting.js +0 -47
  83. package/build/tools/perf.d.ts +0 -13
  84. package/build/tools/perf.js +0 -409
  85. package/build/tools/render_ui.d.ts +0 -22
  86. package/build/tools/render_ui.js +0 -384
  87. package/build/tools/resolve_conflict.d.ts +0 -13
  88. package/build/tools/resolve_conflict.js +0 -349
  89. package/build/tools/security_scan.d.ts +0 -22
  90. package/build/tools/security_scan.js +0 -323
  91. package/build/tools/split.d.ts +0 -13
  92. package/build/tools/split.js +0 -599
  93. package/build/tools/start_api.d.ts +0 -13
  94. package/build/tools/start_api.js +0 -193
  95. package/build/tools/start_doc.d.ts +0 -13
  96. package/build/tools/start_doc.js +0 -207
  97. package/build/tools/start_refactor.d.ts +0 -13
  98. package/build/tools/start_refactor.js +0 -188
  99. package/build/tools/start_release.d.ts +0 -13
  100. package/build/tools/start_release.js +0 -167
  101. package/build/tools/start_review.d.ts +0 -13
  102. package/build/tools/start_review.js +0 -175
  103. /package/build/{utils/design-docs-generator.d.ts → lib/__tests__/memory-orchestration.unit.test.d.ts} +0 -0
  104. /package/build/{utils/design-docs-generator.js → lib/__tests__/memory-payload.unit.test.d.ts} +0 -0
@@ -1,131 +0,0 @@
1
- import { parseArgs, getString } from "../utils/parseArgs.js";
2
- // debug 工具实现
3
- export async function debug(args) {
4
- try {
5
- const parsedArgs = parseArgs(args, {
6
- defaultValues: {
7
- error: "",
8
- context: "",
9
- },
10
- primaryField: "error", // 纯文本输入默认映射到 error 字段
11
- fieldAliases: {
12
- error: ["err", "exception", "错误", "异常"],
13
- context: ["ctx", "code", "上下文", "代码"],
14
- },
15
- });
16
- const error = getString(parsedArgs.error);
17
- const context = getString(parsedArgs.context);
18
- const message = `请分析以下错误并提供调试策略:
19
-
20
- ❌ **错误信息**:
21
- ${error || "请提供错误信息(错误消息、堆栈跟踪等)"}
22
-
23
- 📋 **上下文**:
24
- ${context || "请提供相关代码或场景描述"}
25
-
26
- ---
27
-
28
- 🔍 **调试分析步骤**:
29
-
30
- **第一步:错误分类**
31
- - 确定错误类型(语法错误、运行时错误、逻辑错误)
32
- - 评估错误严重程度(崩溃、功能异常、性能问题)
33
-
34
- **第二步:问题定位**
35
- 1. 分析错误堆栈,确定出错位置
36
- 2. 识别可能的原因(至少列出 3 个)
37
- 3. 检查相关代码上下文
38
-
39
- **第三步:调试策略**
40
- 按优先级列出调试步骤:
41
- 1. 快速验证:最可能的原因
42
- 2. 添加日志:关键变量和执行路径
43
- 3. 断点调试:问题代码段
44
- 4. 单元测试:隔离问题
45
- 5. 回归测试:确认修复
46
-
47
- **第四步:解决方案**
48
- - 临时方案(Quick Fix)
49
- - 根本方案(Root Cause Fix)
50
- - 预防措施(Prevention)
51
-
52
- **第五步:验证清单**
53
- - [ ] 错误已修复
54
- - [ ] 测试通过
55
- - [ ] 无副作用
56
- - [ ] 添加防御性代码
57
- - [ ] 更新文档
58
-
59
- ---
60
-
61
- 💡 **常见错误模式**:
62
- - NullPointerException → 检查空值处理
63
- - ReferenceError → 检查变量声明和作用域
64
- - TypeError → 检查类型转换和数据结构
65
- - TimeoutError → 检查异步操作和网络请求
66
- - MemoryError → 检查内存泄漏和资源释放
67
-
68
- ---
69
-
70
- ## 📤 输出格式要求
71
-
72
- 请严格按以下 JSON 格式输出分析结果:
73
-
74
- \`\`\`json
75
- {
76
- "error_analysis": {
77
- "type": "错误类型(SyntaxError/TypeError/LogicError等)",
78
- "severity": "critical|high|medium|low",
79
- "root_cause": "根本原因分析"
80
- },
81
- "possible_causes": [
82
- {
83
- "probability": "high|medium|low",
84
- "description": "可能原因描述",
85
- "evidence": "支持证据"
86
- }
87
- ],
88
- "debug_strategy": [
89
- {
90
- "step": 1,
91
- "action": "调试步骤描述",
92
- "expected_result": "预期结果"
93
- }
94
- ],
95
- "solutions": {
96
- "quick_fix": "临时解决方案",
97
- "root_fix": "根本解决方案",
98
- "prevention": "预防措施"
99
- }
100
- }
101
- \`\`\`
102
-
103
- ## ⚠️ 边界约束
104
-
105
- - ❌ 仅分析和建议,不自动修改代码
106
- - ❌ 不执行代码或命令
107
- - ✅ 输出结构化调试策略和解决方案
108
-
109
- 现在请按照上述步骤分析错误并提供具体的调试方案。`;
110
- return {
111
- content: [
112
- {
113
- type: "text",
114
- text: message,
115
- },
116
- ],
117
- };
118
- }
119
- catch (error) {
120
- const errorMessage = error instanceof Error ? error.message : String(error);
121
- return {
122
- content: [
123
- {
124
- type: "text",
125
- text: `❌ 生成调试策略失败: ${errorMessage}`,
126
- },
127
- ],
128
- isError: true,
129
- };
130
- }
131
- }
@@ -1,20 +0,0 @@
1
- export declare function design2code(args: any): Promise<{
2
- content: ({
3
- type: string;
4
- text: string;
5
- data?: undefined;
6
- mimeType?: undefined;
7
- } | {
8
- type: string;
9
- data: string;
10
- mimeType: string;
11
- text?: undefined;
12
- })[];
13
- isError?: undefined;
14
- } | {
15
- content: {
16
- type: string;
17
- text: string;
18
- }[];
19
- isError: boolean;
20
- }>;
@@ -1,426 +0,0 @@
1
- import { parseArgs, getString } from "../utils/parseArgs.js";
2
- /**
3
- * design2code - 设计稿转代码工具
4
- *
5
- * 功能:
6
- * 1. 根据设计稿图片生成页面代码(支持图片 URL 或 base64)
7
- * 2. 根据设计稿描述生成页面代码
8
- * 3. 将 HTML 转换为 Vue/React 组件
9
- * 4. 1:1 还原设计稿布局和样式
10
- */
11
- const PROMPT_TEMPLATE = `# 🎨 设计稿转代码指南
12
-
13
- ## 📋 任务信息
14
-
15
- {task_info}
16
-
17
- ---
18
-
19
- ## 🎯 转换目标
20
-
21
- **目标框架**: {framework}
22
- **样式方案**: {style_solution}
23
- **组件类型**: {component_type}
24
-
25
- ---
26
-
27
- ## 📐 设计还原要求
28
-
29
- ### 1. 布局还原(Layout)
30
- - ✅ 使用 Flexbox/Grid 实现响应式布局
31
- - ✅ 严格按照设计稿的间距、对齐方式
32
- - ✅ 保持元素的相对位置和层级关系
33
- - ✅ 考虑不同屏幕尺寸的适配
34
-
35
- ### 2. 样式还原(Styling)
36
- - ✅ 精确还原颜色值(使用设计稿中的色值)
37
- - ✅ 还原字体大小、行高、字重
38
- - ✅ 还原圆角、阴影、边框等细节
39
- - ✅ 还原动画和过渡效果
40
-
41
- ### 3. 交互还原(Interaction)
42
- - ✅ 实现 hover、active、focus 等状态
43
- - ✅ 添加点击、滚动等交互效果
44
- - ✅ 实现表单验证和反馈
45
- - ✅ 添加加载状态和错误处理
46
-
47
- ### 4. 响应式设计(Responsive)
48
- - ✅ 移动端适配(< 768px)
49
- - ✅ 平板适配(768px - 1024px)
50
- - ✅ 桌面端适配(> 1024px)
51
- - ✅ 使用媒体查询或响应式单位
52
-
53
- ---
54
-
55
- ## 🛠️ 技术实现
56
-
57
- ### React 实现要点
58
- \`\`\`typescript
59
- // 1. 使用 TypeScript 定义 Props
60
- interface ComponentProps {
61
- // 定义属性类型
62
- }
63
-
64
- // 2. 使用 Hooks 管理状态
65
- const [state, setState] = useState()
66
-
67
- // 3. 使用 CSS Modules 或 Tailwind CSS
68
- import styles from './Component.module.css'
69
-
70
- // 4. 组件拆分原则
71
- // - 单一职责
72
- // - 可复用性
73
- // - 性能优化(memo, useMemo, useCallback)
74
- \`\`\`
75
-
76
- ### Vue 3 实现要点
77
- \`\`\`vue
78
- <script setup lang="ts">
79
- // 1. 使用 Composition API
80
- import { ref, computed, onMounted } from 'vue'
81
-
82
- // 2. 定义 Props 和 Emits
83
- interface Props {
84
- // 定义属性类型
85
- }
86
- const props = defineProps<Props>()
87
- const emit = defineEmits<{
88
- // 定义事件类型
89
- }>()
90
-
91
- // 3. 响应式状态管理
92
- const state = ref()
93
-
94
- // 4. 生命周期钩子
95
- onMounted(() => {
96
- // 初始化逻辑
97
- })
98
- </script>
99
-
100
- <template>
101
- <!-- 模板内容 -->
102
- </template>
103
-
104
- <style scoped>
105
- /* 样式内容 */
106
- </style>
107
- \`\`\`
108
-
109
- ---
110
-
111
- ## 🎨 样式方案选择
112
-
113
- ### Tailwind CSS(推荐)
114
- \`\`\`jsx
115
- <div className="flex items-center justify-between p-4 bg-white rounded-lg shadow-md">
116
- <h2 className="text-xl font-bold text-gray-900">标题</h2>
117
- <button className="px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600">
118
- 按钮
119
- </button>
120
- </div>
121
- \`\`\`
122
-
123
- ### CSS Modules
124
- \`\`\`css
125
- .container {
126
- display: flex;
127
- align-items: center;
128
- justify-content: space-between;
129
- padding: 1rem;
130
- background: white;
131
- border-radius: 0.5rem;
132
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
133
- }
134
- \`\`\`
135
-
136
- ### Styled Components
137
- \`\`\`typescript
138
- const Container = styled.div\`
139
- display: flex;
140
- align-items: center;
141
- justify-content: space-between;
142
- padding: 1rem;
143
- background: white;
144
- border-radius: 0.5rem;
145
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
146
- \`;
147
- \`\`\`
148
-
149
- ---
150
-
151
- ## 📦 组件结构
152
-
153
- ### 页面级组件(Page Component)
154
- \`\`\`
155
- src/pages/
156
- ├── HomePage/
157
- │ ├── index.tsx # 页面主文件
158
- │ ├── components/ # 页面专用组件
159
- │ │ ├── Header.tsx
160
- │ │ ├── Hero.tsx
161
- │ │ └── Footer.tsx
162
- │ ├── hooks/ # 页面专用 Hooks
163
- │ │ └── usePageData.ts
164
- │ ├── types.ts # 类型定义
165
- │ └── styles.module.css # 样式文件
166
- \`\`\`
167
-
168
- ### 通用组件(Common Component)
169
- \`\`\`
170
- src/components/
171
- ├── Button/
172
- │ ├── index.tsx
173
- │ ├── Button.test.tsx
174
- │ └── styles.module.css
175
- ├── Input/
176
- └── Card/
177
- \`\`\`
178
-
179
- ---
180
-
181
- ## ✅ 代码质量要求
182
-
183
- ### 1. TypeScript 类型安全
184
- - ✅ 所有 Props 都有类型定义
185
- - ✅ 事件处理函数有类型注解
186
- - ✅ API 响应有类型定义
187
-
188
- ### 2. 可访问性(A11y)
189
- - ✅ 使用语义化 HTML 标签
190
- - ✅ 添加 ARIA 属性
191
- - ✅ 键盘导航支持
192
- - ✅ 屏幕阅读器友好
193
-
194
- ### 3. 性能优化
195
- - ✅ 图片懒加载
196
- - ✅ 代码分割
197
- - ✅ 避免不必要的重渲染
198
- - ✅ 使用虚拟滚动(长列表)
199
-
200
- ### 4. 代码规范
201
- - ✅ 遵循 ESLint 规则
202
- - ✅ 统一的命名规范
203
- - ✅ 添加必要的注释
204
- - ✅ 组件拆分合理
205
-
206
- ---
207
-
208
- ## 📝 输出内容
209
-
210
- 请生成以下内容:
211
-
212
- ### 1. 组件代码
213
- - 完整的组件实现
214
- - TypeScript 类型定义
215
- - 样式文件
216
-
217
- ### 2. 使用示例
218
- - 组件的使用方法
219
- - Props 说明
220
- - 常见场景示例
221
-
222
- ### 3. 注意事项
223
- - 浏览器兼容性
224
- - 性能优化建议
225
- - 可能的改进方向
226
-
227
- ---
228
-
229
- ## 🎯 开始转换
230
-
231
- {conversion_guide}
232
-
233
- ---
234
-
235
- ## ⚠️ 边界约束
236
-
237
- - ❌ 仅输出组件代码,不自动创建文件
238
- - ❌ 不执行代码或命令
239
- - ✅ 默认输出与项目一致的框架与样式方案
240
- - ✅ 1:1 还原设计稿布局和样式
241
-
242
- ---
243
-
244
- *工具: MCP Probe Kit - design2code*
245
- `;
246
- export async function design2code(args) {
247
- try {
248
- // 智能参数解析,支持自然语言输入
249
- const parsedArgs = parseArgs(args, {
250
- defaultValues: {
251
- input: "",
252
- framework: "vue",
253
- style_solution: "tailwind",
254
- component_type: "page",
255
- },
256
- primaryField: "input", // 纯文本输入默认映射到 input 字段
257
- fieldAliases: {
258
- input: ["design", "image", "url", "设计稿", "图片"],
259
- framework: ["lib", "library", "框架", "前端框架"],
260
- style_solution: ["style", "css", "样式", "样式方案"],
261
- component_type: ["type", "kind", "类型", "组件类型"],
262
- },
263
- });
264
- const input = getString(parsedArgs.input);
265
- const framework = getString(parsedArgs.framework) || "vue";
266
- const styleSolution = getString(parsedArgs.style_solution) || "tailwind";
267
- const componentType = getString(parsedArgs.component_type) || "page";
268
- if (!input) {
269
- throw new Error("缺少必填参数: input(设计稿图片 URL/base64、设计稿描述或 HTML 代码)");
270
- }
271
- // 判断输入类型
272
- const isImageUrl = /^https?:\/\/.+\.(jpg|jpeg|png|gif|webp|svg)/i.test(input.trim());
273
- const isBase64Image = /^data:image\/(png|jpeg|jpg|gif|webp|svg);base64,/.test(input.trim());
274
- const isHTML = input.trim().startsWith("<");
275
- let taskInfo = "";
276
- let conversionGuide = "";
277
- if (isImageUrl || isBase64Image) {
278
- // 图片转换模式
279
- const imageType = isImageUrl ? "图片 URL" : "Base64 图片";
280
- taskInfo = `**输入类型**: 设计稿图片\n**图片来源**: ${imageType}\n${isImageUrl ? `**图片地址**: ${input}` : "**图片**: [Base64 编码图片]"}`;
281
- conversionGuide = `### 设计稿图片分析步骤
282
-
283
- 1. **视觉分析**
284
- - 仔细观察设计稿的整体布局
285
- - 识别页面的主要区域(导航栏、内容区、侧边栏、底部等)
286
- - 分析颜色方案、字体、间距等设计规范
287
- - 识别重复使用的设计模式和组件
288
-
289
- 2. **元素识别**
290
- - 标题、段落、按钮、输入框等基础元素
291
- - 卡片、列表、表格等容器组件
292
- - 图标、图片、背景等视觉元素
293
- - 导航菜单、下拉框、弹窗等交互组件
294
-
295
- 3. **布局还原**
296
- - 使用 Flexbox/Grid 实现主体布局
297
- - 精确测量元素间距和尺寸
298
- - 实现响应式断点设计
299
- - 保持视觉层次和对齐关系
300
-
301
- 4. **样式还原**
302
- - 提取颜色值(主色、辅助色、文字色、背景色)
303
- - 还原字体大小、行高、字重
304
- - 实现圆角、阴影、边框等细节
305
- - 添加 hover、active 等交互状态
306
-
307
- 5. **组件化开发**
308
- - 将设计稿拆分为可复用组件
309
- - 使用 ${framework === "vue" ? "Vue 3 Composition API" : "React Hooks"}
310
- - 添加 TypeScript 类型定义
311
- - 实现组件间的数据传递
312
-
313
- 6. **交互实现**
314
- - 添加点击、滚动等事件处理
315
- - 实现表单验证和提交
316
- - 添加加载状态和错误处理
317
- - 实现动画和过渡效果
318
-
319
- 7. **响应式适配**
320
- - 移动端布局调整(< 768px)
321
- - 平板端优化(768px - 1024px)
322
- - 桌面端完整展示(> 1024px)
323
- - 使用媒体查询或响应式单位
324
-
325
- **注意事项**:
326
- - 如果图片中有文字,请尽量识别并使用真实文本而非图片
327
- - 图标优先使用 SVG 或图标库(如 Heroicons、Lucide)
328
- - 图片资源使用占位符,并注明实际使用时需要替换
329
- - 保持代码的可维护性和可扩展性`;
330
- }
331
- else if (isHTML) {
332
- // HTML 转换模式
333
- taskInfo = `**输入类型**: HTML 代码转换\n**源代码**:\n\`\`\`html\n${input}\n\`\`\``;
334
- conversionGuide = `### HTML 转换步骤
335
-
336
- 1. **分析 HTML 结构**
337
- - 识别语义化标签
338
- - 提取 class 和 id
339
- - 分析嵌套层级
340
-
341
- 2. **转换为组件**
342
- - 将 HTML 转换为 ${framework === "vue" ? "Vue 模板" : "JSX"}
343
- - 提取可复用的子组件
344
- - 添加 TypeScript 类型
345
-
346
- 3. **样式迁移**
347
- - 将内联样式转换为 ${styleSolution}
348
- - 提取公共样式变量
349
- - 优化样式结构
350
-
351
- 4. **添加交互逻辑**
352
- - 识别需要状态管理的部分
353
- - 添加事件处理
354
- - 实现表单验证
355
-
356
- 5. **优化和完善**
357
- - 添加响应式设计
358
- - 优化性能
359
- - 添加可访问性支持`;
360
- }
361
- else {
362
- // 设计稿描述模式
363
- taskInfo = `**输入类型**: 设计稿描述\n**设计需求**:\n${input}`;
364
- conversionGuide = `### 设计稿实现步骤
365
-
366
- 1. **理解设计需求**
367
- - 分析页面布局结构
368
- - 识别设计元素和组件
369
- - 确定交互流程
370
-
371
- 2. **规划组件结构**
372
- - 划分页面区域(Header、Main、Footer)
373
- - 识别可复用组件
374
- - 设计组件层级关系
375
-
376
- 3. **实现布局**
377
- - 使用 Flexbox/Grid 布局
378
- - 实现响应式设计
379
- - 确保跨浏览器兼容
380
-
381
- 4. **实现样式**
382
- - 还原设计稿的视觉效果
383
- - 使用 ${styleSolution} 编写样式
384
- - 添加动画和过渡效果
385
-
386
- 5. **实现交互**
387
- - 添加状态管理
388
- - 实现用户交互
389
- - 添加数据获取逻辑
390
-
391
- 6. **测试和优化**
392
- - 测试不同屏幕尺寸
393
- - 优化性能
394
- - 确保可访问性`;
395
- }
396
- const guide = PROMPT_TEMPLATE
397
- .replace(/{task_info}/g, taskInfo)
398
- .replace(/{framework}/g, framework === "vue" ? "Vue 3 + TypeScript" : "React + TypeScript")
399
- .replace(/{style_solution}/g, styleSolution === "tailwind" ? "Tailwind CSS" : styleSolution === "css-modules" ? "CSS Modules" : "Styled Components")
400
- .replace(/{component_type}/g, componentType === "page" ? "页面组件" : "通用组件")
401
- .replace(/{conversion_guide}/g, conversionGuide);
402
- // 如果是图片输入,添加图片内容
403
- if (isImageUrl || isBase64Image) {
404
- return {
405
- content: [
406
- { type: "text", text: guide },
407
- {
408
- type: "image",
409
- data: isBase64Image ? input.split(',')[1] : input,
410
- mimeType: isBase64Image ? input.match(/data:image\/([^;]+);/)?.[1] || "png" : "image/png"
411
- }
412
- ],
413
- };
414
- }
415
- return {
416
- content: [{ type: "text", text: guide }],
417
- };
418
- }
419
- catch (error) {
420
- const errorMsg = error instanceof Error ? error.message : String(error);
421
- return {
422
- content: [{ type: "text", text: `❌ 错误: ${errorMsg}` }],
423
- isError: true,
424
- };
425
- }
426
- }
@@ -1,6 +0,0 @@
1
- export declare function detectShell(args: any): Promise<{
2
- content: {
3
- type: string;
4
- text: string;
5
- }[];
6
- }>;