Skip to content

Non-invasive MCP accelerator plugin for Google Antigravity (CLI/Desktop/IDE): cuts LLM turns (-34%), token quota (-31%), and upload traffic (-40%) without affecting native UI or diffs.

Merge pull request #50 from wathing-wind/feat/apply-edits-indentation-mismatch-hints

inkwhited1e5e2f1bed3
diff --cc dist/mcp-server.mjs
index 36b3435,a33db2c..5efa9a3
--- a/dist/mcp-server.mjs
+++ b/dist/mcp-server.mjs
@@@ -3031,19 -3156,12 +3302,17 @@@ function findClosestRegionSnippet(fileL
const snippet = [];
for (let ln = from; ln <= to; ln++) {
const lineText = fileLines[ln - 1] ?? "";
- snippet.push(
- ` ${ln}: ${lineText.length > 160 ? `${sliceSafeChars(lineText, 157)}...` : lineText}`
- );
+ snippet.push(` ${ln}: ${renderSnippetLine(lineText, showLeadingTabs)}`);
}
return `
- Closest match near line ${bestStart + 1} (lines ${from}-${to}):
+ Closest match near line ${bestStart + 1} (lines ${from}-${to})${tabLegend}:
${snippet.join("\n")}`;
}
+function hasOverlappingMatch(content, target, offset, limitEnd) {
+ if (target.length <= 1) return false;
+ const next = content.indexOf(target, offset + 1);
+ return next !== -1 && next + target.length <= limitEnd;
+}
function planHunksForContent(normalizedContent, hunks, displayPath) {
const lineStarts = computeLineStarts(normalizedContent);
if (normalizedContent.length > 0 && lineStarts.at(-1) === normalizedContent.length) {
diff --cc src/tools/apply-edits.ts
index 87960a1,690bbac..5d86895
--- a/src/tools/apply-edits.ts
+++ b/src/tools/apply-edits.ts
@@@ -360,24 -713,11 +713,22 @@@ function findClosestRegionSnippet
const snippet: string[] = [];
for (let ln = from; ln <= to; ln++) {
const lineText = fileLines[ln - 1] ?? "";
- snippet.push(
- ` ${ln}: ${lineText.length > 160 ? `${sliceSafeChars(lineText, 157)}...` : lineText}`,
- );
+ snippet.push(` ${ln}: ${renderSnippetLine(lineText, showLeadingTabs)}`);
}
- return `\n Closest match near line ${bestStart + 1} (lines ${from}-${to}):\n${snippet.join("\n")}`;
+ return `\n Closest match near line ${bestStart + 1} (lines ${from}-${to})${tabLegend}:\n${snippet.join("\n")}`;
}
+function hasOverlappingMatch(
+ content: string,
+ target: string,
+ offset: number,
+ limitEnd: number,
+): boolean {
+ if (target.length <= 1) return false;
+ const next = content.indexOf(target, offset + 1);
+ return next !== -1 && next + target.length <= limitEnd;
+}
+
function planHunksForContent(
normalizedContent: string,
hunks: EditHunk[],