import os
import sys
import argparse

# Add parent directory to path
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../..'))

from comfy_launcher import launch_comfy_server

def main():
    parser = argparse.ArgumentParser(description='Launch RunComfy environment')
    parser.add_argument('--version-id', default='90f77137-ba75-400d-870f-204c614ae8a3')
    parser.add_argument('--server-type', default='medium')
    parser.add_argument('--duration', type=int, default=3600)
    parser.add_argument('--timeout', type=int, default=300)
    
    args = parser.parse_args()
    
    result = launch_comfy_server(
        version_id=args.version_id,
        server_type=args.server_type,
        duration=args.duration,
        timeout=args.timeout
    )
    
    print(f"Server launched successfully!")
    print(f"Server ID: {result['server_id']}")
    print(f"ComfyUI URL: {result['comfy_url']}")
    print(f"Status: {result['status']}")
    print(f"\n{result['usage_instruction']}")

if __name__ == '__main__':
    main()
