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

Function report_with_intent

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

1423 /// join no longer depends on KG enrichment (it sources modified files from
1424 /// the change itself via `change_modified_paths`).
1425 fn report_with_intent(
1426 body_a: &str,
1427 files: &[&str],
1428 enrich_change_kg: bool,
1429 ) -> (TriageReport, String) {
1430 let temp = TempDir::new().unwrap();
1431 let mut repo = Repository::init(temp.path()).unwrap();
1432 repo.init_vault().unwrap();
1433 let base_view = repo.current_view().to_string();
1434
1435 for rel in files {
1436 let p = temp.path().join(rel);
1437 if let Some(parent) = p.parent() {
1438 std::fs::create_dir_all(parent).unwrap();
1439 }
1440 std::fs::write(&p, "base\n").unwrap();
1441 repo.add(rel, Default::default()).unwrap();
1442 }
1443 record_all(&repo, "base change");
1444
1445 let a = repo.vault_intent_create(intent_opts("Intent A")).unwrap();
1446 install_intent_body(&repo, &a.intent_file, body_a, None);
1447 let a_node_id = format!("intent:{}", a.uid.to_uppercase());
1448
1449 repo.create_view_from("feature", &base_view).unwrap();
1450 repo.switch_view("feature").unwrap();
1451 for rel in files {
1452 let p = temp.path().join(rel);
1453 std::fs::write(&p, "base\nfeature edit\n").unwrap();
1454 }
1455 repo.record(
1456 ChangeHeader::new("feature change"),
1457 RecordOptions::new()
1458 .with_all(true)
1459 .save_to_store(true)
1460 .apply_after_record(true)
1461 .enrich_kg(enrich_change_kg)
1462 .sync_vault(false),
1463 )
1464 .unwrap();
1465
1466 let report = build_report(&repo, "feature", &base_view).unwrap();
1467 (report, a_node_id)
1468 }
1469
1470 /// A reached intent that declares a file out of scope (via a `:::scope-out`
1471 /// `::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