Newer
Older
abysiuscodium / build / dev-setup.sh
#!/bin/bash
# Quick local development setup for AbysiusCodium extension

set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
EXT_DIR="${PROJECT_ROOT}/extensions/abysius-ai"

echo "[DEV] Setting up Abysius AI extension for local development..."

cd "$EXT_DIR"

# Install dependencies
if [[ ! -d "node_modules" ]]; then
    echo "[DEV] Installing npm dependencies..."
    npm ci
fi

# Compile TypeScript
echo "[DEV] Compiling TypeScript..."
npm run compile

# Symlink into VS Code/Codium extensions folder for live development
# Detect editor
if command -v codium &>/dev/null; then
    BIN="codium"
elif command -v code &>/dev/null; then
    BIN="code"
else
    echo "[DEV] WARNING: Neither 'codium' nor 'code' found in PATH."
    echo "[DEV] Install VS Code or VSCodium to test the extension."
    echo "[DEV] Extension built successfully at: ${EXT_DIR}/out/"
    exit 0
fi

# Get extensions dir
EXTS_DIR=$($BIN --locate-extension abysius.abysius-ai 2>/dev/null | head -1 || true)

if [[ -z "$EXTS_DIR" ]]; then
    # Use default path
    if [[ "$BIN" == "code" ]]; then
        EXTS_DIR="${HOME}/.vscode/extensions/abysius.abysius-ai-0.1.0"
    else
        EXTS_DIR="${HOME}/.vscode-oss/extensions/abysius.abysius-ai-0.1.0"
    fi
fi

# Remove old symlink
if [[ -L "$EXTS_DIR" ]]; then
    rm "$EXTS_DIR"
fi

# Create symlink
mkdir -p "$(dirname "$EXTS_DIR")"
ln -sf "$EXT_DIR" "$EXTS_DIR"

echo "[DEV] Extension symlinked to: $EXTS_DIR"
echo "[DEV] Launch ${BIN} and the Abysius AI extension will be available."
echo ""
echo "[DEV] Next steps:"
echo "  1. Run: ${BIN} --enable-proposed-api abysius.abysius-ai"
echo "  2. Or add to ${BIN} settings.json:"
echo "     'extensions.experimental.affinity': { 'abysius.abysius-ai': 1 }"
echo "  3. Run 'npm run watch' in ${EXT_DIR} for auto-recompile"