#!/usr/bin/env bash # agent-goal-skill — one-liner installer for Claude Code, Codex, Kimi, Droid, Auggie # # Detects which CLI agents are installed and clones the skill into each one's # skill directory. Idempotent — safe to re-run. set -euo pipefail REPO_URL="${AGENT_GOAL_SKILL_REPO:-https://github.com/dallionking/agent-goal-skill.git}" SKILL_NAME="agent-goal-skill" declare -A TARGETS=( [claude-code]="$HOME/.claude/skills/$SKILL_NAME" [codex]="$HOME/.codex/skills/$SKILL_NAME" [kimi]="$HOME/.kimi/skills/$SKILL_NAME" [droid]="$HOME/.factory/skills/$SKILL_NAME" [auggie]="$HOME/.augment/skills/$SKILL_NAME" ) is_installed() { local agent="$1" case "$agent" in claude-code) command -v claude >/dev/null 2>&1 ;; codex) command -v codex >/dev/null 2>&1 ;; kimi) command -v kimi >/dev/null 2>&1 ;; droid) command -v droid >/dev/null 2>&1 ;; auggie) command -v auggie >/dev/null 2>&1 ;; *) return 1 ;; esac } install_to() { local agent="$1" local target="${TARGETS[$agent]}" local parent parent="$(dirname "$target")" mkdir -p "$parent" if [ -d "$target/.git" ]; then echo " [$agent] already installed → updating..." git -C "$target" pull --ff-only elif [ -d "$target" ]; then echo " [$agent] non-git directory exists — skipping (move or delete it first)" return 0 else echo " [$agent] installing → $target" git clone --quiet "$REPO_URL" "$target" fi echo " [$agent] ✓" } echo "agent-goal-skill installer" echo "Repo: $REPO_URL" echo installed_any=0 for agent in "${!TARGETS[@]}"; do if is_installed "$agent"; then install_to "$agent" installed_any=1 fi done if [ "$installed_any" -eq 0 ]; then echo "No supported CLI agent detected. Install one of: claude, codex, kimi, droid, auggie." echo "Or set target manually: git clone $REPO_URL /$SKILL_NAME" exit 1 fi echo echo "Done. Restart your agent and invoke: /$SKILL_NAME "