(marketplace_path: &Path, label: &str)
| 1034 | } |
| 1035 | |
| 1036 | fn remove_codex_marketplace_entry_at(marketplace_path: &Path, label: &str) -> Result<()> { |
| 1037 | if !marketplace_path.exists() { |
| 1038 | return Ok(()); |
| 1039 | } |
| 1040 | let mut marketplace = load_json_file_strict(marketplace_path)?; |
| 1041 | let Some(plugins) = marketplace |
| 1042 | .get_mut("plugins") |
| 1043 | .and_then(|value| value.as_array_mut()) |
| 1044 | else { |
| 1045 | return Ok(()); |
| 1046 | }; |
| 1047 | let before = plugins.len(); |
| 1048 | plugins.retain(|entry| { |
| 1049 | !matches!( |
| 1050 | entry.get("name").and_then(|value| value.as_str()), |
| 1051 | Some("tracedecay") |
| 1052 | ) |
| 1053 | }); |
| 1054 | if plugins.len() == before { |
| 1055 | return Ok(()); |
| 1056 | } |
| 1057 | safe_write_json_file(marketplace_path, &marketplace, None)?; |
| 1058 | eprintln!( |
| 1059 | "\x1b[32m✔\x1b[0m Removed tracedecay from Codex {label} marketplace at {}", |
| 1060 | marketplace_path.display() |
| 1061 | ); |
| 1062 | Ok(()) |
| 1063 | } |
| 1064 | |
| 1065 | /// Insert (or reconcile) the tracedecay-owned matcher group for `event`. |
| 1066 | /// |
no test coverage detected