@gitwand/mcp 1.6.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.
- package/LICENSE +21 -0
- package/README.md +115 -0
- package/dist/resources/index.d.ts +21 -0
- package/dist/resources/index.d.ts.map +1 -0
- package/dist/resources/index.js +169 -0
- package/dist/resources/index.js.map +1 -0
- package/dist/server.d.ts +13 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +60 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/index.d.ts +121 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +500 -0
- package/dist/tools/index.js.map +1 -0
- package/package.json +54 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Laurent Guitton
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# @gitwand/mcp
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@gitwand/mcp)
|
|
4
|
+
[](../../LICENSE)
|
|
5
|
+
|
|
6
|
+
**MCP server that lets AI agents resolve Git merge conflicts automatically.**
|
|
7
|
+
|
|
8
|
+
[GitWand](https://github.com/devlint/GitWand) exposes its conflict resolution engine as a [Model Context Protocol](https://modelcontextprotocol.io) server. Plug it into Claude Desktop, Claude Code, Cursor, Windsurf, or any MCP-compatible client and the agent can inspect, preview, and resolve conflicts in your repos without you opening a single conflict marker.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
No install step — run it via `npx`:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npx -y @gitwand/mcp --cwd /path/to/your/repo
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Or add it to your MCP client config (examples below).
|
|
19
|
+
|
|
20
|
+
## Configure
|
|
21
|
+
|
|
22
|
+
### Claude Desktop
|
|
23
|
+
|
|
24
|
+
Add to `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
|
|
25
|
+
|
|
26
|
+
```json
|
|
27
|
+
{
|
|
28
|
+
"mcpServers": {
|
|
29
|
+
"gitwand": {
|
|
30
|
+
"command": "npx",
|
|
31
|
+
"args": ["-y", "@gitwand/mcp"]
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The server defaults to the current working directory. To pin it to a specific repo, add `"--cwd", "/absolute/path/to/repo"` to the `args` array.
|
|
38
|
+
|
|
39
|
+
### Claude Code
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
claude mcp add gitwand -- npx -y @gitwand/mcp
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Cursor / Windsurf
|
|
46
|
+
|
|
47
|
+
Same config shape as Claude Desktop — drop it into the `mcpServers` block of your client's config file.
|
|
48
|
+
|
|
49
|
+
## What the agent can do
|
|
50
|
+
|
|
51
|
+
Five tools are exposed:
|
|
52
|
+
|
|
53
|
+
| Tool | What it does |
|
|
54
|
+
|------|--------------|
|
|
55
|
+
| `gitwand_status` | List conflicted files with counts and auto-resolvability score |
|
|
56
|
+
| `gitwand_preview_merge` | Dry-run: return stats and a risk assessment without writing |
|
|
57
|
+
| `gitwand_resolve_conflicts` | Auto-resolve trivial conflicts, return resolutions + pending hunks |
|
|
58
|
+
| `gitwand_explain_hunk` | Full decision trace for one hunk (ours / theirs / base / reasoning) |
|
|
59
|
+
| `gitwand_apply_resolution` | Apply an agent-provided resolution to a specific complex hunk |
|
|
60
|
+
|
|
61
|
+
Plus three resources (`gitwand://repo/conflicts`, `gitwand://repo/policy`, `gitwand://hunk/{file}/{line}`) for ambient context.
|
|
62
|
+
|
|
63
|
+
## How it works — the collaboration loop
|
|
64
|
+
|
|
65
|
+
GitWand handles the trivial conflicts (whitespace, same-change, non-overlapping inserts, value updates, generated files…). The agent handles the complex ones.
|
|
66
|
+
|
|
67
|
+
1. Agent calls `gitwand_preview_merge` → sees risk level + how many conflicts GitWand can handle alone.
|
|
68
|
+
2. Agent calls `gitwand_resolve_conflicts` → GitWand resolves the easy hunks and returns `pendingHunks` for the rest.
|
|
69
|
+
3. For each pending hunk, the agent reads ours/theirs/base from the response and decides.
|
|
70
|
+
4. Agent calls `gitwand_apply_resolution` with its chosen content — the file is written.
|
|
71
|
+
|
|
72
|
+
## Resolution patterns
|
|
73
|
+
|
|
74
|
+
GitWand only auto-resolves when it's certain. The engine tags each hunk with a pattern and a composite confidence score (0–100):
|
|
75
|
+
|
|
76
|
+
- `same_change` — identical edit on both sides (certain)
|
|
77
|
+
- `one_side_change` — only one branch touched the block (certain)
|
|
78
|
+
- `non_overlapping` — additions in different locations (high)
|
|
79
|
+
- `whitespace_only` — same logic, different indentation (high)
|
|
80
|
+
- `reorder_only` — pure permutation (high)
|
|
81
|
+
- `insertion_at_boundary` — pure insertions, base intact (high)
|
|
82
|
+
- `value_only_change` — scalar updated on one side (medium)
|
|
83
|
+
- `generated_file` — path matches a known generated-file pattern (high)
|
|
84
|
+
- `complex` — overlapping edits — **never auto-resolved**
|
|
85
|
+
|
|
86
|
+
Format-aware resolvers (JSON, Markdown, YAML, Vue SFC, lockfiles) kick in before pure text matching.
|
|
87
|
+
|
|
88
|
+
## Configuration
|
|
89
|
+
|
|
90
|
+
Drop a `.gitwandrc` at the repo root to tune policies:
|
|
91
|
+
|
|
92
|
+
```json
|
|
93
|
+
{
|
|
94
|
+
"policy": "prefer-merge",
|
|
95
|
+
"patternOverrides": {
|
|
96
|
+
"*.lock": "prefer-theirs",
|
|
97
|
+
"CHANGELOG.md": "prefer-ours"
|
|
98
|
+
},
|
|
99
|
+
"generatedFiles": ["src/generated/**", "**/*.pb.ts"]
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Policies: `prefer-ours`, `prefer-theirs`, `prefer-safety`, `prefer-merge`, `strict`.
|
|
104
|
+
|
|
105
|
+
## Also available
|
|
106
|
+
|
|
107
|
+
- **[@gitwand/cli](https://www.npmjs.com/package/@gitwand/cli)** — same engine, command-line interface for terminals and CI pipelines.
|
|
108
|
+
- **[GitWand desktop app](https://github.com/devlint/GitWand#desktop-app)** — full Git client with built-in resolution, merge preview, and inline code review.
|
|
109
|
+
|
|
110
|
+
## Links
|
|
111
|
+
|
|
112
|
+
- 📖 [Documentation](https://github.com/devlint/GitWand#mcp-server)
|
|
113
|
+
- 🐛 [Issue tracker](https://github.com/devlint/GitWand/issues)
|
|
114
|
+
- 🌐 [Website](https://devlint.github.io/GitWand/)
|
|
115
|
+
- 📜 [License — MIT](../../LICENSE)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Resources — context the LLM can read.
|
|
3
|
+
*
|
|
4
|
+
* gitwand://repo/conflicts → current conflict state
|
|
5
|
+
* gitwand://repo/policy → .gitwandrc contents
|
|
6
|
+
* gitwand://hunk/{file}/{line} → raw hunk content for a specific conflict
|
|
7
|
+
*/
|
|
8
|
+
export declare function registerResources(): {
|
|
9
|
+
uri: string;
|
|
10
|
+
name: string;
|
|
11
|
+
description: string;
|
|
12
|
+
mimeType: string;
|
|
13
|
+
}[];
|
|
14
|
+
export declare function handleResourceRead(uri: string, cwd: string): Promise<{
|
|
15
|
+
contents: {
|
|
16
|
+
uri: string;
|
|
17
|
+
mimeType: string;
|
|
18
|
+
text: string;
|
|
19
|
+
}[];
|
|
20
|
+
}>;
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AASH,wBAAgB,iBAAiB;;;;;IAiBhC;AAmBD,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM;;;;;;GAyBhE"}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Resources — context the LLM can read.
|
|
3
|
+
*
|
|
4
|
+
* gitwand://repo/conflicts → current conflict state
|
|
5
|
+
* gitwand://repo/policy → .gitwandrc contents
|
|
6
|
+
* gitwand://hunk/{file}/{line} → raw hunk content for a specific conflict
|
|
7
|
+
*/
|
|
8
|
+
import { readFileSync } from "node:fs";
|
|
9
|
+
import { execSync } from "node:child_process";
|
|
10
|
+
import { resolve as resolvePath, join } from "node:path";
|
|
11
|
+
import { resolve } from "@gitwand/core";
|
|
12
|
+
// ─── Resource definitions ──────────────────────────────────
|
|
13
|
+
export function registerResources() {
|
|
14
|
+
return [
|
|
15
|
+
{
|
|
16
|
+
uri: "gitwand://repo/conflicts",
|
|
17
|
+
name: "Current Conflicts",
|
|
18
|
+
description: "Lists all conflicted files in the repo with conflict counts, types, and auto-resolvability. Use this to understand the current merge state before taking action.",
|
|
19
|
+
mimeType: "application/json",
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
uri: "gitwand://repo/policy",
|
|
23
|
+
name: "Merge Policy (.gitwandrc)",
|
|
24
|
+
description: "The .gitwandrc configuration file that controls GitWand's resolution behavior: merge policies, confidence thresholds, and per-path overrides.",
|
|
25
|
+
mimeType: "application/json",
|
|
26
|
+
},
|
|
27
|
+
];
|
|
28
|
+
}
|
|
29
|
+
// ─── Resource handlers ─────────────────────────────────────
|
|
30
|
+
function getConflictedFiles(cwd) {
|
|
31
|
+
try {
|
|
32
|
+
const output = execSync("git diff --name-only --diff-filter=U", {
|
|
33
|
+
cwd,
|
|
34
|
+
encoding: "utf-8",
|
|
35
|
+
});
|
|
36
|
+
return output
|
|
37
|
+
.trim()
|
|
38
|
+
.split("\n")
|
|
39
|
+
.filter((f) => f.length > 0);
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
return [];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
export async function handleResourceRead(uri, cwd) {
|
|
46
|
+
// gitwand://repo/conflicts
|
|
47
|
+
if (uri === "gitwand://repo/conflicts") {
|
|
48
|
+
return readConflictsResource(cwd);
|
|
49
|
+
}
|
|
50
|
+
// gitwand://repo/policy
|
|
51
|
+
if (uri === "gitwand://repo/policy") {
|
|
52
|
+
return readPolicyResource(cwd);
|
|
53
|
+
}
|
|
54
|
+
// gitwand://hunk/{file}/{line}
|
|
55
|
+
const hunkMatch = uri.match(/^gitwand:\/\/hunk\/(.+)\/(\d+)$/);
|
|
56
|
+
if (hunkMatch) {
|
|
57
|
+
const [, file, lineStr] = hunkMatch;
|
|
58
|
+
return readHunkResource(cwd, file, parseInt(lineStr, 10));
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
contents: [{
|
|
62
|
+
uri,
|
|
63
|
+
mimeType: "text/plain",
|
|
64
|
+
text: `Unknown resource: ${uri}`,
|
|
65
|
+
}],
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
async function readConflictsResource(cwd) {
|
|
69
|
+
const files = getConflictedFiles(cwd);
|
|
70
|
+
const conflicts = files.map((file) => {
|
|
71
|
+
const filePath = resolvePath(cwd, file);
|
|
72
|
+
try {
|
|
73
|
+
const content = readFileSync(filePath, "utf-8");
|
|
74
|
+
const result = resolve(content, file, { explainOnly: true });
|
|
75
|
+
return {
|
|
76
|
+
path: file,
|
|
77
|
+
totalConflicts: result.stats.totalConflicts,
|
|
78
|
+
autoResolvable: result.stats.autoResolved,
|
|
79
|
+
remaining: result.stats.remaining,
|
|
80
|
+
byType: Object.entries(result.stats.byType)
|
|
81
|
+
.filter(([, count]) => count > 0)
|
|
82
|
+
.reduce((acc, [type, count]) => ({ ...acc, [type]: count }), {}),
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
return { path: file, error: "Could not read file" };
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
return {
|
|
90
|
+
contents: [{
|
|
91
|
+
uri: "gitwand://repo/conflicts",
|
|
92
|
+
mimeType: "application/json",
|
|
93
|
+
text: JSON.stringify({ files: files.length, conflicts }, null, 2),
|
|
94
|
+
}],
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
async function readPolicyResource(cwd) {
|
|
98
|
+
const rcPath = join(cwd, ".gitwandrc");
|
|
99
|
+
let content;
|
|
100
|
+
try {
|
|
101
|
+
content = readFileSync(rcPath, "utf-8");
|
|
102
|
+
}
|
|
103
|
+
catch {
|
|
104
|
+
content = JSON.stringify({
|
|
105
|
+
message: "No .gitwandrc found. Using default policy (prefer-theirs).",
|
|
106
|
+
defaults: {
|
|
107
|
+
policy: "prefer-theirs",
|
|
108
|
+
minConfidence: "high",
|
|
109
|
+
resolveWhitespace: true,
|
|
110
|
+
resolveNonOverlapping: true,
|
|
111
|
+
},
|
|
112
|
+
}, null, 2);
|
|
113
|
+
}
|
|
114
|
+
return {
|
|
115
|
+
contents: [{
|
|
116
|
+
uri: "gitwand://repo/policy",
|
|
117
|
+
mimeType: "application/json",
|
|
118
|
+
text: content,
|
|
119
|
+
}],
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
async function readHunkResource(cwd, file, targetLine) {
|
|
123
|
+
const filePath = resolvePath(cwd, file);
|
|
124
|
+
let content;
|
|
125
|
+
try {
|
|
126
|
+
content = readFileSync(filePath, "utf-8");
|
|
127
|
+
}
|
|
128
|
+
catch {
|
|
129
|
+
return {
|
|
130
|
+
contents: [{
|
|
131
|
+
uri: `gitwand://hunk/${file}/${targetLine}`,
|
|
132
|
+
mimeType: "application/json",
|
|
133
|
+
text: JSON.stringify({ error: `File not found: ${file}` }),
|
|
134
|
+
}],
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
const result = resolve(content, file, { explainOnly: true });
|
|
138
|
+
const hunk = result.resolutions.find((r) => r.hunk.startLine === targetLine);
|
|
139
|
+
if (!hunk) {
|
|
140
|
+
return {
|
|
141
|
+
contents: [{
|
|
142
|
+
uri: `gitwand://hunk/${file}/${targetLine}`,
|
|
143
|
+
mimeType: "application/json",
|
|
144
|
+
text: JSON.stringify({
|
|
145
|
+
error: `No hunk at line ${targetLine}`,
|
|
146
|
+
availableLines: result.resolutions.map((r) => r.hunk.startLine),
|
|
147
|
+
}),
|
|
148
|
+
}],
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
return {
|
|
152
|
+
contents: [{
|
|
153
|
+
uri: `gitwand://hunk/${file}/${targetLine}`,
|
|
154
|
+
mimeType: "application/json",
|
|
155
|
+
text: JSON.stringify({
|
|
156
|
+
file,
|
|
157
|
+
line: hunk.hunk.startLine,
|
|
158
|
+
type: hunk.hunk.type,
|
|
159
|
+
explanation: hunk.hunk.explanation,
|
|
160
|
+
confidence: hunk.hunk.confidence,
|
|
161
|
+
trace: hunk.hunk.trace,
|
|
162
|
+
ours: hunk.hunk.oursLines.join("\n"),
|
|
163
|
+
theirs: hunk.hunk.theirsLines.join("\n"),
|
|
164
|
+
base: hunk.hunk.baseLines.join("\n"),
|
|
165
|
+
}, null, 2),
|
|
166
|
+
}],
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,8DAA8D;AAE9D,MAAM,UAAU,iBAAiB;IAC/B,OAAO;QACL;YACE,GAAG,EAAE,0BAA0B;YAC/B,IAAI,EAAE,mBAAmB;YACzB,WAAW,EACT,kKAAkK;YACpK,QAAQ,EAAE,kBAAkB;SAC7B;QACD;YACE,GAAG,EAAE,uBAAuB;YAC5B,IAAI,EAAE,2BAA2B;YACjC,WAAW,EACT,+IAA+I;YACjJ,QAAQ,EAAE,kBAAkB;SAC7B;KACF,CAAC;AACJ,CAAC;AAED,8DAA8D;AAE9D,SAAS,kBAAkB,CAAC,GAAW;IACrC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,QAAQ,CAAC,sCAAsC,EAAE;YAC9D,GAAG;YACH,QAAQ,EAAE,OAAO;SAClB,CAAC,CAAC;QACH,OAAO,MAAM;aACV,IAAI,EAAE;aACN,KAAK,CAAC,IAAI,CAAC;aACX,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAA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AC3C,QAAQ,EAAE,kBAAkB;oBAC5B,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;wBACnB,KAAK,EAAE,mBAAmB,UAAU,EAAE;wBACtC,cAAc,EAAE,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC;qBAChE,CAAC;iBACH,CAAC;SACH,CAAC;IACJ,CAAC;IAED,OAAO;QACL,QAAQ,EAAE,CAAC;gBACT,GAAG,EAAE,kBAAkB,IAAI,IAAI,UAAU,EAAE;gBAC3C,QAAQ,EAAE,kBAAkB;gBAC5B,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;oBACnB,IAAI;oBACJ,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS;oBACzB,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI;oBACpB,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,WAAW;oBAClC,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU;oBAChC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK;oBACtB,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC;oBACpC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC;oBACxC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC;iBACrC,EAAE,IAAI,EAAE,CAAC,CAAC;aACZ,CAAC;KACH,CAAC;AACJ,CAAC"}
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @gitwand/mcp — MCP server for smart Git conflict resolution
|
|
4
|
+
*
|
|
5
|
+
* Exposes GitWand's conflict resolution engine as MCP tools and resources
|
|
6
|
+
* for use with Claude Code, Claude Desktop, Cursor, Windsurf, etc.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* npx @gitwand/mcp # stdio transport (default)
|
|
10
|
+
* npx @gitwand/mcp --cwd /path/repo # specify repo directory
|
|
11
|
+
*/
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AAEA;;;;;;;;;GASG"}
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @gitwand/mcp — MCP server for smart Git conflict resolution
|
|
4
|
+
*
|
|
5
|
+
* Exposes GitWand's conflict resolution engine as MCP tools and resources
|
|
6
|
+
* for use with Claude Code, Claude Desktop, Cursor, Windsurf, etc.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* npx @gitwand/mcp # stdio transport (default)
|
|
10
|
+
* npx @gitwand/mcp --cwd /path/repo # specify repo directory
|
|
11
|
+
*/
|
|
12
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
13
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
14
|
+
import { CallToolRequestSchema, ListToolsRequestSchema, ListResourcesRequestSchema, ReadResourceRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
15
|
+
import { registerTools, handleToolCall } from "./tools/index.js";
|
|
16
|
+
import { registerResources, handleResourceRead } from "./resources/index.js";
|
|
17
|
+
// ─── Parse CLI args ────────────────────────────────────────
|
|
18
|
+
const args = process.argv.slice(2);
|
|
19
|
+
let cwd = process.cwd();
|
|
20
|
+
for (let i = 0; i < args.length; i++) {
|
|
21
|
+
if (args[i] === "--cwd" && args[i + 1]) {
|
|
22
|
+
cwd = args[i + 1];
|
|
23
|
+
i++;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
// ─── Server setup ──────────────────────────────────────────
|
|
27
|
+
const server = new Server({
|
|
28
|
+
name: "gitwand",
|
|
29
|
+
version: "1.6.0",
|
|
30
|
+
}, {
|
|
31
|
+
capabilities: {
|
|
32
|
+
tools: {},
|
|
33
|
+
resources: {},
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
// ─── Tools ─────────────────────────────────────────────────
|
|
37
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
38
|
+
tools: registerTools(),
|
|
39
|
+
}));
|
|
40
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
41
|
+
return handleToolCall(request.params.name, request.params.arguments ?? {}, cwd);
|
|
42
|
+
});
|
|
43
|
+
// ─── Resources ─────────────────────────────────────────────
|
|
44
|
+
server.setRequestHandler(ListResourcesRequestSchema, async () => ({
|
|
45
|
+
resources: registerResources(),
|
|
46
|
+
}));
|
|
47
|
+
server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
|
|
48
|
+
return handleResourceRead(request.params.uri, cwd);
|
|
49
|
+
});
|
|
50
|
+
// ─── Start ─────────────────────────────────────────────────
|
|
51
|
+
async function main() {
|
|
52
|
+
const transport = new StdioServerTransport();
|
|
53
|
+
await server.connect(transport);
|
|
54
|
+
console.error("[gitwand-mcp] Server started on stdio");
|
|
55
|
+
}
|
|
56
|
+
main().catch((err) => {
|
|
57
|
+
console.error("[gitwand-mcp] Fatal error:", err);
|
|
58
|
+
process.exit(1);
|
|
59
|
+
});
|
|
60
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AAEA;;;;;;;;;GASG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAA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8DAA8D;AAC9D,MAAM,CAAC,iBAAiB,CAAC,0BAA0B,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;IAChE,SAAS,EAAE,iBAAiB,EAAE;CAC/B,CAAC,CAAC,CAAC;AAEJ,MAAM,CAAC,iBAAiB,CAAC,yBAAyB,EAAE,KAAK,EAAE,OAAY,EAAE,EAAE;IACzE,OAAO,kBAAkB,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AACrD,CAAC,CAAC,CAAC;AAEH,8DAA8D;AAC9D,KAAK,UAAU,IAAI;IACjB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,uCAAuC,CAAC,CAAC;AACzD,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,4BAA4B,EAAE,GAAG,CAAC,CAAC;IACjD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Tools — what the LLM can invoke.
|
|
3
|
+
*
|
|
4
|
+
* gitwand_status → list conflicted files + complexity
|
|
5
|
+
* gitwand_resolve_conflicts → auto-resolve and return results + DecisionTrace
|
|
6
|
+
* gitwand_preview_merge → dry-run: simulate resolution, return stats
|
|
7
|
+
* gitwand_explain_hunk → explain why a specific hunk is "complex"
|
|
8
|
+
* gitwand_apply_resolution → apply a custom resolution to a specific hunk
|
|
9
|
+
*/
|
|
10
|
+
export declare function registerTools(): ({
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
inputSchema: {
|
|
14
|
+
type: "object";
|
|
15
|
+
properties: {
|
|
16
|
+
cwd: {
|
|
17
|
+
type: string;
|
|
18
|
+
description: string;
|
|
19
|
+
};
|
|
20
|
+
files?: undefined;
|
|
21
|
+
dry_run?: undefined;
|
|
22
|
+
policy?: undefined;
|
|
23
|
+
file?: undefined;
|
|
24
|
+
line?: undefined;
|
|
25
|
+
content?: undefined;
|
|
26
|
+
};
|
|
27
|
+
required?: undefined;
|
|
28
|
+
};
|
|
29
|
+
} | {
|
|
30
|
+
name: string;
|
|
31
|
+
description: string;
|
|
32
|
+
inputSchema: {
|
|
33
|
+
type: "object";
|
|
34
|
+
properties: {
|
|
35
|
+
cwd: {
|
|
36
|
+
type: string;
|
|
37
|
+
description: string;
|
|
38
|
+
};
|
|
39
|
+
files: {
|
|
40
|
+
type: string;
|
|
41
|
+
items: {
|
|
42
|
+
type: string;
|
|
43
|
+
};
|
|
44
|
+
description: string;
|
|
45
|
+
};
|
|
46
|
+
dry_run: {
|
|
47
|
+
type: string;
|
|
48
|
+
description: string;
|
|
49
|
+
};
|
|
50
|
+
policy: {
|
|
51
|
+
type: string;
|
|
52
|
+
enum: string[];
|
|
53
|
+
description: string;
|
|
54
|
+
};
|
|
55
|
+
file?: undefined;
|
|
56
|
+
line?: undefined;
|
|
57
|
+
content?: undefined;
|
|
58
|
+
};
|
|
59
|
+
required?: undefined;
|
|
60
|
+
};
|
|
61
|
+
} | {
|
|
62
|
+
name: string;
|
|
63
|
+
description: string;
|
|
64
|
+
inputSchema: {
|
|
65
|
+
type: "object";
|
|
66
|
+
properties: {
|
|
67
|
+
cwd: {
|
|
68
|
+
type: string;
|
|
69
|
+
description: string;
|
|
70
|
+
};
|
|
71
|
+
file: {
|
|
72
|
+
type: string;
|
|
73
|
+
description: string;
|
|
74
|
+
};
|
|
75
|
+
line: {
|
|
76
|
+
type: string;
|
|
77
|
+
description: string;
|
|
78
|
+
};
|
|
79
|
+
files?: undefined;
|
|
80
|
+
dry_run?: undefined;
|
|
81
|
+
policy?: undefined;
|
|
82
|
+
content?: undefined;
|
|
83
|
+
};
|
|
84
|
+
required: string[];
|
|
85
|
+
};
|
|
86
|
+
} | {
|
|
87
|
+
name: string;
|
|
88
|
+
description: string;
|
|
89
|
+
inputSchema: {
|
|
90
|
+
type: "object";
|
|
91
|
+
properties: {
|
|
92
|
+
cwd: {
|
|
93
|
+
type: string;
|
|
94
|
+
description: string;
|
|
95
|
+
};
|
|
96
|
+
file: {
|
|
97
|
+
type: string;
|
|
98
|
+
description: string;
|
|
99
|
+
};
|
|
100
|
+
line: {
|
|
101
|
+
type: string;
|
|
102
|
+
description: string;
|
|
103
|
+
};
|
|
104
|
+
content: {
|
|
105
|
+
type: string;
|
|
106
|
+
description: string;
|
|
107
|
+
};
|
|
108
|
+
files?: undefined;
|
|
109
|
+
dry_run?: undefined;
|
|
110
|
+
policy?: undefined;
|
|
111
|
+
};
|
|
112
|
+
required: string[];
|
|
113
|
+
};
|
|
114
|
+
})[];
|
|
115
|
+
export declare function handleToolCall(name: string, args: Record<string, unknown>, defaultCwd: string): Promise<{
|
|
116
|
+
content: {
|
|
117
|
+
type: "text";
|
|
118
|
+
text: string;
|
|
119
|
+
}[];
|
|
120
|
+
}>;
|
|
121
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AASH,wBAAgB,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA6G5B;AAwGD,wBAAsB,cAAc,CAClC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,UAAU,EAAE,MAAM;;;;;GAkBnB"}
|
|
@@ -0,0 +1,500 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Tools — what the LLM can invoke.
|
|
3
|
+
*
|
|
4
|
+
* gitwand_status → list conflicted files + complexity
|
|
5
|
+
* gitwand_resolve_conflicts → auto-resolve and return results + DecisionTrace
|
|
6
|
+
* gitwand_preview_merge → dry-run: simulate resolution, return stats
|
|
7
|
+
* gitwand_explain_hunk → explain why a specific hunk is "complex"
|
|
8
|
+
* gitwand_apply_resolution → apply a custom resolution to a specific hunk
|
|
9
|
+
*/
|
|
10
|
+
import { readFileSync, writeFileSync } from "node:fs";
|
|
11
|
+
import { execSync } from "node:child_process";
|
|
12
|
+
import { resolve as resolvePath } from "node:path";
|
|
13
|
+
import { resolve } from "@gitwand/core";
|
|
14
|
+
// ─── Tool definitions ──────────────────────────────────────
|
|
15
|
+
export function registerTools() {
|
|
16
|
+
return [
|
|
17
|
+
{
|
|
18
|
+
name: "gitwand_status",
|
|
19
|
+
description: "List conflicted files in the current Git repo with their complexity and auto-resolvability. Returns a structured JSON report with conflict counts, types, and confidence scores.",
|
|
20
|
+
inputSchema: {
|
|
21
|
+
type: "object",
|
|
22
|
+
properties: {
|
|
23
|
+
cwd: {
|
|
24
|
+
type: "string",
|
|
25
|
+
description: "Working directory (repo root). Defaults to server cwd.",
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: "gitwand_resolve_conflicts",
|
|
32
|
+
description: "Auto-resolve trivial Git merge conflicts using GitWand's pattern-based engine. Returns resolved files, DecisionTrace for each hunk, and pendingHunks for conflicts that need human/LLM review. Writes resolved files to disk unless dry_run is true.",
|
|
33
|
+
inputSchema: {
|
|
34
|
+
type: "object",
|
|
35
|
+
properties: {
|
|
36
|
+
cwd: {
|
|
37
|
+
type: "string",
|
|
38
|
+
description: "Working directory (repo root). Defaults to server cwd.",
|
|
39
|
+
},
|
|
40
|
+
files: {
|
|
41
|
+
type: "array",
|
|
42
|
+
items: { type: "string" },
|
|
43
|
+
description: "Specific files to resolve. If omitted, discovers all conflicted files from git.",
|
|
44
|
+
},
|
|
45
|
+
dry_run: {
|
|
46
|
+
type: "boolean",
|
|
47
|
+
description: "If true, analyze without writing files. Default: false.",
|
|
48
|
+
},
|
|
49
|
+
policy: {
|
|
50
|
+
type: "string",
|
|
51
|
+
enum: ["prefer-ours", "prefer-theirs", "prefer-merge", "prefer-safety", "strict"],
|
|
52
|
+
description: "Merge policy to use. Default: prefer-theirs.",
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: "gitwand_preview_merge",
|
|
59
|
+
description: "Dry-run conflict resolution on all conflicted files. Shows how many conflicts GitWand can auto-resolve vs. how many need manual/LLM attention. Does NOT modify any files.",
|
|
60
|
+
inputSchema: {
|
|
61
|
+
type: "object",
|
|
62
|
+
properties: {
|
|
63
|
+
cwd: {
|
|
64
|
+
type: "string",
|
|
65
|
+
description: "Working directory (repo root). Defaults to server cwd.",
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: "gitwand_explain_hunk",
|
|
72
|
+
description: "Explain why a specific conflict hunk was classified as its type. Returns the DecisionTrace with each evaluation step and the ours/theirs/base content for context.",
|
|
73
|
+
inputSchema: {
|
|
74
|
+
type: "object",
|
|
75
|
+
properties: {
|
|
76
|
+
cwd: {
|
|
77
|
+
type: "string",
|
|
78
|
+
description: "Working directory (repo root). Defaults to server cwd.",
|
|
79
|
+
},
|
|
80
|
+
file: {
|
|
81
|
+
type: "string",
|
|
82
|
+
description: "Path to the conflicted file (relative to cwd).",
|
|
83
|
+
},
|
|
84
|
+
line: {
|
|
85
|
+
type: "number",
|
|
86
|
+
description: "Start line of the hunk to explain.",
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
required: ["file", "line"],
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name: "gitwand_apply_resolution",
|
|
94
|
+
description: "Apply a custom resolution (provided by the LLM or user) to a specific conflict hunk. Replaces the conflict markers at the given line range with the provided content. Use this for 'complex' hunks that GitWand couldn't auto-resolve.",
|
|
95
|
+
inputSchema: {
|
|
96
|
+
type: "object",
|
|
97
|
+
properties: {
|
|
98
|
+
cwd: {
|
|
99
|
+
type: "string",
|
|
100
|
+
description: "Working directory (repo root). Defaults to server cwd.",
|
|
101
|
+
},
|
|
102
|
+
file: {
|
|
103
|
+
type: "string",
|
|
104
|
+
description: "Path to the conflicted file (relative to cwd).",
|
|
105
|
+
},
|
|
106
|
+
line: {
|
|
107
|
+
type: "number",
|
|
108
|
+
description: "Start line of the conflict hunk (the <<<<<<< line).",
|
|
109
|
+
},
|
|
110
|
+
content: {
|
|
111
|
+
type: "string",
|
|
112
|
+
description: "The resolved content to replace the conflict block with.",
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
required: ["file", "line", "content"],
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
];
|
|
119
|
+
}
|
|
120
|
+
// ─── Helpers ───────────────────────────────────────────────
|
|
121
|
+
function getConflictedFiles(cwd) {
|
|
122
|
+
try {
|
|
123
|
+
const output = execSync("git diff --name-only --diff-filter=U", {
|
|
124
|
+
cwd,
|
|
125
|
+
encoding: "utf-8",
|
|
126
|
+
});
|
|
127
|
+
return output
|
|
128
|
+
.trim()
|
|
129
|
+
.split("\n")
|
|
130
|
+
.filter((f) => f.length > 0);
|
|
131
|
+
}
|
|
132
|
+
catch {
|
|
133
|
+
return [];
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
function serializeResult(file, result) {
|
|
137
|
+
return {
|
|
138
|
+
path: file,
|
|
139
|
+
totalConflicts: result.stats.totalConflicts,
|
|
140
|
+
autoResolved: result.stats.autoResolved,
|
|
141
|
+
remaining: result.stats.remaining,
|
|
142
|
+
validation: {
|
|
143
|
+
isValid: result.validation.isValid,
|
|
144
|
+
hasResidualMarkers: result.validation.hasResidualMarkers,
|
|
145
|
+
syntaxError: result.validation.syntaxError,
|
|
146
|
+
},
|
|
147
|
+
resolutions: result.resolutions.map((r) => ({
|
|
148
|
+
line: r.hunk.startLine,
|
|
149
|
+
type: r.hunk.type,
|
|
150
|
+
resolved: r.autoResolved,
|
|
151
|
+
explanation: r.hunk.explanation,
|
|
152
|
+
confidence: {
|
|
153
|
+
score: r.hunk.confidence.score,
|
|
154
|
+
label: r.hunk.confidence.label,
|
|
155
|
+
typeClassification: r.hunk.confidence.dimensions.typeClassification,
|
|
156
|
+
dataRisk: r.hunk.confidence.dimensions.dataRisk,
|
|
157
|
+
scopeImpact: r.hunk.confidence.dimensions.scopeImpact,
|
|
158
|
+
},
|
|
159
|
+
trace: {
|
|
160
|
+
selected: r.hunk.trace.selected,
|
|
161
|
+
hasBase: r.hunk.trace.hasBase,
|
|
162
|
+
summary: r.hunk.trace.summary,
|
|
163
|
+
steps: r.hunk.trace.steps,
|
|
164
|
+
},
|
|
165
|
+
})),
|
|
166
|
+
pendingHunks: result.resolutions
|
|
167
|
+
.filter((r) => !r.autoResolved)
|
|
168
|
+
.map((r) => ({
|
|
169
|
+
line: r.hunk.startLine,
|
|
170
|
+
type: r.hunk.type,
|
|
171
|
+
explanation: r.hunk.explanation,
|
|
172
|
+
ours: r.hunk.oursLines.join("\n"),
|
|
173
|
+
theirs: r.hunk.theirsLines.join("\n"),
|
|
174
|
+
base: r.hunk.baseLines.join("\n"),
|
|
175
|
+
trace: {
|
|
176
|
+
selected: r.hunk.trace.selected,
|
|
177
|
+
summary: r.hunk.trace.summary,
|
|
178
|
+
steps: r.hunk.trace.steps,
|
|
179
|
+
},
|
|
180
|
+
})),
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
function buildPartialContent(content, resolutions) {
|
|
184
|
+
const lines = content.split("\n");
|
|
185
|
+
const result = [];
|
|
186
|
+
let conflictIdx = 0;
|
|
187
|
+
let inConflict = false;
|
|
188
|
+
let conflictBuffer = [];
|
|
189
|
+
for (const line of lines) {
|
|
190
|
+
if (line.startsWith("<<<<<<<")) {
|
|
191
|
+
inConflict = true;
|
|
192
|
+
conflictBuffer = [line];
|
|
193
|
+
}
|
|
194
|
+
else if (line.startsWith(">>>>>>>") && inConflict) {
|
|
195
|
+
conflictBuffer.push(line);
|
|
196
|
+
const resolution = resolutions[conflictIdx];
|
|
197
|
+
if (resolution?.autoResolved && resolution.resolvedLines) {
|
|
198
|
+
result.push(...resolution.resolvedLines);
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
result.push(...conflictBuffer);
|
|
202
|
+
}
|
|
203
|
+
conflictIdx++;
|
|
204
|
+
inConflict = false;
|
|
205
|
+
conflictBuffer = [];
|
|
206
|
+
}
|
|
207
|
+
else if (inConflict) {
|
|
208
|
+
conflictBuffer.push(line);
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
result.push(line);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
return result.join("\n");
|
|
215
|
+
}
|
|
216
|
+
// ─── Tool handlers ─────────────────────────────────────────
|
|
217
|
+
export async function handleToolCall(name, args, defaultCwd) {
|
|
218
|
+
const cwd = args.cwd || defaultCwd;
|
|
219
|
+
switch (name) {
|
|
220
|
+
case "gitwand_status":
|
|
221
|
+
return toolStatus(cwd);
|
|
222
|
+
case "gitwand_resolve_conflicts":
|
|
223
|
+
return toolResolve(cwd, args);
|
|
224
|
+
case "gitwand_preview_merge":
|
|
225
|
+
return toolPreview(cwd);
|
|
226
|
+
case "gitwand_explain_hunk":
|
|
227
|
+
return toolExplain(cwd, args);
|
|
228
|
+
case "gitwand_apply_resolution":
|
|
229
|
+
return toolApply(cwd, args);
|
|
230
|
+
default:
|
|
231
|
+
return { content: [{ type: "text", text: `Unknown tool: ${name}` }], isError: true };
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
async function toolStatus(cwd) {
|
|
235
|
+
const files = getConflictedFiles(cwd);
|
|
236
|
+
if (files.length === 0) {
|
|
237
|
+
return {
|
|
238
|
+
content: [{ type: "text", text: JSON.stringify({ files: 0, conflicts: [], message: "No conflicted files." }, null, 2) }],
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
const conflicts = files.map((file) => {
|
|
242
|
+
const filePath = resolvePath(cwd, file);
|
|
243
|
+
try {
|
|
244
|
+
const content = readFileSync(filePath, "utf-8");
|
|
245
|
+
const result = resolve(content, file, { explainOnly: true });
|
|
246
|
+
return {
|
|
247
|
+
path: file,
|
|
248
|
+
totalConflicts: result.stats.totalConflicts,
|
|
249
|
+
autoResolvable: result.stats.autoResolved,
|
|
250
|
+
remaining: result.stats.remaining,
|
|
251
|
+
percentage: result.stats.totalConflicts > 0
|
|
252
|
+
? Math.round((result.stats.autoResolved / result.stats.totalConflicts) * 100)
|
|
253
|
+
: 0,
|
|
254
|
+
types: Object.entries(result.stats.byType)
|
|
255
|
+
.filter(([, count]) => count > 0)
|
|
256
|
+
.map(([type, count]) => ({ type, count: count })),
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
catch {
|
|
260
|
+
return { path: file, error: "Could not read file" };
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
const totalConflicts = conflicts.reduce((s, c) => s + (c.totalConflicts ?? 0), 0);
|
|
264
|
+
const totalResolvable = conflicts.reduce((s, c) => s + (c.autoResolvable ?? 0), 0);
|
|
265
|
+
return {
|
|
266
|
+
content: [{
|
|
267
|
+
type: "text",
|
|
268
|
+
text: JSON.stringify({
|
|
269
|
+
files: files.length,
|
|
270
|
+
totalConflicts,
|
|
271
|
+
autoResolvable: totalResolvable,
|
|
272
|
+
remaining: totalConflicts - totalResolvable,
|
|
273
|
+
conflicts,
|
|
274
|
+
}, null, 2),
|
|
275
|
+
}],
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
async function toolResolve(cwd, args) {
|
|
279
|
+
let files = args.files ?? [];
|
|
280
|
+
const dryRun = args.dry_run ?? false;
|
|
281
|
+
const policy = args.policy;
|
|
282
|
+
if (files.length === 0) {
|
|
283
|
+
files = getConflictedFiles(cwd);
|
|
284
|
+
}
|
|
285
|
+
if (files.length === 0) {
|
|
286
|
+
return {
|
|
287
|
+
content: [{ type: "text", text: JSON.stringify({ message: "No conflicted files found.", files: [] }, null, 2) }],
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
const results = files.map((file) => {
|
|
291
|
+
const filePath = resolvePath(cwd, file);
|
|
292
|
+
try {
|
|
293
|
+
const content = readFileSync(filePath, "utf-8");
|
|
294
|
+
const result = resolve(content, file, {
|
|
295
|
+
...(policy ? { policy: policy } : {}),
|
|
296
|
+
});
|
|
297
|
+
// Write resolved content unless dry-run
|
|
298
|
+
if (!dryRun && result.stats.autoResolved > 0) {
|
|
299
|
+
const newContent = result.mergedContent ?? buildPartialContent(content, result.resolutions);
|
|
300
|
+
writeFileSync(filePath, newContent, "utf-8");
|
|
301
|
+
}
|
|
302
|
+
return serializeResult(file, result);
|
|
303
|
+
}
|
|
304
|
+
catch (err) {
|
|
305
|
+
return { path: file, error: err.message };
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
const totalConflicts = results.reduce((s, r) => s + (r.totalConflicts ?? 0), 0);
|
|
309
|
+
const totalResolved = results.reduce((s, r) => s + (r.autoResolved ?? 0), 0);
|
|
310
|
+
return {
|
|
311
|
+
content: [{
|
|
312
|
+
type: "text",
|
|
313
|
+
text: JSON.stringify({
|
|
314
|
+
dryRun,
|
|
315
|
+
summary: {
|
|
316
|
+
files: results.length,
|
|
317
|
+
totalConflicts,
|
|
318
|
+
autoResolved: totalResolved,
|
|
319
|
+
remaining: totalConflicts - totalResolved,
|
|
320
|
+
allResolved: totalConflicts - totalResolved === 0,
|
|
321
|
+
},
|
|
322
|
+
files: results,
|
|
323
|
+
}, null, 2),
|
|
324
|
+
}],
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
async function toolPreview(cwd) {
|
|
328
|
+
const files = getConflictedFiles(cwd);
|
|
329
|
+
if (files.length === 0) {
|
|
330
|
+
return {
|
|
331
|
+
content: [{ type: "text", text: JSON.stringify({ message: "No conflicted files.", risk: "none" }, null, 2) }],
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
const previews = files.map((file) => {
|
|
335
|
+
const filePath = resolvePath(cwd, file);
|
|
336
|
+
try {
|
|
337
|
+
const content = readFileSync(filePath, "utf-8");
|
|
338
|
+
const result = resolve(content, file, { explainOnly: true });
|
|
339
|
+
return serializeResult(file, result);
|
|
340
|
+
}
|
|
341
|
+
catch (err) {
|
|
342
|
+
return { path: file, error: err.message };
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
const totalConflicts = previews.reduce((s, r) => s + (r.totalConflicts ?? 0), 0);
|
|
346
|
+
const totalResolvable = previews.reduce((s, r) => s + (r.autoResolved ?? 0), 0);
|
|
347
|
+
const remaining = totalConflicts - totalResolvable;
|
|
348
|
+
// Risk assessment
|
|
349
|
+
let risk;
|
|
350
|
+
if (remaining === 0)
|
|
351
|
+
risk = "low";
|
|
352
|
+
else if (remaining <= 2 && files.length <= 3)
|
|
353
|
+
risk = "medium";
|
|
354
|
+
else
|
|
355
|
+
risk = "high";
|
|
356
|
+
return {
|
|
357
|
+
content: [{
|
|
358
|
+
type: "text",
|
|
359
|
+
text: JSON.stringify({
|
|
360
|
+
risk,
|
|
361
|
+
summary: {
|
|
362
|
+
files: files.length,
|
|
363
|
+
totalConflicts,
|
|
364
|
+
autoResolvable: totalResolvable,
|
|
365
|
+
remaining,
|
|
366
|
+
autoResolvePercentage: totalConflicts > 0
|
|
367
|
+
? Math.round((totalResolvable / totalConflicts) * 100)
|
|
368
|
+
: 100,
|
|
369
|
+
},
|
|
370
|
+
files: previews,
|
|
371
|
+
}, null, 2),
|
|
372
|
+
}],
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
async function toolExplain(cwd, args) {
|
|
376
|
+
const file = args.file;
|
|
377
|
+
const targetLine = args.line;
|
|
378
|
+
if (!file || targetLine === undefined) {
|
|
379
|
+
return { content: [{ type: "text", text: "Missing required arguments: file and line." }], isError: true };
|
|
380
|
+
}
|
|
381
|
+
const filePath = resolvePath(cwd, file);
|
|
382
|
+
let content;
|
|
383
|
+
try {
|
|
384
|
+
content = readFileSync(filePath, "utf-8");
|
|
385
|
+
}
|
|
386
|
+
catch {
|
|
387
|
+
return { content: [{ type: "text", text: `File not found: ${file}` }], isError: true };
|
|
388
|
+
}
|
|
389
|
+
const result = resolve(content, file, { explainOnly: true });
|
|
390
|
+
const hunk = result.resolutions.find((r) => r.hunk.startLine === targetLine);
|
|
391
|
+
if (!hunk) {
|
|
392
|
+
const available = result.resolutions.map((r) => r.hunk.startLine);
|
|
393
|
+
return {
|
|
394
|
+
content: [{
|
|
395
|
+
type: "text",
|
|
396
|
+
text: JSON.stringify({
|
|
397
|
+
error: `No conflict hunk found at line ${targetLine}.`,
|
|
398
|
+
availableLines: available,
|
|
399
|
+
}, null, 2),
|
|
400
|
+
}],
|
|
401
|
+
isError: true,
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
return {
|
|
405
|
+
content: [{
|
|
406
|
+
type: "text",
|
|
407
|
+
text: JSON.stringify({
|
|
408
|
+
file,
|
|
409
|
+
line: hunk.hunk.startLine,
|
|
410
|
+
type: hunk.hunk.type,
|
|
411
|
+
resolved: hunk.autoResolved,
|
|
412
|
+
explanation: hunk.hunk.explanation,
|
|
413
|
+
resolutionReason: hunk.resolutionReason,
|
|
414
|
+
confidence: {
|
|
415
|
+
score: hunk.hunk.confidence.score,
|
|
416
|
+
label: hunk.hunk.confidence.label,
|
|
417
|
+
dimensions: hunk.hunk.confidence.dimensions,
|
|
418
|
+
boosters: hunk.hunk.confidence.boosters,
|
|
419
|
+
penalties: hunk.hunk.confidence.penalties,
|
|
420
|
+
},
|
|
421
|
+
trace: {
|
|
422
|
+
selected: hunk.hunk.trace.selected,
|
|
423
|
+
hasBase: hunk.hunk.trace.hasBase,
|
|
424
|
+
summary: hunk.hunk.trace.summary,
|
|
425
|
+
steps: hunk.hunk.trace.steps,
|
|
426
|
+
},
|
|
427
|
+
ours: hunk.hunk.oursLines.join("\n"),
|
|
428
|
+
theirs: hunk.hunk.theirsLines.join("\n"),
|
|
429
|
+
base: hunk.hunk.baseLines.join("\n"),
|
|
430
|
+
}, null, 2),
|
|
431
|
+
}],
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
async function toolApply(cwd, args) {
|
|
435
|
+
const file = args.file;
|
|
436
|
+
const targetLine = args.line;
|
|
437
|
+
const newContent = args.content;
|
|
438
|
+
if (!file || targetLine === undefined || !newContent) {
|
|
439
|
+
return { content: [{ type: "text", text: "Missing required arguments: file, line, and content." }], isError: true };
|
|
440
|
+
}
|
|
441
|
+
const filePath = resolvePath(cwd, file);
|
|
442
|
+
let fileContent;
|
|
443
|
+
try {
|
|
444
|
+
fileContent = readFileSync(filePath, "utf-8");
|
|
445
|
+
}
|
|
446
|
+
catch {
|
|
447
|
+
return { content: [{ type: "text", text: `File not found: ${file}` }], isError: true };
|
|
448
|
+
}
|
|
449
|
+
const lines = fileContent.split("\n");
|
|
450
|
+
const result = [];
|
|
451
|
+
let currentLine = 1;
|
|
452
|
+
let replaced = false;
|
|
453
|
+
let inConflict = false;
|
|
454
|
+
for (const line of lines) {
|
|
455
|
+
if (line.startsWith("<<<<<<<") && currentLine === targetLine) {
|
|
456
|
+
// Found the target conflict block — replace it
|
|
457
|
+
inConflict = true;
|
|
458
|
+
result.push(...newContent.split("\n"));
|
|
459
|
+
replaced = true;
|
|
460
|
+
}
|
|
461
|
+
else if (line.startsWith(">>>>>>>") && inConflict) {
|
|
462
|
+
// End of the conflict block we're replacing
|
|
463
|
+
inConflict = false;
|
|
464
|
+
}
|
|
465
|
+
else if (!inConflict) {
|
|
466
|
+
result.push(line);
|
|
467
|
+
}
|
|
468
|
+
currentLine++;
|
|
469
|
+
}
|
|
470
|
+
if (!replaced) {
|
|
471
|
+
return {
|
|
472
|
+
content: [{
|
|
473
|
+
type: "text",
|
|
474
|
+
text: JSON.stringify({
|
|
475
|
+
error: `No conflict marker found at line ${targetLine} in ${file}.`,
|
|
476
|
+
}, null, 2),
|
|
477
|
+
}],
|
|
478
|
+
isError: true,
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
const newFileContent = result.join("\n");
|
|
482
|
+
writeFileSync(filePath, newFileContent, "utf-8");
|
|
483
|
+
// Re-analyze to check if conflicts remain
|
|
484
|
+
const recheck = resolve(newFileContent, file, { explainOnly: true });
|
|
485
|
+
return {
|
|
486
|
+
content: [{
|
|
487
|
+
type: "text",
|
|
488
|
+
text: JSON.stringify({
|
|
489
|
+
applied: true,
|
|
490
|
+
file,
|
|
491
|
+
line: targetLine,
|
|
492
|
+
remainingConflicts: recheck.stats.totalConflicts,
|
|
493
|
+
message: recheck.stats.totalConflicts === 0
|
|
494
|
+
? "All conflicts resolved in this file."
|
|
495
|
+
: `${recheck.stats.totalConflicts} conflict(s) remaining.`,
|
|
496
|
+
}, null, 2),
|
|
497
|
+
}],
|
|
498
|
+
};
|
|
499
|
+
}
|
|
500
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,OAAO,EAAoB,MAAM,eAAe,CAAC;AAE1D,8DAA8D;AAE9D,MAAM,UAAU,aAAa;IAC3B,OAAO;QACL;YACE,IAAI,EAAE,gBAAgB;YACtB,WAAW,EACT,kLAAkL;YACpL,WAAW,EAAE;gBACX,IAAI,EAAE,QAAiB;gBACvB,UAAU,EAAE;oBACV,GAAG,EAAE;wBACH,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,wDAAwD;qBACtE;iB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I,CAAC,IAAI,CAAC,CAAC;IACzC,aAAa,CAAC,QAAQ,EAAE,cAAc,EAAE,OAAO,CAAC,CAAC;IAEjD,0CAA0C;IAC1C,MAAM,OAAO,GAAG,OAAO,CAAC,cAAc,EAAE,IAAI,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;IAErE,OAAO;QACL,OAAO,EAAE,CAAC;gBACR,IAAI,EAAE,MAAe;gBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;oBACnB,OAAO,EAAE,IAAI;oBACb,IAAI;oBACJ,IAAI,EAAE,UAAU;oBAChB,kBAAkB,EAAE,OAAO,CAAC,KAAK,CAAC,cAAc;oBAChD,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,cAAc,KAAK,CAAC;wBACzC,CAAC,CAAC,sCAAsC;wBACxC,CAAC,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,cAAc,yBAAyB;iBAC7D,EAAE,IAAI,EAAE,CAAC,CAAC;aACZ,CAAC;KACH,CAAC;AACJ,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@gitwand/mcp",
|
|
3
|
+
"version": "1.6.0",
|
|
4
|
+
"description": "GitWand MCP server — smart Git conflict resolution for AI agents (Claude, Cursor, Windsurf, Claude Code)",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/server.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"gitwand-mcp": "dist/server.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"README.md"
|
|
13
|
+
],
|
|
14
|
+
"keywords": [
|
|
15
|
+
"mcp",
|
|
16
|
+
"model-context-protocol",
|
|
17
|
+
"git",
|
|
18
|
+
"merge",
|
|
19
|
+
"conflict",
|
|
20
|
+
"conflict-resolution",
|
|
21
|
+
"claude",
|
|
22
|
+
"claude-code",
|
|
23
|
+
"cursor",
|
|
24
|
+
"windsurf",
|
|
25
|
+
"ai-agent",
|
|
26
|
+
"gitwand"
|
|
27
|
+
],
|
|
28
|
+
"homepage": "https://github.com/devlint/GitWand#mcp-server",
|
|
29
|
+
"bugs": {
|
|
30
|
+
"url": "https://github.com/devlint/GitWand/issues"
|
|
31
|
+
},
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "git+https://github.com/devlint/GitWand.git",
|
|
35
|
+
"directory": "packages/mcp"
|
|
36
|
+
},
|
|
37
|
+
"publishConfig": {
|
|
38
|
+
"access": "public"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
42
|
+
"@gitwand/core": "1.6.0"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@types/node": "^25.5.0",
|
|
46
|
+
"typescript": "^5.4.0"
|
|
47
|
+
},
|
|
48
|
+
"author": "Laurent Guitton <lb.guitton@gmail.com>",
|
|
49
|
+
"license": "MIT",
|
|
50
|
+
"scripts": {
|
|
51
|
+
"build": "tsc",
|
|
52
|
+
"clean": "rm -rf dist"
|
|
53
|
+
}
|
|
54
|
+
}
|