Complete uni-wizard implementation with unified tool registry: **Core Architecture:** - harness.py - Single entry point for all capabilities - tools/registry.py - Central tool registry with schema generation - Elegant routing: One harness, infinite capabilities **Tool Categories (13 tools total):** - System: system_info, process_list, service_status, service_control, health_check, disk_usage - Git: git_status, git_log, git_pull, git_commit, git_push, git_checkout, git_branch_list - Network: http_get, http_post, gitea_create_issue, gitea_comment, gitea_list_issues, gitea_get_issue **Daemons:** - health_daemon.py - HTTP endpoint on :8082, writes to ~/timmy/logs/health.json - task_router.py - Polls Gitea for assigned issues, routes to tools, posts results **Systemd Services:** - timmy-health.service - Health monitoring daemon - timmy-task-router.service - Gitea task router daemon **Testing:** - test_harness.py - Exercises all tool categories **Design Principles:** - Local-first: No cloud dependencies - Self-healing: Tools can restart, reconnect, recover - Unified: One consciousness, all capabilities Closes #76, #77, #78
115 lines
2.8 KiB
Python
115 lines
2.8 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Test script for Uni-Wizard Harness
|
|
Exercises all tool categories
|
|
"""
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
sys.path.insert(0, str(Path(__file__).parent))
|
|
|
|
from harness import get_harness
|
|
|
|
|
|
def test_system_tools():
|
|
"""Test system monitoring tools"""
|
|
print("\n" + "="*60)
|
|
print("TESTING SYSTEM TOOLS")
|
|
print("="*60)
|
|
|
|
harness = get_harness()
|
|
|
|
tests = [
|
|
("system_info", {}),
|
|
("health_check", {}),
|
|
("process_list", {"filter_name": "python"}),
|
|
("disk_usage", {}),
|
|
]
|
|
|
|
for tool_name, params in tests:
|
|
print(f"\n>>> {tool_name}()")
|
|
result = harness.execute(tool_name, **params)
|
|
print(result[:500] + "..." if len(result) > 500 else result)
|
|
|
|
|
|
def test_git_tools():
|
|
"""Test git operations"""
|
|
print("\n" + "="*60)
|
|
print("TESTING GIT TOOLS")
|
|
print("="*60)
|
|
|
|
harness = get_harness()
|
|
|
|
# Test with timmy-home repo if it exists
|
|
repo_path = "/tmp/timmy-home"
|
|
|
|
tests = [
|
|
("git_status", {"repo_path": repo_path}),
|
|
("git_log", {"repo_path": repo_path, "count": 5}),
|
|
("git_branch_list", {"repo_path": repo_path}),
|
|
]
|
|
|
|
for tool_name, params in tests:
|
|
print(f"\n>>> {tool_name}()")
|
|
result = harness.execute(tool_name, **params)
|
|
print(result[:500] + "..." if len(result) > 500 else result)
|
|
|
|
|
|
def test_network_tools():
|
|
"""Test network operations"""
|
|
print("\n" + "="*60)
|
|
print("TESTING NETWORK TOOLS")
|
|
print("="*60)
|
|
|
|
harness = get_harness()
|
|
|
|
tests = [
|
|
("http_get", {"url": "http://143.198.27.163:3000/api/v1/repos/Timmy_Foundation/timmy-home"}),
|
|
("gitea_list_issues", {"state": "open"}),
|
|
]
|
|
|
|
for tool_name, params in tests:
|
|
print(f"\n>>> {tool_name}()")
|
|
result = harness.execute(tool_name, **params)
|
|
print(result[:500] + "..." if len(result) > 500 else result)
|
|
|
|
|
|
def test_harness_features():
|
|
"""Test harness management features"""
|
|
print("\n" + "="*60)
|
|
print("TESTING HARNESS FEATURES")
|
|
print("="*60)
|
|
|
|
harness = get_harness()
|
|
|
|
print("\n>>> list_capabilities()")
|
|
print(harness.list_capabilities())
|
|
|
|
print("\n>>> get_status()")
|
|
print(harness.get_status())
|
|
|
|
|
|
def run_all_tests():
|
|
"""Run complete test suite"""
|
|
print("UNI-WIZARD HARNESS TEST SUITE")
|
|
print("=============================")
|
|
|
|
try:
|
|
test_system_tools()
|
|
test_git_tools()
|
|
test_network_tools()
|
|
test_harness_features()
|
|
|
|
print("\n" + "="*60)
|
|
print("✓ ALL TESTS COMPLETED")
|
|
print("="*60)
|
|
|
|
except Exception as e:
|
|
print(f"\n✗ TEST FAILED: {e}")
|
|
import traceback
|
|
traceback.print_exc()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
run_all_tests()
|