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

Function cbm_upsert_qwen_lifecycle_hooks

src/cli/cli.c:6324–6351  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6322 const char *canonical_command);
6323
6324static int cbm_upsert_qwen_lifecycle_hooks(const char *settings_path, const char *binary_path,
6325 bool windows) {
6326 char command[CLI_BUF_8K];
6327 char released_command[CLI_BUF_8K];
6328 char shell[CLI_BUF_32];
6329 if (cbm_build_qwen_hook_command(binary_path, windows, command, sizeof(command), shell,
6330 sizeof(shell)) != CLI_OK ||
6331 (windows ? cbm_build_augment_command_windows(binary_path, released_command,
6332 sizeof(released_command))
6333 : cbm_build_augment_command(binary_path, released_command,
6334 sizeof(released_command))) != CLI_OK) {
6335 return CLI_ERR;
6336 }
6337 int legacy_result = cbm_remove_paired_lifecycle_hooks_json(settings_path, released_command);
6338 int lifecycle_result = cbm_upsert_paired_lifecycle_hooks_json(settings_path, command, NULL,
6339 shell, GEMINI_HOOK_TIMEOUT_MS);
6340 int read_result = upsert_hooks_json((hooks_upsert_args_t){
6341 .settings_path = settings_path,
6342 .hook_event = "PostToolUse",
6343 .matcher_str = "ReadFile",
6344 .command_str = command,
6345 .shell = shell[0] ? shell : NULL,
6346 .timeout_value = GEMINI_HOOK_TIMEOUT_MS,
6347 .match_command_exact = command,
6348 });
6349 return legacy_result == CLI_OK && lifecycle_result == CLI_OK && read_result == CLI_OK ? CLI_OK
6350 : CLI_ERR;
6351}
6352
6353#ifdef CBM_CLI_ENABLE_TEST_API
6354int cbm_upsert_qwen_lifecycle_hooks_for_testing(const char *settings_path, const char *binary_path,

Tested by

no test coverage detected