/**
 * Shared helpers for `shep bedrock` subcommands.
 *
 * - `appOption`: applies the common `--app <id>` Commander option.
 * - `pipeProgressToStdout`: typed callback that mirrors BedrockProgressChunk
 *   to process.stdout / process.stderr.
 * - `renderBedrockError`: pretty-prints typed bedrock domain errors with
 *   their attached remediation string.
 */
import { messages } from '../../ui/index.js';
export function appOption(cmd) {
    return cmd.requiredOption('--app <id>', 'Application id (required)');
}
export function pipeProgressToStdout(chunk) {
    // Both stdout and stderr chunks are mirrored to the parent's stdout so
    // users see a single coherent stream, matching `shep install`'s convention.
    process.stdout.write(chunk.data);
}
export function renderBedrockError(label, error) {
    const err = error instanceof Error ? error : new Error(String(error));
    messages.error(label, err);
    const candidate = err;
    if (candidate.remediation) {
        messages.info(candidate.remediation);
    }
    process.exitCode = 1;
}
