Skip to content

Fix auto-build: cd to module root before go build#11

Merged
hammadtq merged 1 commit intomainfrom
fix/bootstrap-build-cwd
Apr 2, 2026
Merged

Fix auto-build: cd to module root before go build#11
hammadtq merged 1 commit intomainfrom
fix/bootstrap-build-cwd

Conversation

@hammadtq
Copy link
Copy Markdown
Collaborator

@hammadtq hammadtq commented Apr 2, 2026

Summary

When Claude Code runs the plugin hook, the CWD is the user's project (not the plugin source). go build then fails with 'cannot find main module' because there's no go.mod in the CWD.

Fix: run go build in a subshell cd'd to the module root.

Test plan

  • bash -n plugin/hooks/bootstrap.sh passes
  • Delete plugin binary, run /attach-guard:explain axios from a non-Go project — should auto-build successfully

Generated with Claude Code

bootstrap.sh runs go build from the user's CWD, which may not contain
a go.mod. Run in a subshell cd'd to the module root so Go can find the
module regardless of where Claude Code is invoked.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@hammadtq hammadtq merged commit b6441f7 into main Apr 2, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant