mcp-probe-kit 3.6.0 → 3.6.2
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 +819 -773
- package/build/index.js +222 -134
- package/build/lib/__tests__/custom-mcp-resources.unit.test.d.ts +1 -0
- package/build/lib/__tests__/custom-mcp-resources.unit.test.js +135 -0
- package/build/lib/__tests__/project-mcp-resources.unit.test.d.ts +1 -0
- package/build/lib/__tests__/project-mcp-resources.unit.test.js +49 -0
- package/build/lib/__tests__/workspace-root.unit.test.d.ts +1 -0
- package/build/lib/__tests__/workspace-root.unit.test.js +63 -0
- package/build/lib/custom-mcp-resources.d.ts +39 -0
- package/build/lib/custom-mcp-resources.js +222 -0
- package/build/lib/output-schema-registry.d.ts +8 -0
- package/build/lib/output-schema-registry.js +14 -0
- package/build/lib/project-mcp-resources.d.ts +61 -0
- package/build/lib/project-mcp-resources.js +173 -0
- package/build/lib/workflow-skill-installer.d.ts +2 -0
- package/build/lib/workflow-skill-installer.js +15 -1
- package/build/lib/workflow-skill-template.js +1 -1
- package/build/lib/workspace-root.d.ts +21 -0
- package/build/lib/workspace-root.js +161 -21
- package/build/schemas/basic-tools.d.ts +4 -0
- package/build/schemas/basic-tools.js +5 -0
- package/build/schemas/index.d.ts +5 -1
- package/build/schemas/output/project-tools.d.ts +52 -0
- package/build/schemas/output/project-tools.js +16 -0
- package/build/schemas/project-tools.d.ts +1 -1
- package/build/schemas/project-tools.js +2 -1
- package/build/tools/init_project.js +201 -158
- package/build/tools/scan_and_extract_patterns.js +1 -1
- package/package.json +1 -1
|
@@ -5,7 +5,19 @@ import { mergeAgentsMdBlock } from "./merge-agents-md.js";
|
|
|
5
5
|
import { detectDocumentLocale, resolveProjectContextLayout, toPosixPath, } from "./project-context-layout.js";
|
|
6
6
|
import { generateWorkflowSkillContent, LEGACY_WORKFLOW_SKILL_REL_PATH, MCP_PROBE_SKILL_REL_PATH, } from "./workflow-skill-template.js";
|
|
7
7
|
import { agentsContextNeedsUpgrade, getMcpProbeSkillVersion, parseSkillVersionMarker, skillContentNeedsUpgrade, } from "./workflow-skill-version.js";
|
|
8
|
-
import { isLikelyProjectNamedRelativePath, resolveWorkspaceRoot, } from "./workspace-root.js";
|
|
8
|
+
import { isLikelyProjectNamedRelativePath, getMcpPackageInstallRoot, resolveWorkspaceRoot, } from "./workspace-root.js";
|
|
9
|
+
function buildWorkspaceWarning(projectRoot) {
|
|
10
|
+
const normalizedRoot = path.resolve(projectRoot);
|
|
11
|
+
const packageRoot = path.resolve(getMcpPackageInstallRoot());
|
|
12
|
+
if (normalizedRoot === packageRoot) {
|
|
13
|
+
return [
|
|
14
|
+
"未能自动识别用户项目根目录,Skill/AGENTS.md 可能写入了 mcp-probe-kit 安装目录。",
|
|
15
|
+
"请从目标项目目录打开 MCP 客户端(Cursor / OpenCode 等会自动传入工作区),",
|
|
16
|
+
"或在工具参数中传 project_root 绝对路径。",
|
|
17
|
+
].join("");
|
|
18
|
+
}
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
9
21
|
function flattenToolArgs(args) {
|
|
10
22
|
if (!args || typeof args !== "object" || Array.isArray(args)) {
|
|
11
23
|
return {};
|
|
@@ -131,10 +143,12 @@ export function ensureAgentsMdSkillReference(projectRoot) {
|
|
|
131
143
|
*/
|
|
132
144
|
export function ensureMcpProbeKitBootstrap(projectRoot) {
|
|
133
145
|
const root = path.resolve(projectRoot);
|
|
146
|
+
const workspaceWarning = buildWorkspaceWarning(root);
|
|
134
147
|
return {
|
|
135
148
|
projectRoot: root,
|
|
136
149
|
skill: ensureMcpProbeSkill(root),
|
|
137
150
|
agentsMd: ensureAgentsMdSkillReference(root),
|
|
151
|
+
workspaceWarning,
|
|
138
152
|
};
|
|
139
153
|
}
|
|
140
154
|
export function ensureMcpProbeKitBootstrapForToolCall(_toolName, args) {
|
|
@@ -37,7 +37,7 @@ export function generateWorkflowSkillBody(skillVersion = VERSION) {
|
|
|
37
37
|
return `# MCP 调用时机 — mcp-probe-kit
|
|
38
38
|
|
|
39
39
|
> 本 Skill 只回答一件事:**什么情况 → 调哪个 MCP**。不是开发流程剧本。
|
|
40
|
-
> 由 mcp-probe-kit
|
|
40
|
+
> 由 mcp-probe-kit 自动安装;支持 MCP 的 Agent 客户端可从 \`.agents/skills/\` 加载。
|
|
41
41
|
|
|
42
42
|
## 总规则
|
|
43
43
|
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/** Schema / 文档:project_root 参数说明(自动探测,无需用户配置 MCP_PROJECT_ROOT) */
|
|
2
|
+
export declare const PROJECT_ROOT_SCHEMA_DESCRIPTION = "\u53EF\u9009\u3002\u9879\u76EE\u6839\u76EE\u5F55\u7EDD\u5BF9\u8DEF\u5F84\uFF1B\u672A\u4F20\u65F6\u81EA\u52A8\u4ECE MCP \u5BA2\u6237\u7AEF\u5DE5\u4F5C\u533A\u89E3\u6790\uFF08\u5982 Cursor \u6CE8\u5165 WORKSPACE_FOLDER_PATHS\u3001OpenCode/\u5BA2\u6237\u7AEF\u914D\u7F6E\u7684 cwd \u7B49\uFF09\u3002\u4EC5\u8FB9\u7F18\u573A\u666F\u9700\u624B\u52A8\u4F20\u5165\u3002";
|
|
3
|
+
/** MCP 包自身安装目录(bootstrap 误写此处说明工作区未解析成功) */
|
|
4
|
+
export declare function getMcpPackageInstallRoot(): string;
|
|
5
|
+
/** 解析 MCP 客户端注入的 WORKSPACE_FOLDER_PATHS(如 Cursor) */
|
|
6
|
+
export declare function resolveFromWorkspaceFolderPathsEnv(): string | null;
|
|
1
7
|
export declare function isLikelyProjectNamedRelativePath(inputPath?: string): boolean;
|
|
2
8
|
export declare function buildProjectRootRetryHint(inputPath?: string): {
|
|
3
9
|
preferred: {
|
|
@@ -8,5 +14,20 @@ export declare function buildProjectRootRetryHint(inputPath?: string): {
|
|
|
8
14
|
project_root: string;
|
|
9
15
|
};
|
|
10
16
|
};
|
|
17
|
+
export type WorkspaceRootSource = "explicit" | "explicit-not-yet-created" | "workspace-env" | "layout" | "env" | "cwd" | "package-fallback";
|
|
18
|
+
export interface WorkspaceRootResolution {
|
|
19
|
+
root: string;
|
|
20
|
+
source: WorkspaceRootSource;
|
|
21
|
+
/** 用户传入的 project_root 原始值 */
|
|
22
|
+
explicitRequested?: string;
|
|
23
|
+
/** 是否采用了用户显式路径(未回退到 MCP 安装目录等) */
|
|
24
|
+
explicitHonored: boolean;
|
|
25
|
+
warning?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* 解析项目根目录。
|
|
29
|
+
* 若调用方显式传入 project_root(非空),优先信任该路径,不再向上游走 layout 到父目录。
|
|
30
|
+
*/
|
|
31
|
+
export declare function resolveWorkspaceRootWithMeta(explicitProjectRoot?: string): WorkspaceRootResolution;
|
|
11
32
|
export declare function resolveWorkspaceRoot(explicitProjectRoot?: string): string;
|
|
12
33
|
export declare function toWorkspacePath(explicitProjectRoot?: string): string;
|
|
@@ -2,14 +2,23 @@ import * as fs from "node:fs";
|
|
|
2
2
|
import * as path from "node:path";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
4
|
import { discoverProjectRootFromLayout } from "./project-context-layout.js";
|
|
5
|
-
|
|
5
|
+
/** Schema / 文档:project_root 参数说明(自动探测,无需用户配置 MCP_PROJECT_ROOT) */
|
|
6
|
+
export const PROJECT_ROOT_SCHEMA_DESCRIPTION = "可选。项目根目录绝对路径;未传时自动从 MCP 客户端工作区解析(如 Cursor 注入 WORKSPACE_FOLDER_PATHS、OpenCode/客户端配置的 cwd 等)。仅边缘场景需手动传入。";
|
|
7
|
+
/** MCP 客户端注入的工作区路径(最高优先级,信任客户端,不向父级 layout 上爬) */
|
|
8
|
+
const RUNTIME_CWD_ENV_KEYS = ["INIT_CWD", "PWD", "CWD"];
|
|
9
|
+
/** 用户可选覆盖(不要求在 MCP 配置里逐个填写) */
|
|
10
|
+
const OPTIONAL_OVERRIDE_ENV_KEYS = [
|
|
6
11
|
"MCP_PROJECT_ROOT",
|
|
7
12
|
"MCP_WORKSPACE_ROOT",
|
|
8
13
|
"CURSOR_WORKSPACE_ROOT",
|
|
9
14
|
"WORKSPACE_ROOT",
|
|
10
15
|
"PROJECT_ROOT",
|
|
11
|
-
"
|
|
12
|
-
"
|
|
16
|
+
"OPENCODE_WORKSPACE",
|
|
17
|
+
"OPENCODE_CWD",
|
|
18
|
+
"OPENCODE_PROJECT_ROOT",
|
|
19
|
+
"VSCODE_CWD",
|
|
20
|
+
"CLAUDE_PROJECT_DIR",
|
|
21
|
+
"CODEX_CWD",
|
|
13
22
|
];
|
|
14
23
|
const WORKSPACE_MARKERS = [
|
|
15
24
|
".git",
|
|
@@ -22,6 +31,10 @@ const WORKSPACE_MARKERS = [
|
|
|
22
31
|
"go.mod",
|
|
23
32
|
"pyproject.toml",
|
|
24
33
|
"requirements.txt",
|
|
34
|
+
"opencode.json",
|
|
35
|
+
".opencode",
|
|
36
|
+
"AGENTS.md",
|
|
37
|
+
".agents",
|
|
25
38
|
".cursor",
|
|
26
39
|
".vscode",
|
|
27
40
|
".kiro",
|
|
@@ -76,6 +89,34 @@ function getRuntimePackageRoot() {
|
|
|
76
89
|
const moduleDir = path.dirname(fileURLToPath(import.meta.url));
|
|
77
90
|
return path.resolve(moduleDir, "..", "..");
|
|
78
91
|
}
|
|
92
|
+
/** MCP 包自身安装目录(bootstrap 误写此处说明工作区未解析成功) */
|
|
93
|
+
export function getMcpPackageInstallRoot() {
|
|
94
|
+
return getRuntimePackageRoot();
|
|
95
|
+
}
|
|
96
|
+
/** 解析 MCP 客户端注入的 WORKSPACE_FOLDER_PATHS(如 Cursor) */
|
|
97
|
+
export function resolveFromWorkspaceFolderPathsEnv() {
|
|
98
|
+
const raw = process.env.WORKSPACE_FOLDER_PATHS?.trim();
|
|
99
|
+
if (!raw) {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
if (raw.startsWith("[")) {
|
|
103
|
+
try {
|
|
104
|
+
const parsed = JSON.parse(raw);
|
|
105
|
+
if (Array.isArray(parsed) && parsed.length > 0) {
|
|
106
|
+
const first = safeResolve(String(parsed[0]));
|
|
107
|
+
if (isExistingDirectory(first)) {
|
|
108
|
+
return first;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
catch {
|
|
113
|
+
// fall through
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
const firstSegment = raw.split(/[|;]/)[0]?.trim() || raw;
|
|
117
|
+
const candidate = safeResolve(firstSegment);
|
|
118
|
+
return isExistingDirectory(candidate) ? candidate : null;
|
|
119
|
+
}
|
|
79
120
|
function looksLikeWorkspaceRoot(target) {
|
|
80
121
|
return WORKSPACE_MARKERS.some((marker) => fs.existsSync(path.join(target, marker)));
|
|
81
122
|
}
|
|
@@ -95,6 +136,37 @@ function findWorkspaceAncestor(start, packageRoot) {
|
|
|
95
136
|
current = parent;
|
|
96
137
|
}
|
|
97
138
|
}
|
|
139
|
+
/**
|
|
140
|
+
* 信任 MCP 客户端注入的工作区路径:仅在客户端给定目录及其子树内找 marker,
|
|
141
|
+
* 不向父级 layout 上爬(避免 monorepo 父目录抢走子项目)。
|
|
142
|
+
*/
|
|
143
|
+
function resolveTrustedClientWorkspace(clientPath, packageRoot) {
|
|
144
|
+
if (looksLikeWorkspaceRoot(clientPath)) {
|
|
145
|
+
return clientPath;
|
|
146
|
+
}
|
|
147
|
+
return findWorkspaceAncestor(clientPath, packageRoot) ?? clientPath;
|
|
148
|
+
}
|
|
149
|
+
function resolveFromEnvKeys(keys, packageRoot) {
|
|
150
|
+
for (const key of keys) {
|
|
151
|
+
const candidate = safeResolve(process.env[key] || "");
|
|
152
|
+
const resolved = findWorkspaceAncestor(candidate, packageRoot);
|
|
153
|
+
if (resolved) {
|
|
154
|
+
return resolved;
|
|
155
|
+
}
|
|
156
|
+
if (isExistingDirectory(candidate) && candidate !== packageRoot) {
|
|
157
|
+
return candidate;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return null;
|
|
161
|
+
}
|
|
162
|
+
function buildPackageFallbackWarning(resolved) {
|
|
163
|
+
return [
|
|
164
|
+
"未能自动识别用户项目根目录,Skill/AGENTS.md 可能写入了 mcp-probe-kit 安装目录。",
|
|
165
|
+
"请从目标项目目录打开 MCP 客户端(Cursor / OpenCode 等会自动传入工作区),",
|
|
166
|
+
"或在工具参数中传 project_root 绝对路径。",
|
|
167
|
+
`当前回退路径: ${resolved}`,
|
|
168
|
+
].join(" ");
|
|
169
|
+
}
|
|
98
170
|
export function isLikelyProjectNamedRelativePath(inputPath) {
|
|
99
171
|
if (!inputPath || path.isAbsolute(inputPath)) {
|
|
100
172
|
return false;
|
|
@@ -129,29 +201,97 @@ export function buildProjectRootRetryHint(inputPath) {
|
|
|
129
201
|
},
|
|
130
202
|
};
|
|
131
203
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
204
|
+
function buildExplicitIgnoredWarning(requested, resolved) {
|
|
205
|
+
return [
|
|
206
|
+
`未能采用传入的 project_root: ${requested}`,
|
|
207
|
+
`实际使用: ${resolved}`,
|
|
208
|
+
"请传绝对路径(Windows 建议 E:/project 或 E:\\\\project),或从目标项目目录打开 MCP 客户端以自动识别工作区。",
|
|
209
|
+
].join(" ");
|
|
210
|
+
}
|
|
211
|
+
function resolveAutoWorkspaceRoot(packageRoot) {
|
|
212
|
+
const fromWorkspaceEnv = resolveFromWorkspaceFolderPathsEnv();
|
|
213
|
+
if (fromWorkspaceEnv) {
|
|
214
|
+
const root = resolveTrustedClientWorkspace(fromWorkspaceEnv, packageRoot);
|
|
215
|
+
return {
|
|
216
|
+
root,
|
|
217
|
+
source: "workspace-env",
|
|
218
|
+
explicitHonored: false,
|
|
219
|
+
};
|
|
136
220
|
}
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
221
|
+
const cwd = safeResolve(process.cwd());
|
|
222
|
+
if (isExistingDirectory(cwd) && cwd !== packageRoot) {
|
|
223
|
+
if (looksLikeWorkspaceRoot(cwd)) {
|
|
224
|
+
return { root: cwd, source: "cwd", explicitHonored: false };
|
|
225
|
+
}
|
|
226
|
+
const fromCwdAncestor = findWorkspaceAncestor(cwd, packageRoot);
|
|
227
|
+
if (fromCwdAncestor) {
|
|
228
|
+
return { root: fromCwdAncestor, source: "cwd", explicitHonored: false };
|
|
229
|
+
}
|
|
142
230
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
231
|
+
const fromRuntimeCwd = resolveFromEnvKeys(RUNTIME_CWD_ENV_KEYS, packageRoot);
|
|
232
|
+
if (fromRuntimeCwd) {
|
|
233
|
+
return { root: fromRuntimeCwd, source: "env", explicitHonored: false };
|
|
234
|
+
}
|
|
235
|
+
const fromOverride = resolveFromEnvKeys(OPTIONAL_OVERRIDE_ENV_KEYS, packageRoot);
|
|
236
|
+
if (fromOverride) {
|
|
237
|
+
return { root: fromOverride, source: "env", explicitHonored: false };
|
|
238
|
+
}
|
|
239
|
+
if (isExistingDirectory(cwd)) {
|
|
240
|
+
const fromLayout = discoverProjectRootFromLayout(cwd);
|
|
241
|
+
if (fromLayout) {
|
|
242
|
+
return { root: fromLayout, source: "layout", explicitHonored: false };
|
|
148
243
|
}
|
|
149
244
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
245
|
+
return {
|
|
246
|
+
root: packageRoot,
|
|
247
|
+
source: "package-fallback",
|
|
248
|
+
explicitHonored: false,
|
|
249
|
+
warning: buildPackageFallbackWarning(packageRoot),
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* 解析项目根目录。
|
|
254
|
+
* 若调用方显式传入 project_root(非空),优先信任该路径,不再向上游走 layout 到父目录。
|
|
255
|
+
*/
|
|
256
|
+
export function resolveWorkspaceRootWithMeta(explicitProjectRoot) {
|
|
257
|
+
const explicitRaw = (explicitProjectRoot || "").trim();
|
|
258
|
+
const explicit = safeResolve(explicitRaw);
|
|
259
|
+
const packageRoot = getRuntimePackageRoot();
|
|
260
|
+
if (explicitRaw) {
|
|
261
|
+
if (isExistingDirectory(explicit)) {
|
|
262
|
+
return {
|
|
263
|
+
root: explicit,
|
|
264
|
+
source: "explicit",
|
|
265
|
+
explicitRequested: explicitRaw,
|
|
266
|
+
explicitHonored: true,
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
const userMeantAbsolute = path.isAbsolute(explicitRaw) ||
|
|
270
|
+
/^[a-zA-Z]:[\\/]/.test(explicitRaw) ||
|
|
271
|
+
explicitRaw.startsWith("/") ||
|
|
272
|
+
explicitRaw.startsWith("\\\\");
|
|
273
|
+
if (explicit && userMeantAbsolute) {
|
|
274
|
+
return {
|
|
275
|
+
root: explicit,
|
|
276
|
+
source: "explicit-not-yet-created",
|
|
277
|
+
explicitRequested: explicitRaw,
|
|
278
|
+
explicitHonored: true,
|
|
279
|
+
warning: `project_root 目录尚不存在,将按该路径创建 Skill/AGENTS.md: ${explicit}`,
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
const fallback = resolveAutoWorkspaceRoot(packageRoot);
|
|
283
|
+
return {
|
|
284
|
+
root: fallback.root,
|
|
285
|
+
source: fallback.source,
|
|
286
|
+
explicitRequested: explicitRaw,
|
|
287
|
+
explicitHonored: false,
|
|
288
|
+
warning: buildExplicitIgnoredWarning(explicitRaw, fallback.root),
|
|
289
|
+
};
|
|
153
290
|
}
|
|
154
|
-
return packageRoot;
|
|
291
|
+
return resolveAutoWorkspaceRoot(packageRoot);
|
|
292
|
+
}
|
|
293
|
+
export function resolveWorkspaceRoot(explicitProjectRoot) {
|
|
294
|
+
return resolveWorkspaceRootWithMeta(explicitProjectRoot).root;
|
|
155
295
|
}
|
|
156
296
|
export function toWorkspacePath(explicitProjectRoot) {
|
|
157
297
|
return resolveWorkspaceRoot(explicitProjectRoot).replace(/\\/g, "/");
|
|
@@ -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: "可选。项目根目录绝对路径;未传时自动从 MCP 客户端工作区解析(如 Cursor 注入 WORKSPACE_FOLDER_PATHS、OpenCode/客户端配置的 cwd 等)。仅边缘场景需手动传入。";
|
|
21
|
+
};
|
|
18
22
|
};
|
|
19
23
|
readonly required: readonly [];
|
|
20
24
|
readonly additionalProperties: true;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 基础工具的 Schema 定义
|
|
3
3
|
*/
|
|
4
|
+
import { PROJECT_ROOT_SCHEMA_DESCRIPTION } from "../lib/workspace-root.js";
|
|
4
5
|
export const basicToolSchemas = [
|
|
5
6
|
{
|
|
6
7
|
name: "init_project",
|
|
@@ -16,6 +17,10 @@ export const basicToolSchemas = [
|
|
|
16
17
|
type: "string",
|
|
17
18
|
description: "项目名称。可选,默认为'新项目'",
|
|
18
19
|
},
|
|
20
|
+
project_root: {
|
|
21
|
+
type: "string",
|
|
22
|
+
description: PROJECT_ROOT_SCHEMA_DESCRIPTION,
|
|
23
|
+
},
|
|
19
24
|
},
|
|
20
25
|
required: [],
|
|
21
26
|
additionalProperties: true,
|
package/build/schemas/index.d.ts
CHANGED
|
@@ -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: "可选。项目根目录绝对路径;未传时自动从 MCP 客户端工作区解析(如 Cursor 注入 WORKSPACE_FOLDER_PATHS、OpenCode/客户端配置的 cwd 等)。仅边缘场景需手动传入。";
|
|
21
|
+
};
|
|
18
22
|
};
|
|
19
23
|
readonly required: readonly [];
|
|
20
24
|
readonly additionalProperties: true;
|
|
@@ -316,7 +320,7 @@ export declare const allToolSchemas: ({
|
|
|
316
320
|
};
|
|
317
321
|
readonly project_root: {
|
|
318
322
|
readonly type: "string";
|
|
319
|
-
readonly description: "
|
|
323
|
+
readonly description: "可选。项目根目录绝对路径;未传时自动从 MCP 客户端工作区解析(如 Cursor 注入 WORKSPACE_FOLDER_PATHS、OpenCode/客户端配置的 cwd 等)。仅边缘场景需手动传入。";
|
|
320
324
|
};
|
|
321
325
|
};
|
|
322
326
|
readonly required: readonly [];
|
|
@@ -15,6 +15,46 @@ export declare const ProjectInitSchema: {
|
|
|
15
15
|
readonly projectName: {
|
|
16
16
|
readonly type: "string";
|
|
17
17
|
};
|
|
18
|
+
readonly projectRoot: {
|
|
19
|
+
readonly type: "string";
|
|
20
|
+
readonly description: "解析后的项目根目录(POSIX)";
|
|
21
|
+
};
|
|
22
|
+
readonly bootstrap: {
|
|
23
|
+
readonly type: "object";
|
|
24
|
+
readonly description: "MCP Skill / AGENTS.md 自动安装结果";
|
|
25
|
+
readonly properties: {
|
|
26
|
+
readonly skillPath: {
|
|
27
|
+
readonly type: "string";
|
|
28
|
+
};
|
|
29
|
+
readonly agentsMdPath: {
|
|
30
|
+
readonly type: "string";
|
|
31
|
+
};
|
|
32
|
+
readonly skillCreated: {
|
|
33
|
+
readonly type: "boolean";
|
|
34
|
+
};
|
|
35
|
+
readonly skillUpdated: {
|
|
36
|
+
readonly type: "boolean";
|
|
37
|
+
};
|
|
38
|
+
readonly agentsCreated: {
|
|
39
|
+
readonly type: "boolean";
|
|
40
|
+
};
|
|
41
|
+
readonly agentsUpdated: {
|
|
42
|
+
readonly type: "boolean";
|
|
43
|
+
};
|
|
44
|
+
readonly workspaceWarnings: {
|
|
45
|
+
readonly type: "array";
|
|
46
|
+
readonly items: {
|
|
47
|
+
readonly type: "string";
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
readonly rootSource: {
|
|
51
|
+
readonly type: "string";
|
|
52
|
+
};
|
|
53
|
+
readonly explicitHonored: {
|
|
54
|
+
readonly type: "boolean";
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
};
|
|
18
58
|
readonly structure: {
|
|
19
59
|
readonly type: "object";
|
|
20
60
|
readonly description: "项目结构";
|
|
@@ -404,6 +444,18 @@ export declare const ConflictResolutionSchema: {
|
|
|
404
444
|
export interface ProjectInit {
|
|
405
445
|
summary: string;
|
|
406
446
|
projectName: string;
|
|
447
|
+
projectRoot?: string;
|
|
448
|
+
bootstrap?: {
|
|
449
|
+
skillPath: string;
|
|
450
|
+
agentsMdPath: string;
|
|
451
|
+
skillCreated: boolean;
|
|
452
|
+
skillUpdated: boolean;
|
|
453
|
+
agentsCreated: boolean;
|
|
454
|
+
agentsUpdated: boolean;
|
|
455
|
+
workspaceWarnings: string[];
|
|
456
|
+
rootSource: string;
|
|
457
|
+
explicitHonored: boolean;
|
|
458
|
+
};
|
|
407
459
|
structure: {
|
|
408
460
|
directories?: string[];
|
|
409
461
|
files?: string[];
|
|
@@ -11,6 +11,22 @@ export const ProjectInitSchema = {
|
|
|
11
11
|
properties: {
|
|
12
12
|
summary: { type: 'string' },
|
|
13
13
|
projectName: { type: 'string' },
|
|
14
|
+
projectRoot: { type: 'string', description: '解析后的项目根目录(POSIX)' },
|
|
15
|
+
bootstrap: {
|
|
16
|
+
type: 'object',
|
|
17
|
+
description: 'MCP Skill / AGENTS.md 自动安装结果',
|
|
18
|
+
properties: {
|
|
19
|
+
skillPath: { type: 'string' },
|
|
20
|
+
agentsMdPath: { type: 'string' },
|
|
21
|
+
skillCreated: { type: 'boolean' },
|
|
22
|
+
skillUpdated: { type: 'boolean' },
|
|
23
|
+
agentsCreated: { type: 'boolean' },
|
|
24
|
+
agentsUpdated: { type: 'boolean' },
|
|
25
|
+
workspaceWarnings: { type: 'array', items: { type: 'string' } },
|
|
26
|
+
rootSource: { type: 'string' },
|
|
27
|
+
explicitHonored: { type: 'boolean' },
|
|
28
|
+
},
|
|
29
|
+
},
|
|
14
30
|
structure: {
|
|
15
31
|
type: 'object',
|
|
16
32
|
description: '项目结构',
|
|
@@ -124,7 +124,7 @@ export declare const projectToolSchemas: readonly [{
|
|
|
124
124
|
};
|
|
125
125
|
readonly project_root: {
|
|
126
126
|
readonly type: "string";
|
|
127
|
-
readonly description: "
|
|
127
|
+
readonly description: "可选。项目根目录绝对路径;未传时自动从 MCP 客户端工作区解析(如 Cursor 注入 WORKSPACE_FOLDER_PATHS、OpenCode/客户端配置的 cwd 等)。仅边缘场景需手动传入。";
|
|
128
128
|
};
|
|
129
129
|
};
|
|
130
130
|
readonly required: readonly [];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 项目管理工具的 Schema 定义
|
|
3
3
|
*/
|
|
4
|
+
import { PROJECT_ROOT_SCHEMA_DESCRIPTION } from "../lib/workspace-root.js";
|
|
4
5
|
export const projectToolSchemas = [
|
|
5
6
|
{
|
|
6
7
|
name: "workflow",
|
|
@@ -129,7 +130,7 @@ export const projectToolSchemas = [
|
|
|
129
130
|
},
|
|
130
131
|
project_root: {
|
|
131
132
|
type: "string",
|
|
132
|
-
description:
|
|
133
|
+
description: PROJECT_ROOT_SCHEMA_DESCRIPTION,
|
|
133
134
|
},
|
|
134
135
|
},
|
|
135
136
|
required: [],
|