diff --git a/Documentation.md b/Documentation.md index 60f9b7c..36c6d73 100644 --- a/Documentation.md +++ b/Documentation.md @@ -138,16 +138,18 @@ installed_at = "2026-01-01T00:00:00Z" ## Sync: snapshot and restore -Bread sync snapshots your Bread config, arbitrary dotfiles, and installed package lists into a Git repository. Pull it on another machine to restore state. +Bread sync snapshots your config, dotfiles, and installed packages into a local Git repository. Use `export`/`import` to move state between machines — no git remote required. ```bash -# First-time setup +# First-time setup (remote optional) +bread sync init bread sync init --remote git@github.com:you/bread-config.git -# Snapshot and push +# Commit local snapshot bread sync push +bread sync push --message "before reinstall" -# On another machine: pull and apply +# Apply snapshot to this machine bread sync pull # Also reinstall packages from snapshot @@ -156,12 +158,55 @@ bread sync pull --install-packages # See what has changed bread sync status bread sync diff -bread sync diff --remote # List known machines bread sync machines ``` +### Portable export/import + +`export` creates a self-contained snapshot directory or `.tar.gz` — no git auth needed. + +```bash +# Create a portable snapshot (defaults to ./bread-export--.tar.gz) +bread sync export + +# Export to a specific path +bread sync export --output ~/backups/bread.tar.gz +bread sync export --output /mnt/usb/bread-snapshot/ # directory + +# Apply a snapshot on another machine +bread sync import bread-export-hermes-2026-05-16.tar.gz +bread sync import /mnt/usb/bread-snapshot/ + +# Also install packages from the snapshot +bread sync import bread-export.tar.gz --install-packages + +# Skip cloning git repos back to their original locations +bread sync import bread-export.tar.gz --no-clone-repos + +# Skip confirmation prompt +bread sync import bread-export.tar.gz --yes +``` + +Each export snapshot includes: + +| Directory | Contents | +|-----------|----------| +| `bread/` | `~/.config/bread/` (your Bread config) | +| `configs/` | Common app configs (hypr, nvim, kitty, waybar, fish, etc.) | +| `dotfiles/` | Individual files: `.gitconfig`, `.zshrc`, `.zprofile`, `.zshenv`, SSH config, etc. | +| `local-bin/` | `~/.local/bin/` scripts (non-symlink, <512 KB) | +| `local-fonts/` | `~/.local/share/fonts/` | +| `systemd/` | `~/.config/systemd/user/` units | +| `system/` | System files: udev rules, modprobe, sysctl, NetworkManager, bluetooth (root-only paths skipped unless run with sudo) | +| `packages/` | Package lists (pacman.txt, pip.txt, cargo.txt, npm.txt) | +| `machines/` | Per-machine profile with tags and last-sync time | +| `manifest.toml` | Path map for exact restoration on import | +| `restore.sh` | Shell script for manual restore (system files shown as sudo commands) | + +**Git repository tracking:** at export time, all git repositories with remotes found under `~`, `~/Projects`, `~/Documents`, and `~/.config` are auto-committed and pushed. Their remote URLs and branches are recorded in the manifest. On import, `--no-clone-repos` suppresses cloning them back. + Configure sync in `~/.config/bread/sync.toml`: ```toml @@ -182,16 +227,6 @@ include = ["~/.config/nvim", "~/.config/waybar"] exclude = ["**/.git", "**/*.cache"] ``` -The sync repo stores: - -``` -~/.local/share/bread/sync-repo/ -├── bread/ ← ~/.config/bread/ snapshot -├── configs/ ← delegate paths (nvim, waybar, etc.) -├── machines/ ← per-machine profiles with tags and last-sync time -└── packages/ ← package snapshots (pacman.txt, pip.txt, etc.) -``` - ## Debugging tips - Run `bread events` to see live normalized events. diff --git a/README.md b/README.md index 554084e..18ad5ba 100644 --- a/README.md +++ b/README.md @@ -201,14 +201,19 @@ bread modules update [name] # Re-install one or all GitHub-sourced mod bread modules info # Show full manifest and daemon status # Sync -bread sync init # Initialize sync for this machine -bread sync push # Snapshot and push current state to remote -bread sync pull # Pull and apply latest state from remote +bread sync init # Initialize sync for this machine (remote optional) +bread sync push # Commit local snapshot +bread sync push --message "note" # Commit with a custom message +bread sync pull # Apply local snapshot to this machine bread sync pull --install-packages # Also install packages from snapshot bread sync status # Show what has changed since last push bread sync diff # Show file-level diff vs last commit -bread sync diff --remote # Show diff vs remote bread sync machines # List known machines from sync repo +bread sync export # Create a portable .tar.gz snapshot (no git auth) +bread sync export --output path # Export to a specific file or directory +bread sync import # Apply a portable snapshot (.tar.gz or directory) +bread sync import --install-packages # Also install packages +bread sync import --no-clone-repos # Skip cloning git repos ``` --- @@ -266,27 +271,31 @@ return M ## Sync system -Bread sync snapshots your entire setup — Bread config, arbitrary dotfiles, and package lists — and stores it in a Git repository. Pull it on another machine to restore. +Bread sync snapshots your entire setup — Bread config, dotfiles, fonts, systemd units, package lists, and git repos — into a local Git repository. Use `export`/`import` to move state between machines without needing a git remote. ```bash -# First-time setup +# First-time setup (remote is optional) +bread sync init bread sync init --remote git@github.com:you/bread-config.git -# Push current state +# Commit a local snapshot bread sync push -# On another machine: pull and apply -bread sync pull +# Create a portable .tar.gz (no git auth required) +bread sync export -# Check what's pending -bread sync status +# On another machine: apply the snapshot +bread sync import bread-export-hermes-2026-05-16.tar.gz + +# Also install packages on import +bread sync import bread-export.tar.gz --install-packages ``` Configure what gets synced in `~/.config/bread/sync.toml`: ```toml [remote] -url = "git@github.com:you/bread-config.git" +url = "git@github.com:you/bread-config.git" # optional branch = "main" [machine] @@ -302,14 +311,21 @@ include = ["~/.config/nvim", "~/.config/waybar"] exclude = ["**/.git", "**/*.cache"] ``` -The sync repo stores: +A portable export snapshot contains: ``` -sync-repo/ -├── bread/ ← ~/.config/bread/ snapshot -├── configs/ ← delegate paths (nvim, waybar, etc.) +bread-export-hermes-2026-05-16/ +├── bread/ ← ~/.config/bread/ +├── configs/ ← hypr, nvim, kitty, waybar, fish, dunst, btop, … +├── dotfiles/ ← .gitconfig, .zshrc, .zprofile, .zshenv, ssh config, … +├── local-bin/ ← ~/.local/bin/ scripts +├── local-fonts/ ← ~/.local/share/fonts/ +├── systemd/ ← ~/.config/systemd/user/ units +├── system/ ← udev rules, modprobe, sysctl (sudo required for some) +├── packages/ ← pacman.txt, pip.txt, cargo.txt, npm.txt ├── machines/ ← per-machine profiles -└── packages/ ← package snapshots (pacman.txt, pip.txt, etc.) +├── manifest.toml ← path map for exact restore +└── restore.sh ← shell script for manual restore ``` ---