MCPcopy Index your code
hub / github.com/anomalyco/opencode / deduplicatePluginOrigins

Function deduplicatePluginOrigins

packages/opencode/src/config/plugin.ts:64–77  ·  view source on GitHub ↗
(plugins: Origin[])

Source from the content-addressed store, hash-verified

62// Dedupe on the load identity (package name for npm specs, exact file URL for local specs), but keep the
63// full Origin so downstream code still knows which config file won and where follow-up writes should go.
64export function deduplicatePluginOrigins(plugins: Origin[]): Origin[] {
65 const seen = new Set<string>()
66 const list: Origin[] = []
67
68 for (const plugin of plugins.toReversed()) {
69 const spec = pluginSpecifier(plugin.spec)
70 const name = spec.startsWith("file://") ? spec : parsePluginSpecifier(spec).pkg
71 if (seen.has(name)) continue
72 seen.add(name)
73 list.push(plugin)
74 }
75
76 return list.toReversed()
77}
78
79export * as ConfigPlugin from "./plugin"

Callers

nothing calls this directly

Calls 4

parsePluginSpecifierFunction · 0.90
pluginSpecifierFunction · 0.85
pushMethod · 0.80
addMethod · 0.65

Tested by

no test coverage detected