(raw: &str, tracedecay_bin: &str, policy: CodexBundlePolicy)
| 596 | } |
| 597 | |
| 598 | fn codex_plugin_mcp(raw: &str, tracedecay_bin: &str, policy: CodexBundlePolicy) -> Result<String> { |
| 599 | // Reuse the shared command rewrite, then layer the policy's args/env on |
| 600 | // top of the result. |
| 601 | let stamped = super::plugin_bundle::set_mcp_command(raw, tracedecay_bin)?; |
| 602 | let mut mcp: serde_json::Value = serde_json::from_str(&stamped)?; |
| 603 | let server = &mut mcp["mcpServers"]["tracedecay"]; |
| 604 | server["args"] = policy.mcp_args(); |
| 605 | match policy.mcp_env() { |
| 606 | Some(env) => server["env"] = env, |
| 607 | None => { |
| 608 | if let Some(object) = server.as_object_mut() { |
| 609 | object.remove("env"); |
| 610 | } |
| 611 | } |
| 612 | } |
| 613 | Ok(format!("{}\n", serde_json::to_string_pretty(&mcp)?)) |
| 614 | } |
| 615 | |
| 616 | /// A lifecycle hook the Codex plugin registers. |
| 617 | struct CodexManagedHook { |
no test coverage detected