MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / cbm_resolve_hook_command

Function cbm_resolve_hook_command

src/cli/cli.c:1155–1167  ·  view source on GitHub ↗

Build the hook command string written into Claude Code's settings.json. * Honors $CLAUDE_CONFIG_DIR. When CLAUDE_CONFIG_DIR is unset, preserves the * legacy tilde-expanded form so settings.json stays portable across HOME values. */

Source from the content-addressed store, hash-verified

1153 * Honors $CLAUDE_CONFIG_DIR. When CLAUDE_CONFIG_DIR is unset, preserves the
1154 * legacy tilde-expanded form so settings.json stays portable across HOME values. */
1155static void cbm_resolve_hook_command(const char *script_name, char *out, size_t out_sz) {
1156 if (out_sz == 0) {
1157 return;
1158 }
1159 out[0] = '\0';
1160 char env_buf[CLI_BUF_1K];
1161 const char *env = cbm_safe_getenv("CLAUDE_CONFIG_DIR", env_buf, sizeof(env_buf), NULL);
1162 if (env && env[0]) {
1163 snprintf(out, out_sz, "%s/hooks/%s", env, script_name);
1164 } else {
1165 snprintf(out, out_sz, "~/.claude/hooks/%s", script_name);
1166 }
1167}
1168
1169cbm_detected_agents_t cbm_detect_agents(const char *home_dir) {
1170 cbm_detected_agents_t agents;

Callers 3

cbm_upsert_claude_hooksFunction · 0.85
cbm_upsert_session_hooksFunction · 0.85

Calls 1

cbm_safe_getenvFunction · 0.85

Tested by

no test coverage detected