chore(scripts): remove tool_call aliases and legacy tool discovery
These 4 scripts are redundant aliases and a tool that uses a non-canonical MCP API path. Removed (4 files, ~3.5 KB): - scan_all_hints.py (2.0 KB) - only referenced in .claude/commands/mma-tier2-tech-lead.md (local AI tool config, not the project). The MMA workflow uses audit_weak_types.py. - tool_call.bat (49 B) - cmd wrapper for tool_call.py (redundant with tool_call.ps1) - tool_call.cmd (50 B) - cmd wrapper for tool_call.py (redundant with tool_call.ps1) - tool_discovery.py (1.4 KB) - tool spec discovery using the legacy mcp_client.MCP_TOOL_SPECS API path (will be refactored by mcp_architecture_refactor_20260606) Kept tool-call bridge: tool_call.cpp (source), tool_call.exe (binary), tool_call.py (Python bridge), tool_call.ps1 (PowerShell).
This commit is contained in:
@@ -1,59 +0,0 @@
|
|||||||
"""Scan all .py files for missing type hints. Writes scan_report.txt."""
|
|
||||||
import ast
|
|
||||||
import os
|
|
||||||
|
|
||||||
SKIP: set[str] = {'.git', '__pycache__', '.venv', 'venv', 'node_modules', '.claude', '.gemini'}
|
|
||||||
BASE: str = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
|
|
||||||
os.chdir(BASE)
|
|
||||||
|
|
||||||
results: dict[str, tuple[int, int, int, int]] = {}
|
|
||||||
for root, dirs, files in os.walk('.'):
|
|
||||||
dirs[:] = [d for d in dirs if d not in SKIP]
|
|
||||||
for f in files:
|
|
||||||
if not f.endswith('.py'):
|
|
||||||
continue
|
|
||||||
path: str = os.path.join(root, f).replace('\\', '/')
|
|
||||||
try:
|
|
||||||
with open(path, 'r', encoding='utf-8-sig') as fh:
|
|
||||||
tree = ast.parse(fh.read())
|
|
||||||
except Exception:
|
|
||||||
continue
|
|
||||||
counts: list[int] = [0, 0, 0] # nr, up, uv
|
|
||||||
|
|
||||||
def scan(scope: ast.AST, prefix: str = '') -> None:
|
|
||||||
# Iterate top-level nodes in this scope
|
|
||||||
for node in ast.iter_child_nodes(scope):
|
|
||||||
if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef)):
|
|
||||||
if node.returns is None:
|
|
||||||
counts[0] += 1
|
|
||||||
for arg in node.args.args:
|
|
||||||
if arg.arg not in ('self', 'cls') and arg.annotation is None:
|
|
||||||
counts[1] += 1
|
|
||||||
elif isinstance(node, ast.Assign):
|
|
||||||
for t in node.targets:
|
|
||||||
if isinstance(t, ast.Name):
|
|
||||||
counts[2] += 1
|
|
||||||
elif isinstance(node, ast.ClassDef):
|
|
||||||
scan(node, prefix=f'{node.name}.')
|
|
||||||
scan(tree)
|
|
||||||
nr, up, uv = counts
|
|
||||||
total: int = nr + up + uv
|
|
||||||
if total > 0:
|
|
||||||
results[path] = (nr, up, uv, total)
|
|
||||||
|
|
||||||
lines: list[str] = []
|
|
||||||
lines.append(f'Files with untyped items: {len(results)}')
|
|
||||||
lines.append('')
|
|
||||||
lines.append(f'{"File":<58} {"NoRet":>6} {"Params":>7} {"Vars":>5} {"Total":>6}')
|
|
||||||
lines.append('-' * 85)
|
|
||||||
gt: int = 0
|
|
||||||
for path in sorted(results, key=lambda x: results[x][3], reverse=True):
|
|
||||||
nr, up, uv, t = results[path]
|
|
||||||
lines.append(f'{path:<58} {nr:>6} {up:>7} {uv:>5} {t:>6}')
|
|
||||||
gt += t
|
|
||||||
lines.append('-' * 85)
|
|
||||||
lines.append(f'{"TOTAL":<58} {"":>6} {"":>7} {"":>5} {gt:>6}')
|
|
||||||
|
|
||||||
report: str = '\n'.join(lines)
|
|
||||||
with open('scan_report.txt', 'w', encoding='utf-8') as f:
|
|
||||||
f.write(report)
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
@echo off
|
|
||||||
uv run python "%~dp0tool_call.py" %*
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
@echo off
|
|
||||||
uv run python scripts\tool_call.py %*
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
import json
|
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
|
|
||||||
# Add project root and src/ to sys.path
|
|
||||||
project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
|
|
||||||
sys.path.append(project_root)
|
|
||||||
sys.path.append(os.path.join(project_root, "src"))
|
|
||||||
|
|
||||||
try:
|
|
||||||
import mcp_client
|
|
||||||
except ImportError as e:
|
|
||||||
# Print the error to stderr to diagnose
|
|
||||||
print(f"ImportError in discovery: {e}", file=sys.stderr)
|
|
||||||
print("[]")
|
|
||||||
sys.exit(0)
|
|
||||||
|
|
||||||
def main() -> None:
|
|
||||||
specs = list(mcp_client.MCP_TOOL_SPECS)
|
|
||||||
# Add run_powershell (manually define to match ai_client.py)
|
|
||||||
specs.append({
|
|
||||||
"name": "run_powershell",
|
|
||||||
"description": (
|
|
||||||
"Run a PowerShell script within the project base_dir. "
|
|
||||||
"Use this to create, edit, rename, or delete files and directories. "
|
|
||||||
"The working directory is set to base_dir automatically. "
|
|
||||||
"stdout and stderr are returned to you as the result."
|
|
||||||
),
|
|
||||||
"parameters": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"script": {
|
|
||||||
"type": "string",
|
|
||||||
"description": "The PowerShell script to execute."
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"required": ["script"]
|
|
||||||
}
|
|
||||||
})
|
|
||||||
# Rename 'parameters' to 'parametersJsonSchema' for Gemini CLI
|
|
||||||
for spec in specs:
|
|
||||||
if "parameters" in spec:
|
|
||||||
spec["parametersJsonSchema"] = spec.pop("parameters")
|
|
||||||
# Output as JSON array of FunctionDeclarations
|
|
||||||
print(json.dumps(specs, indent=2))
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
||||||
Reference in New Issue
Block a user