Skip to content

Commit f1d773b

Browse files
committed
MCP: resolve merge conflicts; unify NL parsing and text-edit guards; add SHA precondition and immediate refresh; keep verification slice; minor test and uv.lock updates
1 parent e4e89e4 commit f1d773b

File tree

4 files changed

+14
-24
lines changed

4 files changed

+14
-24
lines changed

UnityMcpBridge/UnityMcpServer~/src/server.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ def read_resource(ctx: Context, uri: str) -> dict:
147147
return {"mimeType": "text/plain", "text": text, "metadata": {"sha256": sha}}
148148
except Exception as e:
149149
return {"mimeType": "text/plain", "text": f"Error reading resource: {e}"}
150-
151150

152151
# Run the server
153152
if __name__ == "__main__":

UnityMcpBridge/UnityMcpServer~/src/tools/manage_script_edits.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,14 @@ def script_apply_edits(
229229
e.setdefault("text", "")
230230
normalized_edits.append(e)
231231
continue
232+
if op == "regex_replace" and ("replacement" not in e):
233+
# Normalize alternative text fields into 'replacement' for local preview path
234+
if "text" in e:
235+
e = dict(e)
236+
e["replacement"] = e.get("text", "")
237+
elif "insert" in e or "content" in e:
238+
e = dict(e)
239+
e["replacement"] = e.get("insert") or e.get("content") or ""
232240
if op == "anchor_insert" and not (e.get("text") or e.get("insert") or e.get("content") or e.get("replacement")):
233241
# Upgrade empty insert intent to anchor_delete with guidance
234242
e = dict(e)
@@ -426,7 +434,6 @@ def line_col_from_index(idx: int) -> Tuple[int, int]:
426434
return {"success": False, "message": "Preview diff; set options.confirm=true to apply.", "data": {"diff": "\n".join(diff)}}
427435
except Exception as e:
428436
return {"success": False, "message": f"Preview failed: {e}"}
429-
430437
# 2) apply edits locally (only if not text-ops)
431438
try:
432439
new_contents = _apply_edits_locally(contents, edits)

UnityMcpBridge/UnityMcpServer~/src/uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/test_logging_stdout.py

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -48,33 +48,17 @@ def visit_Call(self, node: ast.Call):
4848
# print(...)
4949
if isinstance(node.func, ast.Name) and node.func.id == "print":
5050
self.hit = True
51-
# builtins.print(...)
52-
elif (
53-
isinstance(node.func, ast.Attribute)
54-
and node.func.attr == "print"
55-
and isinstance(node.func.value, ast.Name)
56-
and node.func.value.id == "builtins"
57-
):
58-
self.hit = True
5951
# sys.stdout.write(...)
60-
if (
61-
isinstance(node.func, ast.Attribute)
62-
and node.func.attr == "write"
63-
and isinstance(node.func.value, ast.Attribute)
64-
and node.func.value.attr == "stdout"
65-
and isinstance(node.func.value.value, ast.Name)
66-
and node.func.value.value.id == "sys"
67-
):
68-
self.hit = True
52+
if isinstance(node.func, ast.Attribute) and node.func.attr == "write":
53+
val = node.func.value
54+
if isinstance(val, ast.Attribute) and val.attr == "stdout":
55+
if isinstance(val.value, ast.Name) and val.value.id == "sys":
56+
self.hit = True
6957
self.generic_visit(node)
7058

7159
v = StdoutVisitor()
7260
v.visit(tree)
7361
if v.hit:
7462
offenders.append(py_file.relative_to(SRC))
75-
<<<<<<< HEAD
76-
=======
77-
7863
assert not syntax_errors, "syntax errors in: " + ", ".join(str(e) for e in syntax_errors)
79-
>>>>>>> 1a50016 (clarify stdout test failure messaging)
8064
assert not offenders, "stdout writes found in: " + ", ".join(str(o) for o in offenders)

0 commit comments

Comments
 (0)