mcp-probe-kit 3.0.12 → 3.0.13
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/README.md +76 -20
- package/build/lib/__tests__/gitnexus-bridge.unit.test.js +37 -1
- package/build/lib/gitnexus-bridge.d.ts +35 -2
- package/build/lib/gitnexus-bridge.js +316 -41
- package/build/tools/__tests__/code_insight.unit.test.js +51 -1
- package/build/tools/code_insight.d.ts +31 -1
- package/build/tools/code_insight.js +204 -71
- package/docs/i18n/en.json +20 -0
- package/docs/i18n/ja.json +20 -0
- package/docs/i18n/ko.json +20 -0
- package/docs/i18n/zh-CN.json +20 -0
- package/docs/pages/getting-started.html +71 -10
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as fs from "node:fs";
|
|
1
2
|
import * as path from "node:path";
|
|
2
3
|
import { parseArgs, getString, getNumber, getBoolean } from "../utils/parseArgs.js";
|
|
3
4
|
import { okStructured } from "../lib/response.js";
|
|
@@ -70,12 +71,149 @@ function summarizeExecutions(executions) {
|
|
|
70
71
|
return executions
|
|
71
72
|
.map((item) => {
|
|
72
73
|
if (item.ok) {
|
|
73
|
-
|
|
74
|
+
const suffix = item.status ? ` [${item.status}]` : "";
|
|
75
|
+
return `- ✅ ${item.tool}${suffix}: ${(item.text || "已返回结果").replace(/\s+/g, " ").slice(0, 180)}`;
|
|
74
76
|
}
|
|
75
77
|
return `- ⚠️ ${item.tool}: ${(item.error || "调用失败").replace(/\s+/g, " ").slice(0, 180)}`;
|
|
76
78
|
})
|
|
77
79
|
.join("\n");
|
|
78
80
|
}
|
|
81
|
+
export function deriveCodeInsightStatus(result) {
|
|
82
|
+
if (!result.available) {
|
|
83
|
+
return "degraded";
|
|
84
|
+
}
|
|
85
|
+
if (result.ambiguities.length > 0) {
|
|
86
|
+
return "ambiguous";
|
|
87
|
+
}
|
|
88
|
+
const successfulStatuses = result.executions
|
|
89
|
+
.filter((item) => item.ok)
|
|
90
|
+
.map((item) => item.status)
|
|
91
|
+
.filter((item) => Boolean(item));
|
|
92
|
+
if (successfulStatuses.length > 0 && successfulStatuses.every((item) => item === "not_found")) {
|
|
93
|
+
return "not_found";
|
|
94
|
+
}
|
|
95
|
+
return "ok";
|
|
96
|
+
}
|
|
97
|
+
function formatStatusLabel(status) {
|
|
98
|
+
switch (status) {
|
|
99
|
+
case "ambiguous":
|
|
100
|
+
return "歧义";
|
|
101
|
+
case "degraded":
|
|
102
|
+
return "降级";
|
|
103
|
+
case "not_found":
|
|
104
|
+
return "未找到";
|
|
105
|
+
default:
|
|
106
|
+
return "可用";
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function formatAmbiguities(ambiguities) {
|
|
110
|
+
if (ambiguities.length === 0) {
|
|
111
|
+
return "";
|
|
112
|
+
}
|
|
113
|
+
return ambiguities
|
|
114
|
+
.map((ambiguity) => {
|
|
115
|
+
const lines = [`- ${ambiguity.tool}: ${ambiguity.message || "存在多个候选符号"}`];
|
|
116
|
+
for (const candidate of ambiguity.candidates.slice(0, 5)) {
|
|
117
|
+
const parts = [
|
|
118
|
+
typeof candidate.uid === "string" ? `uid=${candidate.uid}` : "",
|
|
119
|
+
typeof candidate.name === "string" ? `name=${candidate.name}` : "",
|
|
120
|
+
typeof candidate.file_path === "string" ? `file_path=${candidate.file_path}` : "",
|
|
121
|
+
].filter(Boolean);
|
|
122
|
+
lines.push(` - ${parts.join(" | ") || JSON.stringify(candidate)}`);
|
|
123
|
+
}
|
|
124
|
+
return lines.join("\n");
|
|
125
|
+
})
|
|
126
|
+
.join("\n");
|
|
127
|
+
}
|
|
128
|
+
function createProjectDocsPlan(projectRoot, docsDirName, docsSnapshot) {
|
|
129
|
+
const docsDir = path.dirname(docsSnapshot.markdownFilePath);
|
|
130
|
+
return {
|
|
131
|
+
docsDir,
|
|
132
|
+
projectContextFilePath: toPosixPath(path.join(path.resolve(projectRoot), docsDirName, "project-context.md")),
|
|
133
|
+
latestMarkdownFilePath: toPosixPath(path.join(docsDir, "latest.md")),
|
|
134
|
+
latestJsonFilePath: toPosixPath(path.join(docsDir, "latest.json")),
|
|
135
|
+
archiveMarkdownFilePath: docsSnapshot.markdownFilePath,
|
|
136
|
+
archiveJsonFilePath: docsSnapshot.jsonFilePath,
|
|
137
|
+
navigationSnippet: `### [代码图谱洞察](./graph-insights/latest.md)
|
|
138
|
+
最近一次 code_insight 分析结果,包含调用链、上下文与影响面摘要
|
|
139
|
+
`,
|
|
140
|
+
devGuideSnippet: `- **代码图谱洞察**: [graph-insights/latest.md](./graph-insights/latest.md) - 需要理解模块依赖、调用链和影响面时优先查看
|
|
141
|
+
`,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
export function buildCodeInsightDelegatedPlan(input) {
|
|
145
|
+
if (!input.showPlan) {
|
|
146
|
+
return undefined;
|
|
147
|
+
}
|
|
148
|
+
if (input.status === "ambiguous" && input.ambiguities.length > 0) {
|
|
149
|
+
return {
|
|
150
|
+
mode: "delegated",
|
|
151
|
+
kind: "ambiguity",
|
|
152
|
+
steps: [
|
|
153
|
+
{
|
|
154
|
+
id: "inspect-candidates",
|
|
155
|
+
action: "阅读本次返回的 candidates,确认目标符号对应的 uid 或 file_path",
|
|
156
|
+
note: "若存在同名符号,优先使用 uid;需要限定文件时使用 file_path",
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
id: "rerun-with-disambiguate",
|
|
160
|
+
action: "重新调用 code_insight,并显式传入 uid 或 file_path 完成消歧",
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
id: "resume-analysis",
|
|
164
|
+
action: "消歧后再继续 context/impact 分析,必要时再决定是否保存到 docs/graph-insights",
|
|
165
|
+
},
|
|
166
|
+
],
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
if (!input.projectDocs) {
|
|
170
|
+
return undefined;
|
|
171
|
+
}
|
|
172
|
+
const projectContextExists = fs.existsSync(input.projectDocs.projectContextFilePath);
|
|
173
|
+
return {
|
|
174
|
+
mode: "delegated",
|
|
175
|
+
kind: "docs",
|
|
176
|
+
steps: [
|
|
177
|
+
{
|
|
178
|
+
id: "ensure-project-context",
|
|
179
|
+
action: projectContextExists
|
|
180
|
+
? `确认 ${input.projectDocs.projectContextFilePath} 已存在并可更新`
|
|
181
|
+
: `检查 ${input.projectDocs.projectContextFilePath} 是否存在;若不存在,先调用 init_project_context 生成项目上下文索引`,
|
|
182
|
+
outputs: [input.projectDocs.projectContextFilePath],
|
|
183
|
+
note: projectContextExists
|
|
184
|
+
? "已有项目上下文,可直接补充图谱入口"
|
|
185
|
+
: "只有 project-context.md 存在,后续图谱文档入口才可持续复用",
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
id: "save-latest-md",
|
|
189
|
+
action: `将本次 code_insight 的文本分析结果写入 ${input.projectDocs.latestMarkdownFilePath}`,
|
|
190
|
+
outputs: [input.projectDocs.latestMarkdownFilePath],
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
id: "save-archive-md",
|
|
194
|
+
action: `将本次 code_insight 的文本分析结果归档到 ${input.projectDocs.archiveMarkdownFilePath}`,
|
|
195
|
+
outputs: [input.projectDocs.archiveMarkdownFilePath],
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
id: "save-latest-json",
|
|
199
|
+
action: `将本次 code_insight 的 structuredContent 写入 ${input.projectDocs.latestJsonFilePath}`,
|
|
200
|
+
outputs: [input.projectDocs.latestJsonFilePath],
|
|
201
|
+
note: "建议保留完整结构化结果,便于后续 AI 继续读取",
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
id: "save-archive-json",
|
|
205
|
+
action: `将本次 code_insight 的 structuredContent 归档到 ${input.projectDocs.archiveJsonFilePath}`,
|
|
206
|
+
outputs: [input.projectDocs.archiveJsonFilePath],
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
id: "update-project-context-index",
|
|
210
|
+
action: `更新 ${input.projectDocs.projectContextFilePath},在“## 📚 文档导航”加入图谱文档入口,并在“## 💡 开发时查看对应文档”加入代码图谱洞察链接`,
|
|
211
|
+
outputs: [input.projectDocs.projectContextFilePath],
|
|
212
|
+
note: `建议插入内容:\n${input.projectDocs.navigationSnippet}\n${input.projectDocs.devGuideSnippet}`,
|
|
213
|
+
},
|
|
214
|
+
],
|
|
215
|
+
};
|
|
216
|
+
}
|
|
79
217
|
export function resolveCodeInsightQuery(input) {
|
|
80
218
|
const finalTarget = input.target || ((input.mode === "context" || input.mode === "impact") ? input.input : "");
|
|
81
219
|
const finalQuery = input.query
|
|
@@ -91,18 +229,23 @@ export async function codeInsight(args, context) {
|
|
|
91
229
|
mode: "auto",
|
|
92
230
|
query: "",
|
|
93
231
|
target: "",
|
|
232
|
+
uid: "",
|
|
233
|
+
file_path: "",
|
|
94
234
|
repo: "",
|
|
95
235
|
goal: "",
|
|
96
236
|
task_context: "",
|
|
97
237
|
direction: "",
|
|
98
238
|
max_depth: 3,
|
|
99
239
|
include_tests: false,
|
|
240
|
+
include_content: false,
|
|
100
241
|
},
|
|
101
242
|
primaryField: "input",
|
|
102
243
|
fieldAliases: {
|
|
103
244
|
mode: ["m", "模式"],
|
|
104
245
|
query: ["q", "keyword", "关键词"],
|
|
105
246
|
target: ["symbol", "name", "目标符号"],
|
|
247
|
+
uid: ["symbol_uid", "候选uid"],
|
|
248
|
+
file_path: ["filePath", "filepath", "文件路径"],
|
|
106
249
|
repo: ["repository", "仓库"],
|
|
107
250
|
project_root: ["projectRoot", "project_path", "path", "dir", "directory", "项目路径", "项目根目录"],
|
|
108
251
|
docs_dir: ["docsDir", "docs", "文档目录"],
|
|
@@ -111,11 +254,16 @@ export async function codeInsight(args, context) {
|
|
|
111
254
|
direction: ["dir", "方向"],
|
|
112
255
|
max_depth: ["depth", "maxDepth", "最大深度"],
|
|
113
256
|
include_tests: ["includeTests", "包含测试"],
|
|
257
|
+
include_content: ["includeContent", "包含代码"],
|
|
258
|
+
save_to_docs: ["saveToDocs", "保存到文档"],
|
|
259
|
+
delegated_plan: ["delegatedPlan", "生成计划"],
|
|
114
260
|
},
|
|
115
261
|
});
|
|
116
262
|
const mode = normalizeMode(getString(parsedArgs.mode, "auto"));
|
|
117
263
|
const query = getString(parsedArgs.query);
|
|
118
264
|
const target = getString(parsedArgs.target);
|
|
265
|
+
const uid = getString(parsedArgs.uid);
|
|
266
|
+
const filePath = getString(parsedArgs.file_path);
|
|
119
267
|
const repo = getString(parsedArgs.repo);
|
|
120
268
|
const projectRoot = getString(parsedArgs.project_root);
|
|
121
269
|
const docsDirName = getString(parsedArgs.docs_dir) || "docs";
|
|
@@ -124,6 +272,8 @@ export async function codeInsight(args, context) {
|
|
|
124
272
|
const direction = normalizeDirection(getString(parsedArgs.direction));
|
|
125
273
|
const maxDepth = Math.max(1, getNumber(parsedArgs.max_depth, 3));
|
|
126
274
|
const includeTests = getBoolean(parsedArgs.include_tests, false);
|
|
275
|
+
const includeContent = getBoolean(parsedArgs.include_content, false);
|
|
276
|
+
const saveToDocs = getBoolean(parsedArgs.save_to_docs, Boolean(projectRoot || parsedArgs.docs_dir));
|
|
127
277
|
const input = getString(parsedArgs.input);
|
|
128
278
|
const { finalQuery, finalTarget } = resolveCodeInsightQuery({
|
|
129
279
|
mode,
|
|
@@ -136,6 +286,8 @@ export async function codeInsight(args, context) {
|
|
|
136
286
|
mode,
|
|
137
287
|
query: finalQuery,
|
|
138
288
|
target: finalTarget,
|
|
289
|
+
uid: uid || undefined,
|
|
290
|
+
filePath: filePath || undefined,
|
|
139
291
|
repo: repo || undefined,
|
|
140
292
|
projectRoot: projectRoot || undefined,
|
|
141
293
|
goal: goal || undefined,
|
|
@@ -143,19 +295,25 @@ export async function codeInsight(args, context) {
|
|
|
143
295
|
direction,
|
|
144
296
|
maxDepth,
|
|
145
297
|
includeTests,
|
|
298
|
+
includeContent,
|
|
146
299
|
signal: context?.signal,
|
|
147
300
|
});
|
|
301
|
+
const status = deriveCodeInsightStatus(result);
|
|
302
|
+
const showDelegatedPlan = getBoolean(parsedArgs.delegated_plan, saveToDocs || status === "ambiguous");
|
|
148
303
|
const executionSummary = summarizeExecutions(result.executions.map((item) => ({
|
|
149
304
|
tool: item.tool,
|
|
150
305
|
ok: item.ok,
|
|
151
306
|
text: item.text,
|
|
152
307
|
error: item.error,
|
|
308
|
+
status: item.status,
|
|
153
309
|
})));
|
|
310
|
+
const ambiguityText = formatAmbiguities(result.ambiguities);
|
|
154
311
|
const message = `# code_insight 图谱分析结果
|
|
155
312
|
|
|
156
|
-
状态: ${
|
|
313
|
+
状态: ${formatStatusLabel(status)}
|
|
157
314
|
模式: ${result.modeRequested} -> ${result.modeResolved}
|
|
158
315
|
来源: ${result.provider}
|
|
316
|
+
启动策略: ${result.launcherStrategy}
|
|
159
317
|
工作区: ${result.workspaceMode}
|
|
160
318
|
源目录: ${result.sourceRoot}
|
|
161
319
|
|
|
@@ -165,9 +323,10 @@ ${result.summary}
|
|
|
165
323
|
执行详情:
|
|
166
324
|
${executionSummary}
|
|
167
325
|
|
|
326
|
+
${ambiguityText ? `歧义候选:\n${ambiguityText}\n\n` : ""}\
|
|
168
327
|
${result.warnings.length > 0 ? `警告: ${result.warnings.join(", ")}` : ""}`.trim();
|
|
169
328
|
const structured = {
|
|
170
|
-
status
|
|
329
|
+
status,
|
|
171
330
|
provider: result.provider,
|
|
172
331
|
mode: {
|
|
173
332
|
requested: result.modeRequested,
|
|
@@ -177,85 +336,57 @@ ${result.warnings.length > 0 ? `警告: ${result.warnings.join(", ")}` : ""}`.tr
|
|
|
177
336
|
warnings: result.warnings,
|
|
178
337
|
executions: result.executions,
|
|
179
338
|
repo: result.repo || null,
|
|
339
|
+
launcherStrategy: result.launcherStrategy,
|
|
340
|
+
ambiguities: result.ambiguities,
|
|
180
341
|
workspaceMode: result.workspaceMode,
|
|
181
342
|
sourceRoot: result.sourceRoot,
|
|
182
343
|
analysisRoot: result.analysisRoot,
|
|
183
344
|
pathMapped: result.pathMapped,
|
|
184
345
|
};
|
|
346
|
+
const docsProjectRoot = saveToDocs ? (projectRoot || result.sourceRoot) : "";
|
|
185
347
|
const docsSnapshot = buildProjectDocsOutputs({
|
|
186
|
-
projectRoot:
|
|
348
|
+
projectRoot: docsProjectRoot,
|
|
187
349
|
docsDirName,
|
|
188
350
|
mode,
|
|
189
351
|
structured,
|
|
190
352
|
});
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
projectDocs = {
|
|
196
|
-
docsDir,
|
|
197
|
-
projectContextFilePath: toPosixPath(path.join(path.resolve(projectRoot || result.sourceRoot), docsDirName, "project-context.md")),
|
|
198
|
-
latestMarkdownFilePath: toPosixPath(path.join(docsDir, "latest.md")),
|
|
199
|
-
latestJsonFilePath: toPosixPath(path.join(docsDir, "latest.json")),
|
|
200
|
-
archiveMarkdownFilePath: docsSnapshot.markdownFilePath,
|
|
201
|
-
archiveJsonFilePath: docsSnapshot.jsonFilePath,
|
|
202
|
-
navigationSnippet: `### [代码图谱洞察](./graph-insights/latest.md)
|
|
203
|
-
最近一次 code_insight 分析结果,包含调用链、上下文与影响面摘要
|
|
204
|
-
`,
|
|
205
|
-
devGuideSnippet: `- **代码图谱洞察**: [graph-insights/latest.md](./graph-insights/latest.md) - 需要理解模块依赖、调用链和影响面时优先查看
|
|
206
|
-
`,
|
|
207
|
-
};
|
|
353
|
+
const projectDocs = docsSnapshot
|
|
354
|
+
? createProjectDocsPlan(docsProjectRoot, docsDirName, docsSnapshot)
|
|
355
|
+
: undefined;
|
|
356
|
+
if (projectDocs) {
|
|
208
357
|
structured.projectDocs = projectDocs;
|
|
209
|
-
structured.nextAction = `请按 delegated plan 落盘图谱文档,并更新 ${projectDocs.projectContextFilePath} 的索引入口`;
|
|
210
|
-
persistencePlan = {
|
|
211
|
-
mode: "delegated",
|
|
212
|
-
steps: [
|
|
213
|
-
{
|
|
214
|
-
id: "ensure-project-context",
|
|
215
|
-
action: `检查 ${projectDocs.projectContextFilePath} 是否存在;若不存在,先调用 init_project_context 生成项目上下文索引`,
|
|
216
|
-
outputs: [projectDocs.projectContextFilePath],
|
|
217
|
-
note: "只有 project-context.md 存在,后续图谱文档入口才可持续复用",
|
|
218
|
-
},
|
|
219
|
-
{
|
|
220
|
-
id: "save-latest-md",
|
|
221
|
-
action: `将本次 code_insight 的文本分析结果写入 ${projectDocs.latestMarkdownFilePath}`,
|
|
222
|
-
outputs: [projectDocs.latestMarkdownFilePath],
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
id: "save-archive-md",
|
|
226
|
-
action: `将本次 code_insight 的文本分析结果归档到 ${projectDocs.archiveMarkdownFilePath}`,
|
|
227
|
-
outputs: [projectDocs.archiveMarkdownFilePath],
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
id: "save-latest-json",
|
|
231
|
-
action: `将本次 code_insight 的 structuredContent 写入 ${projectDocs.latestJsonFilePath}`,
|
|
232
|
-
outputs: [projectDocs.latestJsonFilePath],
|
|
233
|
-
note: "建议保留完整结构化结果,便于后续 AI 继续读取",
|
|
234
|
-
},
|
|
235
|
-
{
|
|
236
|
-
id: "save-archive-json",
|
|
237
|
-
action: `将本次 code_insight 的 structuredContent 归档到 ${projectDocs.archiveJsonFilePath}`,
|
|
238
|
-
outputs: [projectDocs.archiveJsonFilePath],
|
|
239
|
-
},
|
|
240
|
-
{
|
|
241
|
-
id: "update-project-context-index",
|
|
242
|
-
action: `更新 ${projectDocs.projectContextFilePath},在“## 📚 文档导航”加入图谱文档入口,并在“## 💡 开发时查看对应文档”加入代码图谱洞察链接`,
|
|
243
|
-
outputs: [projectDocs.projectContextFilePath],
|
|
244
|
-
note: `建议插入内容:\n${projectDocs.navigationSnippet}\n${projectDocs.devGuideSnippet}`,
|
|
245
|
-
},
|
|
246
|
-
],
|
|
247
|
-
};
|
|
248
|
-
structured.plan = persistencePlan;
|
|
249
358
|
}
|
|
250
|
-
|
|
359
|
+
const delegatedPlan = buildCodeInsightDelegatedPlan({
|
|
360
|
+
status,
|
|
361
|
+
ambiguities: result.ambiguities,
|
|
362
|
+
projectDocs,
|
|
363
|
+
showPlan: showDelegatedPlan,
|
|
364
|
+
});
|
|
365
|
+
if (delegatedPlan) {
|
|
366
|
+
structured.plan = delegatedPlan;
|
|
367
|
+
}
|
|
368
|
+
structured.nextAction = delegatedPlan?.kind === "ambiguity"
|
|
369
|
+
? "请先选择 uid 或 file_path 重新调用 code_insight 完成消歧"
|
|
370
|
+
: projectDocs
|
|
371
|
+
? `请按 delegated plan 落盘图谱文档,并更新 ${projectDocs.projectContextFilePath} 的索引入口`
|
|
372
|
+
: null;
|
|
373
|
+
return okStructured(delegatedPlan
|
|
251
374
|
? `${renderOrchestrationHeader({
|
|
252
375
|
tool: "code_insight",
|
|
253
|
-
goal:
|
|
254
|
-
|
|
255
|
-
"
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
376
|
+
goal: delegatedPlan.kind === "ambiguity"
|
|
377
|
+
? "先完成符号消歧,再继续图谱分析"
|
|
378
|
+
: "完成图谱分析后,将结果按 delegated plan 落盘到 docs/graph-insights",
|
|
379
|
+
tasks: delegatedPlan.kind === "ambiguity"
|
|
380
|
+
? [
|
|
381
|
+
"先阅读本次 code_insight 返回的 candidates",
|
|
382
|
+
"使用 uid 或 file_path 重新调用 code_insight",
|
|
383
|
+
"消歧完成后再继续后续分析或文档保存",
|
|
384
|
+
]
|
|
385
|
+
: [
|
|
386
|
+
"先消费本次 code_insight 返回的分析结果",
|
|
387
|
+
"严格按 delegated plan 将 Markdown / JSON 保存到指定路径",
|
|
388
|
+
"不要只口头总结而不写文件",
|
|
389
|
+
],
|
|
259
390
|
notes: [
|
|
260
391
|
`工作区模式: ${result.workspaceMode}`,
|
|
261
392
|
`来源目录: ${result.sourceRoot}`,
|
|
@@ -263,13 +394,15 @@ ${result.warnings.length > 0 ? `警告: ${result.warnings.join(", ")}` : ""}`.tr
|
|
|
263
394
|
})}${message}
|
|
264
395
|
|
|
265
396
|
## delegated plan
|
|
266
|
-
${renderPlanSteps(
|
|
397
|
+
${renderPlanSteps(delegatedPlan.steps)}
|
|
267
398
|
|
|
268
|
-
|
|
399
|
+
${delegatedPlan.kind === "docs" && projectDocs ? `后续操作:
|
|
269
400
|
- 请先确保 ${projectDocs.projectContextFilePath} 可用,并把图谱入口挂到该索引中
|
|
270
401
|
- 请将本次分析保存到 ${projectDocs.latestMarkdownFilePath}
|
|
271
402
|
- 如需归档,请额外保存到 ${projectDocs.archiveMarkdownFilePath}
|
|
272
|
-
- 如需结构化副本,请保存 JSON 到 ${projectDocs.latestJsonFilePath} 或 ${projectDocs.archiveJsonFilePath}`
|
|
403
|
+
- 如需结构化副本,请保存 JSON 到 ${projectDocs.latestJsonFilePath} 或 ${projectDocs.archiveJsonFilePath}` : `后续操作:
|
|
404
|
+
- 请先从 candidates 中选定唯一符号
|
|
405
|
+
- 重新传入 uid 或 file_path 后再继续 context / impact 分析`}`
|
|
273
406
|
: message, structured);
|
|
274
407
|
}
|
|
275
408
|
catch (error) {
|
package/docs/i18n/en.json
CHANGED
|
@@ -87,6 +87,14 @@
|
|
|
87
87
|
"noteText": "Need to manually run",
|
|
88
88
|
"updateText": "to update version"
|
|
89
89
|
},
|
|
90
|
+
"windowsGraph": {
|
|
91
|
+
"title": "Windows Notes for Graph Tools",
|
|
92
|
+
"description": "Graph-aware tools may have a slower first run on Windows because GitNexus is started through npx by default.",
|
|
93
|
+
"item1": "The first cold start may take 20+ seconds while npx checks or downloads dependencies.",
|
|
94
|
+
"item2": "Some GitNexus dependencies use tree-sitter native modules and may require Visual Studio Build Tools.",
|
|
95
|
+
"item3": "If your MCP client supports env, prefer a preinstalled gitnexus CLI and raise GitNexus timeouts.",
|
|
96
|
+
"exampleTitle": "Example using a preinstalled gitnexus CLI:"
|
|
97
|
+
},
|
|
90
98
|
"source": {
|
|
91
99
|
"title": "Build from Source",
|
|
92
100
|
"description": "Build from source code, suitable for developers:",
|
|
@@ -165,6 +173,18 @@
|
|
|
165
173
|
"step2": "If below v16, please upgrade Node.js",
|
|
166
174
|
"step3": "Clear cache and reinstall:",
|
|
167
175
|
"step4": "Check if configuration file JSON format is correct"
|
|
176
|
+
},
|
|
177
|
+
"q3": {
|
|
178
|
+
"title": "Issue 3: Graph-aware tools are slow or time out on first run on Windows",
|
|
179
|
+
"affected": "Affected tools:",
|
|
180
|
+
"error": "Typical error:",
|
|
181
|
+
"reasons": "Common causes:",
|
|
182
|
+
"reason1": "`npx -y gitnexus@latest mcp` may spend 20+ seconds checking or downloading dependencies on cold start.",
|
|
183
|
+
"reason2": "GitNexus depends on tree-sitter native modules, which may require Visual Studio Build Tools on Windows.",
|
|
184
|
+
"solution": "Recommended actions:",
|
|
185
|
+
"step1": "Install Visual Studio Build Tools with the C++ workload.",
|
|
186
|
+
"step2": "Retry once after dependencies finish installing so the first cold start is not mistaken for steady-state latency.",
|
|
187
|
+
"step3": "If your client supports env, prefer a preinstalled gitnexus CLI and raise MCP_GITNEXUS_CONNECT_TIMEOUT_MS plus MCP_GITNEXUS_TIMEOUT_MS."
|
|
168
188
|
}
|
|
169
189
|
},
|
|
170
190
|
"common": {
|
package/docs/i18n/ja.json
CHANGED
|
@@ -87,6 +87,14 @@
|
|
|
87
87
|
"noteText": "手動で実行する必要があります",
|
|
88
88
|
"updateText": "バージョンを更新"
|
|
89
89
|
},
|
|
90
|
+
"windowsGraph": {
|
|
91
|
+
"title": "Windows 向けグラフツール補足",
|
|
92
|
+
"description": "グラフ関連ツールは、GitNexus を既定で npx 経由で起動するため、Windows では初回起動が遅くなる場合があります。",
|
|
93
|
+
"item1": "初回のコールドスタートでは、npx が依存関係を確認またはダウンロードするため 20 秒以上かかることがあります。",
|
|
94
|
+
"item2": "GitNexus の一部依存関係は tree-sitter ネイティブモジュールを使用しており、Windows では Visual Studio Build Tools が必要になる場合があります。",
|
|
95
|
+
"item3": "MCP クライアントが env をサポートしている場合は、プリインストール済みの gitnexus CLI を優先し、GitNexus のタイムアウトを引き上げてください。",
|
|
96
|
+
"exampleTitle": "プリインストール済み gitnexus CLI を使う設定例:"
|
|
97
|
+
},
|
|
90
98
|
"source": {
|
|
91
99
|
"title": "ソースからビルド",
|
|
92
100
|
"description": "ソースコードからビルド、開発者向け:",
|
|
@@ -165,6 +173,18 @@
|
|
|
165
173
|
"step2": "v16未満の場合、Node.jsをアップグレードしてください",
|
|
166
174
|
"step3": "キャッシュをクリアして再インストール:",
|
|
167
175
|
"step4": "設定ファイルのJSON形式が正しいか確認"
|
|
176
|
+
},
|
|
177
|
+
"q3": {
|
|
178
|
+
"title": "問題3:Windows でグラフツールの初回起動が遅い、またはタイムアウトする",
|
|
179
|
+
"affected": "影響を受けるツール:",
|
|
180
|
+
"error": "典型的なエラー:",
|
|
181
|
+
"reasons": "よくある原因:",
|
|
182
|
+
"reason1": "`npx -y gitnexus@latest mcp` はコールドスタートのため、初回は依存関係の確認やダウンロードに 20 秒以上かかることがあります。",
|
|
183
|
+
"reason2": "GitNexus が依存する tree-sitter ネイティブモジュールは、Windows で Visual Studio Build Tools を必要とする場合があります。",
|
|
184
|
+
"solution": "推奨対応:",
|
|
185
|
+
"step1": "C++ ワークロード付きの Visual Studio Build Tools をインストールしてください。",
|
|
186
|
+
"step2": "依存関係のインストール完了後にもう一度実行し、初回のコールドスタートを通常レイテンシと混同しないでください。",
|
|
187
|
+
"step3": "クライアントが env をサポートしている場合は、プリインストール済みの gitnexus CLI を優先し、MCP_GITNEXUS_CONNECT_TIMEOUT_MS と MCP_GITNEXUS_TIMEOUT_MS を引き上げてください。"
|
|
168
188
|
}
|
|
169
189
|
},
|
|
170
190
|
"common": {
|
package/docs/i18n/ko.json
CHANGED
|
@@ -87,6 +87,14 @@
|
|
|
87
87
|
"noteText": "수동으로 실행 필요",
|
|
88
88
|
"updateText": "버전 업데이트"
|
|
89
89
|
},
|
|
90
|
+
"windowsGraph": {
|
|
91
|
+
"title": "Windows 그래프 도구 안내",
|
|
92
|
+
"description": "그래프 관련 도구는 기본적으로 GitNexus 를 npx 로 시작하므로 Windows 에서 첫 실행이 느릴 수 있습니다.",
|
|
93
|
+
"item1": "첫 콜드 스타트에서는 npx 가 의존성을 확인하거나 다운로드하므로 20초 이상 걸릴 수 있습니다.",
|
|
94
|
+
"item2": "GitNexus 의 일부 의존성은 tree-sitter 네이티브 모듈을 사용하며 Windows 에서는 Visual Studio Build Tools 가 필요할 수 있습니다.",
|
|
95
|
+
"item3": "MCP 클라이언트가 env 를 지원하면, 미리 설치한 gitnexus CLI 를 우선 사용하고 GitNexus 타임아웃을 늘리세요.",
|
|
96
|
+
"exampleTitle": "미리 설치한 gitnexus CLI 를 사용하는 구성 예시:"
|
|
97
|
+
},
|
|
90
98
|
"source": {
|
|
91
99
|
"title": "소스에서 빌드",
|
|
92
100
|
"description": "소스 코드에서 빌드, 개발자용:",
|
|
@@ -165,6 +173,18 @@
|
|
|
165
173
|
"step2": "v16 미만인 경우 Node.js를 업그레이드하세요",
|
|
166
174
|
"step3": "캐시 지우기 및 재설치:",
|
|
167
175
|
"step4": "구성 파일 JSON 형식이 올바른지 확인"
|
|
176
|
+
},
|
|
177
|
+
"q3": {
|
|
178
|
+
"title": "문제 3:Windows 에서 그래프 도구의 첫 실행이 느리거나 시간 초과됨",
|
|
179
|
+
"affected": "영향받는 도구:",
|
|
180
|
+
"error": "대표 오류:",
|
|
181
|
+
"reasons": "주요 원인:",
|
|
182
|
+
"reason1": "`npx -y gitnexus@latest mcp` 는 콜드 스타트이므로 첫 실행 시 의존성 확인 또는 다운로드에 20초 이상 걸릴 수 있습니다.",
|
|
183
|
+
"reason2": "GitNexus 가 의존하는 tree-sitter 네이티브 모듈은 Windows 에서 Visual Studio Build Tools 가 필요할 수 있습니다.",
|
|
184
|
+
"solution": "권장 조치:",
|
|
185
|
+
"step1": "C++ 워크로드가 포함된 Visual Studio Build Tools 를 설치하세요.",
|
|
186
|
+
"step2": "의존성 설치가 끝난 뒤 다시 한 번 실행해서 첫 콜드 스타트를 정상 지연과 구분하세요.",
|
|
187
|
+
"step3": "클라이언트가 env 를 지원하면 미리 설치한 gitnexus CLI 를 우선 사용하고 MCP_GITNEXUS_CONNECT_TIMEOUT_MS 와 MCP_GITNEXUS_TIMEOUT_MS 를 늘리세요."
|
|
168
188
|
}
|
|
169
189
|
},
|
|
170
190
|
"common": {
|
package/docs/i18n/zh-CN.json
CHANGED
|
@@ -87,6 +87,14 @@
|
|
|
87
87
|
"noteText": "需要手动运行",
|
|
88
88
|
"updateText": "更新版本"
|
|
89
89
|
},
|
|
90
|
+
"windowsGraph": {
|
|
91
|
+
"title": "Windows 图谱工具特别说明",
|
|
92
|
+
"description": "图谱相关工具在 Windows 上首次运行可能更慢,因为 GitNexus 默认通过 npx 启动。",
|
|
93
|
+
"item1": "首次冷启动时,npx 可能检查或下载依赖,耗时可能超过 20 秒。",
|
|
94
|
+
"item2": "GitNexus 的部分依赖使用 tree-sitter 原生模块,在 Windows 上可能需要 Visual Studio Build Tools。",
|
|
95
|
+
"item3": "如果 MCP 客户端支持 env,优先使用预装的 gitnexus CLI,并适当增大 GitNexus 超时。",
|
|
96
|
+
"exampleTitle": "使用预装 gitnexus CLI 的配置示例:"
|
|
97
|
+
},
|
|
90
98
|
"source": {
|
|
91
99
|
"title": "源码编译",
|
|
92
100
|
"description": "从源码编译安装,适合开发者:",
|
|
@@ -165,6 +173,18 @@
|
|
|
165
173
|
"step2": "如果低于 v16,请升级 Node.js",
|
|
166
174
|
"step3": "清理缓存并重新安装:",
|
|
167
175
|
"step4": "检查配置文件 JSON 格式是否正确"
|
|
176
|
+
},
|
|
177
|
+
"q3": {
|
|
178
|
+
"title": "问题 3:Windows 下图谱工具首次启动很慢或超时",
|
|
179
|
+
"affected": "受影响工具:",
|
|
180
|
+
"error": "典型错误:",
|
|
181
|
+
"reasons": "常见原因:",
|
|
182
|
+
"reason1": "`npx -y gitnexus@latest mcp` 冷启动时可能花 20 秒以上检查或下载依赖。",
|
|
183
|
+
"reason2": "GitNexus 依赖的 tree-sitter 原生模块在 Windows 上可能需要 Visual Studio Build Tools。",
|
|
184
|
+
"solution": "建议处理:",
|
|
185
|
+
"step1": "安装带 C++ 工作负载的 Visual Studio Build Tools。",
|
|
186
|
+
"step2": "依赖安装完成后重试一次,避免把首次冷启动误判为稳定耗时。",
|
|
187
|
+
"step3": "如果客户端支持 env,优先使用预装的 gitnexus CLI,并增大 MCP_GITNEXUS_CONNECT_TIMEOUT_MS 与 MCP_GITNEXUS_TIMEOUT_MS。"
|
|
168
188
|
}
|
|
169
189
|
},
|
|
170
190
|
"common": {
|
|
@@ -308,9 +308,39 @@ npm run build</code></pre>
|
|
|
308
308
|
<strong data-i18n="gettingStarted.step1.source.note">注意:</strong><span data-i18n="gettingStarted.step1.source.noteText">修改代码后需要重新运行</span> <code class="bg-gray-200 px-1 rounded text-xs">npm run build</code> <span data-i18n="gettingStarted.step1.source.compileText">编译</span>
|
|
309
309
|
</div>
|
|
310
310
|
</div>
|
|
311
|
-
</div>
|
|
312
|
-
|
|
313
|
-
|
|
311
|
+
</div>
|
|
312
|
+
|
|
313
|
+
<div class="mt-5 p-4 bg-blue-50 border-l-4 border-blue-500 rounded-r text-sm text-text-primary">
|
|
314
|
+
<h3 class="font-semibold mb-2" data-i18n="gettingStarted.step1.windowsGraph.title">Windows Notes for Graph Tools</h3>
|
|
315
|
+
<p class="mb-2 text-text-secondary" data-i18n="gettingStarted.step1.windowsGraph.description">Graph-aware tools may have a slower first run on Windows because GitNexus is started through npx by default.</p>
|
|
316
|
+
<ul class="list-disc list-inside space-y-1 mb-3">
|
|
317
|
+
<li data-i18n="gettingStarted.step1.windowsGraph.item1">The first cold start may take 20+ seconds while npx checks or downloads dependencies.</li>
|
|
318
|
+
<li data-i18n="gettingStarted.step1.windowsGraph.item2">Some GitNexus dependencies use tree-sitter native modules and may require Visual Studio Build Tools.</li>
|
|
319
|
+
<li data-i18n="gettingStarted.step1.windowsGraph.item3">If your MCP client supports env, prefer a preinstalled gitnexus CLI and raise GitNexus timeouts.</li>
|
|
320
|
+
</ul>
|
|
321
|
+
<p class="mb-2" data-i18n="gettingStarted.step1.windowsGraph.exampleTitle">Example using a preinstalled gitnexus CLI:</p>
|
|
322
|
+
<div class="bg-slate-900 rounded-lg overflow-hidden">
|
|
323
|
+
<div class="flex items-center justify-between px-3 py-2 bg-slate-800">
|
|
324
|
+
<span class="text-xs text-slate-300 font-medium">JSON</span>
|
|
325
|
+
<button onclick="copyCode(this)" class="text-xs text-slate-300 hover:text-white transition-colors">📋</button>
|
|
326
|
+
</div>
|
|
327
|
+
<pre class="code-block p-3 text-sm text-slate-200 overflow-x-auto"><code>{
|
|
328
|
+
"mcpServers": {
|
|
329
|
+
"mcp-probe-kit": {
|
|
330
|
+
"command": "mcp-probe-kit",
|
|
331
|
+
"env": {
|
|
332
|
+
"MCP_GITNEXUS_COMMAND": "gitnexus",
|
|
333
|
+
"MCP_GITNEXUS_ARGS": "mcp",
|
|
334
|
+
"MCP_GITNEXUS_CONNECT_TIMEOUT_MS": "30000",
|
|
335
|
+
"MCP_GITNEXUS_TIMEOUT_MS": "45000"
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}</code></pre>
|
|
340
|
+
</div>
|
|
341
|
+
</div>
|
|
342
|
+
</div>
|
|
343
|
+
</section>
|
|
314
344
|
|
|
315
345
|
<!-- Step 2: 配置文件位置 -->
|
|
316
346
|
<section class="bg-white rounded-xl border border-border p-4 sm:p-6 mb-6 shadow-sm">
|
|
@@ -493,9 +523,9 @@ npm run build</code></pre>
|
|
|
493
523
|
</div>
|
|
494
524
|
|
|
495
525
|
<!-- 问题 2 -->
|
|
496
|
-
<div class="border border-border rounded-lg overflow-hidden">
|
|
497
|
-
<button onclick="toggleFaq('faq2')" class="w-full px-4 py-3 bg-bg-page flex items-center justify-between text-left hover:bg-gray-100 transition-colors">
|
|
498
|
-
<span class="font-medium text-text-primary" data-i18n="gettingStarted.faq.q2.title">问题 2:MCP 服务器连接失败</span>
|
|
526
|
+
<div class="border border-border rounded-lg overflow-hidden">
|
|
527
|
+
<button onclick="toggleFaq('faq2')" class="w-full px-4 py-3 bg-bg-page flex items-center justify-between text-left hover:bg-gray-100 transition-colors">
|
|
528
|
+
<span class="font-medium text-text-primary" data-i18n="gettingStarted.faq.q2.title">问题 2:MCP 服务器连接失败</span>
|
|
499
529
|
<svg class="w-5 h-5 text-text-tertiary transition-transform" id="faq2-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
500
530
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"/>
|
|
501
531
|
</svg>
|
|
@@ -523,10 +553,41 @@ npm run build</code></pre>
|
|
|
523
553
|
</div>
|
|
524
554
|
</li>
|
|
525
555
|
<li data-i18n="gettingStarted.faq.q2.step4">检查配置文件 JSON 格式是否正确</li>
|
|
526
|
-
</ol>
|
|
527
|
-
</div>
|
|
528
|
-
</div>
|
|
529
|
-
|
|
556
|
+
</ol>
|
|
557
|
+
</div>
|
|
558
|
+
</div>
|
|
559
|
+
|
|
560
|
+
<div class="border border-border rounded-lg overflow-hidden mt-4">
|
|
561
|
+
<button onclick="toggleFaq('faq3')" class="w-full px-4 py-3 bg-bg-page flex items-center justify-between text-left hover:bg-gray-100 transition-colors">
|
|
562
|
+
<span class="font-medium text-text-primary" data-i18n="gettingStarted.faq.q3.title">问题 3:Windows 下图谱工具首次启动很慢或超时</span>
|
|
563
|
+
<svg class="w-5 h-5 text-text-tertiary transition-transform" id="faq3-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
564
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"/>
|
|
565
|
+
</svg>
|
|
566
|
+
</button>
|
|
567
|
+
<div id="faq3-content" class="hidden p-4 border-t border-border">
|
|
568
|
+
<div class="p-3 bg-yellow-50 border-l-3 border-yellow-500 rounded-r text-sm text-text-primary mb-3">
|
|
569
|
+
<strong data-i18n="gettingStarted.faq.q3.affected">Affected tools:</strong>
|
|
570
|
+
<div class="mt-1"><code class="bg-gray-200 px-1 rounded text-xs">code_insight</code>, <code class="bg-gray-200 px-1 rounded text-xs">start_feature</code>, <code class="bg-gray-200 px-1 rounded text-xs">start_bugfix</code>, <code class="bg-gray-200 px-1 rounded text-xs">init_project_context</code></div>
|
|
571
|
+
</div>
|
|
572
|
+
<div class="p-3 bg-red-50 border-l-3 border-red-500 rounded-r text-sm text-text-primary mb-3">
|
|
573
|
+
<strong data-i18n="gettingStarted.faq.q3.error">Typical error:</strong>
|
|
574
|
+
<pre class="code-block mt-2 text-xs text-slate-200 bg-slate-900 p-2 rounded overflow-x-auto"><code>gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use
|
|
575
|
+
gyp ERR! find VS - missing any VC++ toolset</code></pre>
|
|
576
|
+
</div>
|
|
577
|
+
<p class="text-sm text-text-primary mb-2"><strong data-i18n="gettingStarted.faq.q3.reasons">Common causes:</strong></p>
|
|
578
|
+
<ul class="list-disc list-inside space-y-1 text-sm text-text-primary mb-3">
|
|
579
|
+
<li data-i18n="gettingStarted.faq.q3.reason1">npx -y gitnexus@latest mcp may spend 20+ seconds checking or downloading dependencies on cold start.</li>
|
|
580
|
+
<li data-i18n="gettingStarted.faq.q3.reason2">GitNexus depends on tree-sitter native modules, which may require Visual Studio Build Tools on Windows.</li>
|
|
581
|
+
</ul>
|
|
582
|
+
<p class="text-sm text-text-primary mb-2"><strong data-i18n="gettingStarted.faq.q3.solution">Recommended actions:</strong></p>
|
|
583
|
+
<ol class="list-decimal list-inside space-y-2 text-sm text-text-primary">
|
|
584
|
+
<li data-i18n="gettingStarted.faq.q3.step1">Install Visual Studio Build Tools with the C++ workload.</li>
|
|
585
|
+
<li data-i18n="gettingStarted.faq.q3.step2">Retry once after dependencies finish installing so the first cold start is not mistaken for steady-state latency.</li>
|
|
586
|
+
<li data-i18n="gettingStarted.faq.q3.step3">If your client supports env, prefer a preinstalled gitnexus CLI and raise MCP_GITNEXUS_CONNECT_TIMEOUT_MS plus MCP_GITNEXUS_TIMEOUT_MS.</li>
|
|
587
|
+
</ol>
|
|
588
|
+
</div>
|
|
589
|
+
</div>
|
|
590
|
+
</section>
|
|
530
591
|
|
|
531
592
|
<!-- Footer -->
|
|
532
593
|
<footer class="text-center text-sm text-text-tertiary py-4 border-t border-border">
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-probe-kit",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.13",
|
|
4
4
|
"description": "AI-Powered Development Toolkit - MCP Server with 22 tools covering code quality, development efficiency, project management, and UI/UX design. Features: Structured Output, Workflow Orchestration, UI/UX Pro Max, and Requirements Interview.",
|
|
5
5
|
"mcpName": "io.github.mybolide/mcp-probe-kit",
|
|
6
6
|
"type": "module",
|