@shaohui_jin/git-cockpit-mcp-server 0.1.17 → 0.1.18

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.
@@ -7,17 +7,10 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
7
7
  import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
8
8
 
9
9
  // package.json
10
- var version = "0.1.17";
11
-
12
- // src/tools/handlers.ts
13
- import { z } from "zod";
14
- import {
15
- BackupManager,
16
- GitOperationError,
17
- PermissionError
18
- } from "@shaohui_jin/git-cockpit-core";
10
+ var version = "0.1.18";
19
11
 
20
12
  // src/tools/format.ts
13
+ import { suggestNext } from "@shaohui_jin/git-cockpit-core";
21
14
  var FILE_CONTENT_LIMIT = 64 * 1024;
22
15
  function wantsDetail(args) {
23
16
  return args?.detail === true;
@@ -46,60 +39,66 @@ function stripRehearseBodies(result) {
46
39
  hunks: []
47
40
  };
48
41
  });
49
- const first = typeof paths[0]?.path === "string" ? paths[0].path : "";
50
42
  return {
51
43
  ...r,
52
44
  conflictFiles: paths,
53
- detailAvailable: true,
54
- next: first ? [{ tool: "git_merge_rehearse", args: { into: r.into, from: r.from, path: first } }] : []
45
+ detailAvailable: true
55
46
  };
56
47
  }
57
- function summarizeForAgent(tool, result, args = {}) {
48
+ function attachNext(tool, result, args, dryRun2) {
49
+ const rec = asRecord(result);
50
+ if (!rec) return result;
51
+ if (Array.isArray(rec.next) && rec.next.length) return result;
52
+ const next = suggestNext(tool, result, args, { dryRun: dryRun2 });
53
+ if (!next.length) return result;
54
+ return { ...rec, next };
55
+ }
56
+ function summarizeForAgent(tool, result, args = {}, dryRun2 = false) {
58
57
  if (result == null) return result;
59
58
  const detail2 = wantsDetail(args);
60
59
  const pathSet = hasPath(args);
60
+ let summarized = result;
61
61
  if (tool === "git_diff" || tool === "git_stash_show") {
62
- if (detail2 || pathSet) return result;
63
- return stripDiffPatch(result);
64
- }
65
- if (tool === "git_show") {
66
- if (detail2 || pathSet) return result;
67
- const row = asRecord(result);
68
- if (!row) return result;
69
- return { ...row, diff: stripDiffPatch(row.diff) };
70
- }
71
- if (tool === "git_merge_rehearse") {
72
- if (detail2 || pathSet) return result;
73
- return stripRehearseBodies(result);
74
- }
75
- if (tool === "git_repo_overview") {
76
- if (detail2) return result;
77
- const row = asRecord(result);
78
- const repos = Array.isArray(row?.repos) ? row.repos : [];
79
- return {
80
- ...row,
81
- repos: repos.map((item) => {
82
- const rec = asRecord(item);
83
- if (!rec) return item;
84
- const { activity: _days, ...rest } = rec;
85
- return rest;
86
- })
87
- };
88
- }
89
- if (tool === "git_file_content") {
90
- if (detail2) return result;
91
- const row = asRecord(result);
92
- const content = typeof row?.content === "string" ? row.content : "";
93
- const bytes = Buffer.byteLength(content, "utf8");
94
- if (bytes <= FILE_CONTENT_LIMIT) return result;
95
- return {
96
- path: args.path,
97
- truncated: true,
98
- bytes,
99
- detailAvailable: true
100
- };
62
+ summarized = detail2 || pathSet ? result : stripDiffPatch(result);
63
+ } else if (tool === "git_show") {
64
+ if (detail2 || pathSet) {
65
+ summarized = result;
66
+ } else {
67
+ const row = asRecord(result);
68
+ summarized = row ? { ...row, diff: stripDiffPatch(row.diff) } : result;
69
+ }
70
+ } else if (tool === "git_merge_rehearse") {
71
+ summarized = detail2 || pathSet ? result : stripRehearseBodies(result);
72
+ } else if (tool === "git_repo_overview") {
73
+ if (!detail2) {
74
+ const row = asRecord(result);
75
+ const repos = Array.isArray(row?.repos) ? row.repos : [];
76
+ summarized = {
77
+ ...row,
78
+ repos: repos.map((item) => {
79
+ const rec = asRecord(item);
80
+ if (!rec) return item;
81
+ const { activity: _days, ...rest } = rec;
82
+ return rest;
83
+ })
84
+ };
85
+ }
86
+ } else if (tool === "git_file_content") {
87
+ if (!detail2) {
88
+ const row = asRecord(result);
89
+ const content = typeof row?.content === "string" ? row.content : "";
90
+ const bytes = Buffer.byteLength(content, "utf8");
91
+ if (bytes > FILE_CONTENT_LIMIT) {
92
+ summarized = {
93
+ path: args.path,
94
+ truncated: true,
95
+ bytes,
96
+ detailAvailable: true
97
+ };
98
+ }
99
+ }
101
100
  }
102
- return result;
101
+ return attachNext(tool, summarized, args, dryRun2);
103
102
  }
104
103
  function formatResultForMcp(exec) {
105
104
  if (!exec.success) {
@@ -115,122 +114,23 @@ function formatResultForMcp(exec) {
115
114
  `[\u81EA\u52A8\u5907\u4EFD] \u5206\u652F ${exec.backupCreated.branch ?? "(\u672A\u521B\u5EFA)"}${exec.backupCreated.stashRef ? `\uFF0Cstash ${exec.backupCreated.stashRef}` : ""}`
116
115
  );
117
116
  }
118
- const summarized = summarizeForAgent(exec.tool, exec.result, exec.args ?? {});
117
+ const summarized = summarizeForAgent(exec.tool, exec.result, exec.args ?? {}, exec.dryRun);
118
+ const rec = asRecord(summarized);
119
+ const next = Array.isArray(rec?.next) ? rec.next : [];
120
+ if (next.length) {
121
+ const names = next.map((step) => asRecord(step)?.tool).filter((n) => typeof n === "string" && n.length > 0);
122
+ if (names.length) parts.push(`next: ${names.join(" \u2192 ")}`);
123
+ }
119
124
  const payload = typeof summarized === "string" ? summarized : JSON.stringify(summarized);
120
125
  parts.push(payload);
121
126
  return parts.join("\n\n");
122
127
  }
123
128
 
124
129
  // src/tools/handlers.ts
125
- async function resolveRepo(runtime, ctx, argsPath) {
126
- if (ctx.repoId !== void 0) {
127
- const handle = await runtime.repoManager.getById(ctx.repoId);
128
- if (handle) return handle;
129
- throw new GitOperationError(`\u4ED3\u5E93\u4E0D\u5B58\u5728: id=${ctx.repoId}`, "REPO_NOT_FOUND");
130
- }
131
- if (ctx.repoPath) {
132
- return runtime.repoManager.getByPath(ctx.repoPath);
133
- }
134
- if (argsPath) {
135
- return runtime.repoManager.open(argsPath);
136
- }
137
- const current = await runtime.repoManager.getCurrent();
138
- if (!current) {
139
- throw new GitOperationError("\u5C1A\u672A\u6253\u5F00\u4EFB\u4F55\u4ED3\u5E93\u3002\u8BF7\u5148\u6253\u5F00\u4ED3\u5E93\u6216\u63D0\u4F9B repoPath \u53C2\u6570\u3002", "NO_ACTIVE_REPO");
140
- }
141
- return current;
142
- }
143
- function extractError(err) {
144
- if (err instanceof PermissionError) {
145
- return { code: "PERMISSION_DENIED", message: err.message, requiredApproval: err.requiredApproval };
146
- }
147
- if (err instanceof GitOperationError) {
148
- return { code: err.code, message: err.message, requiredApproval: false };
149
- }
150
- if (err instanceof z.ZodError) {
151
- const summary = err.issues.map((i) => `${i.path.join(".") || "(root)"}: ${i.message}`).slice(0, 5).join("; ");
152
- return { code: "INVALID_ARGS", message: `\u53C2\u6570\u6821\u9A8C\u5931\u8D25\uFF1A${summary}`, requiredApproval: false };
153
- }
154
- const msg = err instanceof Error ? err.message : String(err);
155
- return { code: "INTERNAL_ERROR", message: msg.slice(0, 500), requiredApproval: false };
156
- }
157
- async function executeTool(def, rawArgs, ctx) {
158
- const runtime = ctx.runtime;
159
- const t0 = Date.now();
160
- const dryRun2 = typeof rawArgs.dryRun === "boolean" ? rawArgs.dryRun : runtime.permissions.getDryRunDefault();
161
- const record = (result, params, errorMessage, repoPath2) => {
162
- runtime.auditLogger.log({
163
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
164
- source: ctx.source,
165
- tool: def.name,
166
- repoPath: repoPath2 ?? "",
167
- params,
168
- result,
169
- error: errorMessage ?? null,
170
- durationMs: Date.now() - t0,
171
- dryRun: dryRun2
172
- });
173
- runtime.eventBus.emit("log", { tool: def.name, result, at: (/* @__PURE__ */ new Date()).toISOString() });
174
- };
175
- try {
176
- runtime.permissions.assertAllowed(def.name);
177
- let args;
178
- try {
179
- args = def.schema.parse(rawArgs);
180
- } catch (err) {
181
- const e = extractError(err);
182
- record("error", rawArgs, e.message);
183
- return { tool: def.name, source: ctx.source, dryRun: dryRun2, success: false, error: e, durationMs: Date.now() - t0 };
184
- }
185
- let git;
186
- let repoPath2 = "";
187
- if (def.needsRepo !== false) {
188
- const handle = await resolveRepo(runtime, ctx, args.repoPath);
189
- git = handle.service;
190
- repoPath2 = git.repoPath;
191
- }
192
- let backup = null;
193
- if (!dryRun2 && def.risk === "dangerous" && runtime.config.git.backupOnDangerousOps && git) {
194
- backup = await new BackupManager(git).createBackup();
195
- args = { ...args, __backup: { branch: backup.branch, stashRef: backup.stashRef } };
196
- }
197
- const result = await def.handler(args, { ...ctx, git, repoPath: repoPath2 });
198
- record("success", args, void 0, repoPath2);
199
- const preview = dryRun2 ? result : void 0;
200
- return {
201
- tool: def.name,
202
- source: ctx.source,
203
- dryRun: dryRun2,
204
- success: true,
205
- result,
206
- preview,
207
- backupCreated: backup,
208
- durationMs: Date.now() - t0,
209
- args
210
- };
211
- } catch (err) {
212
- const e = extractError(err);
213
- const isDenied = err instanceof PermissionError;
214
- record(isDenied ? "denied" : "error", rawArgs, e.message);
215
- return {
216
- tool: def.name,
217
- source: ctx.source,
218
- dryRun: dryRun2,
219
- success: false,
220
- error: e,
221
- durationMs: Date.now() - t0
222
- };
223
- }
224
- }
130
+ import { executeCapability } from "@shaohui_jin/git-cockpit-core";
225
131
 
226
- // src/tools/index.ts
227
- import {
228
- enrichPrepareMr,
229
- createPullOrMergeRequest,
230
- BackupManager as BackupManager2,
231
- GitOperationError as GitOperationError2,
232
- SURVEY_ASYNC_THRESHOLD
233
- } from "@shaohui_jin/git-cockpit-core";
132
+ // src/host.ts
133
+ import { GitOperationError } from "@shaohui_jin/git-cockpit-core";
234
134
 
235
135
  // src/overview.ts
236
136
  import { emptyActivity } from "@shaohui_jin/git-cockpit-core";
@@ -281,246 +181,319 @@ async function collectRepoOverviews(runtime) {
281
181
  });
