MCPcopy
hub / github.com/dataelement/Clawith / _materialize_storage_entry

Function _materialize_storage_entry

backend/app/services/agent_tools.py:2380–2391  ·  view source on GitHub ↗
(storage, entry_key: str, root_key: str, local_root: Path)

Source from the content-addressed store, hash-verified

2378
2379
2380async def _materialize_storage_entry(storage, entry_key: str, root_key: str, local_root: Path) -> None:
2381 rel = entry_key.removeprefix(root_key.rstrip("/") + "/")
2382 target = (local_root / rel).resolve()
2383 if not str(target).startswith(str(local_root.resolve())):
2384 return
2385 if await storage.is_dir(entry_key):
2386 target.mkdir(parents=True, exist_ok=True)
2387 for child in await storage.list_dir(entry_key):
2388 await _materialize_storage_entry(storage, child.key, root_key, local_root)
2389 return
2390 target.parent.mkdir(parents=True, exist_ok=True)
2391 target.write_bytes(await storage.read_bytes(entry_key))
2392
2393
2394async def _prepare_temp_workspace(

Callers 1

Calls 4

is_dirMethod · 0.45
list_dirMethod · 0.45
write_bytesMethod · 0.45
read_bytesMethod · 0.45

Tested by

no test coverage detected