MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / provision_sandbox

Method provision_sandbox

atomic-repository/src/repository/sandbox.rs:203–220  ·  view source on GitHub ↗

Provision an agent's private working tree as a copy-on-write clone of this repository's working tree. Copies every tracked-or-untracked working file into `dest`, reflinking where the filesystem supports it (so unchanged blocks are shared on disk) and falling back to a plain copy otherwise. The `.atomic/` directory is **never** cloned — the sandbox shares the canonical graph via [`Repository::open

(
        &self,
        dest: P,
        view: &str,
    )

Source from the content-addressed store, hash-verified

201 /// commands run inside the sandbox resolve to this repository's canonical
202 /// graph and the given `view`.
203 pub fn provision_sandbox<P: AsRef<Path>>(
204 &self,
205 dest: P,
206 view: &str,
207 ) -> Result<usize, RepositoryError> {
208 let dest = dest.as_ref();
209 let count = provision_working_tree(&self.root, dest)?;
210
211 let pointer = SandboxPointer {
212 canonical: self.root.clone(),
213 view: view.to_string(),
214 };
215 let bytes = serde_json::to_vec_pretty(&pointer)
216 .map_err(|e| RepositoryError::Database(e.to_string()))?;
217 std::fs::write(dest.join(SANDBOX_POINTER), bytes)?;
218
219 Ok(count)
220 }
221
222 /// Materialize a view's visible file content into `dir` (created if needed).
223 ///

Calls 4

provision_working_treeFunction · 0.85
writeFunction · 0.85
as_refMethod · 0.80
cloneMethod · 0.45