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

Function cbm_upsert_qoder_context_hook

src/cli/cli.c:5000–5043  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4998}
4999
5000static int cbm_upsert_qoder_context_hook(const char *settings_path, const char *binary_path) {
5001 char command[CLI_BUF_8K];
5002 char shell[CLI_BUF_32];
5003 if (cbm_build_qoder_hook_command(binary_path, cbm_current_platform_is_windows(), command,
5004 sizeof(command), shell, sizeof(shell)) != CLI_OK) {
5005 return CLI_ERR;
5006 }
5007 int legacy_result = remove_hooks_json((hooks_remove_args_t){
5008 .settings_path = settings_path,
5009 .hook_event = "UserPromptSubmit",
5010 .match_command_exact = command,
5011 });
5012 int session_result = upsert_hooks_json((hooks_upsert_args_t){
5013 .settings_path = settings_path,
5014 .hook_event = "SessionStart",
5015 .matcher_str = "startup|resume|clear|compact|new",
5016 .command_str = command,
5017 .shell = shell[0] ? shell : NULL,
5018 .timeout_value = CMM_HOOK_TIMEOUT_SEC,
5019 .match_command_exact = command,
5020 });
5021 int subagent_result = upsert_hooks_json((hooks_upsert_args_t){
5022 .settings_path = settings_path,
5023 .hook_event = "SubagentStart",
5024 .matcher_str = "*",
5025 .command_str = command,
5026 .shell = shell[0] ? shell : NULL,
5027 .timeout_value = CMM_HOOK_TIMEOUT_SEC,
5028 .match_command_exact = command,
5029 });
5030 int read_result = upsert_hooks_json((hooks_upsert_args_t){
5031 .settings_path = settings_path,
5032 .hook_event = "PostToolUse",
5033 .matcher_str = "Read",
5034 .command_str = command,
5035 .shell = shell[0] ? shell : NULL,
5036 .timeout_value = CMM_HOOK_TIMEOUT_SEC,
5037 .match_command_exact = command,
5038 });
5039 return legacy_result == CLI_OK && session_result == CLI_OK && subagent_result == CLI_OK &&
5040 read_result == CLI_OK
5041 ? CLI_OK
5042 : CLI_ERR;
5043}
5044
5045static int cbm_remove_qoder_context_hook(const char *settings_path, const char *binary_path) {
5046 char command[CLI_BUF_8K];

Calls 4

remove_hooks_jsonFunction · 0.85
upsert_hooks_jsonFunction · 0.85

Tested by

no test coverage detected