nu-require

CLI helper library: require Nushell as the host shell for tailored tools.

Idea

Nushell-tailored CLIs call validate() near process start:

import { validate } from "@openshellorg/nu-require";

await validate({ offerInstall: true });

Behavior:

  1. Already under Nushell → continue normally.

  2. Not under Nushell, but nu is on PATH → print that the tool is relaunching inside Nushell, then re-exec the same binary/argv via nu -c.

  3. nu missing → clear error, link to https://www.nushell.sh/, optionally offer a one-shot install when offerInstall: true.

PowerShell is not treated as an acceptable host for these tailored tools (relaunch-to-Nushell is the bridge, not "support pwsh").

In this component