feat: cchist install-hook — Stop hook による自動同期#12
Merged
Conversation
Registers a Stop hook in ~/.claude/settings.json that runs
`cchist sync --only local --debounce 30` whenever a Claude Code
session ends.
- `cchist install-hook`: idempotent hook registration (no-op if already present)
- `--debounce <seconds>`: configurable debounce window (default 30s)
- `--force`: replace existing cchist hook entries
- `--dry-run`: preview JSON without writing
- `cchist sync --debounce <seconds>`: skip sync if ran within N seconds
(timestamp stored in `{storage}/.cchist-last-sync`)
- Marks roadmap item as done in README
Closes #3
Co-Authored-By: Claude Sonnet 4.6 <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
Issue #3 の hook 方式を実装しました。
cchist install-hookコマンドを新設~/.claude/settings.jsonのStophook にcchist sync --only local --debounce 30を登録--forceで再登録可能)--dry-runで書き込み内容を確認してから実行可能cchist sync --debounce <seconds>フラグを追加{storage}/.cchist-last-syncに記録生成される hook (デフォルト)
{ "hooks": { "Stop": [ { "matcher": "", "hooks": [ { "type": "command", "command": "cchist sync --only local --debounce 30" } ] } ] } }Test plan
cchist install-hook --dry-runで JSON プレビューが表示されるcchist install-hookを2回実行しても hook が重複しないcchist install-hook --forceで hook が差し替えられるcchist sync --debounce 30を連続実行すると2回目はスキップされるCloses #3
🤖 Generated with Claude Code