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

PROJECT_DIR="${1:-$(pwd)}"
if [[ ! -d "$PROJECT_DIR" ]]; then
  echo "Repository path does not exist: $PROJECT_DIR" >&2
  exit 1
fi
cd "$PROJECT_DIR"
PROJECT_DIR="$(pwd)"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

"$SCRIPT_DIR/setup-codex.sh" --repo "$PROJECT_DIR"
"$SCRIPT_DIR/setup-claude.sh" --local --repo "$PROJECT_DIR"
"$SCRIPT_DIR/setup-cursor.sh" --project --repo "$PROJECT_DIR"
"$SCRIPT_DIR/setup-vscode.sh" --repo "$PROJECT_DIR"
"$SCRIPT_DIR/setup-windsurf.sh" "$PROJECT_DIR"
"$SCRIPT_DIR/setup-zed.sh" "$PROJECT_DIR"

echo "AiIndexer agent setup complete for Codex, Claude Code, Cursor, VS Code, Windsurf, and Zed at $PROJECT_DIR"
