(
dc: &mut DoctorCounters,
plugin_dir: &Path,
policy: CodexBundlePolicy,
home: &Path,
)
| 1335 | } |
| 1336 | |
| 1337 | fn doctor_check_plugin_dir( |
| 1338 | dc: &mut DoctorCounters, |
| 1339 | plugin_dir: &Path, |
| 1340 | policy: CodexBundlePolicy, |
| 1341 | home: &Path, |
| 1342 | ) { |
| 1343 | let manifest_path = plugin_dir.join(".codex-plugin/plugin.json"); |
| 1344 | let manifest = load_json_file(&manifest_path); |
| 1345 | if manifest.get("name").and_then(|value| value.as_str()) == Some("tracedecay") { |
| 1346 | dc.pass(&format!( |
| 1347 | "Codex plugin manifest present in {}", |
| 1348 | manifest_path.display() |
| 1349 | )); |
| 1350 | } else { |
| 1351 | dc.fail(&format!( |
| 1352 | "Codex plugin manifest at {} is not a tracedecay plugin", |
| 1353 | manifest_path.display() |
| 1354 | )); |
| 1355 | } |
| 1356 | match manifest.get("version").and_then(|value| value.as_str()) { |
| 1357 | Some(env!("CARGO_PKG_VERSION")) => dc.pass("Codex plugin version matches tracedecay"), |
| 1358 | Some(version) => dc.warn(&format!( |
| 1359 | "Codex plugin version {version} does not match tracedecay {} — run `tracedecay update-plugin`", |
| 1360 | env!("CARGO_PKG_VERSION") |
| 1361 | )), |
| 1362 | None => dc.warn("Codex plugin manifest does not contain a version"), |
| 1363 | } |
| 1364 | |
| 1365 | let mcp_path = plugin_dir.join(".mcp.json"); |
| 1366 | let mcp = load_json_file(&mcp_path); |
| 1367 | if mcp |
| 1368 | .get("mcpServers") |
| 1369 | .and_then(|servers| servers.get("tracedecay")) |
| 1370 | .is_some() |
| 1371 | { |
| 1372 | dc.pass(&format!( |
| 1373 | "Codex plugin MCP server registered in {}", |
| 1374 | mcp_path.display() |
| 1375 | )); |
| 1376 | } else { |
| 1377 | dc.fail(&format!( |
| 1378 | "Codex plugin MCP server missing in {} — rerun tracedecay Codex install", |
| 1379 | mcp_path.display() |
| 1380 | )); |
| 1381 | } |
| 1382 | let hooks_path = plugin_dir.join("hooks/hooks.json"); |
| 1383 | if let Some(config_path) = policy.hook_trust_config_path(home) { |
| 1384 | doctor_check_hooks(dc, &hooks_path, &config_path); |
| 1385 | } else if hooks_path.exists() { |
| 1386 | dc.warn(&format!( |
| 1387 | "repo-local Codex bundle unexpectedly ships lifecycle hooks in {} — run `tracedecay install --local --agent codex` to refresh it", |
| 1388 | hooks_path.display() |
| 1389 | )); |
| 1390 | } |
| 1391 | } |
| 1392 | |
| 1393 | /// Check hooks.json registers the tracedecay lifecycle hooks, and report Codex |
| 1394 | /// hook trust state from the user-level config. |
no test coverage detected