import { Command } from 'commander';
import { RegistryClient, readCredentials } from '@expxagents/registry-client';
export const infoCommand = new Command('info')
    .description('Show squad details from the registry')
    .argument('<name>', 'Squad name (@scope/name)')
    .action(async (name) => {
    const creds = readCredentials();
    const client = new RegistryClient({
        registryUrl: creds?.registryUrl || 'https://expxagents-marketplace-production.up.railway.app',
    });
    try {
        const squad = await client.getSquad(name);
        console.log(`${squad.icon || ''} ${squad.fullName}`);
        console.log(`  ${squad.description || 'No description'}\n`);
        console.log(`  Latest:    ${squad.latestVersion || 'none'}`);
        console.log(`  Versions:  ${squad.versions.join(', ')}`);
        console.log(`  Category:  ${squad.category || 'none'}`);
        console.log(`  Tags:      ${squad.tags.join(', ') || 'none'}`);
        console.log(`  Downloads: ${squad.downloads}`);
        console.log(`  Rating:    ${squad.rating > 0 ? `${squad.rating.toFixed(1)} (${squad.ratingCount} votes)` : 'none'}`);
        console.log(`  Author:    @${squad.scope}`);
        console.log(`  Visibility: ${squad.visibility}`);
    }
    catch (err) {
        console.error(`\u2717 ${err.message}`);
        process.exit(1);
    }
});
