export declare const SERVICE_NAME = "shortlinks"; export declare const DEFAULT_DATA_DIR: string; /** * The environment the app-home helpers read. Every helper takes the env the * CALLER hands over (defaulting to the live process env) instead of reading * `process.env` behind the caller's back: a caller-built environment — a test * fixture, an env injected into the MCP server or the SDK — must never leak the * on-box store into the real `~/.hasna/shortlinks` (hasna/apps#1720 * validation: `bun test` used to plant `~/.hasna/shortlinks/shortlinks.db` on * the station this way). */ export type ConfigEnv = Record; export interface ShortlinksConfig { defaultDomain?: string; publicBaseUrl?: string; } /** * The app home. `SHORTLINKS_HOME` names the directory itself; otherwise * `HASNA_HOME` replaces `~/.hasna` exactly as it does for the @hasna/contracts * credential chain (`$HASNA_HOME/shortlinks`); otherwise `$HOME/.hasna/shortlinks`. * A pure derivation — nothing on disk is created here. A declared-but-blank * variable means unset, as everywhere else at this app's seam. */ export declare function getDataDir(env?: ConfigEnv): string; export declare function ensureDataDir(env?: ConfigEnv): string; /** Path of the config file. A lookup creates nothing; only a write creates the app home. */ export declare function getConfigPath(env?: ConfigEnv): string; export declare function getClickSaltPath(env?: ConfigEnv): string; /** * The on-box SQLite path: an explicit path, else `SHORTLINKS_DB`, else * `/shortlinks.db`. A derivation only — OPENING the database is what * creates it (and its directory), and only the explicit local opt-in does that; * a hosted-mode read (`doctor`, MCP startup) creates nothing under the app home. */ export declare function getDatabasePath(explicitPath?: string, env?: ConfigEnv): string; export declare function getClickSalt(env?: ConfigEnv): string; export declare function loadConfig(env?: ConfigEnv): ShortlinksConfig; export declare function saveConfig(config: ShortlinksConfig, env?: ConfigEnv): void; export declare function updateConfig(patch: ShortlinksConfig, env?: ConfigEnv): ShortlinksConfig; export declare function normalizeHostname(input: string): string; export declare function formatShortUrl(hostname: string, slug: string, publicBaseUrl?: string): string;