Sc deploy remote

From squadcodercom/squadcoder · View interactive version

Sc deploy remote is an AI agent skill from the GitHub repository squadcodercom/squadcoder. Deploy / sync the current LOCAL workspace to its linked REMOTE host over SSH, and manage that remote (create dirs, run commands, restart services) — all from the local workspace. Use when the user asks to deploy, push to production, sync to the server/remote, ship, release, or "handle the remote". R

How to use this skill

Skill file

Deploy & manage the remote from the local workspace

This skill lets the agent develop locally and then deploy / manage a remote host over SSH

without leaving the local workspace. The workspace is linked to its remote via a small config file;

you push code and run remote commands through that link. No remote engine, no server switching.

1. Read (or create) the workspace ↔ remote link

The link lives at .squadcoder/remote.json in the workspace root:

{
  "host": "Relay",                      // an ~/.ssh/config alias (preferred) OR user@host
  "path": "/opt/squadcoder",            // the remote target directory
  "build": "npm run build",             // optional: local build to run before deploy (or null)
  "exclude": ["node_modules", ".git", ".env", ".env.*", "*.key", "*.pem", "id_*", "*.log", "dist/cache"],
  "postDeploy": "sudo systemctl restart squadcoder || true"  // optional: remote command after sync
}

remote path, then WRITE the file (with the secret-safe exclude defaults above) so the link

persists for next time. Confirm the values back before deploying.

2. Pre-flight (do these EVERY time, in order)

  1. Confirm the target out loud: "Deploying <workspace> → <host>:<path>. Proceed?" Wait for go on

the first deploy of a session.

  1. Verify SSH reachability (non-destructive): ssh <host> 'echo ok && whoami && uname -a'. If it

fails, stop and report — do not guess credentials.

  1. Create the remote dir if missing (idempotent, never deletes): ssh <host> 'mkdir -p "<path>"'.
  2. Local build if build is set: run it locally and stop on failure (never deploy a broken build).

3. Security gate (MANDATORY — this is the whole point of the exclude list)

Before any file leaves the machine:

credentials, .git). If you detect a secret-looking file that isn't excluded, STOP and warn.

if found, refuse and tell the user to move them to env/secret storage on the remote.

chmod 777, never deploy as root unless the user explicitly says so.

3b. Environment separation — local DEV config ≠ remote PROD config (critical)

The remote has its own production .env, database credentials, API keys, and service config that are

different from local dev. Treat them as sacred:

and .git local-only, so a normal /deploy leaves the remote's prod config intact.

migration: confirm the target, prefer a backup/dump first (pg_dump/mysqldump), and never run a

destructive migration without explicit confirmation naming the DB.

(ssh <host> 'cat <file>'), make a timestamped backup (cp <file> <file>.bak.$(date +%s)), apply the

minimal edit, and show the user the diff. Do NOT regenerate it from local.

(→ run on remote), DB (→ migrate on remote, backup first), or a config value (→ edit remote file).

4. Deploy (rsync — safe by default)

  1. DRY-RUN FIRST, always:

rsync -azP --dry-run --delete --exclude-from=<excludes> ./ <host>:"<path>/"

Show the user exactly what will be added / changed / DELETED.

  1. --delete is destructive — only include it after the user sees the dry-run and confirms (it

removes remote files not present locally). Default to NO --delete unless asked for a clean mirror.

  1. On confirmation, run the real rsync (drop --dry-run).
  2. Post-deploy command if postDeploy is set (e.g. restart the service). Then verify it's healthy

(ssh <host> 'systemctl is-active <svc>' or curl a health endpoint) and report.

5. Managing the remote (beyond deploy)

For "restart X / check logs / disk space / run migration on the remote", run the command over SSH

against the linked host (read-only first — ls, cat, journalctl, df -h — before anything that

changes state). Always echo the exact command and the host before a state-changing action, and never

run destructive commands (rm -rf, DROP, systemctl stop) without an explicit confirmation that

names the target.

Hard rules

remote command. Verify reachability before acting. Stop + report on any SSH/auth failure — never

retry blindly. Respond in the user's language (Hebrew or English).

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.