nu-require
nu-require is a small TypeScript library CLIs call at startup to require Nushell as the host shell.
It either continues under Nu, relaunches the same binary and argv via nu -c, or errors with an install path when nu is missing.
PowerShell is not an alternate supported host.
Nushell-tailored CLIs call validate() near process start:
import { validate } from "@openshellorg/nu-require";
await validate({ offerInstall: true });
Behavior:
-
Already under Nushell → continue normally.
-
Not under Nushell, but
nuis on PATH → print that the tool is relaunching inside Nushell, then re-exec the same binary/argv vianu -c. -
numissing → clear error, link to https://www.nushell.sh/, optionally offer a one-shot install whenofferInstall: true.
In this module
-
Vision — dual-role bug and product decision
-
TypeScript API —
validate()options -
Relaunch Behavior — hop into
nu -
Install Offer — winget / brew / docs
Related
-
shell-architecture — architecture thesis
-
open-shell-org — SOS flag syntax / certification
-
nu-emit — structured emit for Nushell