/** * PID file management for the limps HTTP daemon. * * PID files are stored in OS-standard application directories: * - macOS: ~/Library/Application Support/limps/pids/ * - Windows: %APPDATA%/limps/pids/ * - Linux: $XDG_DATA_HOME/limps/pids/ or ~/.local/share/limps/pids/ * * This allows system-wide awareness of which ports are in use. */ /** * Contents of a PID file. */ export interface PidFileContents { pid: number; port: number; host: string; startedAt: string; configPath?: string; logPath?: string; } /** * Get the system-wide PID directory. * Creates the directory if it doesn't exist. * * @returns Path to the system PID directory * @throws Error if directory cannot be created (e.g., permission denied, read-only filesystem) */ export declare function getSystemPidDir(): string; /** * Get the PID file path for a given port. * * PID files are stored system-wide by port number to prevent * duplicate daemons on the same port across different projects. * * @param port - The HTTP server port * @returns Path to the PID file (e.g., ~/Library/Application Support/limps/pids/limps-4269.pid) */ export declare function getPidFilePath(port: number): string; /** * Write a PID file. * * @param pidFilePath - Path to write the PID file * @param contents - PID file contents */ export declare function writePidFile(pidFilePath: string, contents: PidFileContents): void; /** * Read a PID file. * * @param pidFilePath - Path to the PID file * @returns PID file contents, or null if file doesn't exist or is invalid */ export declare function readPidFile(pidFilePath: string): PidFileContents | null; /** * Remove a PID file. * * @param pidFilePath - Path to the PID file */ export declare function removePidFile(pidFilePath: string): void; /** * Check if a process is still running. * * @param pid - Process ID to check * @returns true if the process is running */ export declare function isProcessRunning(pid: number): boolean; /** * Read PID file and check if the daemon is actually running. * Cleans up stale PID files automatically. * * @param pidFilePath - Path to the PID file * @returns PID file contents if daemon is running, null otherwise */ export declare function getRunningDaemon(pidFilePath: string): PidFileContents | null; /** * Scan the system PID directory and return all running daemons. * Cleans up stale PID files automatically. * * @returns Array of PID file contents for all running daemons */ export declare function discoverRunningDaemons(): PidFileContents[]; //# sourceMappingURL=pidfile.d.ts.map