provisioning/reflection/modes/provisioning-assess.ncl
2026-05-12 02:40:14 +01:00

100 lines
4 KiB
Text

let s = import "reflection/schema.ncl" in
# Mode: provisioning-assess
# Reads a child project's ontology and identifies its infrastructure requirements.
# Produces an assessment of what this project needs from the provisioning platform.
#
# Required params (substituted in cmd via {param}):
# {child_project_dir} — absolute path to the child project root
# {child_project_name} — slug of the child project
{
id = "provisioning-assess",
trigger = "Assess a project's infrastructure requirements against the provisioning platform",
strategy = 'Override,
preconditions = [
"{child_project_dir}/.ontology/core.ncl exists and is valid Nickel",
"nickel is available in PATH",
"./scripts/ontoref is available and executable",
"provisioning platform catalog (catalog/providers/, catalog/taskservs/) is readable",
],
steps = [
{
id = "read_child_core",
action = "export_child_ontology",
actor = 'Agent,
cmd = "nickel export {child_project_dir}/.ontology/core.ncl",
depends_on = [],
on_error = { strategy = 'Stop },
note = "Export the child project's core ontology. Identifies nodes with infrastructure implications.",
},
{
id = "list_available_providers",
action = "catalog_providers",
actor = 'Agent,
cmd = "ls catalog/providers/ 2>/dev/null || echo 'no-providers'",
depends_on = [],
on_error = { strategy = 'Continue },
note = "List available provider extensions. Used to cross-reference child requirements.",
},
{
id = "list_available_taskservs",
action = "catalog_taskservs",
actor = 'Agent,
cmd = "ls catalog/taskservs/ 2>/dev/null || echo 'no-taskservs'",
depends_on = [],
on_error = { strategy = 'Continue },
note = "List available taskservs. Used to cross-reference child requirements.",
},
{
id = "identify_infra_nodes",
action = "filter_infra_relevant_nodes",
actor = 'Agent,
cmd = "nickel export {child_project_dir}/.ontology/core.ncl | jq '[.nodes[] | select(.level == \"Project\" or .level == \"Axiom\")]'",
depends_on = [
{ step = "read_child_core", kind = 'OnSuccess },
],
on_error = { strategy = 'Stop },
note = "Filter nodes that imply infrastructure requirements — Project and Axiom level nodes typically require provisioning.",
},
{
id = "cross_reference_providers",
action = "match_requirements_to_providers",
actor = 'Agent,
cmd = "nickel export {child_project_dir}/.ontology/core.ncl | jq -r '.nodes[] | select(.level == \"Project\") | .id' | while read id; do echo \"$id: check catalog/providers/$id 2>/dev/null || echo 'no match'\"; done",
depends_on = [
{ step = "identify_infra_nodes", kind = 'OnSuccess },
{ step = "list_available_providers", kind = 'Always },
],
on_error = { strategy = 'Continue },
note = "Cross-reference identified infrastructure nodes with available providers.",
},
{
id = "generate_assessment_report",
action = "write_assessment_output",
actor = 'Agent,
cmd = "./scripts/ontoref describe {child_project_name} --format assessment",
depends_on = [
{ step = "cross_reference_providers", kind = 'Always },
{ step = "list_available_taskservs", kind = 'Always },
],
on_error = { strategy = 'Stop },
note = "Generate the final assessment report: what the child project needs from provisioning, what is available, what gaps exist.",
},
],
postconditions = [
"Assessment report identifies infrastructure nodes from child project ontology",
"Report cross-references available providers and taskservs",
"Gaps between requirements and available extensions are listed",
],
} | (s.Mode String)