From d0ae31c24c3c98ae89eebd67227c0c0d01606ed5 Mon Sep 17 00:00:00 2001 From: Clawd Date: Sat, 11 Apr 2026 20:43:41 -0700 Subject: Add ship-* Claude skills and plan Introduces a skills/ directory with 8 Claude skills that reimagine ship as a set of composable, human-driven deployment tools backed by Claude's reasoning rather than a rigid CLI. Skills: - ship-setup: one-time VPS config, saves host to ~/.config/ship/config.json - ship-status: derives live state from server, no local state file - ship-env: read/write env vars with merge semantics, never overwrites - ship-binary: deploy Go binaries with SQLite backup, correct restart behavior - ship-caddy: manage per-app Caddyfile with validate-before-reload - ship-service: systemd management and log inspection - ship-static: rsync static sites with SPA routing support - ship-deploy: orchestration runbook tying the others together Also adds SKILLS_PLAN.md documenting the architecture and rationale. Co-Authored-By: Claude Sonnet 4.6 --- skills/ship-static/SKILL.md | 121 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 skills/ship-static/SKILL.md (limited to 'skills/ship-static') diff --git a/skills/ship-static/SKILL.md b/skills/ship-static/SKILL.md new file mode 100644 index 0000000..1ef74d3 --- /dev/null +++ b/skills/ship-static/SKILL.md @@ -0,0 +1,121 @@ +--- +name: ship-static +description: Deploy a static site to a ship VPS. Rsyncs a local dist folder to the server and configures Caddy to serve it. Use when deploying a built frontend, docs site, or any folder of static files. +argument-hint: " [host-nickname]" +--- + +# ship-static + +Deploy a static site by rsyncing a local directory to the server and configuring Caddy. + +## Read Config + +```bash +python3 -c " +import json, os +cfg = json.load(open(os.path.expanduser('~/.config/ship/config.json'))) +nick = '' +h = cfg['hosts'].get(nick, cfg['hosts'][cfg['default']]) +print(h['host']) +print(h['domain']) +" +``` + +## Inputs + +- **Dist path** — local directory containing the built static files (e.g. `./dist`, `./out`) +- **App name** — short lowercase name, becomes the subdomain (e.g. `mysite`) +- **Domain** — defaults to `.`, ask if different +- **Host** — use default unless specified + +## Steps + +### 1. Validate local path + +Check that the dist directory exists and contains an `index.html`: + +```bash +ls /index.html +``` + +If not found, tell the user — they may need to build first. + +### 2. Create remote directory + +```bash +ssh "sudo mkdir -p /var/www/ && sudo chown $USER:$USER /var/www/" +``` + +### 3. Sync files + +```bash +rsync -avz --delete / :/var/www// +``` + +The `--delete` flag removes files on the server that no longer exist locally, keeping +the deployment clean. Tell the user how many files were transferred. + +### 4. Fix ownership + +After rsync, ensure Caddy can read the files: + +```bash +ssh "sudo chown -R www-data:www-data /var/www/" +``` + +### 5. Write Caddy config + +Check if a config already exists: + +```bash +ssh "cat /etc/caddy/sites-enabled/.caddy 2>/dev/null" +``` + +Write (or overwrite) the config: + +```bash +ssh "sudo tee /etc/caddy/sites-enabled/.caddy > /dev/null << 'EOF' + { + root * /var/www/ + file_server + encode gzip +} +EOF" +``` + +### 6. Validate and reload Caddy + +```bash +ssh "sudo caddy validate --config /etc/caddy/Caddyfile 2>&1" +``` + +If valid: +```bash +ssh "sudo systemctl reload caddy" +``` + +If invalid, show the error and do not reload. + +### 7. Confirm + +Tell the user: +- URL the site is live at +- Number of files synced +- Whether this was a new deployment or an update + +## Notes + +- Build before deploying — this skill does not run build commands +- `--delete` in rsync means files removed locally will be removed from the server too +- If the user wants a custom domain, use ship-caddy to update the config after deploying +- For SPAs with client-side routing, the Caddy config may need a `try_files` directive: + ``` + { + root * /var/www/ + try_files {path} /index.html + file_server + encode gzip + } + ``` + Ask the user if their site uses client-side routing. +- Use default host unless another is specified -- cgit v1.2.3