import { loadToken, createInternalClientContext, widget_registry_exports } from './chunk-WYC3GIR7.js';
import './chunk-PBYE7BDH.js';
import './chunk-N67QHFFS.js';
import { init_esm_shims } from './chunk-H26U4HNL.js';
import { consola } from 'consola';

// src/commands/widgetset/version/list/versionListCommand.mts
init_esm_shims();
async function versionListCommand({
  foundryUrl,
  widgetSet,
  token,
  tokenFile
}) {
  const loadedToken = await loadToken(token, tokenFile);
  const tokenProvider = () => loadedToken;
  const clientCtx = createInternalClientContext(foundryUrl, tokenProvider);
  consola.start("Fetching versions");
  const response = await widget_registry_exports.listReleases(clientCtx, widgetSet);
  if (response.data.length === 0) {
    consola.info("No widget set versions found");
    return;
  }
  consola.success("Found versions:");
  const semver = await import('semver');
  const sortedVersions = semver.rsort(response.data.map((v) => v.version).filter((v) => semver.valid(v)));
  for (const version of sortedVersions) {
    consola.log(`    - ${version}`);
  }
}

export { versionListCommand as default };
//# sourceMappingURL=versionListCommand-UUZ4FQGK.js.map
//# sourceMappingURL=versionListCommand-UUZ4FQGK.js.map