--- name: ship-status description: Show what's running on a ship VPS. Derives state from the server — no local state file. Use when you want to know what apps are deployed, what ports they use, and whether they're running. argument-hint: "[host-nickname]" --- # ship-status Show the current state of all deployments on a ship VPS by reading directly from the server. ## Read Config Load the host from `~/.config/ship/config.json`. Use the default host unless a nickname was specified: ```bash python3 -c " import json, os, sys cfg = json.load(open(os.path.expanduser('~/.config/ship/config.json'))) nick = sys.argv[1] if len(sys.argv) > 1 else cfg['default'] h = cfg['hosts'][nick] print(h['host']) print(h['domain']) " ``` ## Gather Server State Run all of these in a single SSH session to minimize round trips: **Systemd services (binary/docker apps):** ```bash ssh "systemctl list-units --type=service --state=active --no-pager --no-legend | grep -v '@' | awk '{print \$1}' | xargs -I{} sh -c 'name=\$(echo {} | sed s/.service//); port=\$(cat /etc/ship/ports/\$name 2>/dev/null); env=\$(cat /etc/ship/env/\$name.env 2>/dev/null | grep SHIP_URL | cut -d= -f2); echo \"\$name|\$port|\$env\"' 2>/dev/null | grep '|'" ``` **Static sites:** ```bash ssh "ls /var/www/ 2>/dev/null" ``` **Caddy configs (domains):** ```bash ssh "ls /etc/caddy/sites-enabled/ 2>/dev/null | grep -v '^$'" ``` **Caddy status:** ```bash ssh "systemctl is-active caddy" ``` **Disk usage for app data dirs:** ```bash ssh "du -sh /var/lib/*/ 2>/dev/null" ``` ## Present Results Format as a clean summary, for example: ``` HOST: prod (ubuntu@1.2.3.4) SERVICES foodtracker running :9013 https://foodtracker.example.com myapi running :9014 https://api.example.com STATIC SITES mysite https://mysite.example.com CADDY: running DATA /var/lib/foodtracker/ 48M /var/lib/myapi/ 2M ``` If a service appears in `/etc/ship/ports/` but is not active in systemd, flag it as **stopped**. If a Caddy config exists for a name but no service or static site matches, flag it as **orphaned config**. ## Notes - No local state file is consulted — everything comes from the server - If `~/.config/ship/config.json` doesn't exist, tell the user to run `/ship-setup` first - If a nickname is given that doesn't exist in config, list available nicknames - Use default host if no argument given