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

Function install_intent_body

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

1223 /// directive body, then index it into the KG. Reuses the created entry's
1224 /// frontmatter so manifest resolution keeps working.
1225 fn install_intent_body(repo: &Repository, intent_file: &str, body: &str, status: Option<&str>) {
1226 use atomic_core::pristine::VaultEntryType;
1227 let entry = repo.vault_retrieve(intent_file).unwrap().unwrap();
1228 let frontmatter_json = match status {
1229 Some(s) => {
1230 let mut fm: serde_json::Map<String, serde_json::Value> =
1231 serde_json::from_str(&entry.frontmatter_json).unwrap();
1232 fm.insert("status".into(), serde_json::Value::String(s.to_string()));
1233 serde_json::to_string(&fm).unwrap()
1234 }
1235 None => entry.frontmatter_json.clone(),
1236 };
1237 repo.vault_store(
1238 intent_file,
1239 VaultEntryType::Intent,
1240 body.as_bytes().to_vec(),
1241 frontmatter_json,
1242 )
1243 .unwrap();
1244 repo.vault_index_kg(intent_file).unwrap();
1245 }
1246
1247 /// Like `install_intent_body` but sets arbitrary frontmatter string fields
1248 /// (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