MCPcopy Index your code
hub / github.com/AI45Lab/Code / patch_file

Method patch_file

sdk/node/src/lib.rs:3785–3793  ·  view source on GitHub ↗
(&self, path: String, diff: String)

Source from the content-addressed store, hash-verified

3783 /// Apply a unified diff patch to a workspace file.
3784 #[napi]
3785 pub async fn patch_file(&self, path: String, diff: String) -> napi::Result<ToolResult> {
3786 let session = self.inner.clone();
3787 let result = get_runtime()
3788 .spawn(async move { session.patch_file(&path, &diff).await })
3789 .await
3790 .map_err(|e| napi::Error::from_reason(format!("Task join error: {e}")))?
3791 .map_err(|e| napi::Error::from_reason(format!("{e}")))?;
3792 Ok(tool_result_from_core(result))
3793 }
3794
3795 /// Execute a bash command in the workspace.
3796 #[napi]

Callers

nothing calls this directly

Calls 4

tool_result_from_coreFunction · 0.85
get_runtimeFunction · 0.70
cloneMethod · 0.45
spawnMethod · 0.45

Tested by

no test coverage detected