Skip to content

Feature Request: Auto-detect existing dotfile setups and migrate #17

Description

@grave0x

Summary

When running dwell setup capture (or a new dwell setup detect subcommand), automatically scan the system for existing dotfile management setups and report what is found — then offer to import/migrate into dwell.

Motivation

Users switching to dwell from other tools need a way to discover what they already have configured. Currently they must manually check for chezmoi, stow, yadm, bare git repos, and other setups. Auto-detection makes migration seamless.

What to detect

Existing dotfile managers

Manager Detection Migration
chezmoi ~/.local/share/chezmoi/ exists, or chezmoi source-path Copy dot_ prefixed files directly into dwell source dir
GNU Stow ~/.stow dir or stow packages in ~/dotfiles/ Copy package files, preserve hierarchy
yadm ~/.config/yadm/ exists, or yadm list Iterate tracked files, add via dwell add
bare git repo ~/.dotfiles/ with git config status.showUntrackedFiles = no Add tracked files
dotbot install.conf.yaml or install.conf.json in common paths Parse config, add listed files
dotter ~/.config/dotter/ exists, or .dotter/ in home Parse dotter.toml, add mapped files

Manual dotfile patterns

Beyond specific tools, also detect:

  • ~/dotfiles/ or ~/.dotfiles/ directories (common convention)
  • ~/.config/ dirs that look like configs (already partially done by dwell)
  • Shell rc files that source external scripts from custom paths
  • Existing .gitconfig includes pointing to custom configs

Proposed design

dwell setup detect

dwell setup detect                    # Scan and report all found setups
dwell setup detect --json             # Machine-readable output
dwell setup detect --migrate          # Auto-import everything into dwell

Output format:

→ Detecting existing dotfile setups...
✓ chezmoi    found at ~/.local/share/chezmoi (48 tracked files)
✓ yadm       found at ~/.config/yadm (23 tracked files)
✓ bare git   found at ~/.dotfiles (repository)
✓ dotter     found at ~/.config/dotter (config present)
ℹ  ~/dotfiles/ directory exists (15 files)

dwell setup detect --migrate

Auto-import detected setups into the dwell source directory:

→ chezmoi: importing 48 files...
   ✓ dot_bashrc, dot_gitconfig, dot_config/nvim/init.lua ...
→ yadm: importing 23 files...
   ✓ dot_zshrc, dot_ssh/config ...
→ done: 71 files imported from 2 setups

dwell setup detect integration with capture

When running dwell setup capture, also run detection and include results:

{
  "captured_at": "...",
  "detected_setups": {
    "chezmoi": { "path": "~/.local/share/chezmoi", "file_count": 48 },
    "yadm": { "path": "~/.config/yadm", "file_count": 23 }
  }
}

Implementation notes

  • Detection is read-only — never modifies existing setups
  • --migrate copies files, does not remove originals
  • Uses dwell add logic internally to ensure correct dot_ prefixing
  • chezmoi: reuse existing SourceDir::detect_chezmoi() method
  • dotter: reuse existing SourceDir::detect_dotter() method
  • Stow: parse package dirs from ~/dotfiles/stow/ or ~/.stow/
  • yadm: shell out to yadm list -a if available
  • bare git: check for ~/.dotfiles/.git with bare config

Acceptance criteria

  • dwell setup detect scans and reports all common setups
  • dwell setup detect --json outputs structured JSON
  • dwell setup detect --migrate imports files into dwell source
  • Migration adds files with correct dot_ prefix
  • Original files are never modified or deleted
  • Integration tests verify detection of at least chezmoi and stow

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions