The cloud scripts
Three scripts live in /workspaces/<repo>/.dsh-cloud/ (a persistent volume, so they survive container rebuilds).
The real implementations are generated by install/cloud-setup.sh; this page is
the short reference.
start.sh — make sure dsh is running, start the sync daemon if needed, print the token URL:
#!/usr/bin/env bash
set -u
LOG="$HOME/dsh-web.log"; SYNC="/workspaces/<repo>/.dsh-cloud/sync.sh"
NODE_BIN="$HOME/.nvm/versions/node/v22.x.y/bin"
ensure_dsh() {
if [ -x "$NODE_BIN/dsh" ]; then export PATH="$NODE_BIN:$PATH"; return 0; fi
for d in "$HOME/.nvm/versions/node"/*/bin "$HOME/nvm/current/bin" /usr/local/share/nvm/versions/node/*/bin; do
if [ -x "$d/dsh" ]; then export PATH="$d:$PATH"; return 0; fi
done
npm install -g @deepseek-ai/dsh >>"$LOG.install" 2>&1 || true
command -v dsh >/dev/null 2>&1
}
ensure_dsh || { echo "STATE:NO_DSH"; exit 1; }
mkdir -p "$HOME/dsh-workspace"
if ! curl -s -o /dev/null -m 3 http://127.0.0.1:3080/; then
(setsid nohup bash -c "cd $HOME/dsh-workspace && exec dsh web" >"$LOG" 2>&1 </dev/null &)
sleep 20
fi
echo "STATE:$(curl -s -o /dev/null -w '%{http_code}' -m 3 http://127.0.0.1:3080/ || true)"
grep -a -o 'http://127.0.0.1:3080[^ ]*' "$LOG" | tail -n 1
update.sh — upgrade and restart:
#!/usr/bin/env bash
export PATH="$HOME/.nvm/versions/node/v22.x.y/bin:$PATH"
echo "BEFORE:$(dsh --version 2>/dev/null || echo unknown)"
npm install -g @deepseek-ai/dsh@latest >>"$HOME/dsh-update.log" 2>&1 || { echo UPDATE:FAILED; exit 1; }
echo "AFTER:$(dsh --version 2>/dev/null || echo unknown)"
PID=$(ss -ltnp 2>/dev/null | grep ':3080' | grep -o 'pid=[0-9]*' | head -1 | cut -d= -f2)
[ -n "$PID" ] && kill "$PID" && sleep 2
bash /workspaces/<repo>/.dsh-cloud/start.sh
sync.sh — idle-batched auto sync. Skeleton of the real thing:
# 1) fingerprint: tracked diff + size/mtime of untracked files
fp=$( { git status --porcelain -uall; git diff --binary; } | sha1sum )
# 2) any change resets the quiet timer
[ "$fp" != "$LAST_FP" ] && CHANGED_AT=$(date +%s)
# 3) once it has been quiet long enough (or max_wait passed), commit once
if [ $(( $(date +%s) - CHANGED_AT )) -ge "$idle_seconds" ]; then
git add -A
git commit -m "$(build_message)" # dsh: update projects/x (12 files)
git push origin HEAD # on rejection: pull --rebase and retry once
fi
mode=idle|interval|manual,idle_seconds,max_wait,squash_window_secondslive in.dsh-cloud/sync.conf- the commit subject is generated from the diff;
--message=or.dsh-cloud/commit-msgoverride it once - behavior details: auto-sync.md