Resolve only the exact command form shipped before hook paths were shell * quoted. This is an ownership identity for upgrade/uninstall, never a command * that new installations write. */
| 2725 | * quoted. This is an ownership identity for upgrade/uninstall, never a command |
| 2726 | * that new installations write. */ |
| 2727 | static int cbm_resolve_released_hook_command(const char *script_name, char *out, size_t out_sz) { |
| 2728 | if (!script_name || !script_name[0] || !out || out_sz == 0U) { |
| 2729 | return CLI_ERR; |
| 2730 | } |
| 2731 | char env_buf[CLI_BUF_1K]; |
| 2732 | const char *env = cbm_safe_getenv("CLAUDE_CONFIG_DIR", env_buf, sizeof(env_buf), NULL); |
| 2733 | int written = env && env[0] ? snprintf(out, out_sz, "%s/hooks/%s", env, script_name) |
| 2734 | : snprintf(out, out_sz, "~/.claude/hooks/%s", script_name); |
| 2735 | return written > 0 && (size_t)written < out_sz ? CLI_OK : CLI_ERR; |
| 2736 | } |
| 2737 | |
| 2738 | cbm_detected_agents_t cbm_detect_agents(const char *home_dir) { |
| 2739 | cbm_detected_agents_t agents; |
no test coverage detected