import{p as _,v as R}from"./chunk-PTIJDS6I.js";import{c as g,l as P}from"./chunk-VSZS3FAJ.js";import{b as N}from"./chunk-Q6LCSRIW.js";import{D as w,F as v,R as L,w as T,z as C}from"./chunk-E24W34C4.js";import{d as F}from"./chunk-ELIH6GCC.js";import{Aa as I,Ca as k,Ta as A,Va as E,ka as b,ma as f,ua as y}from"./chunk-EYDNSYYE.js";import{d as r}from"./chunk-773TIA5M.js";import{r as H}from"./chunk-T6CC5WUU.js";import{e as D,g as d}from"./chunk-VKWPEFWQ.js";d();d();var h="https://github.com/Shopify/skeleton-theme.git",q="https://github.com/Shopify/theme-liquid-docs.git",S={all:"All",github:"VS Code (GitHub Copilot)",cursor:"Cursor",claude:"Claude"};async function G(t,e){await U(t,e)}async function O(t,e){await U(t,e,!0)}async function U(t,e,o){await w([{title:`Cloning ${t} into ${e}`,task:async()=>{await g({repoUrl:t,destination:e,latestTag:o,shallow:!0}),await P(e),t===h&&(await Promise.all(Object.keys(S).map(async c=>x(r(e,`.${c}`)))),await x(r(e,".git")))}}])}async function x(t){await A(t)&&await k(t)}async function M(){return await C({message:"Which LLM instruction file would you like to include in your theme?",choices:[...Object.entries(S).map(([e,o])=>({label:o,value:e})),{label:"Skip",value:null}]})}async function $(t,e){let o=[];await w([{title:`Adding AI instructions into ${t}`,task:async()=>{await b(async c=>{await g({repoUrl:q,destination:c,shallow:!0});let l=e==="all"?Object.keys(S).filter(a=>a!=="all"):[e];try{let a=r(c,"ai","github","copilot-instructions.md"),s=await f(a),n=r(t,"AGENTS.md"),u=`# AGENTS.md

${s}`;await y(n,u),(await Promise.all(l.map(p=>W(t,n,p)))).forEach(p=>{p.copiedFile&&o.push(p.copiedFile)})}catch{throw new F("Failed to create AI instructions")}})}}]),o.length>0&&T({headline:"Files created instead of symlinks.",body:`Shopify CLI attempted to create symbolic links between AGENTS.md and ${o.join(", ")}, but your system doesn't have Developer Mode enabled or symlinks are disabled. Separate files were created instead.`})}async function W(t,e,o){if(o==="cursor")return{};let l={github:"copilot-instructions.md",claude:"CLAUDE.md"}[o],a=r(t,l);try{return await I(e,a),{}}catch(s){if(s instanceof Error){let n=await f(e);return await y(a,n),{copiedFile:l}}else throw s}}var m=D(H(),1);var j,i=class extends R{async command(e,o,c,l){let a=l.name??await this.promptName(e.path),s=e["clone-url"],n=r(e.path,a);if(e.latest?await O(s,n):await G(s,n),!L())return;let u=await M();u&&await $(n,u)}async promptName(e){let o=await E({suffix:"theme",directory:e,family:"creative"});return v({message:"Name of the new theme",defaultValue:o})}};j=i;i.summary="Clones a Git repository to use as a starting point for building a new theme.";i.descriptionWithMarkdown=`Clones a Git repository to your local machine to use as the starting point for building a theme.

  If no Git repository is specified, then this command creates a copy of Shopify's [Skeleton theme](${h}), with the specified name in the current folder. If no name is provided, then you're prompted to enter one.

  > Caution: If you're building a theme for the Shopify Theme Store, then you can use our example theme as a starting point. However, the theme that you submit needs to be [substantively different from existing themes](https://shopify.dev/docs/themes/store/requirements#uniqueness) so that it provides added value for users.
  `;i.description=j.descriptionWithoutMarkdown();i.usage="theme init [name] [flags]";i.args={name:m.Args.string({name:"name",description:"Name of the new theme",required:!1})};i.flags={...N,path:_.path,"clone-url":m.Flags.string({char:"u",default:h,description:"The Git URL to clone from. Defaults to Shopify's Skeleton theme.",env:"SHOPIFY_FLAG_CLONE_URL"}),latest:m.Flags.boolean({char:"l",description:"Downloads the latest release of the `clone-url`",env:"SHOPIFY_FLAG_LATEST"})};i.multiEnvironmentsFlags=null;var se=i;export{se as a};
