mcp-probe-kit 1.10.1 → 1.11.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/build/index.js +22 -450
- package/build/resources/index.d.ts +4 -0
- package/build/resources/index.js +4 -0
- package/build/resources/tool-params-guide.d.ts +571 -0
- package/build/resources/tool-params-guide.js +488 -0
- package/build/schemas/basic-tools.d.ts +54 -0
- package/build/schemas/basic-tools.js +58 -0
- package/build/schemas/code-analysis-tools.d.ts +156 -0
- package/build/schemas/code-analysis-tools.js +165 -0
- package/build/schemas/code-gen-tools.d.ts +150 -0
- package/build/schemas/code-gen-tools.js +158 -0
- package/build/schemas/doc-util-tools.d.ts +85 -0
- package/build/schemas/doc-util-tools.js +93 -0
- package/build/schemas/git-tools.d.ts +76 -0
- package/build/schemas/git-tools.js +81 -0
- package/build/schemas/index.d.ts +767 -0
- package/build/schemas/index.js +20 -0
- package/build/schemas/orchestration-tools.d.ts +186 -0
- package/build/schemas/orchestration-tools.js +196 -0
- package/build/schemas/project-tools.d.ts +84 -0
- package/build/schemas/project-tools.js +89 -0
- package/build/tools/add_feature.js +68 -5
- package/build/tools/start_feature.js +64 -7
- package/build/utils/parseArgs.js +12 -1
- package/package.json +1 -1
|
@@ -5,6 +5,46 @@ import { parseArgs, getString } from "../utils/parseArgs.js";
|
|
|
5
5
|
* 场景:开发新功能
|
|
6
6
|
* 编排:[检查上下文] → add_feature → estimate
|
|
7
7
|
*/
|
|
8
|
+
/**
|
|
9
|
+
* 从自然语言输入中提取功能名和描述
|
|
10
|
+
* @param input - 自然语言输入
|
|
11
|
+
* @returns 提取的功能名和描述
|
|
12
|
+
*/
|
|
13
|
+
function extractFeatureInfo(input) {
|
|
14
|
+
// 移除常见的引导词
|
|
15
|
+
let text = input
|
|
16
|
+
.replace(/^(添加|实现|开发|创建|新增|生成|构建|做|要|想要|需要|帮我|请|麻烦)/i, "")
|
|
17
|
+
.trim();
|
|
18
|
+
// 移除结尾的"功能"、"模块"等词
|
|
19
|
+
text = text.replace(/(功能|模块|特性|组件|系统|服务)$/i, "").trim();
|
|
20
|
+
// 如果文本很短(少于20个字符),直接作为功能名
|
|
21
|
+
if (text.length < 20) {
|
|
22
|
+
const name = text
|
|
23
|
+
.toLowerCase()
|
|
24
|
+
.replace(/[\s\u4e00-\u9fa5]+/g, "-") // 将空格和中文替换为连字符
|
|
25
|
+
.replace(/[^a-z0-9-]/g, "") // 移除非字母数字和连字符
|
|
26
|
+
.replace(/-+/g, "-") // 合并多个连字符
|
|
27
|
+
.replace(/^-|-$/g, ""); // 移除首尾连字符
|
|
28
|
+
return {
|
|
29
|
+
name: name || "new-feature",
|
|
30
|
+
description: input,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
// 如果文本较长,尝试提取关键词作为功能名
|
|
34
|
+
// 提取前几个关键词
|
|
35
|
+
const words = text.split(/[\s,,、]+/).filter(w => w.length > 0);
|
|
36
|
+
const keyWords = words.slice(0, 3).join(" ");
|
|
37
|
+
const name = keyWords
|
|
38
|
+
.toLowerCase()
|
|
39
|
+
.replace(/[\s\u4e00-\u9fa5]+/g, "-")
|
|
40
|
+
.replace(/[^a-z0-9-]/g, "")
|
|
41
|
+
.replace(/-+/g, "-")
|
|
42
|
+
.replace(/^-|-$/g, "");
|
|
43
|
+
return {
|
|
44
|
+
name: name || "new-feature",
|
|
45
|
+
description: input,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
8
48
|
const PROMPT_TEMPLATE = `# 🚀 新功能开发编排指南
|
|
9
49
|
|
|
10
50
|
## 🎯 目标
|
|
@@ -103,21 +143,38 @@ export async function startFeature(args) {
|
|
|
103
143
|
description: "",
|
|
104
144
|
docs_dir: "docs",
|
|
105
145
|
},
|
|
106
|
-
primaryField: "
|
|
146
|
+
primaryField: "input", // 纯文本输入默认映射到 input 字段
|
|
107
147
|
fieldAliases: {
|
|
108
148
|
feature_name: ["name", "feature", "功能名", "功能名称"],
|
|
109
149
|
description: ["desc", "requirement", "描述", "需求"],
|
|
110
150
|
docs_dir: ["dir", "output", "目录", "文档目录"],
|
|
111
151
|
},
|
|
112
152
|
});
|
|
113
|
-
|
|
114
|
-
|
|
153
|
+
let featureName = getString(parsedArgs.feature_name);
|
|
154
|
+
let description = getString(parsedArgs.description);
|
|
115
155
|
const docsDir = getString(parsedArgs.docs_dir) || "docs";
|
|
116
|
-
|
|
117
|
-
|
|
156
|
+
// 如果是纯自然语言输入(input 字段有值但 feature_name 和 description 为空)
|
|
157
|
+
const input = getString(parsedArgs.input);
|
|
158
|
+
if (input && !featureName && !description) {
|
|
159
|
+
// 智能提取功能名和描述
|
|
160
|
+
const extracted = extractFeatureInfo(input);
|
|
161
|
+
featureName = extracted.name;
|
|
162
|
+
description = extracted.description;
|
|
163
|
+
}
|
|
164
|
+
// 如果只有 description 没有 feature_name,尝试从 description 提取
|
|
165
|
+
if (!featureName && description) {
|
|
166
|
+
const extracted = extractFeatureInfo(description);
|
|
167
|
+
featureName = extracted.name;
|
|
168
|
+
if (!description || description === featureName) {
|
|
169
|
+
description = extracted.description;
|
|
170
|
+
}
|
|
118
171
|
}
|
|
119
|
-
if (!description) {
|
|
120
|
-
throw new Error("
|
|
172
|
+
if (!featureName || !description) {
|
|
173
|
+
throw new Error("请提供功能名称和描述。\n\n" +
|
|
174
|
+
"示例用法:\n" +
|
|
175
|
+
"- 自然语言:'开发用户认证功能'\n" +
|
|
176
|
+
"- 详细描述:'实现用户登录、注册和密码重置功能'\n" +
|
|
177
|
+
"- JSON格式:{\"feature_name\": \"user-auth\", \"description\": \"用户认证功能\"}");
|
|
121
178
|
}
|
|
122
179
|
const guide = PROMPT_TEMPLATE
|
|
123
180
|
.replace(/{feature_name}/g, featureName)
|
package/build/utils/parseArgs.js
CHANGED
|
@@ -44,7 +44,18 @@ export function parseArgs(args, config = {}) {
|
|
|
44
44
|
}
|
|
45
45
|
// 3. 处理对象类型 - 标准 JSON 对象
|
|
46
46
|
else if (typeof args === "object" && !Array.isArray(args)) {
|
|
47
|
-
|
|
47
|
+
// 3.1 检查是否有嵌套的 input 字段(MCP 常见格式)
|
|
48
|
+
// 例如: {"input": {"feature_name": "...", "description": "..."}}
|
|
49
|
+
if (args.input && typeof args.input === "object" && !Array.isArray(args.input)) {
|
|
50
|
+
// 展平嵌套结构,优先使用 input 内的字段
|
|
51
|
+
parsedArgs = { ...args, ...args.input };
|
|
52
|
+
delete parsedArgs.input; // 移除 input 字段避免冲突
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
parsedArgs = args;
|
|
56
|
+
}
|
|
57
|
+
// 3.2 规范化字段名(处理别名)
|
|
58
|
+
parsedArgs = normalizeObjectKeys(parsedArgs, fieldAliases);
|
|
48
59
|
}
|
|
49
60
|
// 4. 其他类型
|
|
50
61
|
else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-probe-kit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.0",
|
|
4
4
|
"description": "AI Development Enhancement Toolkit - MCP Server with 40 practical tools (32 basic + 8 orchestration) for code quality, development efficiency, and project management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "build/index.js",
|