MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / install_context_server

Function install_context_server

src/agents/zed.rs:102–130  ·  view source on GitHub ↗
(settings_path: &Path, tracedecay_bin: &str)

Source from the content-addressed store, hash-verified

100// ---------------------------------------------------------------------------
101
102fn install_context_server(settings_path: &Path, tracedecay_bin: &str) -> Result<()> {
103 if let Some(parent) = settings_path.parent() {
104 std::fs::create_dir_all(parent).ok();
105 }
106
107 let backup = backup_config_file(settings_path)?;
108 let mut settings = match load_jsonc_file_strict(settings_path) {
109 Ok(v) => v,
110 Err(e) => {
111 if let Some(ref b) = backup {
112 eprintln!(" Backup preserved at: {}", b.display());
113 }
114 return Err(e);
115 }
116 };
117 settings["context_servers"]["tracedecay"] = json!({
118 "command": {
119 "path": tracedecay_bin,
120 "args": ["serve"]
121 }
122 });
123
124 safe_write_json_file(settings_path, &settings, backup.as_deref())?;
125 eprintln!(
126 "\x1b[32m✔\x1b[0m Added tracedecay context server to {}",
127 settings_path.display()
128 );
129 Ok(())
130}
131
132/// Remove context server entry from Zed settings.json.
133/// Does not delete settings.json even if object is otherwise empty.

Callers 2

installMethod · 0.85
install_localMethod · 0.85

Calls 3

backup_config_fileFunction · 0.85
load_jsonc_file_strictFunction · 0.85
safe_write_json_fileFunction · 0.85

Tested by

no test coverage detected