checkpoint: Claude Code integration + implement missing MCP var tools
Add Claude Code conductor commands, MCP server, MMA exec scripts, and implement py_get_var_declaration / py_set_var_declaration which were registered in dispatch and tool specs but had no function bodies. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -458,6 +458,47 @@ def py_get_class_summary(path: str, name: str) -> str:
|
||||
except Exception as e:
|
||||
return f"ERROR summarizing class '{name}' in '{path}': {e}"
|
||||
|
||||
def py_get_var_declaration(path: str, name: str) -> str:
|
||||
"""Get the assignment/declaration line(s) for a module-level or class-level variable."""
|
||||
p, err = _resolve_and_check(path)
|
||||
if err:
|
||||
return err
|
||||
if not p.is_file() or p.suffix != ".py":
|
||||
return f"ERROR: not a python file: {path}"
|
||||
try:
|
||||
import ast
|
||||
code = p.read_text(encoding="utf-8").lstrip(chr(0xFEFF))
|
||||
lines = code.splitlines(keepends=True)
|
||||
tree = ast.parse(code)
|
||||
node = _get_symbol_node(tree, name)
|
||||
if not node or not isinstance(node, (ast.Assign, ast.AnnAssign)):
|
||||
return f"ERROR: could not find variable '{name}' in {path}"
|
||||
start = getattr(node, "lineno") - 1
|
||||
end = getattr(node, "end_lineno")
|
||||
return "".join(lines[start:end])
|
||||
except Exception as e:
|
||||
return f"ERROR retrieving variable '{name}' from '{path}': {e}"
|
||||
|
||||
def py_set_var_declaration(path: str, name: str, new_declaration: str) -> str:
|
||||
"""Surgically replace a variable assignment/declaration."""
|
||||
p, err = _resolve_and_check(path)
|
||||
if err:
|
||||
return err
|
||||
if not p.is_file() or p.suffix != ".py":
|
||||
return f"ERROR: not a python file: {path}"
|
||||
try:
|
||||
import ast
|
||||
code = p.read_text(encoding="utf-8").lstrip(chr(0xFEFF))
|
||||
tree = ast.parse(code)
|
||||
node = _get_symbol_node(tree, name)
|
||||
if not node or not isinstance(node, (ast.Assign, ast.AnnAssign)):
|
||||
return f"ERROR: could not find variable '{name}' in {path}"
|
||||
start = getattr(node, "lineno")
|
||||
end = getattr(node, "end_lineno")
|
||||
return set_file_slice(path, start, end, new_declaration)
|
||||
except Exception as e:
|
||||
return f"ERROR updating variable '{name}' in '{path}': {e}"
|
||||
|
||||
def get_git_diff(path: str, base_rev: str = "HEAD", head_rev: str = "") -> str:
|
||||
"""
|
||||
Returns the git diff for a file or directory.
|
||||
|
||||
Reference in New Issue
Block a user