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

Function annotate

atomic-cli/src/commands/intent/graph.rs:119–161  ·  view source on GitHub ↗
(graph: &Graph, nodes: &mut [atomic_core::KgNode])

Source from the content-addressed store, hash-verified

117}
118
119fn annotate(graph: &Graph, nodes: &mut [atomic_core::KgNode]) {
120 for node in nodes {
121 let role = if node.id == graph.root {
122 "root intent"
123 } else if graph.declared_changes.contains(&node.id)
124 && !graph.captured_changes.contains(&node.id)
125 {
126 "declared implementation; original turn provenance not established"
127 } else if graph.implementing_changes.contains(&node.id) {
128 "implementing change"
129 } else if graph.recording_changes.contains(&node.id) {
130 "records intent artifact; implementation attribution not asserted"
131 } else if graph.intent_artifact.as_ref() == Some(&node.id) {
132 "selected intent's recorded artifact (matched by stored vault_path)"
133 } else if graph.dependency_changes.contains(&node.id) {
134 "dependency-only change"
135 } else if graph.reviewed_changes.contains(&node.id) {
136 "reviewed change; not inferred implementation"
137 } else {
138 "context"
139 };
140 let state = node.metadata.as_ref().map(|m| {
141 format!(
142 "object={}, projection={}",
143 m.get("object_availability")
144 .and_then(|v| v.as_str())
145 .unwrap_or("unknown"),
146 m.get("projection_completeness")
147 .and_then(|v| v.as_str())
148 .unwrap_or("reference-only")
149 )
150 });
151 let evidence = if node.has_type(atomic_core::kg::ontology::Class::Change) {
152 state.unwrap_or_else(|| "object=unknown, projection=reference-only".into())
153 } else {
154 String::new()
155 };
156 node.summary = Some(format!(
157 "[{role}] {evidence} {}",
158 node.summary.as_deref().unwrap_or("")
159 ));
160 }
161}
162
163pub(crate) fn render_text(graph: &Graph) -> String {
164 render_tree(graph, false)

Callers 3

runMethod · 0.70
node_detailsFunction · 0.70

Calls 3

as_refMethod · 0.80
has_typeMethod · 0.80
containsMethod · 0.45