-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstartup.sh.example
More file actions
executable file
·41 lines (35 loc) · 1.88 KB
/
Copy pathstartup.sh.example
File metadata and controls
executable file
·41 lines (35 loc) · 1.88 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
#!/usr/bin/env bash
# Sample startup.sh — drop a copy into your Codio workspace root (renamed to
# startup.sh) so opencode + the codio-authoring plugin are installed on
# container boot.
#
# The plugin is published to npm as `@codio-ai/opencode-authoring-agent`. Installing
# it via `npm install -g` runs a postinstall script that registers the plugin
# wrapper and copies skills into ~/.config/opencode/. No build step required.
set -euo pipefail
PLUGIN_PACKAGE="@codio-ai/opencode-authoring-agent"
PLUGIN_VERSION="${CODIO_PLUGIN_VERSION:-latest}"
# ── opencode ────────────────────────────────────────────────────────────────
if ! command -v opencode >/dev/null 2>&1; then
echo "[startup] installing opencode..."
curl -fsSL https://opencode.ai/install | bash
fi
# ── node / npm ──────────────────────────────────────────────────────────────
# Source nvm if it's already installed but not on PATH.
if [ -s "$HOME/.nvm/nvm.sh" ]; then
# shellcheck disable=SC1091
\. "$HOME/.nvm/nvm.sh"
fi
if ! command -v npm >/dev/null 2>&1; then
echo "[startup] installing nvm + node (npm missing)..."
curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
export NVM_DIR="$HOME/.nvm"
# shellcheck disable=SC1091
\. "$NVM_DIR/nvm.sh"
nvm install --lts
nvm use --lts
fi
# ── plugin ──────────────────────────────────────────────────────────────────
echo "[startup] installing $PLUGIN_PACKAGE@$PLUGIN_VERSION..."
npm install -g "$PLUGIN_PACKAGE@$PLUGIN_VERSION"
echo "[startup] done."