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

Function query_enrich

atomic-cli/src/commands/rpc.rs:1797–1834  ·  view source on GitHub ↗
(args: &super::query::QueryEnrich)

Source from the content-addressed store, hash-verified

1795}
1796
1797pub fn query_enrich(args: &super::query::QueryEnrich) -> CliResult<bool> {
1798 let session = match Service::open()? {
1799 Some(session) => session,
1800 None => return Ok(false),
1801 };
1802 // Per-change enrichment: each change reference resolves to its full
1803 // hash through the service layer's Log (a read), then rides the
1804 // request's repeated changes — the handler enriches exactly those.
1805 let changes = args
1806 .changes
1807 .iter()
1808 .map(|spec| {
1809 resolve_change_hash(&session, spec).map(|hash| pb::Hash {
1810 value: hash.0.to_vec(),
1811 algorithm: pb::HashAlgorithm::Blake3 as i32,
1812 })
1813 })
1814 .collect::<CliResult<Vec<_>>>()?;
1815 let request = pb::MaintainKnowledgeGraphRequest {
1816 repository: Some(session.reference.clone()),
1817 meta: request_meta(),
1818 action: pb::KnowledgeMaintainAction::Enrich as i32,
1819 scope: args.rebuild.then(|| "rebuild".to_string()),
1820 changes,
1821 ..Default::default()
1822 };
1823 let response = session.maintain_knowledge_graph(request)?;
1824 if !args.changes.is_empty() {
1825 // The targeted form's report, as the local body prints it.
1826 println!("Enriched {} change(s).", response.processed);
1827 } else {
1828 println!(
1829 "Enriched knowledge graph: {} item(s) processed.",
1830 response.processed
1831 );
1832 }
1833 Ok(true)
1834}
1835
1836/// `atomic vault context` over GetVaultContext — every form. The
1837/// gather+rank (seeds from query terms, `--intent`, `--files`; the

Callers 1

runMethod · 0.85

Calls 7

resolve_change_hashFunction · 0.85
request_metaFunction · 0.70
openFunction · 0.50
iterMethod · 0.45
cloneMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected