mirror of
https://github.com/harivansh-afk/nix.git
synced 2026-04-15 08:03:44 +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
|
||||
python3
|
||||
ripgrep
|
||||
rsync
|
||||
rustup
|
||||
tree
|
||||
uv
|
||||
|
|
|
|||
|
|
@ -3,6 +3,19 @@ set -euo pipefail
|
|||
|
||||
remote="${AGENT_HISTORY_REMOTE:-netty}"
|
||||
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")"
|
||||
|
||||
|
|
@ -23,7 +36,7 @@ sync_path() {
|
|||
fi
|
||||
|
||||
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/"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue