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:5569–5596  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5567 const char *canonical_command);
5568
5569static int cbm_upsert_qwen_lifecycle_hooks(const char *settings_path, const char *binary_path,
5570 bool windows) {
5571 char command[CLI_BUF_8K];
5572 char released_command[CLI_BUF_8K];
5573 char shell[CLI_BUF_32];
5574 if (cbm_build_qwen_hook_command(binary_path, windows, command, sizeof(command), shell,
5575 sizeof(shell)) != CLI_OK ||
5576 (windows ? cbm_build_augment_command_windows(binary_path, released_command,
5577 sizeof(released_command))
5578 : cbm_build_augment_command(binary_path, released_command,
5579 sizeof(released_command))) != CLI_OK) {
5580 return CLI_ERR;
5581 }
5582 int legacy_result = cbm_remove_paired_lifecycle_hooks_json(settings_path, released_command);
5583 int lifecycle_result = cbm_upsert_paired_lifecycle_hooks_json(settings_path, command, NULL,
5584 shell, GEMINI_HOOK_TIMEOUT_MS);
5585 int read_result = upsert_hooks_json((hooks_upsert_args_t){
5586 .settings_path = settings_path,
5587 .hook_event = "PostToolUse",
5588 .matcher_str = "ReadFile",
5589 .command_str = command,
5590 .shell = shell[0] ? shell : NULL,
5591 .timeout_value = GEMINI_HOOK_TIMEOUT_MS,
5592 .match_command_exact = command,
5593 });
5594 return legacy_result == CLI_OK && lifecycle_result == CLI_OK && read_result == CLI_OK ? CLI_OK
5595 : CLI_ERR;
5596}
5597
5598#ifdef CBM_CLI_ENABLE_TEST_API
5599int cbm_upsert_qwen_lifecycle_hooks_for_testing(const char *settings_path, const char *binary_path,

Tested by

no test coverage detected