import { readStringFlag } from "../options.js";
export function resolveInstance(config, parsed) {
    const name = readStringFlag(parsed.flags, "instance") ?? config.defaultInstance;
    if (!name) {
        throw new Error("No instance selected. Use --instance or add an instance first.");
    }
    const instance = config.instances[name];
    if (!instance) {
        throw new Error(`Unknown instance: ${name}`);
    }
    return [name, instance];
}
//# sourceMappingURL=instance-selection.js.map