mcp-probe-kit 3.3.0 → 3.6.1

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 (88) hide show
  1. package/README.md +781 -765
  2. package/build/index.js +198 -191
  3. package/build/lib/__tests__/agents-md-template.unit.test.js +1 -0
  4. package/build/lib/__tests__/dev-workflow.unit.test.d.ts +1 -0
  5. package/build/lib/__tests__/dev-workflow.unit.test.js +22 -0
  6. package/build/lib/__tests__/handles.unit.test.d.ts +1 -0
  7. package/build/lib/__tests__/handles.unit.test.js +19 -0
  8. package/build/lib/__tests__/mcp-apps.unit.test.d.ts +1 -0
  9. package/build/lib/__tests__/mcp-apps.unit.test.js +52 -0
  10. package/build/lib/__tests__/mcp-tool-skill-registry.unit.test.d.ts +1 -0
  11. package/build/lib/__tests__/mcp-tool-skill-registry.unit.test.js +18 -0
  12. package/build/lib/__tests__/memory-client.unit.test.js +105 -0
  13. package/build/lib/__tests__/spec-gate.unit.test.d.ts +1 -0
  14. package/build/lib/__tests__/spec-gate.unit.test.js +54 -0
  15. package/build/lib/__tests__/task-defaults.unit.test.d.ts +1 -0
  16. package/build/lib/__tests__/task-defaults.unit.test.js +27 -0
  17. package/build/lib/__tests__/workflow-skill-installer.unit.test.d.ts +1 -0
  18. package/build/lib/__tests__/workflow-skill-installer.unit.test.js +110 -0
  19. package/build/lib/__tests__/workspace-root.unit.test.d.ts +1 -0
  20. package/build/lib/__tests__/workspace-root.unit.test.js +31 -0
  21. package/build/lib/agents-md-template.js +10 -2
  22. package/build/lib/dev-workflow.d.ts +36 -0
  23. package/build/lib/dev-workflow.js +497 -0
  24. package/build/lib/handles.d.ts +31 -0
  25. package/build/lib/handles.js +36 -0
  26. package/build/lib/mcp-apps.d.ts +14 -0
  27. package/build/lib/mcp-apps.js +234 -0
  28. package/build/lib/mcp-tool-skill-registry.d.ts +46 -0
  29. package/build/lib/mcp-tool-skill-registry.js +256 -0
  30. package/build/lib/memory-client.d.ts +19 -0
  31. package/build/lib/memory-client.js +69 -0
  32. package/build/lib/memory-orchestration.d.ts +5 -0
  33. package/build/lib/memory-orchestration.js +20 -0
  34. package/build/lib/merge-agents-md.d.ts +2 -2
  35. package/build/lib/merge-agents-md.js +7 -4
  36. package/build/lib/output-schema-registry.d.ts +11 -0
  37. package/build/lib/output-schema-registry.js +80 -0
  38. package/build/lib/spec-gate.d.ts +32 -0
  39. package/build/lib/spec-gate.js +83 -0
  40. package/build/lib/task-defaults.d.ts +6 -0
  41. package/build/lib/task-defaults.js +20 -0
  42. package/build/lib/tool-annotations.js +3 -0
  43. package/build/lib/toolset-manager.js +2 -0
  44. package/build/lib/workflow-skill-installer.d.ts +40 -0
  45. package/build/lib/workflow-skill-installer.js +172 -0
  46. package/build/lib/workflow-skill-template.d.ts +9 -0
  47. package/build/lib/workflow-skill-template.js +85 -0
  48. package/build/lib/workflow-skill-version.d.ts +15 -0
  49. package/build/lib/workflow-skill-version.js +68 -0
  50. package/build/lib/workspace-root.d.ts +4 -0
  51. package/build/lib/workspace-root.js +33 -0
  52. package/build/schemas/basic-tools.d.ts +4 -0
  53. package/build/schemas/basic-tools.js +4 -0
  54. package/build/schemas/index.d.ts +114 -0
  55. package/build/schemas/index.js +1 -0
  56. package/build/schemas/memory-tools.d.ts +83 -0
  57. package/build/schemas/memory-tools.js +43 -0
  58. package/build/schemas/orchestration-tools.d.ts +8 -0
  59. package/build/schemas/orchestration-tools.js +8 -0
  60. package/build/schemas/output/code-insight-tools.d.ts +65 -0
  61. package/build/schemas/output/code-insight-tools.js +42 -0
  62. package/build/schemas/output/memory-tools.d.ts +576 -0
  63. package/build/schemas/output/memory-tools.js +148 -0
  64. package/build/schemas/project-tools.d.ts +19 -0
  65. package/build/schemas/project-tools.js +20 -0
  66. package/build/tools/__tests__/delete_memory_asset.unit.test.d.ts +1 -0
  67. package/build/tools/__tests__/delete_memory_asset.unit.test.js +87 -0
  68. package/build/tools/__tests__/search_memory.unit.test.js +1 -0
  69. package/build/tools/__tests__/start_bugfix.unit.test.js +34 -1
  70. package/build/tools/__tests__/update_memory_asset.unit.test.d.ts +1 -0
  71. package/build/tools/__tests__/update_memory_asset.unit.test.js +82 -0
  72. package/build/tools/__tests__/workflow.unit.test.d.ts +1 -0
  73. package/build/tools/__tests__/workflow.unit.test.js +24 -0
  74. package/build/tools/code_insight.js +5 -1
  75. package/build/tools/delete_memory_asset.d.ts +7 -0
  76. package/build/tools/delete_memory_asset.js +57 -0
  77. package/build/tools/index.d.ts +3 -0
  78. package/build/tools/index.js +3 -0
  79. package/build/tools/init_project.js +170 -158
  80. package/build/tools/search_memory.js +5 -2
  81. package/build/tools/start_bugfix.js +37 -4
  82. package/build/tools/start_feature.js +4 -3
  83. package/build/tools/start_ui.js +5 -4
  84. package/build/tools/update_memory_asset.d.ts +7 -0
  85. package/build/tools/update_memory_asset.js +98 -0
  86. package/build/tools/workflow.d.ts +13 -0
  87. package/build/tools/workflow.js +69 -0
  88. package/package.json +5 -3
