Repository navigation
fix: derive install targets from the lockfile entry - #422
Merged
Merged
Conversation
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.
Closes #407. Closes #346.
A lockfile entry's
agentslist is the record of where a skill lives. Two callers guessed instead, and both put skills somewhere the record did not name:cihardcodedtargets: ['agents'](src/api/ci.js:23) and never readentry.agents. A skill recorded as['claude-code']was reinstalled into~/.agents/skills, the directory twelve agents share — so the skill ended up in two places and the lockfile disagreed with the disk.updatenever readentry.agentsat all;detectTargetsscanned the filesystem withexistsSync. Every alias whose directory happened to hold the skill became its own target, so~/.agents/skillswas written once per alias, and a project-scoped agent produced a global lock entry.Both now go through
targetsFromLockEntryinsrc/utils/lockfile.js, which reproduces the recorded install and collapses aliases by directory. That dedupe rule was already inapi/install.js:40-49— this extends the existing rule rather than inventing one.updatekeeps a filesystem scan as the fallback for entries predating theagentsfield; that fallback is now deduped too.Also switches
installer.jstoresolveAgentfromgetAgentByFlag.getAgentByFlag('claude-code')returns nothing (the flag isclaude), soinstallSkillhitreturn nulland silently dropped the target — which is why the first version of thecitest still failed after targets were derived correctly.resolveAgentwas added for exactly this by #416.Verified end to end:
Two existing assertions encoded the old behaviour and were updated: a project-locked skill expecting
targets: ['agents'], and a test asserting acodexlabel for the shared directory (reported once, asagents— the directory is identical).