MCPcopy Index your code
hub / github.com/codeaashu/claude-code / areSourcesEqual

Function areSourcesEqual

src/utils/plugins/marketplaceHelpers.ts:191–223  ·  view source on GitHub ↗

* Compare two MarketplaceSource objects for equality. * Sources are equal if they have the same type and all relevant fields match.

(a: MarketplaceSource, b: MarketplaceSource)

Source from the content-addressed store, hash-verified

189 * Sources are equal if they have the same type and all relevant fields match.
190 */
191function areSourcesEqual(a: MarketplaceSource, b: MarketplaceSource): boolean {
192 if (a.source !== b.source) return false
193
194 switch (a.source) {
195 case 'url':
196 return a.url === (b as typeof a).url
197 case 'github':
198 return (
199 a.repo === (b as typeof a).repo &&
200 (a.ref || undefined) === ((b as typeof a).ref || undefined) &&
201 (a.path || undefined) === ((b as typeof a).path || undefined)
202 )
203 case 'git':
204 return (
205 a.url === (b as typeof a).url &&
206 (a.ref || undefined) === ((b as typeof a).ref || undefined) &&
207 (a.path || undefined) === ((b as typeof a).path || undefined)
208 )
209 case 'npm':
210 return a.package === (b as typeof a).package
211 case 'file':
212 return a.path === (b as typeof a).path
213 case 'directory':
214 return a.path === (b as typeof a).path
215 case 'settings':
216 return (
217 a.name === (b as typeof a).name &&
218 isEqual(a.plugins, (b as typeof a).plugins)
219 )
220 default:
221 return false
222 }
223}
224
225/**
226 * Extract the host/domain from a marketplace source.

Callers 1

isSourceAllowedByPolicyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected