[PR #470] Use absolute paths for git-ai in all agent hooks #492

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

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

State: closed
Merged: Yes


Summary

  • Use absolute binary path (from params.binary_path) instead of bare git-ai in Claude Code, Gemini, and OpenCode hook configurations
  • Prevents silent hook failures when agents run outside a shell environment where git-ai is in PATH
  • Matches the pattern already used by Cursor and Droid installers

Changes

Claude Code (claude_code.rs): Replace git-ai checkpoint claude ... with {binary_path} checkpoint claude ... in PreToolUse/PostToolUse hook commands.

Gemini (gemini.rs): Same pattern for BeforeTool/AfterTool hook commands.

OpenCode (opencode.rs + git-ai.ts): Add __GIT_AI_BINARY_PATH__ placeholder in the TypeScript plugin template, substituted with the actual path at install time via generate_plugin_content().

Test plan

  • cargo build compiles cleanly
  • cargo test --lib — 412 tests pass (0 failures)
  • cargo clippy — no warnings
  • Manual: run cargo run -- install-hooks and verify absolute paths appear in ~/.claude/settings.json, ~/.gemini/settings.json, and ~/.config/opencode/plugin/git-ai.ts

🤖 Generated with Claude Code


Open with Devin
**Original Pull Request:** https://github.com/git-ai-project/git-ai/pull/470 **State:** closed **Merged:** Yes --- ## Summary - Use absolute binary path (from `params.binary_path`) instead of bare `git-ai` in Claude Code, Gemini, and OpenCode hook configurations - Prevents silent hook failures when agents run outside a shell environment where `git-ai` is in PATH - Matches the pattern already used by Cursor and Droid installers ## Changes **Claude Code** (`claude_code.rs`): Replace `git-ai checkpoint claude ...` with `{binary_path} checkpoint claude ...` in PreToolUse/PostToolUse hook commands. **Gemini** (`gemini.rs`): Same pattern for BeforeTool/AfterTool hook commands. **OpenCode** (`opencode.rs` + `git-ai.ts`): Add `__GIT_AI_BINARY_PATH__` placeholder in the TypeScript plugin template, substituted with the actual path at install time via `generate_plugin_content()`. ## Test plan - [x] `cargo build` compiles cleanly - [x] `cargo test --lib` — 412 tests pass (0 failures) - [x] `cargo clippy` — no warnings - [x] Manual: run `cargo run -- install-hooks` and verify absolute paths appear in `~/.claude/settings.json`, `~/.gemini/settings.json`, and `~/.config/opencode/plugin/git-ai.ts` 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- devin-review-badge-begin --> --- <a href="https://app.devin.ai/review/git-ai-project/git-ai/pull/470" target="_blank"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://static.devin.ai/assets/gh-open-in-devin-review-dark.svg?v=1"> <img src="https://static.devin.ai/assets/gh-open-in-devin-review-light.svg?v=1" alt="Open with Devin"> </picture> </a> <!-- devin-review-badge-end -->
kerem 2026-03-02 04:13:47 +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#492
No description provided.