#!/usr/bin/env bash # deploy-cli.sh — bundle the keep CLI into a single portable file and ship # it straight to a host over SSH. No git clone, no npm install on the # target — the bundle only touches Node builtins and libsodium-wrappers # (pure JS/WASM, no native compilation), so the file itself is the whole # artifact. Mirrors flit/deploy-daemon.sh's ssh-cat-chmod pattern. # # Usage: HOST=user@host ./deploy-cli.sh set -euo pipefail HOST="${HOST:?usage: HOST=user@host ./deploy-cli.sh}" BIN_DIR="${BIN_DIR:-~/bin}" echo "→ bundling keep CLI…" npm run build:cli-bundle echo "→ uploading to $HOST:$BIN_DIR/keep…" ssh "$HOST" "mkdir -p $BIN_DIR && cat > $BIN_DIR/keep && chmod +x $BIN_DIR/keep" < dist-bundle/keep echo "→ verifying…" ssh "$HOST" "$BIN_DIR/keep --help" | head -1 echo "✓ done — re-run this script any time the CLI changes; it's one file, safe to overwrite."