| 9998 | } |
| 9999 | |
| 10000 | static bool remove_cline_context_hooks(const char *cline_root, const char *binary_path, |
| 10001 | bool dry_run, bool uninstalling) { |
| 10002 | bool ok = true; |
| 10003 | for (size_t i = 0U; i < sizeof(cmm_cline_context_events) / sizeof(cmm_cline_context_events[0]); |
| 10004 | i++) { |
| 10005 | char hook_path[CLI_BUF_1K]; |
| 10006 | char script[CLI_BUF_8K]; |
| 10007 | if (cbm_cline_hook_path(cline_root, cmm_cline_context_events[i], hook_path, |
| 10008 | sizeof(hook_path)) != CLI_OK || |
| 10009 | cbm_build_cline_context_script(binary_path, cmm_cline_context_events[i], script, |
| 10010 | sizeof(script)) != CLI_OK) { |
| 10011 | ok = false; |
| 10012 | record_agent_config_error(uninstalling, "Cline", "hook_resolve", |
| 10013 | cmm_cline_context_events[i]); |
| 10014 | continue; |
| 10015 | } |
| 10016 | if (dry_run) { |
| 10017 | printf(" hook: would remove owned %s adapter\n", cmm_cline_context_events[i]); |
| 10018 | continue; |
| 10019 | } |
| 10020 | int result = cbm_text_remove_owned_document(hook_path, script); |
| 10021 | if (result < 0) { |
| 10022 | ok = false; |
| 10023 | record_agent_config_error(uninstalling, "Cline", |
| 10024 | uninstalling ? "hook_uninstall" : "legacy_hook_cleanup", |
| 10025 | hook_path); |
| 10026 | } else if (result == 1) { |
| 10027 | printf(" hook: preserved modified %s adapter\n", cmm_cline_context_events[i]); |
| 10028 | } |
| 10029 | } |
| 10030 | return ok; |
| 10031 | } |
| 10032 | |
| 10033 | static void uninstall_kimi_durable_context(const cbm_agent_registry_context_t *registry, |
| 10034 | bool dry_run) { |
no test coverage detected