import type { ChildProcess } from 'node:child_process';
/**
 * Cross-runtime file handle creator
 * Compatible with Bun.file() API
 */
export declare function file(path: string): FileHandle;
/**
 * Cross-runtime file writer
 * Compatible with Bun.write() API
 */
export declare function write(path: string, content: string | Uint8Array | ArrayBuffer): Promise<number>;
/**
 * Cross-runtime process spawner
 * Compatible with Bun.spawn() API
 */
export declare function spawnProcess(command: string | string[], options?: CompatSpawnOptions): SpawnResult;
/**
 * Read a file as text with cross-runtime compatibility.
 * On Node.js we skip the FileHandle wrapper allocation and call readFile directly.
 */
export declare function readTextFile(path: string): Promise<string>;
/**
 * Check if a file exists with cross-runtime compatibility.
 * On Node.js we go straight to stat() — the FileHandle indirection only
 * mattered for Bun's optimized exists() check.
 */
export declare function fileExists(path: string): Promise<boolean>;
/**
 * Write text to a file with cross-runtime compatibility
 */
export declare function writeTextFile(path: string, content: string): Promise<void>;
/**
 * Get runtime information
 */
export declare function getRuntimeInfo(): RuntimeInfo;
/**
 * Runtime detection
 */
export declare const isBun: boolean;
export declare const isNode: boolean;
/**
 * Current runtime name
 */
export declare const runtime: 'bun' | 'node';
/**
 * File handle interface compatible with Bun.file()
 */
export declare interface FileHandle {
  exists: () => Promise<boolean>
  text: () => Promise<string>
  arrayBuffer: () => Promise<ArrayBuffer>
  size: number
  name: string
}
/**
 * Spawn result interface compatible with Bun.spawn()
 */
export declare interface SpawnResult {
  pid: number
  stdout: ReadableStream<Uint8Array> | NodeJS.ReadableStream
  stderr: ReadableStream<Uint8Array> | NodeJS.ReadableStream
  stdin: WritableStream<Uint8Array> | NodeJS.WritableStream | null
  exited: Promise<number>
  kill: (signal?: number) => void
  ref: () => void
  unref: () => void
}
/**
 * Spawn options compatible with Bun.spawn()
 */
export declare interface CompatSpawnOptions {
  cwd?: string
  env?: Record<string, string | undefined>
  stdin?: 'inherit' | 'pipe' | 'ignore' | null
  stdout?: 'inherit' | 'pipe' | 'ignore' | null
  stderr?: 'inherit' | 'pipe' | 'ignore' | null
}
/**
 * Runtime information
 */
export declare interface RuntimeInfo {
  name: 'bun' | 'node'
  version: string
  isBun: boolean
  isNode: boolean
}
/**
 * Node.js implementation of Bun-like file handle
 */
declare class NodeFileHandle implements FileHandle {
  name: string;
  constructor(path: string);
  exists(): Promise<boolean>;
  text(): Promise<string>;
  arrayBuffer(): Promise<ArrayBuffer>;
  get size(): number;
}
/**
 * Node.js implementation of Bun-like spawn result
 */
declare class NodeSpawnResult implements SpawnResult {
  pid: number;
  stdout: NodeJS.ReadableStream;
  stderr: NodeJS.ReadableStream;
  stdin: NodeJS.WritableStream | null;
  exited: Promise<number>;
  constructor(proc: ChildProcess);
  kill(signal?: number): void;
  ref(): void;
  unref(): void;
}
