#!/usr/bin/env python3 from pathlib import Path import shutil REPO_DIR = Path.home() / "jbashrc" BACKUP_DIR = Path.home() / ".orig-config" def install(src, dst): src_path = REPO_DIR / src dst_path = Path(dst).expanduser() backup_path = BACKUP_DIR / src if not backup_path.exists() and dst_path.exists() and not dst_path.is_symlink(): backup_path.parent.mkdir(parents=True, exist_ok=True) if dst_path.is_dir(): shutil.copytree(dst_path, backup_path) else: shutil.copy2(dst_path, backup_path) print(f"Backed up {dst_path}") dst_path.parent.mkdir(parents=True, exist_ok=True) if dst_path.is_dir() and not dst_path.is_symlink(): shutil.rmtree(dst_path) elif dst_path.exists() or dst_path.is_symlink(): dst_path.unlink() dst_path.symlink_to(src_path) print(f"Linked {dst_path} -> {src_path}") install("bash/dot-bashrc", "~/.bashrc") install("bash/dot-profile", "~/.profile") install("claude/CLAUDE.md", "~/.claude/CLAUDE.md") install("claude/settings.json", "~/.claude/settings.json") install("claude/integration-memory", "~/.claude/projects/-home-jyelon-integration/memory") install("emacs/dot-emacs", "~/.emacs") install("git/dot-gitconfig", "~/.gitconfig") install("vscode/chatLanguageModels.json", "~/.config/Code/User/chatLanguageModels.json") install("vscode/keybindings.json", "~/.config/Code/User/keybindings.json") install("vscode/settings.json", "~/.config/Code/User/settings.json") install("codex/config.toml", "~/.codex/config.toml") install("codex/default.rules", "~/.codex/rules/default.rules") install("codex/AGENTS.md", "~/.codex/AGENTS.md") install("kwalletd/kdewallet.kwl.blank", "~/.local/share/kwalletd/kdewallet.kwl.blank") install("kwalletd/kdewallet.salt.blank", "~/.local/share/kwalletd/kdewallet.salt.blank") install("ssh/config", "~/.ssh/config") install("bin/clean-vscode.sh", "~/bin/clean-vscode.sh")