/**
 * Centralized signal handler for graceful CLI shutdown
 *
 * Manages SIGINT (Ctrl+C) and SIGTERM handling across the CLI:
 * - Runs registered cleanup callbacks in LIFO order
 * - Kills tracked child processes
 * - Exits with code 130 (standard Unix SIGINT convention)
 * - Prevents ERR_USE_AFTER_CLOSE from dangling inquirer prompts
 *
 * Usage:
 * ```typescript
 * import { onShutdown, trackChildProcess } from '../lib/signal-handler.js'
 *
 * // Register cleanup (returns unregister function)
 * const unregister = onShutdown(async () => {
 *   db.close()
 * })
 *
 * // Track a child process for automatic cleanup
 * trackChildProcess(childProc)
 * ```
 */
import type { ChildProcess } from 'node:child_process';
/** Cleanup callback - should be fast and not throw */
type CleanupFn = () => void | Promise<void>;
/**
 * Install global signal handlers. Called once at CLI startup.
 * Safe to call multiple times (idempotent).
 */
export declare function installSignalHandlers(): void;
/**
 * Register a cleanup callback to run on shutdown.
 * Callbacks run in LIFO order (most recently registered runs first).
 *
 * @returns Unregister function to remove the callback
 */
export declare function onShutdown(fn: CleanupFn): () => void;
/**
 * Track a child process for automatic cleanup on shutdown.
 * The process will receive SIGTERM when the CLI exits.
 *
 * Automatically removes itself from tracking when it exits.
 */
export declare function trackChildProcess(child: ChildProcess): void;
/**
 * Check if the process is currently shutting down.
 * Useful for avoiding work after SIGINT.
 */
export declare function isExiting(): boolean;
/**
 * Wrap an inquirer prompt call to handle SIGINT gracefully.
 * On SIGINT during a prompt, triggers the shutdown sequence
 * instead of letting inquirer throw ERR_USE_AFTER_CLOSE.
 *
 * @param promptFn - Function that calls inquirer.prompt()
 * @returns The prompt result
 */
export declare function withSignalSafePrompt<T>(promptFn: () => Promise<T>): Promise<T>;
export {};
