feat: add multi-tool integration scripts and converted agent files
Adds support for installing The Agency agents across 7 agentic coding
tools via two scripts:
scripts/convert.sh
- Reads all 61 agents and converts them into tool-specific formats
- Supports: Antigravity, Gemini CLI, OpenCode, Cursor, Aider, Windsurf
- Shellcheck-clean, pure bash, no external deps
- Run: ./scripts/convert.sh [--tool <name>]
scripts/install.sh
- Interactive terminal UI with auto-detection of installed tools
- Pre-selects detected tools, toggle by number or bulk commands
- Falls back gracefully in CI / non-interactive mode
- Cross-platform: Linux, macOS (bash 3.2+), Windows Git Bash / WSL
- Run: ./scripts/install.sh [--tool <name>] [--no-interactive]
integrations/ (generated, committed for reference)
- antigravity/ SKILL.md per agent (61 files)
- gemini-cli/ SKILL.md per agent + gemini-extension.json
- opencode/ .md agent files for .opencode/agent/
- cursor/ .mdc rule files for .cursor/rules/
- aider/ single CONVENTIONS.md (all agents combined)
- windsurf/ single .windsurfrules (all agents combined)
- claude-code/ README only (agents copied directly from repo root)
- README.md full usage + tool-specific instructions
README.md
- Added Multi-Tool Integrations section with supported tools table,
quick-start guide, per-tool expandable instructions, and updated
roadmap marking integrations as complete
This commit is contained in:
362
scripts/convert.sh
Executable file
362
scripts/convert.sh
Executable file
@@ -0,0 +1,362 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# convert.sh — Convert agency agent .md files into tool-specific formats.
|
||||
#
|
||||
# Reads all agent files from the standard category directories and outputs
|
||||
# converted files to integrations/<tool>/. Run this to regenerate all
|
||||
# integration files after adding or modifying agents.
|
||||
#
|
||||
# Usage:
|
||||
# ./scripts/convert.sh [--tool <name>] [--out <dir>] [--help]
|
||||
#
|
||||
# Tools:
|
||||
# antigravity — Antigravity skill files (~/.gemini/antigravity/skills/)
|
||||
# gemini-cli — Gemini CLI extension (skills/ + gemini-extension.json)
|
||||
# opencode — OpenCode agent files (.opencode/agent/*.md)
|
||||
# cursor — Cursor rule files (.cursor/rules/*.mdc)
|
||||
# aider — Single CONVENTIONS.md for Aider
|
||||
# windsurf — Single .windsurfrules for Windsurf
|
||||
# all — All tools (default)
|
||||
#
|
||||
# Output is written to integrations/<tool>/ relative to the repo root.
|
||||
# This script never touches user config dirs — see install.sh for that.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# --- Colour helpers ---
|
||||
if [[ -t 1 ]]; then
|
||||
GREEN=$'\033[0;32m'; YELLOW=$'\033[1;33m'; RED=$'\033[0;31m'; BOLD=$'\033[1m'; RESET=$'\033[0m'
|
||||
else
|
||||
GREEN=''; YELLOW=''; RED=''; BOLD=''; RESET=''
|
||||
fi
|
||||
|
||||
info() { printf "${GREEN}[OK]${RESET} %s\n" "$*"; }
|
||||
warn() { printf "${YELLOW}[!!]${RESET} %s\n" "$*"; }
|
||||
error() { printf "${RED}[ERR]${RESET} %s\n" "$*" >&2; }
|
||||
header() { echo -e "\n${BOLD}$*${RESET}"; }
|
||||
|
||||
# --- Paths ---
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
OUT_DIR="$REPO_ROOT/integrations"
|
||||
TODAY="$(date +%Y-%m-%d)"
|
||||
|
||||
AGENT_DIRS=(
|
||||
design engineering marketing product project-management
|
||||
testing support spatial-computing specialized
|
||||
)
|
||||
|
||||
# --- Usage ---
|
||||
usage() {
|
||||
sed -n '3,22p' "$0" | sed 's/^# \{0,1\}//'
|
||||
exit 0
|
||||
}
|
||||
|
||||
# --- Frontmatter helpers ---
|
||||
|
||||
# Extract a single field value from YAML frontmatter block.
|
||||
# Usage: get_field <field> <file>
|
||||
get_field() {
|
||||
local field="$1" file="$2"
|
||||
awk -v f="$field" '
|
||||
/^---$/ { fm++; next }
|
||||
fm == 1 && $0 ~ "^" f ": " { sub("^" f ": ", ""); print; exit }
|
||||
' "$file"
|
||||
}
|
||||
|
||||
# Strip the leading frontmatter block and return only the body.
|
||||
# Usage: get_body <file>
|
||||
get_body() {
|
||||
awk 'BEGIN{fm=0} /^---$/{fm++; next} fm>=2{print}' "$1"
|
||||
}
|
||||
|
||||
# Convert a human-readable agent name to a lowercase kebab-case slug.
|
||||
# "Frontend Developer" → "frontend-developer"
|
||||
slugify() {
|
||||
echo "$1" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g' | sed 's/--*/-/g' | sed 's/^-//;s/-$//'
|
||||
}
|
||||
|
||||
# --- Per-tool converters ---
|
||||
|
||||
convert_antigravity() {
|
||||
local file="$1"
|
||||
local name description slug outdir outfile body
|
||||
|
||||
name="$(get_field "name" "$file")"
|
||||
description="$(get_field "description" "$file")"
|
||||
slug="agency-$(slugify "$name")"
|
||||
body="$(get_body "$file")"
|
||||
|
||||
outdir="$OUT_DIR/antigravity/$slug"
|
||||
outfile="$outdir/SKILL.md"
|
||||
mkdir -p "$outdir"
|
||||
|
||||
# Antigravity SKILL.md format mirrors community skills in ~/.gemini/antigravity/skills/
|
||||
cat > "$outfile" <<HEREDOC
|
||||
---
|
||||
name: ${slug}
|
||||
description: ${description}
|
||||
risk: low
|
||||
source: community
|
||||
date_added: '${TODAY}'
|
||||
---
|
||||
${body}
|
||||
HEREDOC
|
||||
}
|
||||
|
||||
convert_gemini_cli() {
|
||||
local file="$1"
|
||||
local name description slug outdir outfile body
|
||||
|
||||
name="$(get_field "name" "$file")"
|
||||
description="$(get_field "description" "$file")"
|
||||
slug="$(slugify "$name")"
|
||||
body="$(get_body "$file")"
|
||||
|
||||
outdir="$OUT_DIR/gemini-cli/skills/$slug"
|
||||
outfile="$outdir/SKILL.md"
|
||||
mkdir -p "$outdir"
|
||||
|
||||
# Gemini CLI skill format: minimal frontmatter (name + description only)
|
||||
cat > "$outfile" <<HEREDOC
|
||||
---
|
||||
name: ${slug}
|
||||
description: ${description}
|
||||
---
|
||||
${body}
|
||||
HEREDOC
|
||||
}
|
||||
|
||||
convert_opencode() {
|
||||
local file="$1"
|
||||
local name description color slug outfile body
|
||||
|
||||
name="$(get_field "name" "$file")"
|
||||
description="$(get_field "description" "$file")"
|
||||
color="$(get_field "color" "$file")"
|
||||
slug="$(slugify "$name")"
|
||||
body="$(get_body "$file")"
|
||||
|
||||
outfile="$OUT_DIR/opencode/agent/${slug}.md"
|
||||
mkdir -p "$OUT_DIR/opencode/agent"
|
||||
|
||||
# OpenCode agent format: same as the source format (.md with frontmatter).
|
||||
# color field is supported. No conversion needed beyond directory placement.
|
||||
cat > "$outfile" <<HEREDOC
|
||||
---
|
||||
name: ${name}
|
||||
description: ${description}
|
||||
color: ${color}
|
||||
---
|
||||
${body}
|
||||
HEREDOC
|
||||
}
|
||||
|
||||
convert_cursor() {
|
||||
local file="$1"
|
||||
local name description slug outfile body
|
||||
|
||||
name="$(get_field "name" "$file")"
|
||||
description="$(get_field "description" "$file")"
|
||||
slug="$(slugify "$name")"
|
||||
body="$(get_body "$file")"
|
||||
|
||||
outfile="$OUT_DIR/cursor/rules/${slug}.mdc"
|
||||
mkdir -p "$OUT_DIR/cursor/rules"
|
||||
|
||||
# Cursor .mdc format: description + globs + alwaysApply frontmatter
|
||||
cat > "$outfile" <<HEREDOC
|
||||
---
|
||||
description: ${description}
|
||||
globs: ""
|
||||
alwaysApply: false
|
||||
---
|
||||
${body}
|
||||
HEREDOC
|
||||
}
|
||||
|
||||
# Aider and Windsurf are single-file formats — accumulate into temp files
|
||||
# then write at the end.
|
||||
AIDER_TMP="$(mktemp)"
|
||||
WINDSURF_TMP="$(mktemp)"
|
||||
trap 'rm -f "$AIDER_TMP" "$WINDSURF_TMP"' EXIT
|
||||
|
||||
# Write Aider/Windsurf headers once
|
||||
cat > "$AIDER_TMP" <<'HEREDOC'
|
||||
# The Agency — AI Agent Conventions
|
||||
#
|
||||
# This file provides Aider with the full roster of specialized AI agents from
|
||||
# The Agency (https://github.com/msitarzewski/agency-agents).
|
||||
#
|
||||
# To activate an agent, reference it by name in your Aider session prompt, e.g.:
|
||||
# "Use the Frontend Developer agent to review this component."
|
||||
#
|
||||
# Generated by scripts/convert.sh — do not edit manually.
|
||||
|
||||
HEREDOC
|
||||
|
||||
cat > "$WINDSURF_TMP" <<'HEREDOC'
|
||||
# The Agency — AI Agent Rules for Windsurf
|
||||
#
|
||||
# Full roster of specialized AI agents from The Agency.
|
||||
# To activate an agent, reference it by name in your Windsurf conversation.
|
||||
#
|
||||
# Generated by scripts/convert.sh — do not edit manually.
|
||||
|
||||
HEREDOC
|
||||
|
||||
accumulate_aider() {
|
||||
local file="$1"
|
||||
local name description body
|
||||
|
||||
name="$(get_field "name" "$file")"
|
||||
description="$(get_field "description" "$file")"
|
||||
body="$(get_body "$file")"
|
||||
|
||||
cat >> "$AIDER_TMP" <<HEREDOC
|
||||
|
||||
---
|
||||
|
||||
## ${name}
|
||||
|
||||
> ${description}
|
||||
|
||||
${body}
|
||||
HEREDOC
|
||||
}
|
||||
|
||||
accumulate_windsurf() {
|
||||
local file="$1"
|
||||
local name description body
|
||||
|
||||
name="$(get_field "name" "$file")"
|
||||
description="$(get_field "description" "$file")"
|
||||
body="$(get_body "$file")"
|
||||
|
||||
cat >> "$WINDSURF_TMP" <<HEREDOC
|
||||
|
||||
================================================================================
|
||||
## ${name}
|
||||
${description}
|
||||
================================================================================
|
||||
|
||||
${body}
|
||||
|
||||
HEREDOC
|
||||
}
|
||||
|
||||
# --- Main loop ---
|
||||
|
||||
run_conversions() {
|
||||
local tool="$1"
|
||||
local count=0
|
||||
|
||||
for dir in "${AGENT_DIRS[@]}"; do
|
||||
local dirpath="$REPO_ROOT/$dir"
|
||||
[[ -d "$dirpath" ]] || continue
|
||||
|
||||
while IFS= read -r -d '' file; do
|
||||
# Skip files without frontmatter (non-agent docs like QUICKSTART.md)
|
||||
local first_line
|
||||
first_line="$(head -1 "$file")"
|
||||
[[ "$first_line" == "---" ]] || continue
|
||||
|
||||
local name
|
||||
name="$(get_field "name" "$file")"
|
||||
[[ -n "$name" ]] || continue
|
||||
|
||||
case "$tool" in
|
||||
antigravity) convert_antigravity "$file" ;;
|
||||
gemini-cli) convert_gemini_cli "$file" ;;
|
||||
opencode) convert_opencode "$file" ;;
|
||||
cursor) convert_cursor "$file" ;;
|
||||
aider) accumulate_aider "$file" ;;
|
||||
windsurf) accumulate_windsurf "$file" ;;
|
||||
esac
|
||||
|
||||
(( count++ )) || true
|
||||
done < <(find "$dirpath" -maxdepth 1 -name "*.md" -type f -print0 | sort -z)
|
||||
done
|
||||
|
||||
echo "$count"
|
||||
}
|
||||
|
||||
write_single_file_outputs() {
|
||||
# Aider
|
||||
mkdir -p "$OUT_DIR/aider"
|
||||
cp "$AIDER_TMP" "$OUT_DIR/aider/CONVENTIONS.md"
|
||||
|
||||
# Windsurf
|
||||
mkdir -p "$OUT_DIR/windsurf"
|
||||
cp "$WINDSURF_TMP" "$OUT_DIR/windsurf/.windsurfrules"
|
||||
}
|
||||
|
||||
# --- Entry point ---
|
||||
|
||||
main() {
|
||||
local tool="all"
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--tool) tool="${2:?'--tool requires a value'}"; shift 2 ;;
|
||||
--out) OUT_DIR="${2:?'--out requires a value'}"; shift 2 ;;
|
||||
--help|-h) usage ;;
|
||||
*) error "Unknown option: $1"; usage ;;
|
||||
esac
|
||||
done
|
||||
|
||||
local valid_tools=("antigravity" "gemini-cli" "opencode" "cursor" "aider" "windsurf" "all")
|
||||
local valid=false
|
||||
for t in "${valid_tools[@]}"; do [[ "$t" == "$tool" ]] && valid=true && break; done
|
||||
if ! $valid; then
|
||||
error "Unknown tool '$tool'. Valid: ${valid_tools[*]}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
header "The Agency -- Converting agents to tool-specific formats"
|
||||
echo " Repo: $REPO_ROOT"
|
||||
echo " Output: $OUT_DIR"
|
||||
echo " Tool: $tool"
|
||||
echo " Date: $TODAY"
|
||||
|
||||
local tools_to_run=()
|
||||
if [[ "$tool" == "all" ]]; then
|
||||
tools_to_run=("antigravity" "gemini-cli" "opencode" "cursor" "aider" "windsurf")
|
||||
else
|
||||
tools_to_run=("$tool")
|
||||
fi
|
||||
|
||||
local total=0
|
||||
for t in "${tools_to_run[@]}"; do
|
||||
header "Converting: $t"
|
||||
local count
|
||||
count="$(run_conversions "$t")"
|
||||
total=$(( total + count ))
|
||||
|
||||
# Gemini CLI also needs the extension manifest
|
||||
if [[ "$t" == "gemini-cli" ]]; then
|
||||
mkdir -p "$OUT_DIR/gemini-cli"
|
||||
cat > "$OUT_DIR/gemini-cli/gemini-extension.json" <<'HEREDOC'
|
||||
{
|
||||
"name": "agency-agents",
|
||||
"version": "1.0.0"
|
||||
}
|
||||
HEREDOC
|
||||
info "Wrote gemini-extension.json"
|
||||
fi
|
||||
|
||||
info "Converted $count agents for $t"
|
||||
done
|
||||
|
||||
# Write single-file outputs after accumulation
|
||||
if [[ "$tool" == "all" || "$tool" == "aider" || "$tool" == "windsurf" ]]; then
|
||||
write_single_file_outputs
|
||||
info "Wrote integrations/aider/CONVENTIONS.md"
|
||||
info "Wrote integrations/windsurf/.windsurfrules"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
info "Done. Total conversions: $total"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
465
scripts/install.sh
Executable file
465
scripts/install.sh
Executable file
@@ -0,0 +1,465 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# install.sh -- Install The Agency agents into your local agentic tool(s).
|
||||
#
|
||||
# Reads converted files from integrations/ and copies them to the appropriate
|
||||
# config directory for each tool. Run scripts/convert.sh first if integrations/
|
||||
# is missing or stale.
|
||||
#
|
||||
# Usage:
|
||||
# ./scripts/install.sh [--tool <name>] [--interactive] [--no-interactive] [--help]
|
||||
#
|
||||
# Tools:
|
||||
# claude-code -- Copy agents to ~/.claude/agents/
|
||||
# antigravity -- Copy skills to ~/.gemini/antigravity/skills/
|
||||
# gemini-cli -- Install extension to ~/.gemini/extensions/agency-agents/
|
||||
# opencode -- Copy agents to .opencode/agent/ in current directory
|
||||
# cursor -- Copy rules to .cursor/rules/ in current directory
|
||||
# aider -- Copy CONVENTIONS.md to current directory
|
||||
# windsurf -- Copy .windsurfrules to current directory
|
||||
# all -- Install for all detected tools (default)
|
||||
#
|
||||
# Flags:
|
||||
# --tool <name> Install only the specified tool
|
||||
# --interactive Show interactive selector (default when run in a terminal)
|
||||
# --no-interactive Skip interactive selector, install all detected tools
|
||||
# --help Show this help
|
||||
#
|
||||
# Platform support:
|
||||
# Linux, macOS (requires bash 3.2+), Windows Git Bash / WSL
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Colours -- only when stdout is a real terminal
|
||||
# ---------------------------------------------------------------------------
|
||||
if [[ -t 1 ]]; then
|
||||
C_GREEN=$'\033[0;32m'
|
||||
C_YELLOW=$'\033[1;33m'
|
||||
C_RED=$'\033[0;31m'
|
||||
C_CYAN=$'\033[0;36m'
|
||||
C_BOLD=$'\033[1m'
|
||||
C_DIM=$'\033[2m'
|
||||
C_RESET=$'\033[0m'
|
||||
else
|
||||
C_GREEN=''; C_YELLOW=''; C_RED=''; C_CYAN=''; C_BOLD=''; C_DIM=''; C_RESET=''
|
||||
fi
|
||||
|
||||
ok() { printf "${C_GREEN}[OK]${C_RESET} %s\n" "$*"; }
|
||||
warn() { printf "${C_YELLOW}[!!]${C_RESET} %s\n" "$*"; }
|
||||
err() { printf "${C_RED}[ERR]${C_RESET} %s\n" "$*" >&2; }
|
||||
header() { printf "\n${C_BOLD}%s${C_RESET}\n" "$*"; }
|
||||
dim() { printf "${C_DIM}%s${C_RESET}\n" "$*"; }
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Box drawing -- pure ASCII, fixed 52-char wide
|
||||
# box_top / box_mid / box_bot -- structural lines
|
||||
# box_row <text> -- content row, right-padded to fit
|
||||
# ---------------------------------------------------------------------------
|
||||
BOX_INNER=48 # chars between the two | walls
|
||||
|
||||
box_top() { printf " +"; printf '%0.s-' $(seq 1 $BOX_INNER); printf "+\n"; }
|
||||
box_bot() { box_top; }
|
||||
box_sep() { printf " |"; printf '%0.s-' $(seq 1 $BOX_INNER); printf "|\n"; }
|
||||
box_row() {
|
||||
# Strip ANSI escapes when measuring visible length
|
||||
local raw="$1"
|
||||
local visible
|
||||
visible="$(printf '%s' "$raw" | sed 's/\x1b\[[0-9;]*m//g')"
|
||||
local pad=$(( BOX_INNER - 2 - ${#visible} ))
|
||||
if (( pad < 0 )); then pad=0; fi
|
||||
printf " | %s%*s |\n" "$raw" "$pad" ''
|
||||
}
|
||||
box_blank() { printf " |%*s|\n" $BOX_INNER ''; }
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Paths
|
||||
# ---------------------------------------------------------------------------
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
INTEGRATIONS="$REPO_ROOT/integrations"
|
||||
|
||||
ALL_TOOLS=(claude-code antigravity gemini-cli opencode cursor aider windsurf)
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Usage
|
||||
# ---------------------------------------------------------------------------
|
||||
usage() {
|
||||
sed -n '3,28p' "$0" | sed 's/^# \{0,1\}//'
|
||||
exit 0
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Preflight
|
||||
# ---------------------------------------------------------------------------
|
||||
check_integrations() {
|
||||
if [[ ! -d "$INTEGRATIONS" ]]; then
|
||||
err "integrations/ not found. Run ./scripts/convert.sh first."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Tool detection
|
||||
# ---------------------------------------------------------------------------
|
||||
detect_claude_code() { [[ -d "${HOME}/.claude" ]]; }
|
||||
detect_antigravity() { [[ -d "${HOME}/.gemini/antigravity/skills" ]]; }
|
||||
detect_gemini_cli() { command -v gemini >/dev/null 2>&1 || [[ -d "${HOME}/.gemini" ]]; }
|
||||
detect_cursor() { command -v cursor >/dev/null 2>&1 || [[ -d "${HOME}/.cursor" ]]; }
|
||||
detect_opencode() { command -v opencode >/dev/null 2>&1 || [[ -d "${HOME}/.config/opencode" ]]; }
|
||||
detect_aider() { command -v aider >/dev/null 2>&1; }
|
||||
detect_windsurf() { command -v windsurf >/dev/null 2>&1 || [[ -d "${HOME}/.codeium" ]]; }
|
||||
|
||||
is_detected() {
|
||||
case "$1" in
|
||||
claude-code) detect_claude_code ;;
|
||||
antigravity) detect_antigravity ;;
|
||||
gemini-cli) detect_gemini_cli ;;
|
||||
opencode) detect_opencode ;;
|
||||
cursor) detect_cursor ;;
|
||||
aider) detect_aider ;;
|
||||
windsurf) detect_windsurf ;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Fixed-width labels: name (14) + detail (24) = 38 visible chars
|
||||
tool_label() {
|
||||
case "$1" in
|
||||
claude-code) printf "%-14s %s" "Claude Code" "(claude.ai/code)" ;;
|
||||
antigravity) printf "%-14s %s" "Antigravity" "(~/.gemini/antigravity)" ;;
|
||||
gemini-cli) printf "%-14s %s" "Gemini CLI" "(gemini extension)" ;;
|
||||
opencode) printf "%-14s %s" "OpenCode" "(opencode.ai)" ;;
|
||||
cursor) printf "%-14s %s" "Cursor" "(.cursor/rules)" ;;
|
||||
aider) printf "%-14s %s" "Aider" "(CONVENTIONS.md)" ;;
|
||||
windsurf) printf "%-14s %s" "Windsurf" "(.windsurfrules)" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Interactive selector
|
||||
# ---------------------------------------------------------------------------
|
||||
interactive_select() {
|
||||
# bash 3-compatible arrays
|
||||
declare -a selected=()
|
||||
declare -a detected_map=()
|
||||
|
||||
local t
|
||||
for t in "${ALL_TOOLS[@]}"; do
|
||||
if is_detected "$t" 2>/dev/null; then
|
||||
selected+=(1); detected_map+=(1)
|
||||
else
|
||||
selected+=(0); detected_map+=(0)
|
||||
fi
|
||||
done
|
||||
|
||||
while true; do
|
||||
# --- header ---
|
||||
printf "\n"
|
||||
box_top
|
||||
box_row "${C_BOLD} The Agency -- Tool Installer${C_RESET}"
|
||||
box_bot
|
||||
printf "\n"
|
||||
printf " ${C_DIM}System scan: [*] = detected on this machine${C_RESET}\n"
|
||||
printf "\n"
|
||||
|
||||
# --- tool rows ---
|
||||
local i=0
|
||||
for t in "${ALL_TOOLS[@]}"; do
|
||||
local num=$(( i + 1 ))
|
||||
local label
|
||||
label="$(tool_label "$t")"
|
||||
local dot
|
||||
if [[ "${detected_map[$i]}" == "1" ]]; then
|
||||
dot="${C_GREEN}[*]${C_RESET}"
|
||||
else
|
||||
dot="${C_DIM}[ ]${C_RESET}"
|
||||
fi
|
||||
local chk
|
||||
if [[ "${selected[$i]}" == "1" ]]; then
|
||||
chk="${C_GREEN}[x]${C_RESET}"
|
||||
else
|
||||
chk="${C_DIM}[ ]${C_RESET}"
|
||||
fi
|
||||
printf " %s %s) %s %s\n" "$chk" "$num" "$dot" "$label"
|
||||
(( i++ )) || true
|
||||
done
|
||||
|
||||
# --- controls ---
|
||||
printf "\n"
|
||||
printf " ------------------------------------------------\n"
|
||||
printf " ${C_CYAN}[1-7]${C_RESET} toggle ${C_CYAN}[a]${C_RESET} all ${C_CYAN}[n]${C_RESET} none ${C_CYAN}[d]${C_RESET} detected\n"
|
||||
printf " ${C_GREEN}[Enter]${C_RESET} install ${C_RED}[q]${C_RESET} quit\n"
|
||||
printf "\n"
|
||||
printf " >> "
|
||||
read -r input </dev/tty
|
||||
|
||||
case "$input" in
|
||||
q|Q)
|
||||
printf "\n"; ok "Aborted."; exit 0 ;;
|
||||
a|A)
|
||||
for (( j=0; j<${#ALL_TOOLS[@]}; j++ )); do selected[$j]=1; done ;;
|
||||
n|N)
|
||||
for (( j=0; j<${#ALL_TOOLS[@]}; j++ )); do selected[$j]=0; done ;;
|
||||
d|D)
|
||||
for (( j=0; j<${#ALL_TOOLS[@]}; j++ )); do selected[$j]="${detected_map[$j]}"; done ;;
|
||||
"")
|
||||
local any=false
|
||||
local s
|
||||
for s in "${selected[@]}"; do [[ "$s" == "1" ]] && any=true && break; done
|
||||
if $any; then
|
||||
break
|
||||
else
|
||||
printf " ${C_YELLOW}Nothing selected -- pick a tool or press q to quit.${C_RESET}\n"
|
||||
sleep 1
|
||||
fi ;;
|
||||
*)
|
||||
local toggled=false
|
||||
local num
|
||||
for num in $input; do
|
||||
if [[ "$num" =~ ^[0-9]+$ ]]; then
|
||||
local idx=$(( num - 1 ))
|
||||
if (( idx >= 0 && idx < ${#ALL_TOOLS[@]} )); then
|
||||
if [[ "${selected[$idx]}" == "1" ]]; then
|
||||
selected[$idx]=0
|
||||
else
|
||||
selected[$idx]=1
|
||||
fi
|
||||
toggled=true
|
||||
fi
|
||||
fi
|
||||
done
|
||||
if ! $toggled; then
|
||||
printf " ${C_RED}Invalid. Enter a number 1-%s, or a command.${C_RESET}\n" "${#ALL_TOOLS[@]}"
|
||||
sleep 1
|
||||
fi ;;
|
||||
esac
|
||||
|
||||
# Clear UI for redraw
|
||||
local lines=$(( ${#ALL_TOOLS[@]} + 14 ))
|
||||
local l
|
||||
for (( l=0; l<lines; l++ )); do printf '\033[1A\033[2K'; done
|
||||
done
|
||||
|
||||
# Build output array
|
||||
SELECTED_TOOLS=()
|
||||
local i=0
|
||||
for t in "${ALL_TOOLS[@]}"; do
|
||||
[[ "${selected[$i]}" == "1" ]] && SELECTED_TOOLS+=("$t")
|
||||
(( i++ )) || true
|
||||
done
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Installers
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
install_claude_code() {
|
||||
local dest="${HOME}/.claude/agents"
|
||||
local count=0
|
||||
mkdir -p "$dest"
|
||||
local dir f first_line
|
||||
for dir in design engineering marketing product project-management \
|
||||
testing support spatial-computing specialized; do
|
||||
[[ -d "$REPO_ROOT/$dir" ]] || continue
|
||||
while IFS= read -r -d '' f; do
|
||||
first_line="$(head -1 "$f")"
|
||||
[[ "$first_line" == "---" ]] || continue
|
||||
cp "$f" "$dest/"
|
||||
(( count++ )) || true
|
||||
done < <(find "$REPO_ROOT/$dir" -maxdepth 1 -name "*.md" -type f -print0)
|
||||
done
|
||||
ok "Claude Code: $count agents -> $dest"
|
||||
}
|
||||
|
||||
install_antigravity() {
|
||||
local src="$INTEGRATIONS/antigravity"
|
||||
local dest="${HOME}/.gemini/antigravity/skills"
|
||||
local count=0
|
||||
[[ -d "$src" ]] || { err "integrations/antigravity missing. Run convert.sh first."; return 1; }
|
||||
mkdir -p "$dest"
|
||||
local d
|
||||
while IFS= read -r -d '' d; do
|
||||
local name; name="$(basename "$d")"
|
||||
mkdir -p "$dest/$name"
|
||||
cp "$d/SKILL.md" "$dest/$name/SKILL.md"
|
||||
(( count++ )) || true
|
||||
done < <(find "$src" -mindepth 1 -maxdepth 1 -type d -print0)
|
||||
ok "Antigravity: $count skills -> $dest"
|
||||
}
|
||||
|
||||
install_gemini_cli() {
|
||||
local src="$INTEGRATIONS/gemini-cli"
|
||||
local dest="${HOME}/.gemini/extensions/agency-agents"
|
||||
local count=0
|
||||
[[ -d "$src" ]] || { err "integrations/gemini-cli missing. Run convert.sh first."; return 1; }
|
||||
mkdir -p "$dest/skills"
|
||||
cp "$src/gemini-extension.json" "$dest/gemini-extension.json"
|
||||
local d
|
||||
while IFS= read -r -d '' d; do
|
||||
local name; name="$(basename "$d")"
|
||||
mkdir -p "$dest/skills/$name"
|
||||
cp "$d/SKILL.md" "$dest/skills/$name/SKILL.md"
|
||||
(( count++ )) || true
|
||||
done < <(find "$src/skills" -mindepth 1 -maxdepth 1 -type d -print0)
|
||||
ok "Gemini CLI: $count skills -> $dest"
|
||||
}
|
||||
|
||||
install_opencode() {
|
||||
local src="$INTEGRATIONS/opencode/agent"
|
||||
local dest="${PWD}/.opencode/agent"
|
||||
local count=0
|
||||
[[ -d "$src" ]] || { err "integrations/opencode missing. Run convert.sh first."; return 1; }
|
||||
mkdir -p "$dest"
|
||||
local f
|
||||
while IFS= read -r -d '' f; do
|
||||
cp "$f" "$dest/"; (( count++ )) || true
|
||||
done < <(find "$src" -maxdepth 1 -name "*.md" -print0)
|
||||
ok "OpenCode: $count agents -> $dest"
|
||||
warn "OpenCode: project-scoped. Run from your project root to install there."
|
||||
}
|
||||
|
||||
install_cursor() {
|
||||
local src="$INTEGRATIONS/cursor/rules"
|
||||
local dest="${PWD}/.cursor/rules"
|
||||
local count=0
|
||||
[[ -d "$src" ]] || { err "integrations/cursor missing. Run convert.sh first."; return 1; }
|
||||
mkdir -p "$dest"
|
||||
local f
|
||||
while IFS= read -r -d '' f; do
|
||||
cp "$f" "$dest/"; (( count++ )) || true
|
||||
done < <(find "$src" -maxdepth 1 -name "*.mdc" -print0)
|
||||
ok "Cursor: $count rules -> $dest"
|
||||
warn "Cursor: project-scoped. Run from your project root to install there."
|
||||
}
|
||||
|
||||
install_aider() {
|
||||
local src="$INTEGRATIONS/aider/CONVENTIONS.md"
|
||||
local dest="${PWD}/CONVENTIONS.md"
|
||||
[[ -f "$src" ]] || { err "integrations/aider/CONVENTIONS.md missing. Run convert.sh first."; return 1; }
|
||||
if [[ -f "$dest" ]]; then
|
||||
warn "Aider: CONVENTIONS.md already exists at $dest (remove to reinstall)."
|
||||
return 0
|
||||
fi
|
||||
cp "$src" "$dest"
|
||||
ok "Aider: installed -> $dest"
|
||||
warn "Aider: project-scoped. Run from your project root to install there."
|
||||
}
|
||||
|
||||
install_windsurf() {
|
||||
local src="$INTEGRATIONS/windsurf/.windsurfrules"
|
||||
local dest="${PWD}/.windsurfrules"
|
||||
[[ -f "$src" ]] || { err "integrations/windsurf/.windsurfrules missing. Run convert.sh first."; return 1; }
|
||||
if [[ -f "$dest" ]]; then
|
||||
warn "Windsurf: .windsurfrules already exists at $dest (remove to reinstall)."
|
||||
return 0
|
||||
fi
|
||||
cp "$src" "$dest"
|
||||
ok "Windsurf: installed -> $dest"
|
||||
warn "Windsurf: project-scoped. Run from your project root to install there."
|
||||
}
|
||||
|
||||
install_tool() {
|
||||
case "$1" in
|
||||
claude-code) install_claude_code ;;
|
||||
antigravity) install_antigravity ;;
|
||||
gemini-cli) install_gemini_cli ;;
|
||||
opencode) install_opencode ;;
|
||||
cursor) install_cursor ;;
|
||||
aider) install_aider ;;
|
||||
windsurf) install_windsurf ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Entry point
|
||||
# ---------------------------------------------------------------------------
|
||||
main() {
|
||||
local tool="all"
|
||||
local interactive_mode="auto"
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--tool) tool="${2:?'--tool requires a value'}"; shift 2; interactive_mode="no" ;;
|
||||
--interactive) interactive_mode="yes"; shift ;;
|
||||
--no-interactive) interactive_mode="no"; shift ;;
|
||||
--help|-h) usage ;;
|
||||
*) err "Unknown option: $1"; usage ;;
|
||||
esac
|
||||
done
|
||||
|
||||
check_integrations
|
||||
|
||||
# Validate explicit tool
|
||||
if [[ "$tool" != "all" ]]; then
|
||||
local valid=false t
|
||||
for t in "${ALL_TOOLS[@]}"; do [[ "$t" == "$tool" ]] && valid=true && break; done
|
||||
if ! $valid; then
|
||||
err "Unknown tool '$tool'. Valid: ${ALL_TOOLS[*]}"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Decide whether to show interactive UI
|
||||
local use_interactive=false
|
||||
if [[ "$interactive_mode" == "yes" ]]; then
|
||||
use_interactive=true
|
||||
elif [[ "$interactive_mode" == "auto" && -t 0 && -t 1 && "$tool" == "all" ]]; then
|
||||
use_interactive=true
|
||||
fi
|
||||
|
||||
SELECTED_TOOLS=()
|
||||
|
||||
if $use_interactive; then
|
||||
interactive_select
|
||||
|
||||
elif [[ "$tool" != "all" ]]; then
|
||||
SELECTED_TOOLS=("$tool")
|
||||
|
||||
else
|
||||
# Non-interactive: auto-detect
|
||||
header "The Agency -- Scanning for installed tools..."
|
||||
printf "\n"
|
||||
local t
|
||||
for t in "${ALL_TOOLS[@]}"; do
|
||||
if is_detected "$t" 2>/dev/null; then
|
||||
SELECTED_TOOLS+=("$t")
|
||||
printf " ${C_GREEN}[*]${C_RESET} %s ${C_DIM}detected${C_RESET}\n" "$(tool_label "$t")"
|
||||
else
|
||||
printf " ${C_DIM}[ ] %s not found${C_RESET}\n" "$(tool_label "$t")"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [[ ${#SELECTED_TOOLS[@]} -eq 0 ]]; then
|
||||
warn "No tools selected or detected. Nothing to install."
|
||||
printf "\n"
|
||||
dim " Tip: use --tool <name> to force-install a specific tool."
|
||||
dim " Available: ${ALL_TOOLS[*]}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
printf "\n"
|
||||
header "The Agency -- Installing agents"
|
||||
printf " Repo: %s\n" "$REPO_ROOT"
|
||||
printf " Installing: %s\n" "${SELECTED_TOOLS[*]}"
|
||||
printf "\n"
|
||||
|
||||
local installed=0 t
|
||||
for t in "${SELECTED_TOOLS[@]}"; do
|
||||
install_tool "$t"
|
||||
(( installed++ )) || true
|
||||
done
|
||||
|
||||
# Done box
|
||||
local msg=" Done! Installed $installed tool(s)."
|
||||
printf "\n"
|
||||
box_top
|
||||
box_row "${C_GREEN}${C_BOLD}${msg}${C_RESET}"
|
||||
box_bot
|
||||
printf "\n"
|
||||
dim " Run ./scripts/convert.sh to regenerate after adding or editing agents."
|
||||
printf "\n"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
Reference in New Issue
Block a user