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

Function cursor_plugin_hooks

src/agents/cursor.rs:279–299  ·  view source on GitHub ↗
(raw: &str, tracedecay_bin: &str)

Source from the content-addressed store, hash-verified

277}
278
279fn cursor_plugin_hooks(raw: &str, tracedecay_bin: &str) -> Result<String> {
280 let mut hooks: serde_json::Value = serde_json::from_str(raw)?;
281 if let Some(events) = hooks
282 .get_mut("hooks")
283 .and_then(|value| value.as_object_mut())
284 {
285 for entries in events.values_mut().filter_map(|value| value.as_array_mut()) {
286 for entry in entries {
287 if let Some(command_value) = entry.get_mut("command") {
288 let Some(command) = command_value.as_str() else {
289 continue;
290 };
291 if let Some(suffix) = command.strip_prefix("tracedecay ") {
292 *command_value = json!(super::hook_command(tracedecay_bin, suffix));
293 }
294 }
295 }
296 }
297 }
298 Ok(format!("{}\n", serde_json::to_string_pretty(&hooks)?))
299}
300
301fn remove_cursor_plugin_install(install_dir: &Path) -> Result<()> {
302 let Ok(metadata) = std::fs::symlink_metadata(install_dir) else {

Callers 1

write_embedded_pluginFunction · 0.85

Calls 1

as_strMethod · 0.45

Tested by

no test coverage detected