@rethunk/mcp-multi-root-git 2.9.1 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/AGENTS.md +23 -19
  2. package/CHANGELOG.md +145 -39
  3. package/HUMANS.md +23 -42
  4. package/README.md +30 -13
  5. package/dist/repo-paths.js +57 -13
  6. package/dist/server/batch-commit-tool.js +203 -53
  7. package/dist/server/error-codes.js +31 -16
  8. package/dist/server/git-blame-tool.js +66 -19
  9. package/dist/server/git-branch-tool.js +151 -0
  10. package/dist/server/git-cherry-pick-tool.js +221 -12
  11. package/dist/server/git-conflicts-tool.js +230 -0
  12. package/dist/server/git-diff-summary-tool.js +39 -28
  13. package/dist/server/git-diff-tool.js +56 -31
  14. package/dist/server/git-grep-tool.js +188 -0
  15. package/dist/server/git-inventory-tool.js +30 -10
  16. package/dist/server/git-log-tool.js +37 -6
  17. package/dist/server/git-merge-tool.js +71 -13
  18. package/dist/server/git-parity-tool.js +15 -6
  19. package/dist/server/git-push-tool.js +4 -2
  20. package/dist/server/git-refs.js +48 -17
  21. package/dist/server/git-reset-soft-tool.js +1 -1
  22. package/dist/server/git-revert-tool.js +160 -0
  23. package/dist/server/git-show-tool.js +5 -10
  24. package/dist/server/git-stash-tool.js +112 -78
  25. package/dist/server/git-status-tool.js +2 -2
  26. package/dist/server/git-tag-tool.js +8 -13
  27. package/dist/server/git-worktree-tool.js +67 -59
  28. package/dist/server/git.js +116 -24
  29. package/dist/server/inventory.js +90 -32
  30. package/dist/server/list-presets-tool.js +2 -8
  31. package/dist/server/presets-resource.js +37 -20
  32. package/dist/server/presets.js +87 -15
  33. package/dist/server/roots.js +52 -79
  34. package/dist/server/schemas.js +18 -19
  35. package/dist/server/test-harness.js +11 -4
  36. package/dist/server/tool-parameter-schemas.js +47 -58
  37. package/dist/server/tools.js +36 -17
  38. package/dist/server.js +1 -1
  39. package/docs/install.md +52 -5
  40. package/docs/mcp-tools.md +472 -284
  41. package/package.json +6 -6
  42. package/schemas/batch_commit.json +5 -17
  43. package/schemas/git_blame.json +13 -11
  44. package/schemas/git_branch.json +54 -0
  45. package/schemas/git_cherry_pick.json +13 -15
  46. package/schemas/git_cherry_pick_continue.json +34 -0
  47. package/schemas/git_conflicts.json +38 -0
  48. package/schemas/git_diff.json +12 -10
  49. package/schemas/git_diff_summary.json +1 -15
  50. package/schemas/git_grep.json +85 -0
  51. package/schemas/git_inventory.json +32 -23
  52. package/schemas/git_log.json +20 -24
  53. package/schemas/git_merge.json +3 -15
  54. package/schemas/git_parity.json +13 -23
  55. package/schemas/git_push.json +1 -13
  56. package/schemas/git_reset_soft.json +1 -13
  57. package/schemas/git_revert.json +47 -0
  58. package/schemas/git_show.json +2 -8
  59. package/schemas/git_stash_apply.json +2 -8
  60. package/schemas/git_stash_push.json +47 -0
  61. package/schemas/git_status.json +13 -23
  62. package/schemas/git_tag.json +1 -7
  63. package/schemas/git_worktree_add.json +2 -14
  64. package/schemas/git_worktree_remove.json +2 -14
  65. package/schemas/index.json +28 -23
  66. package/schemas/list_presets.json +13 -23
  67. package/tool-parameters.schema.json +407 -423
  68. package/dist/server/git-branch-list-tool.js +0 -138
  69. package/dist/server/git-fetch-tool.js +0 -266
  70. package/dist/server/git-reflog-tool.js +0 -126
  71. package/schemas/git_branch_list.json +0 -36
  72. package/schemas/git_fetch.json +0 -52
  73. package/schemas/git_reflog.json +0 -44
  74. package/schemas/git_stash_list.json +0 -30
  75. package/schemas/git_worktree_list.json +0 -30
