#!/usr/bin/env python3 """Cross-platform installer for ServerManager AI integrations. Supports Claude (/ssh), Codex (server-manager), and Gemini (server-manager) for the current user, a target home, or all discovered user homes. """ from __future__ import annotations import argparse import os import sys from pathlib import Path PROJECT_ROOT = Path(__file__).resolve().parents[1] if str(PROJECT_ROOT) not in sys.path: sys.path.insert(0, str(PROJECT_ROOT)) from core.claude_setup import install_all # noqa: E402 def parse_args() -> argparse.Namespace: p = argparse.ArgumentParser(description="Install ServerManager AI integrations") p.add_argument("--target-home", help="Install into this home directory instead of the current user") p.add_argument("--all-users", action="store_true", help="Install to all discovered user homes on this system") return p.parse_args() def main() -> int: args = parse_args() if args.target_home and args.all_users: print("error: --target-home and --all-users are mutually exclusive", file=sys.stderr) return 2 if args.target_home: os.environ["SERVER_MANAGER_TARGET_HOME"] = os.path.abspath(os.path.expanduser(args.target_home)) if args.all_users: os.environ["SERVER_MANAGER_INSTALL_ALL_USERS"] = "1" for line in install_all(): print(line) return 0 if __name__ == "__main__": raise SystemExit(main())