(
install_dir: &Path,
tracedecay_bin: &str,
policy: CodexBundlePolicy,
)
| 568 | } |
| 569 | |
| 570 | fn write_codex_plugin_files( |
| 571 | install_dir: &Path, |
| 572 | tracedecay_bin: &str, |
| 573 | policy: CodexBundlePolicy, |
| 574 | ) -> Result<()> { |
| 575 | for (relative, contents) in codex_embedded_plugin_files() { |
| 576 | let rendered = match relative { |
| 577 | ".codex-plugin/plugin.json" => codex_plugin_manifest(contents, policy)?, |
| 578 | ".mcp.json" => codex_plugin_mcp(contents, tracedecay_bin, policy)?, |
| 579 | "hooks/hooks.json" if !policy.include_hooks() => continue, |
| 580 | "hooks/hooks.json" => codex_plugin_hooks(contents, tracedecay_bin)?, |
| 581 | _ => contents.to_string(), |
| 582 | }; |
| 583 | safe_write_text_file(&install_dir.join(relative), &rendered, None)?; |
| 584 | } |
| 585 | Ok(()) |
| 586 | } |
| 587 | |
| 588 | fn codex_plugin_manifest(raw: &str, policy: CodexBundlePolicy) -> Result<String> { |
| 589 | super::plugin_bundle::stamp_manifest_version_with(raw, |manifest| { |
no test coverage detected