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

Function report_with_intent

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

Build a report where a single intent A (installed with `body_a`) is reached by a candidate that modifies every path in `files`. Each path is created + tracked on the base view and edited on the feature view. `enrich_change_kg` controls whether the candidate record projects the change's `MODIFIES` KG edges. Passing `false` proves the change→intent join no longer depends on KG enrichment (it source

(
        body_a: &str,
        files: &[&str],
        enrich_change_kg: bool,
    )

Source from the content-addressed store, hash-verified

1159 /// join no longer depends on KG enrichment (it sources modified files from
1160 /// the change itself via `change_modified_paths`).
1161 fn report_with_intent(
1162 body_a: &str,
1163 files: &[&str],
1164 enrich_change_kg: bool,
1165 ) -> (TriageReport, String) {
1166 let temp = TempDir::new().unwrap();
1167 let mut repo = Repository::init(temp.path()).unwrap();
1168 repo.init_vault().unwrap();
1169 let base_view = repo.current_view().to_string();
1170
1171 for rel in files {
1172 let p = temp.path().join(rel);
1173 if let Some(parent) = p.parent() {
1174 std::fs::create_dir_all(parent).unwrap();
1175 }
1176 std::fs::write(&p, "base\n").unwrap();
1177 repo.add(rel, Default::default()).unwrap();
1178 }
1179 record_all(&repo, "base change");
1180
1181 let a = repo.vault_intent_create(intent_opts("Intent A")).unwrap();
1182 install_intent_body(&repo, &a.intent_file, body_a, None);
1183 let a_node_id = format!("intent:{}", a.uid.to_uppercase());
1184
1185 repo.create_view_from("feature", &base_view).unwrap();
1186 repo.switch_view("feature").unwrap();
1187 for rel in files {
1188 let p = temp.path().join(rel);
1189 std::fs::write(&p, "base\nfeature edit\n").unwrap();
1190 }
1191 repo.record(
1192 ChangeHeader::new("feature change"),
1193 RecordOptions::new()
1194 .with_all(true)
1195 .save_to_store(true)
1196 .apply_after_record(true)
1197 .enrich_kg(enrich_change_kg)
1198 .sync_vault(false),
1199 )
1200 .unwrap();
1201
1202 let report = build_report(&repo, "feature", &base_view).unwrap();
1203 (report, a_node_id)
1204 }
1205
1206 /// A reached intent that declares a file out of scope (via a `:::scope-out`
1207 /// `::file-ref`) which a candidate change modifies → SCOPE_OUT_BREACH (block).

Calls 15

writeFunction · 0.85
intent_optsFunction · 0.85
install_intent_bodyFunction · 0.85
build_reportFunction · 0.85
current_viewMethod · 0.80
parentMethod · 0.80
vault_intent_createMethod · 0.80
create_view_fromMethod · 0.80
switch_viewMethod · 0.80
sync_vaultMethod · 0.80
enrich_kgMethod · 0.80
apply_after_recordMethod · 0.80