import{o as f}from"./chunk-2HZMOK4U.js";import{b as l}from"./chunk-Q6LCSRIW.js";import{b as u}from"./chunk-IDKUJQIG.js";import{d as n}from"./chunk-ELIH6GCC.js";import{Lb as m}from"./chunk-EYDNSYYE.js";import{r as g}from"./chunk-T6CC5WUU.js";import{e as v,g as o}from"./chunk-VKWPEFWQ.js";o();o();var S="https://shopify.dev/assistant/search",w="X-Shopify-Surface",A="cli";async function y(s,e,p){let i=new URLSearchParams({query:s});e&&i.append("api_name",e),p&&i.append("api_version",p);let r;try{r=await f(`${S}?${i.toString()}`,{headers:{Accept:"application/json",[w]:A}})}catch{throw new n("Could not reach shopify.dev to run the search.","Check your network connection and try again.")}let h=await r.text();if(!r.ok){let d=`${r.status} ${r.statusText}`;try{let t=JSON.parse(h);t?.error&&(d=t.error)}catch(t){if(!(t instanceof SyntaxError))throw t}throw new n(`Search failed: ${d}`)}m(h)}var a=v(g(),1),c=class s extends u{static{this.description="Query the shopify.dev vector store and print the most relevant documentation chunks as JSON. Best for programmatic discovery \u2014 surfacing the relevant pieces of documentation for a topic, rather than retrieving a whole document. To download a full document verbatim, use `doc fetch`."}static{this.examples=[`# search shopify.dev for a topic
    shopify doc search --query "subscribe to webhooks"

    # narrow the search to a specific API and version
    shopify doc search --query "create a product" --api-name admin --api-version latest
    `]}static{this.flags={...l,query:a.Flags.string({description:"The search query.",env:"SHOPIFY_FLAG_QUERY",required:!0}),"api-name":a.Flags.string({description:"Limit results to a specific API (for example: admin, storefront, hydrogen, functions). Unrecognized values are ignored.",env:"SHOPIFY_FLAG_API_NAME"}),"api-version":a.Flags.string({description:"Limit results to a specific API version (for example: 2025-10, latest, current).",env:"SHOPIFY_FLAG_API_VERSION"})}}async run(){let{flags:e}=await this.parse(s);await y(e.query,e["api-name"],e["api-version"])}};export{c as a};
