Cross-OS dev environment synchronizer with auto-encrypted dotfiles
Project description
DotSync AI
Cross-OS Dev Environment Synchronizer โ keep your dotfiles and dev tools in sync across Linux, Windows, and macOS.
๐ Table of Contents
- Why DotSync AI?
- Features
- Installation
- Quick Start
- Sync Flow Diagrams
- Command Reference
- Advanced Usage
- Configuration
- Project Structure
- Architecture
- Use Cases
- Roadmap
- Contributing
- License
๐ฏ Why DotSync AI?
The problem: You have 3 machines (work Linux, personal macOS, home Windows) and configuring each one from scratch takes hours. Your .bashrc, .gitconfig, VS Code settings, SSH config, and dev tools are scattered across different OS paths.
DotSync AI solves this by:
| Problem | Solution |
|---|---|
| Manual setup on each machine | Auto-detect tools + dotfiles, apply with one command |
| Path differences across OS | Automatic cross-OS path remapping (~/.config โ %APPDATA%) |
| Sensitive data in git | Fernet (AES-128) encrypted secrets storage |
| File conflicts | 3-way conflict resolution (mine / theirs / merge) |
| Selective sync | Per-tool include/exclude filters |
| No backup before changes | Automatic backup on apply |
โจ Features
๐ Auto-Detection
Scans your environment and detects installed dev tools automatically:
- Shells: bash, zsh, fish
- Git โ
.gitconfig, SSH keys, global gitignore - VS Code โ settings, keybindings, snippets, extensions
- Terminal โ tmux, starship, kitty, alacritty
- Runtimes โ Node.js (
.npmrc), Python, Docker - And more...
๐ Sync & Apply
- Snapshot โ collect dotfiles into a structured store
- Apply โ restore dotfiles via symlinks with automatic backup
- Diff โ compare stored vs current filesystem state
- Selective sync โ sync only specific tools (
-t git,vscode)
๐ค๏ธ Cross-OS Path Remapping
Automatically translates paths between OS conventions:
~/.config/code/User/settings.jsonโ%APPDATA%\Code\User\settings.json~/.ssh/configโ~/.ssh/config(same on macOS/Linux)- Windows โ Linux โ macOS path normalization
๐ Encrypted Secrets (Fernet AES-128)
Store sensitive data safely:
- set / get / list / delete secrets
- Fernet (AES-128-CBC) symmetric encryption
- Vault file + separate key file
- Secrets never exposed in
listoutput
๐ฆ Git Backend
Version-controlled dotfile storage:
- init โ create a git repo in your store
- push / pull โ sync via private git remote (GitLab, GitHub)
- Smart commit messages with machine context
๐ง Multi-Machine
Track environments across machines:
- machines โ list all known machines
- switch โ switch active context
- snapshot --copy-files โ capture actual file contents per machine
โก Conflict Resolution
When both sides changed, choose a strategy:
mineโ keep your local versiontheirsโ accept the stored versionmergeโ let DotSync attempt auto-merge
๐ฆ Installation
Option 1: pip (Python)
pip install dotsync-ai
Option 2: pip (from source)
git clone https://gitlab.com/fiqi/dotsync-ai.git
cd dotsync-ai
pip install .
Option 3: npm (Node.js wrapper)
The npm wrapper auto-bootstraps a Python virtualenv and installs the wheel on first use.
# From local source
npm install /path/to/dotsync-ai/npm
# From npm registry (when published)
npm install dotsync-ai
Then use via npx:
npx dotsync --help
Prerequisites
- Python 3.10+
- Git (for push/pull features)
- pip (for Python installation)
๐ Quick Start
1. Initialize โ scan your environment
dotsync init
This scans your current machine for installed dev tools and detected dotfiles. Example output:
โญโโโโโโ ๐ DotSync Init โโโโโโโฎ
โ Scanning linux environment... โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
Detected Tools (11 found):
git v2.34.1
ssh -
bash v5.1.16
vscode v1.109.5
node v22.20.0
python v3.11.15
docker v27.3.1
... and more
2. Take a snapshot
dotsync snapshot
Collects all detected config files into the DotSync store (~/.dotsync/). Use --copy-files to snapshot actual file contents (not just paths).
3. Check status
dotsync status
Shows current sync state: which files are tracked, modified, or missing.
4. List tracked files
dotsync list
Shows all tracked dotfiles with their status icons:
- โ Synced
- โ Missing from stash
- โง Modified
-
- New file
5. See what's changed
# Quick diff (file list)
dotsync diff
# Detailed content diff
dotsync diff --content
6. Apply dotfiles (restore)
# Dry run first โ see what would happen
dotsync apply --dry-run
# Apply with automatic backup
dotsync apply
# Force overwrite
dotsync apply --force
๐ Sync Flow Diagrams
Linux โ Windows (First Time Setup)
๐ฅ๏ธ PC Linux (Source) โ๏ธ Git Private Repo ๐ช PC Windows (Target)
โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโ
1. pip install dotsync-ai
2. dotsync init
โโ Scan: 11 tools detected โฌ
โโ ๐ง Set up git remote? โ [y]
โโ Git remote URL? โ git@gitlab.com:user/dotfiles.git
โโ โ Git initialized + remote set
3. dotsync snapshot --copy-files
โโ โ 9 dotfiles captured โฌ
4. dotsync push
โโ โฌ Pushed to git โโโโโโโโโโโโโโโโโโ gitlab.com:user/dotfiles (private)
5. pip install dotsync-ai
6. dotsync init
โโ Scan: tools detected
โโ ๐ง Set up git remote? โ [n]
โโ (skip โ will pull instead)
7. dotsync push -r git@gitlab.com:user/dotfiles.git
โโ โฌ Init + set remote
8. dotsync pull
โโ โฌ Pulled dotfiles โโโโโโโ
9. ๐ค๏ธ Auto Path Remap:
~/.config/Code โ %APPDATA%\Code
~/.bashrc โ C:\Users\x\.bashrc
10. dotsync apply --dry-run
โโ Preview changes
11. dotsync apply
โโ โ
Done! Windows configured!
Windows โ Linux (Reverse)
๐ช PC Windows (Source) โ๏ธ Git Private Repo ๐ฅ๏ธ PC Linux (Target)
โโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ
1. pip install dotsync-ai
2. dotsync init
โโ Scan tools
โโ ๐ง Set up git remote? โ git@gitlab.com:user/dotfiles.git
3. dotsync snapshot --copy-files
4. dotsync push โโโโโโโโโโโโโโโโโโโโโโโ dotfiles repo
5. pip install dotsync-ai
6. dotsync init
7. dotsync push -r git@gitlab.com:user/dotfiles.git
8. dotsync pull โโโโโโโโโโโ
9. ๐ค๏ธ Auto remap:
%APPDATA%\Code โ ~/.config/Code
10. dotsync apply
โโ โ
Done!
Daily Sync (After First Setup)
๐ Daily Workflow
โโโโโโโโโโโโโโโโโ
PC A: edit dotfiles โ dotsync snapshot โ dotsync push โโ โ๏ธ
PC B: dotsync pull โโ โ๏ธ โ dotsync apply
โ ๏ธ Important Notes
Git Repo Requirement:
- You need 1 private git repo (GitLab, GitHub, etc.)
- Recommended: create an empty repo first, e.g.
gitlab.com/user/dotfiles dotsync initwill prompt to set it up automatically
Vault Key (.vault_key):
- The encryption key for secrets is never pushed to git
- To sync secrets across machines, transfer
.vault_keymanually:- Flash drive, Signal DM, encrypted email, etc.
- Place in
~/.dotsync/.vault_keyon the target machine
๐ Command Reference
dotsync init
Initialize DotSync โ scan your current environment.
dotsync init # Scan default home directory
dotsync init --home /home/custom # Scan a custom home directory
dotsync snapshot
Take a snapshot of your current dotfiles into the store.
dotsync snapshot # Record paths of detected dotfiles
dotsync snapshot --copy-files # Copy actual file contents
dotsync snapshot --store /custom/path # Use custom store directory
dotsync status
Show current sync status โ tracked, modified, missing.
dotsync status
dotsync list
List all tracked dotfiles.
dotsync list # Table output
dotsync list --json # JSON output for scripting
dotsync diff
Compare stored dotfiles with current filesystem.
dotsync diff # File-level comparison
dotsync diff --content # Unified diff of file contents
dotsync diff /path/to/snapshot # Compare against a specific snapshot
dotsync apply
Restore dotfiles from store to filesystem via symlinks.
dotsync apply --dry-run # Preview changes only
dotsync apply # Apply with backup
dotsync apply --force # Overwrite existing (with backup)
dotsync apply --no-backup # Skip backup (use with caution)
dotsync apply -t git,vscode # Only sync git and vscode
dotsync apply -e docker # Sync everything except docker
dotsync apply --resolve mine # Keep my version on conflict
dotsync apply --resolve theirs # Accept stored version on conflict
dotsync apply --resolve merge # Auto-merge on conflict
dotsync config
Show current DotSync configuration.
dotsync config
dotsync machines
List all known machines that have snapshots stored.
dotsync machines
dotsync switch
Switch the active machine context.
dotsync switch <machine-name> # e.g. dotsync switch my-work-pc
dotsync push
Commit and push dotfiles to git remote.
dotsync push # Auto-commit + push
dotsync push -r git@gitlab.com:user/dotfiles.git # Set remote URL
dotsync push -m "Custom commit message"
dotsync pull
Pull latest dotfiles from git remote.
dotsync pull
dotsync secret
Manage encrypted secrets in the Fernet vault.
dotsync secret set GITHUB_TOKEN # Store a secret (prompts for value)
dotsync secret get GITHUB_TOKEN # Retrieve a secret
dotsync secret list # List all secret keys
dotsync secret delete GITHUB_TOKEN # Remove a secret
๐ง Advanced Usage
๐ End-to-End Sync Workflow
# Machine A (source)
dotsync init
dotsync snapshot --copy-files
dotsync secret set DOTFILES_GIT_TOKEN # Store your git token
dotsync push -r git@gitlab.com:user/dotfiles.git
# Machine B (target, fresh install)
dotsync init # Detect tools on this machine
dotsync pull # Pull dotfiles from git
dotsync apply --dry-run # See what will be applied
dotsync apply --resolve theirs # Accept stored versions
๐ ๏ธ Selective Sync Examples
# Only sync dev tools, skip terminal config
dotsync apply -t git,ssh,vscode,node,python
# Exclude heavy configs
dotsync apply -e docker -e starship
# Multiple machines, different tools
dotsync switch work-linux
dotsync apply -t git,vscode,docker
dotsync switch home-mac
dotsync apply -t git,ssh,node
๐ Cross-OS Workflow
# --- On Linux work machine ---
dotsync init
dotsync snapshot --copy-files
dotsync push
# --- On Windows home machine ---
# Paths like ~/.config/code/User/settings.json
# are automatically remapped to %APPDATA%\Code\User\settings.json
dotsync init
dotsync pull
dotsync apply --dry-run # Verify path remapping
dotsync apply
๐๏ธ Cleanup
# Clean up a specific tool's files from store
dotsync apply -e <tool> # Skip the tool on next apply
# Full reset
rm -rf ~/.dotsync
โ๏ธ Configuration
DotSync looks for config in ~/.dotsync/dotsync.yaml (auto-created on init).
Example ~/.dotsync/dotsync.yaml
# DotSync AI Configuration
store_path: ~/.dotsync/store
active_machine: my-laptop
# Path remapping rules (cross-OS)
pathmaps:
linux:
vscode_config: ~/.config/Code/User
windows:
vscode_config: '%APPDATA%\Code\User'
macos:
vscode_config: ~/Library/Application Support/Code/User
# Tool-specific settings
tools:
git:
enabled: true
config_files:
- ~/.gitconfig
vscode:
enabled: true
ssh:
enabled: true
exclude:
- ~/.ssh/known_hosts # Don't sync known_hosts
# Sync behavior
sync:
backup: true # Always backup before overwriting
resolve_strategy: mine # Default conflict resolution
๐ Project Structure
dotsync-ai/
โโโ src/dotsync/ # Main Python package
โ โโโ cli.py # CLI entry point (Click + Rich)
โ โโโ scanner.py # Detect installed tools & dotfiles
โ โโโ snapshot.py # Collect & store dotfile snapshots
โ โโโ sync.py # Apply dotfiles to target OS
โ โโโ apply.py # Symlink-based dotfile application
โ โโโ diff_engine.py # File-level and content diff
โ โโโ pathmap.py # Cross-OS path remapping
โ โโโ config.py # Config file parsing (YAML)
โ โโโ crypto.py # Encrypt/decrypt secrets (Fernet)
โ โโโ git_backend.py # Git push/pull operations
โ โโโ conflict.py # 3-way conflict resolution
โ โโโ selective.py # Per-tool include/exclude filtering
โ โโโ content_remap.py # Path remapping inside file contents
โ โโโ filter.py # Exclude/include pattern matching
โ โโโ lineending.py # Line ending normalization
โ โโโ tool_normalize.py # Tool name normalization (cross-OS)
โ โโโ list_cmd.py # List tracked files with status
โ โโโ machines.py # Multi-machine tracking
โ โโโ manifest.py # Manifest.json store management
โ โโโ status.py # Sync status display
โ โโโ models.py # Pydantic data models
โ โโโ __init__.py # Package init
โโโ npm/ # npm wrapper package
โ โโโ package.json # npm package definition
โ โโโ bin/
โ โ โโโ dotsync.js # npm CLI entry point
โ โโโ src/
โ โ โโโ setup.js # postinstall โ venv + wheel setup
โ โ โโโ cleanup.js # uninstall โ venv cleanup
โ โโโ dist/ # Bundled Python wheel
โ โโโ dotsync_ai-*.whl
โโโ tests/ # Comprehensive test suite
โ โโโ test_cli.py
โ โโโ test_scanner.py
โ โโโ test_snapshot.py
โ โโโ test_sync.py
โ โโโ test_apply.py
โ โโโ test_pathmap.py
โ โโโ test_config.py
โ โโโ test_crypto.py
โ โโโ test_git_backend.py
โ โโโ test_conflict.py
โ โโโ test_selective.py
โ โโโ test_content_remap.py
โ โโโ test_filter.py
โ โโโ test_lineending.py
โ โโโ test_tool_normalize.py
โ โโโ test_list_cmd.py
โ โโโ test_machines.py
โ โโโ test_manifest.py
โ โโโ test_status.py
โ โโโ test_dotsync.py
โ โโโ test_diff_engine.py
โ โโโ __init__.py
โโโ docs/
โ โโโ plans/ # Development plans
โโโ pyproject.toml # Python project config
โโโ .gitignore
โโโ LICENSE # MIT License
โโโ README.md # You are here
๐๏ธ Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ dotsync CLI โ
โ (Click + Rich โ cli.py) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโค
โ init / snapshot / diff โ push / pull โ
โ apply / config / list โ secret โ
โ status / machines โ โ
โ switch โ โ
โโโโโโโโโโโโฌโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโค
โ Scanner โ GitBackend โ Crypto โ
โ (detect) โ (version ) โ (Fernet AES) โ
โ โ control) โ โ
โโโโโโโโโโโโผโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโค
โ Pathmap โ Conflict โ DiffEngine โ
โ (remap) โ (resolve) โ (compare) โ
โโโโโโโโโโโโดโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโค
โ Store (~/.dotsync/) โ
โ manifest.json โ dotfiles/ โ secrets.enc โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Key Design Decisions
| Decision | Why |
|---|---|
| Symlinks for apply | Files stay editable in-place, store is the source of truth |
| Fernet (AES-128) | Battle-tested symmetric encryption from cryptography lib |
| YAML config | Human-readable, easy to edit manually |
| Git backend | Leverages existing git infrastructure, no custom server |
| Pydantic models | Type-safe data validation throughout |
๐ก Use Cases
๐ฅ๏ธ Developer Machine Setup
- Fresh OS install?
dotsync pull && dotsync applyโ back to full dev setup in seconds. - VS Code settings, git config, shell aliases โ all restored instantly.
๐ข Multi-Workstation
- Office desktop + home laptop: keep both in sync.
- Switch machine context with
dotsync switch. - Different tool sets per machine (desktop has Docker, laptop doesn't).
๐ Cross-Platform (Linux โ macOS โ Windows)
- One config for all three OS.
- Path remapping handles OS conventions automatically.
- Line ending normalization prevents CRLF/LF issues.
๐ Secure Dotfiles in Git
- Public dotfiles repo + encrypted secrets.
- Git tokens, API keys, SSH passwords stored encrypted.
- Only you can decrypt (separate vault key).
๐ฅ Team Onboarding
- New dev joins the team? Share a base config.
- Each team member customizes via selective sync.
- Standardized dev environment across the team.
๐บ๏ธ Roadmap
v0.1 โ MVP (โ Complete)
- Project setup and packaging
-
dotsync initโ scan environment, detect tools -
dotsync snapshotโ collect dotfiles into store - Linux support (bash, zsh, git, ssh, vscode)
-
dotsync applyโ restore via symlinks -
dotsync diffโ compare environments -
dotsync statusโ sync state overview -
dotsync listโ tracked file listing - Cross-OS path remapping (Linux โ Windows โ macOS)
- Git-based dotfile storage (push/pull)
- Encrypted secrets (Fernet AES-128)
- Multi-machine support (machines/switch)
- Conflict resolution (mine/theirs/merge)
- Selective sync (per-tool filtering)
- Config file (YAML)
- npm wrapper package
- Comprehensive test suite (136+ tests)
v0.2 โ Cross-OS Polish
-
dotsync snapshotโ Windows path scanning -
dotsync initโ macOS Homebrew detection - npm package published to registry
- Windows Chocolatey/Scoop detection
- Shell completion scripts (bash, zsh, fish)
v0.3 โ Collaboration & CI
- GitHub/GitLab CI template for dotfile validation
-
dotsync validateโ validate config before apply -
dotsync doctorโ diagnose common issues - Pre-commit hook for secret scanning
v0.4 โ AI-Assisted Config
- AI-powered config optimization suggestions
- Workflow-based config profiles
- Smart conflict auto-resolution
- Config drift detection and alerts
๐ค Contributing
Contributions are welcome! Here's how to get started:
# Clone and set up
git clone https://gitlab.com/fiqi/dotsync-ai.git
cd dotsync-ai
# Install in development mode
pip install -e ".[dev]"
# Run tests
pytest
# Type check
mypy src/dotsync
# Lint
ruff check src/dotsync
Guidelines
- Fork the repository.
- Create a feature branch:
git checkout -b feat/my-feature. - Write tests for new features.
- Ensure all tests pass and coverage doesn't drop.
- Submit a Merge Request.
๐ License
MIT License โ see LICENSE for full text.
Made with โค๏ธ for developers tired of configuring environments twice.
GitLab
ยท
GitHub Mirror
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dotsync_ai-0.2.0.tar.gz.
File metadata
- Download URL: dotsync_ai-0.2.0.tar.gz
- Upload date:
- Size: 56.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0042c32262122d42d648bb82112a043e02f0a027573585c008680bfce1400231
|
|
| MD5 |
ec256d5fcdc69faa9cf3b4ef73e971d6
|
|
| BLAKE2b-256 |
e55200b6bbd26a78b12f1b69b9e71b3be9c546875a704193c308710368daf3a0
|
File details
Details for the file dotsync_ai-0.2.0-py3-none-any.whl.
File metadata
- Download URL: dotsync_ai-0.2.0-py3-none-any.whl
- Upload date:
- Size: 44.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
de673a04d9b23c7df7b0960320653d03f03ac0b51ec65577f267543057991cf6
|
|
| MD5 |
832145e29bf42a80f8539f74a222d833
|
|
| BLAKE2b-256 |
d1efb68200fb8774ee85534a1692b15056fcaa0d7cb509e6355f8c0c3ab4dd01
|