website-htmx-rustelo/.ontoref/reflection/modes/sync-ontology.ncl
Jesús Pérez 3ccd15a14b init repo
2026-07-10 03:33:46 +01:00

44 lines
1.9 KiB
Text

let d = import "../defaults.ncl" in
d.make_mode String {
id = "sync-ontology",
trigger = "Synchronize .ontoref/ontology/ declarations with actual project artifacts — detect drift between declared practice nodes and the crates/site structure under code/, and propose ontology patches.",
preconditions = [
".ontoref/ontology/core.ncl exists",
"nickel binary available on PATH",
"rg (ripgrep) available on PATH",
],
steps = [
{
id = "scan",
action = "Enumerate the implementation structure: crates under code/crates/, config under code/site/config/, content directories, and the rendering profile declarations. Extract the artifact paths actually present.",
cmd = "ls code/crates/ 2>/dev/null; echo '---'; ls code/site/config/ 2>/dev/null",
actor = 'Both,
on_error = { strategy = 'Stop },
},
{
id = "export-core",
action = "Export .ontoref/ontology/core.ncl and collect the artifact_paths declared on each practice node.",
cmd = "nickel export .ontoref/ontology/core.ncl 2>/dev/null",
actor = 'Both,
depends_on = [{ step = "scan" }],
on_error = { strategy = 'Stop },
},
{
id = "diff",
action = "Compare scan results against core.ncl artifact_paths. Categorize each: OK (node path exists), STALE (declared path absent under code/), MISSING (significant artifact with no node). Account for the code/ prefix introduced by the constellation layout.",
actor = 'Both,
depends_on = [{ step = "export-core" }],
on_error = { strategy = 'Continue },
},
{
id = "propose",
action = "Generate Nickel patches: corrected artifact_paths for STALE nodes, new Practice node stubs for MISSING artifacts. Present for human review; do not apply automatically.",
actor = 'Both,
depends_on = [{ step = "diff" }],
on_error = { strategy = 'Stop },
},
],
}