Commit c338d99f5a64

Vincent Demeester <vincent@sbr.pm>
2026-02-13 16:17:24
fix(dots): handle existing sessions dir before symlinking
When ~/.pi/agent/sessions existed as a real directory, ln -snf created the symlink inside it instead of replacing it. Now moves contents to ai-sync target and removes the directory before creating the symlink.
1 parent df1fa3f
Changed files (1)
dots/Makefile
@@ -103,6 +103,11 @@ ai-config : ~/.config/ai/skills ~/.config/ai/path-policies.json
 ~/.pi/agent/sessions : force
 	@echo "🔗 Linking ~/.local/share/ai-sync/pi-sessions -> ~/.pi/agent/sessions"
 	@mkdir -p ~/.pi/agent ~/.local/share/ai-sync/pi-sessions
+	@if [ -d ~/.pi/agent/sessions ] && [ ! -L ~/.pi/agent/sessions ]; then \
+		echo "  ⚠️  Moving existing sessions directory contents to ai-sync"; \
+		cp -a ~/.pi/agent/sessions/. ~/.local/share/ai-sync/pi-sessions/ 2>/dev/null || true; \
+		rm -rf ~/.pi/agent/sessions; \
+	fi
 	@ln -snf ~/.local/share/ai-sync/pi-sessions ~/.pi/agent/sessions
 
 # Unified AI agent config - symlink skills to claude skills (shared)