/** * @file Tracked-status + submodule-membership probes for a working-tree path. * `isTracked` answers "does git track this exact path?"; `getSubmodulePaths` * lists the repo's submodule mount points; `isInSubmodule` answers "does this * path live inside one?"; `isUntrackedNonSubmodulePath` composes them into * the safe-to-touch condition for cleanup tooling — never delete a tracked * file or reach into a submodule's own tree, which would dirty it. */ /** * The repo's submodule mount points as normalized, repo-root-relative paths * (e.g. `upstream/foo`). Reads `git config` on `.gitmodules`, so it lists * declared submodules whether or not they are initialized — the case a * stderr-message check on `git ls-files` misses. * * @example * ;```typescript * await getSubmodulePaths() * // => ['packages/acorn/upstream/acorn', 'vendor/mbedtls'] * ``` */ export declare function getSubmodulePaths(options?: GitPathOptions | undefined): Promise; /** * Whether `targetPath` lives inside one of the repo's submodules. Resolves the * submodule list itself; for a batch sweep prefer `getSubmodulePaths` once plus * `pathIsUnderSubmodule` per path. * * @example * ;```typescript * await isInSubmodule('vendor/mbedtls/x.py') // => true * await isInSubmodule('src/index.ts') // => false * ``` */ export declare function isInSubmodule(targetPath: string, options?: GitPathOptions | undefined): Promise; export interface GitPathOptions { /** * The git working-tree directory the path is resolved against. * * @default process.cwd() */ cwd?: string | undefined; } /** * Whether git tracks `targetPath` exactly. Uses `git ls-files --error-unmatch`, * which exits non-zero for an untracked path. A path inside a submodule, or one * git does not know, returns `false`. * * @example * ;```typescript * await isTracked('src/index.ts') // => true * await isTracked('.DS_Store') // => false * ``` */ export declare function isTracked(targetPath: string, options?: GitPathOptions | undefined): Promise; /** * Whether `targetPath` is git does NOT track AND does not live inside a * submodule — the safe-to-touch condition for cleanup tooling. A tracked path * is a deliberate file; a submodule-internal path belongs to that submodule's * own git, so touching it would dirty the submodule. Composes `isTracked` + * `getSubmodulePaths`/`pathIsUnderSubmodule`. Fails closed — any check error * resolves to `false`. * * For a batch sweep, call `getSubmodulePaths` once and compose `isTracked` + * `pathIsUnderSubmodule` per path to avoid re-reading `.gitmodules` each time. * * @example * ;```typescript * await isUntrackedNonSubmodulePath('.DS_Store') // => true * await isUntrackedNonSubmodulePath('src/index.ts') // => false (tracked) * await isUntrackedNonSubmodulePath('vendor/sub/x.pyc') // => false (submodule) * ``` */ export declare function isUntrackedNonSubmodulePath(targetPath: string, options?: GitPathOptions | undefined): Promise; /** * Whether `relativePath` (repo-root-relative) lies at or under any of * `submodulePaths`. Pure — pass the result of `getSubmodulePaths` so the git * read happens once for a whole sweep. * * @example * ;```typescript * pathIsUnderSubmodule('vendor/mbedtls/scripts/__pycache__', ['vendor/mbedtls']) * // => true * ``` */ export declare function pathIsUnderSubmodule(relativePath: string, submodulePaths: string[]): boolean;