import { getGlobalCatalystAPIClient } from '../../../config';
import * as tui from '../../../tui';
export async function createOAuthClient(ctx, explicitOrgId) {
    const orgId = explicitOrgId ??
        ctx.project?.orgId ??
        ctx.options.orgId ??
        (process.env.AGENTUITY_CLOUD_ORG_ID || ctx.config?.preferences?.orgId);
    if (!orgId) {
        tui.fatal('Organization ID is required. Either run from a project directory or use --org-id flag.');
    }
    return getGlobalCatalystAPIClient(ctx.logger, ctx.auth, ctx.config?.name, orgId, ctx.config);
}
//# sourceMappingURL=util.js.map