| 4388 | #define KIMI_HOOK_END "# <<< codebase-memory-mcp Kimi UserPromptSubmit <<<" |
| 4389 | |
| 4390 | static int cbm_upsert_kimi_context_hook(const char *config_path, const char *binary_path) { |
| 4391 | char command[CLI_BUF_8K]; |
| 4392 | char escaped[CLI_BUF_8K]; |
| 4393 | char block[CLI_BUF_8K]; |
| 4394 | if (cbm_build_augment_dialect_command(binary_path, "kimi", command, sizeof(command)) != |
| 4395 | CLI_OK || |
| 4396 | cbm_toml_escape_basic_string(command, escaped, sizeof(escaped)) != 0) { |
| 4397 | return CLI_ERR; |
| 4398 | } |
| 4399 | int written = snprintf(block, sizeof(block), |
| 4400 | "[[hooks]]\n" |
| 4401 | "event = \"UserPromptSubmit\"\n" |
| 4402 | "command = \"%s\"\n" |
| 4403 | "timeout = 5\n", |
| 4404 | escaped); |
| 4405 | if (written < 0 || (size_t)written >= sizeof(block)) { |
| 4406 | return CLI_ERR; |
| 4407 | } |
| 4408 | return cbm_toml_upsert_managed_block(config_path, KIMI_HOOK_BEGIN, KIMI_HOOK_END, block) == 0 |
| 4409 | ? CLI_OK |
| 4410 | : CLI_ERR; |
| 4411 | } |
| 4412 | |
| 4413 | static int cbm_remove_kimi_context_hook(const char *config_path) { |
| 4414 | return cbm_toml_remove_managed_block(config_path, KIMI_HOOK_BEGIN, KIMI_HOOK_END) == 0 |
no test coverage detected