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