feat(watcher): S-64 continuous dotfiles watcher#98
Merged
Conversation
Two LaunchAgents (launchd WatchPaths regenerated from `chezmoi managed`
+ fswatch -r daemon) call a mkdir-locked `dotfiles-watcher-tick` that
runs `chezmoi re-add` on every drifted managed file. Working-tree only:
no auto-commit, no auto-push (operator reviews via `git status` and
commits manually). New verb `dotfiles watch {install|uninstall|status|now|tail}`.
Distinct from /dotfiles-sync: the watcher only absorbs drift on
already-managed files, so /dotfiles-sync's drift section stays empty
and the operator-decisions stay focused on what only a human can do
(classify new brews / new skills, commit, push). WatchPaths covers
direct mtime on every leaf (including in-place ~/.claude/skills/*/SKILL.md
edits); fswatch covers subdirs created since the last apply.
Test runner at tests/dotfiles-watch.sh covers 9 cases (shellcheck,
template render+lint, no-op-when-clean, single-pass absorb, drift-loop
iteration, mkdir-lock coalescing, Brewfile entry). 9/9 pass on
Hans-Air-M4.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
WatchPathsregenerated fromchezmoi managed, onefswatch -rdaemon). Both pipe into a mkdir-lockeddotfiles-watcher-tickthat runschezmoi re-addon every drifted file.dotfiles watch {install|uninstall|status|now|tail}./dotfiles-sync: the watcher only does the "absorb drift on already-managed files" slice, so the skill's drift section stays empty and the operator-decisions stay focused on classification (new brews / new skills / SSH fragments) + commits.Full design:
docs/specs/S-64-dotfiles-watch.md. User-facing docs:docs/guide.md§ 4 "The background watcher."Test plan
bash tests/dotfiles-watch.sh-- 9/9 pass on Hans-Air-M4 (shellcheck both wrappers, template render+lint, no-op-when-clean, single-pass absorb, drift-loop iteration, mkdir-lock coalescing, Brewfile entry).dotfiles watch install, edit~/.claude/skills/<any>/SKILL.md, verify aTICK done (passes=1)line lands in~/Library/Logs/dotfiles-watcher.logwithin ~3s and the corresponding source file underhome/dot_claude/skills/.../SKILL.mdshows as modified ingit status.dotfiles watch statusshows bothcom.truonghan.dotfiles-watcherandcom.truonghan.dotfiles-watcher-fswatchloaded.dotfiles watch uninstallcleanly boots out both agents.Naming note
Earlier drafts used
autosync/resync. Renamed towatch/watcher-tickbecause "sync" was too close to/dotfiles-syncand made the boundary unclear (the watcher is one slice of what /dotfiles-sync does, not a different sync). The help text now closes with the disambiguation explicitly.🤖 Generated with Claude Code