Applied 236 return type annotations to functions with no return values across 100+ files (core modules, tests, scripts, simulations). Added Phase 4 to python_style_refactor track for remaining 597 items (untyped params, vars, and functions with return values). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
63 lines
1.8 KiB
Python
63 lines
1.8 KiB
Python
import subprocess
|
|
import time
|
|
import sys
|
|
import os
|
|
|
|
PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
|
|
if PROJECT_ROOT not in sys.path:
|
|
sys.path.insert(0, PROJECT_ROOT)
|
|
|
|
from api_hook_client import ApiHookClient
|
|
|
|
def diag_run() -> None:
|
|
print("Launching GUI for manual inspection + automated hooks...")
|
|
# Use a log file for GUI output
|
|
with open("gui_diag.log", "w") as log_file:
|
|
gui_process = subprocess.Popen(
|
|
[sys.executable, "gui_2.py", "--enable-test-hooks"],
|
|
cwd=PROJECT_ROOT,
|
|
stdout=log_file,
|
|
stderr=log_file,
|
|
text=True
|
|
)
|
|
client = ApiHookClient()
|
|
print("Waiting for GUI...")
|
|
if not client.wait_for_server(timeout=10):
|
|
print("GUI failed to start.")
|
|
gui_process.terminate()
|
|
return
|
|
# Pushing state
|
|
track_data = {"id": "diag_track", "title": "Diagnostic Track"}
|
|
tickets_data = [{"id": f"T{i}", "status": "todo"} for i in range(3)]
|
|
print("Pushing state update...")
|
|
client.push_event("mma_state_update", {
|
|
"status": "active",
|
|
"active_tier": "Tier 1",
|
|
"track": track_data,
|
|
"tickets": tickets_data
|
|
})
|
|
time.sleep(2)
|
|
print("Pushing approval request...")
|
|
client.push_event("mma_step_approval", {
|
|
"ticket_id": "T0",
|
|
"payload": "Get-ChildItem"
|
|
})
|
|
print("\nGUI is running. Check 'gui_diag.log' for output.")
|
|
print("I will now poll mma_status every 2 seconds. Ctrl+C to stop.")
|
|
try:
|
|
start_poll = time.time()
|
|
while time.time() - start_poll < 30:
|
|
try:
|
|
status = client.get_mma_status()
|
|
print(f"[{time.strftime('%H:%M:%S')}] Status: {status.get('mma_status')}, Pending Approval: {status.get('pending_approval')}")
|
|
except Exception as e:
|
|
print(f"[{time.strftime('%H:%M:%S')}] Error querying status: {e}")
|
|
time.sleep(2)
|
|
except KeyboardInterrupt:
|
|
print("Stopping...")
|
|
finally:
|
|
gui_process.terminate()
|
|
|
|
if __name__ == "__main__":
|
|
diag_run()
|