282
182
  }
283
183
 
184
+ // src/host.ts
185
+ function hostFromRuntime(runtime) {
186
+ return {
187
+ config: runtime.config,
188
+ permissions: runtime.permissions,
189
+ auditLogger: runtime.auditLogger,
190
+ eventBus: runtime.eventBus,
191
+ jobs: runtime.jobs,
192
+ async resolveRepo({ repoId, repoPath: repoPath2, argsPath }) {
193
+ if (repoId !== void 0) {
194
+ const handle = await runtime.repoManager.getById(repoId);
195
+ if (handle) return { git: handle.service, repoPath: handle.service.repoPath };
196
+ throw new GitOperationError(`\u4ED3\u5E93\u4E0D\u5B58\u5728: id=${repoId}`, "REPO_NOT_FOUND");
197
+ }
198
+ if (repoPath2) {
199
+ const handle = runtime.repoManager.getByPath(repoPath2);
200
+ return { git: handle.service, repoPath: handle.service.repoPath };
201
+ }
202
+ if (argsPath) {
203
+ const handle = await runtime.repoManager.open(argsPath);
204
+ return { git: handle.service, repoPath: handle.service.repoPath };
205
+ }
206
+ const current = await runtime.repoManager.getCurrent();
207
+ if (!current) {
208
+ throw new GitOperationError("\u5C1A\u672A\u6253\u5F00\u4EFB\u4F55\u4ED3\u5E93\u3002\u8BF7\u5148\u6253\u5F00\u4ED3\u5E93\u6216\u63D0\u4F9B repoPath \u53C2\u6570\u3002", "NO_ACTIVE_REPO");
209
+ }
210
+ return { git: current.service, repoPath: current.service.repoPath };
211
+ },
212
+ listOverviews: () => collectRepoOverviews(runtime)
213
+ };
214
+ }
215
+
216
+ // src/tools/handlers.ts
217
+ async function executeTool(def, rawArgs, ctx) {
218
+ return executeCapability(def, rawArgs, {
219
+ source: ctx.source,
220
+ repoId: ctx.repoId,
221
+ repoPath: ctx.repoPath,
222
+ host: hostFromRuntime(ctx.runtime)
223
+ });
224
+ }
225
+
226
+ // src/tools/bindMcp.ts
227
+ function bindMcpTools(server, runtime, capabilities) {
228
+ for (const def of capabilities) {
229
+ const register = server.registerTool.bind(server);
230
+ register(
231
+ def.name,
232
+ { description: def.description, inputSchema: def.schema },
233
+ async (args) => {
234
+ const exec = await executeTool(def, args ?? {}, {
235
+ runtime,
236
+ source: "mcp"
237
+ });
238
+ return {
239
+ content: [{ type: "text", text: formatResultForMcp(exec) }],
240
+ isError: !exec.success
241
+ };
242
+ }
243
+ );
244
+ }
245
+ }
246
+
247
+ // src/tools/index.ts
248
+ import {
249
+ enrichPrepareMr,
250
+ createPullOrMergeRequest,
251
+ BackupManager,
252
+ GitOperationError as GitOperationError2,
253
+ SURVEY_ASYNC_THRESHOLD,
254
+ getCapabilityRegistry
255
+ } from "@shaohui_jin/git-cockpit-core";
256
+
284
257
  // src/tools/schemas.ts
