Skip to content

feat: cchist install-hook — Stop hook による自動同期#12

Merged
mikana0918 merged 1 commit into
mainfrom
feat/install-hook
May 15, 2026
Merged

feat: cchist install-hook — Stop hook による自動同期#12
mikana0918 merged 1 commit into
mainfrom
feat/install-hook

Conversation

@ifx-kernel-bot

Copy link
Copy Markdown

Summary

Issue #3 の hook 方式を実装しました。

  • cchist install-hook コマンドを新設
    • ~/.claude/settings.jsonStop hook に cchist sync --only local --debounce 30 を登録
    • idempotent: 既に登録済みなら no-op(--force で再登録可能)
    • --dry-run で書き込み内容を確認してから実行可能
  • cchist sync --debounce <seconds> フラグを追加
    • 前回実行から N 秒以内なら sync をスキップ(連続 hook 発火によるレート制御)
    • タイムスタンプを {storage}/.cchist-last-sync に記録
  • README ロードマップ項目を完了マークに更新

生成される 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回目はスキップされる
  • typecheck / build / smoke test が通る (CI)

Closes #3

🤖 Generated with Claude Code

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>
@mikana0918 mikana0918 merged commit 9ed4a1c into main May 15, 2026
1 check passed
@mikana0918 mikana0918 deleted the feat/install-hook branch May 15, 2026 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: cchist watch — hook経由リアルタイム同期

1 participant