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

Method intent_graph

atomic-repository/src/intent_graph.rs:55–73  ·  view source on GitHub ↗

Resolve a human intent key, UID, or canonical intent IRI and select its asserted semantic lineage. Does not enrich/rebuild the graph or read files.

(&self, id: &str, max_nodes: usize)

Source from the content-addressed store, hash-verified

53 /// Resolve a human intent key, UID, or canonical intent IRI and select its
54 /// asserted semantic lineage. Does not enrich/rebuild the graph or read files.
55 pub fn intent_graph(&self, id: &str, max_nodes: usize) -> Result<IntentGraph, RepositoryError> {
56 let uid = if let Ok((project, uid)) = iri::parse_intent(id) {
57 if project != self.project_id()? {
58 return Err(invalid("intent belongs to a different project"));
59 }
60 uid
61 } else {
62 let inputs = crate::intent_bridge::read_intent(self, id)?;
63 inputs
64 .frontmatter
65 .get("uid")
66 .and_then(|v| v.as_str())
67 .ok_or_else(|| invalid("intent has no canonical UID"))?
68 .to_uppercase()
69 };
70 let root = iri::mint_intent(&self.project_id()?, &uid)
71 .map_err(|error| invalid(&error.to_string()))?;
72 IntentGraph::from_snapshot(&self.workflow_snapshot()?, &root, max_nodes)
73 }
74}
75
76fn invalid(message: &str) -> RepositoryError {

Calls 8

parse_intentFunction · 0.85
mint_intentFunction · 0.85
workflow_snapshotMethod · 0.80
invalidFunction · 0.70
read_intentFunction · 0.70
getMethod · 0.65
project_idMethod · 0.45
as_strMethod · 0.45