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

Function lift_scope

atomic-canonical/src/lift.rs:317–333  ·  view source on GitHub ↗

Lift a `:::scope-in` / `:::scope-out` container into a `ScopeItem`. `kind` is "scope-in" or "scope-out" and drives the generated id slug. Prose body is the unconstrained narrative (never graded). Nested `::file-ref{path=}` leaves name the files this boundary covers — same leaf directive a `:::task` uses for `TOUCHES` — so a `:::scope-out` can declare concrete files out of scope for breach detectio

(d: &Directive, id_base: &str, kind: &str, n: usize)

Source from the content-addressed store, hash-verified

315/// directive a `:::task` uses for `TOUCHES` — so a `:::scope-out` can declare
316/// concrete files out of scope for breach detection.
317fn lift_scope(d: &Directive, id_base: &str, kind: &str, n: usize) -> ScopeItem {
318 let local =
319 d.id.clone()
320 .unwrap_or_else(|| format!("{}-{kind}-{n}", slug(id_base)));
321 let files = d
322 .children
323 .iter()
324 .filter(|c| c.name == "file-ref")
325 .filter_map(|c| c.attr("path").map(str::to_string))
326 .collect();
327 ScopeItem {
328 type_: NodeType::ScopeItem.as_str().to_string(),
329 id: as_urn("scope", &local),
330 text: d.body.clone(),
331 files,
332 }
333}
334
335/// Lift a `:::constraint` container into a `Constraint`.
336fn lift_constraint(d: &Directive, id_base: &str, n: usize) -> Constraint {

Callers 1

lift_intentFunction · 0.85

Calls 6

as_urnFunction · 0.85
attrMethod · 0.80
cloneMethod · 0.45
collectMethod · 0.45
iterMethod · 0.45
as_strMethod · 0.45

Tested by

no test coverage detected