/** * Install Context Utility * Issue #136: DRY refactoring - extract common install detection functions * * This module provides centralized functions for detecting the install type * (global vs local npm install) and resolving configuration directories. * * Extracted from env-setup.ts to solve circular import issues and follow DRY principle. * * @module install-context */ /** * Check if running as global npm package * Issue #119: Determine .env location based on install type * Issue #136: Extracted to avoid circular imports * * @returns true if running as global npm package * * @example * ```typescript * if (isGlobalInstall()) { * // Use ~/.commandmate for config * } else { * // Use current working directory * } * ``` */ export declare function isGlobalInstall(): boolean; /** * Check if the running code was resolved from the npx cache * Issue #1319: `npx commandmate` must not be treated as an installed CLI * * npm resolves `npx ` under `/_npx//node_modules/`, * which isGlobalInstall() reports as global on purpose (Issue #1195: config and * db must still land in ~/.commandmate). This answers a narrower question that * isGlobalInstall() cannot: is this process a throwaway npx run rather than the * user's own install? Callers that would mutate the installation need both. * * @returns true if running from the npx cache * * @example * ```typescript * if (isNpxExecution()) { * // Do not modify the user's install from a throwaway process * } * ``` */ export declare function isNpxExecution(): boolean; /** * Get the config directory path * Issue #119: Returns ~/.commandmate for global, cwd for local * Issue #125: Added symlink resolution for security (path traversal protection) * Issue #136: Extracted to avoid circular imports * * @returns Path to config directory (absolute, with symlinks resolved) * @throws Error if config directory resolves outside home directory (for global install) * * @example * ```typescript * const configDir = getConfigDir(); * // Global: /Users/username/.commandmate * // Local: /path/to/project (resolved from symlinks) * ``` */ export declare function getConfigDir(): string; /** * Ensure the config directory exists with proper permissions * Issue #136: Utility for creating config directory if needed * * @returns Path to config directory (created if needed) */ export declare function ensureConfigDir(): string; //# sourceMappingURL=install-context.d.ts.map