285
- import { z as z2 } from "zod";
286
- var repoPath = z2.string().optional().describe("\u4ED3\u5E93\u7EDD\u5BF9\u8DEF\u5F84\u3002\u4E0D\u63D0\u4F9B\u65F6\u4F7F\u7528\u5F53\u524D\u6253\u5F00\u7684\u4ED3\u5E93\u3002");
287
- var dryRun = z2.boolean().optional().describe("\u4E3A true \u65F6\u4EC5\u8FD4\u56DE\u5C06\u6267\u884C\u7684\u547D\u4EE4\u4E0E\u5F71\u54CD\u8303\u56F4\uFF08\u9884\u89C8/\u5E72\u8FD0\u884C\uFF09\uFF0C\u4E0D\u771F\u6B63\u4FEE\u6539\u4ED3\u5E93\u3002");
288
- var detail = z2.boolean().optional().describe("\u4E3A true \u65F6 MCP \u8FD4\u56DE\u5B8C\u6574\u6B63\u6587\uFF1B\u9ED8\u8BA4\u53EA\u56DE\u6458\u8981\uFF08\u8DEF\u5F84/\u7EDF\u8BA1\uFF09\u3002\u7F51\u9875 GET \u4E0D\u53D7\u5F71\u54CD\u3002");
289
- var maxCount = z2.number().int().min(1).max(1e4).optional().describe("\u6700\u591A\u8FD4\u56DE\u7684\u63D0\u4EA4\u6570\u91CF\u3002");
258
+ import { z } from "zod";
259
+ var repoPath = z.string().optional().describe("\u4ED3\u5E93\u7EDD\u5BF9\u8DEF\u5F84\u3002\u4E0D\u63D0\u4F9B\u65F6\u4F7F\u7528\u5F53\u524D\u6253\u5F00\u7684\u4ED3\u5E93\u3002");
260
+ var dryRun = z.boolean().optional().describe("\u4E3A true \u65F6\u4EC5\u8FD4\u56DE\u5C06\u6267\u884C\u7684\u547D\u4EE4\u4E0E\u5F71\u54CD\u8303\u56F4\uFF08\u9884\u89C8/\u5E72\u8FD0\u884C\uFF09\uFF0C\u4E0D\u771F\u6B63\u4FEE\u6539\u4ED3\u5E93\u3002");
261
+ var detail = z.boolean().optional().describe("\u4E3A true \u65F6 MCP \u8FD4\u56DE\u5B8C\u6574\u6B63\u6587\uFF1B\u9ED8\u8BA4\u53EA\u56DE\u6458\u8981\uFF08\u8DEF\u5F84/\u7EDF\u8BA1\uFF09\u3002\u7F51\u9875 GET \u4E0D\u53D7\u5F71\u54CD\u3002");
262
+ var maxCount = z.number().int().min(1).max(1e4).optional().describe("\u6700\u591A\u8FD4\u56DE\u7684\u63D0\u4EA4\u6570\u91CF\u3002");
290
263
  var readonlyBase = { repoPath };
