MCPcopy Create free account
hub / github.com/AI45Lab/Code / save_to_dir

Method save_to_dir

core/src/tools/artifacts.rs:111–124  ·  view source on GitHub ↗
(&self, dir: impl AsRef<Path>)

Source from the content-addressed store, hash-verified

109 }
110
111 pub fn save_to_dir(&self, dir: impl AsRef<Path>) -> Result<()> {
112 let dir = dir.as_ref();
113 std::fs::create_dir_all(dir)
114 .with_context(|| format!("failed to create artifact directory '{}'", dir.display()))?;
115 let snapshot = ArtifactStoreSnapshot {
116 artifacts: self.ordered_artifacts(),
117 };
118 let json = serde_json::to_string_pretty(&snapshot)
119 .context("failed to serialize artifact store snapshot")?;
120 let path = artifact_manifest_path(dir);
121 std::fs::write(&path, json)
122 .with_context(|| format!("failed to write artifact manifest '{}'", path.display()))?;
123 Ok(())
124 }
125
126 pub fn load_from_dir(dir: impl AsRef<Path>) -> Result<Self> {
127 Self::load_from_dir_with_limits(dir, ArtifactStoreLimits::default())

Callers 2

save_artifactsMethod · 0.80

Calls 5

artifact_manifest_pathFunction · 0.85
writeFunction · 0.85
with_contextMethod · 0.80
ordered_artifactsMethod · 0.80
contextMethod · 0.80