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

Function matchesPiPackage

packages/cli/src/adapters/pi.ts:205–216  ·  view source on GitHub ↗

* Match a Pi packages array entry against our plugin source. * * Pi `packages` entries are sources like: * - "npm:@cortexkit/pi-magic-context" * - "npm:@cortexkit/pi-magic-context@1.0.0" * - { name: "@cortexkit/pi-magic-context", source: "npm:..." } * - "file:/path/to/local/dev" * *

(entry: unknown)

Source from the content-addressed store, hash-verified

203 * entries by design (so dev installs don't get silently overridden).
204 */
205function matchesPiPackage(entry: unknown): boolean {
206 if (typeof entry === "string") {
207 if (entry.startsWith("file:")) return false;
208 return entry.includes(PLUGIN_NAME);
209 }
210 if (entry !== null && typeof entry === "object") {
211 const obj = entry as { name?: unknown; source?: unknown };
212 if (typeof obj.name === "string" && obj.name === PLUGIN_NAME) return true;
213 if (typeof obj.source === "string") return matchesPiPackage(obj.source);
214 }
215 return false;
216}
217
218function ensureDir(filePath: string): void {
219 const dir = dirname(filePath);

Callers 3

hasPluginEntryMethod · 0.85
ensurePluginEntryMethod · 0.85
removePluginEntryMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected