mirror of
https://github.com/harivansh-afk/nix.git
synced 2026-04-15 07:04:47 +00:00
sync-agent-history (#41)
This commit is contained in:
parent
320ae1332e
commit
22e76a1c95
2 changed files with 15 additions and 1 deletions
|
|
@ -22,6 +22,7 @@ in
|
||||||
nodejs_22
|
nodejs_22
|
||||||
python3
|
python3
|
||||||
ripgrep
|
ripgrep
|
||||||
|
rsync
|
||||||
rustup
|
rustup
|
||||||
tree
|
tree
|
||||||
uv
|
uv
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,19 @@ set -euo pipefail
|
||||||
|
|
||||||
remote="${AGENT_HISTORY_REMOTE:-netty}"
|
remote="${AGENT_HISTORY_REMOTE:-netty}"
|
||||||
remote_root="${AGENT_HISTORY_REMOTE_ROOT:-/home/rathi/.local/share/agent-history/raw/darwin}"
|
remote_root="${AGENT_HISTORY_REMOTE_ROOT:-/home/rathi/.local/share/agent-history/raw/darwin}"
|
||||||
|
local_rsync="$(command -v rsync || true)"
|
||||||
|
|
||||||
|
if [[ -z "$local_rsync" ]]; then
|
||||||
|
printf 'rsync is not available locally.\n' >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ssh "$remote" 'command -v rsync >/dev/null 2>&1'; then
|
||||||
|
remote_rsync='rsync'
|
||||||
|
else
|
||||||
|
remote_rsync='nix --extra-experimental-features nix-command --extra-experimental-features flakes shell nixpkgs#rsync -c rsync'
|
||||||
|
printf 'Remote rsync not found on %s - using a temporary nix shell fallback.\n' "$remote" >&2
|
||||||
|
fi
|
||||||
|
|
||||||
remote_root_q="$(printf '%q' "$remote_root")"
|
remote_root_q="$(printf '%q' "$remote_root")"
|
||||||
|
|
||||||
|
|
@ -23,7 +36,7 @@ sync_path() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf 'Syncing %s -> %s:%s\n' "$src" "$remote" "$dest"
|
printf 'Syncing %s -> %s:%s\n' "$src" "$remote" "$dest"
|
||||||
rsync -az "$src" "$remote:$dest"
|
"$local_rsync" -az --rsync-path="$remote_rsync" "$src" "$remote:$dest"
|
||||||
}
|
}
|
||||||
|
|
||||||
sync_path "$HOME/.claude/history.jsonl" "${remote_root}/claude/"
|
sync_path "$HOME/.claude/history.jsonl" "${remote_root}/claude/"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue