fix(cli): detect machine-level agent tools, not just project-local (BUG-1156)#783
Merged
Merged
Conversation
…UG-1156) DetectTools() only checked project-local dirs (.codex, .claude, etc.), so a machine with Codex installed but no project-local dirs was invisible to `pad init` — only the force-included Claude skill got installed. Widen detection to OR three signals per tool: project-local dir (existing), a home-relative dir, and a binary on PATH. Machine-level signals are only populated for claude and agents (codex/cursor/windsurf); copilot/amazon-q/ junie keep project-local-only detection since their binaries/dirs are too ambiguous to trust as machine-wide signals.
Collaborator
Author
|
CI note: the Go job failure is the pre-existing gofmt drift on |
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
pad initon a machine with codex installed only ever set up the Claude skill:cli.DetectTools()looked exclusively at project-local directories (.codex,.cursor, …), which don't exist in a fresh project even when the tool is installed machine-wide (~/.codex,codexon PATH). Fixes BUG-1156.DetectTools()now ORs three signals per tool:AgentTool.DetectHomeDirsexec.LookPath— newAgentTool.DetectBinariesMachine-level signals are populated conservatively: only
claude(~/.claude,claude) andagents(~/.codex/.cursor/.windsurf/.agents;codex/cursor/windsurf). Copilot, Amazon Q, and Junie keep project-local-only detection —gh/qbinaries are too ambiguous as install signals.Plus
DetectTools()no longer returns nil onos.Getwd()failure; it degrades to home/PATH signals.ensureSkills,offerSkillInstall,pad agent install/--all/list): each only widens which tools get project-local installs, which is the intended fix.pad agent updategates on existing project-local files and is unaffected.Observable behavior changes
pad init/pad workspace initon a machine with codex (or cursor/windsurf) installed now also writes.agents/skills/pad/SKILL.md.pad agent install --listmarks machine-installed tools as(detected).Test plan
go test ./...full suite green (includes 7 newTestDetectToolssubtests: home-dir hit, PATH-binary hit, no-signal miss, project-local regression, dedup)t.Setenv(HOME/PATH)+t.Chdirtemp dirs (this dev box has~/.codex— naive tests would false-pass)golangci-lint runclean on touched packages (repo-widemake lintfails on pre-existinginternal/models/workspace.gogofmt drift, identical on unmodified main)$HOMEcontaining only.codex, empty project dir →pad agent install --listshows Codex/Cursor/Windsurf(detected)Refs: BUG-1156
https://claude.ai/code/session_01CL1pBjNpPUX6SWkuAuYXHS