Check hooks.json registers the tracedecay lifecycle hooks, and report Codex hook trust state from the user-level config.
(dc: &mut DoctorCounters, hooks_path: &Path, config_path: &Path)
| 1393 | /// Check hooks.json registers the tracedecay lifecycle hooks, and report Codex |
| 1394 | /// hook trust state from the user-level config. |
| 1395 | fn doctor_check_hooks(dc: &mut DoctorCounters, hooks_path: &Path, config_path: &Path) { |
| 1396 | if !hooks_path.exists() { |
| 1397 | dc.warn(&format!( |
| 1398 | "{} not found — run `tracedecay install --agent codex` to add lifecycle hooks", |
| 1399 | hooks_path.display() |
| 1400 | )); |
| 1401 | return; |
| 1402 | } |
| 1403 | let hooks = super::load_json_file(hooks_path); |
| 1404 | let missing: Vec<&str> = CODEX_MANAGED_HOOKS |
| 1405 | .iter() |
| 1406 | .filter_map(|hook| { |
| 1407 | (!codex_hook_present(&hooks, hook.event, hook.subcommand)).then_some(hook.event) |
| 1408 | }) |
| 1409 | .collect(); |
| 1410 | if !missing.is_empty() { |
| 1411 | dc.warn(&format!( |
| 1412 | "tracedecay hook(s) missing for {} in {} — run `tracedecay install --agent codex`", |
| 1413 | missing.join(", "), |
| 1414 | hooks_path.display(), |
| 1415 | )); |
| 1416 | return; |
| 1417 | } |
| 1418 | |
| 1419 | dc.pass(&format!( |
| 1420 | "All {} Codex lifecycle hooks registered in {}", |
| 1421 | CODEX_MANAGED_HOOKS.len(), |
| 1422 | hooks_path.display() |
| 1423 | )); |
| 1424 | match load_toml_file(config_path) { |
| 1425 | Ok(config) => match codex_plugin_hook_trust_state(&config) { |
| 1426 | CodexHookTrustState::Trusted => dc.info(&format!( |
| 1427 | "Codex hook trust entries recorded in {} — trust is pinned to hook content, so if hooks changed since trusting (e.g. after update-plugin), run /hooks in Codex to re-trust", |
| 1428 | config_path.display() |
| 1429 | )), |
| 1430 | CodexHookTrustState::Missing(missing) => dc.info(&format!( |
| 1431 | "Codex skips new/changed command hooks until trusted — missing trust for {} in {}; run `/hooks` in Codex", |
| 1432 | missing.join(", "), |
| 1433 | config_path.display() |
| 1434 | )), |
| 1435 | }, |
| 1436 | Err(_) => dc.info( |
| 1437 | "Codex skips new/changed command hooks until trusted — run `/hooks` in Codex to trust the tracedecay hooks", |
| 1438 | ), |
| 1439 | } |
| 1440 | } |
| 1441 | |
| 1442 | /// Suggests turning off Codex's native memories *injection* when tracedecay's |
| 1443 | /// fact-store injection is active, so the model does not receive two parallel |
no test coverage detected