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

Function writeRegistry

src/runtime/registry.ts:241–261  ·  view source on GitHub ↗
(data: RegistryData)

Source from the content-addressed store, hash-verified

239 * entrypoint. It now rewrites the registry directory to match the provided set.
240 */
241export function writeRegistry(data: RegistryData): void {
242 ensureRegistryReady();
243
244 const nextPaths = new Set<string>();
245 for (const pack of data.packs) {
246 const normalized: RegistryEntry = {
247 ...pack,
248 dir: canonicalizeDir(pack.dir),
249 updatedAt: pack.updatedAt ?? new Date().toISOString(),
250 };
251 const entryPath = getEntryPathForCanonicalDir(normalized.dir);
252 nextPaths.add(entryPath);
253 writeEntryFile(normalized);
254 }
255
256 for (const existingPath of listEntryFiles()) {
257 if (!nextPaths.has(existingPath)) {
258 fs.unlinkSync(existingPath);
259 }
260 }
261}
262
263// ---------------------------------------------------------------------------
264// Public API

Callers

nothing calls this directly

Calls 5

ensureRegistryReadyFunction · 0.85
canonicalizeDirFunction · 0.85
writeEntryFileFunction · 0.85
listEntryFilesFunction · 0.85

Tested by

no test coverage detected