fix(mcp_client): add missing ts_c_get_skeleton function
Commit3bb850acadded tests/test_ts_c_tools.py but the corresponding ts_c_get_skeleton function was never added to src/mcp_client.py. The test file's module-level 'from src.mcp_client import ts_c_get_skeleton, ts_c_get_code_outline' raises ImportError, which aborts Batch 9 collection in run_tests_batched.py. Add ts_c_get_skeleton parallel to ts_cpp_get_skeleton (commit3bb850acalso added ts_cpp_get_skeleton). Implementation is the same pattern: parse via ASTParser('c') (which is supported per Phase 2B) and delegate to parser.get_skeleton(). The C function block in mcp_client.py now mirrors the CPP block: ts_c_get_skeleton, ts_c_get_code_outline, ts_c_get_definition, ts_c_get_signature, ts_c_update_definition ts_cpp_get_skeleton, ts_cpp_get_code_outline, ts_cpp_get_definition, ts_cpp_get_signature, ts_cpp_update_definition Verified: tests/test_ts_c_tools.py 2/2 pass (previously aborted Batch 9 with ImportError).
This commit is contained in:
@@ -376,6 +376,23 @@ def get_git_diff(path: str, base_rev: str = "HEAD", head_rev: str = "") -> str:
|
||||
|
||||
#region: C
|
||||
|
||||
def ts_c_get_skeleton(path: str) -> str:
|
||||
"""
|
||||
Returns a skeleton of a C file.
|
||||
[C: tests/test_ts_c_tools.py:test_ts_c_get_skeleton]
|
||||
"""
|
||||
p, err = _resolve_and_check(path)
|
||||
if err: return err
|
||||
assert p is not None
|
||||
if not p.exists(): return f"ERROR: file not found: {path}"
|
||||
try:
|
||||
from src.file_cache import ASTParser
|
||||
code = p.read_text(encoding="utf-8")
|
||||
parser = ASTParser("c")
|
||||
return parser.get_skeleton(code, path=str(p))
|
||||
except Exception as e:
|
||||
return f"ERROR generating skeleton for '{path}': {e}"
|
||||
|
||||
def ts_c_get_code_outline(path: str) -> str:
|
||||
"""
|
||||
Returns a hierarchical outline of a C file.
|
||||
|
||||
Reference in New Issue
Block a user