mcp-probe-kit 1.6.0 → 1.8.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.
@@ -0,0 +1,543 @@
1
+ /**
2
+ * gen_skill - 生成 Agent Skills 文档
3
+ */
4
+ // 工具分类定义
5
+ const TOOL_CATEGORIES = {
6
+ basic: ["detect_shell", "init_setting", "init_project", "css_order"],
7
+ generation: ["gencommit", "gentest", "genapi", "gendoc", "genpr", "genchangelog", "genreadme", "gensql", "genui", "gen_mock"],
8
+ analysis: ["code_review", "security_scan", "perf", "explain", "analyze_project", "check_deps", "debug"],
9
+ refactoring: ["refactor", "fix", "convert", "split", "resolve_conflict"],
10
+ workflow: ["fix_bug", "estimate", "design2code"],
11
+ context: ["init_project_context", "add_feature"],
12
+ orchestration: ["start_feature", "start_bugfix", "start_review", "start_release", "start_refactor", "start_onboard", "start_api", "start_doc"],
13
+ };
14
+ const TOOL_METADATA = {
15
+ detect_shell: {
16
+ name: "detect-shell",
17
+ description: "检测 AI 应用环境指纹,识别是否为套壳产品",
18
+ usage: "当需要检测 AI 应用是否为套壳产品时使用",
19
+ params: "nonce(可选): 随机字符串\nskip_network(可选): 是否跳过网络探测",
20
+ related: [],
21
+ },
22
+ init_setting: {
23
+ name: "init-setting",
24
+ description: "初始化 Cursor IDE 配置",
25
+ usage: "当需要初始化 Cursor IDE 的 AI 配置时使用",
26
+ params: "project_path(可选): 项目根目录路径",
27
+ related: ["init_project"],
28
+ },
29
+ init_project: {
30
+ name: "init-project",
31
+ description: "创建新项目结构和任务分解",
32
+ usage: "当需要创建新项目或初始化项目结构时使用",
33
+ params: "input: 项目需求描述\nproject_name: 项目名称",
34
+ related: ["init_setting", "init_project_context"],
35
+ },
36
+ css_order: {
37
+ name: "css-order",
38
+ description: "重排 CSS 属性顺序",
39
+ usage: "当需要整理 CSS 属性顺序时使用",
40
+ params: "无参数",
41
+ related: [],
42
+ },
43
+ gencommit: {
44
+ name: "gencommit",
45
+ description: "分析代码变更生成 Git commit 消息",
46
+ usage: "当需要生成规范的 Git commit 消息时使用",
47
+ params: "changes(可选): 代码变更内容\ntype(可选): 提交类型",
48
+ related: ["genpr", "genchangelog"],
49
+ },
50
+ gentest: {
51
+ name: "gentest",
52
+ description: "生成单元测试代码(Jest/Vitest/Mocha)",
53
+ usage: "当需要为代码生成单元测试时使用",
54
+ params: "code: 需要测试的代码\nframework(可选): 测试框架",
55
+ related: ["code_review", "start_api"],
56
+ },
57
+ genapi: {
58
+ name: "genapi",
59
+ description: "生成 API 文档(Markdown/OpenAPI/JSDoc)",
60
+ usage: "当需要为 API 生成文档时使用",
61
+ params: "code: API 代码\nformat(可选): 文档格式",
62
+ related: ["gendoc", "genreadme", "start_doc"],
63
+ },
64
+ gendoc: {
65
+ name: "gendoc",
66
+ description: "生成代码注释(JSDoc/TSDoc/Javadoc)",
67
+ usage: "当需要为代码添加注释时使用",
68
+ params: "code: 需要生成注释的代码\nstyle(可选): 注释风格\nlang(可选): 注释语言",
69
+ related: ["genapi", "start_doc"],
70
+ },
71
+ genpr: {
72
+ name: "genpr",
73
+ description: "生成 Pull Request 描述",
74
+ usage: "当需要生成 PR 描述时使用",
75
+ params: "branch: 当前分支名称\ncommits: Commit 历史",
76
+ related: ["gencommit", "genchangelog", "start_release"],
77
+ },
78
+ genchangelog: {
79
+ name: "genchangelog",
80
+ description: "根据 commit 历史生成 CHANGELOG",
81
+ usage: "当需要生成或更新 CHANGELOG 时使用",
82
+ params: "version: 版本号\nfrom(可选): 起始 commit/tag\nto(可选): 结束 commit/tag",
83
+ related: ["gencommit", "genpr", "start_release"],
84
+ },
85
+ genreadme: {
86
+ name: "genreadme",
87
+ description: "生成 README 文档",
88
+ usage: "当需要生成项目 README 文档时使用",
89
+ params: "project_info: 项目信息或代码\nstyle(可选): 风格",
90
+ related: ["genapi", "start_doc"],
91
+ },
92
+ gensql: {
93
+ name: "gensql",
94
+ description: "根据自然语言生成 SQL 语句",
95
+ usage: "当需要根据描述生成 SQL 查询时使用",
96
+ params: "description: 查询需求描述\ndialect(可选): 数据库类型",
97
+ related: [],
98
+ },
99
+ genui: {
100
+ name: "genui",
101
+ description: "生成 UI 组件代码(React/Vue/HTML)",
102
+ usage: "当需要生成 UI 组件时使用",
103
+ params: "description: 组件功能描述\nframework(可选): 框架",
104
+ related: ["design2code"],
105
+ },
106
+ gen_mock: {
107
+ name: "gen-mock",
108
+ description: "根据 TypeScript 类型或 JSON Schema 生成 Mock 数据",
109
+ usage: "当需要生成测试数据或 Mock 数据时使用",
110
+ params: "schema: 数据结构定义\ncount(可选): 生成数量\nformat(可选): 输出格式",
111
+ related: ["gentest", "start_api"],
112
+ },
113
+ code_review: {
114
+ name: "code-review",
115
+ description: "审查代码质量、安全性、性能",
116
+ usage: "当需要审查代码质量时使用",
117
+ params: "code: 代码片段或文件内容\nfocus(可选): 审查重点",
118
+ related: ["security_scan", "perf", "start_review"],
119
+ },
120
+ security_scan: {
121
+ name: "security-scan",
122
+ description: "专项安全漏洞扫描",
123
+ usage: "当需要专项安全检查时使用",
124
+ params: "code: 需要扫描的代码\nlanguage(可选): 编程语言\nscan_type(可选): 扫描类型",
125
+ related: ["code_review", "start_review"],
126
+ },
127
+ perf: {
128
+ name: "perf",
129
+ description: "分析性能瓶颈",
130
+ usage: "当需要分析代码性能问题时使用",
131
+ params: "code: 需要性能分析的代码\ntype(可选): 分析类型",
132
+ related: ["code_review", "start_review"],
133
+ },
134
+ explain: {
135
+ name: "explain",
136
+ description: "解释代码逻辑和实现原理",
137
+ usage: "当需要理解代码逻辑时使用",
138
+ params: "code: 需要解释的代码片段\ncontext(可选): 补充说明",
139
+ related: [],
140
+ },
141
+ analyze_project: {
142
+ name: "analyze-project",
143
+ description: "分析项目结构、技术栈、架构模式",
144
+ usage: "当需要了解项目整体情况时使用",
145
+ params: "project_path(可选): 项目路径\nmax_depth(可选): 目录树最大深度",
146
+ related: ["init_project_context", "start_onboard"],
147
+ },
148
+ check_deps: {
149
+ name: "check-deps",
150
+ description: "检查依赖健康度",
151
+ usage: "当需要检查项目依赖状态时使用",
152
+ params: "无参数",
153
+ related: ["security_scan"],
154
+ },
155
+ debug: {
156
+ name: "debug",
157
+ description: "分析错误信息和堆栈,定位问题根因",
158
+ usage: "当遇到错误需要定位问题时使用",
159
+ params: "error: 完整错误信息\ncontext(可选): 相关代码片段",
160
+ related: ["fix_bug", "start_bugfix"],
161
+ },
162
+ refactor: {
163
+ name: "refactor",
164
+ description: "分析代码结构提供重构建议",
165
+ usage: "当需要重构代码但不确定如何进行时使用",
166
+ params: "code: 需要重构的代码\ngoal(可选): 重构目标",
167
+ related: ["code_review", "start_refactor"],
168
+ },
169
+ fix: {
170
+ name: "fix",
171
+ description: "自动修复可机械化问题(Lint/TS/格式化)",
172
+ usage: "当需要自动修复代码格式或类型问题时使用",
173
+ params: "code: 需要修复的代码\ntype(可选): 修复类型",
174
+ related: ["fix_bug"],
175
+ },
176
+ convert: {
177
+ name: "convert",
178
+ description: "转换代码格式或框架",
179
+ usage: "当需要转换代码格式或迁移框架时使用",
180
+ params: "code: 源代码\nfrom: 源格式/框架\nto: 目标格式/框架",
181
+ related: [],
182
+ },
183
+ split: {
184
+ name: "split",
185
+ description: "拆分大文件为小模块",
186
+ usage: "当文件过大需要拆分时使用",
187
+ params: "file: 文件完整内容或路径\nstrategy(可选): 拆分策略",
188
+ related: ["refactor"],
189
+ },
190
+ resolve_conflict: {
191
+ name: "resolve-conflict",
192
+ description: "分析 Git 合并冲突",
193
+ usage: "当遇到 Git 合并冲突需要解决时使用",
194
+ params: "conflicts: 冲突文件内容或 git diff 输出",
195
+ related: [],
196
+ },
197
+ fix_bug: {
198
+ name: "fix-bug",
199
+ description: "指导 Bug 修复流程",
200
+ usage: "当需要系统性修复 Bug 时使用",
201
+ params: "error_message: 完整错误消息\nstack_trace(可选): 完整调用栈",
202
+ related: ["debug", "fix", "start_bugfix"],
203
+ },
204
+ estimate: {
205
+ name: "estimate",
206
+ description: "估算开发工作量",
207
+ usage: "当需要评估开发任务工作量时使用",
208
+ params: "task_description: 任务描述\ncode_context(可选): 相关代码",
209
+ related: ["start_feature"],
210
+ },
211
+ design2code: {
212
+ name: "design2code",
213
+ description: "设计稿转代码",
214
+ usage: "当需要将设计稿转换为代码时使用",
215
+ params: "input: 设计稿图片 URL/描述/HTML\nframework(可选): 目标框架",
216
+ related: ["genui"],
217
+ },
218
+ init_project_context: {
219
+ name: "init-project-context",
220
+ description: "生成项目上下文文档",
221
+ usage: "当需要记录项目上下文供后续开发参考时使用",
222
+ params: "docs_dir(可选): 文档目录",
223
+ related: ["analyze_project", "start_onboard"],
224
+ },
225
+ add_feature: {
226
+ name: "add-feature",
227
+ description: "生成新功能规格文档",
228
+ usage: "当需要为新功能生成规格文档时使用",
229
+ params: "feature_name: 功能名称\ndescription: 功能描述",
230
+ related: ["start_feature", "estimate"],
231
+ },
232
+ start_feature: {
233
+ name: "start-feature",
234
+ description: "新功能开发编排",
235
+ usage: "当需要完整的新功能开发流程时使用",
236
+ params: "feature_name: 功能名称\ndescription: 功能描述",
237
+ related: ["add_feature", "estimate", "init_project_context"],
238
+ },
239
+ start_bugfix: {
240
+ name: "start-bugfix",
241
+ description: "Bug 修复编排",
242
+ usage: "当需要完整的 Bug 修复流程时使用",
243
+ params: "error_message: 错误信息\nstack_trace(可选): 堆栈跟踪",
244
+ related: ["debug", "fix_bug", "gentest"],
245
+ },
246
+ start_review: {
247
+ name: "start-review",
248
+ description: "代码全面体检",
249
+ usage: "当需要全面检查代码质量时使用",
250
+ params: "code: 需要审查的代码\nlanguage(可选): 编程语言",
251
+ related: ["code_review", "security_scan", "perf"],
252
+ },
253
+ start_release: {
254
+ name: "start-release",
255
+ description: "发布准备编排",
256
+ usage: "当准备发布新版本时使用",
257
+ params: "version: 版本号\nfrom_tag(可选): 起始 tag",
258
+ related: ["genchangelog", "genpr"],
259
+ },
260
+ start_refactor: {
261
+ name: "start-refactor",
262
+ description: "代码重构编排",
263
+ usage: "当需要系统性重构代码时使用",
264
+ params: "code: 需要重构的代码\ngoal(可选): 重构目标",
265
+ related: ["refactor", "code_review", "gentest"],
266
+ },
267
+ start_onboard: {
268
+ name: "start-onboard",
269
+ description: "快速上手编排",
270
+ usage: "当需要快速了解一个项目时使用",
271
+ params: "project_path(可选): 项目路径\ndocs_dir(可选): 文档目录",
272
+ related: ["analyze_project", "init_project_context"],
273
+ },
274
+ start_api: {
275
+ name: "start-api",
276
+ description: "API 开发编排",
277
+ usage: "当需要完整的 API 开发流程时使用",
278
+ params: "code: API 代码\nlanguage(可选): 编程语言",
279
+ related: ["genapi", "gen_mock", "gentest"],
280
+ },
281
+ start_doc: {
282
+ name: "start-doc",
283
+ description: "文档补全编排",
284
+ usage: "当需要一次性补全项目文档时使用",
285
+ params: "code: 代码或项目信息\nstyle(可选): 注释风格",
286
+ related: ["gendoc", "genreadme", "genapi"],
287
+ },
288
+ };
289
+ const CATEGORY_NAMES = {
290
+ basic: "基础工具",
291
+ generation: "生成工具",
292
+ analysis: "分析工具",
293
+ refactoring: "重构工具",
294
+ workflow: "工作流工具",
295
+ context: "上下文工具",
296
+ orchestration: "编排工具",
297
+ };
298
+ // Agent Skills 标准模板
299
+ const SKILL_TEMPLATE = `---
300
+ name: skill-name
301
+ description: 技能描述,说明做什么、什么时候用(最多1024字符)
302
+ compatibility: claude, gemini, opencode
303
+ metadata:
304
+ author: mcp-probe-kit
305
+ version: 1.0.0
306
+ mcp-tool: tool_name
307
+ ---
308
+
309
+ # skill-name
310
+
311
+ ## 功能描述
312
+
313
+ 详细描述技能的功能和用途。
314
+
315
+ ## 使用场景
316
+
317
+ 说明什么情况下应该使用这个技能。
318
+
319
+ ## 参数说明
320
+
321
+ \`\`\`
322
+ param1: 参数1说明
323
+ param2(可选): 参数2说明
324
+ \`\`\`
325
+
326
+ ## 调用示例
327
+
328
+ 调用 MCP 工具 \`tool_name\`:
329
+
330
+ \`\`\`json
331
+ {
332
+ "tool": "tool_name",
333
+ "arguments": {
334
+ "param1": "value1"
335
+ }
336
+ }
337
+ \`\`\`
338
+
339
+ ## 相关工具
340
+
341
+ \`related_tool_1\`, \`related_tool_2\`
342
+ `;
343
+ function generateSkillMd(toolId, lang) {
344
+ const meta = TOOL_METADATA[toolId];
345
+ if (!meta)
346
+ return "";
347
+ const isZh = lang === "zh";
348
+ const relatedTools = meta.related.length > 0
349
+ ? meta.related.map(t => "`" + t + "`").join(", ")
350
+ : isZh ? "无" : "None";
351
+ const lines = [
352
+ "---",
353
+ `name: ${meta.name}`,
354
+ `description: ${meta.description}`,
355
+ "compatibility: claude, gemini, opencode",
356
+ "metadata:",
357
+ " author: mcp-probe-kit",
358
+ " version: 1.0.0",
359
+ ` mcp-tool: ${toolId}`,
360
+ "---",
361
+ "",
362
+ `# ${meta.name}`,
363
+ "",
364
+ `## ${isZh ? "功能描述" : "Description"}`,
365
+ "",
366
+ meta.description,
367
+ "",
368
+ `## ${isZh ? "使用场景" : "When to Use"}`,
369
+ "",
370
+ meta.usage,
371
+ "",
372
+ `## ${isZh ? "参数说明" : "Parameters"}`,
373
+ "",
374
+ "```",
375
+ meta.params,
376
+ "```",
377
+ "",
378
+ `## ${isZh ? "调用示例" : "Example"}`,
379
+ "",
380
+ `${isZh ? "调用 MCP 工具" : "Call MCP tool"} \`${toolId}\`:`,
381
+ "",
382
+ "```json",
383
+ "{",
384
+ ` "tool": "${toolId}",`,
385
+ " \"arguments\": {",
386
+ ` // ${isZh ? "根据参数说明填写" : "Fill in according to parameters"}`,
387
+ " }",
388
+ "}",
389
+ "```",
390
+ "",
391
+ `## ${isZh ? "相关工具" : "Related Tools"}`,
392
+ "",
393
+ relatedTools,
394
+ "",
395
+ "---",
396
+ "",
397
+ `*${isZh ? "由 MCP Probe Kit gen_skill 工具生成" : "Generated by MCP Probe Kit gen_skill tool"}*`,
398
+ ];
399
+ return lines.join("\n");
400
+ }
401
+ function generateReadme(tools, lang) {
402
+ const isZh = lang === "zh";
403
+ const lines = [];
404
+ lines.push(`# ${isZh ? "MCP Probe Kit 技能文档" : "MCP Probe Kit Skills"}`);
405
+ lines.push("");
406
+ lines.push(isZh
407
+ ? "本目录包含 MCP Probe Kit 所有工具的 Agent Skills 文档,符合 [Agent Skills 开放标准](https://agentskills.io)。"
408
+ : "This directory contains Agent Skills documentation for all MCP Probe Kit tools, following the [Agent Skills open standard](https://agentskills.io).");
409
+ lines.push("");
410
+ lines.push(`## ${isZh ? "使用方法" : "Usage"}`);
411
+ lines.push("");
412
+ lines.push(isZh
413
+ ? "将 `skills/` 目录复制到你的项目中,AI 助手会自动发现并使用这些技能。"
414
+ : "Copy the `skills/` directory to your project, and AI assistants will automatically discover and use these skills.");
415
+ lines.push("");
416
+ lines.push(`## ${isZh ? "技能列表" : "Skills List"}`);
417
+ lines.push("");
418
+ for (const [category, categoryTools] of Object.entries(TOOL_CATEGORIES)) {
419
+ const categoryName = isZh ? CATEGORY_NAMES[category] : category.charAt(0).toUpperCase() + category.slice(1);
420
+ const filteredTools = categoryTools.filter(t => tools.includes(t));
421
+ if (filteredTools.length === 0)
422
+ continue;
423
+ lines.push(`### ${categoryName}`);
424
+ lines.push("");
425
+ lines.push(`| ${isZh ? "技能" : "Skill"} | ${isZh ? "描述" : "Description"} |`);
426
+ lines.push("|------|------|");
427
+ for (const toolId of filteredTools) {
428
+ const meta = TOOL_METADATA[toolId];
429
+ if (meta) {
430
+ const desc = meta.description.length > 40 ? meta.description.slice(0, 40) + "..." : meta.description;
431
+ lines.push(`| [${meta.name}](./${meta.name}/SKILL.md) | ${desc} |`);
432
+ }
433
+ }
434
+ lines.push("");
435
+ }
436
+ lines.push(`## ${isZh ? "自定义" : "Customization"}`);
437
+ lines.push("");
438
+ lines.push(isZh
439
+ ? "你可以根据项目需求修改这些技能文档,添加项目特定的上下文和指导。"
440
+ : "You can modify these skill documents according to your project needs, adding project-specific context and guidance.");
441
+ lines.push("");
442
+ lines.push("---");
443
+ lines.push("");
444
+ lines.push(`*${isZh ? "由 MCP Probe Kit gen_skill 工具生成" : "Generated by MCP Probe Kit gen_skill tool"}*`);
445
+ return lines.join("\n");
446
+ }
447
+ export async function genSkill(args) {
448
+ try {
449
+ const scope = args?.scope || "all";
450
+ const toolName = args?.tool_name;
451
+ const outputDir = args?.output_dir || "skills";
452
+ const lang = args?.lang || "zh";
453
+ const isZh = lang === "zh";
454
+ let toolsToGenerate = [];
455
+ if (toolName) {
456
+ if (!TOOL_METADATA[toolName]) {
457
+ throw new Error(`未知工具: ${toolName}`);
458
+ }
459
+ toolsToGenerate = [toolName];
460
+ }
461
+ else if (scope === "all") {
462
+ toolsToGenerate = Object.keys(TOOL_METADATA);
463
+ }
464
+ else {
465
+ const categoryTools = TOOL_CATEGORIES[scope];
466
+ if (!categoryTools) {
467
+ throw new Error(`未知分类: ${scope},可选值: ${Object.keys(TOOL_CATEGORIES).join(", ")}`);
468
+ }
469
+ toolsToGenerate = categoryTools;
470
+ }
471
+ const files = [];
472
+ for (const toolId of toolsToGenerate) {
473
+ const meta = TOOL_METADATA[toolId];
474
+ if (!meta)
475
+ continue;
476
+ files.push({
477
+ path: `${outputDir}/${meta.name}/SKILL.md`,
478
+ content: generateSkillMd(toolId, lang),
479
+ });
480
+ }
481
+ files.push({
482
+ path: `${outputDir}/README.md`,
483
+ content: generateReadme(toolsToGenerate, lang),
484
+ });
485
+ // 构建输出
486
+ const outputLines = [];
487
+ outputLines.push(`# ${isZh ? "Agent Skills 生成指南" : "Agent Skills Generation Guide"}`);
488
+ outputLines.push("");
489
+ outputLines.push(`## ${isZh ? "Agent Skills 标准模板" : "Agent Skills Standard Template"}`);
490
+ outputLines.push("");
491
+ outputLines.push(isZh
492
+ ? "以下是符合 [Agent Skills 开放标准](https://agentskills.io) 的 SKILL.md 模板:"
493
+ : "The following is a SKILL.md template that conforms to the [Agent Skills open standard](https://agentskills.io):");
494
+ outputLines.push("");
495
+ outputLines.push("```markdown");
496
+ outputLines.push(SKILL_TEMPLATE);
497
+ outputLines.push("```");
498
+ outputLines.push("");
499
+ outputLines.push(`### ${isZh ? "格式要求" : "Format Requirements"}`);
500
+ outputLines.push("");
501
+ outputLines.push(`| ${isZh ? "字段" : "Field"} | ${isZh ? "要求" : "Requirement"} |`);
502
+ outputLines.push("|------|------|");
503
+ outputLines.push(`| name | ${isZh ? "必填,最多64字符,小写字母+数字+连字符" : "Required, max 64 chars, lowercase+numbers+hyphens"} |`);
504
+ outputLines.push(`| description | ${isZh ? "必填,最多1024字符" : "Required, max 1024 chars"} |`);
505
+ outputLines.push(`| compatibility | ${isZh ? "可选,支持的平台" : "Optional, supported platforms"} |`);
506
+ outputLines.push(`| metadata | ${isZh ? "可选,额外元数据" : "Optional, additional metadata"} |`);
507
+ outputLines.push("");
508
+ outputLines.push(`### ${isZh ? "目录结构" : "Directory Structure"}`);
509
+ outputLines.push("");
510
+ outputLines.push("```");
511
+ outputLines.push("skills/");
512
+ outputLines.push("└── skill-name/");
513
+ outputLines.push(` ├── SKILL.md # ${isZh ? "核心文件(必须)" : "Core file (required)"}`);
514
+ outputLines.push(` ├── scripts/ # ${isZh ? "可执行脚本(可选)" : "Scripts (optional)"}`);
515
+ outputLines.push(` └── references/ # ${isZh ? "参考文档(可选)" : "References (optional)"}`);
516
+ outputLines.push("```");
517
+ outputLines.push("");
518
+ outputLines.push(`## ${isZh ? "生成范围" : "Scope"}`);
519
+ outputLines.push("");
520
+ outputLines.push(`${isZh ? "本次生成" : "Generated"} **${toolsToGenerate.length}** ${isZh ? "个工具的技能文档" : "skill documents"}`);
521
+ outputLines.push("");
522
+ outputLines.push(`## ${isZh ? "请创建以下文件" : "Please Create Files"}`);
523
+ outputLines.push("");
524
+ for (const file of files) {
525
+ outputLines.push(`### \`${file.path}\``);
526
+ outputLines.push("");
527
+ outputLines.push("```markdown");
528
+ outputLines.push(file.content);
529
+ outputLines.push("```");
530
+ outputLines.push("");
531
+ }
532
+ return {
533
+ content: [{ type: "text", text: outputLines.join("\n") }],
534
+ };
535
+ }
536
+ catch (error) {
537
+ const errorMsg = error instanceof Error ? error.message : String(error);
538
+ return {
539
+ content: [{ type: "text", text: `❌ 生成失败: ${errorMsg}` }],
540
+ isError: true,
541
+ };
542
+ }
543
+ }
@@ -127,7 +127,16 @@ paths:
127
127
 