291
- var GitStatusSchema = z2.object({ ...readonlyBase });
292
- var GitLogSchema = z2.object({
264
+ var GitStatusSchema = z.object({ ...readonlyBase });
265
+ var GitLogSchema = z.object({
293
266
  ...readonlyBase,
294
267
  maxCount,
295
- from: z2.string().optional().describe("\u8D77\u59CB\u63D0\u4EA4\uFF08\u542B\uFF09\uFF1B\u4E0E to \u914D\u5408\u8868\u793A\u8303\u56F4 from..to"),
296
- to: z2.string().optional().describe("\u7ED3\u675F\u63D0\u4EA4\uFF08\u542B\uFF09"),
297
- author: z2.string().optional().describe("\u6309\u4F5C\u8005\u8FC7\u6EE4\uFF08\u652F\u6301\u5B50\u4E32\uFF09"),
298
- path: z2.string().optional().describe("\u4EC5\u67E5\u770B\u8BE5\u8DEF\u5F84\u7684\u5386\u53F2"),
299
- all: z2.boolean().optional().describe("\u5305\u542B\u6240\u6709\u5206\u652F\uFF08--all\uFF09")
268
+ from: z.string().optional().describe("\u8D77\u59CB\u63D0\u4EA4\uFF08\u542B\uFF09\uFF1B\u4E0E to \u914D\u5408\u8868\u793A\u8303\u56F4 from..to"),
269
+ to: z.string().optional().describe("\u7ED3\u675F\u63D0\u4EA4\uFF08\u542B\uFF09"),
270
+ author: z.string().optional().describe("\u6309\u4F5C\u8005\u8FC7\u6EE4\uFF08\u652F\u6301\u5B50\u4E32\uFF09"),
271
+ path: z.string().optional().describe("\u4EC5\u67E5\u770B\u8BE5\u8DEF\u5F84\u7684\u5386\u53F2"),
272
+ all: z.boolean().optional().describe("\u5305\u542B\u6240\u6709\u5206\u652F\uFF08--all\uFF09")
300
273
  });
301
- var GitDiffSchema = z2.object({
274
+ var GitDiffSchema = z.object({
302
275
  ...readonlyBase,
303
- from: z2.string().optional().describe("\u8D77\u70B9\u63D0\u4EA4"),
304
- to: z2.string().optional().describe("\u7EC8\u70B9\u63D0\u4EA4"),
305
- path: z2.string().optional().describe("\u9650\u5B9A\u7684\u6587\u4EF6\u8DEF\u5F84"),
306
- staged: z2.boolean().optional().describe("\u67E5\u770B\u5DF2\u6682\u5B58\uFF08\u7D22\u5F15\uFF09\u5DEE\u5F02"),
307
- maxPatchBytes: z2.number().int().positive().optional().describe("diff \u6B63\u6587\u6700\u5927\u5B57\u8282\u6570\uFF0C\u8D85\u51FA\u622A\u65AD"),
276
+ from: z.string().optional().describe("\u8D77\u70B9\u63D0\u4EA4"),
277
+ to: z.string().optional().describe("\u7EC8\u70B9\u63D0\u4EA4"),
278
+ path: z.string().optional().describe("\u9650\u5B9A\u7684\u6587\u4EF6\u8DEF\u5F84"),
279
+ staged: z.boolean().optional().describe("\u67E5\u770B\u5DF2\u6682\u5B58\uFF08\u7D22\u5F15\uFF09\u5DEE\u5F02"),
280
+ maxPatchBytes: z.number().int().positive().optional().describe("diff \u6B63\u6587\u6700\u5927\u5B57\u8282\u6570\uFF0C\u8D85\u51FA\u622A\u65AD"),
308
281
  detail
309
282
  });
310
- var GitShowSchema = z2.object({
283
+ var GitShowSchema = z.object({
311
284
  ...readonlyBase,
312
- commit: z2.string().describe("\u8981\u67E5\u770B\u7684\u63D0\u4EA4 hash"),
313
- path: z2.string().optional().describe("\u9650\u5B9A\u6587\u4EF6"),
314
- maxPatchBytes: z2.number().int().positive().optional(),
285
+ commit: z.string().describe("\u8981\u67E5\u770B\u7684\u63D0\u4EA4 hash"),
286
+ path: z.string().optional().describe("\u9650\u5B9A\u6587\u4EF6"),
287
+ maxPatchBytes: z.number().int().positive().optional(),
315
288
  detail
316
289
  });
317
- var GitBranchListSchema = z2.object({ ...readonlyBase });
318
- var GitTagListSchema = z2.object({ ...readonlyBase });
319
- var GitRemoteListSchema = z2.object({ ...readonlyBase });
320
- var GitFileContentSchema = z2.object({
290
+ var GitBranchListSchema = z.object({ ...readonlyBase });
291
+ var GitTagListSchema = z.object({ ...readonlyBase });
292
+ var GitRemoteListSchema = z.object({ ...readonlyBase });
293
+ var GitFileContentSchema = z.object({
321
294
  ...readonlyBase,
322
- commit: z2.string().describe("\u63D0\u4EA4 hash\uFF08\u5982 HEAD\u3001main\uFF09"),
323
- path: z2.string().describe("\u4ED3\u5E93\u5185\u6587\u4EF6\u76F8\u5BF9\u8DEF\u5F84"),
295
+ commit: z.string().describe("\u63D0\u4EA4 hash\uFF08\u5982 HEAD\u3001main\uFF09"),
296
+ path: z.string().describe("\u4ED3\u5E93\u5185\u6587\u4EF6\u76F8\u5BF9\u8DEF\u5F84"),
324
297
  detail
325
298
  });
326
- var GitGraphSchema = z2.object({
299
+ var GitGraphSchema = z.object({
327
300
  ...readonlyBase,
328
- maxCount: z2.number().int().min(1).max(5e3).optional().describe("\u6700\u5927\u63D0\u4EA4\u6570")
301
+ maxCount: z.number().int().min(1).max(5e3).optional().describe("\u6700\u5927\u63D0\u4EA4\u6570")
329
302
  });
330
- var GitBranchGraphSchema = z2.object({
303
+ var GitBranchGraphSchema = z.object({
331
304
  ...readonlyBase,
332
- maxNodes: z2.number().int().min(1).max(2e3).optional().describe("rev-list \u6700\u591A\u679A\u4E3E\u7684\u63D0\u4EA4\u6570\uFF0C\u7F3A\u7701 200"),
333
- into: z2.string().optional().describe("\u5408\u5165\u76EE\u6807\uFF08\u7EBF\u4E0A / ours\uFF09\u3002\u4E0E from \u4E00\u8D77\u65F6\u8FD4\u56DE lineage"),
334
- from: z2.string().optional().describe("\u6211\u7684\u5206\u652F\uFF08theirs\uFF09\u3002\u4E0E into \u4E00\u8D77\u65F6\u8FD4\u56DE lineage")
305
+ maxNodes: z.number().int().min(1).max(2e3).optional().describe("rev-list \u6700\u591A\u679A\u4E3E\u7684\u63D0\u4EA4\u6570\uFF0C\u7F3A\u7701 200"),
306
+ into: z.string().optional().describe("\u5408\u5165\u76EE\u6807\uFF08\u7EBF\u4E0A / ours\uFF09\u3002\u4E0E from \u4E00\u8D77\u65F6\u8FD4\u56DE lineage"),
307
+ from: z.string().optional().describe("\u6211\u7684\u5206\u652F\uFF08theirs\uFF09\u3002\u4E0E into \u4E00\u8D77\u65F6\u8FD4\u56DE lineage")
335
308
  });
336
- var GitReflogSchema = z2.object({
309
+ var GitReflogSchema = z.object({
337
310
  ...readonlyBase,
338
- maxCount: z2.number().int().min(1).max(500).optional().describe("\u6700\u591A\u8FD4\u56DE\u6761\u6570\uFF0C\u7F3A\u7701 50")
311
+ maxCount: z.number().int().min(1).max(500).optional().describe("\u6700\u591A\u8FD4\u56DE\u6761\u6570\uFF0C\u7F3A\u7701 50")
339
312
  });
340
313
  var mergeIntoFrom = {
341
- into: z2.string().min(1).describe("\u5408\u5165\u76EE\u6807\uFF08\u7EBF\u4E0A / ours / \u9884\u6F14\u5DE6\u4FA7\uFF09\u3002\u4F8B\u5982 origin/main"),
342
- from: z2.string().min(1).describe("\u6211\u7684\u5206\u652F\uFF08theirs / \u9884\u6F14\u53F3\u4FA7\uFF09\u3002\u4F8B\u5982 feature/x"),
343
- fetch: z2.boolean().optional().describe("\u662F\u5426\u5148\u975E\u4EA4\u4E92 fetch\u3002\u7F3A\u7701 true\uFF1B\u5931\u8D25\u5219\u7528\u672C\u5730\u5F15\u7528\u5E76\u6807\u660E stale"),
344
- remote: z2.string().optional().describe("fetch/push \u4F7F\u7528\u7684\u8FDC\u7A0B\u540D\uFF0C\u7F3A\u7701 origin"),
345
- path: z2.string().optional().describe("\u4EC5\u5173\u5FC3\u8BE5\u51B2\u7A81\u6587\u4EF6\u8DEF\u5F84")
314
+ into: z.string().min(1).describe("\u5408\u5165\u76EE\u6807\uFF08\u7EBF\u4E0A / ours / \u9884\u6F14\u5DE6\u4FA7\uFF09\u3002\u4F8B\u5982 origin/main"),
315
+ from: z.string().min(1).describe("\u6211\u7684\u5206\u652F\uFF08theirs / \u9884\u6F14\u53F3\u4FA7\uFF09\u3002\u4F8B\u5982 feature/x"),
316
+ fetch: z.boolean().optional().describe("\u662F\u5426\u5148\u975E\u4EA4\u4E92 fetch\u3002\u7F3A\u7701 true\uFF1B\u5931\u8D25\u5219\u7528\u672C\u5730\u5F15\u7528\u5E76\u6807\u660E stale"),
317
+ remote: z.string().optional().describe("fetch/push \u4F7F\u7528\u7684\u8FDC\u7A0B\u540D\uFF0C\u7F3A\u7701 origin"),
318
+ path: z.string().optional().describe("\u4EC5\u5173\u5FC3\u8BE5\u51B2\u7A81\u6587\u4EF6\u8DEF\u5F84")
346
319
  };
347
- var GitMergePreviewSchema = z2.object({
320
+ var GitMergePreviewSchema = z.object({
348
321
  ...readonlyBase,
349
322
  ...mergeIntoFrom
350
323
  });
351
- var GitMergeRehearseSchema = z2.object({
324
+ var GitMergeRehearseSchema = z.object({
352
325
  ...readonlyBase,
353
326
  ...mergeIntoFrom,
354
- maxFiles: z2.number().int().min(1).max(100).optional().describe("\u6700\u591A\u751F\u6210\u51B2\u7A81\u6B63\u6587\u7684\u6587\u4EF6\u6570\uFF0C\u7F3A\u7701 20"),
327
+ maxFiles: z.number().int().min(1).max(100).optional().describe("\u6700\u591A\u751F\u6210\u51B2\u7A81\u6B63\u6587\u7684\u6587\u4EF6\u6570\uFF0C\u7F3A\u7701 20"),
355
328
  detail
356
329
  });
357
- var GitMergeBlameSchema = z2.object({
330
+ var GitMergeBlameSchema = z.object({
358
331
  ...readonlyBase,
359
- into: z2.string().min(1).describe("\u5408\u5165\u76EE\u6807\uFF08\u7EBF\u4E0A / ours\uFF09"),
360
- from: z2.string().min(1).describe("\u6211\u7684\u5206\u652F\uFF08theirs\uFF09"),
361
- path: z2.string().min(1).describe("\u8981\u6EAF\u6E90\u7684\u51B2\u7A81\u6587\u4EF6\u8DEF\u5F84"),
362
- fetch: z2.boolean().optional().describe("\u662F\u5426\u5148\u975E\u4EA4\u4E92 fetch\u3002\u7F3A\u7701 false\uFF08\u9884\u6F14\u4E4B\u540E\u6309\u9700\u62C9\uFF09"),
363
- remote: z2.string().optional().describe("fetch \u4F7F\u7528\u7684\u8FDC\u7A0B\u540D\uFF0C\u7F3A\u7701 origin")
332
+ into: z.string().min(1).describe("\u5408\u5165\u76EE\u6807\uFF08\u7EBF\u4E0A / ours\uFF09"),
333
+ from: z.string().min(1).describe("\u6211\u7684\u5206\u652F\uFF08theirs\uFF09"),
334
+ path: z.string().min(1).describe("\u8981\u6EAF\u6E90\u7684\u51B2\u7A81\u6587\u4EF6\u8DEF\u5F84"),
335
+ fetch: z.boolean().optional().describe("\u662F\u5426\u5148\u975E\u4EA4\u4E92 fetch\u3002\u7F3A\u7701 false\uFF08\u9884\u6F14\u4E4B\u540E\u6309\u9700\u62C9\uFF09"),
336
+ remote: z.string().optional().describe("fetch \u4F7F\u7528\u7684\u8FDC\u7A0B\u540D\uFF0C\u7F3A\u7701 origin")
364
337
  });
365
- var GitMergeSurveySchema = z2.object({
338
+ var GitMergeSurveySchema = z.object({
366
339
  ...readonlyBase,
367
- intos: z2.array(z2.string().min(1)).min(1).describe("\u5408\u5165\u76EE\u6807\uFF08\u7EBF\u4E0A / ours\uFF09\u5217\u8868"),
368
- froms: z2.array(z2.string().min(1)).min(1).describe("\u6211\u7684\u5206\u652F\uFF08theirs\uFF09\u5217\u8868"),
369
- fetch: z2.boolean().optional().describe("\u662F\u5426\u5148\u975E\u4EA4\u4E92 fetch\u3002\u7F3A\u7701 true\uFF1B\u6574\u6279\u53EA fetch \u4E00\u6B21"),
370
- remote: z2.string().optional().describe("fetch \u4F7F\u7528\u7684\u8FDC\u7A0B\u540D\uFF0C\u7F3A\u7701 origin"),
371
- async: z2.boolean().optional().describe("\u4E3A true \u6216\u683C\u5B50\u6570>20 \u65F6\u540E\u53F0\u8DD1\uFF0C\u7ACB\u5373\u8FD4\u56DE jobId\uFF0C\u7528 git_job_get \u67E5\u7ED3\u679C")
340
+ intos: z.array(z.string().min(1)).min(1).describe("\u5408\u5165\u76EE\u6807\uFF08\u7EBF\u4E0A / ours\uFF09\u5217\u8868"),
341
+ froms: z.array(z.string().min(1)).min(1).describe("\u6211\u7684\u5206\u652F\uFF08theirs\uFF09\u5217\u8868"),
342
+ fetch: z.boolean().optional().describe("\u662F\u5426\u5148\u975E\u4EA4\u4E92 fetch\u3002\u7F3A\u7701 true\uFF1B\u6574\u6279\u53EA fetch \u4E00\u6B21"),
343
+ remote: z.string().optional().describe("fetch \u4F7F\u7528\u7684\u8FDC\u7A0B\u540D\uFF0C\u7F3A\u7701 origin"),
344
+ async: z.boolean().optional().describe("\u4E3A true \u6216\u683C\u5B50\u6570>20 \u65F6\u540E\u53F0\u8DD1\uFF0C\u7ACB\u5373\u8FD4\u56DE jobId\uFF0C\u7528 git_job_get \u67E5\u7ED3\u679C")
372
345
  });
373
- var GitMergeOrderSchema = z2.object({
346
+ var GitMergeOrderSchema = z.object({
374
347
  ...readonlyBase,
375
- into: z2.string().min(1).describe("\u5408\u5165\u76EE\u6807\uFF08\u7EBF\u4E0A / ours\uFF09"),
376
- branches: z2.array(z2.string().min(1)).min(2).describe("\u5F85\u4F9D\u6B21\u5408\u5165\u7684\u6765\u6E90\u5206\u652F\uFF08\u81F3\u5C11 2 \u4E2A\uFF09"),
377
- fetch: z2.boolean().optional().describe("\u662F\u5426\u5148\u975E\u4EA4\u4E92 fetch\u3002\u7F3A\u7701 true"),
378
- remote: z2.string().optional().describe("fetch \u4F7F\u7528\u7684\u8FDC\u7A0B\u540D\uFF0C\u7F3A\u7701 origin")
348
+ into: z.string().min(1).describe("\u5408\u5165\u76EE\u6807\uFF08\u7EBF\u4E0A / ours\uFF09"),
349
+ branches: z.array(z.string().min(1)).min(2).describe("\u5F85\u4F9D\u6B21\u5408\u5165\u7684\u6765\u6E90\u5206\u652F\uFF08\u81F3\u5C11 2 \u4E2A\uFF09"),
350
+ fetch: z.boolean().optional().describe("\u662F\u5426\u5148\u975E\u4EA4\u4E92 fetch\u3002\u7F3A\u7701 true"),
351
+ remote: z.string().optional().describe("fetch \u4F7F\u7528\u7684\u8FDC\u7A0B\u540D\uFF0C\u7F3A\u7701 origin")
379
352
  });
380
353
  var writeBase = { repoPath, dryRun };
381
- var pathsField = z2.array(z2.string()).default([]).describe("\u6587\u4EF6\u8DEF\u5F84\u5217\u8868\uFF1B\u7F3A\u7701\u4E3A\u7A7A\u5373\u5168\u90E8\u6587\u4EF6");
382
- var GitAddSchema = z2.object({ ...writeBase, paths: pathsField });
383
- var GitUnstageSchema = z2.object({ ...writeBase, paths: pathsField });
384
- var GitCommitSchema = z2.object({
354
+ var pathsField = z.array(z.string()).default([]).describe("\u6587\u4EF6\u8DEF\u5F84\u5217\u8868\uFF1B\u7F3A\u7701\u4E3A\u7A7A\u5373\u5168\u90E8\u6587\u4EF6");
355
+ var GitAddSchema = z.object({ ...writeBase, paths: pathsField });
356
+ var GitUnstageSchema = z.object({ ...writeBase, paths: pathsField });
357
+ var GitCommitSchema = z.object({
385
358
  ...writeBase,
386
- message: z2.string().min(1).describe("\u63D0\u4EA4\u4FE1\u606F"),
387
- paths: z2.array(z2.string()).optional().describe("\u4EC5\u63D0\u4EA4\u8FD9\u4E9B\u8DEF\u5F84\uFF08\u53EF\u7A7A\uFF09"),
388
- allowEmpty: z2.boolean().optional().describe("\u5141\u8BB8\u7A7A\u63D0\u4EA4\uFF08--allow-empty\uFF09")
359
+ message: z.string().min(1).describe("\u63D0\u4EA4\u4FE1\u606F"),
360
+ paths: z.array(z.string()).optional().describe("\u4EC5\u63D0\u4EA4\u8FD9\u4E9B\u8DEF\u5F84\uFF08\u53EF\u7A7A\uFF09"),
361
+ allowEmpty: z.boolean().optional().describe("\u5141\u8BB8\u7A7A\u63D0\u4EA4\uFF08--allow-empty\uFF09")
389
362
  });
390
- var GitCheckoutSchema = z2.object({
363
+ var GitCheckoutSchema = z.object({
391
364
  ...writeBase,
392
- branch: z2.string().describe("\u8981\u5207\u6362\u5230\u7684\u5206\u652F\u540D")
365
+ branch: z.string().describe("\u8981\u5207\u6362\u5230\u7684\u5206\u652F\u540D")
393
366
  });
394
- var GitBranchCreateSchema = z2.object({
367
+ var GitBranchCreateSchema = z.object({
395
368
  ...writeBase,
396
- name: z2.string().describe("\u65B0\u5206\u652F\u540D"),
397
- startPoint: z2.string().optional().describe("\u521B\u5EFA\u8D77\u70B9\uFF08\u63D0\u4EA4/\u5206\u652F\uFF09\uFF0C\u7F3A\u7701\u4E3A\u5F53\u524D HEAD")
369
+ name: z.string().describe("\u65B0\u5206\u652F\u540D"),
370
+ startPoint: z.string().optional().describe("\u521B\u5EFA\u8D77\u70B9\uFF08\u63D0\u4EA4/\u5206\u652F\uFF09\uFF0C\u7F3A\u7701\u4E3A\u5F53\u524D HEAD")
398
371
  });
399
- var GitBranchDeleteSchema = z2.object({
372
+ var GitBranchDeleteSchema = z.object({
400
373
  ...writeBase,
401
- name: z2.string().describe("\u8981\u5220\u9664\u7684\u5206\u652F\u540D\uFF08\u672A\u5408\u5E76\u5206\u652F\u4F1A\u88AB\u62D2\u7EDD\uFF09")
374
+ name: z.string().describe("\u8981\u5220\u9664\u7684\u5206\u652F\u540D\uFF08\u672A\u5408\u5E76\u5206\u652F\u4F1A\u88AB\u62D2\u7EDD\uFF09")
402
375
  });
403
- var GitMergeSchema = z2.object({
376
+ var GitMergeSchema = z.object({
404
377
  ...writeBase,
405
- branch: z2.string().describe("\u8981\u5408\u5E76\u8FDB\u6765\u7684\u5206\u652F\u540D")
378
+ branch: z.string().describe("\u8981\u5408\u5E76\u8FDB\u6765\u7684\u5206\u652F\u540D")
406
379
  });
407
- var GitPullSchema = z2.object({
380
+ var GitPullSchema = z.object({
408
381
  ...writeBase,
409
- remote: z2.string().optional().describe("\u8FDC\u7A0B\u540D\uFF08\u7F3A\u7701 origin\uFF09"),
410
- branch: z2.string().optional().describe("\u8FDC\u7AEF\u5206\u652F\u540D")
382
+ remote: z.string().optional().describe("\u8FDC\u7A0B\u540D\uFF08\u7F3A\u7701 origin\uFF09"),
383
+ branch: z.string().optional().describe("\u8FDC\u7AEF\u5206\u652F\u540D")
411
384
  });
412
- var GitFetchSchema = z2.object({
385
+ var GitFetchSchema = z.object({
413
386
  ...writeBase,
414
- remote: z2.string().optional().describe("\u8FDC\u7A0B\u540D\uFF08\u7F3A\u7701 origin\uFF09")
387
+ remote: z.string().optional().describe("\u8FDC\u7A0B\u540D\uFF08\u7F3A\u7701 origin\uFF09")
415
388
  });
416
- var continueFiles = z2.array(
417
- z2.object({
418
- path: z2.string().describe("\u4ED3\u5E93\u5185\u76F8\u5BF9\u8DEF\u5F84"),
419
- resolvedContent: z2.string().describe("\u8BE5\u6587\u4EF6\u89E3\u51B3\u540E\u7684\u5B8C\u6574\u5185\u5BB9")
389
+ var continueFiles = z.array(
390
+ z.object({
391
+ path: z.string().describe("\u4ED3\u5E93\u5185\u76F8\u5BF9\u8DEF\u5F84"),
392
+ resolvedContent: z.string().describe("\u8BE5\u6587\u4EF6\u89E3\u51B3\u540E\u7684\u5B8C\u6574\u5185\u5BB9")
420
393
  })
421
394
  ).optional().describe("\u5DF2\u89E3\u51B3\u51B2\u7A81\u7684\u6587\u4EF6\uFF1B\u5199\u5165\u5DE5\u4F5C\u533A\u5E76 git add \u540E\u518D continue\u3002\u5DF2\u5728\u7F16\u8F91\u5668\u89E3\u51B3\u5E76\u53EF\u4E3A\u7A7A");
422
- var GitMergeAbortSchema = z2.object({ ...writeBase });
423
- var GitMergeContinueSchema = z2.object({
395
+ var GitMergeAbortSchema = z.object({ ...writeBase });
396
+ var GitMergeContinueSchema = z.object({
424
397
  ...writeBase,
425
398
  files: continueFiles
426
399
  });
427
- var GitRebaseAbortSchema = z2.object({ ...writeBase });
428
- var GitRebaseContinueSchema = z2.object({
400
+ var GitRebaseAbortSchema = z.object({ ...writeBase });
401
+ var GitRebaseContinueSchema = z.object({
429
402
  ...writeBase,
430
403
  files: continueFiles
431
404
  });
432
- var GitPushSchema = z2.object({
405
+ var GitPushSchema = z.object({
433
406
  ...writeBase,
434
- remote: z2.string().optional().describe("\u8FDC\u7A0B\u540D\uFF08\u7F3A\u7701 origin\uFF09"),
435
- branch: z2.string().optional().describe("\u5206\u652F\u540D")
407
+ remote: z.string().optional().describe("\u8FDC\u7A0B\u540D\uFF08\u7F3A\u7701 origin\uFF09"),
408
+ branch: z.string().optional().describe("\u5206\u652F\u540D")
436
409
  });
437
- var GitTagCreateSchema = z2.object({
410
+ var GitTagCreateSchema = z.object({
438
411
  ...writeBase,
439
- name: z2.string().describe("\u6807\u7B7E\u540D"),
440
- message: z2.string().optional().describe("\u9644\u6CE8\u6807\u7B7E\u6D88\u606F\uFF08\u5E26\u5219\u521B\u5EFA annotated tag\uFF09"),
441
- commit: z2.string().optional().describe("\u6253\u6807\u7B7E\u7684\u63D0\u4EA4\uFF0C\u7F3A\u7701\u4E3A HEAD")
412
+ name: z.string().describe("\u6807\u7B7E\u540D"),
413
+ message: z.string().optional().describe("\u9644\u6CE8\u6807\u7B7E\u6D88\u606F\uFF08\u5E26\u5219\u521B\u5EFA annotated tag\uFF09"),
414
+ commit: z.string().optional().describe("\u6253\u6807\u7B7E\u7684\u63D0\u4EA4\uFF0C\u7F3A\u7701\u4E3A HEAD")
442
415
  });
443
- var GitStashSchema = z2.object({
416
+ var GitStashSchema = z.object({
444
417
  ...writeBase,
445
- message: z2.string().optional().describe("stash \u6D88\u606F"),
446
- includeUntracked: z2.boolean().optional().describe("\u5305\u542B\u672A\u8DDF\u8E2A\u6587\u4EF6\uFF08-u\uFF09"),
418
+ message: z.string().optional().describe("stash \u6D88\u606F"),
419
+ includeUntracked: z.boolean().optional().describe("\u5305\u542B\u672A\u8DDF\u8E2A\u6587\u4EF6\uFF08-u\uFF09"),
447
420
  paths: pathsField.describe("\u4EC5\u6682\u5B58\u8FD9\u4E9B\u6587\u4EF6\uFF08\u5BF9\u5E94 WebStorm Shelve \u7684\u9009\u62E9\u6027\u6682\u5B58\uFF1B\u7A7A\u5219\u6682\u5B58\u5168\u90E8\uFF09")
448
421
  });
449
- var GitStashListSchema = z2.object({ ...readonlyBase });
450
- var GitStashShowSchema = z2.object({
422
+ var GitStashListSchema = z.object({ ...readonlyBase });
423
+ var GitStashShowSchema = z.object({
451
424
  ...readonlyBase,
452
- index: z2.number().int().min(0).optional().describe("stash \u5E8F\u53F7\uFF0C\u7F3A\u7701\u4E3A stash@{0}"),
453
- maxPatchBytes: z2.number().int().positive().optional().describe("diff \u6B63\u6587\u6700\u5927\u5B57\u8282\u6570\uFF0C\u8D85\u51FA\u622A\u65AD"),
425
+ index: z.number().int().min(0).optional().describe("stash \u5E8F\u53F7\uFF0C\u7F3A\u7701\u4E3A stash@{0}"),
426
+ maxPatchBytes: z.number().int().positive().optional().describe("diff \u6B63\u6587\u6700\u5927\u5B57\u8282\u6570\uFF0C\u8D85\u51FA\u622A\u65AD"),
454
427
  detail
455
428
  });
456
- var GitRepoOverviewSchema = z2.object({ ...readonlyBase, detail });
457
- var GitJobListSchema = z2.object({ ...readonlyBase });
458
- var GitJobGetSchema = z2.object({
429
+ var GitRepoOverviewSchema = z.object({ ...readonlyBase, detail });
430
+ var GitJobListSchema = z.object({ ...readonlyBase });
431
+ var GitJobGetSchema = z.object({
459
432
  ...readonlyBase,
460
- id: z2.string().min(1).describe("\u540E\u53F0\u4EFB\u52A1 id")
433
+ id: z.string().min(1).describe("\u540E\u53F0\u4EFB\u52A1 id")
461
434
  });
462
- var GitJobCancelSchema = z2.object({
435
+ var GitJobCancelSchema = z.object({
463
436
  ...writeBase,
464
- id: z2.string().min(1).describe("\u8981\u53D6\u6D88\u7684\u540E\u53F0\u4EFB\u52A1 id")
437
+ id: z.string().min(1).describe("\u8981\u53D6\u6D88\u7684\u540E\u53F0\u4EFB\u52A1 id")
465
438
  });
466
- var GitStashApplySchema = z2.object({
439
+ var GitStashApplySchema = z.object({
467
440
  ...writeBase,
468
- index: z2.number().int().min(0).optional().describe("stash \u5E8F\u53F7\uFF0C\u7F3A\u7701\u4E3A stash@{0}")
441
+ index: z.number().int().min(0).optional().describe("stash \u5E8F\u53F7\uFF0C\u7F3A\u7701\u4E3A stash@{0}")
469
442
  });
470
- var GitStashDropSchema = z2.object({
443
+ var GitStashDropSchema = z.object({
471
444
  ...writeBase,
472
- index: z2.number().int().min(0).optional().describe("stash \u5E8F\u53F7\uFF0C\u7F3A\u7701\u4E3A stash@{0}")
445
+ index: z.number().int().min(0).optional().describe("stash \u5E8F\u53F7\uFF0C\u7F3A\u7701\u4E3A stash@{0}")
473
446
  });
474
- var GitStashPopSchema = z2.object({
447
+ var GitStashPopSchema = z.object({
475
448
  ...writeBase,
476
- index: z2.number().int().min(0).optional().describe("stash \u5E8F\u53F7\uFF0C\u7F3A\u7701\u4E3A\u6700\u65B0\u7684 stash@{0}")
449
+ index: z.number().int().min(0).optional().describe("stash \u5E8F\u53F7\uFF0C\u7F3A\u7701\u4E3A\u6700\u65B0\u7684 stash@{0}")
477
450
  });
478
- var GitApplyResolveSchema = z2.object({
451
+ var GitApplyResolveSchema = z.object({
479
452
  ...writeBase,
480
- into: z2.string().min(1).describe("\u5408\u5165\u76EE\u6807\uFF08\u7EBF\u4E0A / ours\uFF09\u3002\u4F8B\u5982 origin/main"),
481
- from: z2.string().min(1).describe("\u6211\u7684\u5206\u652F\uFF08theirs\uFF09\u3002\u4F8B\u5982 feature/x"),
482
- remote: z2.string().optional().describe("push \u4F7F\u7528\u7684\u8FDC\u7A0B\u540D\uFF0C\u7F3A\u7701 origin"),
483
- files: z2.array(
484
- z2.object({
485
- path: z2.string().describe("\u4ED3\u5E93\u5185\u76F8\u5BF9\u8DEF\u5F84"),
486
- resolvedContent: z2.string().describe("\u8BE5\u6587\u4EF6\u89E3\u51B3\u540E\u7684\u5B8C\u6574\u5185\u5BB9")
453
+ into: z.string().min(1).describe("\u5408\u5165\u76EE\u6807\uFF08\u7EBF\u4E0A / ours\uFF09\u3002\u4F8B\u5982 origin/main"),
454
+ from: z.string().min(1).describe("\u6211\u7684\u5206\u652F\uFF08theirs\uFF09\u3002\u4F8B\u5982 feature/x"),
455
+ remote: z.string().optional().describe("push \u4F7F\u7528\u7684\u8FDC\u7A0B\u540D\uFF0C\u7F3A\u7701 origin"),
456
+ files: z.array(
457
+ z.object({
458
+ path: z.string().describe("\u4ED3\u5E93\u5185\u76F8\u5BF9\u8DEF\u5F84"),
459
+ resolvedContent: z.string().describe("\u8BE5\u6587\u4EF6\u89E3\u51B3\u540E\u7684\u5B8C\u6574\u5185\u5BB9")
487
460
  })
488
461
  ).optional().describe("\u5DF2\u89E3\u51B3\u51B2\u7A81\u7684\u6587\u4EF6\u3002\u5E72\u51C0\u5408\u5E76\u53EF\u7701\u7565\u6216\u4F20\u7A7A\u6570\u7EC4"),
489
- push: z2.boolean().optional().describe("\u662F\u5426\u63A8\u9001\u4E34\u65F6\u5206\u652F\uFF0C\u7F3A\u7701 true"),
490
- keepLocal: z2.boolean().optional().describe("\u63A8\u9001\u5931\u8D25\u65F6\u4ECD\u4FDD\u7559\u672C\u5730\u4E34\u65F6\u5206\u652F"),
491
- tempBranch: z2.string().optional().describe("\u81EA\u5B9A\u4E49\u4E34\u65F6\u5206\u652F\u540D\uFF1B\u7F3A\u7701 merge/<from>-into-<into>")
462
+ push: z.boolean().optional().describe("\u662F\u5426\u63A8\u9001\u4E34\u65F6\u5206\u652F\uFF0C\u7F3A\u7701 true"),
463
+ keepLocal: z.boolean().optional().describe("\u63A8\u9001\u5931\u8D25\u65F6\u4ECD\u4FDD\u7559\u672C\u5730\u4E34\u65F6\u5206\u652F"),
464
+ tempBranch: z.string().optional().describe("\u81EA\u5B9A\u4E49\u4E34\u65F6\u5206\u652F\u540D\uFF1B\u7F3A\u7701 merge/<from>-into-<into>")
492
465
  });
493
466
  var mrIntoFrom = {
494
- into: z2.string().min(1).describe("\u5408\u5165\u76EE\u6807\uFF08\u7EBF\u4E0A / ours\uFF09\u3002\u4F8B\u5982 origin/main"),
495
- from: z2.string().min(1).describe("\u6211\u7684\u5206\u652F\uFF08theirs\uFF09\u3002\u4F8B\u5982 feature/x"),
496
- remote: z2.string().optional().describe("\u8FDC\u7A0B\u540D\uFF0C\u7F3A\u7701 origin"),
497
- sourceBranch: z2.string().optional().describe("PR \u6E90\u5206\u652F\uFF1B\u7F3A\u7701\u5DF2\u6709\u4E34\u65F6\u5206\u652F merge/<from>-into-<into>\uFF0C\u5426\u5219 from")
467
+ into: z.string().min(1).describe("\u5408\u5165\u76EE\u6807\uFF08\u7EBF\u4E0A / ours\uFF09\u3002\u4F8B\u5982 origin/main"),
468
+ from: z.string().min(1).describe("\u6211\u7684\u5206\u652F\uFF08theirs\uFF09\u3002\u4F8B\u5982 feature/x"),
469
+ remote: z.string().optional().describe("\u8FDC\u7A0B\u540D\uFF0C\u7F3A\u7701 origin"),
470
+ sourceBranch: z.string().optional().describe("PR \u6E90\u5206\u652F\uFF1B\u7F3A\u7701\u5DF2\u6709\u4E34\u65F6\u5206\u652F merge/<from>-into-<into>\uFF0C\u5426\u5219 from")
498
471
  };
499
- var GitMrPrepareSchema = z2.object({
472
+ var GitMrPrepareSchema = z.object({
500
473
  ...readonlyBase,
501
474
  ...mrIntoFrom
502
475
  });
503
- var GitMrCreateSchema = z2.object({
476
+ var GitMrCreateSchema = z.object({
504
477
  ...writeBase,
505
478
  ...mrIntoFrom,
506
- title: z2.string().optional().describe("PR \u6807\u9898\uFF1B\u7F3A\u7701 Merge <source> into <target>"),
507
- body: z2.string().optional().describe("PR \u6B63\u6587"),
508
- reviewers: z2.array(z2.string()).optional().describe("\u5BA1\u6838\u4EBA/\u6307\u6D3E\u4EBA\u7528\u6237\u540D\uFF1BGitLab \u4F1A\u89E3\u6790\u6210\u6570\u5B57 id\u3002Token \u4E0D\u5728\u6B64\u4F20\u5165")
479
+ title: z.string().optional().describe("PR \u6807\u9898\uFF1B\u7F3A\u7701 Merge <source> into <target>"),
480
+ body: z.string().optional().describe("PR \u6B63\u6587"),
481
+ reviewers: z.array(z.string()).optional().describe("\u5BA1\u6838\u4EBA/\u6307\u6D3E\u4EBA\u7528\u6237\u540D\uFF1BGitLab \u4F1A\u89E3\u6790\u6210\u6570\u5B57 id\u3002Token \u4E0D\u5728\u6B64\u4F20\u5165")
509
482
  });
510
- var GitResetHardSchema = z2.object({ ...writeBase, target: z2.string().describe("\u8981\u91CD\u7F6E\u5230\u7684\u63D0\u4EA4") });
511
- var GitCleanSchema = z2.object({ ...writeBase });
512
- var GitPushForceSchema = z2.object({
483
+ var GitResetHardSchema = z.object({ ...writeBase, target: z.string().describe("\u8981\u91CD\u7F6E\u5230\u7684\u63D0\u4EA4") });
484
+ var GitCleanSchema = z.object({ ...writeBase });
485
+ var GitPushForceSchema = z.object({
513
486
  ...writeBase,
514
- remote: z2.string().optional(),
515
- branch: z2.string().optional()
487
+ remote: z.string().optional(),
488
+ branch: z.string().optional()
516
489
  });
517
- var GitBranchDeleteForceSchema = z2.object({
490
+ var GitBranchDeleteForceSchema = z.object({
518
491
  ...writeBase,
519
- name: z2.string().describe("\u8981\u5F3A\u5236\u5220\u9664\u7684\u5206\u652F\u540D")
492
+ name: z.string().describe("\u8981\u5F3A\u5236\u5220\u9664\u7684\u5206\u652F\u540D")
520
493
  });
521
- var GitRebaseSchema = z2.object({
494
+ var GitRebaseSchema = z.object({
522
495
  ...writeBase,
523
- branch: z2.string().describe("\u8981\u53D8\u57FA\u5230\u7684\u5206\u652F/\u63D0\u4EA4")
496
+ branch: z.string().describe("\u8981\u53D8\u57FA\u5230\u7684\u5206\u652F/\u63D0\u4EA4")
524
497
  });
525
498
 
526
499
  // src/tools/index.ts
@@ -630,7 +603,7 @@ var TOOL_DEFS = [
630
603
  description: "\u5217\u51FA\u9AD8\u5371\u64CD\u4F5C\u524D\u81EA\u52A8\u521B\u5EFA\u7684 backup/pre-op-* \u5206\u652F\uFF0C\u4EE5\u53CA\u8BF4\u660E\u542B git-cockpit backup \u7684 stash\u3002",
631
604
  risk: "readonly",
632
605
  schema: GitStatusSchema,
633
- handler: async (_args, ctx) => new BackupManager2(ctx.git).listBackups()
606
+ handler: async (_args, ctx) => new BackupManager(ctx.git).listBackups()
634
607
  },
635
608
  {
636
609
  name: "git_merge_preview",
@@ -694,7 +667,7 @@ var TOOL_DEFS = [
694
667
  const froms = args.froms;
695
668
  const asyncWanted = args.async === true || intos.length * froms.length > SURVEY_ASYNC_THRESHOLD;
696
669
  if (asyncWanted) {
697
- const job = ctx.runtime.jobs.startSurvey({
670
+ const job = ctx.host.jobs.startSurvey({
698
671
  repoPath: ctx.repoPath,
699
672
  intos,
700
673
  froms,
@@ -730,7 +703,7 @@ var TOOL_DEFS = [
730
703
  risk: "readonly",
731
704
  schema: GitMrPrepareSchema,
732
705
  handler: async (args, ctx) => {
733
- const mr = ctx.runtime.config.mr;
706
+ const mr = ctx.host.config.mr;
734
707
  const prep = await ctx.git.prepareMr({
735
708
  into: args.into,
736
709
  from: args.from,
@@ -746,7 +719,7 @@ var TOOL_DEFS = [
746
719
  risk: "readonly",
747
720
  needsRepo: false,
748
721
  schema: GitRepoOverviewSchema,
749
- handler: async (_args, ctx) => ({ repos: await collectRepoOverviews(ctx.runtime) })
722
+ handler: async (_args, ctx) => ({ repos: await ctx.host.listOverviews() })
750
723
  },
751
724
  {
752
725
  name: "git_job_list",
@@ -754,7 +727,7 @@ var TOOL_DEFS = [
754
727
  risk: "readonly",
755
728
  needsRepo: false,
756
729
  schema: GitJobListSchema,
757
- handler: async (_args, ctx) => ({ jobs: ctx.runtime.jobs.list().map((j) => ctx.runtime.jobs.summary(j)) })
730
+ handler: async (_args, ctx) => ({ jobs: ctx.host.jobs.list().map((j) => ctx.host.jobs.summary(j)) })
758
731
  },
759
732
  {
760
733
  name: "git_job_get",
@@ -763,9 +736,9 @@ var TOOL_DEFS = [
763
736
  needsRepo: false,
764
737
  schema: GitJobGetSchema,
765
738
  handler: async (args, ctx) => {
766
- const job = ctx.runtime.jobs.get(args.id);
739
+ const job = ctx.host.jobs.get(args.id);
767
740
  if (!job) throw new GitOperationError2("\u4EFB\u52A1\u4E0D\u5B58\u5728", "JOB_NOT_FOUND");
768
- return ctx.runtime.jobs.detail(job);
741
+ return ctx.host.jobs.detail(job);
769
742
  }
770
743
  },
771
744
  // ---------------------------------------------------------------------------
@@ -958,7 +931,7 @@ var TOOL_DEFS = [
958
931
  risk: "write",
959
932
  schema: GitMrCreateSchema,
960
933
  handler: async (args, ctx) => {
961
- const mr = ctx.runtime.config.mr;
934
+ const mr = ctx.host.config.mr;
962
935
  const prep = await ctx.git.prepareMr({
963
936
  into: args.into,
964
937
  from: args.from,
@@ -992,7 +965,7 @@ var TOOL_DEFS = [
992
965
  note: "\u5C06\u53D6\u6D88\u8FDB\u884C\u4E2D\u7684\u540E\u53F0\u4EFB\u52A1"
993
966
  };
994
967
  }
995
- return ctx.runtime.jobs.summary(ctx.runtime.jobs.cancel(args.id));
968
+ return ctx.host.jobs.summary(ctx.host.jobs.cancel(args.id));
996
969
  }
997
970
  },
998
971
  // ---------------------------------------------------------------------------
@@ -1056,6 +1029,7 @@ var TOOL_DEFS = [
1056
1029
  }
1057
1030
  ];
1058
1031
  var TOOL_DEF_MAP = new Map(TOOL_DEFS.map((d) => [d.name, d]));
1032
+ getCapabilityRegistry().registerAll(TOOL_DEFS);
1059
1033
  function toolSummaries() {
1060
1034
  return TOOL_DEFS.map((d) => ({ name: d.name, description: d.description }));
1061
1035
  }
@@ -1256,23 +1230,7 @@ function createMcpServer(runtime) {
1256
1230
  ].join("\n")
1257
1231
  }
1258
1232
  );
1259
- for (const def of TOOL_DEFS) {
1260
- const register = server.registerTool.bind(server);
1261
- register(
1262
- def.name,
1263
- { description: def.description, inputSchema: def.schema },
1264
- async (args) => {
1265
- const exec = await executeTool(def, args ?? {}, {
1266
- runtime,
1267
- source: "mcp"
1268
- });
1269
- return {
1270
- content: [{ type: "text", text: formatResultForMcp(exec) }],
1271
- isError: !exec.success
1272
- };
1273
- }
1274
- );
1275
- }
1233
+ bindMcpTools(server, runtime, TOOL_DEFS);
1276
1234
  registerMcpPrompts(server);
1277
1235
  registerMcpResources(server, runtime);
1278
1236
  return server;
@@ -1339,4 +1297,4 @@ export {
1339
1297
  startMcpStdio,
1340
1298
  McpHttpHandler
1341
1299
  };
1342
- //# sourceMappingURL=chunk-I7QFIFI2.js.map
1300
+ //# sourceMappingURL=chunk-HUTQV5AS.js.map