feat: Add automated dependency installation and tangling to installer
Some checks failed
Deploy-Agent-V15-Stdin / JOB-V15-STDIN (push) Failing after 2s

This commit is contained in:
2026-04-16 12:38:52 -04:00
parent 3dc8cc3934
commit d89c69f9f6

View File

@@ -4,28 +4,65 @@ RED='\033[0;31m'; GREEN='\033[0;32m'; BLUE='\033[0;34m'; NC='\033[0m'
echo -e "${BLUE}=== opencortex: Baremetal Power-User Setup ===${NC}"
if ! command -v sbcl >/dev/null 2>&1; then
echo -e "${RED}✗ SBCL not found. Please install it first.${NC}"
exit 1
# 1. Dependency Management
install_deps() {
if command -v apt-get >/dev/null; then
sudo apt-get update && sudo apt-get install -y sbcl emacs git curl socat
elif command -v pacman >/dev/null; then
sudo pacman -S --noconfirm sbcl emacs git curl socat
elif command -v dnf >/dev/null; then
sudo dnf install -y sbcl emacs git curl socat
elif command -v brew >/dev/null; then
brew install sbcl emacs git curl socat
else
echo -e "${RED}✗ Unknown package manager. Please install SBCL and Emacs manually.${NC}"
exit 1
fi
}
if ! command -v sbcl >/dev/null 2>&1 || ! command -v emacs >/dev/null 2>&1; then
echo -e "${YELLOW}! Missing dependencies (SBCL/Emacs).${NC}"
read -p "Should I attempt to install them for you? [Y/n]: " INSTALL_CHOICE
if [[ ! "$INSTALL_CHOICE" =~ ^[Nn]$ ]]; then
install_deps
else
echo -e "${RED}✗ Dependencies required. Exiting.${NC}"
exit 1
fi
fi
# 2. Quicklisp Installation
if [ ! -d "$HOME/quicklisp" ] && [ ! -d "$HOME/.quicklisp" ]; then
echo -e "${RED} Quicklisp not found. Please install Quicklisp.${NC}"
exit 1
echo -e "${YELLOW}! Quicklisp not found.${NC}"
read -p "Install Quicklisp now? [Y/n]: " QL_CHOICE
if [[ ! "$QL_CHOICE" =~ ^[Nn]$ ]]; then
curl -O https://beta.quicklisp.org/quicklisp.lisp
sbcl --non-interactive --load quicklisp.lisp \
--eval "(quicklisp-quickstart:install)" \
--eval "(ql-util:without-prompting (ql:add-to-init-file))"
rm quicklisp.lisp
echo -e "${GREEN}✓ Quicklisp installed.${NC}"
fi
fi
# 3. Literate Tangling
echo -e "${BLUE}Tangling Literate Org files into source code...${NC}"
emacs --batch --eval "(require 'org)" --eval "(mapc 'org-babel-tangle-file (file-expand-wildcards \"literate/*.org\"))"
echo -e "${GREEN}✓ Core tangled.${NC}"
# 4. Environment Configuration
if [ ! -f .env ]; then cp .env.example .env; fi
read -p "What is your name? (default: User): " USER_NAME
USER_NAME=${USER_NAME:-User}
sed -i "s/MEMEX_USER=.*/MEMEX_USER=\"$USER_NAME\"/g" .env
read -p "What shall we name your Assistant? (default: Agent): " AGENT_NAME
AGENT_NAME=${AGENT_NAME:-Agent}
read -p "What shall we name your Assistant? (default: OpenCortex): " AGENT_NAME
AGENT_NAME=${AGENT_NAME:-OpenCortex}
sed -i "s/MEMEX_ASSISTANT=.*/MEMEX_ASSISTANT=\"$AGENT_NAME\"/g" .env
echo "Select primary neural provider:"
echo "1) Gemini"; echo "2) OpenRouter"; echo "3) Anthropic"; echo "4) OpenAI"
echo -e "\nSelect primary neural provider:"
echo "1) Gemini (Free/Official)"; echo "2) OpenRouter"; echo "3) Anthropic"; echo "4) OpenAI"
read -p "Choice [1-4]: " LLM_CHOICE
case $LLM_CHOICE in
2) read -p "Enter OpenRouter Key: " INPUT; sed -i "s/OPENROUTER_API_KEY=.*/OPENROUTER_API_KEY=\"$INPUT\"/g" .env ;;
@@ -34,14 +71,17 @@ case $LLM_CHOICE in
*) read -p "Enter Gemini Key: " INPUT; sed -i "s/GEMINI_API_KEY=.*/GEMINI_API_KEY=\"$INPUT\"/g" .env ;;
esac
# Update baremetal paths based on current directory structure
# 5. Path Alignment
PROJECT_ROOT=$(pwd)
PARENT_DIR=$(dirname "$PROJECT_ROOT")
sed -i "s|MEMEX_DIR=.*|MEMEX_DIR=\"$PARENT_DIR\"|g" .env
sed -i "s|ZETTELKASTEN_DIR=.*|ZETTELKASTEN_DIR=\"$PARENT_DIR/notes\"|g" .env
sed -i "s|SKILLS_DIR=.*|SKILLS_DIR=\"$PARENT_DIR/notes\"|g" .env
sed -i "s|SKILLS_DIR=.*|SKILLS_DIR=\"$PROJECT_ROOT/skills\"|g" .env
mkdir -p "$PARENT_DIR/notes"
cp -n skills/*.org "$PARENT_DIR/notes/" 2>/dev/null || true
echo -e "${GREEN}✓ Configuration complete.${NC}"
echo -e "${GREEN}Baremetal setup complete. Run 'make run' to start.${NC}"
# 6. Final Instructions
echo -e "\n${BLUE}=== Setup Complete ===${NC}"
echo -e "To start the harness: ${YELLOW}./opencortex.sh${NC}"
echo -e "To run tests: ${YELLOW}sbcl --eval '(ql:quickload :opencortex)' --eval '(asdf:test-system :opencortex)'${NC}"