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

Function main_run_hook_frontend

src/main.c:1694–1720  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1692}
1693
1694static int main_run_hook_frontend(cbm_daemon_runtime_client_t *client, const char *hook_event,
1695 const char *hook_dialect) {
1696 char *input = cbm_hook_augment_read_stdin();
1697 if (!input) {
1698 return 0;
1699 }
1700 char *hook_cwd = main_hook_cwd(input);
1701 bool context_set =
1702 main_set_client_context(client, hook_cwd, CBM_MCP_TOOL_PROFILE_ALL, hook_event,
1703 hook_dialect, MAIN_HOOK_CONNECT_TIMEOUT_MS);
1704 free(hook_cwd);
1705 if (!context_set) {
1706 free(input);
1707 return 0;
1708 }
1709 uint8_t *response = NULL;
1710 uint32_t response_length = 0;
1711 cbm_daemon_runtime_application_status_t status = cbm_daemon_application_client_hook_augment(
1712 client, input, &response, &response_length, MAIN_HOOK_REQUEST_TIMEOUT_MS);
1713 free(input);
1714 if (status == CBM_DAEMON_RUNTIME_APPLICATION_OK && response && response_length > 0) {
1715 (void)fwrite(response, 1, response_length, stdout);
1716 (void)fflush(stdout);
1717 }
1718 free(response);
1719 return 0; /* hooks always fail open */
1720}
1721
1722static bool main_hook_options(int argc, char **argv, const char **event_out,
1723 const char **dialect_out) {

Callers 1

mainFunction · 0.85

Calls 4

main_hook_cwdFunction · 0.85
main_set_client_contextFunction · 0.85

Tested by

no test coverage detected