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

Function lift_task

atomic-canonical/src/lift.rs:155–182  ·  view source on GitHub ↗
(d: &Directive, human_key: &str, n: usize)

Source from the content-addressed store, hash-verified

153}
154
155fn lift_task(d: &Directive, human_key: &str, n: usize) -> Task {
156 let local =
157 d.id.clone()
158 .unwrap_or_else(|| format!("{}-{n}", slug(human_key)));
159 let mut touches: Vec<String> = Vec::new();
160 if let Some(f) = d.attr("touchesFile") {
161 touches.push(f.to_string());
162 }
163 for child in &d.children {
164 if child.name == "file-ref" {
165 if let Some(path) = child.attr("path") {
166 touches.push(path.to_string());
167 }
168 }
169 }
170 let satisfies = d
171 .attr("satisfies")
172 .or_else(|| d.attr("criteria"))
173 .map(|v| as_urn("ac", v));
174 Task {
175 type_: NodeType::Task.as_str().to_string(),
176 id: as_urn("task", &local),
177 text: d.body.clone(),
178 task_status: d.attr("status").unwrap_or("open").to_string(),
179 touches_file: touches,
180 satisfies,
181 }
182}
183
184/// Lift a `:::scope-in` / `:::scope-out` container into a `ScopeItem`.
185/// `kind` is "scope-in" or "scope-out" and drives the generated id slug.

Callers 1

lift_intentFunction · 0.85

Calls 5

as_urnFunction · 0.85
attrMethod · 0.80
cloneMethod · 0.45
pushMethod · 0.45
as_strMethod · 0.45

Tested by

no test coverage detected