feat(src): Resolve imports and create sloppy.py entry point

This commit is contained in:
2026-03-04 10:01:55 -05:00
parent a0276e0894
commit c102392320
44 changed files with 90 additions and 21 deletions

View File

@@ -13,8 +13,10 @@ import asyncio
import os
import sys
# Add project root to sys.path
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
# Add project root and src/ to sys.path
project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
sys.path.insert(0, project_root)
sys.path.insert(0, os.path.join(project_root, "src"))
import mcp_client
import shell_runner

View File

@@ -7,8 +7,10 @@ import io
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8')
# Add project root to sys.path
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
# 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

View File

@@ -2,8 +2,10 @@ import json
import sys
import os
# Add project root to sys.path
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
# 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

20
scripts/update_paths.py Normal file
View File

@@ -0,0 +1,20 @@
import os
import glob
pattern = 'sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "src")))'
replacement = pattern + '\nsys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "src")))'
# Files to update
files = glob.glob("tests/*.py") + glob.glob("simulation/*.py") + glob.glob("scripts/*.py")
for file_path in files:
if not os.path.isfile(file_path):
continue
with open(file_path, 'r', encoding='utf-8') as f:
content = f.read()
if pattern in content and replacement not in content:
print(f"Updating {file_path}")
new_content = content.replace(pattern, replacement)
with open(file_path, 'w', encoding='utf-8') as f:
f.write(new_content)