128
128
  ---
129
129
 
130
- 现在请根据上述代码生成完整的 API 文档,并将文档保存到项目的 \`docs/api/\` 目录。`;
130
+ ---
131
+
132
+ ## ⚠️ 边界约束
133
+
134
+ - ❌ 仅输出文档,不修改业务代码
135
+ - ❌ 不执行代码或命令
136
+ - ✅ 基于现有接口定义/路由/注释推断
137
+ - ✅ 输出完整的 API 文档
138
+
139
+ 现在请根据上述代码生成完整的 API 文档。`;
131
140
  return {
132
141
  content: [
133
142
  {
@@ -202,7 +202,15 @@ npx standard-version --first-release
202
202
 
203
203
  ---
204
204
 
205
- 现在请根据 commit 历史生成详细的 CHANGELOG.md 文件。`;
205
+ ---
206
+
207
+ ## ⚠️ 边界约束
208
+
209
+ - ❌ 仅输出 CHANGELOG 文本,不自动写入文件
210
+ - ❌ 不执行 git 命令
211
+ - ✅ 输出完整的 CHANGELOG Markdown
212
+
213
+ 现在请根据 commit 历史生成详细的 CHANGELOG.md 内容。`;
206
214
  return {
207
215
  content: [
208
216
  {
@@ -179,6 +179,15 @@ type TypeName = {
179
179
 
180
180
  ---
181
181
 
182
+ ---
183
+
184
+ ## ⚠️ 边界约束
185
+
186
+ - ❌ 仅输出注释,不改变代码逻辑
187
+ - ❌ 不执行代码或命令
188
+ - ✅ 补全参数/返回值/异常/示例说明
189
+ - ✅ 输出带完整注释的代码
190
+
182
191
  现在请为代码生成${lang === "zh" ? "中文" : "英文"}的${style}风格注释文档,包括:
183
192
  1. 完整的函数/类/接口注释
184
193
  2. 复杂逻辑的行内注释
@@ -148,6 +148,14 @@ Relates to #789
148
148
 
149
149
  ---
150
150
 
151
+ ---
152
+
153
+ ## ⚠️ 边界约束
154
+
155
+ - ❌ 仅输出 PR 描述文本,不自动创建 PR
156
+ - ❌ 不执行 git 命令
157
+ - ✅ 输出完整的 PR 描述 Markdown
158
+
151
159
  现在请根据变更内容生成完整的 PR 描述,并建议合适的审查者。`;
