feat: shared binary resolver + goose-init driver support#1283
Merged
Conversation
b18464d to
343660b
Compare
Extract resolveBinary() into apps/cli/src/resolve-binary.ts — all init commands (claude-init, copilot-init, deepagents-init, goose-init) now use the same resolution logic: 1. Dev repo: apps/cli/dist/bin.js → "node apps/cli/dist/bin.js" 2. npm install: node_modules/.bin/agentguard → relative path 3. npm alias: node_modules/.bin/aguard → relative path 4. Global: bare "agentguard" (PATH) Also fixes the claude-init workspace resolver: uses $HOME fallback instead of git rev-parse (which breaks when cwd is a subrepo). New: goose-init command for Block's Goose CLI — registers AgentGuard as an MCP governance extension in ~/.config/goose/config.yaml. - apps/cli/src/resolve-binary.ts: shared binary resolution - apps/cli/src/commands/goose-init.ts: new Goose driver init - apps/cli/src/commands/claude-init.ts: use shared resolver + hookCmd() - apps/cli/src/commands/copilot-init.ts: use shared resolver - apps/cli/src/commands/deepagents-init.ts: use shared resolver - apps/cli/src/commands/auto-setup.ts: also runs goose-init - apps/cli/src/bin.ts: register goose-init command + help text Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
343660b to
7eed433
Compare
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
resolveBinary()into shared module — all 4 init commands use identical resolution logic$HOMEfallback instead ofgit rev-parse(fixes broken Stop hook in subrepos)goose-initcommand for Block's Goose CLI (MCP extension integration)auto-setupnow covers Claude Code, Copilot CLI, Goose, and DeepAgentsBinary resolution order (all drivers)
apps/cli/dist/bin.js→node apps/cli/dist/bin.jsnode_modules/.bin/agentguard→ relative pathnode_modules/.bin/aguard→ relative pathagentguard(PATH)Files
apps/cli/src/resolve-binary.tsapps/cli/src/commands/goose-init.tsapps/cli/src/commands/claude-init.tshookCmd()helperapps/cli/src/commands/copilot-init.tsapps/cli/src/commands/deepagents-init.tsapps/cli/src/commands/auto-setup.tsapps/cli/src/bin.tsTest plan
pnpm build— 18/18 packagespnpm test— 856 CLI tests pass (including updated claude-init test)agentguard claude-initin dev repo — verify direct binary pathagentguard auto-setup— verify all drivers attemptedagentguard goose-init— verify config written🤖 Generated with Claude Code