import{a as C}from"./chunk-6ZRHK4ON.js";import{a as E}from"./chunk-7XQDZF73.js";import{Fa as y,W as F,X as _,Y as x}from"./chunk-UZ7U322K.js";import{b as I}from"./chunk-Q6LCSRIW.js";import{D as A,v,x as h}from"./chunk-E24W34C4.js";import{d as w}from"./chunk-3QVXHF6I.js";import{f as k}from"./chunk-ELIH6GCC.js";import{r as b}from"./chunk-T6CC5WUU.js";import{e as T,g as d}from"./chunk-VKWPEFWQ.js";d();d();async function P(n){let{developerPlatformClient:e,app:m,remoteApp:o}=n,{extensionIdentifiersBreakdown:a,versionDetails:r}=await F(e,o,n.version),l=await _({developerPlatformClient:e,apiKey:o.apiKey,localApp:m,remoteApp:o,versionAppModules:r.appModuleVersions.map(t=>({...t})),release:!0});if(!await x({configExtensionIdentifiersBreakdown:l,extensionIdentifiersBreakdown:a,appTitle:o.title,release:!0,force:n.force,allowUpdates:n.allowUpdates,allowDeletes:n.allowDeletes}))throw new k;let f=[{title:"Releasing version",task:async t=>{t.appRelease=await e.release({app:o,version:{versionId:r.uuid,appVersionId:r.id}})}}],{appRelease:{appRelease:i}}=await A(f),u=[{link:{label:r.versionTag??void 0,url:r.location}},r.message?`
${r.message}`:""];if(i.userErrors&&i.userErrors.length>0){let t=i.userErrors?.map(R=>R.message).join(", ");h({headline:"Version couldn't be released.",body:[...u,`${u.length>0?`

`:""}${t}`]})}else v({headline:"Version released to users.",body:u})}var p=T(b(),1);var g,s=class extends C{async run(){let{flags:e}=await this.parse(g),m=e["client-id"];await w(()=>({cmd_app_reset_used:e.reset}));let o=e["allow-updates"],a=e["allow-deletes"],r=!!(o&&a),l=[];!o&&!a&&l.push("allow-updates"),this.failMissingNonTTYFlags(e,l);let{app:c,remoteApp:f,developerPlatformClient:i}=await y({directory:e.path,clientId:m,forceRelink:e.reset,userProvidedConfigName:e.config});return await P({app:c,remoteApp:f,developerPlatformClient:i,force:r,allowUpdates:o,allowDeletes:a,version:e.version}),{app:c}}};g=s;s.summary="Release an app version.";s.usage="app release --version <version>";s.descriptionWithMarkdown="Releases an existing app version. Pass the name of the version that you want to release using the `--version` flag.";s.description=g.descriptionWithoutMarkdown();s.flags={...I,...E,"allow-updates":p.Flags.boolean({hidden:!1,description:"Allows adding and updating extensions and configuration without requiring user confirmation. Recommended option for CI/CD environments.",env:"SHOPIFY_FLAG_ALLOW_UPDATES"}),"allow-deletes":p.Flags.boolean({hidden:!1,description:"Allows removing extensions and configuration without requiring user confirmation. For CI/CD environments, the recommended flag is --allow-updates.",env:"SHOPIFY_FLAG_ALLOW_DELETES"}),version:p.Flags.string({hidden:!1,description:"The name of the app version to release.",env:"SHOPIFY_FLAG_VERSION",required:!0})};var G=s;export{G as a};
