#!/usr/bin/env bash
set -euo pipefail

# Helper to create system-wide symlinks for installed CLIs (run interactively)
# This script will prompt for sudo password when necessary.

echo "Creating system-wide symlinks (requires sudo)"

sudo ln -sf "$HOME/.local/bin/claude" /usr/local/bin/claude || true
sudo ln -sf "$HOME/.npm-global/bin/codex" /usr/local/bin/codex || true
sudo ln -sf "$HOME/.local/bin/devin" /usr/local/bin/devin || true
sudo ln -sf "$HOME/.local/bin/agy" /usr/local/bin/agy || true
# copilot installed via snap; link snap binary if present
if [ -x "/snap/bin/copilot" ]; then
  sudo ln -sf "/snap/bin/copilot" /usr/local/bin/copilot || true
fi

echo "Symlink operations attempted. Verify with: ls -l /usr/local/bin/{claude,codex,devin,agy,copilot}"
