Fix local-dev hooks path resolution for non-Claude agents#745
Merged
Conversation
Entire-Checkpoint: 42ab6d2bb759
Entire-Checkpoint: 1d414313029f
Entire-Checkpoint: 4fec5565b45f
- Ensure hooks don't crash the agent - Allow `git ref-parse ...` to be used as entire cmd
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates how local-dev hook commands resolve the repository root for non-Claude agents by switching from agent-specific *_PROJECT_DIR environment variables to $(git rev-parse --show-toplevel), and adjusts the OpenCode Bun plugin to execute hook commands via sh -c so command substitution works.
Changes:
- Replace non-Claude local-dev hook prefixes with
go run $(git rev-parse --show-toplevel)/...across multiple agents and fixtures. - Update OpenCode plugin hook execution to use Bun spawn APIs +
sh -c, and add top-level event safetytry/catch. - Update docs and Go unit/integration tests to assert the new local-dev command format.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/architecture/agent-guide.md | Updates guidance/examples for local-dev hook command prefixing. |
| cmd/entire/cli/integration_test/agent_test.go | Updates integration assertions for new local-dev prefix. |
| cmd/entire/cli/agent/opencode/hooks_test.go | Updates OpenCode install test to expect new local-dev command. |
| cmd/entire/cli/agent/opencode/hooks.go | Switches OpenCode local-dev ENTIRE_CMD to git rev-parse based path. |
| cmd/entire/cli/agent/opencode/entire_plugin.ts | Updates plugin template to run hooks via Bun.spawn + sh -c and add safety try/catch. |
| cmd/entire/cli/agent/geminicli/hooks_test.go | Updates Gemini hook command expectations for new local-dev prefix. |
| cmd/entire/cli/agent/geminicli/hooks.go | Switches Gemini local-dev prefix + detection prefix to git rev-parse. |
| cmd/entire/cli/agent/factoryaidroid/hooks_test.go | Updates Factory AI Droid hook command expectations for new local-dev prefix. |
| cmd/entire/cli/agent/factoryaidroid/hooks.go | Switches Factory AI Droid local-dev prefix + detection prefix to git rev-parse. |
| cmd/entire/cli/agent/cursor/hooks_test.go | Updates Cursor hook command expectation for new local-dev prefix. |
| cmd/entire/cli/agent/cursor/hooks.go | Switches Cursor local-dev prefix + detection prefix to git rev-parse. |
| cmd/entire/cli/agent/copilotcli/hooks_test.go | Updates Copilot CLI hook command expectation for new local-dev prefix. |
| cmd/entire/cli/agent/copilotcli/hooks.go | Switches Copilot CLI local-dev prefix + detection prefix to git rev-parse. |
| cmd/entire/cli/agent/copilotcli/AGENT.md | Updates Copilot CLI docs for new detection prefix string. |
| .opencode/plugins/entire.ts | Updates generated OpenCode plugin fixture to new local-dev ENTIRE_CMD + spawn behavior. |
| .gemini/settings.json | Updates generated Gemini settings fixture to new local-dev command prefix. |
Prevents word-splitting when the repo root path contains spaces. Without quoting, the shell splits the expanded path into multiple arguments, breaking `go run` invocations for all non-Claude agents. Entire-Checkpoint: 01186addddb4
Entire-Checkpoint: a83b06a72986
Soph
approved these changes
Mar 21, 2026
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
*_PROJECT_DIRvariables to$(git rev-parse --show-toplevel)so hooks resolve the repo root correctly at runtime regardless of checkout location.sh -cwith Bun spawn APIs and wrapping event handling in a top-level safetytry/catch, ensuring shell substitution works and plugin errors remain non-fatal.Why
entire hooks ...paths unchanged.Testing
Please note:
--local-devis a feature specific to this repository and shouldn't be used outside of developing this CLI. I therefore ignored all legacy commands usingAGENT_PROJECT_DIRsince they simply didn't work.