/** The authored project manifest. Its presence alone marks a project root. */ export declare const MANIFEST_FILENAME = "rebase.json"; /** * Walk up from `startDir` to find the Rebase project root. * * A directory is the root when it holds a `rebase.json`, or when it holds a * `package.json` that either lists `backend` as a workspace or sits beside both * `backend/` and `config/`. * * `rebase.json` is checked first and needs no `package.json` beside it, because * the conventions below all describe a repository that *contains the backend*. * A repository holding only a frontend — the normal shape once a project's apps * live in separate repositories — matches none of them, so without this the * tooling could not run there at all. */ export declare function findProjectRoot(startDir?: string): string | null; /** * Locate the backend directory within the project root. */ export declare function findBackendDir(projectRoot: string): string | null; /** * Detect the active backend plugin (e.g. @rebasepro/server-postgres) from the backend's package.json. */ export declare function getActiveBackendPlugin(backendDir: string): string | null; /** * Resolve the active plugin's CLI script. */ export declare function resolvePluginCliScript(backendDir: string, pluginName: string): string | null; /** * Locate the frontend directory within the project root. */ export declare function findFrontendDir(projectRoot: string): string | null; /** * Find the .env file. Checks the project root first, then backend. */ export declare function findEnvFile(projectRoot: string): string | null; /** * Read the project's `.env` into a plain object. * * One reader, because there were four: `dotenv` in `start`, a hand-rolled * `indexOf("=")` loop in `api-keys`, a single-key regex in `auth`, and its own * splitting in `cloud env`. `dotenv` is a declared dependency of this package, * so the other three existed for no reason and disagreed with the correct one * on the two things people actually write in a `.env`: * * - `export KEY=value`, which the hand-rolled parser keyed as * `export KEY` — so the command reported the key as unset while it was * right there in the file; * - `KEY=value # comment`, whose comment travelled into the value and then * into an `Authorization` header, coming back as a 401 with nothing * pointing at the cause. * * Returns `{}` when the project has no `.env`, so callers can treat "absent" * and "empty" alike. */ export declare function readEnvFile(projectRoot: string): Record; /** * Resolve a binary from the project's node_modules/.bin. * Checks backend, root, parent monorepo root, then falls back to PATH. */ export declare function resolveLocalBin(projectRoot: string, binName: string): string | null; /** * Resolve the tsx binary. Checks backend node_modules first, then root. */ export declare function resolveTsx(projectRoot: string): string | null; /** * Validate that a resolved tsx binary actually has an intact installation. * * `resolveLocalBin` only checks whether `node_modules/.bin/tsx` (a symlink) * exists. If the pnpm content-addressable store was cleaned or a previous * install was interrupted, the symlink can exist while critical files inside * the tsx package (e.g. `dist/preflight.cjs`) are missing — causing a * confusing MODULE_NOT_FOUND error at runtime. * * This function follows the symlink, walks up to find the tsx package root * (`package.json` with `name: "tsx"`), and verifies that `dist/preflight.cjs` * is present. Returns `null` when the installation looks healthy, or an * error description string when it appears corrupted. */ export declare function validateTsxInstallation(tsxBinPath: string): string | null; /** * Require the project root or exit with a helpful error. */ export declare function requireProjectRoot(): string; /** * Require the backend directory or exit with a helpful error. */ export declare function requireBackendDir(projectRoot: string): string;