| 4552 | #define KIMI_HOOK_END "# <<< codebase-memory-mcp Kimi UserPromptSubmit <<<" |
| 4553 | |
| 4554 | static int cbm_upsert_kimi_context_hook(const char *config_path, const char *binary_path) { |
| 4555 | char command[CLI_BUF_8K]; |
| 4556 | char escaped[CLI_BUF_8K]; |
| 4557 | char block[CLI_BUF_8K]; |
| 4558 | if (cbm_build_augment_dialect_command(binary_path, "kimi", command, sizeof(command)) != |
| 4559 | CLI_OK || |
| 4560 | cbm_toml_escape_basic_string(command, escaped, sizeof(escaped)) != 0) { |
| 4561 | return CLI_ERR; |
| 4562 | } |
| 4563 | int written = snprintf(block, sizeof(block), |
| 4564 | "[[hooks]]\n" |
| 4565 | "event = \"UserPromptSubmit\"\n" |
| 4566 | "command = \"%s\"\n" |
| 4567 | "timeout = 5\n", |
| 4568 | escaped); |
| 4569 | if (written < 0 || (size_t)written >= sizeof(block)) { |
| 4570 | return CLI_ERR; |
| 4571 | } |
| 4572 | return cbm_toml_upsert_managed_block(config_path, KIMI_HOOK_BEGIN, KIMI_HOOK_END, block) == 0 |
| 4573 | ? CLI_OK |
| 4574 | : CLI_ERR; |
| 4575 | } |
| 4576 | |
| 4577 | static int cbm_remove_kimi_context_hook(const char *config_path) { |
| 4578 | return cbm_toml_remove_managed_block(config_path, KIMI_HOOK_BEGIN, KIMI_HOOK_END) == 0 |
no test coverage detected