MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / handle_install_command

Function handle_install_command

src/agent_cmd.rs:230–403  ·  view source on GitHub ↗
(
    agent: Option<String>,
    local: bool,
    profile: Option<String>,
    all_profiles: bool,
    project_root: Option<String>,
    no_dashboard: bool,
    automation: Option<CodexAutomationInsta

Source from the content-addressed store, hash-verified

228}
229
230pub(crate) async fn handle_install_command(
231 agent: Option<String>,
232 local: bool,
233 profile: Option<String>,
234 all_profiles: bool,
235 project_root: Option<String>,
236 no_dashboard: bool,
237 automation: Option<CodexAutomationInstall>,
238) -> tracedecay::errors::Result<()> {
239 validate_hermes_profile_flags(agent.as_deref(), &profile, all_profiles)?;
240 let pinned_project_root = validate_hermes_project_root_flag(agent.as_deref(), &project_root)?;
241 validate_codex_automation_flags(agent.as_deref(), automation)?;
242 let home = tracedecay::agents::home_dir().ok_or_else(|| {
243 tracedecay::errors::TraceDecayError::Config {
244 message: "could not determine home directory".to_string(),
245 }
246 })?;
247 let tracedecay_bin = tracedecay::agents::which_tracedecay().ok_or_else(|| {
248 tracedecay::errors::TraceDecayError::Config {
249 message: "tracedecay not found on PATH. Install it from this repo first:\n \
250 cargo binstall --git https://github.com/ScriptedAlchemy/tracedecay tracedecay\n \
251 cargo install --git https://github.com/ScriptedAlchemy/tracedecay tracedecay"
252 .to_string(),
253 }
254 })?;
255 if local {
256 let project_path =
257 std::env::current_dir().map_err(|e| tracedecay::errors::TraceDecayError::Config {
258 message: format!("could not determine current project directory: {e}"),
259 })?;
260 let ctx = tracedecay::agents::InstallContext {
261 home: home.clone(),
262 tracedecay_bin: tracedecay_bin.clone(),
263 tool_permissions: tracedecay::agents::expected_tool_perms(),
264 profile: profile.clone(),
265 project_root: pinned_project_root.clone(),
266 dashboard: !no_dashboard,
267 };
268 let mut installed_names: Vec<String> = Vec::new();
269
270 if let Some(id) = agent {
271 let ag = tracedecay::agents::get_integration(&id)?;
272 for target_profile in hermes_selected_profile_targets(&home, &profile, all_profiles)? {
273 let ctx = tracedecay::agents::InstallContext {
274 home: home.clone(),
275 tracedecay_bin: tracedecay_bin.clone(),
276 tool_permissions: tracedecay::agents::expected_tool_perms(),
277 profile: target_profile,
278 project_root: pinned_project_root.clone(),
279 dashboard: !no_dashboard,
280 };
281 ag.install_local(&ctx, &project_path)?;
282 ag.post_install(Some(&project_path)).await;
283 if let Some(options) = automation.filter(|_| id == "codex") {
284 let scoped_project_path = validate_codex_automation_project_path()?;
285 install_codex_daemon_automation(&scoped_project_path, &home, options).await?;
286 }
287 }

Callers 1

dispatch_commandFunction · 0.85

Tested by

no test coverage detected