import type { PackageManager, PMCommands } from "../utils/package-manager"; /** * Every scaffolded file that carries a `{{PLACEHOLDER}}`. * * Exported because it is the single source of truth: `init.test.ts` reads it and * asserts that every template file containing `{{` appears here. It used to be a * local, with the test harness keeping a *second* copy — so the two drifted, and * a test built on the copy could not observe the production list at all. * * The drift shipped: `docker-compose.yml` arrived with the self-host work * (26fd5259c) and was added to neither, so every scaffolded project got a literal * `name: {{PROJECT_NAME}}`. In YAML `{{...}}` is a map, not a string, so the * documented `docker compose up` path failed on the file before doing anything: * * yaml: unmarshal errors: line 28: cannot unmarshal !!map into string */ export declare const TEMPLATE_PLACEHOLDER_FILES: string[]; /** Returns an error message, or null when the name is a valid package name. */ export declare function validateProjectName(name: string): string | null; export type TemplatePreset = "blog" | "ecommerce" | "blank"; export interface InitOptions { projectName: string; git: boolean; installDeps: boolean; targetDirectory: string; templateDirectory: string; databaseUrl?: string; introspect?: boolean; /** Starter template preset. */ preset: TemplatePreset; /** Whether `preset` came from an explicit --template rather than the default. */ explicitPreset?: boolean; /** Scaffold the backend alone, with no admin panel and no collections. */ headless: boolean; /** Detected package manager (pnpm or npm). */ pm: PackageManager; /** Command helpers for the detected PM. */ pmCommands: PMCommands; /** Cloud project slug (its subdomain) to link the scaffold to. */ cloudProject?: string; /** One-time setup key that authenticates the cloud link. */ setupKey?: string; /** Control-plane URL the setup key is redeemed against. */ cloudUrl?: string; } export interface BuildQuestionsParams { nameArg?: string; templateArg?: TemplatePreset; headlessArg?: boolean; hasGitFlag: boolean; hasInstallFlag: boolean; pm: PackageManager; } /** * Builds the interactive prompt questions for `rebase init`. * Exported for testability — all prompt `type` values must match * types registered by the installed version of inquirer. */ export declare function buildInitQuestions(params: BuildQuestionsParams): Record[]; /** * The `cd` a user must type to enter the new project. * * Not the project's basename: `init apps/my-app` has to say `cd apps/my-app`, * and `init .` returns "" because they are already in the project. */ export declare function formatCdTarget(cwd: string, targetDirectory: string): string; /** Help for `rebase init` — the flags were previously only discoverable by * triggering the non-TTY error. */ export declare function printInitHelp(): void; export declare function createRebaseApp(rawArgs: string[]): Promise; /** The flags `rebase init` takes. */ export declare const INIT_FLAGS: { readonly "--git": BooleanConstructor; readonly "--install": BooleanConstructor; readonly "--database-url": StringConstructor; readonly "--introspect": BooleanConstructor; readonly "--template": StringConstructor; readonly "--headless": BooleanConstructor; readonly "--project": StringConstructor; readonly "--setup-key": StringConstructor; readonly "--yes": BooleanConstructor; readonly "-g": "--git"; readonly "-i": "--install"; readonly "-t": "--template"; readonly "-y": "--yes"; }; /** * Whether `port` is free — on the wildcard address *and* on both loopback addresses. * * All three, because on macOS/BSD a successful bind does not mean the port is * unused. Sockets carry `SO_REUSEADDR` (Node sets it), under which a wildcard * bind and a specific-address bind on the same port do not conflict — in either * direction. So each probe alone has a blind spot, and they are different ones: * * - **Wildcard only** (what this used to do) misses a server bound to * `127.0.0.1` and `[::1]` — a Homebrew or Postgres.app install, i.e. most * developer machines. 5432 was reported free while it was already serving * another project's database. Docker then published `*:5432` for the same * reason and the container started cleanly, with no "port already allocated" * error anywhere to hint at the collision. `DATABASE_URL` pointed at * `localhost:5432`, `localhost` resolves to `::1` first, and every command * reported success while reading and writing the *pre-existing* database — a * `db push` would have created tables, roles and RLS policies inside it. * * - **Loopback only** misses the opposite case: Docker Desktop publishes a * container's port on `*`, and a specific-address bind succeeds right past it. * That port is free to probe and unusable to publish, so `docker compose up -d * db` fails on "Bind for 0.0.0.0:PORT failed: port is already allocated" — * loudly, but only after the project has been generated around the bad port. * * Requiring all three costs three sockets and leaves neither gap. The wildcard * bind is the one the container itself has to make; the loopback binds are the * addresses `DATABASE_URL` will actually name. */ export declare function isPortAvailable(port: number): Promise; /** * The runtime image tag to pin, given the version of the CLI doing the scaffolding. * * Only a stable release publishes `rebasepro/server` — a multi-arch build on * every push to main would cost minutes per commit for an image nobody pulls. * So pinning a prerelease CLI's own version writes a tag that cannot exist, and * `docker compose up` fails on `manifest unknown`, which is the same dead end * as the missing-repository bug this pinning was added to prevent. * * A prerelease therefore falls back to `latest`, which is correct rather than * merely available: a bundle's manifest declares the runtime range it needs * (`^1`), the image supplies only `@rebasepro/server`, and the framework a * bundle runs is installed from its own `deps.declared` at boot. The current * stable runtime boots a canary bundle by design. * * A floating tag is a real cost — it is what pinning exists to avoid — so say * so in the file rather than leaving a reader to discover it. */ export declare function resolveRuntimeImageTag(cliVersion: string): { tag: string; note?: string; }; export declare function configureEnvFile(targetDirectory: string, databaseUrl?: string): Promise;