| 10669 | } |
| 10670 | |
| 10671 | static bool remove_cline_context_hooks(const char *cline_root, const char *binary_path, |
| 10672 | bool dry_run, bool uninstalling) { |
| 10673 | bool ok = true; |
| 10674 | for (size_t i = 0U; i < sizeof(cmm_cline_context_events) / sizeof(cmm_cline_context_events[0]); |
| 10675 | i++) { |
| 10676 | char hook_path[CLI_BUF_1K]; |
| 10677 | char script[CLI_BUF_8K]; |
| 10678 | if (cbm_cline_hook_path(cline_root, cmm_cline_context_events[i], hook_path, |
| 10679 | sizeof(hook_path)) != CLI_OK || |
| 10680 | cbm_build_cline_context_script(binary_path, cmm_cline_context_events[i], script, |
| 10681 | sizeof(script)) != CLI_OK) { |
| 10682 | ok = false; |
| 10683 | record_agent_config_error(uninstalling, "Cline", "hook_resolve", |
| 10684 | cmm_cline_context_events[i]); |
| 10685 | continue; |
| 10686 | } |
| 10687 | if (dry_run) { |
| 10688 | printf(" hook: would remove owned %s adapter\n", cmm_cline_context_events[i]); |
| 10689 | continue; |
| 10690 | } |
| 10691 | int result = cbm_text_remove_owned_document(hook_path, script); |
| 10692 | if (result < 0) { |
| 10693 | ok = false; |
| 10694 | record_agent_config_error(uninstalling, "Cline", |
| 10695 | uninstalling ? "hook_uninstall" : "legacy_hook_cleanup", |
| 10696 | hook_path); |
| 10697 | } else if (result == 1) { |
| 10698 | printf(" hook: preserved modified %s adapter\n", cmm_cline_context_events[i]); |
| 10699 | } |
| 10700 | } |
| 10701 | return ok; |
| 10702 | } |
| 10703 | |
| 10704 | static void uninstall_kimi_durable_context(const cbm_agent_registry_context_t *registry, |
| 10705 | bool dry_run) { |
no test coverage detected