"""Expose three user-mode commands without editing shell startup files."""
import os
from pathlib import Path
import shutil

if os.geteuid() != 0:
    raise SystemExit("One-time command registration requires sudo")
stage = Path("/home/si/.local/share/contextra-offline-prep/20260928-r01")
names = ("ct-llm", "ct-agent", "ct-gui")
for name in names:
    target = Path("/usr/local/bin") / name
    if target.exists() or target.is_symlink():
        raise RuntimeError("Existing command requires review: " + name)
for name in names:
    target = Path("/usr/local/bin") / name
    shutil.copyfile(stage / name, target)
    target.chmod(0o755)
print("ct-llm / ct-agent / ct-gui registered; no services started")
