c118996746
- SwiftUI macOS app with C++17 code analysis engine (ObjC++ bridge) - Agentic AI loop: LLM plans → tool calls → execution → feedback loop - 15 agent tools: file ops, terminal, git, xcode build, code intel - 7 persistent terminal tools with background session management - Chat sidebar with agent step rendering and auto-apply - NVIDIA NIM API integration (Llama 3.3 70B default) - OpenAI tool_calls format with prompt-based fallback - Code editor with syntax highlighting and multi-tab support - File tree, console view, terminal view - Git integration and workspace management
118 lines
4.5 KiB
Bash
Executable File
118 lines
4.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# ──────────────────────────────────────────────────────────────────
|
|
# CxIDE — Setup Script
|
|
# First-time project setup: installs hooks, validates toolchain.
|
|
# ──────────────────────────────────────────────────────────────────
|
|
set -euo pipefail
|
|
|
|
ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
|
|
|
RED='\033[0;31m'; GREEN='\033[0;32m'; CYAN='\033[0;36m'; YELLOW='\033[0;33m'; BOLD='\033[1m'; RESET='\033[0m'
|
|
info() { printf "${CYAN}▸${RESET} %s\n" "$*"; }
|
|
ok() { printf "${GREEN}✓${RESET} %s\n" "$*"; }
|
|
warn() { printf "${YELLOW}⚠${RESET} %s\n" "$*"; }
|
|
fail() { printf "${RED}✗${RESET} %s\n" "$*" >&2; exit 1; }
|
|
|
|
echo ""
|
|
printf "${BOLD}CxIDE — Project Setup${RESET}\n"
|
|
echo "────────────────────────────────────"
|
|
|
|
# ─── Check toolchain ─────────────────────────────────────────────
|
|
info "Checking toolchain..."
|
|
|
|
if command -v swift >/dev/null 2>&1; then
|
|
ok "Swift: $(swift --version 2>&1 | head -1)"
|
|
else
|
|
fail "Swift not found. Install Xcode or the Swift toolchain from swift.org"
|
|
fi
|
|
|
|
if command -v clang++ >/dev/null 2>&1; then
|
|
ok "Clang++: $(clang++ --version 2>&1 | head -1)"
|
|
else
|
|
fail "clang++ not found. Run: xcode-select --install"
|
|
fi
|
|
|
|
if command -v xcodebuild >/dev/null 2>&1; then
|
|
ok "Xcode: $(xcodebuild -version 2>&1 | head -1)"
|
|
else
|
|
warn "xcodebuild not found — Xcode tools won't work"
|
|
fi
|
|
|
|
if command -v git >/dev/null 2>&1; then
|
|
ok "Git: $(git --version)"
|
|
else
|
|
warn "Git not found — version control features disabled"
|
|
fi
|
|
|
|
# ─── Check macOS version ─────────────────────────────────────────
|
|
info "Checking platform..."
|
|
if [[ "$(uname)" == "Darwin" ]]; then
|
|
MACOS_VER="$(sw_vers -productVersion 2>/dev/null || echo 'unknown')"
|
|
ok "macOS $MACOS_VER"
|
|
else
|
|
warn "CxIDE targets macOS — some features may not work on $(uname)"
|
|
fi
|
|
|
|
# ─── Install git hooks ───────────────────────────────────────────
|
|
info "Installing git hooks..."
|
|
if [[ -d "$ROOT_DIR/.git" ]]; then
|
|
HOOKS_DIR="$ROOT_DIR/.git/hooks"
|
|
mkdir -p "$HOOKS_DIR"
|
|
|
|
for hook in "$ROOT_DIR/hooks/"*; do
|
|
[[ -f "$hook" ]] || continue
|
|
HOOK_NAME="$(basename "$hook")"
|
|
cp "$hook" "$HOOKS_DIR/$HOOK_NAME"
|
|
chmod +x "$HOOKS_DIR/$HOOK_NAME"
|
|
ok "Installed hook: $HOOK_NAME"
|
|
done
|
|
else
|
|
warn "No .git directory — skipping hook installation"
|
|
info "Run 'git init' first, then re-run this script to install hooks"
|
|
fi
|
|
|
|
# ─── Make scripts executable ─────────────────────────────────────
|
|
info "Setting permissions..."
|
|
chmod +x "$ROOT_DIR/scripts/"*.sh 2>/dev/null || true
|
|
chmod +x "$ROOT_DIR/hooks/"* 2>/dev/null || true
|
|
ok "Scripts and hooks are executable"
|
|
|
|
# ─── Verify project structure ─────────────────────────────────────
|
|
info "Verifying project structure..."
|
|
MISSING=0
|
|
for dir in Core Models Views ViewModels Services Agent Agent/Tools; do
|
|
if [[ -d "$ROOT_DIR/$dir" ]]; then
|
|
ok "$dir/"
|
|
else
|
|
warn "Missing: $dir/"
|
|
((MISSING++))
|
|
fi
|
|
done
|
|
|
|
if [[ "$MISSING" -gt 0 ]]; then
|
|
warn "$MISSING directories missing"
|
|
else
|
|
ok "All directories present"
|
|
fi
|
|
|
|
# ─── Build CxSwiftAgent if present ──────────────────────────────
|
|
if [[ -d "$ROOT_DIR/CxSwiftAgent" ]]; then
|
|
info "Building CxSwiftAgent (debug)..."
|
|
if (cd "$ROOT_DIR/CxSwiftAgent" && swift build 2>&1); then
|
|
ok "CxSwiftAgent built successfully"
|
|
else
|
|
warn "CxSwiftAgent build failed — agent CLI unavailable"
|
|
fi
|
|
fi
|
|
|
|
echo ""
|
|
printf "${BOLD}Setup complete.${RESET}\n"
|
|
echo ""
|
|
echo "Next steps:"
|
|
echo " ./scripts/build.sh Build the project"
|
|
echo " ./scripts/build.sh release Build for release"
|
|
echo " ./scripts/test.sh Run tests"
|
|
echo " ./scripts/lint.sh Run linter"
|
|
echo " ./scripts/clean.sh Clean build artifacts"
|
|
echo ""
|