MCPcopy
hub / github.com/coder/mux / resolveStore

Method resolveStore

src/node/services/memoryService.ts:601–615  ·  view source on GitHub ↗

* Resolve a parsed path to its store with containment verified. * createRoot is reserved for commands that can create files (create, UI * save): everything else must not materialize scope roots. Missing roots * simply make targets report "not found".

(
    ctx: MemoryScopeContext,
    scope: MemoryScope,
    relPath: string,
    opts?: { createRoot?: boolean }
  )

Source from the content-addressed store, hash-verified

599 * simply make targets report "not found".
600 */
601 private async resolveStore(
602 ctx: MemoryScopeContext,
603 scope: MemoryScope,
604 relPath: string,
605 opts?: { createRoot?: boolean }
606 ): Promise<MemoryStore> {
607 const store = this.getStore(ctx, scope);
608 if (opts?.createRoot) {
609 await store.ensureRoot();
610 } else {
611 await store.assertRootSafe();
612 }
613 await store.assertContained(relPath);
614 return store;
615 }
616
617 private requireFilePath(parsed: ParsedMemoryPath, virtualPath: string): MemoryScope {
618 if (parsed.scope === null || parsed.relPath === "") {

Callers 8

viewMethod · 0.95
createMethod · 0.95
strReplaceMethod · 0.95
insertMethod · 0.95
deletePathMethod · 0.95
renameMethod · 0.95
readFileWithShaMethod · 0.95
saveFileMethod · 0.95

Calls 4

getStoreMethod · 0.95
ensureRootMethod · 0.65
assertRootSafeMethod · 0.65
assertContainedMethod · 0.65

Tested by

no test coverage detected