getNanoStagedConfig
Resolves the nano-staged configuration to use, honoring a per-developer opt-out.
Loads a gitignored .env if present, then — when NANO_STAGED is set to an off value (0, false, off, or no) — prints a notice and exits the process successfully so the pre-commit checks are skipped. This mirrors husky’s own HUSKY=0 switch, but scoped to the nano-staged step (so the commit-msg hook still runs). Otherwise it returns obsidianDevUtilsConfig.
NANO_STAGED is not an npm script, so it carries its own switch rather than the script-name-derived one every npm script gets — but both share the same notion of an off value, via isEnvVariableOff.
This is a function rather than module-level code so importing the package barrel never triggers the .env read or the process exit; call it from the thin scripts/nano-staged-config.ts entry. Resolving the package manager is the one thing that does run at module scope, and it does neither of those two things — it only probes for a lockfile.
Import:
import { getNanoStagedConfig } from 'obsidian-dev-utils/script-utils/nano-staged-config';Signature:
function getNanoStagedConfig(): Record<string, string[]>Returns: Record<string, string[]> — The nano-staged task configuration. Does not return when the opt-out is active.