MCPcopy Create free account
hub / github.com/cortexkit/magic-context / matchesPluginEntry

Function matchesPluginEntry

packages/cli/src/adapters/opencode.ts:277–287  ·  view source on GitHub ↗
(entry: unknown, pkgName: string)

Source from the content-addressed store, hash-verified

275 * Exported for reuse across setup and doctor flows.
276 */
277export function matchesPluginEntry(entry: unknown, pkgName: string): boolean {
278 let candidate: string | null = null;
279 if (typeof entry === "string") candidate = entry;
280 else if (Array.isArray(entry) && typeof entry[0] === "string") candidate = entry[0];
281 if (!candidate) return false;
282 if (candidate.startsWith("file://")) return false;
283 // Strip version tag: "@cortexkit/foo@latest" → "@cortexkit/foo"
284 const at = candidate.lastIndexOf("@");
285 const head = at > 0 ? candidate.slice(0, at) : candidate;
286 return head === pkgName;
287}
288
289function ensureDir(filePath: string): void {
290 const dir = dirname(filePath);

Callers 7

runDoctorFunction · 0.90
addPluginToTuiConfigFunction · 0.90
findDcpPluginIndexesFunction · 0.90
hasPluginEntryMethod · 0.85
ensurePluginEntryMethod · 0.85
removePluginEntryMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected