/** * Result from appstash() containing all resolved directory paths */ export interface AppStashResult { /** Root directory: ~/. */ root: string; /** Config directory: ~/./config */ config: string; /** Cache directory: ~/./cache */ cache: string; /** Data directory: ~/./data */ data: string; /** Logs directory: ~/./logs */ logs: string; /** Temp directory: /tmp/ */ tmp: string; /** True if XDG or tmp fallback was used during ensure */ usedFallback?: boolean; } /** * Options for appstash() */ export interface AppStashOptions { /** Base directory (defaults to APPSTASH_BASE_DIR env var, then os.homedir()) */ baseDir?: string; /** Use XDG fallback if home fails (default: true) */ useXdgFallback?: boolean; /** Automatically create directories (default: false) */ ensure?: boolean; /** Root for temp directory (defaults to os.tmpdir()) */ tmpRoot?: string; } /** * Result from ensure() containing created directories */ export interface EnsureResult { /** Directories that were created */ created: string[]; /** True if XDG or tmp fallback was used */ usedFallback: boolean; } /** * Resolve application directories for a given tool name * * Primary: ~/./{config,cache,data,logs} * Fallback: XDG directories (only if home fails or ensure fails) * * @param tool - Tool name (e.g., 'pgpm', 'lql') * @param options - Configuration options * @returns Resolved directory paths * * @example * ```typescript * import { appstash } from 'appstash'; * * // Get directories without creating them * const dirs = appstash('pgpm'); * console.log(dirs.config); // ~/.pgpm/config * * // Get directories and create them * const dirs = appstash('pgpm', { ensure: true }); * ``` */ export declare function appstash(tool: string, options?: AppStashOptions): AppStashResult; /** * Ensure directories exist, creating them if needed * Never throws - returns fallback paths on failure * * @param dirs - Directory paths to create * @returns Result with created directories and fallback flag * * @example * ```typescript * import { appstash, ensure } from 'appstash'; * * const dirs = appstash('pgpm'); * const result = ensure(dirs); * console.log(result.created); // ['~/.pgpm', '~/.pgpm/config', ...] * ``` */ export declare function ensure(dirs: AppStashResult): EnsureResult; /** * Resolve a path within a specific directory kind * * @param dirs - Directory paths from appstash() * @param kind - Directory kind (config, cache, data, logs, tmp) * @param parts - Path parts to join * @returns Resolved path * * @example * ```typescript * import { appstash, resolve } from 'appstash'; * * const dirs = appstash('pgpm'); * const dbPath = resolve(dirs, 'data', 'repos', 'my-repo'); * // Returns: ~/.pgpm/data/repos/my-repo * ``` */ export declare function resolve(dirs: AppStashResult, kind: 'config' | 'cache' | 'data' | 'logs' | 'tmp', ...parts: string[]): string; export { createConfigStore } from './config-store'; export type { ClientConfig, ConfigStore, ConfigStoreOptions, ContextConfig, ContextCredentials, ContextTargetEndpoint, Credentials, GlobalSettings, } from './config-store';