feat: implement claude-sync auto enable/disable/status#39
Open
jimjawn wants to merge 1 commit into
Open
Conversation
Add `claude-sync auto enable/disable/status` subcommands that install and remove claude-sync pull/push hooks in ~/.claude/settings.json, merging with existing hooks without clobbering them. Backed by new internal/claudesettings package that round-trips the full settings file via a raw JSON map. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Closed
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
Implements the
claude-sync autosubcommand that was documented in the README but not yet functional.How it works
Reads and writes
~/.claude/settings.jsonusing the Claude Code hook format. Onenable, two hooks are added:claude-sync pull -q(pull latest on session start)claude-sync push -q(push changes on session end)On
disable, only the claude-sync entries are removed — all other hooks are left exactly as they were.Implementation details
internal/claudesettingshandles settings.json read/writemap[string]json.RawMessageround-trip so all unknown fields are preserved — no data loss on save0600permissionsenableis a no-op if hooks already present,disableis a no-op if not installed~/.claude/settings.jsonif it doesn't exist yetTested
statuscorrectly reports not-installed / enabled stateenablemerges with existing hooks (pre-existing Stop hooks survive intact)disableremoves only claude-sync entries, leaves other hooks untouchedhooksare preservedCloses the gap noted in issue #26.