import { execSync } from 'child_process';

/** Error thrown by `execSyncVarlock` when the CLI exits with a non-zero status code and `fullResult` is enabled. */
declare class VarlockExecError extends Error {
    stdout: string;
    stderr: string;
    exitCode: number;
    constructor(message: string, stdout: string, stderr: string, exitCode: number);
}
type ExecVarlockResult = {
    stdout: string;
    stderr: string;
};
type ExecSyncVarlockOpts = Parameters<typeof execSync>[1] & {
    exitOnError?: boolean;
    showLogsOnError?: boolean;
    /**
     * Additional directory to start searching for the varlock binary from.
     * Searched before process.cwd(). Pass `import.meta.dirname` from the
     * call-site so that in monorepos the binary installed next to the
     * importing package is found even when cwd is an unrelated workspace root.
     */
    callerDir?: string;
    /**
     * When true, return `{ stdout, stderr }` instead of just the stdout string,
     * and throw `VarlockExecError` (with `.stdout`, `.stderr`, `.exitCode`) on failure
     * instead of the raw execSync error.
     */
    fullResult?: boolean;
};
/**
 * Small helper to call execSync and call the varlock cli.
 *
 * When the user runs via a package manager, it will inject node_modules/.bin into PATH
 * but otherwise we may need to try to find that path ourselves.
 *
 * @returns stdout as a string by default, or `{ stdout, stderr }` when `fullResult: true`
 */
declare function execSyncVarlock(command: string, opts?: ExecSyncVarlockOpts & {
    fullResult?: false;
}): string;
declare function execSyncVarlock(command: string, opts: ExecSyncVarlockOpts & {
    fullResult: true;
}): ExecVarlockResult;

export { type ExecVarlockResult, VarlockExecError, execSyncVarlock };
