| 4332 | #define KIMI_HOOK_END "# <<< codebase-memory-mcp Kimi UserPromptSubmit <<<" |
| 4333 | |
| 4334 | static int cbm_upsert_kimi_context_hook(const char *config_path, const char *binary_path) { |
| 4335 | char command[CLI_BUF_8K]; |
| 4336 | char escaped[CLI_BUF_8K]; |
| 4337 | char block[CLI_BUF_8K]; |
| 4338 | if (cbm_build_augment_dialect_command(binary_path, "kimi", command, sizeof(command)) != |
| 4339 | CLI_OK || |
| 4340 | cbm_toml_escape_basic_string(command, escaped, sizeof(escaped)) != 0) { |
| 4341 | return CLI_ERR; |
| 4342 | } |
| 4343 | int written = snprintf(block, sizeof(block), |
| 4344 | "[[hooks]]\n" |
| 4345 | "event = \"UserPromptSubmit\"\n" |
| 4346 | "command = \"%s\"\n" |
| 4347 | "timeout = 5\n", |
| 4348 | escaped); |
| 4349 | if (written < 0 || (size_t)written >= sizeof(block)) { |
| 4350 | return CLI_ERR; |
| 4351 | } |
| 4352 | return cbm_toml_upsert_managed_block(config_path, KIMI_HOOK_BEGIN, KIMI_HOOK_END, block) == 0 |
| 4353 | ? CLI_OK |
| 4354 | : CLI_ERR; |
| 4355 | } |
| 4356 | |
| 4357 | static int cbm_remove_kimi_context_hook(const char *config_path) { |
| 4358 | return cbm_toml_remove_managed_block(config_path, KIMI_HOOK_BEGIN, KIMI_HOOK_END) == 0 |
no test coverage detected