-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathai_cli_host_db.sh
More file actions
executable file
·50 lines (39 loc) · 1.21 KB
/
ai_cli_host_db.sh
File metadata and controls
executable file
·50 lines (39 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env bash
# ai_bundle_installer.sh
# Installer for AI CLI host (Python + Node + SQLite3 + JSON bridge)
set -euo pipefail
IFS=$'\n\t'
# === CONFIG ===
BASE_DIR="$HOME/_/ai"
ENV_DIR="$BASE_DIR/.env.local"
TMP_DIR="$BASE_DIR/tmp"
DB_DIR="$BASE_DIR/db"
echo "[Installer] Starting AI bundle installation..."
# --- Create directories ---
mkdir -p "$TMP_DIR" "$DB_DIR"
# --- Setup Python virtual environment ---
if [ ! -d "$ENV_DIR" ]; then
echo "[Installer] Creating Python virtual environment..."
python3 -m venv "$ENV_DIR"
fi
# --- Activate environment ---
source "$ENV_DIR/bin/activate"
# --- Install Python dependencies ---
echo "[Installer] Installing Python dependencies..."
pip install --upgrade pip
pip install aiohttp
# Note: sqlite3 is built-in in Python, no need to install
# --- Install Node.js dependencies ---
echo "[Installer] Installing Node.js dependencies..."
cd "$BASE_DIR"
# Ensure package.json exists
if [ ! -f package.json ]; then
npm init -y
fi
# Install common CLI dependencies
npm install chalk
echo "[Installer] Installation complete."
echo "Activate environment with:"
echo " source $ENV_DIR/bin/activate"
echo "Run AI cockpit using:"
echo " $BASE_DIR/ai_cli_host_db.sh '<your prompt>'"