FS Utils
Installation
Section titled “Installation”pnpm add @theholocron/fs-utilsimport { findRoot, findUpward, hasGitEntry } from "@theholocron/fs-utils";
// the nearest ancestor holding a marker file or directoryconst repoRoot = await findRoot(process.cwd(), ".git");
// anything a marker cannot express: your own check, stopping at the repo rootconst configDir = await findUpward( process.cwd(), async (dir) => ((await fileExists(join(dir, "app.config.json"))) ? dir : undefined), hasGitEntry);Choosing a helper
Section titled “Choosing a helper”findRoot/findRootSyncwhen a named file or directory marks the root. Reach forfindUpwardwhen the test is anything else.findExecutable/findExecutableSyncis awhich: it searchesPATH(or a path you pass) for a runnable file.walkFilesSynclists every regular file under a directory in a stable order, skipping.gitandnode_modulesunless you say otherwise.
Every helper that takes a name (a marker or a command) accepts a bare name only, never a path.
The full API reference is generated from the package’s TSDoc comments.