Files
skillshare/.devcontainer/ensure-agent-clis.sh
T
Willie 7f8a2dd083 chore(devcontainer): install the claude, codex and pi CLIs
Plugin installs could only be checked against real Agents on the host.
The CLIs are installed on the dev-home volume so image rebuilds keep
them, and relinked into /usr/local/bin on every start so non-login
docker exec finds them. A failed install warns without blocking start.
2026-09-21 15:50:30 +08:00

26 lines
936 B
Bash
Executable File

#!/usr/bin/env bash
# Ensure the Agent CLIs that plugin work drives (claude, codex, pi) exist in the
# devcontainer, so installs can be verified against the real clients.
# Packages live on the dev-home volume and survive image rebuilds; only the
# /usr/local/bin links are container-local, so they are re-made every start.
set -euo pipefail
PREFIX="$HOME/.local/agent-clis"
# bin → npm package
declare -A PACKAGES=(
[claude]="@anthropic-ai/claude-code"
[codex]="@openai/codex"
[pi]="@mariozechner/pi-coding-agent"
)
for bin in "${!PACKAGES[@]}"; do
if [ ! -x "$PREFIX/bin/$bin" ]; then
echo "▸ Installing $bin (${PACKAGES[$bin]}) …"
if ! npm install -g --prefix "$PREFIX" --no-fund --no-audit "${PACKAGES[$bin]}" >/dev/null 2>&1; then
echo "⚠ Could not install $bin; plugin checks against it will report it missing." >&2
continue
fi
fi
ln -sf "$PREFIX/bin/$bin" "/usr/local/bin/$bin"
done