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

33 lines
964 B
Plaintext

#!/usr/bin/env nu
# reflection/modules/env.nu — environment bootstrap for ontoref.
# Sets: ONTOREF_ROOT, NICKEL_IMPORT_PATH, ONTOREF_ACTOR
export-env {
let root = (
$env.CURRENT_FILE
| path dirname # reflection/modules
| path dirname # reflection
| path dirname # <root>
)
$env.ONTOREF_ROOT = $root
if ($env.NICKEL_IMPORT_PATH? | is-empty) {
let config_file = $"($root)/.ontoref/config.ncl"
# Guard: config must exist and nickel must be in PATH before reading
let paths = if ($config_file | path exists) and (which nickel | is-not-empty) {
do { ^nickel export $config_file } | complete
| if $in.exit_code == 0 {
$in.stdout | from json | get nickel_import_paths
| each { |p| $"($root)/($p)" }
} else { [$root] }
} else { [$root] }
$env.NICKEL_IMPORT_PATH = ($paths | str join ":")
}
if ($env.ONTOREF_ACTOR? | is-empty) {
$env.ONTOREF_ACTOR = "developer"
}
}