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

Function install_intent_body

atomic-cli/src/commands/triage/project.rs:1190–1210  ·  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

1188 /// directive body, then index it into the KG. Reuses the created entry's
1189 /// frontmatter so manifest resolution keeps working.
1190 fn install_intent_body(repo: &Repository, intent_file: &str, body: &str, status: Option<&str>) {
1191 use atomic_core::pristine::VaultEntryType;
1192 let entry = repo.vault_retrieve(intent_file).unwrap().unwrap();
1193 let frontmatter_json = match status {
1194 Some(s) => {
1195 let mut fm: serde_json::Map<String, serde_json::Value> =
1196 serde_json::from_str(&entry.frontmatter_json).unwrap();
1197 fm.insert("status".into(), serde_json::Value::String(s.to_string()));
1198 serde_json::to_string(&fm).unwrap()
1199 }
1200 None => entry.frontmatter_json.clone(),
1201 };
1202 repo.vault_store(
1203 intent_file,
1204 VaultEntryType::Intent,
1205 body.as_bytes().to_vec(),
1206 frontmatter_json,
1207 )
1208 .unwrap();
1209 repo.vault_index_kg(intent_file).unwrap();
1210 }
1211
1212 /// Like `install_intent_body` but sets arbitrary frontmatter string fields
1213 /// (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