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

Function query_enrich

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

Source from the content-addressed store, hash-verified

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

Callers 1

runMethod · 0.85

Calls 7

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

Tested by

no test coverage detected