feat(repo-sync): one local tree for every repo reachable on your forges

bin/repo-sync ports the Alphalink dotfiles repo/repo-reset zsh functions to
bash + zsh on Linux and macOS, for several forges at once: GitLab, GitHub
(+GHES), Gitea/Forgejo, Bitbucket Cloud, via curl + jq (no per-forge CLI).
Tokens live in ~/.config/repos/forges.conf (0600, parsed line by line, never
tracked), written by `repo-sync add`. Cache ~/.cache/repos/list refreshed
at most once a day (mkdir lock: flock is not on macOS), same namespace/project
on two forges kept once, archived and mirrors skipped. Layout
~/repos/<namespace with / as @>/<project>.

rc files: `repo <project> [namespace]` clones on demand and cd's, with
completion (bash compgen, zsh _describe), background refresh at shell start.
install.sh: jq in the apt and brew lists, chmod repo-sync.

Verified: shellcheck + bash -n, zsh -n; stub-curl harness over the four forges
(pagination, dedup, auth headers, lock, stale cache, path/clone); live GitLab
refresh (139 projects, 3s).
This commit is contained in:
bchanot
2026-10-07 15:31:03 +02:00
parent 2573756e73
commit f42e28807b
9 changed files with 451 additions and 4 deletions
+5 -4
View File
@@ -307,7 +307,7 @@ install_brew_packages() {
brew upgrade
brew install \
vim git git-lfs git-filter-repo gitleaks pkgconf shellcheck gh git-delta \
curl gnupg lftp inetutils \
curl gnupg lftp inetutils jq \
unzip tree tmux fzf dtach \
node python pipx php \
mariadb imagemagick \
@@ -595,7 +595,7 @@ if command -v apt-get >/dev/null 2>&1; then
# follow the distro's PHP version instead of pinning php8.x-*.
sudo apt-get install -y \
vim git git-lfs git-filter-repo gitleaks gcc make pkg-config dkms valgrind shellcheck git-delta \
curl gnupg ca-certificates apt-transport-https \
curl gnupg ca-certificates apt-transport-https jq \
unzip tree tmux fzf dtach net-tools \
openssh-server cifs-utils lftp ftp \
nodejs python3-pip pipx php-cli \
@@ -699,11 +699,12 @@ if command -v pipx >/dev/null 2>&1; then
pipx ensurepath >/dev/null
fi
# Deploy personal CLI scripts to ~/.local/bin (dt, dtach-router, claude-provider).
# Deploy personal CLI scripts to ~/.local/bin (dt, dtach-router, claude-provider, repo-sync).
echo "Deploying CLI scripts to ~/.local/bin"
mkdir -p "$HOME/.local/bin"
cp "$SCRIPT_DIR"/bin/* "$HOME/.local/bin/"
chmod +x "$HOME"/.local/bin/dt "$HOME"/.local/bin/dtach-router "$HOME"/.local/bin/claude-provider
chmod +x "$HOME"/.local/bin/dt "$HOME"/.local/bin/dtach-router \
"$HOME"/.local/bin/claude-provider "$HOME"/.local/bin/repo-sync
# Remove any stale dtach wiring from ~/.profile (the menu now ships in ~/.bashrc; see above).