[PR #34] claude code preset hook #213

Closed
opened 2026-03-02 04:12:58 +03:00 by kerem · 0 comments
Owner

Original Pull Request: https://github.com/git-ai-project/git-ai/pull/34

State: closed
Merged: Yes


Implemented a checkpoint claude preset for easier use from hooks.

A few points

  1. claude hooks pass JSON into the process you spawn as a string. Not every computer can be expected to have jq installed, so I decided to make parsing that JSON the responsibility of git-ai
  2. All hooks run from the cwd you started Claude Code in, for our purposes that is probably right, but we may want to swallow errors int he event you run it outside of a git repo

Here's what my ~/.claude/settings.json looks like:

{
        "hooks": {
            "PreToolUse": [
                {
                    "matcher": "Write|Edit|MultiEdit",
                    "hooks": [
                        {
                            "type": "command",
                            "command": "git-ai checkpoint"
                        }
                    ]
                }
            ],
            "PostToolUse": [
                {
                    "matcher": "Write|Edit|MultiEdit",
                    "hooks": [
                        {
                            "type": "command",
                            "command": "git-ai checkpoint claude --hook-input \"$(cat)\""
                        }
                    ]
                }
            ]
        }
    }

#25

**Original Pull Request:** https://github.com/git-ai-project/git-ai/pull/34 **State:** closed **Merged:** Yes --- Implemented a `checkpoint claude` preset for easier use from hooks. A few points 1. claude hooks pass JSON into the process you spawn as a string. Not every computer can be expected to have `jq` installed, so I decided to make parsing that JSON the responsibility of `git-ai` 2. All hooks run from the cwd you started Claude Code in, for our purposes that is probably right, but we may want to swallow errors int he event you run it outside of a git repo Here's what my `~/.claude/settings.json` looks like: ``` { "hooks": { "PreToolUse": [ { "matcher": "Write|Edit|MultiEdit", "hooks": [ { "type": "command", "command": "git-ai checkpoint" } ] } ], "PostToolUse": [ { "matcher": "Write|Edit|MultiEdit", "hooks": [ { "type": "command", "command": "git-ai checkpoint claude --hook-input \"$(cat)\"" } ] } ] } } ``` #25
kerem 2026-03-02 04:12:58 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/git-ai#213
No description provided.