| name | rpi-setup |
| description | Install or upgrade the rpi binary into ~/.rpi/bin/rpi for the Claude Code plugin. Use when user says '/rpi:rpi-setup', 'install rpi', 'set up the rpi plugin binary', or after first installing the rpi plugin. |
RPI Setup
Goal
Install the rpi binary so the plugin's MCP server (~/.rpi/bin/rpi serve) and CLI subcommands work. Safely re-runnable — when the binary is already present, delegate to rpi upgrade. Refuse to proceed when a prior standalone install is detected and surface the remediation command.
The plugin writes the binary only to ~/.rpi/bin/rpi. It does not touch ~/.local/bin, shell rc files, PATH, or any other location.
Invariants
- Download binaries only from official GitHub Releases under
A-NGJ/rpi. No mirrors.
- Verify every download's SHA256 against the release's
checksums.txt asset. On mismatch: delete the temp dir and abort with a clear error naming the expected and observed checksums. Leave no partial files at ~/.rpi/bin/.
- The only filesystem mutation outside
~/.rpi/ is reading from network and writing to mktemp -d (which is cleaned up before return).
- Print what each step is about to do before executing.
- Never
sudo. Never write outside ~/.rpi/. Never modify the user's PATH.
- On any failure mid-flight: clean up the temp dir and exit non-zero with a clear message.
Steps
There are four invocations. Run them in order; stop the flow if any prints a remediation message and exits non-zero.
Execution preference, in order of decreasing preference:
- Bash tool — the natural choice. Step 3 is a single short pipe, so output is small and unlikely to trip any PreToolUse hook that restricts large-output Bash calls.
- A single sandboxed-shell call (if your environment provides one and it intercepts the Bash tool) — run step 3's whole pipe in one call so
install.sh's internal trap and $tmp survive. Never split the pipe across multiple calls.
- User runs it with
! prefix — only when neither of the above is available. Surface the exact one-liner from step 3 to the user, prefixed with !, and ask them to paste it into the Claude Code prompt.
1. Detect a prior standalone install
A standalone install — created by rpi init --global — leaves skills under ~/.claude/skills/rpi-* and registers an rpi MCP server in ~/.claude/settings.json outside the plugin. If detected, refuse and instruct the user to clean up first.
The MCP-server check uses jq if available (looks at .mcpServers.rpi specifically — a plain grep for "rpi" would false-positive on extraKnownMarketplaces.rpi). If jq is absent, falls back to a targeted grep -A5 scoped to the mcpServers block.
skills_conflict=0
mcp_conflict=0
skills_found="$(find "$HOME/.claude/skills" -maxdepth 1 -name 'rpi-*' -type d 2>/dev/null)"
if [ -n "$skills_found" ]; then
skills_conflict=1
fi
if ! command -v jq >/dev/null 2>&1; then
if [ -f "$HOME/.claude/settings.json" ] && grep -A5 '"mcpServers"' "$HOME/.claude/settings.json" 2>/dev/null | grep -q '"rpi"'; then
mcp_conflict=1
fi
else
if [ -f "$HOME/.claude/settings.json" ] && jq -e '.mcpServers.rpi // empty' "$HOME/.claude/settings.json" >/dev/null 2>&1; then
mcp_conflict=1
fi
fi
if [ "$skills_conflict" = 1 ]; then
echo "Standalone rpi skills found:"
echo "$skills_found" | sed 's/^/ /'
echo "This conflicts with the plugin install."
echo "To remove: run 'rpi uninstall --global' (or '~/.rpi/bin/rpi uninstall --global' if rpi is not in PATH)."
echo "Or manually: rm -rf ~/.claude/skills/rpi-*"
echo "Then re-run /rpi:rpi-setup."
fi
if [ "$mcp_conflict" = 1 ]; then
echo "An 'rpi' MCP server entry was found under mcpServers in ~/.claude/settings.json."
echo "This conflicts with the plugin's own MCP server."
echo "To remove: run 'rpi uninstall --global', or manually delete the 'rpi' key from"
echo "the mcpServers section of ~/.claude/settings.json."
echo "Then re-run /rpi:rpi-setup."
fi
if [ "$skills_conflict" = 1 ] || [ "$mcp_conflict" = 1 ]; then
exit 1
fi
2. Detect an existing plugin-mode install → delegate to rpi upgrade
If ~/.rpi/bin/rpi already exists and works, this is a re-run. Hand off to the binary's own upgrade flow.
if [ -x "$HOME/.rpi/bin/rpi" ] && "$HOME/.rpi/bin/rpi" version >/dev/null 2>&1; then
echo "Existing rpi binary found at ~/.rpi/bin/rpi; delegating to 'rpi upgrade'..."
"$HOME/.rpi/bin/rpi" upgrade
exit $?
fi
3. Install (delegate to the project's install.sh)
Before downloading, verify that curl is available. If not, exit with an actionable message:
if ! command -v curl >/dev/null 2>&1; then
echo "Required command not found: curl"
echo "Install it with: brew install jq curl # macOS"
echo " apt install jq curl # Debian/Ubuntu"
echo "Then re-run /rpi:rpi-setup."
exit 1
fi
The repo already ships an install.sh that handles platform detection, version resolution, download, SHA256 verification, temp-dir cleanup via trap, and installation. Honour its INSTALL_DIR env var to target the plugin's well-known location (~/.rpi/bin) instead of the standalone default. One pipe; the script does the rest.
INSTALL_DIR="$HOME/.rpi/bin" bash -c 'curl -sSfL https://raw.githubusercontent.com/A-NGJ/rpi/main/install.sh | bash'
Confirm it landed:
"$HOME/.rpi/bin/rpi" version
If either command exits non-zero, surface the message to the user verbatim — install.sh prints actionable errors (Checksum mismatch, No sha256sum or shasum found, Unsupported OS, etc.). Don't retry blindly.
4. Tell the user to restart Claude Code
After the install succeeds, surface this message in your reply (do not skip it):
Restart Claude Code (close and reopen this session) so the rpi MCP server can launch. It tried to start at the previous session start, but the binary wasn't installed yet — Claude Code has no live MCP reload, so a session restart is required. After restart, the RPI tools are available.
Behavioral guarantees
- After step 1 fires with
skills_conflict=1 or mcp_conflict=1, no further steps run — the binary is not downloaded.
- After step 2 succeeds (delegated upgrade), the script returns the binary's own upgrade exit code; no files under the plugin directory are modified.
- Step 3 delegates to
install.sh, which downloads to its own mktemp -d and registers an EXIT trap inside its own shell — every exit path (including SHA256 mismatch) cleans up the temp dir. The only file ever written outside $tmp is $HOME/.rpi/bin/rpi.
install.sh only downloads binaries from official A-NGJ/rpi GitHub Releases. The plugin never points elsewhere.
Recommended model: cheap tier, low effort — binary install/upgrade is mechanical. Advisory; see docs/model-routing.md.