@@ -1,138 +0,0 @@
1
- import { z } from "zod";
2
- import { ERROR_CODES } from "./error-codes.js";
3
- import { spawnGitAsync } from "./git.js";
4
- import { jsonRespond, spreadDefined, spreadWhen } from "./json.js";
5
- import { requireSingleRepo } from "./roots.js";
6
- import { WorkspacePickSchema } from "./schemas.js";
7
- // ---------------------------------------------------------------------------
8
- // Helpers
9
- // ---------------------------------------------------------------------------
10
- async function runBranchList(opts) {
11
- const { top, includeRemotes } = opts;
12
- // Local branches: name, full SHA, upstream (may be empty), HEAD marker (* or space)
13
- const localR = await spawnGitAsync(top, [
14
- "for-each-ref",
15
- "--format=%(refname:short)%00%(objectname)%00%(upstream:short)%00%(HEAD)",
16
- "refs/heads",
17
- ]);
18
- if (!localR.ok) {
19
- return {
20
- error: ERROR_CODES.BRANCH_LIST_FAILED,
21
- detail: (localR.stderr || localR.stdout).trim(),
22
- };
23
- }
24
- const branches = [];
25
- const localLines = (localR.stdout || "").split("\n").filter((l) => l.length > 0);
26
- for (const line of localLines) {
27
- const parts = line.split("\x00");
28
- const name = parts[0] ?? "";
29
- const sha = parts[1] ?? "";
30
- const upstream = parts[2] ?? "";
31
- const headMarker = parts[3] ?? "";
32
- if (!name || !sha)
33
- continue;
34
- branches.push({
35
- name,
36
- sha,
37
- current: headMarker === "*",
38
- ...spreadDefined("upstream", upstream || undefined),
39
- });
40
- }
41
- if (!includeRemotes) {
42
- return { branches };
43
- }
44
- // Remote branches: name, full SHA — skip symbolic origin/HEAD refs
45
- const remoteR = await spawnGitAsync(top, [
46
- "for-each-ref",
47
- "--format=%(refname:short)%00%(objectname)",
48
- "refs/remotes",
49
- ]);
50
- if (!remoteR.ok) {
51
- return {
52
- error: ERROR_CODES.BRANCH_LIST_FAILED,
53
- detail: (remoteR.stderr || remoteR.stdout).trim(),
54
- };
55
- }
56
- const remotes = [];
57
- const remoteLines = (remoteR.stdout || "").split("\n").filter((l) => l.length > 0);
58
- for (const line of remoteLines) {
59
- const parts = line.split("\x00");
60
- const name = parts[0] ?? "";
61
- const sha = parts[1] ?? "";
62
- // Skip symbolic origin/HEAD
63
- if (!name || !sha || name.endsWith("/HEAD"))
64
- continue;
65
- remotes.push({ name, sha });
66
- }
67
- return {
68
- branches,
69
- ...spreadWhen(remotes.length > 0, { remotes }),
70
- };
71
- }
72
- // ---------------------------------------------------------------------------
73
- // Markdown rendering
74
- // ---------------------------------------------------------------------------
75
- function renderBranchListMarkdown(result) {
76
- const lines = ["## Branches", ""];
77
- if (result.branches.length === 0) {
78
- lines.push("_(none)_");
79
- }
80
- else {
81
- for (const b of result.branches) {
82
- const prefix = b.current ? "* " : " ";
83
- const upstream = b.upstream ? ` → ${b.upstream}` : "";
84
- lines.push(`${prefix}**${b.name}**${upstream} (\`${b.sha}\`)`);
85
- }
86
- }
87
- if (result.remotes && result.remotes.length > 0) {
88
- lines.push("");
89
- lines.push("## Remote branches");
90
- lines.push("");
91
- for (const r of result.remotes) {
92
- lines.push(`- **${r.name}** (\`${r.sha}\`)`);
93
- }
94
- }
95
- return lines.join("\n");
96
- }
97
- // ---------------------------------------------------------------------------
98
- // Tool registration
99
- // ---------------------------------------------------------------------------
100
- export function registerGitBranchListTool(server) {
101
- server.addTool({
102
- name: "git_branch_list",
103
- description: "List local (and optionally remote-tracking) branches. Current branch marked `current: true`. Set `includeRemotes: true` for remotes.",
104
- annotations: {
105
- readOnlyHint: true,
106
- },
107
- parameters: WorkspacePickSchema.omit({ absoluteGitRoots: true, allWorkspaceRoots: true })
108
- .pick({
109
- workspaceRoot: true,
110
- rootIndex: true,
111
- format: true,
112
- })
113
- .extend({
114
- includeRemotes: z
115
- .boolean()
116
- .optional()
117
- .default(false)
118
- .describe("Include remote-tracking branches from refs/remotes (symbolic origin/HEAD excluded)."),
119
- }),
120
- execute: async (args) => {
121
- const pre = requireSingleRepo(server, args);
122
- if (!pre.ok)
123
- return jsonRespond(pre.error);
124
- const { gitTop } = pre;
125
- const result = await runBranchList({
126
- top: gitTop,
127
- includeRemotes: args.includeRemotes ?? false,
128
- });
129
- if ("error" in result) {
130
- return jsonRespond(result);
131
- }
132
- if (args.format === "json") {
133
- return jsonRespond(result);
134
- }
135
- return renderBranchListMarkdown(result);
136
- },
137
- });
138
- }
@@ -1,266 +0,0 @@
1
- import { z } from "zod";
2
- import { ERROR_CODES } from "./error-codes.js";
3
- import { isSafeGitUpstreamToken, spawnGitAsync } from "./git.js";
4
- import { jsonRespond, spreadWhen } from "./json.js";
5
- import { requireSingleRepo } from "./roots.js";
6
- import { WorkspacePickSchema } from "./schemas.js";
7
- // ---------------------------------------------------------------------------
8
- // Helpers
9
- // ---------------------------------------------------------------------------
10
- /**
11
- * Parse `git fetch` output to extract updated and new refs.
12
- * Lines containing "[new" indicate new refs (new branch, new tag, new ref).
13
- * Lines with " -> " but not containing "[new" indicate updated refs.
14
- */
15
- function parseGitFetchOutput(output) {
16
- const lines = output.split("\n");
17
- const updatedRefs = [];
18
- const newRefs = [];
19
- for (const line of lines) {
20
- const trimmed = line.trim();
21
- if (!trimmed)
22
- continue;
23
- // Lines containing "[new" indicate new refs (e.g. "[new branch]", "[new tag]", "[new ref]")
24
- if (trimmed.includes("[new")) {
25
- newRefs.push(trimmed);
26
- }
27
- // Lines with " -> " that don't contain "[new" indicate ref updates
28
- else if (trimmed.includes(" -> ")) {
29
- updatedRefs.push(trimmed);
30
- }
31
- }
32
- return { updatedRefs, newRefs };
33
- }
34
- const ZEROS_SHA = "0000000000000000000000000000000000000000";
35
- /**
36
- * Parse `git fetch --porcelain` stdout.
37
- *
38
- * Machine-readable lines have the form:
39
- * <flag><SP><old-sha><SP><new-sha><SP><local-ref>
40
- *
41
- * Flags:
42
- * ' ' = fast-forward update
43
- * '+' = forced update
44
- * '*' = new ref
45
- * '-' = pruned (deleted)
46
- * '!' = rejected
47
- * '=' = up-to-date (no change)
48
- * 't' = tag update
49
- */
50
- function parsePorcelainOutput(stdout) {
51
- const updated = [];
52
- const created = [];
53
- const pruned = [];
54
- for (const line of stdout.split("\n")) {
55
- if (!line)
56
- continue;
57
- // Porcelain lines: flag(1) + space(1) + old-sha + space + new-sha + space + ref
58
- // Minimum viable line: 1 flag + 1 space + at least some content
59
- if (line.length < 3)
60
- continue;
61
- const flag = line[0];
62
- const rest = line.slice(2); // skip "flag " prefix
63
- const parts = rest.split(" ");
64
- // Expected: [old-sha, new-sha, ref...]
65
- if (parts.length < 3)
66
- continue;
67
- const oldSha = parts[0] ?? "";
68
- const newSha = parts[1] ?? "";
69
- const ref = parts.slice(2).join(" ");
70
- if (!ref)
71
- continue;
72
- if (flag === "-") {
73
- pruned.push({ ref });
74
- }
75
- else if (flag === "*" || oldSha === ZEROS_SHA) {
76
- // New ref: flag is '*' OR old-sha is all-zeros
77
- created.push({ ref, newSha, flag: flag ?? "*" });
78
- }
79
- else if (flag === " " || flag === "+" || flag === "t") {
80
- // Update: old and new differ
81
- if (oldSha !== newSha) {
82
- updated.push({ ref, oldSha, newSha, flag: flag ?? " " });
83
- }
84
- }
85
- // '!' (rejected) and '=' (up-to-date) are intentionally ignored
86
- }
87
- return { updated, created, pruned };
88
- }
89
- // ---------------------------------------------------------------------------
90
- // Tool registration
91
- // ---------------------------------------------------------------------------
92
- export function registerGitFetchTool(server) {
93
- server.addTool({
94
- name: "git_fetch",
95
- description: "Fetch updates from a remote repository without modifying the working tree. " +
96
- "Returns structured output distinguishing updated refs from new refs.",
97
- annotations: {
98
- readOnlyHint: false, // Fetch modifies refs but not working tree; not strictly read-only but safe
99
- },
100
- parameters: WorkspacePickSchema.omit({ absoluteGitRoots: true, allWorkspaceRoots: true })
101
- .pick({
102
- workspaceRoot: true,
103
- rootIndex: true,
104
- format: true,
105
- })
106
- .extend({
107
- remote: z
108
- .string()
109
- .optional()
110
- .default("origin")
111
- .describe("Remote to fetch from (default: origin)."),
112
- branch: z
113
- .string()
114
- .optional()
115
- .describe("If specified: fetch only this branch (e.g. 'main')."),
116
- prune: z
117
- .boolean()
118
- .optional()
119
- .default(false)
120
- .describe("Pass --prune to remove deleted remote branches (default: false)."),
121
- tags: z
122
- .boolean()
123
- .optional()
124
- .default(false)
125
- .describe("Pass --tags to also fetch all tags (default: false)."),
126
- }),
127
- execute: async (args) => {
128
- const pre = requireSingleRepo(server, args);
129
- if (!pre.ok) {
130
- return jsonRespond(pre.error);
131
- }
132
- const gitTop = pre.gitTop;
133
- const remote = (args.remote ?? "origin").trim();
134
- const branch = args.branch?.trim();
135
- const prune = args.prune === true;
136
- const tags = args.tags === true;
137
- // Validate remote and branch to prevent argument injection.
138
- if (!isSafeGitUpstreamToken(remote)) {
139
- return jsonRespond({ error: ERROR_CODES.UNSAFE_REMOTE_TOKEN, remote });
140
- }
141
- if (branch && !isSafeGitUpstreamToken(branch)) {
142
- return jsonRespond({ error: ERROR_CODES.UNSAFE_REF_TOKEN, branch });
143
- }
144
- // Build base fetch args (without --porcelain for now)
145
- const baseArgs = ["fetch"];
146
- if (prune) {
147
- baseArgs.push("--prune");
148
- }
149
- if (tags) {
150
- baseArgs.push("--tags");
151
- }
152
- baseArgs.push(remote);
153
- if (branch) {
154
- baseArgs.push(branch);
155
- }
156
- // --- Attempt structured fetch with --porcelain (requires git >= 2.41) ---
157
- let structured = null;
158
- let result;
159
- const porcelainArgs = ["fetch", "--porcelain"];
160
- if (prune)
161
- porcelainArgs.push("--prune");
162
- if (tags)
163
- porcelainArgs.push("--tags");
164
- porcelainArgs.push(remote);
165
- if (branch)
166
- porcelainArgs.push(branch);
167
- const porcelainResult = await spawnGitAsync(gitTop, porcelainArgs);
168
- if (!porcelainResult.ok &&
169
- (porcelainResult.stderr.includes("unknown option") ||
170
- porcelainResult.stderr.includes("unknown switch") ||
171
- porcelainResult.stderr.includes("invalid option"))) {
172
- // --porcelain not supported: fall back to plain fetch
173
- result = await spawnGitAsync(gitTop, baseArgs);
174
- structured = null;
175
- }
176
- else {
177
- // Use porcelain result (ok or actual fetch error)
178
- result = porcelainResult;
179
- if (porcelainResult.ok || !porcelainResult.stderr.includes("unknown option")) {
180
- structured = parsePorcelainOutput(porcelainResult.stdout);
181
- }
182
- }
183
- // Legacy string-line parse: use combined output when porcelain is unavailable.
184
- // When porcelain succeeded, derive legacy fields from structured data so
185
- // that callers who rely on updatedRefs/newRefs still get useful values.
186
- let updatedRefs;
187
- let newRefs;
188
- if (structured !== null) {
189
- // Derive legacy string arrays from structured deltas
190
- updatedRefs = structured.updated.map((d) => `${d.oldSha.slice(0, 7)}..${d.newSha.slice(0, 7)} ${d.ref}`);
191
- newRefs = structured.created.map((d) => `[new ref] ${d.ref} -> ${d.newSha.slice(0, 7)}`);
192
- }
193
- else {
194
- const parsed = parseGitFetchOutput(result.stdout + result.stderr);
195
- updatedRefs = parsed.updatedRefs;
196
- newRefs = parsed.newRefs;
197
- }
198
- const fetchResult = {
199
- ok: result.ok,
200
- remote,
201
- updatedRefs,
202
- newRefs,
203
- output: (result.stdout + result.stderr).trim(),
204
- ...spreadWhen(structured !== null && structured.updated.length > 0, {
205
- updated: structured?.updated ?? [],
206
- }),
207
- ...spreadWhen(structured !== null && structured.created.length > 0, {
208
- created: structured?.created ?? [],
209
- }),
210
- ...spreadWhen(structured !== null && structured.pruned.length > 0, {
211
- pruned: structured?.pruned ?? [],
212
- }),
213
- };
214
- if (args.format === "json") {
215
- return jsonRespond(fetchResult);
216
- }
217
- // Markdown output
218
- const lines = [`# Git fetch from '${remote}'`];
219
- if (!result.ok) {
220
- lines.push("", "**Status**: Failed", "");
221
- lines.push("```", result.stdout || result.stderr || "(no output)", "```");
222
- return lines.join("\n");
223
- }
224
- lines.push("", "**Status**: Success", "");
225
- // Prefer structured deltas in markdown when available
226
- if (structured !== null && structured.updated.length > 0) {
227
- lines.push("## Updated refs", "");
228
- for (const d of structured.updated) {
229
- lines.push(`- \`${d.ref}\` ${d.oldSha.slice(0, 7)}→${d.newSha.slice(0, 7)}`);
230
- }
231
- }
232
- else if (updatedRefs.length > 0) {
233
- lines.push("## Updated refs", "");
234
- for (const ref of updatedRefs) {
235
- lines.push(`- ${ref}`);
236
- }
237
- }
238
- if (structured !== null && structured.created.length > 0) {
239
- lines.push("", "## New refs", "");
240
- for (const d of structured.created) {
241
- lines.push(`- \`${d.ref}\` (new, ${d.newSha.slice(0, 7)})`);
242
- }
243
- }
244
- else if (newRefs.length > 0) {
245
- lines.push("", "## New refs", "");
246
- for (const ref of newRefs) {
247
- lines.push(`- ${ref}`);
248
- }
249
- }
250
- if (structured !== null && structured.pruned.length > 0) {
251
- lines.push("", "## Pruned refs", "");
252
- for (const d of structured.pruned) {
253
- lines.push(`- \`${d.ref}\` (deleted)`);
254
- }
255
- }
256
- if (updatedRefs.length === 0 &&
257
- newRefs.length === 0 &&
258
- (structured === null ||
259
- (structured.updated.length === 0 && structured.created.length === 0)) &&
260
- result.stdout.trim()) {
261
- lines.push("", "## Output", "", "```", result.stdout.trim(), "```");
262
- }
263
- return lines.join("\n");
264
- },
265
- });
266
- }
@@ -1,126 +0,0 @@
1
- import { z } from "zod";
2
- import { ERROR_CODES } from "./error-codes.js";
3
- import { spawnGitAsync } from "./git.js";
4
- import { isSafeGitRefToken } from "./git-refs.js";
5
- import { jsonRespond } from "./json.js";
6
- import { requireSingleRepo } from "./roots.js";
7
- import { WorkspacePickSchema } from "./schemas.js";
8
- // ---------------------------------------------------------------------------
9
- // Constants
10
- // ---------------------------------------------------------------------------
11
- const MAX_ENTRIES_HARD_CAP = 200;
12
- const DEFAULT_MAX_ENTRIES = 30;
13
- // ---------------------------------------------------------------------------
14
- // Helpers
15
- // ---------------------------------------------------------------------------
16
- /**
17
- * Run git reflog for a single ref and return structured data.
18
- * Uses NUL-delimited fields within each line for robust parsing.
19
- */
20
- async function runGitReflog(opts) {
21
- const { top, ref, maxEntries } = opts;
22
- // %h = short sha, %H = full sha, %gd = selector (HEAD@{0}), %gs = reflog subject
23
- const reflogArgs = [
24
- "reflog",
25
- "show",
26
- ref,
27
- "--format=%h%x00%H%x00%gd%x00%gs",
28
- `-n`,
29
- String(maxEntries),
30
- ];
31
- const r = await spawnGitAsync(top, reflogArgs);
32
- if (!r.ok) {
33
- return {
34
- error: ERROR_CODES.REFLOG_FAILED,
35
- detail: (r.stderr || r.stdout || "git reflog failed").trim(),
36
- };
37
- }
38
- const entries = [];
39
- const lines = r.stdout.split("\n");
40
- for (const line of lines) {
41
- if (!line.trim())
42
- continue;
43
- const parts = line.split("\x00");
44
- // Expect 4 fields: shaShort, shaFull, selector, message
45
- if (parts.length < 4)
46
- continue;
47
- const [, shaFull, selector, message] = parts;
48
- if (!shaFull)
49
- continue;
50
- entries.push({
51
- sha: shaFull.trim(),
52
- selector: (selector ?? "").trim(),
53
- message: (message ?? "").trim(),
54
- });
55
- }
56
- return { ref, entries };
57
- }
58
- // ---------------------------------------------------------------------------
59
- // Markdown rendering
60
- // ---------------------------------------------------------------------------
61
- function renderReflogMarkdown(result) {
62
- const lines = [];
63
- lines.push(`## Reflog (${result.ref})`);
64
- lines.push("");
65
- if (result.entries.length === 0) {
66
- lines.push("_(no reflog entries)_");
67
- }
68
- else {
69
- for (const entry of result.entries) {
70
- lines.push(`${entry.selector} ${entry.sha.slice(0, 7)} ${entry.message}`);
71
- }
72
- }
73
- return lines.join("\n");
74
- }
75
- // ---------------------------------------------------------------------------
76
- // Tool registration
77
- // ---------------------------------------------------------------------------
78
- export function registerGitReflogTool(server) {
79
- server.addTool({
80
- name: "git_reflog",
81
- description: "Show the reflog for a ref (default HEAD). Returns a list of recent HEAD movements with selector (e.g. HEAD@{0}), full SHA, and message. Useful for recovering lost commits or inspecting reset/checkout history.",
82
- annotations: {
83
- readOnlyHint: true,
84
- },
85
- parameters: WorkspacePickSchema.omit({ absoluteGitRoots: true, allWorkspaceRoots: true })
86
- .pick({
87
- workspaceRoot: true,
88
- rootIndex: true,
89
- format: true,
90
- })
91
- .extend({
92
- ref: z
93
- .string()
94
- .optional()
95
- .default("HEAD")
96
- .describe("Ref whose reflog to show (branch name, HEAD, etc.). Default: HEAD."),
97
- maxEntries: z
98
- .number()
99
- .int()
100
- .min(1)
101
- .max(MAX_ENTRIES_HARD_CAP)
102
- .optional()
103
- .default(DEFAULT_MAX_ENTRIES)
104
- .describe(`Maximum reflog entries to return (hard cap ${MAX_ENTRIES_HARD_CAP}). Default ${DEFAULT_MAX_ENTRIES}.`),
105
- }),
106
- execute: async (args) => {
107
- const pre = requireSingleRepo(server, args);
108
- if (!pre.ok)
109
- return jsonRespond(pre.error);
110
- const top = pre.gitTop;
111
- const ref = args.ref ?? "HEAD";
112
- if (!isSafeGitRefToken(ref)) {
113
- return jsonRespond({ error: ERROR_CODES.UNSAFE_REF_TOKEN, ref });
114
- }
115
- const maxEntries = Math.min(args.maxEntries ?? DEFAULT_MAX_ENTRIES, MAX_ENTRIES_HARD_CAP);
116
- const result = await runGitReflog({ top, ref, maxEntries });
117
- if ("error" in result) {
118
- return jsonRespond(result);
119
- }
120
- if (args.format === "json") {
121
- return jsonRespond(result);
122
- }
123
- return renderReflogMarkdown(result);
124
- },
125
- });
126
- }
@@ -1,36 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "title": "@rethunk/mcp-multi-root-git: git_branch_list",
4
- "description": "Parameter schema for the 'git_branch_list' MCP tool.",
5
- "type": "object",
6
- "properties": {
7
- "workspaceRoot": {
8
- "description": "Highest-priority root override.",
9
- "type": "string"
10
- },
11
- "rootIndex": {
12
- "description": "0-based index into MCP roots; ignored if workspaceRoot set.",
13
- "type": "integer",
14
- "minimum": 0,
15
- "maximum": 9007199254740991
16
- },
17
- "format": {
18
- "default": "markdown",
19
- "type": "string",
20
- "enum": [
21
- "markdown",
22
- "json"
23
- ]
24
- },
25
- "includeRemotes": {
26
- "default": false,
27
- "description": "Include remote-tracking branches from refs/remotes (symbolic origin/HEAD excluded).",
28
- "type": "boolean"
29
- }
30
- },
31
- "required": [
32
- "format",
33
- "includeRemotes"
34
- ],
35
- "additionalProperties": false
36
- }
@@ -1,52 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "title": "@rethunk/mcp-multi-root-git: git_fetch",
4
- "description": "Parameter schema for the 'git_fetch' MCP tool.",
5
- "type": "object",
6
- "properties": {
7
- "workspaceRoot": {
8
- "description": "Highest-priority root override.",
9
- "type": "string"
10
- },
11
- "rootIndex": {
12
- "description": "0-based index into MCP roots; ignored if workspaceRoot set.",
13
- "type": "integer",
14
- "minimum": 0,
15
- "maximum": 9007199254740991
16
- },
17
- "format": {
18
- "default": "markdown",
19
- "type": "string",
20
- "enum": [
21
- "markdown",
22
- "json"
23
- ]
24
- },
25
- "remote": {
26
- "default": "origin",
27
- "description": "Remote to fetch from (default: origin).",
28
- "type": "string"
29
- },
30
- "branch": {
31
- "description": "If specified: fetch only this branch (e.g. 'main').",
32
- "type": "string"
33
- },
34
- "prune": {
35
- "default": false,
36
- "description": "Pass --prune to remove deleted remote branches (default: false).",
37
- "type": "boolean"
38
- },
39
- "tags": {
40
- "default": false,
41
- "description": "Pass --tags to also fetch all tags (default: false).",
42
- "type": "boolean"
43
- }
44
- },
45
- "required": [
46
- "format",
47
- "remote",
48
- "prune",
49
- "tags"
50
- ],
51
- "additionalProperties": false
52
- }
@@ -1,44 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "title": "@rethunk/mcp-multi-root-git: git_reflog",
4
- "description": "Parameter schema for the 'git_reflog' MCP tool.",
5
- "type": "object",
6
- "properties": {
7
- "workspaceRoot": {
8
- "description": "Highest-priority root override.",
9
- "type": "string"
10
- },
11
- "rootIndex": {
12
- "description": "0-based index into MCP roots; ignored if workspaceRoot set.",
13
- "type": "integer",
14
- "minimum": 0,
15
- "maximum": 9007199254740991
16
- },
17
- "format": {
18
- "default": "markdown",
19
- "type": "string",
20
- "enum": [
21
- "markdown",
22
- "json"
23
- ]
24
- },
25
- "ref": {
26
- "default": "HEAD",
27
- "description": "Ref whose reflog to show (branch name, HEAD, etc.). Default: HEAD.",
28
- "type": "string"
29
- },
30
- "maxEntries": {
31
- "default": 30,
32
- "description": "Maximum reflog entries to return (hard cap 200). Default 30.",
33
- "type": "integer",
34
- "minimum": 1,
35
- "maximum": 200
36
- }
37
- },
38
- "required": [
39
- "format",
40
- "ref",
41
- "maxEntries"
42
- ],
43
- "additionalProperties": false
44
- }