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

Function cbm_upsert_claude_subagent_hooks

src/cli/cli.c:5344–5376  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5342}
5343
5344int cbm_upsert_claude_subagent_hooks(const char *settings_path) {
5345 char command[CLI_BUF_8K];
5346 char previous_command[CLI_BUF_8K];
5347 char released_command[CLI_BUF_8K];
5348 char previous_legacy_command[CLI_BUF_8K];
5349 char released_legacy_command[CLI_BUF_8K];
5350 if (cbm_resolve_hook_command(CMM_SUBAGENT_REMINDER_SCRIPT, command, sizeof(command)) !=
5351 CLI_OK ||
5352 cbm_resolve_previous_hook_command(CMM_SUBAGENT_REMINDER_SCRIPT, previous_command,
5353 sizeof(previous_command)) != CLI_OK ||
5354 cbm_resolve_released_hook_command(CMM_SUBAGENT_REMINDER_SCRIPT, released_command,
5355 sizeof(released_command)) != CLI_OK ||
5356 cbm_resolve_previous_hook_command(CMM_SUBAGENT_REMINDER_SCRIPT_LEGACY,
5357 previous_legacy_command,
5358 sizeof(previous_legacy_command)) != CLI_OK ||
5359 cbm_resolve_released_hook_command(CMM_SUBAGENT_REMINDER_SCRIPT_LEGACY,
5360 released_legacy_command,
5361 sizeof(released_legacy_command)) != CLI_OK) {
5362 return CLI_ERR;
5363 }
5364 const char *const old_commands[] = {released_command, previous_command, released_legacy_command,
5365 previous_legacy_command, NULL};
5366 /* matcher "*" is the natural choice a user would also pick for their own
5367 * catch-all SubagentStart hook, so claim ownership by command too — never
5368 * clobber or remove a foreign "*" entry. */
5369 return upsert_hooks_json((hooks_upsert_args_t){.settings_path = settings_path,
5370 .hook_event = "SubagentStart",
5371 .matcher_str = "*",
5372 .command_str = command,
5373 .old_commands = old_commands,
5374 .timeout_value = CMM_HOOK_TIMEOUT_SEC,
5375 .match_command_exact = command});
5376}
5377
5378int cbm_remove_claude_subagent_hooks(const char *settings_path) {
5379 char command[CLI_BUF_8K];

Callers 2

test_cli.cFile · 0.85

Tested by

no test coverage detected