152
160
  return {
153
161
  content: [
@@ -125,6 +125,15 @@ const createUser = (overrides = {}) => ({
125
125
 
126
126
  ---
127
127
 
128
+ ---
129
+
130
+ ## ⚠️ 边界约束
131
+
132
+ - ❌ 仅输出测试代码,不自动运行测试
133
+ - ❌ 不修改被测试的源代码
134
+ - ✅ 默认跟随项目现有测试框架与语言
135
+ - ✅ 输出完整可运行的测试文件
136
+
128
137
  现在请生成完整的测试代码,包括:
129
138
  1. describe 块组织
130
139
  2. 所有必要的测试用例
@@ -746,6 +746,15 @@ const modalClasses = computed(() => {
746
746
 
747
747
  ---
748
748
 
749
+ ---
750
+
751
+ ## ⚠️ 边界约束
752
+
753
+ - ❌ 仅输出组件代码,不自动创建文件
754
+ - ❌ 不执行代码或命令
755
+ - ✅ 默认跟随项目现有前端栈与组件风格
756
+ - ✅ 输出完整可用的组件代码
757
+
749
758
  现在请根据需求生成完整的 UI 组件代码,包括:
750
759
  1. 组件实现(TypeScript)
751
760
  2. 样式(Tailwind CSS)
@@ -28,6 +28,7 @@ export { securityScan } from "./security_scan.js";
28
28
  export { fixBug } from "./fix_bug.js";
29
29
  export { estimate } from "./estimate.js";
30
30
  export { genMock } from "./gen_mock.js";
31
+ export { design2code } from "./design2code.js";
31
32
  export { startFeature } from "./start_feature.js";
32
33
  export { startBugfix } from "./start_bugfix.js";
33
34
  export { startReview } from "./start_review.js";
@@ -36,3 +37,4 @@ export { startRefactor } from "./start_refactor.js";
36
37
  export { startOnboard } from "./start_onboard.js";
37
38
  export { startApi } from "./start_api.js";
38
39
  export { startDoc } from "./start_doc.js";
40
+ export { genSkill } from "./gen_skill.js";
@@ -28,6 +28,7 @@ export { securityScan } from "./security_scan.js";
28
28
  export { fixBug } from "./fix_bug.js";
29
29
  export { estimate } from "./estimate.js";
30
30
  export { genMock } from "./gen_mock.js";
31
+ export { design2code } from "./design2code.js";
31
32
  // 智能编排工具
32
33
  export { startFeature } from "./start_feature.js";
33
34
  export { startBugfix } from "./start_bugfix.js";
@@ -37,3 +38,4 @@ export { startRefactor } from "./start_refactor.js";
37
38
  export { startOnboard } from "./start_onboard.js";
38
39
  export { startApi } from "./start_api.js";
39
40
  export { startDoc } from "./start_doc.js";
41
+ export { genSkill } from "./gen_skill.js";