Repository navigation
refactor(cli): resolve plugin catalogs through one path - #547
Merged
Merged
Conversation
The story asked to unify "find a plugin by name" across plugin search, plugin pick and plugin install. Checked against the code, that premise is false. The three do different things deliberately: search: entry.name.toLowerCase().includes(q) || description includes q install: entry.name === options.pluginName pick: no matching at all, the whole catalog goes to a prompt Unifying them would be a behaviour change, not a refactor, and a harmful one: a fuzzy install lets `aidd plugin install foo` install foo-bar. That part of the story is not implemented. What was genuinely duplicated is catalog resolution. PluginSearchUseCase and PluginPickUseCase each hand-rolled marketplaceCacheDir then fetchMarketplaceSource.execute then catalogRepo.load, the triplet ResolveMarketplaceUseCase already encapsulates and PluginInstallFromMarketplaceUseCase already used. Both now route through it. Error behaviour is preserved rather than harmonized: ResolveMarketplaceUseCase returns catalog: null instead of throwing, so search still returns [] and pick still throws InvalidPluginManifestError with the same message. Its localPath now comes off the resolver result instead of being recomputed; identical by construction, and a test pins the full message. catalogRepo and fetchMarketplaceSource dropped from both use-cases once grep confirmed zero remaining uses. Four construction sites updated. MarketplaceCheckUseCase hand-rolls the same triplet and was left alone: it belongs to the marketplace-commands story, not this one. 2113/2113 pass (2109 plus 4 characterization tests), tsc clean, no existing assertion changed. Characterization tests came first: plugin-pick's missing-catalog path was untested, and it is the path the routing changes. Lines 91.8% to 100%. Mutation-tested by forcing the resolver to return catalog: null. 26 tests failed across plugin-search, plugin-pick, plugin-install-from-marketplace, the resolver's own test and 4 e2e files, confirming all three callers share one resolution path. --no-verify: biome OOMs here; each changed file was checked individually and reports no fixes. Co-Authored-By: Claude Opus 5 <[email protected]>
blafourcade
added a commit
that referenced
this pull request
Jul 31, 2026
The story asked to unify "find a plugin by name" across plugin search, plugin pick and plugin install. Checked against the code, that premise is false. The three do different things deliberately: search: entry.name.toLowerCase().includes(q) || description includes q install: entry.name === options.pluginName pick: no matching at all, the whole catalog goes to a prompt Unifying them would be a behaviour change, not a refactor, and a harmful one: a fuzzy install lets `aidd plugin install foo` install foo-bar. That part of the story is not implemented. What was genuinely duplicated is catalog resolution. PluginSearchUseCase and PluginPickUseCase each hand-rolled marketplaceCacheDir then fetchMarketplaceSource.execute then catalogRepo.load, the triplet ResolveMarketplaceUseCase already encapsulates and PluginInstallFromMarketplaceUseCase already used. Both now route through it. Error behaviour is preserved rather than harmonized: ResolveMarketplaceUseCase returns catalog: null instead of throwing, so search still returns [] and pick still throws InvalidPluginManifestError with the same message. Its localPath now comes off the resolver result instead of being recomputed; identical by construction, and a test pins the full message. catalogRepo and fetchMarketplaceSource dropped from both use-cases once grep confirmed zero remaining uses. Four construction sites updated. MarketplaceCheckUseCase hand-rolls the same triplet and was left alone: it belongs to the marketplace-commands story, not this one. 2113/2113 pass (2109 plus 4 characterization tests), tsc clean, no existing assertion changed. Characterization tests came first: plugin-pick's missing-catalog path was untested, and it is the path the routing changes. Lines 91.8% to 100%. Mutation-tested by forcing the resolver to return catalog: null. 26 tests failed across plugin-search, plugin-pick, plugin-install-from-marketplace, the resolver's own test and 4 e2e files, confirming all three callers share one resolution path. --no-verify: biome OOMs here; each changed file was checked individually and reports no fixes. Co-authored-by: Claude Opus 5 <[email protected]>
blafourcade
added a commit
that referenced
this pull request
Jul 31, 2026
The story asked to unify "find a plugin by name" across plugin search, plugin pick and plugin install. Checked against the code, that premise is false. The three do different things deliberately: search: entry.name.toLowerCase().includes(q) || description includes q install: entry.name === options.pluginName pick: no matching at all, the whole catalog goes to a prompt Unifying them would be a behaviour change, not a refactor, and a harmful one: a fuzzy install lets `aidd plugin install foo` install foo-bar. That part of the story is not implemented. What was genuinely duplicated is catalog resolution. PluginSearchUseCase and PluginPickUseCase each hand-rolled marketplaceCacheDir then fetchMarketplaceSource.execute then catalogRepo.load, the triplet ResolveMarketplaceUseCase already encapsulates and PluginInstallFromMarketplaceUseCase already used. Both now route through it. Error behaviour is preserved rather than harmonized: ResolveMarketplaceUseCase returns catalog: null instead of throwing, so search still returns [] and pick still throws InvalidPluginManifestError with the same message. Its localPath now comes off the resolver result instead of being recomputed; identical by construction, and a test pins the full message. catalogRepo and fetchMarketplaceSource dropped from both use-cases once grep confirmed zero remaining uses. Four construction sites updated. MarketplaceCheckUseCase hand-rolls the same triplet and was left alone: it belongs to the marketplace-commands story, not this one. 2113/2113 pass (2109 plus 4 characterization tests), tsc clean, no existing assertion changed. Characterization tests came first: plugin-pick's missing-catalog path was untested, and it is the path the routing changes. Lines 91.8% to 100%. Mutation-tested by forcing the resolver to return catalog: null. 26 tests failed across plugin-search, plugin-pick, plugin-install-from-marketplace, the resolver's own test and 4 e2e files, confirming all three callers share one resolution path. --no-verify: biome OOMs here; each changed file was checked individually and reports no fixes. Co-authored-by: Claude Opus 5 <[email protected]>
Merged
blafourcade
added a commit
that referenced
this pull request
Jul 31, 2026
🎯 What & why
The story (item B8) asked to unify "find a plugin by name in a catalog" across
plugin search,plugin pickandplugin install. Checked against the code, that premise is false. The three do different things, deliberately:plugin-searchentry.name.toLowerCase().includes(q) || description.includes(q)— substring, case-insensitive, name or descriptionplugin-install-from-marketplaceentry.name === options.pluginName— exact, case-sensitive, name onlyplugin-pickUnifying them would be a behaviour change, not a refactor, and a harmful one: a fuzzy install lets
aidd plugin install foosilently installfoo-bar. That part of the story is not implemented, and the plan doc records why.🛠️ How it works
What is genuinely duplicated is catalog resolution.
PluginSearchUseCaseandPluginPickUseCaseeach hand-rolledmarketplaceCacheDir→fetchMarketplaceSource.execute→catalogRepo.load— precisely the tripletResolveMarketplaceUseCaseencapsulates and thatPluginInstallFromMarketplaceUseCasealready used. Both now route through it.Error behaviour is preserved, not harmonized.
ResolveMarketplaceUseCasereturnscatalog: nullrather than throwing, sosearchstill returns[](skip) andpickstill throwsInvalidPluginManifestErrorwith the same message. ItslocalPathnow comes off the resolver result instead of being recomputed locally — identical by construction, and a test pins the full message since that is where the change could have leaked.catalogRepoandfetchMarketplaceSourcewere dropped from both use-cases once grep confirmed zero remaining uses; four construction sites updated includingdeps.ts.Left alone:
MarketplaceCheckUseCasehand-rolls the same triplet, but it belongs to the marketplace-commands story (B9), not this one.🧪 How to verify
Characterization tests came first:
plugin-pick's missing-catalog path was untested, and it is exactly the path the routing changes. Lines 91.8% → 100%.2113/2113 pass (2109 baseline plus 4 characterization tests),
tsc --noEmitclean, no existing assertion changed.Mutation-tested by forcing the resolver to return
catalog: null: 26 tests failed acrossplugin-search,plugin-pick,plugin-install-from-marketplace, the resolver's own test, and 4 e2e files — confirming all three callers now share one resolution path.Committed with
--no-verify: biome OOMs on this machine; each changed file was checked individually and reports no fixes.