| 232 | } |
| 233 | |
| 234 | fn uninstall(&self, repo_root: &Path) -> AgentResult<()> { |
| 235 | let settings_path = Self::settings_path(repo_root); |
| 236 | |
| 237 | if !settings_path.exists() { |
| 238 | return Ok(()); // Nothing to uninstall |
| 239 | } |
| 240 | |
| 241 | let (mut raw, mut hooks) = settings::read_settings(&settings_path)?; |
| 242 | |
| 243 | // Remove all Atomic hooks from every hook list |
| 244 | settings::remove_atomic_hooks(&mut hooks.session_start); |
| 245 | settings::remove_atomic_hooks(&mut hooks.session_end); |
| 246 | settings::remove_atomic_hooks(&mut hooks.stop); |
| 247 | settings::remove_atomic_hooks(&mut hooks.user_prompt_submit); |
| 248 | settings::remove_atomic_hooks(&mut hooks.pre_tool_use); |
| 249 | settings::remove_atomic_hooks(&mut hooks.post_tool_use); |
| 250 | |
| 251 | // Remove the metadata deny rule from permissions |
| 252 | settings::remove_deny_rule(&mut raw); |
| 253 | |
| 254 | // Serialize hooks back |
| 255 | let hooks_val = serde_json::to_value(&hooks).map_err(|e| AgentError::ConfigError { |
| 256 | operation: "serialize hooks".to_string(), |
| 257 | path: settings_path.clone(), |
| 258 | reason: e.to_string(), |
| 259 | })?; |
| 260 | raw.insert("hooks".to_string(), hooks_val); |
| 261 | settings::write_settings(&settings_path, &raw)?; |
| 262 | |
| 263 | Ok(()) |
| 264 | } |
| 265 | |
| 266 | fn is_installed(&self, repo_root: &Path) -> bool { |
| 267 | let settings_path = Self::settings_path(repo_root); |