Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.
C aiderastclaude-codecode-analysiscode-intelligencecodexcursorcypherdeveloper-toolsgemini-cligraph-visualizationkilocodeknowledge-graphmcpmcp-servermodel-context-protocolopencodesqlitetree-sitterwindsurf
fix(cli): harden hook diagnostic contract
astandrik00e0cf38d60f
diff --git a/src/cli/config_toml_edit.h b/src/cli/config_toml_edit.hindex 4fa989cf7..4e41a4d9c 100644--- a/src/cli/config_toml_edit.h+++ b/src/cli/config_toml_edit.h@@ -82,7 +82,10 @@ typedef enum {CBM_TOML_CODEX_HOOK_FAILURE_EDIT_BUILD,CBM_TOML_CODEX_HOOK_FAILURE_CONFIG_WRITE} cbm_toml_codex_hook_failure_t;+/* Returns a stable, content-free diagnostic name for a failure category. */const char *cbm_toml_codex_hook_failure_name(cbm_toml_codex_hook_failure_t failure);+/* `failure` may be NULL. When non-NULL, it is reset to NONE on entry and remains+ * NONE on success; failure categories never contain configuration content. */int cbm_toml_reconcile_codex_hooks_detailed(const char *file_path, const char *begin_marker,const char *end_marker, const char *command,const char *command_windows,diff --git a/tests/test_cli.c b/tests/test_cli.cindex 785091263..221eb749c 100644--- a/tests/test_cli.c+++ b/tests/test_cli.c@@ -9326,12 +9326,18 @@ TEST(cli_codex_preflight_reports_heading_and_reason) {snprintf(codex_dir, sizeof(codex_dir), "%s/.codex", tmpdir);snprintf(config_path, sizeof(config_path), "%s/config.toml", codex_dir);snprintf(agents_path, sizeof(agents_path), "%s/AGENTS.md", codex_dir);- test_mkdirp(codex_dir);+ if (test_mkdirp(codex_dir) != 0) {+ test_rmdir_r(tmpdir);+ FAIL("failed to create Codex preflight fixture directory");+ }const char *ambiguous ="[hooks]\nSessionStart = [{ matcher = 'startup|resume|clear|compact', hooks = [""{ type = 'command', command = 'codebase-memory-mcp hook-augment' }, ""{ type = 'command', command = 'foreign' }] }]\n";- write_test_file(config_path, ambiguous);+ if (write_test_file(config_path, ambiguous) != 0) {+ test_rmdir_r(tmpdir);+ FAIL("failed to write Codex preflight fixture config");+ }char *saved_home = save_test_env("HOME");char *saved_path = save_test_env("PATH");