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

Function parsePluginSpecifier

packages/opencode/src/plugin/shared.ts:22–34  ·  view source on GitHub ↗
(spec: string)

Source from the content-addressed store, hash-verified

20}
21
22export function parsePluginSpecifier(spec: string) {
23 const hit = parse(spec)
24 if (hit?.type === "alias" && !hit.name) {
25 const sub = (hit as npa.AliasResult).subSpec
26 if (sub?.name) {
27 const version = !sub.rawSpec || sub.rawSpec === "*" ? "latest" : sub.rawSpec
28 return { pkg: sub.name, version }
29 }
30 }
31 if (!hit?.name) return { pkg: spec, version: "" }
32 if (hit.raw === hit.name) return { pkg: hit.name, version: "latest" }
33 return { pkg: hit.name, version: hit.rawSpec }
34}
35
36export type PluginSource = "file" | "npm"
37export type PluginKind = "server" | "tui"

Callers 5

shared.test.tsFile · 0.90
errorFunction · 0.90
patchPluginListFunction · 0.90
entryCoreFunction · 0.90
deduplicatePluginOriginsFunction · 0.90

Calls 1

parseFunction · 0.70

Tested by

no test coverage detected