/**
 * Zero-downtime atomic release management for Forge-style git deploys.
 *
 * Directory layout under a site's base (`/var/www/<site>`):
 *   releases/<id>/   one checkout per deploy
 *   shared/          files persisted across releases (storage, .env, …)
 *   current ->       symlink to the active release
 *
 * A deploy clones into `releases/<id>`, symlinks the shared paths in, runs the
 * deploy script, then atomically repoints `current`. Old releases are pruned
 * to a retention count for rollback. These map to Forge's deploy macros:
 *   $CREATE_RELEASE   → {@link buildEnsureReleaseLayout} + git clone + {@link buildLinkSharedPaths}
 *   $ACTIVATE_RELEASE → {@link buildActivateRelease} (+ {@link buildPruneReleases})
 */
/** Paths that are always shared across releases (Forge shares `.env` implicitly). */
export declare const DEFAULT_SHARED_PATHS: readonly string[];
/** Default number of past releases to retain for rollback. */
export declare const DEFAULT_KEEP_RELEASES = 4;
/** Number of per-deploy output logs to keep on the box. */
export declare const DEFAULT_KEEP_DEPLOY_LOGS = 20;
/** ts-cloud metadata dir for a site (deploy history + per-deploy logs). */
export declare function deployMetaDir(base: string): string;
/** Append-only deploy history log path for a site. */
export declare function deployHistoryPath(base: string): string;
/** Per-deploy output log path for a release. */
export declare function deployLogPath(base: string, releaseId: string): string;
export interface ReleasePaths {
    /** Site base directory (`/var/www/<site>`). */
    base: string;
    /** Releases parent (`<base>/releases`). */
    releases: string;
    /** Shared parent (`<base>/shared`). */
    shared: string;
    /** Active-release symlink (`<base>/current`). */
    current: string;
    /** This deploy's release dir (`<base>/releases/<id>`). */
    release: string;
}
/** Resolve the standard release layout paths for a site + release id. */
export declare function releasePaths(base: string, releaseId: string): ReleasePaths;
/**
 * Ensure the releases/ and shared/ skeleton exist, including the Laravel
 * `storage` tree and an empty shared `.env` so symlinks never dangle.
 */
export declare function buildEnsureReleaseLayout(paths: ReleasePaths, sharedPaths?: readonly string[]): string[];
/**
 * Symlink every shared path from `shared/` into the freshly checked-out release,
 * replacing whatever the checkout shipped (e.g. the repo's empty `storage`).
 */
export declare function buildLinkSharedPaths(paths: ReleasePaths, sharedPaths?: readonly string[]): string[];
/**
 * Atomically repoint `current` at the new release. Writes a temp symlink and
 * `mv -T`s it over `current` so there is no window where `current` is missing.
 */
export declare function buildActivateRelease(paths: ReleasePaths): string[];
/**
 * Roll the active release back to a previous one (Forge-style rollback). With
 * `to` set, points `current` at `releases/<to>`; otherwise picks the most recent
 * release that isn't the one `current` resolves to. Atomic (temp symlink + `mv
 * -T`), and a no-op-safe guard fails loudly if the target is missing rather than
 * leaving `current` dangling.
 *
 * With `unitBase` set (e.g. `myapp-api`), the script also swaps the running
 * systemd release instance for sites deployed zero-downtime style (templated
 * `<unitBase>@<releaseId>` units pinned to their release dirs): it starts the
 * instance for the rolled-back release — overlapping on the SO_REUSEPORT port —
 * then stops the newer one, so even the rollback itself is zero-downtime. Sites
 * on the legacy single unit just get a restart. The caller appends any engine
 * reload (php-fpm/queues) — see {@link import('./laravel-deploy')}.
 */
export declare function buildRollbackScript(paths: ReleasePaths, options?: {
    to?: string;
    unitBase?: string;
}): string[];
/**
 * Remove all but the newest `keep` releases (by mtime). `current` always points
 * at the newest, so it is never pruned.
 */
export declare function buildPruneReleases(paths: ReleasePaths, keep?: number): string[];
/** Owner marker recording which project a site's base dir belongs to. */
export declare function siteOwnerPath(base: string): string;
/**
 * Guard a site's base dir against cross-project deploys on a shared box
 * (`attachTo`): the first deploy stamps `<base>/.ts-cloud/owner` with the
 * project slug; a later deploy whose slug differs fails loudly instead of
 * silently overwriting another tenant's releases. Two projects can only trip
 * this by deriving the same site key (e.g. both claiming the same domain),
 * which is a config conflict the operator must resolve — not one deploys
 * should paper over. Emitted before anything mutates the dir.
 */
export declare function buildSiteOwnerGuard(base: string, slug: string): string[];
export interface DeployHistoryOptions {
    /** This deploy's release id. */
    releaseId: string;
    /** Commit SHA being deployed (recorded in the history line). */
    commit?: string;
    /** Branch being deployed. */
    branch?: string;
    /** Per-deploy logs to retain. @default {@link DEFAULT_KEEP_DEPLOY_LOGS} */
    keepLogs?: number;
}
/**
 * Header lines that record deployment history + capture per-deploy output
 * (Forge's deployment log). Emitted near the top of the deploy script: it tees
 * all stdout/stderr to `<base>/.ts-cloud/deploys/<releaseId>.log` and installs
 * an EXIT trap that appends a `<ts>\t<releaseId>\t<commit>\t<status>` line to
 * `<base>/.ts-cloud/deploy-history.log` — so both successful and failed deploys
 * are recorded (the trap reads `$?`). Requires bash (the deploy script already
 * uses `set -euo pipefail`).
 */
export declare function buildDeployHistoryHeader(base: string, options: DeployHistoryOptions): string[];
