#!/usr/bin/env python3
"""Check ComfyUI flags and update startup."""
import paramiko
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('192.168.178.150', username='fabian', key_filename=r'C:\Users\fabia\.ssh\id_ed25519')

def run(cmd, timeout=60):
    _, stdout, stderr = ssh.exec_command(cmd, timeout=timeout)
    out = stdout.read().decode()
    err = stderr.read().decode()
    return out + err

# Kill any leftover
print(run("pkill -9 -f 'python3 main.py' 2>/dev/null; echo killed"))

# Full help output
print("=== ComfyUI --help ===")
help_text = run("bash -c 'source /home/fabian/comfyui-env/bin/activate && cd /home/fabian/ComfyUI && python3 main.py --help 2>&1'")
# Filter for interesting lines
for line in help_text.split('\n'):
    low = line.lower()
    if any(w in low for w in ['vae', 'fp16', 'fp32', 'force', 'cpu', 'vram', 'memory', 'offload', 'precision']):
        print(f"  {line.strip()}")

# Also just dump the full thing to see everything
print("\n=== FULL HELP ===")
print(help_text)

ssh.close()
