48 lines
1.6 KiB
Plaintext
48 lines
1.6 KiB
Plaintext
|
|
#!/usr/bin/env nu
|
||
|
|
# reflection/modules/prereqs.nu — prerequisite checking.
|
||
|
|
|
||
|
|
use env.nu *
|
||
|
|
|
||
|
|
export def "prereqs check" [
|
||
|
|
--context: string = "",
|
||
|
|
--form: string = "",
|
||
|
|
--severity: string = "",
|
||
|
|
--json,
|
||
|
|
] {
|
||
|
|
let actor = ($env.ONTOREF_ACTOR? | default "developer")
|
||
|
|
let ctx = if ($context | is-not-empty) { $context } else { actor-to-context $actor }
|
||
|
|
let checker = $"($env.ONTOREF_ROOT)/reflection/bin/check-prereqs.nu"
|
||
|
|
|
||
|
|
let args = (
|
||
|
|
["--context", $ctx]
|
||
|
|
| append (if ($form | is-not-empty) { ["--form", $form] } else { [] })
|
||
|
|
| append (if ($severity | is-not-empty) { ["--severity", $severity] } else { [] })
|
||
|
|
| append (if $json { ["--json"] } else { [] })
|
||
|
|
)
|
||
|
|
^nu $checker ...$args
|
||
|
|
}
|
||
|
|
|
||
|
|
export def "prereqs help" [] {
|
||
|
|
let actor = ($env.ONTOREF_ACTOR? | default "developer")
|
||
|
|
print ""
|
||
|
|
print "Prerequisites commands:"
|
||
|
|
print " prereqs check check for current actor context"
|
||
|
|
print " prereqs check --context ci check CI context"
|
||
|
|
print " prereqs check --context agent check agent context"
|
||
|
|
print " prereqs check --form new_adr check what a specific form needs"
|
||
|
|
print " prereqs check --severity Hard only Hard requirements"
|
||
|
|
print " prereqs check --json machine-readable output"
|
||
|
|
print ""
|
||
|
|
print $"Current actor: ($actor) → context: (actor-to-context $actor)"
|
||
|
|
print ""
|
||
|
|
}
|
||
|
|
|
||
|
|
def actor-to-context [actor: string] {
|
||
|
|
match $actor {
|
||
|
|
"ci" => "ci",
|
||
|
|
"agent" => "agent",
|
||
|
|
"benchmark" => "benchmark",
|
||
|
|
_ => "local_dev",
|
||
|
|
}
|
||
|
|
}
|