cfn-vps
Purpose
Drive a remote Linux server from the local session: one-shot commands in a project folder, a safe git pull, and background jobs that keep running when the connection drops.
Setup (once per machine)
- An ssh alias for the server in
~/.ssh/config(default namevps) with key login.ssh vpsmust work without a password prompt. - Projects on the server live in
~/Projects/<name>(override withCFN_VPS_PROJECTS). - Different alias: set
CFN_VPS_HOST. - If you are ALREADY on the server (hostname is the server's, or
~/Projectsis local and there is novpsalias), do not use this skill; run commands directly.
Usage
VPS="$HOME/.claude/skills/cfn-vps/vps.sh"
"$VPS" check # reachable? OS, load
"$VPS" sync legion-engine # git pull --ff-only on the server
"$VPS" run legion-engine -- cargo test -p sim_core
"$VPS" job legion-engine build -- cargo build --release
"$VPS" status build # running | done, exit N
"$VPS" log build 100 # last 100 lines
"$VPS" jobs # every job and its state
Exit codes
0success,2bad usage or invalid name,3no such project/job,4server copy has uncommitted changes (sync refused),5a job with that name is still running.runreturns the remote command's own exit code.
Workflow: build here, build there
- Commit and push locally (the server pulls from GitHub; it never receives local files).
sync <project>. Exit 4 means someone edited the server copy: report the listed files to the user, do not discard them.- Short commands (under ~2 minutes):
run. Anything longer:job, then pollstatusand readlog. Jobs survive ssh drops and laptop sleep; they do not survive a server reboot (status sayslost).
Rules
- Sandbox: the local Bash sandbox blocks ssh (port 22 and
~/.ssh). Runvps.shwith the sandbox disabled; each call is its own approval. - Secrets: never print
.envfiles or tokens throughrun. Check for a variable withgrep -c '^NAME=' .env, notcat. - Never write the server's address, tailnet name, usernames or keys into any repo file, commit, log you share, or this skill. Refer to the server only by its alias.
- Destructive commands (
rm -rf,git reset --hard, dropping data) follow the same approval rules as local ones. The server's own guard hooks do not see commands sent through ssh. - Login-sensitive changes (ssh config, firewall, user accounts, reboot) need the user's explicit OK first: a mistake can lock everyone out.
Dependencies
- Local: bash 4+, ssh. Remote: bash, git; nvm/cargo/
~/.local/binare loaded automatically when present.
Tests
tests/test-cfn-vps.sh (ssh stubbed; includes a scan that fails if any IP, tailnet name, key or password appears in this folder).