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

Function install_managed_agent

src/agents/kiro.rs:396–423  ·  view source on GitHub ↗

Create or refresh the tracedecay-owned Kiro agent. Returns true when tracedecay owns the resulting agent file. A pre-existing user-managed `tracedecay.json` is preserved and returns false so the default agent selector is not pointed at a file whose policy tracedecay does not own.

(
    path: &Path,
    tracedecay_bin: &str,
    steering_path: &Path,
    profile_home: &Path,
    managed_skill_index_path: Option<&Path>,
)

Source from the content-addressed store, hash-verified

394/// user-managed `tracedecay.json` is preserved and returns false so the default
395/// agent selector is not pointed at a file whose policy tracedecay does not own.
396fn install_managed_agent(
397 path: &Path,
398 tracedecay_bin: &str,
399 steering_path: &Path,
400 profile_home: &Path,
401 managed_skill_index_path: Option<&Path>,
402) -> Result<bool> {
403 if path.exists() && !is_owned_agent_file(path) {
404 eprintln!(
405 " {} already exists and is user-managed, leaving unchanged",
406 path.display()
407 );
408 return Ok(false);
409 }
410
411 let managed_skill_index_path = match managed_skill_index_path {
412 Some(index_path) => install_kiro_managed_skill_index(profile_home, index_path)?,
413 None => None,
414 };
415 let backup = backup_config_file(path)?;
416 let config = managed_agent_config(tracedecay_bin, steering_path, managed_skill_index_path);
417 safe_write_json_file(path, &config, backup.as_deref())?;
418 eprintln!(
419 "\x1b[32m✔\x1b[0m Wrote tracedecay Kiro agent to {}",
420 path.display()
421 );
422 Ok(true)
423}
424
425fn install_kiro_managed_skill_index<'a>(
426 home: &Path,

Callers 3

installMethod · 0.85
install_localMethod · 0.85
update_pluginMethod · 0.85

Calls 6

is_owned_agent_fileFunction · 0.85
backup_config_fileFunction · 0.85
managed_agent_configFunction · 0.85
safe_write_json_fileFunction · 0.85
existsMethod · 0.80

Tested by

no test coverage detected