Files
CxIDE/scripts/build.sh
T
cx-git-agent c118996746 feat: CxIDE v1 — native macOS SwiftUI IDE with agentic AI assistant
- 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
2026-04-21 16:05:52 -05:00

80 lines
3.7 KiB
Bash
Executable File

#!/usr/bin/env bash
# ──────────────────────────────────────────────────────────────────
# CxIDE — Build Script
# Builds the CxIDE macOS app and optionally the CxSwiftAgent CLI.
# ──────────────────────────────────────────────────────────────────
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
AGENT_DIR="$ROOT_DIR/CxSwiftAgent"
BUILD_DIR="$ROOT_DIR/.build"
CONFIG="${1:-debug}" # debug | release
# ─── Colors ───────────────────────────────────────────────────────
RED='\033[0;31m'; GREEN='\033[0;32m'; CYAN='\033[0;36m'; BOLD='\033[1m'; RESET='\033[0m'
info() { printf "${CYAN}${RESET} %s\n" "$*"; }
ok() { printf "${GREEN}${RESET} %s\n" "$*"; }
fail() { printf "${RED}${RESET} %s\n" "$*" >&2; exit 1; }
# ─── Pre-flight checks ───────────────────────────────────────────
command -v swift >/dev/null 2>&1 || fail "swift not found — install Xcode or Swift toolchain"
command -v clang++ >/dev/null 2>&1 || fail "clang++ not found — install Xcode command-line tools"
SWIFT_VER="$(swift --version 2>&1 | head -1)"
info "Swift: $SWIFT_VER"
info "Config: $CONFIG"
info "Root: $ROOT_DIR"
# ─── Compile C++ Engine ──────────────────────────────────────────
info "Compiling C++ CodeEngine..."
mkdir -p "$BUILD_DIR"
CXXFLAGS="-std=c++17 -Wall -Wextra -Wpedantic"
if [[ "$CONFIG" == "release" ]]; then
CXXFLAGS="$CXXFLAGS -O2 -DNDEBUG"
else
CXXFLAGS="$CXXFLAGS -g -O0 -DDEBUG"
fi
clang++ $CXXFLAGS \
-c "$ROOT_DIR/Core/CodeEngine.cpp" \
-o "$BUILD_DIR/CodeEngine.o" \
2>&1 || fail "C++ compilation failed"
ok "CodeEngine.o compiled"
# ─── Compile ObjC++ Bridge ───────────────────────────────────────
info "Compiling ObjC++ bridge..."
clang++ $CXXFLAGS \
-fobjc-arc \
-c "$ROOT_DIR/Core/SwiftEngineWrapper.mm" \
-I "$ROOT_DIR/Core" \
-o "$BUILD_DIR/SwiftEngineWrapper.o" \
2>&1 || fail "ObjC++ bridge compilation failed"
ok "SwiftEngineWrapper.o compiled"
# ─── Create static library ───────────────────────────────────────
info "Creating static library..."
ar rcs "$BUILD_DIR/libCxEngine.a" \
"$BUILD_DIR/CodeEngine.o" \
"$BUILD_DIR/SwiftEngineWrapper.o"
ok "libCxEngine.a created"
# ─── Build CxSwiftAgent (SPM) ────────────────────────────────────
if [[ -d "$AGENT_DIR" ]]; then
info "Building CxSwiftAgent..."
(cd "$AGENT_DIR" && swift build -c "$CONFIG" 2>&1) || fail "CxSwiftAgent build failed"
ok "CxSwiftAgent built ($CONFIG)"
else
info "CxSwiftAgent directory not found — skipping agent CLI build"
fi
# ─── Summary ─────────────────────────────────────────────────────
echo ""
printf "${BOLD}Build artifacts:${RESET}\n"
ls -lh "$BUILD_DIR/libCxEngine.a" 2>/dev/null
if [[ -d "$AGENT_DIR" ]]; then
ls -lh "$AGENT_DIR/.build/$CONFIG/cx-swift-agent" 2>/dev/null || true
fi
echo ""
ok "Build complete ($CONFIG)"