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. */
| 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. */ |
| 1155 | static 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 | |
| 1169 | cbm_detected_agents_t cbm_detect_agents(const char *home_dir) { |
| 1170 | cbm_detected_agents_t agents; |
no test coverage detected