import { configPath, DEFAULT_URL, type Env, readConfig, type StoredConfig } from "@taleseal/sdk"; /** * The CLI owns the WRITE side of the stored config; the READ side — configPath, readConfig, * DEFAULT_URL and the empty-is-unset rule (`nonEmpty`) — lives in @taleseal/sdk so every * surface resolves credentials identically. The order the whole tool obeys: * * API key TALESEAL_API_KEY env var → config "apiKey" * Base URL TALESEAL_URL env var → config "url" → DEFAULT_URL * * The config lives at $XDG_CONFIG_HOME/taleseal/config.json (falling back to ~/.config), * written by `taleseal login` with mode 0600. */ /** The read side is the SDK's — re-exported so the CLI's surface is unchanged. */ export { configPath, DEFAULT_URL, type Env, readConfig }; /** The shape `taleseal login` writes — the SDK's stored-config shape, under the CLI's name. */ export type TalesealConfig = StoredConfig; /** Writes the config file (mode 0600; directory created as needed) and returns its path. */ export declare function writeConfig(config: TalesealConfig, env?: Env): string; /** Removes the stored key (keeping a stored "url"); returns whether one was stored. */ export declare function deleteStoredKey(env?: Env): boolean; /** TALESEAL_API_KEY env var → config "apiKey" → undefined. */ export declare function resolveApiKey(env?: Env, config?: TalesealConfig): string | undefined; /** * The three-way key state behind auto-anonymous drafting. `resolveApiKey` collapses a * present-but-blank key into "no key", which is right for refusing but wrong for going * anonymous: a CI secret that fails to load expands to "", and silently publishing an * ownerless page that is hard-deleted in 24 hours — while the pipeline stays green — is * exactly the footgun. Only a key that was never set ANYWHERE ("absent") makes `draft` * eligible for the anonymous path; "empty" keeps refusing loudly. */ export type ApiKeyState = { state: "key"; key: string; } | { state: "absent"; } | { state: "empty"; source: "env" | "config"; }; export declare function resolveApiKeyState(env?: Env): ApiKeyState; /** TALESEAL_URL env var → config "url" → DEFAULT_URL; any trailing slash is stripped. */ export declare function resolveUrl(env?: Env, config?: TalesealConfig): string;