@@ -0,0 +1,68 @@
1
+ import { VERSION } from "../version.js";
2
+ /** Skill 文件首行版本标记:`<!-- mcp-probe-kit-skill-version: 3.5.0 -->` */
3
+ export const SKILL_VERSION_MARKER = "mcp-probe-kit-skill-version";
4
+ /** AGENTS.md mcp-probe 块内版本标记 */
5
+ export const AGENTS_CONTEXT_VERSION_MARKER = "mcp-probe:context-version";
6
+ export function getMcpProbeSkillVersion() {
7
+ return VERSION;
8
+ }
9
+ export function formatSkillVersionMarker(version = VERSION) {
10
+ return `<!-- ${SKILL_VERSION_MARKER}: ${version} -->`;
11
+ }
12
+ export function formatAgentsContextVersionMarker(version = VERSION) {
13
+ return `<!-- ${AGENTS_CONTEXT_VERSION_MARKER}: ${version} -->`;
14
+ }
15
+ export function parseSkillVersionMarker(content) {
16
+ const pattern = new RegExp(`<!--\\s*${SKILL_VERSION_MARKER}:\\s*([^\\s>]+)\\s*-->`, "i");
17
+ const match = content.match(pattern);
18
+ return match?.[1]?.trim() ?? null;
19
+ }
20
+ export function parseAgentsContextVersion(content) {
21
+ const pattern = new RegExp(`<!--\\s*${AGENTS_CONTEXT_VERSION_MARKER}:\\s*([^\\s>]+)\\s*-->`, "i");
22
+ const match = content.match(pattern);
23
+ return match?.[1]?.trim() ?? null;
24
+ }
25
+ /** 比较 semver(仅主版本号段,忽略 prerelease 后缀) */
26
+ export function compareSemver(a, b) {
27
+ const normalize = (value) => value
28
+ .trim()
29
+ .replace(/^v/i, "")
30
+ .split("-")[0]
31
+ .split(".")
32
+ .map((part) => {
33
+ const n = Number.parseInt(part, 10);
34
+ return Number.isFinite(n) ? n : 0;
35
+ });
36
+ const left = normalize(a);
37
+ const right = normalize(b);
38
+ const length = Math.max(left.length, right.length);
39
+ for (let i = 0; i < length; i += 1) {
40
+ const diff = (left[i] ?? 0) - (right[i] ?? 0);
41
+ if (diff !== 0) {
42
+ return diff > 0 ? 1 : -1;
43
+ }
44
+ }
45
+ return 0;
46
+ }
47
+ /** 已安装 Skill 是否落后于当前 kit 版本(无标记视为过期) */
48
+ export function skillContentNeedsUpgrade(existing, targetVersion = VERSION) {
49
+ if (!existing?.trim()) {
50
+ return true;
51
+ }
52
+ const installed = parseSkillVersionMarker(existing);
53
+ if (!installed) {
54
+ return true;
55
+ }
56
+ return compareSemver(installed, targetVersion) < 0;
57
+ }
58
+ /** AGENTS.md mcp-probe 块是否落后于当前 kit 版本 */
59
+ export function agentsContextNeedsUpgrade(existing, targetVersion = VERSION) {
60
+ if (!existing?.trim()) {
61
+ return true;
62
+ }
63
+ const installed = parseAgentsContextVersion(existing);
64
+ if (!installed) {
65
+ return true;
66
+ }
67
+ return compareSemver(installed, targetVersion) < 0;
68
+ }
@@ -1,3 +1,7 @@
1
+ /** MCP 包自身安装目录(bootstrap 误写此处说明工作区未解析成功) */
2
+ export declare function getMcpPackageInstallRoot(): string;
3
+ /** 解析 Cursor 等客户端注入的 WORKSPACE_FOLDER_PATHS */
4
+ export declare function resolveFromWorkspaceFolderPathsEnv(): string | null;
1
5
  export declare function isLikelyProjectNamedRelativePath(inputPath?: string): boolean;
