Skip to main content

Cross-OS dev environment synchronizer

Project description

DotSync AI

Cross-OS Dev Environment Synchronizer โ€” keep your dotfiles and dev tools in sync across Linux, Windows, and macOS.

License: MIT Python 3.10+ CLI


๐Ÿ“‹ Table of Contents


๐ŸŽฏ 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 list output

๐Ÿ“ฆ 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 version
  • theirs โ€” accept the stored version
  • merge โ€” 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

๐Ÿ“– 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

  1. Fork the repository.
  2. Create a feature branch: git checkout -b feat/my-feature.
  3. Write tests for new features.
  4. Ensure all tests pass and coverage doesn't drop.
  5. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dotsync_ai-0.1.0.tar.gz (47.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dotsync_ai-0.1.0-py3-none-any.whl (42.0 kB view details)

Uploaded Python 3

File details

Details for the file dotsync_ai-0.1.0.tar.gz.

File metadata

  • Download URL: dotsync_ai-0.1.0.tar.gz
  • Upload date:
  • Size: 47.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for dotsync_ai-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bab7a51c18e88f4b58f48bdcf80cd4817b6a8595f8f4c43e598a92fa15b7e409
MD5 1423c1fadf65a604c5c4e614b872de73
BLAKE2b-256 4c3ad254dcc200b24c7283da9f57af47166186ba40f44704e8b2c2f0ec82f70b

See more details on using hashes here.

File details

Details for the file dotsync_ai-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: dotsync_ai-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 42.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for dotsync_ai-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9fe87ea732a1662fec5ef52edb2a6bce3d62de693502c932cee536c76315f13d
MD5 719b9d4a8dbb556d3ecd3df4255b6e3a
BLAKE2b-256 7d0d84141217429fabcf3f0ffba7fe431e0a39272d743af3145caf9428a1bcf7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page