import type { DockerRunner } from "./docker.js"; /** * The machine's local Tenants (tenancy.md §6): one installation per Tenant, each with its own * Host root `~/.nylorun/tenants//`, Compose project `nylorun-`, ports and volumes. */ /** The Tenant a command acts on outside a project when nothing names one. */ export declare const DEFAULT_TENANT = "default"; /** A Tenant name: also part of its Compose project, so Compose's rules apply. */ export declare const TENANT_NAME: RegExp; /** `~/.nylorun`: the Tenants and the machine's settings. Tests pass another directory. */ export declare function defaultNylorunRoot(): string; export declare function tenantsDir(base: string): string; export declare function tenantRoot(base: string, name: string): string; export declare function assertTenantName(name: string, source: string): string; /** A directory name as a Tenant name: lowercased, other characters as `-`, trimmed. */ export declare function sanitizeTenantName(raw: string): string; /** `tenant.json` in a Host root: the Tenant's name and the project it was created for. */ export interface TenantRecord { format: 1; name: string; /** The project directory `nylorun start` created the Tenant in; absent outside a project. */ project?: string; } export declare function tenantRecordPath(root: string): string; export declare function readTenantRecord(root: string): Promise; export declare function writeTenantRecord(root: string, record: Omit): Promise; export interface TenantEntry { name: string; root: string; record: TenantRecord; } /** * The Tenants under `/tenants`, by name: directories with a `tenant.json` (releases * before 0.4 kept other directories there). */ export declare function listTenants(base: string): Promise; /** * The Tenant name for a project without a link: the directory's name, or the first `-2`, * `-3`, … suffix that no Tenant of another project directory holds. A Tenant this project * directory created keeps its name. */ export declare function chooseTenantName(base: string, projectDir: string): Promise; /** * Move the Host roots of nylorun 0.4 (`~/.nylorun/stacks//`) to `tenants//`, when * that is free: `stack.json` becomes `tenant.json`, and `NYLORUN_STACK_NAME` becomes * `NYLORUN_TENANT_NAME` in `docker/.env` (and `docker/compose.yaml`, until the next start * rewrites it). `stacks/` goes when empty. They move rather than start fresh because Compose * project names do not change: a fresh Host root under the same name would reuse the old * volumes with new keys. */ export declare function moveStackRoots(base: string, err: (line: string) => void): Promise; /** * Remove the Studio proxy of nylorun 0.6 (a Caddy container `nylorun-proxy` on its own network, * files in `~/.nylorun/proxy/`). Removing the container also detaches it from the Tenants' * networks, so their `docker compose down` works again. The directory goes last, once Docker * removed both (or never had them), so a Docker that does not answer is retried next time. */ export declare function removeOldProxy(docker: DockerRunner, base: string, err: (line: string) => void): Promise;