Skip to content

Unify install scripts: root delegates to src/scripts/install.sh (#534) - #537

Merged
joelteply merged 1 commit into
mainfrom
fix/unify-install-scripts
Mar 26, 2026
Merged

joelteply merged 1 commit into
mainfrom
fix/unify-install-scripts

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Root install.sh now delegates to the comprehensive src/scripts/install.sh instead of duplicating dep handling. One source of truth.

Two install scripts existed (#534). Root install.sh had incomplete
PostgreSQL/build-essential/Python handling. src/scripts/install.sh
had everything. Now root delegates to src/scripts/install.sh after
cloning, eliminating duplication. One source of truth for deps.

Closes #534. Contributes to #517.
Copilot AI review requested due to automatic review settings March 26, 2026 16:44
@joelteply
joelteply merged commit 5d894e1 into main Mar 26, 2026
@joelteply
joelteply deleted the fix/unify-install-scripts branch March 26, 2026 16:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the root install.sh (the curl | bash entrypoint) to delegate dependency installation to src/scripts/install.sh, aiming to consolidate install logic into a single comprehensive installer.

Changes:

  • Replaces the root script’s dependency installation step with a call to src/scripts/install.sh (with an npm-install fallback if missing).
  • Removes the root script’s inline Python/GPU dependency handling in favor of the delegated installer.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread install.sh
Comment on lines 214 to +217
cd src
npm install --no-audit --no-fund 2>&1 | tail -3
echo " ✅ Node dependencies installed"

# Python training dependencies (for Academy LoRA fine-tuning + plasticity compaction)
# Install torch first (needed for GPU detection), then training deps if GPU available
if command -v python3 &>/dev/null; then
PIP_FLAGS=""
# Python 3.12+ requires --break-system-packages for system pip
if python3 -c "import sys; exit(0 if sys.version_info >= (3,12) else 1)" 2>/dev/null; then
PIP_FLAGS="--break-system-packages"
fi

# Ensure torch is installed (needed for GPU detection and inference)
if ! python3 -c "import torch" 2>/dev/null; then
echo " 📦 Installing PyTorch..."
python3 -m pip install --quiet $PIP_FLAGS torch 2>&1 | tail -3
fi

HAS_GPU=false
if python3 -c "import torch; exit(0 if torch.cuda.is_available() else 1)" 2>/dev/null; then
HAS_GPU=true
fi

if [ "$HAS_GPU" = true ]; then
echo " 🧠 GPU detected — installing training + compaction dependencies..."
python3 -m pip install --quiet $PIP_FLAGS \
unsloth \
peft \
transformers \
bitsandbytes \
datasets \
trl \
tensorboard \
huggingface_hub \
safetensors \
2>&1 | tail -3
echo " ✅ Training dependencies installed (Unsloth + PEFT + LoRA + compaction)"
else
echo " ⚠️ No GPU detected — skipping training dependencies (inference still works)"
fi
if [ -f "scripts/install.sh" ]; then
bash scripts/install.sh
else

Copilot AI Mar 26, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running the comprehensive src/scripts/install.sh from the root installer changes the behavior of the public curl | bash entrypoint: it will now (via the delegated script) install Tailscale and modify local PostgreSQL auth (e.g., swapping scram-sha-256 to trust). If this is intended, the root installer should explicitly warn users; if not, consider adding opt-in/opt-out flags (env vars) and passing them here to avoid unexpected security-impacting changes during installation.

Copilot uses AI. Check for mistakes.
Comment thread install.sh
Comment on lines +209 to +216
# ─── Step 4: Full Install via comprehensive installer ────────────────
# src/scripts/install.sh handles ALL platform-specific dependencies:
# PostgreSQL, build-essential, CUDA, Python ML stack, Node deps, Rust build
echo "📋 Step 4: Running full installer"
echo "-----------------------------------"
cd src
npm install --no-audit --no-fund 2>&1 | tail -3
echo " ✅ Node dependencies installed"

# Python training dependencies (for Academy LoRA fine-tuning + plasticity compaction)
# Install torch first (needed for GPU detection), then training deps if GPU available
if command -v python3 &>/dev/null; then
PIP_FLAGS=""
# Python 3.12+ requires --break-system-packages for system pip
if python3 -c "import sys; exit(0 if sys.version_info >= (3,12) else 1)" 2>/dev/null; then
PIP_FLAGS="--break-system-packages"
fi

# Ensure torch is installed (needed for GPU detection and inference)
if ! python3 -c "import torch" 2>/dev/null; then
echo " 📦 Installing PyTorch..."
python3 -m pip install --quiet $PIP_FLAGS torch 2>&1 | tail -3
fi

HAS_GPU=false
if python3 -c "import torch; exit(0 if torch.cuda.is_available() else 1)" 2>/dev/null; then
HAS_GPU=true
fi

if [ "$HAS_GPU" = true ]; then
echo " 🧠 GPU detected — installing training + compaction dependencies..."
python3 -m pip install --quiet $PIP_FLAGS \
unsloth \
peft \
transformers \
bitsandbytes \
datasets \
trl \
tensorboard \
huggingface_hub \
safetensors \
2>&1 | tail -3
echo " ✅ Training dependencies installed (Unsloth + PEFT + LoRA + compaction)"
else
echo " ⚠️ No GPU detected — skipping training dependencies (inference still works)"
fi
if [ -f "scripts/install.sh" ]; then
bash scripts/install.sh

Copilot AI Mar 26, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This step claims the root installer is delegating dependency handling to the comprehensive installer, but the root script still installs Node/Rust/Postgres/build tools earlier and then calls the comprehensive installer that repeats those checks/installs. That undermines the “one source of truth” goal and can lead to redundant work and subtle divergence. Consider trimming the root installer to a minimal bootstrap (git/curl + clone) and then hand off to src/scripts/install.sh for the rest (or otherwise avoid overlapping responsibilities).

Copilot uses AI. Check for mistakes.
Comment thread install.sh
Comment on lines +218 to +220
# Fallback: basic npm install if comprehensive script not found
npm install --no-audit --no-fund 2>&1 | tail -3
echo " ✅ Node dependencies installed"

Copilot AI Mar 26, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the fallback path, npm install ... | tail -3 can mask a failing npm install because the script does not enable pipefail (only set -e). That can cause the installer to continue into npm start with incomplete dependencies. Consider enabling set -o pipefail for the script (or avoid piping the npm install output) so install failures reliably stop the installer.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants