#!/bin/zsh set -e here="${0:A:h}" bindir="$HOME/bin" skilldir="$HOME/.claude/skills/routinectl" if [[ "$1" == "--uninstall" ]]; then rm -f "$bindir/routinectl" rm -rf "$skilldir" echo "removed $bindir/routinectl and $skilldir" exit 0 fi if ! command -v swiftc >/dev/null 2>&1; then echo "swiftc not found. Install Xcode command line tools first:" >&2 echo " xcode-select --install" >&2 exit 1 fi echo "building..." mkdir -p "$here/bin" swiftc -O "$here/routinectl.swift" -o "$here/bin/routinectl" mkdir -p "$bindir" cp "$here/bin/routinectl" "$bindir/routinectl" chmod +x "$bindir/routinectl" mkdir -p "$skilldir/reference" cp "$here/skill/SKILL.md" "$skilldir/SKILL.md" cp "$here/README.md" "$skilldir/reference/README.md" echo "installed:" echo " $bindir/routinectl" echo " $skilldir/SKILL.md" case ":$PATH:" in *":$bindir:"*) ;; *) echo "" echo "NOTE: $bindir is not on PATH. Add to ~/.zshrc:" echo " export PATH=\"\$HOME/bin:\$PATH\"" ;; esac echo "" echo "next: grant Accessibility permission to the app that runs your terminal" echo " (iTerm2, Terminal, or Claude Desktop if you drive it from the app's" echo " own terminal pane), quit and relaunch that app, then run:" echo "" echo " routinectl doctor"