MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / install

Method install

atomic-agent/src/hooks/claude_code/mod.rs:209–232  ·  view source on GitHub ↗
(&self, repo_root: &Path)

Source from the content-addressed store, hash-verified

207 }
208
209 fn install(&self, repo_root: &Path) -> AgentResult<usize> {
210 let settings_path = Self::settings_path(repo_root);
211 let (mut raw, mut hooks) = settings::read_settings(&settings_path)?;
212
213 let count = install_hooks_into(&mut hooks, &settings_path)?;
214
215 // Add permissions.deny rule to prevent Claude from reading metadata
216 let permissions_changed = settings::ensure_deny_rule(&mut raw);
217
218 if count == 0 && !permissions_changed {
219 return Ok(0);
220 }
221
222 // Serialize hooks back into raw settings
223 let hooks_val = serde_json::to_value(&hooks).map_err(|e| AgentError::ConfigError {
224 operation: "serialize hooks".to_string(),
225 path: settings_path.clone(),
226 reason: e.to_string(),
227 })?;
228 raw.insert("hooks".to_string(), hooks_val);
229 settings::write_settings(&settings_path, &raw)?;
230
231 Ok(count)
232 }
233
234 fn uninstall(&self, repo_root: &Path) -> AgentResult<()> {
235 let settings_path = Self::settings_path(repo_root);

Calls 6

read_settingsFunction · 0.85
install_hooks_intoFunction · 0.85
ensure_deny_ruleFunction · 0.85
write_settingsFunction · 0.85
cloneMethod · 0.45
insertMethod · 0.45