import { Command } from "commander"; import chalk from "chalk"; import { PLATFORM_REGISTRY } from "../lib/install-path.js"; /** * `skills-hub list-platforms`, print the platform registry with detection * status. Useful for users who want to know which AI agents the CLI will * install to when they run `skills-hub install `. */ export const listPlatformsCommand = new Command("list-platforms") .description( "List all supported install targets and whether each is detected on this machine", ) .option("--json", "Output as JSON") .action((options: { json?: boolean }) => { const rows = PLATFORM_REGISTRY.map((p) => ({ id: p.id, label: p.label, detected: p.detect(), format: p.format, path: p.paths[0], })); if (options.json) { console.log(JSON.stringify(rows, null, 2)); return; } console.log(chalk.bold("Supported install targets:")); console.log(""); const idWidth = Math.max(...rows.map((r) => r.id.length)); const labelWidth = Math.max(...rows.map((r) => r.label.length)); for (const r of rows) { const status = r.detected ? chalk.green("detected") : chalk.dim("not detected"); console.log( ` ${r.id.padEnd(idWidth)} ${r.label.padEnd(labelWidth)} ${status} ${chalk.dim(r.path)}`, ); } console.log(""); console.log( chalk.dim( "Use --target=[,...] or --all with `skills-hub install`.", ), ); });