import { loadToken, createInternalClientContext, widget_registry_exports } from './chunk-VPU4ENPI.js';
import './chunk-VI2PPUJW.js';
import './chunk-ESVT7U37.js';
import { init_esm_shims } from './chunk-RBJBODXB.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-KBAEYYTR.js.map
//# sourceMappingURL=versionListCommand-KBAEYYTR.js.map