Files
dotfiles/scripts/setup-capablemind.sh
David F GliddenandClaude Opus 4.6 066a47a26b Audit and optimize for CapableMind development
Brewfile: stripped to essential tools (~600MB freed), removed boost,
cmake, aerc, newsboat, fontforge, starship, and 24 auto-dependencies.
Added caffeine, ollama, fastfetch, ocrmypdf, tea, sshpass, vitetris.
Dropped 1password, iterm2, github-desktop, hazel, swiftbar, oversight.

Shell: fixed all stale references (fzf, zoxide, starship, old paths,
Homebrew node aliases). Updated project paths to ~/_Dev/. Added
CapableMind aliases (cm, bmf, bmf-health, bmf-status, bmf-logs).

Configs: removed iterm2, neofetch, swiftbar configs. Added capablemind
(launchd plists, MCP example, bmf-start script). Updated SSH config
with git.skemantix.com. Added CLAUDE.md to dotfiles.

Scripts: consolidated 3 backup scripts into 1 (backup-all-secrets.sh),
added pass store backup. Added setup-capablemind.sh for full environment
reconstruction. Updated symlinks.sh for new config structure.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 23:45:33 +01:00

174 lines
5.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# CapableMind development environment setup
# Run after engage (Brewfile) has installed base packages
#
# Prerequisites: Homebrew, Ollama, GPG, pass
# This script sets up: nvm/Node, Ollama models, BMF, launchd agents
set -euo pipefail
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m'
echo -e "${YELLOW}Setting up CapableMind development environment${NC}"
echo ""
# ============================================
# 1. NVM + Node.js
# ============================================
echo -e "${YELLOW}1. Node.js via nvm${NC}"
if [ -d "$HOME/.nvm" ]; then
echo -e "${GREEN} ✓ nvm already installed${NC}"
else
echo " Installing nvm..."
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash
fi
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && source "$NVM_DIR/nvm.sh"
if command -v node >/dev/null && [[ "$(node -v)" == v22.* ]]; then
echo -e "${GREEN} ✓ Node $(node -v) installed${NC}"
else
echo " Installing Node 22 LTS..."
nvm install 22
nvm alias default 22
fi
# ============================================
# 2. Ollama models
# ============================================
echo ""
echo -e "${YELLOW}2. Ollama models${NC}"
if ! command -v ollama >/dev/null; then
echo -e "${RED} ✗ Ollama not installed. Install via: brew install ollama${NC}"
else
# Required models for CapableMind
MODELS=("mxbai-embed-large" "qwen3.5:4b")
for model in "${MODELS[@]}"; do
if ollama list 2>/dev/null | grep -q "$model"; then
echo -e "${GREEN} ✓ $model already pulled${NC}"
else
echo " Pulling $model..."
ollama pull "$model"
fi
done
echo -e "${YELLOW} Note: cm-david trained models must be imported separately from clasp${NC}"
fi
# ============================================
# 3. Clone repositories
# ============================================
echo ""
echo -e "${YELLOW}3. Repositories${NC}"
DEV_DIR="$HOME/_Dev"
mkdir -p "$DEV_DIR"
declare -A REPOS=(
["BetterMemories.io"]="git@github.com:skemantix/BetterMemories.io.git"
["CapableMind-AI"]="git@github.com:skemantix/CapableMind.ai.git"
["chamber-library"]="git@github.com:skemantix/chamber-library.git"
["animal-davidglidden-eu"]="git@github.com:davidglidden/animal-davidglidden-eu.git"
)
for dir in "${!REPOS[@]}"; do
if [ -d "$DEV_DIR/$dir" ]; then
echo -e "${GREEN} ✓ $dir already cloned${NC}"
else
echo " Cloning $dir..."
git clone "${REPOS[$dir]}" "$DEV_DIR/$dir"
fi
done
# ============================================
# 4. BMF build
# ============================================
echo ""
echo -e "${YELLOW}4. Building BetterMemories (BMF)${NC}"
BMF_DIR="$DEV_DIR/BetterMemories.io"
if [ -d "$BMF_DIR" ]; then
cd "$BMF_DIR"
npm install
npm run build
echo -e "${GREEN} ✓ BMF built${NC}"
else
echo -e "${RED} ✗ BMF directory not found${NC}"
fi
# ============================================
# 5. Environment file
# ============================================
echo ""
echo -e "${YELLOW}5. CapableMind environment${NC}"
CM_DIR="$HOME/.capablemind"
mkdir -p "$CM_DIR"
if [ -f "$CM_DIR/env" ]; then
echo -e "${GREEN} ✓ env file exists${NC}"
else
cat > "$CM_DIR/env" << 'ENVEOF'
# CapableMind environment — add your API key
# ANTHROPIC_API_KEY=sk-ant-...
ENVEOF
echo -e "${YELLOW} ⚠ Created $CM_DIR/env — add your ANTHROPIC_API_KEY${NC}"
fi
# ============================================
# 6. Launchd agents
# ============================================
echo ""
echo -e "${YELLOW}6. Launchd agents${NC}"
AGENTS_DIR="$HOME/Library/LaunchAgents"
DOTFILES_CM="$HOME/dotfiles/config/capablemind"
if [ -d "$DOTFILES_CM" ]; then
for plist in "$DOTFILES_CM"/*.plist; do
name=$(basename "$plist")
if [ -f "$AGENTS_DIR/$name" ]; then
echo -e "${GREEN} ✓ $name already installed${NC}"
else
cp "$plist" "$AGENTS_DIR/"
echo -e "${GREEN} ✓ Installed $name${NC}"
echo -e "${YELLOW} Note: Edit paths in $AGENTS_DIR/$name before loading${NC}"
fi
done
else
echo -e "${YELLOW} ⚠ No capablemind config dir in dotfiles${NC}"
fi
# ============================================
# 7. Obsidian vault git mirror
# ============================================
echo ""
echo -e "${YELLOW}7. Obsidian vault sync${NC}"
VAULT_GIT="$DEV_DIR/david-root-and-branch-vault-git"
if [ -d "$VAULT_GIT" ]; then
echo -e "${GREEN} ✓ Vault git mirror exists${NC}"
else
echo -e "${YELLOW} ⚠ Vault git mirror not set up. Run ~/bin/obsidian_vault_sync.sh manually${NC}"
fi
# ============================================
# Summary
# ============================================
echo ""
echo -e "${GREEN}Setup complete.${NC}"
echo ""
echo -e "${YELLOW}Remaining manual steps:${NC}"
echo " 1. Add ANTHROPIC_API_KEY to ~/.capablemind/env"
echo " 2. Edit launchd plist paths if needed, then: launchctl load ~/Library/LaunchAgents/com.capablemind.*.plist"
echo " 3. Import trained cm-david models from clasp (if available)"
echo " 4. Run: cd ~/_Dev/BetterMemories.io && node dist/index.js (to start BMF)"
echo " 5. Reconnect MCP in Claude Code: /mcp"