This commit is contained in:
Jaroslaw Konik 2026-05-24 17:52:24 +02:00
parent 2602f34a2b
commit 6d70d54f44
2 changed files with 36 additions and 0 deletions

1
agent
View file

@ -48,6 +48,7 @@ case "$app" in
-v "$HOME/.config/opencode:$HOME/.config/opencode"
-v "$HOME/.local/share/opencode:$HOME/.local/share/opencode"
-v "$HOME/.local/state/opencode:$HOME/.local/state/opencode"
-v "$HOME/.cache:$HOME/.cache"
-v "$HOME/.claude:$HOME/.claude" # allow access to claude config for hacked auth
)
;;

35
copy.sh Normal file
View file

@ -0,0 +1,35 @@
#!/usr/bin/env bash
# usage: smart-cp SRC DST
set -euo pipefail
src=$1
dst=$2
find "$src" -type f -print0 | while IFS= read -r -d '' f; do
rel=${f#"$src"/}
target=$dst/$rel
mkdir -p "$(dirname "$target")"
if [[ ! -e $target ]]; then
cp -p "$f" "$target"
continue
fi
src_size=$(stat -c%s "$f")
dst_size=$(stat -c%s "$target")
if (( src_size == dst_size )); then
continue # same size — leave it alone
fi
printf '%s differs (src=%d, dst=%d) — [o]verwrite/[s]kip/[d]iff/[q]uit? ' \
"$rel" "$src_size" "$dst_size" >&2
read -r choice </dev/tty
case $choice in
o|O) cp -p "$f" "$target" ;;
s|S) ;;
d|D) diff "$target" "$f" || true; exec "$0" "$src" "$dst" ;; # crude: restart
q|Q) exit 0 ;;
*) echo "skipping" >&2 ;;
esac
done