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

Function install_intent_body

atomic-cli/src/commands/triage/project.rs:961–981  ·  view source on GitHub ↗

Overwrite a created intent's body (and optionally its status) with a directive body, then index it into the KG. Reuses the created entry's frontmatter so manifest resolution keeps working.

(repo: &Repository, intent_file: &str, body: &str, status: Option<&str>)

Source from the content-addressed store, hash-verified

959 /// directive body, then index it into the KG. Reuses the created entry's
960 /// frontmatter so manifest resolution keeps working.
961 fn install_intent_body(repo: &Repository, intent_file: &str, body: &str, status: Option<&str>) {
962 use atomic_core::pristine::VaultEntryType;
963 let entry = repo.vault_retrieve(intent_file).unwrap().unwrap();
964 let frontmatter_json = match status {
965 Some(s) => {
966 let mut fm: serde_json::Map<String, serde_json::Value> =
967 serde_json::from_str(&entry.frontmatter_json).unwrap();
968 fm.insert("status".into(), serde_json::Value::String(s.to_string()));
969 serde_json::to_string(&fm).unwrap()
970 }
971 None => entry.frontmatter_json.clone(),
972 };
973 repo.vault_store(
974 intent_file,
975 VaultEntryType::Intent,
976 body.as_bytes().to_vec(),
977 frontmatter_json,
978 )
979 .unwrap();
980 repo.vault_index_kg(intent_file).unwrap();
981 }
982
983 /// Like `install_intent_body` but sets arbitrary frontmatter string fields
984 /// (e.g. `kind`, `attributedTo`, `status`) so tests can control the review

Callers 2

remediation_reportFunction · 0.85
report_with_intentFunction · 0.85

Calls 7

vault_retrieveMethod · 0.80
vault_storeMethod · 0.80
vault_index_kgMethod · 0.80
unwrapMethod · 0.45
insertMethod · 0.45
cloneMethod · 0.45
as_bytesMethod · 0.45

Tested by

no test coverage detected