@paretools/git 0.2.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 (46) hide show
  1. package/LICENSE +21 -0
  2. package/dist/index.d.ts +3 -0
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +12 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/lib/formatters.d.ts +7 -0
  7. package/dist/lib/formatters.d.ts.map +1 -0
  8. package/dist/lib/formatters.js +41 -0
  9. package/dist/lib/formatters.js.map +1 -0
  10. package/dist/lib/git-runner.d.ts +3 -0
  11. package/dist/lib/git-runner.d.ts.map +1 -0
  12. package/dist/lib/git-runner.js +5 -0
  13. package/dist/lib/git-runner.js.map +1 -0
  14. package/dist/lib/parsers.d.ts +7 -0
  15. package/dist/lib/parsers.d.ts.map +1 -0
  16. package/dist/lib/parsers.js +161 -0
  17. package/dist/lib/parsers.js.map +1 -0
  18. package/dist/schemas/index.d.ts +403 -0
  19. package/dist/schemas/index.d.ts.map +1 -0
  20. package/dist/schemas/index.js +72 -0
  21. package/dist/schemas/index.js.map +1 -0
  22. package/dist/tools/branch.d.ts +3 -0
  23. package/dist/tools/branch.d.ts.map +1 -0
  24. package/dist/tools/branch.js +46 -0
  25. package/dist/tools/branch.js.map +1 -0
  26. package/dist/tools/diff.d.ts +3 -0
  27. package/dist/tools/diff.d.ts.map +1 -0
  28. package/dist/tools/diff.js +71 -0
  29. package/dist/tools/diff.js.map +1 -0
  30. package/dist/tools/index.d.ts +3 -0
  31. package/dist/tools/index.d.ts.map +1 -0
  32. package/dist/tools/index.js +13 -0
  33. package/dist/tools/index.js.map +1 -0
  34. package/dist/tools/log.d.ts +3 -0
  35. package/dist/tools/log.d.ts.map +1 -0
  36. package/dist/tools/log.js +39 -0
  37. package/dist/tools/log.js.map +1 -0
  38. package/dist/tools/show.d.ts +3 -0
  39. package/dist/tools/show.d.ts.map +1 -0
  40. package/dist/tools/show.js +36 -0
  41. package/dist/tools/show.js.map +1 -0
  42. package/dist/tools/status.d.ts +3 -0
  43. package/dist/tools/status.d.ts.map +1 -0
  44. package/dist/tools/status.js +28 -0
  45. package/dist/tools/status.js.map +1 -0
  46. package/package.json +44 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Dave London
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/dist/index.js ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
+ import { registerAllTools } from "./tools/index.js";
5
+ const server = new McpServer({
6
+ name: "@paretools/git",
7
+ version: "0.1.0",
8
+ });
9
+ registerAllTools(server);
10
+ const transport = new StdioServerTransport();
11
+ await server.connect(transport);
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;IAC3B,IAAI,EAAE,gBAAgB;IACtB,OAAO,EAAE,OAAO;CACjB,CAAC,CAAC;AAEH,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAEzB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;AAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { GitStatus, GitLog, GitDiff, GitBranch, GitShow } from "../schemas/index.js";
2
+ export declare function formatStatus(s: GitStatus): string;
3
+ export declare function formatLog(log: GitLog): string;
4
+ export declare function formatDiff(diff: GitDiff): string;
5
+ export declare function formatBranch(b: GitBranch): string;
6
+ export declare function formatShow(s: GitShow): string;
7
+ //# sourceMappingURL=formatters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatters.d.ts","sourceRoot":"","sources":["../../src/lib/formatters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE1F,wBAAgB,YAAY,CAAC,CAAC,EAAE,SAAS,GAAG,MAAM,CAkBjD;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE7C;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAGhD;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,SAAS,GAAG,MAAM,CAEjD;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,CAI7C"}
@@ -0,0 +1,41 @@
1
+ export function formatStatus(s) {
2
+ if (s.clean)
3
+ return `On branch ${s.branch} — clean`;
4
+ const parts = [`On branch ${s.branch}`];
5
+ if (s.upstream) {
6
+ const tracking = [];
7
+ if (s.ahead)
8
+ tracking.push(`ahead ${s.ahead}`);
9
+ if (s.behind)
10
+ tracking.push(`behind ${s.behind}`);
11
+ if (tracking.length)
12
+ parts[0] += ` [${tracking.join(", ")}]`;
13
+ }
14
+ if (s.staged.length)
15
+ parts.push(`Staged: ${s.staged.map((f) => `${f.status[0]}:${f.file}`).join(", ")}`);
16
+ if (s.modified.length)
17
+ parts.push(`Modified: ${s.modified.join(", ")}`);
18
+ if (s.deleted.length)
19
+ parts.push(`Deleted: ${s.deleted.join(", ")}`);
20
+ if (s.untracked.length)
21
+ parts.push(`Untracked: ${s.untracked.join(", ")}`);
22
+ if (s.conflicts.length)
23
+ parts.push(`Conflicts: ${s.conflicts.join(", ")}`);
24
+ return parts.join("\n");
25
+ }
26
+ export function formatLog(log) {
27
+ return log.commits.map((c) => `${c.hashShort} ${c.message} (${c.author}, ${c.date})`).join("\n");
28
+ }
29
+ export function formatDiff(diff) {
30
+ const files = diff.files.map((f) => ` ${f.file} +${f.additions} -${f.deletions}`).join("\n");
31
+ return `${diff.totalFiles} files changed, +${diff.totalAdditions} -${diff.totalDeletions}\n${files}`;
32
+ }
33
+ export function formatBranch(b) {
34
+ return b.branches.map((br) => `${br.current ? "* " : " "}${br.name}`).join("\n");
35
+ }
36
+ export function formatShow(s) {
37
+ const header = `${s.hash.slice(0, 8)} ${s.message}\nAuthor: ${s.author} <${s.email}>\nDate: ${s.date}`;
38
+ const diff = formatDiff(s.diff);
39
+ return `${header}\n\n${diff}`;
40
+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AAC,IAAI,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACpF,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,CAAU;IACnC,MAAM,MAAM,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,KAAK,YAAY,CAAC,CAAC,IAAI,EAAE,CAAC;IACvG,MAAM,IAAI,GAAG,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAChC,OAAO,GAAG,MAAM,OAAO,IAAI,EAAE,CAAC;AAChC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type RunResult } from "@paretools/shared";
2
+ export declare function git(args: string[], cwd?: string): Promise<RunResult>;
3
+ //# sourceMappingURL=git-runner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-runner.d.ts","sourceRoot":"","sources":["../../src/lib/git-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAExD,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAE1E"}
@@ -0,0 +1,5 @@
1
+ import { run } from "@paretools/shared";
2
+ export async function git(args, cwd) {
3
+ return run("git", args, { cwd });
4
+ }
5
+ //# sourceMappingURL=git-runner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-runner.js","sourceRoot":"","sources":["../../src/lib/git-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAkB,MAAM,mBAAmB,CAAC;AAExD,MAAM,CAAC,KAAK,UAAU,GAAG,CAAC,IAAc,EAAE,GAAY;IACpD,OAAO,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;AACnC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { GitStatus, GitLog, GitDiff, GitBranch, GitShow } from "../schemas/index.js";
2
+ export declare function parseStatus(stdout: string, branchLine: string): GitStatus;
3
+ export declare function parseLog(stdout: string): GitLog;
4
+ export declare function parseDiffStat(stdout: string): GitDiff;
5
+ export declare function parseBranch(stdout: string): GitBranch;
6
+ export declare function parseShow(stdout: string, diffStdout: string): GitShow;
7
+ //# sourceMappingURL=parsers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parsers.d.ts","sourceRoot":"","sources":["../../src/lib/parsers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAU1F,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,SAAS,CAuDzE;AAiCD,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAkB/C;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAkCrD;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAcrD;AAED,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAerE"}
@@ -0,0 +1,161 @@
1
+ const STATUS_MAP = {
2
+ A: "added",
3
+ M: "modified",
4
+ D: "deleted",
5
+ R: "renamed",
6
+ C: "copied",
7
+ };
8
+ export function parseStatus(stdout, branchLine) {
9
+ const lines = stdout.split("\n").filter(Boolean);
10
+ const staged = [];
11
+ const modified = [];
12
+ const deleted = [];
13
+ const untracked = [];
14
+ const conflicts = [];
15
+ for (const line of lines) {
16
+ const index = line[0];
17
+ const worktree = line[1];
18
+ const file = line.slice(3).trim();
19
+ // Conflicts (both modified, unmerged, etc.)
20
+ if (index === "U" || worktree === "U" || (index === "A" && worktree === "A")) {
21
+ conflicts.push(file);
22
+ continue;
23
+ }
24
+ // Staged changes
25
+ if (index && index !== " " && index !== "?") {
26
+ const parts = file.split(" -> ");
27
+ staged.push({
28
+ file: parts[parts.length - 1],
29
+ status: STATUS_MAP[index] ?? "modified",
30
+ ...(parts.length > 1 ? { oldFile: parts[0] } : {}),
31
+ });
32
+ }
33
+ // Worktree changes
34
+ if (worktree === "M")
35
+ modified.push(file);
36
+ else if (worktree === "D")
37
+ deleted.push(file);
38
+ else if (index === "?")
39
+ untracked.push(file);
40
+ }
41
+ // Parse branch info from `git status --branch --porcelain=v1`
42
+ const branch = parseBranchFromPorcelain(branchLine);
43
+ return {
44
+ branch: branch.name,
45
+ upstream: branch.upstream,
46
+ ahead: branch.ahead,
47
+ behind: branch.behind,
48
+ staged,
49
+ modified,
50
+ deleted,
51
+ untracked,
52
+ conflicts,
53
+ clean: staged.length === 0 &&
54
+ modified.length === 0 &&
55
+ deleted.length === 0 &&
56
+ untracked.length === 0 &&
57
+ conflicts.length === 0,
58
+ };
59
+ }
60
+ function parseBranchFromPorcelain(line) {
61
+ // "## main...origin/main [ahead 2, behind 1]"
62
+ // "## main"
63
+ // "## HEAD (no branch)"
64
+ const stripped = line.replace(/^## /, "");
65
+ const dotIndex = stripped.indexOf("...");
66
+ if (dotIndex === -1) {
67
+ return { name: stripped.split(" ")[0] };
68
+ }
69
+ const name = stripped.slice(0, dotIndex);
70
+ const rest = stripped.slice(dotIndex + 3);
71
+ const upstream = rest.split(" ")[0];
72
+ const aheadMatch = rest.match(/ahead (\d+)/);
73
+ const behindMatch = rest.match(/behind (\d+)/);
74
+ return {
75
+ name,
76
+ upstream,
77
+ ahead: aheadMatch ? parseInt(aheadMatch[1], 10) : undefined,
78
+ behind: behindMatch ? parseInt(behindMatch[1], 10) : undefined,
79
+ };
80
+ }
81
+ export function parseLog(stdout) {
82
+ // Format: hash|hashShort|author|email|date|refs|message
83
+ const DELIMITER = "\x1f";
84
+ const lines = stdout.trim().split("\n").filter(Boolean);
85
+ const commits = lines.map((line) => {
86
+ const [hash, hashShort, author, email, date, refs, ...messageParts] = line.split(DELIMITER);
87
+ return {
88
+ hash,
89
+ hashShort,
90
+ author,
91
+ email,
92
+ date,
93
+ message: messageParts.join(DELIMITER),
94
+ ...(refs ? { refs } : {}),
95
+ };
96
+ });
97
+ return { commits, total: commits.length };
98
+ }
99
+ export function parseDiffStat(stdout) {
100
+ // Parse --numstat output: additions\tdeletions\tfilename
101
+ const lines = stdout.trim().split("\n").filter(Boolean);
102
+ const files = lines.map((line) => {
103
+ const [add, del, ...fileParts] = line.split("\t");
104
+ const filePath = fileParts.join("\t");
105
+ // Detect renames: "old => new" or "{old => new}/path"
106
+ const renameMatch = filePath.match(/(.+)\{(.+) => (.+)\}(.*)/) || filePath.match(/(.+) => (.+)/);
107
+ const isRename = !!renameMatch;
108
+ const additions = add === "-" ? 0 : parseInt(add, 10);
109
+ const deletions = del === "-" ? 0 : parseInt(del, 10);
110
+ return {
111
+ file: filePath,
112
+ status: (additions > 0 && deletions === 0 && !isRename
113
+ ? "added"
114
+ : isRename
115
+ ? "renamed"
116
+ : deletions > 0 && additions === 0
117
+ ? "deleted"
118
+ : "modified"),
119
+ additions,
120
+ deletions,
121
+ ...(isRename && renameMatch ? { oldFile: renameMatch[1] ?? renameMatch[0] } : {}),
122
+ };
123
+ });
124
+ return {
125
+ files,
126
+ totalAdditions: files.reduce((sum, f) => sum + f.additions, 0),
127
+ totalDeletions: files.reduce((sum, f) => sum + f.deletions, 0),
128
+ totalFiles: files.length,
129
+ };
130
+ }
131
+ export function parseBranch(stdout) {
132
+ const lines = stdout.trim().split("\n").filter(Boolean);
133
+ let current = "";
134
+ const branches = lines.map((line) => {
135
+ const isCurrent = line.startsWith("* ");
136
+ const name = line.replace(/^\*?\s+/, "").split(/\s+/)[0];
137
+ if (isCurrent)
138
+ current = name;
139
+ return {
140
+ name,
141
+ current: isCurrent,
142
+ };
143
+ });
144
+ return { branches, current };
145
+ }
146
+ export function parseShow(stdout, diffStdout) {
147
+ // stdout is the formatted commit info, diffStdout is the numstat
148
+ const DELIMITER = "\x1f";
149
+ const parts = stdout.trim().split(DELIMITER);
150
+ const [hash, author, email, date, ...messageParts] = parts;
151
+ const diff = parseDiffStat(diffStdout);
152
+ return {
153
+ hash,
154
+ author,
155
+ email,
156
+ date,
157
+ message: messageParts.join(DELIMITER),
158
+ diff,
159
+ };
160
+ }
161
+ //# sourceMappingURL=parsers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parsers.js","sourceRoot":"","sources":["../../src/lib/parsers.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,GAA0D;IACxE,CAAC,EAAE,OAAO;IACV,CAAC,EAAE,UAAU;IACb,CAAC,EAAE,SAAS;IACZ,CAAC,EAAE,SAAS;IACZ,CAAC,EAAE,QAAQ;CACZ,CAAC;AAEF,MAAM,UAAU,WAAW,CAAC,MAAc,EAAE,UAAkB;IAC5D,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACjD,MAAM,MAAM,GAAwB,EAAE,CAAC;IACvC,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,MAAM,SAAS,GAAa,EAAE,CAAC;IAC/B,MAAM,SAAS,GAAa,EAAE,CAAC;IAE/B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACtB,MAAM,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACzB,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAElC,4CAA4C;QAC5C,IAAI,KAAK,KAAK,GAAG,IAAI,QAAQ,KAAK,GAAG,IAAI,CAAC,KAAK,KAA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.ZodString;
4
+ upstream: z.ZodOptional<z.ZodString>;
5
+ ahead: z.ZodOptional<z.ZodNumber>;
6
+ behind: z.ZodOptional<z.ZodNumber>;
7
+ staged: z.ZodArray<z.ZodObject<{
8
+ file: z.ZodString;
9
+ status: z.ZodEnum<["added", "modified", "deleted", "renamed", "copied"]>;
10
+ oldFile: z.ZodOptional<z.ZodString>;
11
+ }, "strip", z.ZodTypeAny, {
12
+ status: "added" | "modified" | "deleted" | "renamed" | "copied";
13
+ file: string;
14
+ oldFile?: string | undefined;
15
+ }, {
16
+ status: "added" | "modified" | "deleted" | "renamed" | "copied";
17
+ file: string;
18
+ oldFile?: string | undefined;
19
+ }>, "many">;
20
+ modified: z.ZodArray<z.ZodString, "many">;
21
+ deleted: z.ZodArray<z.ZodString, "many">;
22
+ untracked: z.ZodArray<z.ZodString, "many">;
23
+ conflicts: z.ZodArray<z.ZodString, "many">;
24
+ clean: z.ZodBoolean;
25
+ }, "strip", z.ZodTypeAny, {
26
+ branch: string;
27
+ staged: {
28
+ status: "added" | "modified" | "deleted" | "renamed" | "copied";
29
+ file: string;
30
+ oldFile?: string | undefined;
31
+ }[];
32
+ modified: string[];
33
+ deleted: string[];
34
+ untracked: string[];
35
+ conflicts: string[];
36
+ clean: boolean;
37
+ upstream?: string | undefined;
38
+ ahead?: number | undefined;
39
+ behind?: number | undefined;
40
+ }, {
41
+ branch: string;
42
+ staged: {
43
+ status: "added" | "modified" | "deleted" | "renamed" | "copied";
44
+ file: string;
45
+ oldFile?: string | undefined;
46
+ }[];
47
+ modified: string[];
48
+ deleted: string[];
49
+ untracked: string[];
50
+ conflicts: string[];
51
+ clean: boolean;
52
+ upstream?: string | undefined;
53
+ ahead?: number | undefined;
54
+ behind?: number | undefined;
55
+ }>;
56
+ export type GitStatus = z.infer<typeof GitStatusSchema>;
57
+ export declare const GitLogEntrySchema: z.ZodObject<{
58
+ hash: z.ZodString;
59
+ hashShort: z.ZodString;
60
+ author: z.ZodString;
61
+ email: z.ZodString;
62
+ date: z.ZodString;
63
+ message: z.ZodString;
64
+ refs: z.ZodOptional<z.ZodString>;
65
+ }, "strip", z.ZodTypeAny, {
66
+ message: string;
67
+ date: string;
68
+ hash: string;
69
+ hashShort: string;
70
+ author: string;
71
+ email: string;
72
+ refs?: string | undefined;
73
+ }, {
74
+ message: string;
75
+ date: string;
76
+ hash: string;
77
+ hashShort: string;
78
+ author: string;
79
+ email: string;
80
+ refs?: string | undefined;
81
+ }>;
82
+ export declare const GitLogSchema: z.ZodObject<{
83
+ commits: z.ZodArray<z.ZodObject<{
84
+ hash: z.ZodString;
85
+ hashShort: z.ZodString;
86
+ author: z.ZodString;
87
+ email: z.ZodString;
88
+ date: z.ZodString;
89
+ message: z.ZodString;
90
+ refs: z.ZodOptional<z.ZodString>;
91
+ }, "strip", z.ZodTypeAny, {
92
+ message: string;
93
+ date: string;
94
+ hash: string;
95
+ hashShort: string;
96
+ author: string;
97
+ email: string;
98
+ refs?: string | undefined;
99
+ }, {
100
+ message: string;
101
+ date: string;
102
+ hash: string;
103
+ hashShort: string;
104
+ author: string;
105
+ email: string;
106
+ refs?: string | undefined;
107
+ }>, "many">;
108
+ total: z.ZodNumber;
109
+ }, "strip", z.ZodTypeAny, {
110
+ commits: {
111
+ message: string;
112
+ date: string;
113
+ hash: string;
114
+ hashShort: string;
115
+ author: string;
116
+ email: string;
117
+ refs?: string | undefined;
118
+ }[];
119
+ total: number;
120
+ }, {
121
+ commits: {
122
+ message: string;
123
+ date: string;
124
+ hash: string;
125
+ hashShort: string;
126
+ author: string;
127
+ email: string;
128
+ refs?: string | undefined;
129
+ }[];
130
+ total: number;
131
+ }>;
132
+ export type GitLog = z.infer<typeof GitLogSchema>;
133
+ export declare const GitDiffFileSchema: z.ZodObject<{
134
+ file: z.ZodString;
135
+ status: z.ZodEnum<["added", "modified", "deleted", "renamed"]>;
136
+ additions: z.ZodNumber;
137
+ deletions: z.ZodNumber;
138
+ oldFile: z.ZodOptional<z.ZodString>;
139
+ chunks: z.ZodOptional<z.ZodArray<z.ZodObject<{
140
+ header: z.ZodString;
141
+ lines: z.ZodString;
142
+ }, "strip", z.ZodTypeAny, {
143
+ header: string;
144
+ lines: string;
145
+ }, {
146
+ header: string;
147
+ lines: string;
148
+ }>, "many">>;
149
+ }, "strip", z.ZodTypeAny, {
150
+ status: "added" | "modified" | "deleted" | "renamed";
151
+ file: string;
152
+ additions: number;
153
+ deletions: number;
154
+ oldFile?: string | undefined;
155
+ chunks?: {
156
+ header: string;
157
+ lines: string;
158
+ }[] | undefined;
159
+ }, {
160
+ status: "added" | "modified" | "deleted" | "renamed";
161
+ file: string;
162
+ additions: number;
163
+ deletions: number;
164
+ oldFile?: string | undefined;
165
+ chunks?: {
166
+ header: string;
167
+ lines: string;
168
+ }[] | undefined;
169
+ }>;
170
+ export declare const GitDiffSchema: z.ZodObject<{
171
+ files: z.ZodArray<z.ZodObject<{
172
+ file: z.ZodString;
173
+ status: z.ZodEnum<["added", "modified", "deleted", "renamed"]>;
174
+ additions: z.ZodNumber;
175
+ deletions: z.ZodNumber;
176
+ oldFile: z.ZodOptional<z.ZodString>;
177
+ chunks: z.ZodOptional<z.ZodArray<z.ZodObject<{
178
+ header: z.ZodString;
179
+ lines: z.ZodString;
180
+ }, "strip", z.ZodTypeAny, {
181
+ header: string;
182
+ lines: string;
183
+ }, {
184
+ header: string;
185
+ lines: string;
186
+ }>, "many">>;
187
+ }, "strip", z.ZodTypeAny, {
188
+ status: "added" | "modified" | "deleted" | "renamed";
189
+ file: string;
190
+ additions: number;
191
+ deletions: number;
192
+ oldFile?: string | undefined;
193
+ chunks?: {
194
+ header: string;
195
+ lines: string;
196
+ }[] | undefined;
197
+ }, {
198
+ status: "added" | "modified" | "deleted" | "renamed";
199
+ file: string;
200
+ additions: number;
201
+ deletions: number;
202
+ oldFile?: string | undefined;
203
+ chunks?: {
204
+ header: string;
205
+ lines: string;
206
+ }[] | undefined;
207
+ }>, "many">;
208
+ totalAdditions: z.ZodNumber;
209
+ totalDeletions: z.ZodNumber;
210
+ totalFiles: z.ZodNumber;
211
+ }, "strip", z.ZodTypeAny, {
212
+ files: {
213
+ status: "added" | "modified" | "deleted" | "renamed";
214
+ file: string;
215
+ additions: number;
216
+ deletions: number;
217
+ oldFile?: string | undefined;
218
+ chunks?: {
219
+ header: string;
220
+ lines: string;
221
+ }[] | undefined;
222
+ }[];
223
+ totalAdditions: number;
224
+ totalDeletions: number;
225
+ totalFiles: number;
226
+ }, {
227
+ files: {
228
+ status: "added" | "modified" | "deleted" | "renamed";
229
+ file: string;
230
+ additions: number;
231
+ deletions: number;
232
+ oldFile?: string | undefined;
233
+ chunks?: {
234
+ header: string;
235
+ lines: string;
236
+ }[] | undefined;
237
+ }[];
238
+ totalAdditions: number;
239
+ totalDeletions: number;
240
+ totalFiles: number;
241
+ }>;
242
+ export type GitDiff = z.infer<typeof GitDiffSchema>;
243
+ export declare const GitBranchSchema: z.ZodObject<{
244
+ branches: z.ZodArray<z.ZodObject<{
245
+ name: z.ZodString;
246
+ current: z.ZodBoolean;
247
+ upstream: z.ZodOptional<z.ZodString>;
248
+ lastCommit: z.ZodOptional<z.ZodString>;
249
+ }, "strip", z.ZodTypeAny, {
250
+ name: string;
251
+ current: boolean;
252
+ upstream?: string | undefined;
253
+ lastCommit?: string | undefined;
254
+ }, {
255
+ name: string;
256
+ current: boolean;
257
+ upstream?: string | undefined;
258
+ lastCommit?: string | undefined;
259
+ }>, "many">;
260
+ current: z.ZodString;
261
+ }, "strip", z.ZodTypeAny, {
262
+ branches: {
263
+ name: string;
264
+ current: boolean;
265
+ upstream?: string | undefined;
266
+ lastCommit?: string | undefined;
267
+ }[];
268
+ current: string;
269
+ }, {
270
+ branches: {
271
+ name: string;
272
+ current: boolean;
273
+ upstream?: string | undefined;
274
+ lastCommit?: string | undefined;
275
+ }[];
276
+ current: string;
277
+ }>;
278
+ export type GitBranch = z.infer<typeof GitBranchSchema>;
279
+ export declare const GitShowSchema: z.ZodObject<{
280
+ hash: z.ZodString;
281
+ author: z.ZodString;
282
+ email: z.ZodString;
283
+ date: z.ZodString;
284
+ message: z.ZodString;
285
+ diff: z.ZodObject<{
286
+ files: z.ZodArray<z.ZodObject<{
287
+ file: z.ZodString;
288
+ status: z.ZodEnum<["added", "modified", "deleted", "renamed"]>;
289
+ additions: z.ZodNumber;
290
+ deletions: z.ZodNumber;
291
+ oldFile: z.ZodOptional<z.ZodString>;
292
+ chunks: z.ZodOptional<z.ZodArray<z.ZodObject<{
293
+ header: z.ZodString;
294
+ lines: z.ZodString;
295
+ }, "strip", z.ZodTypeAny, {
296
+ header: string;
297
+ lines: string;
298
+ }, {
299
+ header: string;
300
+ lines: string;
301
+ }>, "many">>;
302
+ }, "strip", z.ZodTypeAny, {
303
+ status: "added" | "modified" | "deleted" | "renamed";
304
+ file: string;
305
+ additions: number;
306
+ deletions: number;
307
+ oldFile?: string | undefined;
308
+ chunks?: {
309
+ header: string;
310
+ lines: string;
311
+ }[] | undefined;
312
+ }, {
313
+ status: "added" | "modified" | "deleted" | "renamed";
314
+ file: string;
315
+ additions: number;
316
+ deletions: number;
317
+ oldFile?: string | undefined;
318
+ chunks?: {
319
+ header: string;
320
+ lines: string;
321
+ }[] | undefined;
322
+ }>, "many">;
323
+ totalAdditions: z.ZodNumber;
324
+ totalDeletions: z.ZodNumber;
325
+ totalFiles: z.ZodNumber;
326
+ }, "strip", z.ZodTypeAny, {
327
+ files: {
328
+ status: "added" | "modified" | "deleted" | "renamed";
329
+ file: string;
330
+ additions: number;
331
+ deletions: number;
332
+ oldFile?: string | undefined;
333
+ chunks?: {
334
+ header: string;
335
+ lines: string;
336
+ }[] | undefined;
337
+ }[];
338
+ totalAdditions: number;
339
+ totalDeletions: number;
340
+ totalFiles: number;
341
+ }, {
342
+ files: {
343
+ status: "added" | "modified" | "deleted" | "renamed";
344
+ file: string;
345
+ additions: number;
346
+ deletions: number;
347
+ oldFile?: string | undefined;
348
+ chunks?: {
349
+ header: string;
350
+ lines: string;
351
+ }[] | undefined;
352
+ }[];
353
+ totalAdditions: number;
354
+ totalDeletions: number;
355
+ totalFiles: number;
356
+ }>;
357
+ }, "strip", z.ZodTypeAny, {
358
+ message: string;
359
+ date: string;
360
+ hash: string;
361
+ author: string;
362
+ email: string;
363
+ diff: {
364
+ files: {
365
+ status: "added" | "modified" | "deleted" | "renamed";
366
+ file: string;
367
+ additions: number;
368
+ deletions: number;
369
+ oldFile?: string | undefined;
370
+ chunks?: {
371
+ header: string;
372
+ lines: string;
373
+ }[] | undefined;
374
+ }[];
375
+ totalAdditions: number;
376
+ totalDeletions: number;
377
+ totalFiles: number;
378
+ };
379
+ }, {
380
+ message: string;
381
+ date: string;
382
+ hash: string;
383
+ author: string;
384
+ email: string;
385
+ diff: {
386
+ files: {
387
+ status: "added" | "modified" | "deleted" | "renamed";
388
+ file: string;
389
+ additions: number;
390
+ deletions: number;
391
+ oldFile?: string | undefined;
392
+ chunks?: {
393
+ header: string;
394
+ lines: string;
395
+ }[] | undefined;
396
+ }[];
397
+ totalAdditions: number;
398
+ totalDeletions: number;
399
+ totalFiles: number;
400
+ };
401
+ }>;
402
+ export type GitShow = z.infer<typeof GitShowSchema>;
403
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiB1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;EAQ5B,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGvB,CAAC;AAEH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAElD,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAc5B,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKxB,CAAC;AAEH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAEpD,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAU1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAYxB,CAAC;AAEH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC"}
@@ -0,0 +1,72 @@
1
+ import { z } from "zod";
2
+ export const GitStatusSchema = z.object({
3
+ branch: z.string(),
4
+ upstream: z.string().optional(),
5
+ ahead: z.number().optional(),
6
+ behind: z.number().optional(),
7
+ staged: z.array(z.object({
8
+ file: z.string(),
9
+ status: z.enum(["added", "modified", "deleted", "renamed", "copied"]),
10
+ oldFile: z.string().optional(),
11
+ })),
12
+ modified: z.array(z.string()),
13
+ deleted: z.array(z.string()),
14
+ untracked: z.array(z.string()),
15
+ conflicts: z.array(z.string()),
16
+ clean: z.boolean(),
17
+ });
18
+ export const GitLogEntrySchema = z.object({
19
+ hash: z.string(),
20
+ hashShort: z.string(),
21
+ author: z.string(),
22
+ email: z.string(),
23
+ date: z.string(),
24
+ message: z.string(),
25
+ refs: z.string().optional(),
26
+ });
27
+ export const GitLogSchema = z.object({
28
+ commits: z.array(GitLogEntrySchema),
29
+ total: z.number(),
30
+ });
31
+ export const GitDiffFileSchema = z.object({
32
+ file: z.string(),
33
+ status: z.enum(["added", "modified", "deleted", "renamed"]),
34
+ additions: z.number(),
35
+ deletions: z.number(),
36
+ oldFile: z.string().optional(),
37
+ chunks: z
38
+ .array(z.object({
39
+ header: z.string(),
40
+ lines: z.string(),
41
+ }))
42
+ .optional(),
43
+ });
44
+ export const GitDiffSchema = z.object({
45
+ files: z.array(GitDiffFileSchema),
46
+ totalAdditions: z.number(),
47
+ totalDeletions: z.number(),
48
+ totalFiles: z.number(),
49
+ });
50
+ export const GitBranchSchema = z.object({
51
+ branches: z.array(z.object({
52
+ name: z.string(),
53
+ current: z.boolean(),
54
+ upstream: z.string().optional(),
55
+ lastCommit: z.string().optional(),
56
+ })),
57
+ current: z.string(),
58
+ });
59
+ export const GitShowSchema = z.object({
60
+ hash: z.string(),
61
+ author: z.string(),
62
+ email: z.string(),
63
+ date: z.string(),
64
+ message: z.string(),
65
+ diff: z.object({
66
+ files: z.array(GitDiffFileSchema),
67
+ totalAdditions: z.number(),
68
+ totalDeletions: z.number(),
69
+ totalFiles: z.number(),
70
+ }),
71
+ });
72
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,MAAM,EAAE,CAAC,CAAC,MAAM,EA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pB,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;QACb,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAAC;QACjC,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;QAC1B,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;QAC1B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;KACvB,CAAC;CACH,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerBranchTool(server: McpServer): void;
3
+ //# sourceMappingURL=branch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"branch.d.ts","sourceRoot":"","sources":["../../src/tools/branch.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOzE,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,QA8CnD"}
@@ -0,0 +1,46 @@
1
+ import { z } from "zod";
2
+ import { dualOutput } from "@paretools/shared";
3
+ import { git } from "../lib/git-runner.js";
4
+ import { parseBranch } from "../lib/parsers.js";
5
+ import { formatBranch } from "../lib/formatters.js";
6
+ import { GitBranchSchema } from "../schemas/index.js";
7
+ export function registerBranchTool(server) {
8
+ server.registerTool("branch", {
9
+ title: "Git Branch",
10
+ description: "Lists, creates, or deletes branches. Returns structured branch data.",
11
+ inputSchema: {
12
+ path: z.string().optional().describe("Repository path (default: cwd)"),
13
+ create: z.string().optional().describe("Create a new branch with this name"),
14
+ delete: z.string().optional().describe("Delete branch with this name"),
15
+ all: z.boolean().optional().default(false).describe("Include remote branches"),
16
+ },
17
+ outputSchema: GitBranchSchema,
18
+ }, async ({ path, create, delete: deleteBranch, all }) => {
19
+ const cwd = path || process.cwd();
20
+ // Create branch
21
+ if (create) {
22
+ const result = await git(["checkout", "-b", create], cwd);
23
+ if (result.exitCode !== 0) {
24
+ throw new Error(`Failed to create branch: ${result.stderr}`);
25
+ }
26
+ }
27
+ // Delete branch
28
+ if (deleteBranch) {
29
+ const result = await git(["branch", "-d", deleteBranch], cwd);
30
+ if (result.exitCode !== 0) {
31
+ throw new Error(`Failed to delete branch: ${result.stderr}`);
32
+ }
33
+ }
34
+ // List branches
35
+ const args = ["branch"];
36
+ if (all)
37
+ args.push("-a");
38
+ const result = await git(args, cwd);
39
+ if (result.exitCode !== 0) {
40
+ throw new Error(`git branch failed: ${result.stderr}`);
41
+ }
42
+ const branches = parseBranch(result.stdout);
43
+ return dualOutput(branches, formatBranch);
44
+ });
45
+ }
46
+ //# sourceMappingURL=branch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"branch.js","sourceRoot":"","sources":["../../src/tools/branch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,MAAM,UAAU,kBAAkB,CAAC,MAAiB;IAClD,MAAM,CAAC,YAAY,CACjB,QAAQ,EACR;QACE,KAAK,EAAE,YAAY;QACnB,WAAW,EAAE,sEAAsE;QACnF,WAAW,EAAE;YACX,IAAI,EAAE,CAAC,CAAC,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AAG,CAAC,QAAQ,CAAC,CAAC;QACxB,IAAI,GAAG;YAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACzB,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QAEpC,IAAI,MAAM,CAAC,QAAQ,KAAK,CAAC,EAAE,CAAC;YAC1B,MAAM,IAAI,KAAK,CAAC,sBAAsB,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;QACzD,CAAC;QAED,MAAM,QAAQ,GAAG,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC5C,OAAO,UAAU,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;IAC5C,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerDiffTool(server: McpServer): void;
3
+ //# sourceMappingURL=diff.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../src/tools/diff.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOzE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,QAqEjD"}
@@ -0,0 +1,71 @@
1
+ import { z } from "zod";
2
+ import { dualOutput } from "@paretools/shared";
3
+ import { git } from "../lib/git-runner.js";
4
+ import { parseDiffStat } from "../lib/parsers.js";
5
+ import { formatDiff } from "../lib/formatters.js";
6
+ import { GitDiffSchema } from "../schemas/index.js";
7
+ export function registerDiffTool(server) {
8
+ server.registerTool("diff", {
9
+ title: "Git Diff",
10
+ description: "Returns file-level diff statistics as structured data. Use full=true for patch content.",
11
+ inputSchema: {
12
+ path: z.string().optional().describe("Repository path (default: cwd)"),
13
+ staged: z.boolean().optional().default(false).describe("Show staged changes (--cached)"),
14
+ ref: z.string().optional().describe("Compare against a specific ref (branch, tag, commit)"),
15
+ file: z.string().optional().describe("Limit diff to a specific file"),
16
+ full: z
17
+ .boolean()
18
+ .optional()
19
+ .default(false)
20
+ .describe("Include full patch content in chunks"),
21
+ },
22
+ outputSchema: GitDiffSchema,
23
+ }, async ({ path, staged, ref, file, full }) => {
24
+ const cwd = path || process.cwd();
25
+ const args = ["diff", "--numstat"];
26
+ if (staged)
27
+ args.push("--cached");
28
+ if (ref)
29
+ args.push(ref);
30
+ if (file)
31
+ args.push("--", file);
32
+ const result = await git(args, cwd);
33
+ if (result.exitCode !== 0) {
34
+ throw new Error(`git diff failed: ${result.stderr}`);
35
+ }
36
+ const diff = parseDiffStat(result.stdout);
37
+ // If full patch requested, get the actual diff content per file
38
+ if (full && diff.files.length > 0) {
39
+ const patchArgs = ["diff"];
40
+ if (staged)
41
+ patchArgs.push("--cached");
42
+ if (ref)
43
+ patchArgs.push(ref);
44
+ if (file)
45
+ patchArgs.push("--", file);
46
+ const patchResult = await git(patchArgs, cwd);
47
+ if (patchResult.exitCode === 0) {
48
+ // Split patch into per-file chunks
49
+ const filePatches = patchResult.stdout.split(/^diff --git /m).filter(Boolean);
50
+ for (const patch of filePatches) {
51
+ const fileMatch = patch.match(/b\/(.+)\n/);
52
+ if (fileMatch) {
53
+ const matchedFile = diff.files.find((f) => f.file === fileMatch[1]);
54
+ if (matchedFile) {
55
+ const chunks = patch.split(/^@@/m).slice(1);
56
+ matchedFile.chunks = chunks.map((chunk) => {
57
+ const headerEnd = chunk.indexOf("\n");
58
+ return {
59
+ header: `@@${chunk.slice(0, headerEnd)}`,
60
+ lines: chunk.slice(headerEnd + 1),
61
+ };
62
+ });
63
+ }
64
+ }
65
+ }
66
+ }
67
+ }
68
+ return dualOutput(diff, formatDiff);
69
+ });
70
+ }
71
+ //# sourceMappingURL=diff.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff.js","sourceRoot":"","sources":["../../src/tools/diff.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAA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C;wBACd,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;wBACpE,IAAI,WAAW,EAAE,CAAC;4BAChB,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;4BAC5C,WAAW,CAAC,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;gCACxC,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;gCACtC,OAAO;oCACL,MAAM,EAAE,KAAK,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,EAAE;oCACxC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC;iCAClC,CAAC;4BACJ,CAAC,CAAC,CAAC;wBACL,CAAC;oBACH,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACtC,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerAllTools(server: McpServer): void;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOzE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,QAMjD"}
@@ -0,0 +1,13 @@
1
+ import { registerStatusTool } from "./status.js";
2
+ import { registerLogTool } from "./log.js";
3
+ import { registerDiffTool } from "./diff.js";
4
+ import { registerBranchTool } from "./branch.js";
5
+ import { registerShowTool } from "./show.js";
6
+ export function registerAllTools(server) {
7
+ registerStatusTool(server);
8
+ registerLogTool(server);
9
+ registerDiffTool(server);
10
+ registerBranchTool(server);
11
+ registerShowTool(server);
12
+ }
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C,MAAM,UAAU,gBAAgB,CAAC,MAAiB;IAChD,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC3B,eAAe,CAAC,MAAM,CAAC,CAAC;IACxB,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACzB,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC3B,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAC3B,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerLogTool(server: McpServer): void;
3
+ //# sourceMappingURL=log.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/tools/log.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAUzE,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,QAmChD"}
@@ -0,0 +1,39 @@
1
+ import { z } from "zod";
2
+ import { dualOutput } from "@paretools/shared";
3
+ import { git } from "../lib/git-runner.js";
4
+ import { parseLog } from "../lib/parsers.js";
5
+ import { formatLog } from "../lib/formatters.js";
6
+ import { GitLogSchema } from "../schemas/index.js";
7
+ const DELIMITER = "\x1f";
8
+ const LOG_FORMAT = `%H${DELIMITER}%h${DELIMITER}%an${DELIMITER}%ae${DELIMITER}%ar${DELIMITER}%D${DELIMITER}%s`;
9
+ export function registerLogTool(server) {
10
+ server.registerTool("log", {
11
+ title: "Git Log",
12
+ description: "Returns commit history as structured data",
13
+ inputSchema: {
14
+ path: z.string().optional().describe("Repository path (default: cwd)"),
15
+ maxCount: z
16
+ .number()
17
+ .optional()
18
+ .default(10)
19
+ .describe("Number of commits to return (default: 10)"),
20
+ ref: z.string().optional().describe("Branch, tag, or commit to start from"),
21
+ author: z.string().optional().describe("Filter by author name or email"),
22
+ },
23
+ outputSchema: GitLogSchema,
24
+ }, async ({ path, maxCount, ref, author }) => {
25
+ const cwd = path || process.cwd();
26
+ const args = ["log", `--format=${LOG_FORMAT}`, `--max-count=${maxCount ?? 10}`];
27
+ if (author)
28
+ args.push(`--author=${author}`);
29
+ if (ref)
30
+ args.push(ref);
31
+ const result = await git(args, cwd);
32
+ if (result.exitCode !== 0) {
33
+ throw new Error(`git log failed: ${result.stderr}`);
34
+ }
35
+ const log = parseLog(result.stdout);
36
+ return dualOutput(log, formatLog);
37
+ });
38
+ }
39
+ //# sourceMappingURL=log.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log.js","sourceRoot":"","sources":["../../src/tools/log.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,SAAS,GAAG,MAAM,CAAC;AACzB,MAAM,UAAU,GAAG,KAAK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AK,CAAC,mBAAmB,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;QACtD,CAAC;QAED,MAAM,GAAG,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACpC,OAAO,UAAU,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;IACpC,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerShowTool(server: McpServer): void;
3
+ //# sourceMappingURL=show.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"show.d.ts","sourceRoot":"","sources":["../../src/tools/show.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAUzE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,QAoCjD"}
@@ -0,0 +1,36 @@
1
+ import { z } from "zod";
2
+ import { dualOutput } from "@paretools/shared";
3
+ import { git } from "../lib/git-runner.js";
4
+ import { parseShow } from "../lib/parsers.js";
5
+ import { formatShow } from "../lib/formatters.js";
6
+ import { GitShowSchema } from "../schemas/index.js";
7
+ const DELIMITER = "\x1f";
8
+ const SHOW_FORMAT = `%H${DELIMITER}%an${DELIMITER}%ae${DELIMITER}%ar${DELIMITER}%B`;
9
+ export function registerShowTool(server) {
10
+ server.registerTool("show", {
11
+ title: "Git Show",
12
+ description: "Shows commit details and diff statistics for a given ref",
13
+ inputSchema: {
14
+ path: z.string().optional().describe("Repository path (default: cwd)"),
15
+ ref: z
16
+ .string()
17
+ .optional()
18
+ .default("HEAD")
19
+ .describe("Commit hash, branch, or tag (default: HEAD)"),
20
+ },
21
+ outputSchema: GitShowSchema,
22
+ }, async ({ path, ref }) => {
23
+ const cwd = path || process.cwd();
24
+ const commitRef = ref || "HEAD";
25
+ // Get commit info
26
+ const infoResult = await git(["show", "--no-patch", `--format=${SHOW_FORMAT}`, commitRef], cwd);
27
+ if (infoResult.exitCode !== 0) {
28
+ throw new Error(`git show failed: ${infoResult.stderr}`);
29
+ }
30
+ // Get diff stats
31
+ const diffResult = await git(["show", "--numstat", "--format=", commitRef], cwd);
32
+ const show = parseShow(infoResult.stdout, diffResult.stdout);
33
+ return dualOutput(show, formatShow);
34
+ });
35
+ }
36
+ //# sourceMappingURL=show.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"show.js","sourceRoot":"","sources":["../../src/tools/show.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,SAAS,GAAG,MAAM,CAAC;AACzB,MAAM,WAAW,GAAG,KAAK,SAAS,MAAM,SAAS,MAAM,SAAS,MAAM,SAAS,IAAI,CAAC;AAEpF,MAAM,UAAU,gBAAgB,CAAC,MAAiB;IAChD,MAAM,CAAC,YAAY,CACjB,MAAM,EACN;QACE,KAAK,EAAE,UAAU;QACjB,WAAW,EAAE,0DAA0D;QACvE,WAAW,EAAE;YACX,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,gCAAgC,CAAC;YACtE,GAAG,EAAE,CAAC;iBACH,MAAM,EAAE;iBACR,QAAQ,EAAE;iBACV,OAAO,CAAC,MAAM,CAAC;iBACf,QAAQ,CAAC,6CAA6C,CAAC;SAC3D;QACD,YAAY,EAAE,aAAa;KAC5B,EACD,KAAK,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE;QACtB,MAAM,GAAG,GAAG,IAAI,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QAClC,MAAM,SAAS,GAAG,GAAG,IAAI,MAAM,CAAC;QAEhC,kBAAkB;QAClB,MAAM,UAAU,GAAG,MAAM,GAAG,CAC1B,CAAC,MAAM,EAAE,YAAY,EAAE,YAAY,WAAW,EAAE,EAAE,SAAS,CAAC,EAC5D,GAAG,CACJ,CAAC;QACF,IAAI,UAAU,CAAC,QAAQ,KAAK,CAAC,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,oBAAoB,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC;QAC3D,CAAC;QAED,iBAAiB;QACjB,MAAM,UAAU,GAAG,MAAM,GAAG,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,CAAC,EAAE,GAAG,CAAC,CAAC;QAEjF,MAAM,IAAI,GAAG,SAAS,CAAC,UAAU,CAAC,MAAM,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;QAC7D,OAAO,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACtC,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerStatusTool(server: McpServer): void;
3
+ //# sourceMappingURL=status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/tools/status.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOzE,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,QA4BnD"}
@@ -0,0 +1,28 @@
1
+ import { z } from "zod";
2
+ import { dualOutput } from "@paretools/shared";
3
+ import { git } from "../lib/git-runner.js";
4
+ import { parseStatus } from "../lib/parsers.js";
5
+ import { formatStatus } from "../lib/formatters.js";
6
+ import { GitStatusSchema } from "../schemas/index.js";
7
+ export function registerStatusTool(server) {
8
+ server.registerTool("status", {
9
+ title: "Git Status",
10
+ description: "Returns the working tree status as structured data (branch, staged, modified, untracked, conflicts)",
11
+ inputSchema: {
12
+ path: z.string().optional().describe("Repository path (default: cwd)"),
13
+ },
14
+ outputSchema: GitStatusSchema,
15
+ }, async ({ path }) => {
16
+ const cwd = path || process.cwd();
17
+ const result = await git(["status", "--porcelain=v1", "--branch"], cwd);
18
+ if (result.exitCode !== 0) {
19
+ throw new Error(`git status failed: ${result.stderr}`);
20
+ }
21
+ const lines = result.stdout.split("\n").filter(Boolean);
22
+ const branchLine = lines.find((l) => l.startsWith("## ")) ?? "## unknown";
23
+ const fileLines = lines.filter((l) => !l.startsWith("## ")).join("\n");
24
+ const status = parseStatus(fileLines, branchLine);
25
+ return dualOutput(status, formatStatus);
26
+ });
27
+ }
28
+ //# sourceMappingURL=status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/tools/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,MAAM,UAAU,kBAAkB,CAAC,MAAiB;IAClD,MAAM,CAAC,YAAY,CACjB,QAAQ,EACR;QACE,KAAK,EAAE,YAAY;QACnB,WAAW,EACT,qGAAqG;QACvG,WAAW,EAAE;YACX,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,gCAAgC,CAAC;SACvE;QACD,YAAY,EAAE,eAAe;KAC9B,EACD,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;QACjB,MAAM,GAAG,GAAG,IAAI,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QAClC,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,CAAC,QAAQ,EAAE,gBAAgB,EAAE,UAAU,CAAC,EAAE,GAAG,CAAC,CAAC;QAExE,IAAI,MAAM,CAAC,QAAQ,KAAK,CAAC,EAAE,CAAC;YAC1B,MAAM,IAAI,KAAK,CAAC,sBAAsB,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;QACzD,CAAC;QAED,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACxD,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,IAAI,YAAY,CAAC;QAC1E,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEvE,MAAM,MAAM,GAAG,WAAW,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QAClD,OAAO,UAAU,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IAC1C,CAAC,CACF,CAAC;AACJ,CAAC"}
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "@paretools/git",
3
+ "version": "0.2.0",
4
+ "description": "MCP server for git with structured, token-efficient output",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "bin": {
8
+ "pare-git": "./dist/index.js"
9
+ },
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "default": "./dist/index.js"
14
+ }
15
+ },
16
+ "publishConfig": {
17
+ "access": "public"
18
+ },
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "https://github.com/Dave-London/pare.git",
22
+ "directory": "packages/server-git"
23
+ },
24
+ "files": [
25
+ "dist"
26
+ ],
27
+ "dependencies": {
28
+ "@modelcontextprotocol/sdk": "^1.26.0",
29
+ "zod": "^3.25.0",
30
+ "@paretools/shared": "0.2.0"
31
+ },
32
+ "devDependencies": {
33
+ "@types/node": "^22.0.0",
34
+ "typescript": "^5.7.0",
35
+ "vitest": "^3.0.0",
36
+ "@paretools/tsconfig": "0.0.0"
37
+ },
38
+ "scripts": {
39
+ "build": "tsc",
40
+ "test": "vitest run",
41
+ "test:watch": "vitest",
42
+ "lint": "eslint src/"
43
+ }
44
+ }