Skip to content

Feature Request: dwell sync command + remote repo setup in dwell init #11

Description

@grave0x

Summary

Add a dwell sync command that auto-commits changes and pushes to the configured git remote. Also add remote repo setup during dwell init so the user can provide a remote URL upfront.

Motivation

Currently dwell init creates a local git repo but does not configure a remote. Users must manually run git remote add and git push after adding dotfiles. There is also no command to auto-commit and push changes — users must shell out to git manually.

Proposed behavior

1. dwell init — remote repo setup

Extend dwell init to accept a --remote flag:

dwell init                                         # local only (current behavior)
dwell init --remote https://github.com/user/dotfiles.git   # + set up origin
dwell init --remote git@github.com:user/dotfiles.git       # SSH
dwell init --clone https://github.com/user/dotfiles.git    # existing (works)

When --remote is provided:

  • Create/init the local repo as before
  • Set origin to the provided URL
  • Optionally do an initial push

2. dwell sync — commit and push

dwell sync                              # auto-commit + push
dwell sync -m "Custom commit message"   # with message
dwell sync --dry-run                    # preview what would be committed

The sync command should:

  • Stage all changed files in the source directory (git add -A)
  • Commit changes with a descriptive auto-message (or custom via -m)
  • Push to the configured remote

Auto-commit message format: "dwell: sync [N] file(s) — [YYYY-MM-DD HH:MM]" or use the custom message.

3. dwell status — show git sync status

Extend dwell status (or add dwell status --sync) to show:

  • Whether the source directory has a remote configured
  • Whether there are uncommitted changes
  • Whether the local branch is ahead/behind the remote
  • Last sync timestamp

Implementation notes

  • GitRepo in dwell-store already has add(), commit(), status_summary() methods
  • Need to add: remote_url(), has_remote(), push(), is_ahead(), is_behind()
  • dwell sync should be a no-op if no changes are detected
  • dwell sync should fail early if no remote is configured
  • The dwell.toml config should store the remote URL for dwell sync to use (as an alternative to git remote)

Acceptance criteria

  • dwell init --remote <url> creates the repo + sets origin
  • dwell sync commits all changes with auto-message
  • dwell sync -m "msg" uses custom message
  • dwell sync --dry-run shows what would change without committing
  • dwell sync pushes to remote after commit
  • dwell sync exits cleanly with "nothing to sync" if no changes
  • dwell status shows sync status (remote, uncommitted, ahead/behind)
  • Integration tests cover init → add → sync → push cycle

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