'use server';
import { resolve } from '../../lib/server-container.js';
import { GitHubAuthError } from '../../../../../packages/core/src/application/ports/output/services/github-repository-service.interface.js';
export async function listGitHubRepositories(input) {
    try {
        const useCase = resolve('ListGitHubRepositoriesUseCase');
        const repos = await useCase.execute(input);
        return { repos };
    }
    catch (error) {
        if (error instanceof GitHubAuthError) {
            return { error: 'GitHub CLI is not authenticated. Run `gh auth login` to sign in.' };
        }
        const message = error instanceof Error ? error.message : 'Failed to list repositories';
        return { error: message };
    }
}
