MCPcopy Create free account
hub / github.com/CreminiAI/skillpack / readEntryFile

Function readEntryFile

src/runtime/registry.ts:106–135  ·  view source on GitHub ↗
(filePath: string)

Source from the content-addressed store, hash-verified

104}
105
106function readEntryFile(filePath: string): RegistryEntry | null {
107 try {
108 const raw = fs.readFileSync(filePath, "utf-8");
109 const data = JSON.parse(raw) as Partial<RegistryEntry>;
110 if (
111 typeof data?.dir !== "string" ||
112 typeof data?.name !== "string" ||
113 typeof data?.version !== "string" ||
114 typeof data?.port !== "number" ||
115 (typeof data?.pid !== "number" && data?.pid !== null) ||
116 (data?.status !== "running" && data?.status !== "stopped")
117 ) {
118 return null;
119 }
120
121 return {
122 dir: canonicalizeDir(data.dir),
123 name: data.name,
124 version: data.version,
125 port: data.port,
126 pid: data.pid,
127 status: data.status,
128 startedAt: data.startedAt,
129 stoppedAt: data.stoppedAt,
130 updatedAt: data.updatedAt,
131 };
132 } catch {
133 return null;
134 }
135}
136
137function createTmpPath(entryPath: string): string {
138 const suffix = `${process.pid}.${Date.now()}.${Math.random().toString(16).slice(2)}`;

Callers 2

readEntryFunction · 0.85
readAllFunction · 0.85

Calls 2

canonicalizeDirFunction · 0.85
parseMethod · 0.80

Tested by

no test coverage detected