Resolve the parent dir containing `.claude.json` (Claude Code's user config file). * Honors $CLAUDE_CONFIG_DIR; falls back to "$home_dir". */
| 1136 | /* Resolve the parent dir containing `.claude.json` (Claude Code's user config file). |
| 1137 | * Honors $CLAUDE_CONFIG_DIR; falls back to "$home_dir". */ |
| 1138 | static void cbm_claude_user_root(const char *home_dir, char *out, size_t out_sz) { |
| 1139 | if (out_sz == 0) { |
| 1140 | return; |
| 1141 | } |
| 1142 | out[0] = '\0'; |
| 1143 | char env_buf[CLI_BUF_1K]; |
| 1144 | const char *env = cbm_safe_getenv("CLAUDE_CONFIG_DIR", env_buf, sizeof(env_buf), NULL); |
| 1145 | if (env && env[0]) { |
| 1146 | snprintf(out, out_sz, "%s", env); |
| 1147 | } else if (home_dir && home_dir[0]) { |
| 1148 | snprintf(out, out_sz, "%s", home_dir); |
| 1149 | } |
| 1150 | } |
| 1151 | |
| 1152 | /* Build the hook command string written into Claude Code's settings.json. |
| 1153 | * Honors $CLAUDE_CONFIG_DIR. When CLAUDE_CONFIG_DIR is unset, preserves the |
no test coverage detected