mcp-probe-kit 3.3.0 → 3.6.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/README.md +15 -7
- package/build/index.js +45 -79
- package/build/lib/__tests__/agents-md-template.unit.test.js +1 -0
- package/build/lib/__tests__/dev-workflow.unit.test.d.ts +1 -0
- package/build/lib/__tests__/dev-workflow.unit.test.js +22 -0
- package/build/lib/__tests__/handles.unit.test.d.ts +1 -0
- package/build/lib/__tests__/handles.unit.test.js +19 -0
- package/build/lib/__tests__/mcp-apps.unit.test.d.ts +1 -0
- package/build/lib/__tests__/mcp-apps.unit.test.js +52 -0
- package/build/lib/__tests__/mcp-tool-skill-registry.unit.test.d.ts +1 -0
- package/build/lib/__tests__/mcp-tool-skill-registry.unit.test.js +18 -0
- package/build/lib/__tests__/memory-client.unit.test.js +105 -0
- package/build/lib/__tests__/spec-gate.unit.test.d.ts +1 -0
- package/build/lib/__tests__/spec-gate.unit.test.js +54 -0
- package/build/lib/__tests__/task-defaults.unit.test.d.ts +1 -0
- package/build/lib/__tests__/task-defaults.unit.test.js +27 -0
- package/build/lib/__tests__/workflow-skill-installer.unit.test.d.ts +1 -0
- package/build/lib/__tests__/workflow-skill-installer.unit.test.js +110 -0
- package/build/lib/agents-md-template.js +10 -2
- package/build/lib/dev-workflow.d.ts +36 -0
- package/build/lib/dev-workflow.js +497 -0
- package/build/lib/handles.d.ts +31 -0
- package/build/lib/handles.js +36 -0
- package/build/lib/mcp-apps.d.ts +14 -0
- package/build/lib/mcp-apps.js +234 -0
- package/build/lib/mcp-tool-skill-registry.d.ts +46 -0
- package/build/lib/mcp-tool-skill-registry.js +256 -0
- package/build/lib/memory-client.d.ts +19 -0
- package/build/lib/memory-client.js +69 -0
- package/build/lib/memory-orchestration.d.ts +5 -0
- package/build/lib/memory-orchestration.js +20 -0
- package/build/lib/merge-agents-md.d.ts +2 -2
- package/build/lib/merge-agents-md.js +7 -4
- package/build/lib/output-schema-registry.d.ts +11 -0
- package/build/lib/output-schema-registry.js +80 -0
- package/build/lib/spec-gate.d.ts +32 -0
- package/build/lib/spec-gate.js +83 -0
- package/build/lib/task-defaults.d.ts +6 -0
- package/build/lib/task-defaults.js +20 -0
- package/build/lib/tool-annotations.js +3 -0
- package/build/lib/toolset-manager.js +2 -0
- package/build/lib/workflow-skill-installer.d.ts +38 -0
- package/build/lib/workflow-skill-installer.js +158 -0
- package/build/lib/workflow-skill-template.d.ts +9 -0
- package/build/lib/workflow-skill-template.js +85 -0
- package/build/lib/workflow-skill-version.d.ts +15 -0
- package/build/lib/workflow-skill-version.js +68 -0
- package/build/schemas/index.d.ts +110 -0
- package/build/schemas/index.js +1 -0
- package/build/schemas/memory-tools.d.ts +83 -0
- package/build/schemas/memory-tools.js +43 -0
- package/build/schemas/orchestration-tools.d.ts +8 -0
- package/build/schemas/orchestration-tools.js +8 -0
- package/build/schemas/output/code-insight-tools.d.ts +65 -0
- package/build/schemas/output/code-insight-tools.js +42 -0
- package/build/schemas/output/memory-tools.d.ts +576 -0
- package/build/schemas/output/memory-tools.js +148 -0
- package/build/schemas/project-tools.d.ts +19 -0
- package/build/schemas/project-tools.js +20 -0
- package/build/tools/__tests__/delete_memory_asset.unit.test.d.ts +1 -0
- package/build/tools/__tests__/delete_memory_asset.unit.test.js +87 -0
- package/build/tools/__tests__/search_memory.unit.test.js +1 -0
- package/build/tools/__tests__/start_bugfix.unit.test.js +34 -1
- package/build/tools/__tests__/update_memory_asset.unit.test.d.ts +1 -0
- package/build/tools/__tests__/update_memory_asset.unit.test.js +82 -0
- package/build/tools/__tests__/workflow.unit.test.d.ts +1 -0
- package/build/tools/__tests__/workflow.unit.test.js +24 -0
- package/build/tools/code_insight.js +5 -1
- package/build/tools/delete_memory_asset.d.ts +7 -0
- package/build/tools/delete_memory_asset.js +57 -0
- package/build/tools/index.d.ts +3 -0
- package/build/tools/index.js +3 -0
- package/build/tools/search_memory.js +5 -2
- package/build/tools/start_bugfix.js +37 -4
- package/build/tools/start_feature.js +4 -3
- package/build/tools/start_ui.js +5 -4
- package/build/tools/update_memory_asset.d.ts +7 -0
- package/build/tools/update_memory_asset.js +98 -0
- package/build/tools/workflow.d.ts +13 -0
- package/build/tools/workflow.js +69 -0
- package/package.json +5 -3
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import * as fs from "node:fs";
|
|
2
2
|
import { parseArgs, getString, getNumber } from "../utils/parseArgs.js";
|
|
3
3
|
import { okStructured } from "../lib/response.js";
|
|
4
|
+
import { attachHandles } from "../lib/handles.js";
|
|
4
5
|
import { renderOrchestrationHeader } from "../lib/orchestration-guidance.js";
|
|
5
6
|
import { BugFixReportSchema, RequirementsLoopSchema } from "../schemas/structured-output.js";
|
|
6
7
|
import { reportToolProgress, throwIfAborted, } from "../lib/tool-execution-context.js";
|
|
7
8
|
import { buildBugfixGraphContext } from "../lib/gitnexus-bridge.js";
|
|
8
|
-
import { buildMemoryPlanStep, loadMemoryInjectionContext, renderMemoryGuideSection, } from "../lib/memory-orchestration.js";
|
|
9
|
+
import { buildMemoryPlanStep, loadMemoryInjectionContext, renderMemoryGuideSection, buildOrchestrationHandles, } from "../lib/memory-orchestration.js";
|
|
9
10
|
import { resolveWorkspaceRoot, isLikelyProjectNamedRelativePath, buildProjectRootRetryHint } from "../lib/workspace-root.js";
|
|
10
11
|
import { layoutAbsPath, parseLayoutArgsFromRecord, resolveProjectContextLayout, } from "../lib/project-context-layout.js";
|
|
12
|
+
import { buildCheckSpecPlanStep, renderSpecGatePromptSection, resolveBugfixSpecGate, } from "../lib/spec-gate.js";
|
|
11
13
|
function decideTemplateProfile(description) {
|
|
12
14
|
const text = description || '';
|
|
13
15
|
const lengthScore = text.length >= 200 ? 2 : text.length >= 120 ? 1 : 0;
|
|
@@ -120,6 +122,8 @@ const PROMPT_TEMPLATE_GUIDED = `# 🐛 Bug 修复编排指南(TBP 8 步真因
|
|
|
120
122
|
|
|
121
123
|
**产出**: 测试代码
|
|
122
124
|
|
|
125
|
+
{spec_gate_section}
|
|
126
|
+
|
|
123
127
|
---
|
|
124
128
|
|
|
125
129
|
## ✅ 完成检查
|
|
@@ -177,6 +181,7 @@ const PROMPT_TEMPLATE_STRICT = `# 🐛 Bug 修复编排(严格 | TBP 8 步)
|
|
|
177
181
|
"framework": "[根据项目上下文选择: jest/vitest/mocha]"
|
|
178
182
|
}
|
|
179
183
|
\`\`\`
|
|
184
|
+
{spec_gate_section}
|
|
180
185
|
|
|
181
186
|
---
|
|
182
187
|
|
|
@@ -307,6 +312,8 @@ export async function startBugfix(args, context) {
|
|
|
307
312
|
stack_trace: ["stack", "trace", "堆栈", "调用栈"],
|
|
308
313
|
code_context: ["code_context", "code", "context", "相关代码", "代码上下文"],
|
|
309
314
|
project_root: ["projectRoot", "project_path", "projectPath", "root", "project_root", "项目路径", "项目根目录"],
|
|
315
|
+
docs_dir: ["dir", "output", "目录", "文档目录"],
|
|
316
|
+
feature_name: ["name", "feature", "spec", "功能名", "功能名称", "规格"],
|
|
310
317
|
analysis_mode: ["analysis_mode", "methodology", "rca", "tbp", "分析方法"],
|
|
311
318
|
template_profile: ["profile", "template_profile", "模板档位", "模板模式"],
|
|
312
319
|
requirements_mode: ["mode", "requirements_mode", "loop", "需求模式"],
|
|
@@ -320,6 +327,7 @@ export async function startBugfix(args, context) {
|
|
|
320
327
|
const codeContext = getString(parsedArgs.code_context);
|
|
321
328
|
const projectRoot = getString(parsedArgs.project_root);
|
|
322
329
|
const docsDir = getString(parsedArgs.docs_dir) || "docs";
|
|
330
|
+
const featureNameInput = getString(parsedArgs.feature_name);
|
|
323
331
|
if (isLikelyProjectNamedRelativePath(projectRoot)) {
|
|
324
332
|
return {
|
|
325
333
|
content: [{
|
|
@@ -388,6 +396,18 @@ export async function startBugfix(args, context) {
|
|
|
388
396
|
layoutManifest: layout.manifestPath,
|
|
389
397
|
};
|
|
390
398
|
const graphDocsMissing = !bootstrapState.latestMarkdownExists || !bootstrapState.latestJsonExists;
|
|
399
|
+
const specGate = resolveBugfixSpecGate({
|
|
400
|
+
featureName: featureNameInput,
|
|
401
|
+
projectRoot: layout.projectRoot,
|
|
402
|
+
docsDir,
|
|
403
|
+
hintText: combinedText,
|
|
404
|
+
});
|
|
405
|
+
const specGateSection = specGate ? renderSpecGatePromptSection(specGate) : '';
|
|
406
|
+
if (specGate) {
|
|
407
|
+
headerNotes.push(specGate.detected
|
|
408
|
+
? `规格闸门: 已自动关联 ${specGate.specDir}/,修复后需 check_spec`
|
|
409
|
+
: `规格闸门: 关联 ${specGate.specDir}/,修复后需 check_spec`);
|
|
410
|
+
}
|
|
391
411
|
const graphContext = await buildBugfixGraphContext({
|
|
392
412
|
errorMessage,
|
|
393
413
|
stackTrace,
|
|
@@ -571,7 +591,7 @@ ${graphContext.highlights.length > 0
|
|
|
571
591
|
},
|
|
572
592
|
};
|
|
573
593
|
await reportToolProgress(context, 95, "start_bugfix: loop 输出已生成");
|
|
574
|
-
return okStructured(guide, loopReport, {
|
|
594
|
+
return okStructured(guide, attachHandles(loopReport, buildOrchestrationHandles(memoryContext)), {
|
|
575
595
|
schema: RequirementsLoopSchema,
|
|
576
596
|
note: 'AI 应按轮次澄清 Bug 需求并更新结构化输出,满足结束条件后再进入 fix_bug / gentest',
|
|
577
597
|
});
|
|
@@ -598,7 +618,8 @@ ${graphContext.highlights.length > 0
|
|
|
598
618
|
.replace(/{error_message}/g, errorMessage)
|
|
599
619
|
.replace(/{stack_trace}/g, stackTrace)
|
|
600
620
|
.replace(/{analysis_mode}/g, analysisMode)
|
|
601
|
-
.replace(/{stack_trace_section}/g, stackTraceSection)
|
|
621
|
+
.replace(/{stack_trace_section}/g, stackTraceSection)
|
|
622
|
+
.replace(/{spec_gate_section}/g, specGateSection);
|
|
602
623
|
const guide = header + memoryGuideSection + renderedPrompt + graphGuideSection;
|
|
603
624
|
const plan = {
|
|
604
625
|
mode: 'delegated',
|
|
@@ -635,6 +656,7 @@ ${graphContext.highlights.length > 0
|
|
|
635
656
|
},
|
|
636
657
|
outputs: [],
|
|
637
658
|
},
|
|
659
|
+
...(specGate ? [buildCheckSpecPlanStep(specGate.featureName, specGate.docsDir)] : []),
|
|
638
660
|
...(memoryContext.enabled ? [buildMemoryPlanStep('bugfix')] : []),
|
|
639
661
|
],
|
|
640
662
|
};
|
|
@@ -659,6 +681,13 @@ ${graphContext.highlights.length > 0
|
|
|
659
681
|
status: 'pending',
|
|
660
682
|
description: '调用 gentest 工具生成测试用例',
|
|
661
683
|
},
|
|
684
|
+
...(specGate
|
|
685
|
+
? [{
|
|
686
|
+
name: '规格闸门校验',
|
|
687
|
+
status: 'pending',
|
|
688
|
+
description: `修复后调用 check_spec 校验 ${specGate.specDir}/`,
|
|
689
|
+
}]
|
|
690
|
+
: []),
|
|
662
691
|
],
|
|
663
692
|
artifacts: [],
|
|
664
693
|
nextSteps: [
|
|
@@ -670,6 +699,9 @@ ${graphContext.highlights.length > 0
|
|
|
670
699
|
'调用 fix_bug 工具分析问题并形成因果句真因',
|
|
671
700
|
'调用 gentest 工具生成回归测试',
|
|
672
701
|
'运行测试验证修复',
|
|
702
|
+
...(specGate
|
|
703
|
+
? [`修复后调用 check_spec 校验 ${specGate.specDir}/,未通过先补规格再重跑`]
|
|
704
|
+
: []),
|
|
673
705
|
],
|
|
674
706
|
rootCause: '待分析(需要调用 fix_bug 工具)',
|
|
675
707
|
fixPlan: '待制定(需要调用 fix_bug 工具)',
|
|
@@ -709,10 +741,11 @@ ${graphContext.highlights.length > 0
|
|
|
709
741
|
graphDocsMissing,
|
|
710
742
|
},
|
|
711
743
|
graphContext,
|
|
744
|
+
...(specGate ? { specGate } : {}),
|
|
712
745
|
},
|
|
713
746
|
};
|
|
714
747
|
await reportToolProgress(context, 95, "start_bugfix: 执行计划输出已生成");
|
|
715
|
-
return okStructured(guide, bugfixReport, {
|
|
748
|
+
return okStructured(guide, attachHandles(bugfixReport, buildOrchestrationHandles(memoryContext)), {
|
|
716
749
|
schema: BugFixReportSchema,
|
|
717
750
|
note: 'AI 应该按照指南执行步骤,并在每个步骤完成后更新 structuredContent 中的状态',
|
|
718
751
|
});
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import * as fs from "node:fs";
|
|
2
2
|
import { parseArgs, getString, getNumber } from "../utils/parseArgs.js";
|
|
3
3
|
import { okStructured } from "../lib/response.js";
|
|
4
|
+
import { attachHandles } from "../lib/handles.js";
|
|
4
5
|
import { renderOrchestrationHeader } from "../lib/orchestration-guidance.js";
|
|
5
6
|
import { FeatureReportSchema, RequirementsLoopSchema } from "../schemas/structured-output.js";
|
|
6
7
|
import { reportToolProgress, throwIfAborted, } from "../lib/tool-execution-context.js";
|
|
7
8
|
import { buildFeatureGraphContext } from "../lib/gitnexus-bridge.js";
|
|
8
|
-
import { buildMemoryPlanStep, loadMemoryInjectionContext, renderMemoryGuideSection, } from "../lib/memory-orchestration.js";
|
|
9
|
+
import { buildMemoryPlanStep, loadMemoryInjectionContext, renderMemoryGuideSection, buildOrchestrationHandles, } from "../lib/memory-orchestration.js";
|
|
9
10
|
import { resolveWorkspaceRoot, toWorkspacePath, isLikelyProjectNamedRelativePath, buildProjectRootRetryHint } from "../lib/workspace-root.js";
|
|
10
11
|
import { layoutAbsPath, parseLayoutArgsFromRecord, resolveProjectContextLayout, } from "../lib/project-context-layout.js";
|
|
11
12
|
/**
|
|
@@ -463,7 +464,7 @@ ${graphContext.highlights.length > 0
|
|
|
463
464
|
},
|
|
464
465
|
};
|
|
465
466
|
await reportToolProgress(context, 95, "start_feature: loop 输出已生成");
|
|
466
|
-
return okStructured(guide, loopReport, {
|
|
467
|
+
return okStructured(guide, attachHandles(loopReport, buildOrchestrationHandles(memoryContext)), {
|
|
467
468
|
schema: RequirementsLoopSchema,
|
|
468
469
|
note: 'AI 应按轮次澄清需求并更新结构化输出,满足结束条件后再进入 add_feature / estimate',
|
|
469
470
|
});
|
|
@@ -595,7 +596,7 @@ ${graphContext.highlights.length > 0
|
|
|
595
596
|
},
|
|
596
597
|
};
|
|
597
598
|
await reportToolProgress(context, 95, "start_feature: 执行计划输出已生成");
|
|
598
|
-
return okStructured(guide, featureReport, {
|
|
599
|
+
return okStructured(guide, attachHandles(featureReport, buildOrchestrationHandles(memoryContext)), {
|
|
599
600
|
schema: FeatureReportSchema,
|
|
600
601
|
note: 'AI 应该按照指南执行步骤,并在每个步骤完成后更新 structuredContent 中的状态和估算信息',
|
|
601
602
|
});
|
package/build/tools/start_ui.js
CHANGED
|
@@ -10,13 +10,14 @@
|
|
|
10
10
|
import { parseArgs, getString, getNumber } from "../utils/parseArgs.js";
|
|
11
11
|
import { getReasoningEngine } from "./ui-ux-tools.js";
|
|
12
12
|
import { okStructured } from "../lib/response.js";
|
|
13
|
+
import { attachHandles } from "../lib/handles.js";
|
|
13
14
|
import { renderOrchestrationHeader } from "../lib/orchestration-guidance.js";
|
|
14
15
|
import { buildSkillBridgePlanStep, buildSkillHeaderNote, detectSkillBridge, renderSkillBridgeSection, } from "../lib/skill-bridge.js";
|
|
15
16
|
import { UIReportSchema, RequirementsLoopSchema } from "../schemas/structured-output.js";
|
|
16
17
|
import { detectProjectType } from "../lib/project-detector.js";
|
|
17
18
|
import { resolveWorkspaceRoot, isLikelyProjectNamedRelativePath, buildProjectRootRetryHint } from "../lib/workspace-root.js";
|
|
18
19
|
import { reportToolProgress, throwIfAborted, } from "../lib/tool-execution-context.js";
|
|
19
|
-
import { buildMemoryPlanStep, loadMemoryInjectionContext, renderMemoryGuideSection, } from "../lib/memory-orchestration.js";
|
|
20
|
+
import { buildMemoryPlanStep, loadMemoryInjectionContext, renderMemoryGuideSection, buildOrchestrationHandles, } from "../lib/memory-orchestration.js";
|
|
20
21
|
import { isShadcnStack } from "../lib/shadcn-ui.js";
|
|
21
22
|
import { renderUiHardRules, renderUiBannedList, renderPreFlightChecklist } from "../lib/quality-constraints.js";
|
|
22
23
|
/** 渲染代码步骤统一注入的 UI 硬约束 + 黑名单 + 交付前自检 */
|
|
@@ -782,7 +783,7 @@ start_ui <描述> --requirements_mode=loop
|
|
|
782
783
|
},
|
|
783
784
|
};
|
|
784
785
|
await reportToolProgress(context, 95, "start_ui: loop 输出已生成");
|
|
785
|
-
return okStructured(guide, loopReport, {
|
|
786
|
+
return okStructured(guide, attachHandles(loopReport, buildOrchestrationHandles(memoryContext)), {
|
|
786
787
|
schema: RequirementsLoopSchema,
|
|
787
788
|
note: 'AI 应按轮次澄清 UI 需求并更新结构化输出,满足结束条件后再执行 UI 计划',
|
|
788
789
|
});
|
|
@@ -1035,7 +1036,7 @@ ${recommendation.reasoning}
|
|
|
1035
1036
|
},
|
|
1036
1037
|
};
|
|
1037
1038
|
await reportToolProgress(context, 95, "start_ui: auto 输出已生成");
|
|
1038
|
-
return okStructured(smartPlan, uiReport, {
|
|
1039
|
+
return okStructured(smartPlan, attachHandles(uiReport, buildOrchestrationHandles(memoryContext)), {
|
|
1039
1040
|
schema: UIReportSchema,
|
|
1040
1041
|
note: 'AI 应该按照智能计划执行步骤,并在每个步骤完成后更新 structuredContent',
|
|
1041
1042
|
});
|
|
@@ -1238,7 +1239,7 @@ start_ui "设置页面" --framework=react
|
|
|
1238
1239
|
},
|
|
1239
1240
|
};
|
|
1240
1241
|
await reportToolProgress(context, 95, "start_ui: manual 输出已生成");
|
|
1241
|
-
return okStructured(guide, uiReport, {
|
|
1242
|
+
return okStructured(guide, attachHandles(uiReport, buildOrchestrationHandles(memoryContext)), {
|
|
1242
1243
|
schema: UIReportSchema,
|
|
1243
1244
|
note: 'AI 应该按照指南执行步骤,并在每个步骤完成后更新 structuredContent',
|
|
1244
1245
|
});
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { parseArgs, getString, getNumber } from '../utils/parseArgs.js';
|
|
2
|
+
import { okStructured } from '../lib/response.js';
|
|
3
|
+
import { createMemoryClient } from '../lib/memory-client.js';
|
|
4
|
+
import { handleToolError } from '../utils/error-handler.js';
|
|
5
|
+
import { attachHandles, buildMemoryAssetHandles } from '../lib/handles.js';
|
|
6
|
+
function fieldProvided(args, ...keys) {
|
|
7
|
+
const record = args?.input && typeof args.input === 'object' && !Array.isArray(args.input)
|
|
8
|
+
? { ...args, ...args.input }
|
|
9
|
+
: args;
|
|
10
|
+
if (!record || typeof record !== 'object' || Array.isArray(record)) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
return keys.some((key) => key in record && record[key] !== undefined && record[key] !== null);
|
|
14
|
+
}
|
|
15
|
+
export async function updateMemoryAsset(args) {
|
|
16
|
+
try {
|
|
17
|
+
const parsed = parseArgs(args, {
|
|
18
|
+
fieldAliases: {
|
|
19
|
+
code_snippet: ['code', 'snippet'],
|
|
20
|
+
file_path: ['path'],
|
|
21
|
+
source_project: ['project'],
|
|
22
|
+
source_path: ['source'],
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
const assetId = getString(parsed.asset_id);
|
|
26
|
+
if (!assetId) {
|
|
27
|
+
throw new Error('缺少必填参数: asset_id');
|
|
28
|
+
}
|
|
29
|
+
const patch = {};
|
|
30
|
+
if (fieldProvided(args, 'name')) {
|
|
31
|
+
patch.name = getString(parsed.name);
|
|
32
|
+
}
|
|
33
|
+
if (fieldProvided(args, 'type')) {
|
|
34
|
+
patch.type = getString(parsed.type);
|
|
35
|
+
}
|
|
36
|
+
if (fieldProvided(args, 'description')) {
|
|
37
|
+
patch.description = getString(parsed.description);
|
|
38
|
+
}
|
|
39
|
+
if (fieldProvided(args, 'summary')) {
|
|
40
|
+
patch.summary = getString(parsed.summary);
|
|
41
|
+
}
|
|
42
|
+
if (fieldProvided(args, 'content', 'code_snippet', 'code', 'snippet')) {
|
|
43
|
+
patch.content = getString(parsed.content) || getString(parsed.code_snippet);
|
|
44
|
+
}
|
|
45
|
+
if (fieldProvided(args, 'tags')) {
|
|
46
|
+
patch.tags = Array.isArray(parsed.tags)
|
|
47
|
+
? parsed.tags.filter((item) => typeof item === 'string')
|
|
48
|
+
: [];
|
|
49
|
+
}
|
|
50
|
+
if (fieldProvided(args, 'confidence')) {
|
|
51
|
+
patch.confidence = getNumber(parsed.confidence, 0.7);
|
|
52
|
+
}
|
|
53
|
+
if (fieldProvided(args, 'usage')) {
|
|
54
|
+
patch.usage = getString(parsed.usage);
|
|
55
|
+
}
|
|
56
|
+
if (fieldProvided(args, 'source_project', 'project')) {
|
|
57
|
+
patch.sourceProject = getString(parsed.source_project);
|
|
58
|
+
}
|
|
59
|
+
if (fieldProvided(args, 'source_path', 'source', 'file_path', 'path')) {
|
|
60
|
+
patch.sourcePath = getString(parsed.source_path) || getString(parsed.file_path);
|
|
61
|
+
}
|
|
62
|
+
if (Object.keys(patch).length === 0) {
|
|
63
|
+
throw new Error('至少提供一个待更新字段: name, type, description, summary, content, tags, confidence, usage 等');
|
|
64
|
+
}
|
|
65
|
+
const client = createMemoryClient();
|
|
66
|
+
if (!client.isEnabled()) {
|
|
67
|
+
return okStructured('记忆服务未开启,已跳过更新。', { enabled: false, updated: false, asset: null });
|
|
68
|
+
}
|
|
69
|
+
const warnings = [];
|
|
70
|
+
const nextType = patch.type;
|
|
71
|
+
const nextContent = patch.content;
|
|
72
|
+
if (nextType === 'bugfix' && nextContent) {
|
|
73
|
+
const requiredSections = ['【现象】', '【根因】', '【修复】'];
|
|
74
|
+
const missing = requiredSections.filter((section) => !nextContent.includes(section));
|
|
75
|
+
if (missing.length > 0) {
|
|
76
|
+
warnings.push(`建议 content 包含 ${missing.join('、')},便于跨仓库检索与复用`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (patch.sourceProject || patch.sourcePath) {
|
|
80
|
+
warnings.push('跨仓库共享记忆时请勿依赖 source_project/source_path;路径请写入 content 正文(可选)');
|
|
81
|
+
}
|
|
82
|
+
const { updated, asset } = await client.updateAsset(assetId, patch);
|
|
83
|
+
if (!updated || !asset) {
|
|
84
|
+
return okStructured(`未找到记忆资产: ${assetId}`, { enabled: true, updated: false, asset: null });
|
|
85
|
+
}
|
|
86
|
+
return okStructured(`已更新记忆资产: ${asset.name}`, attachHandles({
|
|
87
|
+
enabled: true,
|
|
88
|
+
updated: true,
|
|
89
|
+
asset,
|
|
90
|
+
warnings: warnings.length > 0 ? warnings : undefined,
|
|
91
|
+
}, {
|
|
92
|
+
memory_assets: buildMemoryAssetHandles([{ id: asset.id, name: asset.name, type: asset.type, summary: asset.summary }], 'update_memory_asset'),
|
|
93
|
+
}));
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
return handleToolError(error, 'update_memory_asset');
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* workflow — 开发工作流路由(只读指南)
|
|
3
|
+
*
|
|
4
|
+
* 根据用户意图生成「何时调哪个 MCP 工具」的分阶段计划,
|
|
5
|
+
* 用于约束 Agent 先走 start_* / code_insight / check_spec,而不是直接写代码。
|
|
6
|
+
*/
|
|
7
|
+
export declare function workflow(args: unknown): Promise<import("../lib/response.js").ToolResponse | {
|
|
8
|
+
content: Array<{
|
|
9
|
+
type: string;
|
|
10
|
+
text: string;
|
|
11
|
+
}>;
|
|
12
|
+
isError: true;
|
|
13
|
+
}>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { parseArgs, getString } from '../utils/parseArgs.js';
|
|
2
|
+
import { okStructured } from '../lib/response.js';
|
|
3
|
+
import { handleToolError } from '../utils/error-handler.js';
|
|
4
|
+
import { buildDevWorkflow, renderWorkflowMarkdown } from '../lib/dev-workflow.js';
|
|
5
|
+
import { ensureMcpProbeKitBootstrap } from '../lib/workflow-skill-installer.js';
|
|
6
|
+
import { resolveWorkspaceRoot } from '../lib/workspace-root.js';
|
|
7
|
+
/**
|
|
8
|
+
* workflow — 开发工作流路由(只读指南)
|
|
9
|
+
*
|
|
10
|
+
* 根据用户意图生成「何时调哪个 MCP 工具」的分阶段计划,
|
|
11
|
+
* 用于约束 Agent 先走 start_* / code_insight / check_spec,而不是直接写代码。
|
|
12
|
+
*/
|
|
13
|
+
export async function workflow(args) {
|
|
14
|
+
try {
|
|
15
|
+
const parsed = parseArgs(args, {
|
|
16
|
+
defaultValues: {
|
|
17
|
+
intent: '',
|
|
18
|
+
input: '',
|
|
19
|
+
scenario: 'auto',
|
|
20
|
+
description: '',
|
|
21
|
+
},
|
|
22
|
+
primaryField: 'intent',
|
|
23
|
+
fieldAliases: {
|
|
24
|
+
intent: ['input', 'description', 'goal', 'task', '需求', '目标', '描述'],
|
|
25
|
+
scenario: ['mode', 'type', '场景', '类型'],
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
const intent = getString(parsed.intent) ||
|
|
29
|
+
getString(parsed.input) ||
|
|
30
|
+
getString(parsed.description);
|
|
31
|
+
const scenario = getString(parsed.scenario) || 'auto';
|
|
32
|
+
const plan = buildDevWorkflow(intent, { scenario });
|
|
33
|
+
const text = renderWorkflowMarkdown(plan, intent);
|
|
34
|
+
const projectRoot = resolveWorkspaceRoot('');
|
|
35
|
+
const bootstrap = ensureMcpProbeKitBootstrap(projectRoot);
|
|
36
|
+
return okStructured(text, {
|
|
37
|
+
scenario: plan.scenario,
|
|
38
|
+
scenarioLabel: plan.scenarioLabel,
|
|
39
|
+
confidence: plan.confidence,
|
|
40
|
+
summary: plan.summary,
|
|
41
|
+
firstTool: plan.firstTool,
|
|
42
|
+
firstToolArgsHint: plan.firstToolArgsHint ?? null,
|
|
43
|
+
phases: plan.phases,
|
|
44
|
+
avoid: plan.avoid,
|
|
45
|
+
memoryNotes: plan.memoryNotes,
|
|
46
|
+
projectSkill: {
|
|
47
|
+
relPath: bootstrap.skill.skillRelPath,
|
|
48
|
+
existed: bootstrap.skill.existed,
|
|
49
|
+
created: bootstrap.skill.created,
|
|
50
|
+
updated: bootstrap.skill.updated,
|
|
51
|
+
version: bootstrap.skill.version,
|
|
52
|
+
previousVersion: bootstrap.skill.previousVersion,
|
|
53
|
+
},
|
|
54
|
+
agentsMd: {
|
|
55
|
+
path: bootstrap.agentsMd.path,
|
|
56
|
+
existed: bootstrap.agentsMd.existed,
|
|
57
|
+
created: bootstrap.agentsMd.created,
|
|
58
|
+
updated: bootstrap.agentsMd.updated,
|
|
59
|
+
},
|
|
60
|
+
handles: {
|
|
61
|
+
next_tool: plan.firstTool,
|
|
62
|
+
next_args: plan.firstToolArgsHint ?? {},
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
return handleToolError(error, 'workflow');
|
|
68
|
+
}
|
|
69
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-probe-kit",
|
|
3
|
-
"version": "3.
|
|
4
|
-
"description": "AI-Powered Development Toolkit - MCP Server with
|
|
3
|
+
"version": "3.6.0",
|
|
4
|
+
"description": "AI-Powered Development Toolkit - MCP Server with 30 tools covering code quality, development efficiency, project management, and UI/UX design. Features: Structured Output, Workflow Orchestration, MCP Skill auto-sync, UI/UX Pro Max, and Requirements Interview.",
|
|
5
5
|
"mcpName": "io.github.mybolide/mcp-probe-kit",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "build/index.js",
|
|
@@ -21,7 +21,9 @@
|
|
|
21
21
|
"prepublishOnly": "npm run build",
|
|
22
22
|
"sync-ui-data": "tsx scripts/sync-ui-data.ts",
|
|
23
23
|
"sync-version": "node scripts/sync-version.mjs",
|
|
24
|
-
"
|
|
24
|
+
"verify-workflow-skill": "tsx scripts/verify-workflow-skill.ts",
|
|
25
|
+
"sync-workflow-skill": "tsx scripts/sync-workflow-skill.ts",
|
|
26
|
+
"prebuild": "npm run sync-version && npm run sync-ui-data && npm run verify-workflow-skill && npm run sync-workflow-skill",
|
|
25
27
|
"docs:serve": "npx http-server docs -p 8080 -o"
|
|
26
28
|
},
|
|
27
29
|
"keywords": [
|