2
6
  export declare function buildProjectRootRetryHint(inputPath?: string): {
3
7
  preferred: {
@@ -3,6 +3,7 @@ import * as path from "node:path";
3
3
  import { fileURLToPath } from "node:url";
4
4
  import { discoverProjectRootFromLayout } from "./project-context-layout.js";
5
5
  const WORKSPACE_ENV_KEYS = [
6
+ "WORKSPACE_FOLDER_PATHS",
6
7
  "MCP_PROJECT_ROOT",
7
8
  "MCP_WORKSPACE_ROOT",
8
9
  "CURSOR_WORKSPACE_ROOT",
@@ -76,6 +77,34 @@ function getRuntimePackageRoot() {
76
77
  const moduleDir = path.dirname(fileURLToPath(import.meta.url));
77
78
  return path.resolve(moduleDir, "..", "..");
78
79
  }
80
+ /** MCP 包自身安装目录(bootstrap 误写此处说明工作区未解析成功) */
81
+ export function getMcpPackageInstallRoot() {
82
+ return getRuntimePackageRoot();
83
+ }
84
+ /** 解析 Cursor 等客户端注入的 WORKSPACE_FOLDER_PATHS */
85
+ export function resolveFromWorkspaceFolderPathsEnv() {
86
+ const raw = process.env.WORKSPACE_FOLDER_PATHS?.trim();
87
+ if (!raw) {
88
+ return null;
89
+ }
90
+ if (raw.startsWith("[")) {
91
+ try {
92
+ const parsed = JSON.parse(raw);
93
+ if (Array.isArray(parsed) && parsed.length > 0) {
94
+ const first = safeResolve(String(parsed[0]));
95
+ if (isExistingDirectory(first)) {
96
+ return first;
97
+ }
98
+ }
99
+ }
100
+ catch {
101
+ // fall through
102
+ }
103
+ }
104
+ const firstSegment = raw.split(/[|;]/)[0]?.trim() || raw;
105
+ const candidate = safeResolve(firstSegment);
106
+ return isExistingDirectory(candidate) ? candidate : null;
107
+ }
79
108
  function looksLikeWorkspaceRoot(target) {
80
109
  return WORKSPACE_MARKERS.some((marker) => fs.existsSync(path.join(target, marker)));
81
110
  }
@@ -134,6 +163,10 @@ export function resolveWorkspaceRoot(explicitProjectRoot) {
134
163
  if (isExistingDirectory(explicit)) {
135
164
  return discoverProjectRootFromLayout(explicit) ?? explicit;
136
165
  }
166
+ const fromCursorWorkspace = resolveFromWorkspaceFolderPathsEnv();
167
+ if (fromCursorWorkspace) {
168
+ return discoverProjectRootFromLayout(fromCursorWorkspace) ?? fromCursorWorkspace;
169
+ }
137
170
  const packageRoot = getRuntimePackageRoot();
138
171
  const cwd = safeResolve(process.cwd()) || packageRoot;
139
172
  const fromLayout = discoverProjectRootFromLayout(cwd);
@@ -15,6 +15,10 @@ export declare const basicToolSchemas: readonly [{
15
15
  readonly type: "string";
16
16
  readonly description: "项目名称。可选,默认为'新项目'";
17
17
  };
18
+ readonly project_root: {
19
+ readonly type: "string";
20
+ readonly description: "项目根目录绝对路径。用于 Skill/AGENTS.md 自动安装;未传则解析 Cursor 工作区";
21
+ };
18
22
  };
19
23
  readonly required: readonly [];
20
24
  readonly additionalProperties: true;
@@ -16,6 +16,10 @@ export const basicToolSchemas = [
16
16
  type: "string",
17
17
  description: "项目名称。可选,默认为'新项目'",
18
18
  },
19
+ project_root: {
20
+ type: "string",
21
+ description: "项目根目录绝对路径。用于 Skill/AGENTS.md 自动安装;未传则解析 Cursor 工作区",
22
+ },
19
23
  },
20
24
  required: [],
21
25
  additionalProperties: true,
@@ -15,6 +15,10 @@ export declare const allToolSchemas: ({
15
15
  readonly type: "string";
16
16
  readonly description: "项目名称。可选,默认为'新项目'";
17
17
  };
18
+ readonly project_root: {
19
+ readonly type: "string";
20
+ readonly description: "项目根目录绝对路径。用于 Skill/AGENTS.md 自动安装;未传则解析 Cursor 工作区";
21
+ };
18
22
  };
19
23
  readonly required: readonly [];
20
24
  readonly additionalProperties: true;
@@ -193,6 +197,25 @@ export declare const allToolSchemas: ({
193
197
  readonly required: readonly [];
194
198
  readonly additionalProperties: true;
195
199
  };
200
+ } | {
201
+ readonly name: "workflow";
202
+ readonly description: "当不确定该用哪个 MCP 工具时使用。根据意图返回分阶段 MCP 指南(firstTool + phases)。同时确保用户项目已存在 .agents/skills/mcp-probe-kit/SKILL.md 与 AGENTS.md 中的 Skill 引用(缺失则自动创建/更新)。";
203
+ readonly inputSchema: {
204
+ readonly type: "object";
205
+ readonly properties: {
206
+ readonly intent: {
207
+ readonly type: "string";
208
+ readonly description: "用户目标或任务描述(自然语言)";
209
+ };
210
+ readonly scenario: {
211
+ readonly type: "string";
212
+ readonly enum: readonly ["auto", "feature", "bugfix", "ui", "explore", "commit", "review", "refactor", "onboard", "spec", "memory"];
213
+ readonly description: "可选:显式场景;默认 auto 从 intent 推断";
214
+ };
215
+ };
216
+ readonly required: readonly [];
217
+ readonly additionalProperties: true;
218
+ };
196
219
  } | {
197
220
  readonly name: "init_project_context";
198
221
  readonly description: "生成/更新项目上下文:默认写入 AGENTS.md(含 MCP 与 GitNexus 触发规则)及 docs/project-context/。新功能请先 start_feature,修 bug 请先 start_bugfix。完成后 Agent 应阅读 AGENTS.md。";
@@ -371,6 +394,14 @@ export declare const allToolSchemas: ({
371
394
  readonly type: "string";
372
395
  readonly description: "项目根目录绝对路径。建议显式传入;docs_dir 等相对路径参数应统一相对该项目根目录解析,避免依赖客户端 cwd。";
373
396
  };
397
+ readonly docs_dir: {
398
+ readonly type: "string";
399
+ readonly description: "文档目录。可选,默认 docs";
400
+ };
401
+ readonly feature_name: {
402
+ readonly type: "string";
403
+ readonly description: "关联功能规格名(对应 docs/specs/<feature_name>/)。提供后或能自动识别时,修复闭环会插入 check_spec 闸门";
404
+ };
374
405
  readonly analysis_mode: {
375
406
  readonly type: "string";
376
407
  readonly description: "分析方法。默认 tbp8(丰田问题分析 8 步法)";
@@ -814,6 +845,89 @@ export declare const allToolSchemas: ({
814
845
  readonly required: readonly ["name", "description", "summary"];
815
846
  readonly additionalProperties: true;
816
847
  };
848
+ } | {
849
+ readonly name: "delete_memory_asset";
850
+ readonly description: "按 asset_id 从共享记忆库删除一条资产。适用于过时、错误或重复沉淀的清理;删除前建议先用 read_memory_asset 确认内容。";
851
+ readonly inputSchema: {
852
+ readonly type: "object";
853
+ readonly properties: {
854
+ readonly asset_id: {
855
+ readonly type: "string";
856
+ readonly description: "要删除的记忆资产 ID(通常来自 search_memory 或 read_memory_asset)";
857
+ };
858
+ readonly confirm: {
859
+ readonly type: "boolean";
860
+ readonly description: "为 true 时执行删除;省略或 false 时仅返回预览并要求确认(软确认)";
861
+ };
862
+ };
863
+ readonly required: readonly ["asset_id"];
864
+ readonly additionalProperties: true;
865
+ };
866
+ } | {
867
+ readonly name: "update_memory_asset";
868
+ readonly description: "按 asset_id 更新共享记忆库中的已有资产(保留原 ID)。适用于修正摘要、正文或标签;content 变更会重新向量化。跨仓库共享时勿填 source_project/source_path。";
869
+ readonly inputSchema: {
870
+ readonly type: "object";
871
+ readonly properties: {
872
+ readonly asset_id: {
873
+ readonly type: "string";
874
+ readonly description: "要更新的记忆资产 ID";
875
+ };
876
+ readonly name: {
877
+ readonly type: "string";
878
+ readonly description: "资产名称";
879
+ };
880
+ readonly type: {
881
+ readonly type: "string";
882
+ readonly description: "资产类型:bugfix / pattern / component / code 等";
883
+ };
884
+ readonly description: {
885
+ readonly type: "string";
886
+ readonly description: "资产描述";
887
+ };
888
+ readonly summary: {
889
+ readonly type: "string";
890
+ readonly description: "检索用一句话摘要";
891
+ };
892
+ readonly content: {
893
+ readonly type: "string";
894
+ readonly description: "完整内容";
895
+ };
896
+ readonly code_snippet: {
897
+ readonly type: "string";
898
+ readonly description: "代码片段,content 的别名";
899
+ };
900
+ readonly file_path: {
901
+ readonly type: "string";
902
+ readonly description: "已废弃:勿用于跨仓库沉淀,路径写入 content";
903
+ };
904
+ readonly source_project: {
905
+ readonly type: "string";
906
+ readonly description: "已废弃:仅同仓库追溯时可选";
907
+ };
908
+ readonly source_path: {
909
+ readonly type: "string";
910
+ readonly description: "已废弃:仅同仓库追溯时可选";
911
+ };
912
+ readonly usage: {
913
+ readonly type: "string";
914
+ readonly description: "适用场景/使用方式";
915
+ };
916
+ readonly confidence: {
917
+ readonly type: "number";
918
+ readonly description: "置信度,0-1";
919
+ };
920
+ readonly tags: {
921
+ readonly type: "array";
922
+ readonly items: {
923
+ readonly type: "string";
924
+ };
925
+ readonly description: "标签列表";
926
+ };
927
+ };
928
+ readonly required: readonly ["asset_id"];
929
+ readonly additionalProperties: true;
930
+ };
817
931
  } | {
818
932
  readonly name: "scan_and_extract_patterns";
819
933
  readonly description: "当需要从单段代码、单文件或整个目录中抽取可复用模式,再决定是否沉淀到记忆系统时使用。目录扫描时,优先传 `project_root` 为项目根目录绝对路径,并让 `directory_path` 传相对项目根的路径,例如 `app/utils`;只有无法确定项目根时,才把 `directory_path` 直接设为绝对路径。不要传带项目名的半相对路径,例如 `font-miniapp-api/app/utils`。";
@@ -13,6 +13,7 @@ import { uiUxSchemas } from "./ui-ux-schemas.js";
13
13
  import { productDesignSchemas } from "./product-design-schemas.js";
14
14
  import { memoryToolSchemas } from "./memory-tools.js";
15
15
  // 合并所有工具 schemas
16
+ // 增删工具时同步更新 src/lib/mcp-tool-skill-registry.ts(prebuild 会 verify-workflow-skill 校验)
16
17
  export const allToolSchemas = [
17
18
  ...basicToolSchemas,
18
19
  ...gitToolSchemas,
@@ -102,6 +102,89 @@ export declare const memoryToolSchemas: readonly [{
102
102
  readonly required: readonly ["name", "description", "summary"];
103
103
  readonly additionalProperties: true;
104
104
  };
105
+ }, {
106
+ readonly name: "delete_memory_asset";
107
+ readonly description: "按 asset_id 从共享记忆库删除一条资产。适用于过时、错误或重复沉淀的清理;删除前建议先用 read_memory_asset 确认内容。";
108
+ readonly inputSchema: {
109
+ readonly type: "object";
110
+ readonly properties: {
111
+ readonly asset_id: {
112
+ readonly type: "string";
113
+ readonly description: "要删除的记忆资产 ID(通常来自 search_memory 或 read_memory_asset)";
114
+ };
115
+ readonly confirm: {
116
+ readonly type: "boolean";
117
+ readonly description: "为 true 时执行删除;省略或 false 时仅返回预览并要求确认(软确认)";
118
+ };
119
+ };
120
+ readonly required: readonly ["asset_id"];
121
+ readonly additionalProperties: true;
122
+ };
123
+ }, {
124
+ readonly name: "update_memory_asset";
125
+ readonly description: "按 asset_id 更新共享记忆库中的已有资产(保留原 ID)。适用于修正摘要、正文或标签;content 变更会重新向量化。跨仓库共享时勿填 source_project/source_path。";
126
+ readonly inputSchema: {
127
+ readonly type: "object";
128
+ readonly properties: {
129
+ readonly asset_id: {
130
+ readonly type: "string";
131
+ readonly description: "要更新的记忆资产 ID";
132
+ };
133
+ readonly name: {
134
+ readonly type: "string";
135
+ readonly description: "资产名称";
136
+ };
137
+ readonly type: {
138
+ readonly type: "string";
139
+ readonly description: "资产类型:bugfix / pattern / component / code 等";
140
+ };
141
+ readonly description: {
142
+ readonly type: "string";
143
+ readonly description: "资产描述";
144
+ };
145
+ readonly summary: {
146
+ readonly type: "string";
147
+ readonly description: "检索用一句话摘要";
148
+ };
149
+ readonly content: {
150
+ readonly type: "string";
151
+ readonly description: "完整内容";
152
+ };
153
+ readonly code_snippet: {
154
+ readonly type: "string";
155
+ readonly description: "代码片段,content 的别名";
156
+ };
157
+ readonly file_path: {
158
+ readonly type: "string";
159
+ readonly description: "已废弃:勿用于跨仓库沉淀,路径写入 content";
160
+ };
161
+ readonly source_project: {
162
+ readonly type: "string";
163
+ readonly description: "已废弃:仅同仓库追溯时可选";
164
+ };
165
+ readonly source_path: {
166
+ readonly type: "string";
167
+ readonly description: "已废弃:仅同仓库追溯时可选";
168
+ };
169
+ readonly usage: {
170
+ readonly type: "string";
171
+ readonly description: "适用场景/使用方式";
172
+ };
173
+ readonly confidence: {
174
+ readonly type: "number";
175
+ readonly description: "置信度,0-1";
176
+ };
177
+ readonly tags: {
178
+ readonly type: "array";
179
+ readonly items: {
180
+ readonly type: "string";
181
+ };
182
+ readonly description: "标签列表";
183
+ };
184
+ };
185
+ readonly required: readonly ["asset_id"];
186
+ readonly additionalProperties: true;
187
+ };
105
188
  }, {
106
189
  readonly name: "scan_and_extract_patterns";
107
190
  readonly description: "当需要从单段代码、单文件或整个目录中抽取可复用模式,再决定是否沉淀到记忆系统时使用。目录扫描时,优先传 `project_root` 为项目根目录绝对路径,并让 `directory_path` 传相对项目根的路径,例如 `app/utils`;只有无法确定项目根时,才把 `directory_path` 直接设为绝对路径。不要传带项目名的半相对路径,例如 `font-miniapp-api/app/utils`。";
@@ -52,6 +52,49 @@ export const memoryToolSchemas = [
52
52
  additionalProperties: true,
53
53
  },
54
54
  },
55
+ {
56
+ name: 'delete_memory_asset',
57
+ description: '按 asset_id 从共享记忆库删除一条资产。适用于过时、错误或重复沉淀的清理;删除前建议先用 read_memory_asset 确认内容。',
58
+ inputSchema: {
59
+ type: 'object',
60
+ properties: {
61
+ asset_id: {
62
+ type: 'string',
63
+ description: '要删除的记忆资产 ID(通常来自 search_memory 或 read_memory_asset)',
64
+ },
65
+ confirm: {
66
+ type: 'boolean',
67
+ description: '为 true 时执行删除;省略或 false 时仅返回预览并要求确认(软确认)',
68
+ },
69
+ },
70
+ required: ['asset_id'],
71
+ additionalProperties: true,
72
+ },
73
+ },
74
+ {
75
+ name: 'update_memory_asset',
76
+ description: '按 asset_id 更新共享记忆库中的已有资产(保留原 ID)。适用于修正摘要、正文或标签;content 变更会重新向量化。跨仓库共享时勿填 source_project/source_path。',
77
+ inputSchema: {
78
+ type: 'object',
79
+ properties: {
80
+ asset_id: { type: 'string', description: '要更新的记忆资产 ID' },
81
+ name: { type: 'string', description: '资产名称' },
82
+ type: { type: 'string', description: '资产类型:bugfix / pattern / component / code 等' },
83
+ description: { type: 'string', description: '资产描述' },
84
+ summary: { type: 'string', description: '检索用一句话摘要' },
85
+ content: { type: 'string', description: '完整内容' },
86
+ code_snippet: { type: 'string', description: '代码片段,content 的别名' },
87
+ file_path: { type: 'string', description: '已废弃:勿用于跨仓库沉淀,路径写入 content' },
88
+ source_project: { type: 'string', description: '已废弃:仅同仓库追溯时可选' },
89
+ source_path: { type: 'string', description: '已废弃:仅同仓库追溯时可选' },
90
+ usage: { type: 'string', description: '适用场景/使用方式' },
91
+ confidence: { type: 'number', description: '置信度,0-1' },
92
+ tags: { type: 'array', items: { type: 'string' }, description: '标签列表' },
93
+ },
94
+ required: ['asset_id'],
95
+ additionalProperties: true,
96
+ },
97
+ },
55
98
  {
56
99
  name: 'scan_and_extract_patterns',
57
100
  description: '当需要从单段代码、单文件或整个目录中抽取可复用模式,再决定是否沉淀到记忆系统时使用。目录扫描时,优先传 `project_root` 为项目根目录绝对路径,并让 `directory_path` 传相对项目根的路径,例如 `app/utils`;只有无法确定项目根时,才把 `directory_path` 直接设为绝对路径。不要传带项目名的半相对路径,例如 `font-miniapp-api/app/utils`。',
@@ -69,6 +69,14 @@ export declare const orchestrationToolSchemas: readonly [{
69
69
  readonly type: "string";
70
70
  readonly description: "项目根目录绝对路径。建议显式传入;docs_dir 等相对路径参数应统一相对该项目根目录解析,避免依赖客户端 cwd。";
71
71
  };
72
+ readonly docs_dir: {
73
+ readonly type: "string";
74
+ readonly description: "文档目录。可选,默认 docs";
75
+ };
76
+ readonly feature_name: {
77
+ readonly type: "string";
78
+ readonly description: "关联功能规格名(对应 docs/specs/<feature_name>/)。提供后或能自动识别时,修复闭环会插入 check_spec 闸门";
79
+ };
72
80
  readonly analysis_mode: {
73
81
  readonly type: "string";
74
82
  readonly description: "分析方法。默认 tbp8(丰田问题分析 8 步法)";
@@ -71,6 +71,14 @@ export const orchestrationToolSchemas = [
71
71
  type: "string",
72
72
  description: "项目根目录绝对路径。建议显式传入;docs_dir 等相对路径参数应统一相对该项目根目录解析,避免依赖客户端 cwd。",
73
73
  },
74
+ docs_dir: {
75
+ type: "string",
76
+ description: "文档目录。可选,默认 docs",
77
+ },
78
+ feature_name: {
79
+ type: "string",
80
+ description: "关联功能规格名(对应 docs/specs/<feature_name>/)。提供后或能自动识别时,修复闭环会插入 check_spec 闸门",
81
+ },
74
82
  analysis_mode: {
75
83
  type: "string",
76
84
  description: "分析方法。默认 tbp8(丰田问题分析 8 步法)",
@@ -0,0 +1,65 @@
1
+ /**
2
+ * code_insight 结构化输出 Schema(精简版,覆盖 handles 与核心字段)
3
+ */
4
+ export declare const CodeInsightSchema: {
5
+ readonly type: "object";
6
+ readonly properties: {
7
+ readonly status: {
8
+ readonly type: "string";
9
+ readonly enum: readonly ["ok", "degraded", "ambiguous", "not_found"];
10
+ };
11
+ readonly provider: {
12
+ readonly type: "string";
13
+ };
14
+ readonly mode: {
15
+ readonly type: "object";
16
+ readonly properties: {
17
+ readonly requested: {
18
+ readonly type: "string";
19
+ };
20
+ readonly resolved: {
21
+ readonly type: "string";
22
+ };
23
+ };
24
+ };
25
+ readonly summary: {
26
+ readonly type: "string";
27
+ };
28
+ readonly warnings: {
29
+ readonly type: "array";
30
+ readonly items: {
31
+ readonly type: "string";
32
+ };
33
+ };
34
+ readonly nextAction: {
35
+ readonly type: readonly ["string", "null"];
36
+ };
37
+ readonly handles: {
38
+ readonly type: "object";
39
+ readonly properties: {
40
+ readonly graph_snapshot: {
41
+ readonly type: "string";
42
+ };
43
+ readonly graph_resource: {
44
+ readonly type: "string";
45
+ };
46
+ readonly memory_assets: {
47
+ readonly type: "array";
48
+ readonly items: {
49
+ readonly type: "object";
50
+ readonly properties: {
51
+ readonly id: {
52
+ readonly type: "string";
53
+ };
54
+ readonly tool: {
55
+ readonly type: "string";
56
+ };
57
+ };
58
+ readonly required: readonly ["id", "tool"];
59
+ };
60
+ };
61
+ };
62
+ };
63
+ };
64
+ readonly required: readonly ["status", "summary"];
65
+ };
@@ -0,0 +1,42 @@
1
+ /**
2
+ * code_insight 结构化输出 Schema(精简版,覆盖 handles 与核心字段)
3
+ */
4
+ export const CodeInsightSchema = {
5
+ type: 'object',
6
+ properties: {
7
+ status: {
8
+ type: 'string',
9
+ enum: ['ok', 'degraded', 'ambiguous', 'not_found'],
10
+ },
11
+ provider: { type: 'string' },
12
+ mode: {
13
+ type: 'object',
14
+ properties: {
15
+ requested: { type: 'string' },
16
+ resolved: { type: 'string' },
17
+ },
18
+ },
19
+ summary: { type: 'string' },
20
+ warnings: { type: 'array', items: { type: 'string' } },
21
+ nextAction: { type: ['string', 'null'] },
22
+ handles: {
23
+ type: 'object',
24
+ properties: {
25
+ graph_snapshot: { type: 'string' },
26
+ graph_resource: { type: 'string' },
27
+ memory_assets: {
28
+ type: 'array',
29
+ items: {
30
+ type: 'object',
31
+ properties: {
32
+ id: { type: 'string' },
33
+ tool: { type: 'string' },
34
+ },
35
+ required: ['id', 'tool'],
36
+ },
37
+ },
38
+ },
39
+ },
40
+ },
41
+ required: ['status', 'summary'],
42
+ };