-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_onchange_setup-opencode.sh.tmpl
More file actions
30 lines (24 loc) · 1.02 KB
/
run_onchange_setup-opencode.sh.tmpl
File metadata and controls
30 lines (24 loc) · 1.02 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
#!/usr/bin/env bash
set -euo pipefail
# =============================================================================
# Set up OpenCode configuration
# Installs plugin SDK dependencies
# chezmoi:template:hash {{ include "private_dot_config/private_opencode/package.json" | sha256sum }}
# =============================================================================
OC_CONFIG="$HOME/.config/opencode"
echo "[opencode] Setting up OpenCode..."
mkdir -p "$OC_CONFIG/plugins"
# --- Install plugin SDK dependencies ---
if [ -f "$OC_CONFIG/package.json" ]; then
if command -v bun &>/dev/null; then
echo " Installing plugin dependencies via bun..."
(cd "$OC_CONFIG" && bun install 2>&1 | sed 's/^/ /')
elif command -v npm &>/dev/null; then
echo " Installing plugin dependencies via npm..."
(cd "$OC_CONFIG" && npm install 2>&1 | sed 's/^/ /')
else
echo " WARNING: Neither bun nor npm found. Install Node.js or Bun to use OpenCode plugins."
fi
fi
echo " Done."
npx get-shit-done-cc@latest --opencode --global