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

Function cbm_cmd_hook_augment

src/cli/hook_augment.c:1405–1439  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1403}
1404
1405int cbm_cmd_hook_augment(int argc, char **argv) {
1406 cbm_hook_augment_arm_deadline();
1407
1408 const char *forced_event = NULL;
1409 ha_lifecycle_dialect_t dialect = HA_DIALECT_EVENT;
1410 for (int i = 0; i < argc; i++) {
1411 if (strcmp(argv[i], "--event") == 0 && i + 1 < argc) {
1412 forced_event = argv[++i];
1413 } else if (strcmp(argv[i], "--dialect") == 0 && i + 1 < argc &&
1414 ha_dialect_from_name(argv[i + 1], &dialect)) {
1415 i++;
1416 } else {
1417 return 0;
1418 }
1419 }
1420 /* Copilot omits the event in stdin and therefore requires --event. Other
1421 * forced events must be documented lifecycle events for their dialect. */
1422 if (!ha_invocation_supported(dialect, forced_event)) {
1423 return 0;
1424 }
1425
1426 char *input = cbm_hook_augment_read_stdin();
1427 if (!input) {
1428 return 0;
1429 }
1430 cbm_mcp_server_t *srv = cbm_mcp_server_new(NULL);
1431 char *output = srv ? ha_process(srv, input, forced_event, dialect) : NULL;
1432 if (output) {
1433 fputs(output, stdout);
1434 }
1435 free(output);
1436 cbm_mcp_server_free(srv);
1437 free(input);
1438 return 0;
1439}
1440
1441const char *cbm_hook_admission_notice(cbm_hook_admission_t reason, const char *hook_dialect) {
1442 /* Only Claude Code (the NULL dialect) consumes a bare stdout JSON object;

Callers 2

handle_subcommandFunction · 0.85
test_cli.cFile · 0.85

Calls 7

ha_dialect_from_nameFunction · 0.85
ha_invocation_supportedFunction · 0.85
cbm_mcp_server_newFunction · 0.85
ha_processFunction · 0.85
cbm_mcp_server_freeFunction · 0.85

Tested by

no test coverage detected