/**
 * Shared platform prompt/config logic.
 * Used by `lobu init` when scaffolding optional local platform config.
 */
import { input, password } from "@inquirer/prompts";
import { getPlatformDefinition } from "./registry.js";
export async function promptPlatformConfig(platform) {
    const platformConfig = {};
    const platformSecrets = [];
    const def = getPlatformDefinition(platform);
    if (!def)
        return { platformConfig, platformSecrets };
    for (const line of def.intro ?? []) {
        console.log(line);
    }
    const values = {};
    for (const field of def.fields) {
        const value = field.secret
            ? await password({ message: field.label, mask: true })
            : await input({ message: field.label });
        values[field.key] = value;
        if (value) {
            platformConfig[field.key] = `$${field.envVar}`;
            platformSecrets.push({ envVar: field.envVar, value });
        }
    }
    def.finalize?.(platformConfig, values);
    return { platformConfig, platformSecrets };
}
//# sourceMappingURL=platform-prompts.js.map