ontoref/reflection/modes/generate-examples.ncl
Jesús Pérez 0396e4037b
Some checks failed
Nickel Type Check / Nickel Type Checking (push) Has been cancelled
Rust CI / Security Audit (push) Has been cancelled
Rust CI / Check + Test + Lint (nightly) (push) Has been cancelled
Rust CI / Check + Test + Lint (stable) (push) Has been cancelled
chore: add ontology and reflection
2026-03-13 00:21:04 +00:00

55 lines
2.4 KiB
Plaintext

let s = import "../schema.ncl" in
# Mode: generate-examples
# Executes all verifiable steps from reflection/modes/ in the target project.
# The modes are the examples — this mode runs them to prove they work.
# Used as the integration test suite replacing a static examples/ directory.
{
id = "generate-examples",
trigger = "Run all verifiable mode steps as integration checks — modes are the canonical examples",
preconditions = [
"nickel is available in PATH",
"jq is available in PATH",
"reflection/modes/*.ncl export without error",
"Project binary (typedialog, ontoref, etc.) is installed and in PATH",
"reflection/forms/ contains at least one .ncl file",
],
steps = [
{
id = "list-verifiable-steps",
action = "Extract all steps with a non-empty verify field from all modes",
actor = 'Agent,
cmd = "for f in reflection/modes/*.ncl; do NICKEL_IMPORT_PATH=\"$(pwd)\" nickel export $f 2>/dev/null | jq -r '.steps[] | select(.verify != null and .verify != \"\") | .verify'; done",
verify = "for f in reflection/modes/*.ncl; do NICKEL_IMPORT_PATH=\"$(pwd)\" nickel export $f 2>/dev/null && true; done",
depends_on = [],
on_error = { strategy = 'Stop },
},
{
id = "run-verifiable-steps",
action = "Execute each verify command; non-zero exit fails the check",
actor = 'Agent,
cmd = "for f in reflection/modes/*.ncl; do NICKEL_IMPORT_PATH=\"$(pwd)\" nickel export $f 2>/dev/null | jq -r '.steps[] | select(.verify != null and .verify != \"\") | .verify' | while read -r check; do echo \"CHECK: $check\"; eval \"$check\" || { echo \"FAILED: $check\"; exit 1; }; done; done",
verify = "echo 'all verifiable steps passed'",
depends_on = [{ step = "list-verifiable-steps", kind = 'OnSuccess }],
on_error = { strategy = 'Stop },
},
{
id = "run-form-typecheck",
action = "Typecheck all forms in reflection/forms/",
actor = 'Both,
cmd = "for f in reflection/forms/*.ncl; do NICKEL_IMPORT_PATH=\"$(pwd)\" nickel typecheck $f || exit 1; done",
verify = "for f in reflection/forms/*.ncl; do NICKEL_IMPORT_PATH=\"$(pwd)\" nickel typecheck $f; done",
depends_on = [],
on_error = { strategy = 'Stop },
},
],
postconditions = [
"All modes with verify commands pass",
"All reflection/forms/*.ncl typecheck",
"No regressions in verifiable behavior",
],
} | s.Mode std.string.NonEmpty