/** * User-editable stub collision detection. Issue #98 v5.8.18 / #99 v5.8.19. * * Many Laravel projects organize Requests / Resources / Services by * domain subfolder (`Admin/`, `Cms/`, `Audit/`) BEFORE adopting omnify, * OR they upgrade from v4 with wrappers at v4 paths * (`app/Services/Omnify/Service.php`) and v5 wants to emit at * the new modular path (`app/Omnify/Services/Service.php`). In * both cases the auto-emitted user-editable stub is unused noise that * regenerates every `omnify generate`, forcing the dev to delete it. * * Detection: scan a configurable root directory recursively for any * file with the same basename. If found at a path != target, skip * emission. * * Scope decision: * - Wide scope (e.g. project's `app/`): finds cross-layer wrappers * like the v4 → v5 upgrade case (#99). * - Narrow scope (file's parent dir): finds same-layer siblings only, * like a domain-organized `Admin/Brand.php` next to the flat * default (#98 v5.8.18). * * The CLI passes whichever scope matches the layout. Bounded by * `MAX_FILES_SCANNED` so a project with tens of thousands of files * doesn't grind generate to a halt. */ /** * Walk up from `filePath` looking for the closest ancestor directory * named `app`. Returns its absolute path or null. Used by the CLI to * pick a project-wide search root for sibling-skip — covers v4 → v5 * cross-layer wrappers (e.g. v4 wrapper at `app/Services/Omnify/Service.php` * vs v5 modular emit at `app/Omnify/Services/Service.php`). Capped * at 12 levels of climbing so we don't traverse the entire FS on a * malformed input. */ export declare function findAppRootAncestor(filePath: string): string | null; /** * The omnify root that governs `filePath`: the closest ancestor directory * holding an `omnify.yaml`. Null when there is none within 12 levels. * * Issue #178: a project with omnify packages inside `app/` (`app/Idp/`, * `app/Auth/`, each its own omnify root) runs `generate` once per root, and * the `app/`-wide basename scan reaches straight across those boundaries. The * root run then skipped `app/Models/.php` because the package had * emitted `app/Idp/Models/Pivot/.php`, and the package run skipped its * own stub because the root had emitted the flat one — two different classes * suppressing each other, permanently, since neither is ever rewritten. */ export declare function findOmnifyRoot(filePath: string): string | null; /** * Scan `rootDir` recursively for a file whose basename matches * `baseName`, excluding `excludePath` itself. Returns the first * match's full path or null. * * Issue #99 v5.8.19 follow-up: skip the auto-gen `Omnify/` subtree * (its files are codegen output, not project-owned siblings) so the * editable layer at `app/Models/.php` doesn't get blocked by * the sibling base at `app/Omnify/Models//.php` under * canonical+flatBase layout. Project-owned siblings under * `app/Services/Omnify/Service.php` (v4 wrapper layout) DO still * trigger a skip because they live OUTSIDE the auto-gen zone — the * skip rule is "any directory whose name starts with `Omnify` is * codegen-owned", which matches `Omnify/`, `OmnifyBase/`, etc. */ export declare function findSiblingWithSameBasename(rootDir: string, baseName: string, excludePath: string): string | null;