@sequenzy/cli 0.0.180 → 0.0.181

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +3 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -191,7 +191,7 @@ Check the top-level render call using <`+Be+">."}return de}}function Gr(T,de){{i
191
191
  <%s {...props} />
192
192
  React keys must be passed directly to JSX without using spread:
193
193
  let props = %s;
194
- <%s key={someKey} {...props} />`,Ts,bi,$s,bi),fc[bi+Ts]=!0}}if(T===n)Pr(dn);else No(dn);return dn}}var fr=kl;lye.Fragment=n,lye.jsxDEV=fr})()});var iw={};oZ(iw,{program:()=>KR,createCommand:()=>WR,createOption:()=>YR,createArgument:()=>ZR,Command:()=>XR,Option:()=>eQ,Argument:()=>tQ,Help:()=>nQ,CommanderError:()=>rQ,InvalidArgumentError:()=>oQ,InvalidOptionArgumentError:()=>iQ},{program:(m0e)=>KR=m0e,createCommand:(m0e)=>WR=m0e,createOption:(m0e)=>YR=m0e,createArgument:(m0e)=>ZR=m0e,Command:(m0e)=>XR=m0e,Option:(m0e)=>eQ=m0e,Argument:(m0e)=>tQ=m0e,Help:(m0e)=>nQ=m0e,CommanderError:(m0e)=>rQ=m0e,InvalidArgumentError:(m0e)=>oQ=m0e,InvalidOptionArgumentError:(m0e)=>iQ=m0e});var{Argument:GR}=uh(),{Command:ow}=HR(),{CommanderError:$Z,InvalidArgumentError:JR}=Lm(),{Help:NZ}=ew(),{Option:VR}=tw();var KR=new ow,WR=(e)=>new ow(e),YR=(e,t)=>new VR(e,t),ZR=(e,t)=>new GR(e,t),XR=ow,eQ=VR,tQ=GR,nQ=NZ,rQ=$Z,oQ=JR,iQ=JR;var{program:g0e,createCommand:A0e,createArgument:h0e,createOption:y0e,CommanderError:sQ,InvalidArgumentError:b0e,InvalidOptionArgumentError:v0e,Command:aQ,Argument:E0e,Option:I0e,Help:C0e}=iw;var dh={name:"@sequenzy/cli",version:"0.0.180",description:"Sequenzy CLI for email marketing from the terminal",type:"module",bin:{sequenzy:"./dist/index.js"},main:"./src/index.tsx",types:"./src/index.tsx",exports:{".":"./src/index.tsx"},scripts:{dev:"bun --watch src/index.tsx",build:"bun ../../scripts/build-ink-cli.ts",start:"node dist/index.js",lint:"eslint src","type-check":"bun check",test:"sh ../../scripts/run-package-tests.sh src","test:watch":"bun test --watch",prepublishOnly:"bun run build"},dependencies:{commander:"^12.1.0",ink:"^5.0.1","ink-spinner":"^5.0.0","ink-text-input":"^6.0.0","ink-select-input":"^6.0.0","ink-table":"^3.1.0",open:"^10.1.0",react:"^18.3.1",conf:"^13.0.0"},devDependencies:{"@emailer/shared":"workspace:*","@types/bun":"latest","@types/node":"^22.0.0","@types/react":"^18.3.0","bun-types":"latest",typescript:"^7.0.2"},files:["dist"],keywords:["sequenzy","email","cli","marketing"],license:"MIT",repository:{type:"git",url:"https://github.com/sequenzy/sequenzy"}};import{isDeepStrictEqual as Kae}from"node:util";import e1 from"node:process";import su from"node:fs";import t1 from"node:path";import pf from"node:crypto";import Wae from"node:assert";var Xl=(e)=>{let t=typeof e;return e!==null&&(t==="object"||t==="function")};var sw=new Set(["__proto__","prototype","constructor"]),PZ=new Set("0123456789");function ph(e){let t=[],n="",r="start",o=!1;for(let a of e)switch(a){case"\\":{if(r==="index")throw Error("Invalid character in an index");if(r==="indexEnd")throw Error("Invalid character after an index");if(o)n+=a;r="property",o=!o;break}case".":{if(r==="index")throw Error("Invalid character in an index");if(r==="indexEnd"){r="property";break}if(o){o=!1,n+=a;break}if(sw.has(n))return[];t.push(n),n="",r="property";break}case"[":{if(r==="index")throw Error("Invalid character in an index");if(r==="indexEnd"){r="index";break}if(o){o=!1,n+=a;break}if(r==="property"){if(sw.has(n))return[];t.push(n),n=""}r="index";break}case"]":{if(r==="index"){t.push(Number.parseInt(n,10)),n="",r="indexEnd";break}if(r==="indexEnd")throw Error("Invalid character after an index")}default:{if(r==="index"&&!PZ.has(a))throw Error("Invalid character in an index");if(r==="indexEnd")throw Error("Invalid character after an index");if(r==="start")r="property";if(o)o=!1,n+="\\";n+=a}}if(o)n+="\\";switch(r){case"property":{if(sw.has(n))return[];t.push(n);break}case"index":throw Error("Index was not closed");case"start":{t.push("");break}}return t}function aw(e,t){if(typeof t!=="number"&&Array.isArray(e)){let n=Number.parseInt(t,10);return Number.isInteger(n)&&e[n]===e[t]}return!1}function cQ(e,t){if(aw(e,t))throw Error("Cannot use string index")}function lQ(e,t,n){if(!Xl(e)||typeof t!=="string")return n===void 0?e:n;let r=ph(t);if(r.length===0)return n;for(let o=0;o<r.length;o++){let a=r[o];if(aw(e,a))e=o===r.length-1?void 0:null;else e=e[a];if(e===void 0||e===null){if(o!==r.length-1)return n;break}}return e===void 0?n:e}function cw(e,t,n){if(!Xl(e)||typeof t!=="string")return e;let r=e,o=ph(t);for(let a=0;a<o.length;a++){let c=o[a];if(cQ(e,c),a===o.length-1)e[c]=n;else if(!Xl(e[c]))e[c]=typeof o[a+1]==="number"?[]:{};e=e[c]}return r}function uQ(e,t){if(!Xl(e)||typeof t!=="string")return!1;let n=ph(t);for(let r=0;r<n.length;r++){let o=n[r];if(cQ(e,o),r===n.length-1)return delete e[o],!0;if(e=e[o],!Xl(e))return!1}}function dQ(e,t){if(!Xl(e)||typeof t!=="string")return!1;let n=ph(t);if(n.length===0)return!1;for(let r of n){if(!Xl(e)||!(r in e)||aw(e,r))return!1;e=e[r]}return!0}import Yn from"node:path";import pQ from"node:os";import lw from"node:process";var $c=pQ.homedir(),uw=pQ.tmpdir(),{env:Ed}=lw,FZ=(e)=>{let t=Yn.join($c,"Library");return{data:Yn.join(t,"Application Support",e),config:Yn.join(t,"Preferences",e),cache:Yn.join(t,"Caches",e),log:Yn.join(t,"Logs",e),temp:Yn.join(uw,e)}},qZ=(e)=>{let t=Ed.APPDATA||Yn.join($c,"AppData","Roaming"),n=Ed.LOCALAPPDATA||Yn.join($c,"AppData","Local");return{data:Yn.join(n,e,"Data"),config:Yn.join(t,e,"Config"),cache:Yn.join(n,e,"Cache"),log:Yn.join(n,e,"Log"),temp:Yn.join(uw,e)}},LZ=(e)=>{let t=Yn.basename($c);return{data:Yn.join(Ed.XDG_DATA_HOME||Yn.join($c,".local","share"),e),config:Yn.join(Ed.XDG_CONFIG_HOME||Yn.join($c,".config"),e),cache:Yn.join(Ed.XDG_CACHE_HOME||Yn.join($c,".cache"),e),log:Yn.join(Ed.XDG_STATE_HOME||Yn.join($c,".local","state"),e),temp:Yn.join(uw,t,e)}};function dw(e,{suffix:t="nodejs"}={}){if(typeof e!=="string")throw TypeError(`Expected a string, got ${typeof e}`);if(t)e+=`-${t}`;if(lw.platform==="darwin")return FZ(e);if(lw.platform==="win32")return qZ(e);return LZ(e)}import VZ from"node:path";import nn from"node:fs";import{promisify as wo}from"node:util";var UZ=(e,t)=>{let{onError:n}=t;return function(...o){return e.apply(void 0,o).catch(n)}},ra=UZ;var jZ=(e,t)=>{let{onError:n}=t;return function(...o){try{return e.apply(void 0,o)}catch(a){return n(a)}}},bs=jZ;var mQ=250;var zZ=(e,t)=>{let{isRetriable:n}=t;return function(o){let{timeout:a}=o,c=o.interval??mQ,l=Date.now()+a;return function p(...f){return e.apply(void 0,f).catch((h)=>{if(!n(h))throw h;if(Date.now()>=l)throw h;let y=Math.round(c*Math.random());if(y>0)return new Promise((C)=>setTimeout(C,y)).then(()=>p.apply(void 0,f));else return p.apply(void 0,f)})}}},oa=zZ;var MZ=(e,t)=>{let{isRetriable:n}=t;return function(o){let{timeout:a}=o,c=Date.now()+a;return function(...p){while(!0)try{return e.apply(void 0,p)}catch(f){if(!n(f))throw f;if(Date.now()>=c)throw f;continue}}}},ia=MZ;import gQ from"node:process";var Um={isChangeErrorOk:(e)=>{if(!Um.isNodeError(e))return!1;let{code:t}=e;if(t==="ENOSYS")return!0;if(!fQ&&(t==="EINVAL"||t==="EPERM"))return!0;return!1},isNodeError:(e)=>e instanceof Error,isRetriableError:(e)=>{if(!Um.isNodeError(e))return!1;let{code:t}=e;if(t==="EMFILE"||t==="ENFILE"||t==="EAGAIN"||t==="EBUSY"||t==="EACCESS"||t==="EACCES"||t==="EACCS"||t==="EPERM")return!0;return!1},onChangeError:(e)=>{if(!Um.isNodeError(e))throw e;if(Um.isChangeErrorOk(e))return;throw e}},pw=Um;var jm={onError:pw.onChangeError},ri={onError:()=>{return}},fQ=gQ.getuid?!gQ.getuid():!1,Ao={isRetriable:pw.isRetriableError};var HZ={attempt:{chmod:ra(wo(nn.chmod),jm),chown:ra(wo(nn.chown),jm),close:ra(wo(nn.close),ri),fsync:ra(wo(nn.fsync),ri),mkdir:ra(wo(nn.mkdir),ri),realpath:ra(wo(nn.realpath),ri),stat:ra(wo(nn.stat),ri),unlink:ra(wo(nn.unlink),ri),chmodSync:bs(nn.chmodSync,jm),chownSync:bs(nn.chownSync,jm),closeSync:bs(nn.closeSync,ri),existsSync:bs(nn.existsSync,ri),fsyncSync:bs(nn.fsync,ri),mkdirSync:bs(nn.mkdirSync,ri),realpathSync:bs(nn.realpathSync,ri),statSync:bs(nn.statSync,ri),unlinkSync:bs(nn.unlinkSync,ri)},retry:{close:oa(wo(nn.close),Ao),fsync:oa(wo(nn.fsync),Ao),open:oa(wo(nn.open),Ao),readFile:oa(wo(nn.readFile),Ao),rename:oa(wo(nn.rename),Ao),stat:oa(wo(nn.stat),Ao),write:oa(wo(nn.write),Ao),writeFile:oa(wo(nn.writeFile),Ao),closeSync:ia(nn.closeSync,Ao),fsyncSync:ia(nn.fsyncSync,Ao),openSync:ia(nn.openSync,Ao),readFileSync:ia(nn.readFileSync,Ao),renameSync:ia(nn.renameSync,Ao),statSync:ia(nn.statSync,Ao),writeSync:ia(nn.writeSync,Ao),writeFileSync:ia(nn.writeFileSync,Ao)}},Xr=HZ;import eu from"node:process";var AQ="utf8",mw=438,hQ=511;var yQ={},bQ=eu.geteuid?eu.geteuid():-1,vQ=eu.getegid?eu.getegid():-1;var EQ=1000,IQ=!!eu.getuid,eDe=eu.getuid?!eu.getuid():!1,fw=128;var CQ=(e)=>e instanceof Error&&("code"in e);var gw=(e)=>typeof e==="string",mh=(e)=>e===void 0;import JZ from"node:path";import Id from"node:process";import wQ from"node:process";var SQ=wQ.platform==="linux",fh=wQ.platform==="win32";var Aw=["SIGHUP","SIGINT","SIGTERM"];if(!fh)Aw.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(SQ)Aw.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var DQ=Aw;class BQ{constructor(){this.callbacks=new Set,this.exited=!1,this.exit=(e)=>{if(this.exited)return;this.exited=!0;for(let t of this.callbacks)t();if(e)if(fh&&(e!=="SIGINT"&&e!=="SIGTERM"&&e!=="SIGKILL"))Id.kill(Id.pid,"SIGTERM");else Id.kill(Id.pid,e)},this.hook=()=>{Id.once("exit",()=>this.exit());for(let e of DQ)try{Id.once(e,()=>this.exit(e))}catch{}},this.register=(e)=>(this.callbacks.add(e),()=>{this.callbacks.delete(e)}),this.hook()}}var xQ=new BQ;var GZ=xQ.register,_Q=GZ;var Bi={store:{},create:(e)=>{let t=`000000${Math.floor(Math.random()*16777215).toString(16)}`.slice(-6),n=Date.now().toString().slice(-10),r="tmp-",o=`.tmp-${n}${t}`;return`${e}${o}`},get:(e,t,n=!0)=>{let r=Bi.truncate(t(e));if(r in Bi.store)return Bi.get(e,t,n);return Bi.store[r]=n,[r,()=>delete Bi.store[r]]},purge:(e)=>{if(!Bi.store[e])return;delete Bi.store[e],Xr.attempt.unlink(e)},purgeSync:(e)=>{if(!Bi.store[e])return;delete Bi.store[e],Xr.attempt.unlinkSync(e)},purgeSyncAll:()=>{for(let e in Bi.store)Bi.purgeSync(e)},truncate:(e)=>{let t=JZ.basename(e);if(t.length<=fw)return e;let n=/^(\.?)(.*?)((?:\.[^.]+)?(?:\.tmp-\d{10}[a-f0-9]{6})?)$/.exec(t);if(!n)return e;let r=t.length-fw;return`${e.slice(0,-t.length)}${n[1]}${n[2].slice(0,-r)}${n[3]}`}};_Q(Bi.purgeSyncAll);var zm=Bi;function hw(e,t,n=yQ){if(gw(n))return hw(e,t,{encoding:n});let o={timeout:n.timeout??EQ},a=null,c=null,l=null;try{let p=Xr.attempt.realpathSync(e),f=!!p;e=p||e,[c,a]=zm.get(e,n.tmpCreate||zm.create,n.tmpPurge!==!1);let h=IQ&&mh(n.chown),y=mh(n.mode);if(f&&(h||y)){let v=Xr.attempt.statSync(e);if(v){if(n={...n},h)n.chown={uid:v.uid,gid:v.gid};if(y)n.mode=v.mode}}if(!f){let v=VZ.dirname(e);Xr.attempt.mkdirSync(v,{mode:hQ,recursive:!0})}if(l=Xr.retry.openSync(o)(c,"w",n.mode||mw),n.tmpCreated)n.tmpCreated(c);if(gw(t))Xr.retry.writeSync(o)(l,t,0,n.encoding||AQ);else if(!mh(t))Xr.retry.writeSync(o)(l,t,0,t.length,0);if(n.fsync!==!1)if(n.fsyncWait!==!1)Xr.retry.fsyncSync(o)(l);else Xr.attempt.fsync(l);if(Xr.retry.closeSync(o)(l),l=null,n.chown&&(n.chown.uid!==bQ||n.chown.gid!==vQ))Xr.attempt.chownSync(c,n.chown.uid,n.chown.gid);if(n.mode&&n.mode!==mw)Xr.attempt.chmodSync(c,n.mode);try{Xr.retry.renameSync(o)(c,e)}catch(v){if(!CQ(v))throw v;if(v.code!=="ENAMETOOLONG")throw v;Xr.retry.renameSync(o)(c,zm.truncate(e))}a(),c=null}finally{if(l)Xr.attempt.closeSync(l);if(c)zm.purge(c)}}var r1=yt(LP(),1),o1=yt(cF(),1);var joe=(e,t,n,r)=>{if(n==="length"||n==="prototype")return;if(n==="arguments"||n==="caller")return;let o=Object.getOwnPropertyDescriptor(e,n),a=Object.getOwnPropertyDescriptor(t,n);if(!zoe(o,a)&&r)return;Object.defineProperty(e,n,a)},zoe=function(e,t){return e===void 0||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},Moe=(e,t)=>{let n=Object.getPrototypeOf(t);if(n===Object.getPrototypeOf(e))return;Object.setPrototypeOf(e,n)},Hoe=(e,t)=>`/* Wrapped ${e}*/
194
+ <%s key={someKey} {...props} />`,Ts,bi,$s,bi),fc[bi+Ts]=!0}}if(T===n)Pr(dn);else No(dn);return dn}}var fr=kl;lye.Fragment=n,lye.jsxDEV=fr})()});var iw={};oZ(iw,{program:()=>KR,createCommand:()=>WR,createOption:()=>YR,createArgument:()=>ZR,Command:()=>XR,Option:()=>eQ,Argument:()=>tQ,Help:()=>nQ,CommanderError:()=>rQ,InvalidArgumentError:()=>oQ,InvalidOptionArgumentError:()=>iQ},{program:(m0e)=>KR=m0e,createCommand:(m0e)=>WR=m0e,createOption:(m0e)=>YR=m0e,createArgument:(m0e)=>ZR=m0e,Command:(m0e)=>XR=m0e,Option:(m0e)=>eQ=m0e,Argument:(m0e)=>tQ=m0e,Help:(m0e)=>nQ=m0e,CommanderError:(m0e)=>rQ=m0e,InvalidArgumentError:(m0e)=>oQ=m0e,InvalidOptionArgumentError:(m0e)=>iQ=m0e});var{Argument:GR}=uh(),{Command:ow}=HR(),{CommanderError:$Z,InvalidArgumentError:JR}=Lm(),{Help:NZ}=ew(),{Option:VR}=tw();var KR=new ow,WR=(e)=>new ow(e),YR=(e,t)=>new VR(e,t),ZR=(e,t)=>new GR(e,t),XR=ow,eQ=VR,tQ=GR,nQ=NZ,rQ=$Z,oQ=JR,iQ=JR;var{program:g0e,createCommand:A0e,createArgument:h0e,createOption:y0e,CommanderError:sQ,InvalidArgumentError:b0e,InvalidOptionArgumentError:v0e,Command:aQ,Argument:E0e,Option:I0e,Help:C0e}=iw;var dh={name:"@sequenzy/cli",version:"0.0.181",description:"Sequenzy CLI for email marketing from the terminal",type:"module",bin:{sequenzy:"./dist/index.js"},main:"./src/index.tsx",types:"./src/index.tsx",exports:{".":"./src/index.tsx"},scripts:{dev:"bun --watch src/index.tsx",build:"bun ../../scripts/build-ink-cli.ts",start:"node dist/index.js",lint:"eslint src","type-check":"bun check",test:"sh ../../scripts/run-package-tests.sh src","test:watch":"bun test --watch",prepublishOnly:"bun run build"},dependencies:{commander:"^12.1.0",ink:"^5.0.1","ink-spinner":"^5.0.0","ink-text-input":"^6.0.0","ink-select-input":"^6.0.0","ink-table":"^3.1.0",open:"^10.1.0",react:"^18.3.1",conf:"^13.0.0"},devDependencies:{"@emailer/shared":"workspace:*","@types/bun":"latest","@types/node":"^22.0.0","@types/react":"^18.3.0","bun-types":"latest",typescript:"^7.0.2"},files:["dist"],keywords:["sequenzy","email","cli","marketing"],license:"MIT",repository:{type:"git",url:"https://github.com/sequenzy/sequenzy"}};import{isDeepStrictEqual as Kae}from"node:util";import e1 from"node:process";import su from"node:fs";import t1 from"node:path";import pf from"node:crypto";import Wae from"node:assert";var Xl=(e)=>{let t=typeof e;return e!==null&&(t==="object"||t==="function")};var sw=new Set(["__proto__","prototype","constructor"]),PZ=new Set("0123456789");function ph(e){let t=[],n="",r="start",o=!1;for(let a of e)switch(a){case"\\":{if(r==="index")throw Error("Invalid character in an index");if(r==="indexEnd")throw Error("Invalid character after an index");if(o)n+=a;r="property",o=!o;break}case".":{if(r==="index")throw Error("Invalid character in an index");if(r==="indexEnd"){r="property";break}if(o){o=!1,n+=a;break}if(sw.has(n))return[];t.push(n),n="",r="property";break}case"[":{if(r==="index")throw Error("Invalid character in an index");if(r==="indexEnd"){r="index";break}if(o){o=!1,n+=a;break}if(r==="property"){if(sw.has(n))return[];t.push(n),n=""}r="index";break}case"]":{if(r==="index"){t.push(Number.parseInt(n,10)),n="",r="indexEnd";break}if(r==="indexEnd")throw Error("Invalid character after an index")}default:{if(r==="index"&&!PZ.has(a))throw Error("Invalid character in an index");if(r==="indexEnd")throw Error("Invalid character after an index");if(r==="start")r="property";if(o)o=!1,n+="\\";n+=a}}if(o)n+="\\";switch(r){case"property":{if(sw.has(n))return[];t.push(n);break}case"index":throw Error("Index was not closed");case"start":{t.push("");break}}return t}function aw(e,t){if(typeof t!=="number"&&Array.isArray(e)){let n=Number.parseInt(t,10);return Number.isInteger(n)&&e[n]===e[t]}return!1}function cQ(e,t){if(aw(e,t))throw Error("Cannot use string index")}function lQ(e,t,n){if(!Xl(e)||typeof t!=="string")return n===void 0?e:n;let r=ph(t);if(r.length===0)return n;for(let o=0;o<r.length;o++){let a=r[o];if(aw(e,a))e=o===r.length-1?void 0:null;else e=e[a];if(e===void 0||e===null){if(o!==r.length-1)return n;break}}return e===void 0?n:e}function cw(e,t,n){if(!Xl(e)||typeof t!=="string")return e;let r=e,o=ph(t);for(let a=0;a<o.length;a++){let c=o[a];if(cQ(e,c),a===o.length-1)e[c]=n;else if(!Xl(e[c]))e[c]=typeof o[a+1]==="number"?[]:{};e=e[c]}return r}function uQ(e,t){if(!Xl(e)||typeof t!=="string")return!1;let n=ph(t);for(let r=0;r<n.length;r++){let o=n[r];if(cQ(e,o),r===n.length-1)return delete e[o],!0;if(e=e[o],!Xl(e))return!1}}function dQ(e,t){if(!Xl(e)||typeof t!=="string")return!1;let n=ph(t);if(n.length===0)return!1;for(let r of n){if(!Xl(e)||!(r in e)||aw(e,r))return!1;e=e[r]}return!0}import Yn from"node:path";import pQ from"node:os";import lw from"node:process";var $c=pQ.homedir(),uw=pQ.tmpdir(),{env:Ed}=lw,FZ=(e)=>{let t=Yn.join($c,"Library");return{data:Yn.join(t,"Application Support",e),config:Yn.join(t,"Preferences",e),cache:Yn.join(t,"Caches",e),log:Yn.join(t,"Logs",e),temp:Yn.join(uw,e)}},qZ=(e)=>{let t=Ed.APPDATA||Yn.join($c,"AppData","Roaming"),n=Ed.LOCALAPPDATA||Yn.join($c,"AppData","Local");return{data:Yn.join(n,e,"Data"),config:Yn.join(t,e,"Config"),cache:Yn.join(n,e,"Cache"),log:Yn.join(n,e,"Log"),temp:Yn.join(uw,e)}},LZ=(e)=>{let t=Yn.basename($c);return{data:Yn.join(Ed.XDG_DATA_HOME||Yn.join($c,".local","share"),e),config:Yn.join(Ed.XDG_CONFIG_HOME||Yn.join($c,".config"),e),cache:Yn.join(Ed.XDG_CACHE_HOME||Yn.join($c,".cache"),e),log:Yn.join(Ed.XDG_STATE_HOME||Yn.join($c,".local","state"),e),temp:Yn.join(uw,t,e)}};function dw(e,{suffix:t="nodejs"}={}){if(typeof e!=="string")throw TypeError(`Expected a string, got ${typeof e}`);if(t)e+=`-${t}`;if(lw.platform==="darwin")return FZ(e);if(lw.platform==="win32")return qZ(e);return LZ(e)}import VZ from"node:path";import nn from"node:fs";import{promisify as wo}from"node:util";var UZ=(e,t)=>{let{onError:n}=t;return function(...o){return e.apply(void 0,o).catch(n)}},ra=UZ;var jZ=(e,t)=>{let{onError:n}=t;return function(...o){try{return e.apply(void 0,o)}catch(a){return n(a)}}},bs=jZ;var mQ=250;var zZ=(e,t)=>{let{isRetriable:n}=t;return function(o){let{timeout:a}=o,c=o.interval??mQ,l=Date.now()+a;return function p(...f){return e.apply(void 0,f).catch((h)=>{if(!n(h))throw h;if(Date.now()>=l)throw h;let y=Math.round(c*Math.random());if(y>0)return new Promise((C)=>setTimeout(C,y)).then(()=>p.apply(void 0,f));else return p.apply(void 0,f)})}}},oa=zZ;var MZ=(e,t)=>{let{isRetriable:n}=t;return function(o){let{timeout:a}=o,c=Date.now()+a;return function(...p){while(!0)try{return e.apply(void 0,p)}catch(f){if(!n(f))throw f;if(Date.now()>=c)throw f;continue}}}},ia=MZ;import gQ from"node:process";var Um={isChangeErrorOk:(e)=>{if(!Um.isNodeError(e))return!1;let{code:t}=e;if(t==="ENOSYS")return!0;if(!fQ&&(t==="EINVAL"||t==="EPERM"))return!0;return!1},isNodeError:(e)=>e instanceof Error,isRetriableError:(e)=>{if(!Um.isNodeError(e))return!1;let{code:t}=e;if(t==="EMFILE"||t==="ENFILE"||t==="EAGAIN"||t==="EBUSY"||t==="EACCESS"||t==="EACCES"||t==="EACCS"||t==="EPERM")return!0;return!1},onChangeError:(e)=>{if(!Um.isNodeError(e))throw e;if(Um.isChangeErrorOk(e))return;throw e}},pw=Um;var jm={onError:pw.onChangeError},ri={onError:()=>{return}},fQ=gQ.getuid?!gQ.getuid():!1,Ao={isRetriable:pw.isRetriableError};var HZ={attempt:{chmod:ra(wo(nn.chmod),jm),chown:ra(wo(nn.chown),jm),close:ra(wo(nn.close),ri),fsync:ra(wo(nn.fsync),ri),mkdir:ra(wo(nn.mkdir),ri),realpath:ra(wo(nn.realpath),ri),stat:ra(wo(nn.stat),ri),unlink:ra(wo(nn.unlink),ri),chmodSync:bs(nn.chmodSync,jm),chownSync:bs(nn.chownSync,jm),closeSync:bs(nn.closeSync,ri),existsSync:bs(nn.existsSync,ri),fsyncSync:bs(nn.fsync,ri),mkdirSync:bs(nn.mkdirSync,ri),realpathSync:bs(nn.realpathSync,ri),statSync:bs(nn.statSync,ri),unlinkSync:bs(nn.unlinkSync,ri)},retry:{close:oa(wo(nn.close),Ao),fsync:oa(wo(nn.fsync),Ao),open:oa(wo(nn.open),Ao),readFile:oa(wo(nn.readFile),Ao),rename:oa(wo(nn.rename),Ao),stat:oa(wo(nn.stat),Ao),write:oa(wo(nn.write),Ao),writeFile:oa(wo(nn.writeFile),Ao),closeSync:ia(nn.closeSync,Ao),fsyncSync:ia(nn.fsyncSync,Ao),openSync:ia(nn.openSync,Ao),readFileSync:ia(nn.readFileSync,Ao),renameSync:ia(nn.renameSync,Ao),statSync:ia(nn.statSync,Ao),writeSync:ia(nn.writeSync,Ao),writeFileSync:ia(nn.writeFileSync,Ao)}},Xr=HZ;import eu from"node:process";var AQ="utf8",mw=438,hQ=511;var yQ={},bQ=eu.geteuid?eu.geteuid():-1,vQ=eu.getegid?eu.getegid():-1;var EQ=1000,IQ=!!eu.getuid,eDe=eu.getuid?!eu.getuid():!1,fw=128;var CQ=(e)=>e instanceof Error&&("code"in e);var gw=(e)=>typeof e==="string",mh=(e)=>e===void 0;import JZ from"node:path";import Id from"node:process";import wQ from"node:process";var SQ=wQ.platform==="linux",fh=wQ.platform==="win32";var Aw=["SIGHUP","SIGINT","SIGTERM"];if(!fh)Aw.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(SQ)Aw.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var DQ=Aw;class BQ{constructor(){this.callbacks=new Set,this.exited=!1,this.exit=(e)=>{if(this.exited)return;this.exited=!0;for(let t of this.callbacks)t();if(e)if(fh&&(e!=="SIGINT"&&e!=="SIGTERM"&&e!=="SIGKILL"))Id.kill(Id.pid,"SIGTERM");else Id.kill(Id.pid,e)},this.hook=()=>{Id.once("exit",()=>this.exit());for(let e of DQ)try{Id.once(e,()=>this.exit(e))}catch{}},this.register=(e)=>(this.callbacks.add(e),()=>{this.callbacks.delete(e)}),this.hook()}}var xQ=new BQ;var GZ=xQ.register,_Q=GZ;var Bi={store:{},create:(e)=>{let t=`000000${Math.floor(Math.random()*16777215).toString(16)}`.slice(-6),n=Date.now().toString().slice(-10),r="tmp-",o=`.tmp-${n}${t}`;return`${e}${o}`},get:(e,t,n=!0)=>{let r=Bi.truncate(t(e));if(r in Bi.store)return Bi.get(e,t,n);return Bi.store[r]=n,[r,()=>delete Bi.store[r]]},purge:(e)=>{if(!Bi.store[e])return;delete Bi.store[e],Xr.attempt.unlink(e)},purgeSync:(e)=>{if(!Bi.store[e])return;delete Bi.store[e],Xr.attempt.unlinkSync(e)},purgeSyncAll:()=>{for(let e in Bi.store)Bi.purgeSync(e)},truncate:(e)=>{let t=JZ.basename(e);if(t.length<=fw)return e;let n=/^(\.?)(.*?)((?:\.[^.]+)?(?:\.tmp-\d{10}[a-f0-9]{6})?)$/.exec(t);if(!n)return e;let r=t.length-fw;return`${e.slice(0,-t.length)}${n[1]}${n[2].slice(0,-r)}${n[3]}`}};_Q(Bi.purgeSyncAll);var zm=Bi;function hw(e,t,n=yQ){if(gw(n))return hw(e,t,{encoding:n});let o={timeout:n.timeout??EQ},a=null,c=null,l=null;try{let p=Xr.attempt.realpathSync(e),f=!!p;e=p||e,[c,a]=zm.get(e,n.tmpCreate||zm.create,n.tmpPurge!==!1);let h=IQ&&mh(n.chown),y=mh(n.mode);if(f&&(h||y)){let v=Xr.attempt.statSync(e);if(v){if(n={...n},h)n.chown={uid:v.uid,gid:v.gid};if(y)n.mode=v.mode}}if(!f){let v=VZ.dirname(e);Xr.attempt.mkdirSync(v,{mode:hQ,recursive:!0})}if(l=Xr.retry.openSync(o)(c,"w",n.mode||mw),n.tmpCreated)n.tmpCreated(c);if(gw(t))Xr.retry.writeSync(o)(l,t,0,n.encoding||AQ);else if(!mh(t))Xr.retry.writeSync(o)(l,t,0,t.length,0);if(n.fsync!==!1)if(n.fsyncWait!==!1)Xr.retry.fsyncSync(o)(l);else Xr.attempt.fsync(l);if(Xr.retry.closeSync(o)(l),l=null,n.chown&&(n.chown.uid!==bQ||n.chown.gid!==vQ))Xr.attempt.chownSync(c,n.chown.uid,n.chown.gid);if(n.mode&&n.mode!==mw)Xr.attempt.chmodSync(c,n.mode);try{Xr.retry.renameSync(o)(c,e)}catch(v){if(!CQ(v))throw v;if(v.code!=="ENAMETOOLONG")throw v;Xr.retry.renameSync(o)(c,zm.truncate(e))}a(),c=null}finally{if(l)Xr.attempt.closeSync(l);if(c)zm.purge(c)}}var r1=yt(LP(),1),o1=yt(cF(),1);var joe=(e,t,n,r)=>{if(n==="length"||n==="prototype")return;if(n==="arguments"||n==="caller")return;let o=Object.getOwnPropertyDescriptor(e,n),a=Object.getOwnPropertyDescriptor(t,n);if(!zoe(o,a)&&r)return;Object.defineProperty(e,n,a)},zoe=function(e,t){return e===void 0||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},Moe=(e,t)=>{let n=Object.getPrototypeOf(t);if(n===Object.getPrototypeOf(e))return;Object.setPrototypeOf(e,n)},Hoe=(e,t)=>`/* Wrapped ${e}*/
195
195
  ${t}`,Goe=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Joe=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Voe=(e,t,n)=>{let r=n===""?"":`with ${n.trim()}() `,o=Hoe.bind(null,r,t.toString());Object.defineProperty(o,"name",Joe);let{writable:a,enumerable:c,configurable:l}=Goe;Object.defineProperty(e,"toString",{value:o,writable:a,enumerable:c,configurable:l})};function bS(e,t,{ignoreNonConfigurable:n=!1}={}){let{name:r}=e;for(let o of Reflect.ownKeys(t))joe(e,t,o,n);return Moe(e,t),Voe(e,t,r),e}var Koe=(e,t={})=>{if(typeof e!=="function")throw TypeError(`Expected the first argument to be a function, got \`${typeof e}\``);let{wait:n=0,maxWait:r=Number.POSITIVE_INFINITY,before:o=!1,after:a=!0}=t;if(n<0||r<0)throw RangeError("`wait` and `maxWait` must not be negative.");if(!o&&!a)throw Error("Both `before` and `after` are false, function wouldn't be called.");let c,l,p,f=function(...h){let y=this,v=()=>{if(c=void 0,l)clearTimeout(l),l=void 0;if(a)p=e.apply(y,h)},C=()=>{if(l=void 0,c)clearTimeout(c),c=void 0;if(a)p=e.apply(y,h)},R=o&&!c;if(clearTimeout(c),c=setTimeout(v,n),r>0&&r!==Number.POSITIVE_INFINITY&&!l)l=setTimeout(C,r);if(R)p=e.apply(y,h);return p};return bS(f,e),f.cancel=()=>{if(c)clearTimeout(c),c=void 0;if(l)clearTimeout(l),l=void 0},f},vS=Koe;var au=yt(Wq(),1);var jae=Object.prototype.toString;function Zq(e,t,n){if(!e)return!1;if(e.constructor===t)return!0;return jae.call(e)===n}function Xq(e){return Zq(e,Uint8Array,"[object Uint8Array]")}function zae(e){return Zq(e,ArrayBuffer,"[object ArrayBuffer]")}function Mae(e){return Xq(e)||zae(e)}function Hae(e){if(!Xq(e))throw TypeError(`Expected \`Uint8Array\`, got \`${typeof e}\``)}function Gae(e){if(!Mae(e))throw TypeError(`Expected \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof e}\``)}function $S(e,t){if(e.length===0)return new Uint8Array(0);t??=e.reduce((o,a)=>o+a.length,0);let n=new Uint8Array(t),r=0;for(let o of e)Hae(o),n.set(o,r),r+=o.length;return n}var Yq={utf8:new globalThis.TextDecoder("utf8")};function NS(e,t="utf8"){return Gae(e),Yq[t]??=new globalThis.TextDecoder(t),Yq[t].decode(e)}function Jae(e){if(typeof e!=="string")throw TypeError(`Expected \`string\`, got \`${typeof e}\``)}var Vae=new globalThis.TextEncoder;function Dy(e){return Jae(e),Vae.encode(e)}var U_e=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));var Yae=o1.default.default,n1="aes-256-cbc",Kd=()=>Object.create(null),Zae=(e)=>e!==void 0&&e!==null,Xae=(e,t)=>{let n=new Set(["undefined","symbol","function"]),r=typeof t;if(n.has(r))throw TypeError(`Setting a value of type \`${r}\` for key \`${e}\` is not allowed as it's not supported by JSON`)},By="__internal__",OS=`${By}.migrations.version`;class xy{path;events;#r;#t;#e;#n={};constructor(e={}){let t={configName:"config",fileExtension:"json",projectSuffix:"nodejs",clearInvalidConfig:!1,accessPropertiesByDotNotation:!0,configFileMode:438,...e};if(!t.cwd){if(!t.projectName)throw Error("Please specify the `projectName` option.");t.cwd=dw(t.projectName,{suffix:t.projectSuffix}).config}if(this.#e=t,t.schema??t.ajvOptions??t.rootSchema){if(t.schema&&typeof t.schema!=="object")throw TypeError("The `schema` option must be an object.");let a=new r1.Ajv2020({allErrors:!0,useDefaults:!0,...t.ajvOptions});Yae(a);let c={...t.rootSchema,type:"object",properties:t.schema};this.#r=a.compile(c);for(let[l,p]of Object.entries(t.schema??{}))if(p?.default)this.#n[l]=p.default}if(t.defaults)this.#n={...this.#n,...t.defaults};if(t.serialize)this._serialize=t.serialize;if(t.deserialize)this._deserialize=t.deserialize;this.events=new EventTarget,this.#t=t.encryptionKey;let n=t.fileExtension?`.${t.fileExtension}`:"";this.path=t1.resolve(t.cwd,`${t.configName??"config"}${n}`);let r=this.store,o=Object.assign(Kd(),t.defaults,r);if(t.migrations){if(!t.projectVersion)throw Error("Please specify the `projectVersion` option.");this._migrate(t.migrations,t.projectVersion,t.beforeEachMigration)}this._validate(o);try{Wae.deepEqual(r,o)}catch{this.store=o}if(t.watch)this._watch()}get(e,t){if(this.#e.accessPropertiesByDotNotation)return this._get(e,t);let{store:n}=this;return e in n?n[e]:t}set(e,t){if(typeof e!=="string"&&typeof e!=="object")throw TypeError(`Expected \`key\` to be of type \`string\` or \`object\`, got ${typeof e}`);if(typeof e!=="object"&&t===void 0)throw TypeError("Use `delete()` to clear values");if(this._containsReservedKey(e))throw TypeError(`Please don't use the ${By} key, as it's used to manage this module internal operations.`);let{store:n}=this,r=(o,a)=>{if(Xae(o,a),this.#e.accessPropertiesByDotNotation)cw(n,o,a);else n[o]=a};if(typeof e==="object"){let o=e;for(let[a,c]of Object.entries(o))r(a,c)}else r(e,t);this.store=n}has(e){if(this.#e.accessPropertiesByDotNotation)return dQ(this.store,e);return e in this.store}reset(...e){for(let t of e)if(Zae(this.#n[t]))this.set(t,this.#n[t])}delete(e){let{store:t}=this;if(this.#e.accessPropertiesByDotNotation)uQ(t,e);else delete t[e];this.store=t}clear(){this.store=Kd();for(let e of Object.keys(this.#n))this.reset(e)}onDidChange(e,t){if(typeof e!=="string")throw TypeError(`Expected \`key\` to be of type \`string\`, got ${typeof e}`);if(typeof t!=="function")throw TypeError(`Expected \`callback\` to be of type \`function\`, got ${typeof t}`);return this._handleChange(()=>this.get(e),t)}onDidAnyChange(e){if(typeof e!=="function")throw TypeError(`Expected \`callback\` to be of type \`function\`, got ${typeof e}`);return this._handleChange(()=>this.store,e)}get size(){return Object.keys(this.store).length}get store(){try{let e=su.readFileSync(this.path,this.#t?null:"utf8"),t=this._encryptData(e),n=this._deserialize(t);return this._validate(n),Object.assign(Kd(),n)}catch(e){if(e?.code==="ENOENT")return this._ensureDirectory(),Kd();if(this.#e.clearInvalidConfig&&e.name==="SyntaxError")return Kd();throw e}}set store(e){this._ensureDirectory(),this._validate(e),this._write(e),this.events.dispatchEvent(new Event("change"))}*[Symbol.iterator](){for(let[e,t]of Object.entries(this.store))yield[e,t]}_encryptData(e){if(!this.#t)return typeof e==="string"?e:NS(e);try{let t=e.slice(0,16),n=pf.pbkdf2Sync(this.#t,t.toString(),1e4,32,"sha512"),r=pf.createDecipheriv(n1,n,t),o=e.slice(17),a=typeof o==="string"?Dy(o):o;return NS($S([r.update(a),r.final()]))}catch{}return e.toString()}_handleChange(e,t){let n=e(),r=()=>{let o=n,a=e();if(Kae(a,o))return;n=a,t.call(this,a,o)};return this.events.addEventListener("change",r),()=>{this.events.removeEventListener("change",r)}}_deserialize=(e)=>JSON.parse(e);_serialize=(e)=>JSON.stringify(e,void 0,"\t");_validate(e){if(!this.#r)return;if(this.#r(e)||!this.#r.errors)return;let n=this.#r.errors.map(({instancePath:r,message:o=""})=>`\`${r.slice(1)}\` ${o}`);throw Error("Config schema violation: "+n.join("; "))}_ensureDirectory(){su.mkdirSync(t1.dirname(this.path),{recursive:!0})}_write(e){let t=this._serialize(e);if(this.#t){let n=pf.randomBytes(16),r=pf.pbkdf2Sync(this.#t,n.toString(),1e4,32,"sha512"),o=pf.createCipheriv(n1,r,n);t=$S([n,Dy(":"),o.update(Dy(t)),o.final()])}if(e1.env.SNAP)su.writeFileSync(this.path,t,{mode:this.#e.configFileMode});else try{hw(this.path,t,{mode:this.#e.configFileMode})}catch(n){if(n?.code==="EXDEV"){su.writeFileSync(this.path,t,{mode:this.#e.configFileMode});return}throw n}}_watch(){if(this._ensureDirectory(),!su.existsSync(this.path))this._write(Kd());if(e1.platform==="win32")su.watch(this.path,{persistent:!1},vS(()=>{this.events.dispatchEvent(new Event("change"))},{wait:100}));else su.watchFile(this.path,{persistent:!1},vS(()=>{this.events.dispatchEvent(new Event("change"))},{wait:5000}))}_migrate(e,t,n){let r=this._get(OS,"0.0.0"),o=Object.keys(e).filter((c)=>this._shouldPerformMigration(c,r,t)),a={...this.store};for(let c of o)try{if(n)n(this,{fromVersion:r,toVersion:c,finalVersion:t,versions:o});let l=e[c];l?.(this),this._set(OS,c),r=c,a={...this.store}}catch(l){throw this.store=a,Error(`Something went wrong during the migration! Changes applied to the store until this failed migration will be restored. ${l}`)}if(this._isVersionInRangeFormat(r)||!au.default.eq(r,t))this._set(OS,t)}_containsReservedKey(e){if(typeof e==="object"){if(Object.keys(e)[0]===By)return!0}if(typeof e!=="string")return!1;if(this.#e.accessPropertiesByDotNotation){if(e.startsWith(`${By}.`))return!0;return!1}return!1}_isVersionInRangeFormat(e){return au.default.clean(e)===null}_shouldPerformMigration(e,t,n){if(this._isVersionInRangeFormat(e)){if(t!=="0.0.0"&&au.default.satisfies(t,e))return!1;return au.default.satisfies(n,e)}if(au.default.lte(e,t))return!1;if(au.default.gt(e,n))return!1;return!0}_get(e,t){return lQ(this.store,e,t)}_set(e,t){let{store:n}=this;cw(n,e,t),this.store=n}}var PS="com.sequenzy.cli",FS="api-key",qS=typeof globalThis.Bun<"u",tl=new xy({projectName:"sequenzy",schema:{userId:{type:"string"},userEmail:{type:"string"},_apiKey:{type:"string"}}});async function LS(){let e=process.env.SEQUENZY_API_KEY;if(e)return e;if(qS)try{let t=await globalThis.Bun.secrets.get({service:PS,name:FS});if(t)return t}catch{}return tl.get("_apiKey")}async function i1(e){if(qS)try{await globalThis.Bun.secrets.set({service:PS,name:FS,value:e,allowUnrestrictedAccess:!1});return}catch{}tl.set("_apiKey",e)}async function s1(){if(qS)try{await globalThis.Bun.secrets.delete({service:PS,name:FS})}catch{}tl.delete("_apiKey")}async function z(){return!!await LS()}function _y(){return{userId:tl.get("userId"),userEmail:tl.get("userEmail")}}function a1(e){if(e.userId!==void 0)tl.set("userId",e.userId);if(e.userEmail!==void 0)tl.set("userEmail",e.userEmail)}function c1(){tl.clear()}function l1(e,t=Date.now()){if(!e?.trim())return;let n=e.trim();if(/^\d+$/.test(n)){let o=Number(n);return Number.isSafeInteger(o)?o:void 0}if(!/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), \d{2} [A-Z][a-z]{2} \d{4} \d{2}:\d{2}:\d{2} GMT$/.test(n))return;let r=Date.parse(n);if(!Number.isFinite(r)||new Date(r).toUTCString().slice(5)!==n.slice(5))return;return Math.max(0,Math.ceil((r-t)/1000))}function u1(e,t,n){if(e&&/^[A-Z][A-Z0-9_]{1,95}$/.test(e))return e;switch(t){case 0:return"NETWORK_ERROR";case 400:case 422:return"VALIDATION_ERROR";case 401:return"UNAUTHORIZED";case 403:return"FORBIDDEN";case 404:return"NOT_FOUND";case 409:return"CONFLICT";case 429:return"RATE_LIMITED";default:return t!==void 0?t>=500?"SERVER_ERROR":"HTTP_ERROR":n}}var ece=process.env.SEQUENZY_API_URL??"https://api.sequenzy.com";class A extends Error{statusCode;rawDetails;code;retryAfterSeconds;constructor(e,t,n,r,o){super(e);this.statusCode=t;this.rawDetails=n;this.code=r;this.retryAfterSeconds=o;this.name="ApiError"}}function tce(e,t){if(typeof e!=="string")return;if(typeof t!=="string"||t==="root")return e;let n=t.slice(1).replaceAll("/",".");return e.includes(`'${n}'`)?e:`${n}: ${e}`}function nce(e){if(!e.trim())return{message:"Request failed"};try{let t=JSON.parse(e);if(typeof t==="string")return{message:t};if(!t||typeof t!=="object"||Array.isArray(t))return{message:"Request failed"};let n=t,r=n.error&&typeof n.error==="object"?n.error:void 0,o=r?.code??n.code,a=n.type==="validation"?tce(n.summary,n.property):void 0,c=typeof n.error==="string"?n.error:typeof a==="string"?a:r?.message??n.message;return{message:typeof c==="string"?c:"Request failed",...typeof o==="string"?{code:o}:{}}}catch{return{message:e}}}async function E(e,t,n,r,o){let a=await LS();if(!a)throw new A("Not logged in. Run `sequenzy login` first.",401);let c={"Content-Type":"application/json",Authorization:`Bearer ${a}`,"x-sequenzy-client":`cli/${dh.version}`};if(r)c["x-company-id"]=r;Object.assign(c,o);let l;try{l=await fetch(`${ece}${t}`,{method:e,headers:c,body:n?JSON.stringify(n):void 0})}catch(p){throw new A(p instanceof Error?p.message:"Failed to reach Sequenzy API",0,void 0,"NETWORK_ERROR")}if(!l.ok){let p=await l.text(),f=nce(p);throw new A(f.message,l.status,p,f.code,l1(l.headers.get("Retry-After")))}return l.json()}var d1=!1;function US(e){d1=e}function ky(){return d1}var zS="https://docs.sequenzy.com",Va=`${zS}/concepts/cli`,jS=`${zS}/authentication`,p1="https://sequenzy.com/dashboard";function m1(e){if(e instanceof A)return{message:e.message,statusCode:e.statusCode,code:e.code,rawDetails:e.rawDetails};if(e instanceof Error)return{message:e.message};return{message:String(e)}}function rce(e){let t=e.match(/api key is missing required scopes?:\s*(.+)$/i);if(!t?.[1])return[];return[...new Set(t[1].match(/[a-z_]+:[a-z_]+/gi)??[])]}function f1(e){let t=m1(e),n=t.message.trim()||"Unknown error",r=n.toLowerCase(),o=t.rawDetails?.trim()||n;if(t.code==="CLI_AUTH_REQUIRED"||r.includes("not logged in"))return{title:"Authentication required",description:"This command needs a Sequenzy API key, but the CLI could not find one in your local login state or environment.",howToFix:"Run `sequenzy login` and approve the session, or set `SEQUENZY_API_KEY` for non-interactive environments.",docsUrl:Va,details:o};if(r.includes("already logged in"))return{title:"CLI already authenticated",description:"The CLI already has a saved Sequenzy login for this machine.",howToFix:"Run `sequenzy logout` first if you want to switch accounts, then run `sequenzy login` again.",docsUrl:Va,details:o};if(t.statusCode===401||t.code==="UNAUTHORIZED")return{title:"Authentication failed",description:"The request reached Sequenzy, but the current API key was rejected.",howToFix:"Run `sequenzy login` again, or replace the key with a valid personal API key that still has access to your account.",docsUrl:jS,details:o};if(t.code==="COMPANY_CREATE_REQUIRES_PERSONAL_KEY")return{title:"Personal account key required",description:"Company creation is account-level and cannot be performed with a company/workspace-scoped API key.",howToFix:"Create or use a personal account key beginning with `seq_user_` from Account → API Keys, replace `SEQUENZY_API_KEY`, and retry the same command; alternatively, create the company in the Sequenzy dashboard. Widening the current company key or switching companies will not fix this restriction.",docsUrl:jS,details:o};let a=rce(n);if(a.length>0){let c=a.map((f)=>`\`${f}\``).join(", "),l=a.every((f)=>f.endsWith(":read"))?"the Read-only or Safer agent access preset":"Safer agent access when it covers the task, or Custom permissions",p=a.includes("api_keys:manage")?` This command manages API keys, so the missing scope cannot be granted through the API by the key that is missing it. If the active key has \`account:read\`, run \`sequenzy api-keys handoff\` (add \`--replaces current\` when rotating) to get a dashboard link that opens the create-key form prefilled, then give it to the workspace owner. It creates nothing and never prints a key. If handoff is also denied because \`account:read\` is missing, open ${p1} directly and choose the matching API Keys page.`:"";return{title:"API key permission required",description:`The current API key is valid, but this operation requires the missing ${a.length===1?"scope":"scopes"}: ${c}.`,howToFix:`Permissions can be widened on the key you are already using - no new key and no re-login. Run \`sequenzy account\` to see the active key, its type, and its API Keys settings URL, then have the key owner enable ${c} there. Personal keys open Account → API Keys; company keys open workspace Settings → API Keys. If account metadata is unavailable, open ${p1} directly and choose the matching API Keys page. When the active key type is \`company\` and it holds \`api_keys:manage\`, run \`sequenzy api-keys list --json\` and then \`sequenzy api-keys update <api-key-id> --scopes\` with the current scopes plus ${c}, or \`--preset\` covering all of them (${l}). Personal keys cannot be changed through \`sequenzy api-keys update\`. Both options replace the whole selection rather than merging. Retry the same command once the key is updated. Issuing a replacement key and swapping \`SEQUENZY_API_KEY\` also works but is not required.${p}`,docsUrl:Va,details:o}}if(t.statusCode===403||r.includes("access denied"))return{title:"Access denied",description:"The current API key is valid, but it does not have permission to perform this action or access the requested company.",howToFix:"Use an API key with access to the target company, or switch to a company you can access before retrying.",docsUrl:jS,details:o};if(t.statusCode===404||r.includes("not found"))return{title:"Requested resource not found",description:"Sequenzy could not find the company, template, campaign, sequence, or subscriber you asked for.",howToFix:"Double-check the ID or email value and list the resource first before retrying the command.",docsUrl:Va,details:o};if(t.statusCode===429||r.includes("rate limit"))return{title:"Rate limited",description:"Sequenzy temporarily slowed this request because too many requests were sent in a short period.",howToFix:"Wait a moment and retry. If an agent is looping, reduce the retry frequency before calling the CLI again.",docsUrl:Va,details:o};if(t.code==="AB_TEST_VARIANT_CONTENT_EDIT"||r.includes("update_ab_test_variant")&&(r.includes("a/b test")||r.includes("ab test")))return{title:"A/B variant copy cannot be edited here",description:n,howToFix:"Use `sequenzy ab-tests update-variant` with the `abTestId` and `variantId` from `sequenzy sequences get` or `sequenzy ab-tests get`. Repeat once per variant for a whole-step rewrite. If the sequence is live or the test has activity, pass `--confirm-live-change`. Do not retry with `sequenzy templates update` or `sequenzy sequences update-node`.",docsUrl:`${zS}/concepts/cli#editing-the-copy-of-a-sequence-ab-step`,details:o};if(r.includes("--subject")||r.includes("--template")||r.includes("is required"))return{title:"Invalid command input",description:"The CLI command arguments are incomplete or incompatible for this action.",howToFix:"Review the flags you passed, add the missing values, and run the command again.",docsUrl:Va,details:o};if(t.code==="NETWORK_ERROR"||r.includes("fetch failed")||r.includes("failed to initiate login"))return{title:"Network or configuration error",description:"The CLI could not reach the Sequenzy API or app URL from this environment.",howToFix:"Check your network connection and verify `SEQUENZY_API_URL` or `SEQUENZY_APP_URL` if you override them locally.",docsUrl:Va,details:o};if(t.statusCode&&t.statusCode>=500)return{title:"Sequenzy server error",description:"The request reached Sequenzy, but the server could not complete it successfully.",howToFix:"Retry once. If the error persists, keep the details below and check the docs before escalating.",docsUrl:Va,details:o};return{title:"Command failed",description:"The CLI could not complete the requested operation.",howToFix:"Review the details below, adjust the command or credentials, and retry.",docsUrl:Va,details:o}}function H(){return new A("Not logged in. Run `sequenzy login` first.",401,void 0,"CLI_AUTH_REQUIRED")}function mf(e){let t=f1(e);return[`Sequenzy CLI error: ${t.title}`,`Description: ${t.description}`,`How to fix: ${t.howToFix}`,`Docs: ${t.docsUrl}`,`Details: ${t.details}`].join(`
196
196
  `)}function oce(e){let t=m1(e),n=f1(e),r=(t.rawDetails===t.message?n.description:t.message.trim())||n.description;return{success:!1,error:{code:u1(t.code,t.statusCode,"CLI_ERROR"),message:r.replace(/\bBearer\s+[^\s]+/gi,"Bearer [redacted]").replace(/\bseq_(?:user_)?[A-Za-z0-9_-]{8,}\b/g,"[redacted key]"),...t.statusCode!==void 0?{statusCode:t.statusCode}:{},howToFix:n.howToFix,docsUrl:n.docsUrl,...e instanceof A&&e.retryAfterSeconds!==void 0?{retryAfterSeconds:e.retryAfterSeconds}:{}}}}function k(e,t={}){console.error(t.json??ky()?JSON.stringify(oce(e)):mf(e))}import{readFileSync as ice}from"node:fs";import{isatty as g1}from"node:tty";var nl;function A1(){nl=void 0}function MS(e){if(new Set(e).size>1)throw new A("Only one text input may read stdin (-) per command. Use regular files for the other inputs.",400,void 0,"CLI_INVALID_INPUT")}async function h1(){if(g1(0))throw new A("Pipe text into stdin when using a text file '-'.",400,void 0,"CLI_INVALID_INPUT");try{process.stdin.setEncoding("utf8");let e="";for await(let t of process.stdin)e+=String(t);nl={text:e}}catch(e){throw new A(`Failed to read stdin: ${e instanceof Error?e.message:"Unknown error"}`,400,void 0,"CLI_INPUT_READ_FAILED")}}function y1(e,t){if(e==="-"){if(nl){if(nl.field)MS([nl.field,t]);return nl.field=t,nl.text}if(g1(0))throw new A(`Pipe text into stdin when using ${t} file '-'.`,400,void 0,"CLI_INVALID_INPUT")}try{let n=ice(e==="-"?0:e,"utf8");if(e==="-")nl={field:t,text:n};return n}catch(n){throw new A(`Failed to read ${t} file '${e}': ${n instanceof Error?n.message:"Unknown error"}`,400,void 0,"CLI_INPUT_READ_FAILED")}}function Ry(e){return e.optsWithGlobals().json===!0||e.commands.some(Ry)}async function sce(e){US(e.optsWithGlobals().json===!0),A1();let t=Object.entries(e.optsWithGlobals()).filter(([n,r])=>r==="-"&&n.endsWith("File")||n==="audienceJson"&&r==="@-").map(([n])=>n);if(e.parent?.name()==="subscribers"&&["import","events-import"].includes(e.name())&&e.args[0]==="-")t.push("subscriber import");if(MS(t),t.length>0)await h1()}function b1(e){let t=e.configureOutput().writeErr;e.configureOutput({writeErr:(n)=>{if(!Ry(e))t?.(n)}}),e.exitOverride(),e.hook("preAction",(n,r)=>sce(r))}async function v1(e,t){US(!1);try{await e.parseAsync(t)}catch(n){if(n instanceof sQ){if(n.exitCode===0)return;if(Ry(e))k(new A(n.message,400,void 0,"CLI_INVALID_INPUT"),{json:!0});process.exitCode=n.exitCode;return}k(n,{json:Ry(e)}),process.exitCode=1}}var Qy="Variant copy is edited with `sequenzy ab-tests update-variant`, not with `sequenzy sequences update-node`.";var E1;function ce(e,t,n){function r(l,p){if(!l._zod)Object.defineProperty(l,"_zod",{value:{def:p,constr:c,traits:new Set},enumerable:!1});if(l._zod.traits.has(e))return;l._zod.traits.add(e),t(l,p);let f=c.prototype,h=Object.keys(f);for(let y=0;y<h.length;y++){let v=h[y];if(!(v in l))l[v]=f[v].bind(l)}}let o=n?.Parent??Object;class a extends o{}Object.defineProperty(a,"name",{value:e});function c(l){var p;let f=n?.Parent?new a:this;r(f,l),(p=f._zod).deferred??(p.deferred=[]);for(let h of f._zod.deferred)h();return f}return Object.defineProperty(c,"init",{value:r}),Object.defineProperty(c,Symbol.hasInstance,{value:(l)=>{if(n?.Parent&&l instanceof n.Parent)return!0;return l?._zod?.traits?.has(e)}}),Object.defineProperty(c,"name",{value:e}),c}var wke=Symbol("zod_brand");class Ka extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class ff extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(E1=globalThis).__zod_globalConfig??(E1.__zod_globalConfig={});var Wd=globalThis.__zod_globalConfig;function Wa(e){if(e)Object.assign(Wd,e);return Wd}function $y(e){let t=Object.values(e).filter((r)=>typeof r==="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function Af(e,t){if(typeof t==="bigint")return t.toString();return t}function Ny(e){return{get value(){{let n=e();return Object.defineProperty(this,"value",{value:n}),n}throw Error("cached value already set")}}}function Oy(e){return e===null||e===void 0}function Py(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}var I1=Symbol("evaluating");function hn(e,t,n){let r=void 0;Object.defineProperty(e,t,{get(){if(r===I1)return;if(r===void 0)r=I1,r=n();return r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function cu(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function rl(...e){let t={};for(let n of e){let r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function GS(e){return JSON.stringify(e)}function C1(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var JS="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function gf(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var w1=Ny(()=>{if(Wd.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function Yd(e){if(gf(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let n=t.prototype;if(gf(n)===!1)return!1;if(Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)return!1;return!0}function VS(e){if(Yd(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}var S1=new Set(["string","number","symbol"]);function ol(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function va(e,t,n){let r=new e._zod.constr(t??e._zod.def);if(!t||n?.parent)r._zod.parent=e;return r}function bt(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function D1(e){return Object.keys(e).filter((t)=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var ace={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function cce(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let a=rl(e._zod.def,{get shape(){let c={};for(let l in t){if(!(l in n.shape))throw Error(`Unrecognized key: "${l}"`);if(!t[l])continue;c[l]=n.shape[l]}return cu(this,"shape",c),c},checks:[]});return va(e,a)}function lce(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let a=rl(e._zod.def,{get shape(){let c={...e._zod.def.shape};for(let l in t){if(!(l in n.shape))throw Error(`Unrecognized key: "${l}"`);if(!t[l])continue;delete c[l]}return cu(this,"shape",c),c},checks:[]});return va(e,a)}function uce(e,t){if(!Yd(t))throw Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let a=e._zod.def.shape;for(let c in t)if(Object.getOwnPropertyDescriptor(a,c)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let o=rl(e._zod.def,{get shape(){let a={...e._zod.def.shape,...t};return cu(this,"shape",a),a}});return va(e,o)}function dce(e,t){if(!Yd(t))throw Error("Invalid input to safeExtend: expected a plain object");let n=rl(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t};return cu(this,"shape",r),r}});return va(e,n)}function pce(e,t){if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let n=rl(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return cu(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return va(e,n)}function mce(e,t,n){let o=t._zod.def.checks;if(o&&o.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let c=rl(t._zod.def,{get shape(){let l=t._zod.def.shape,p={...l};if(n)for(let f in n){if(!(f in l))throw Error(`Unrecognized key: "${f}"`);if(!n[f])continue;p[f]=e?new e({type:"optional",innerType:l[f]}):l[f]}else for(let f in l)p[f]=e?new e({type:"optional",innerType:l[f]}):l[f];return cu(this,"shape",p),p},checks:[]});return va(t,c)}function fce(e,t,n){let r=rl(t._zod.def,{get shape(){let o=t._zod.def.shape,a={...o};if(n)for(let c in n){if(!(c in a))throw Error(`Unrecognized key: "${c}"`);if(!n[c])continue;a[c]=new e({type:"nonoptional",innerType:o[c]})}else for(let c in o)a[c]=new e({type:"nonoptional",innerType:o[c]});return cu(this,"shape",a),a}});return va(t,r)}function lu(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function B1(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function Fy(e,t){return t.map((n)=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Ty(e){return typeof e==="string"?e:e?.message}function Ya(e,t,n){let r=e.message?e.message:Ty(e.inst?._zod.def?.error?.(e))??Ty(t?.error?.(e))??Ty(n.customError?.(e))??Ty(n.localeError?.(e))??"Invalid input",{inst:o,continue:a,input:c,...l}=e;if(l.path??(l.path=[]),l.message=r,t?.reportInput)l.input=c;return l}function qy(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function uu(...e){let[t,n,r]=e;if(typeof t==="string")return{message:t,code:"custom",input:n,inst:r};return{...t}}var x1=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Af,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ly=ce("$ZodError",x1),KS=ce("$ZodError",x1,{Parent:Error});function _1(e,t=(n)=>n.message){let n={},r=[];for(let o of e.issues)if(o.path.length>0)n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o));else r.push(t(o));return{formErrors:r,fieldErrors:n}}function k1(e,t=(n)=>n.message){let n={_errors:[]},r=(o,a=[])=>{for(let c of o.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map((l)=>r({issues:l},[...a,...c.path]));else if(c.code==="invalid_key")r({issues:c.issues},[...a,...c.path]);else if(c.code==="invalid_element")r({issues:c.issues},[...a,...c.path]);else{let l=[...a,...c.path];if(l.length===0)n._errors.push(t(c));else{let p=n,f=0;while(f<l.length){let h=l[f];if(f!==l.length-1)p[h]=p[h]||{_errors:[]};else p[h]=p[h]||{_errors:[]},p[h]._errors.push(t(c));p=p[h],f++}}}};return r(e),n}var Uy=(e)=>(t,n,r,o)=>{let a=r?{...r,async:!1}:{async:!1},c=t._zod.run({value:n,issues:[]},a);if(c instanceof Promise)throw new Ka;if(c.issues.length){let l=new(o?.Err??e)(c.issues.map((p)=>Ya(p,a,Wa())));throw JS(l,o?.callee),l}return c.value};var jy=(e)=>async(t,n,r,o)=>{let a=r?{...r,async:!0}:{async:!0},c=t._zod.run({value:n,issues:[]},a);if(c instanceof Promise)c=await c;if(c.issues.length){let l=new(o?.Err??e)(c.issues.map((p)=>Ya(p,a,Wa())));throw JS(l,o?.callee),l}return c.value};var hf=(e)=>(t,n,r)=>{let o=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},o);if(a instanceof Promise)throw new Ka;return a.issues.length?{success:!1,error:new(e??Ly)(a.issues.map((c)=>Ya(c,o,Wa())))}:{success:!0,data:a.value}},R1=hf(KS),yf=(e)=>async(t,n,r)=>{let o=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},o);if(a instanceof Promise)a=await a;return a.issues.length?{success:!1,error:new e(a.issues.map((c)=>Ya(c,o,Wa())))}:{success:!0,data:a.value}},Q1=yf(KS),T1=(e)=>(t,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return Uy(e)(t,n,o)};var $1=(e)=>(t,n,r)=>Uy(e)(t,n,r);var N1=(e)=>async(t,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return jy(e)(t,n,o)};var O1=(e)=>async(t,n,r)=>jy(e)(t,n,r);var P1=(e)=>(t,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return hf(e)(t,n,o)};var F1=(e)=>(t,n,r)=>hf(e)(t,n,r);var q1=(e)=>async(t,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return yf(e)(t,n,o)};var L1=(e)=>async(t,n,r)=>yf(e)(t,n,r);var U1=/^[cC][0-9a-z]{6,}$/,j1=/^[0-9a-z]+$/,z1=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,M1=/^[0-9a-vA-V]{20}$/,H1=/^[A-Za-z0-9]{27}$/,G1=/^[a-zA-Z0-9_-]{21}$/,J1=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var V1=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,WS=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var K1=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Ace="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function W1(){return new RegExp(Ace,"u")}var Y1=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Z1=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var X1=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,eL=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,tL=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,YS=/^[A-Za-z0-9_-]*$/;var nL=/^https?$/,rL=/^\+[1-9]\d{6,14}$/,oL="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",iL=new RegExp(`^${oL}$`);function sL(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function aL(e){return new RegExp(`^${sL(e)}$`)}function cL(e){let t=sL({precision:e.precision}),n=["Z"];if(e.local)n.push("");if(e.offset)n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${t}(?:${n.join("|")})`;return new RegExp(`^${oL}T(?:${r})$`)}var lL=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var uL=/^[^A-Z]*$/,dL=/^[^a-z]*$/;var xi=ce("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])});var pL=ce("$ZodCheckMaxLength",(e,t)=>{var n;xi.init(e,t),(n=e._zod.def).when??(n.when=(r)=>{let o=r.value;return!Oy(o)&&o.length!==void 0}),e._zod.onattach.push((r)=>{let o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<o)r._zod.bag.maximum=t.maximum}),e._zod.check=(r)=>{let o=r.value;if(o.length<=t.maximum)return;let c=qy(o);r.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),mL=ce("$ZodCheckMinLength",(e,t)=>{var n;xi.init(e,t),(n=e._zod.def).when??(n.when=(r)=>{let o=r.value;return!Oy(o)&&o.length!==void 0}),e._zod.onattach.push((r)=>{let o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>o)r._zod.bag.minimum=t.minimum}),e._zod.check=(r)=>{let o=r.value;if(o.length>=t.minimum)return;let c=qy(o);r.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),fL=ce("$ZodCheckLengthEquals",(e,t)=>{var n;xi.init(e,t),(n=e._zod.def).when??(n.when=(r)=>{let o=r.value;return!Oy(o)&&o.length!==void 0}),e._zod.onattach.push((r)=>{let o=r._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=(r)=>{let o=r.value,a=o.length;if(a===t.length)return;let c=qy(o),l=a>t.length;r.issues.push({origin:c,...l?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),bf=ce("$ZodCheckStringFormat",(e,t)=>{var n,r;if(xi.init(e,t),e._zod.onattach.push((o)=>{let a=o._zod.bag;if(a.format=t.format,t.pattern)a.patterns??(a.patterns=new Set),a.patterns.add(t.pattern)}),t.pattern)(n=e._zod).check??(n.check=(o)=>{if(t.pattern.lastIndex=0,t.pattern.test(o.value))return;o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(r=e._zod).check??(r.check=()=>{})}),gL=ce("$ZodCheckRegex",(e,t)=>{bf.init(e,t),e._zod.check=(n)=>{if(t.pattern.lastIndex=0,t.pattern.test(n.value))return;n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),AL=ce("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=uL),bf.init(e,t)}),hL=ce("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=dL),bf.init(e,t)}),yL=ce("$ZodCheckIncludes",(e,t)=>{xi.init(e,t);let n=ol(t.includes),r=new RegExp(typeof t.position==="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push((o)=>{let a=o._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(r)}),e._zod.check=(o)=>{if(o.value.includes(t.includes,t.position))return;o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),bL=ce("$ZodCheckStartsWith",(e,t)=>{xi.init(e,t);let n=new RegExp(`^${ol(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push((r)=>{let o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=(r)=>{if(r.value.startsWith(t.prefix))return;r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),vL=ce("$ZodCheckEndsWith",(e,t)=>{xi.init(e,t);let n=new RegExp(`.*${ol(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push((r)=>{let o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=(r)=>{if(r.value.endsWith(t.suffix))return;r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}});var EL=ce("$ZodCheckOverwrite",(e,t)=>{xi.init(e,t),e._zod.check=(n)=>{n.value=t.tx(n.value)}});class ZS{constructor(e=[]){if(this.content=[],this.indent=0,this)this.args=e}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(`
197
197
  `).filter((a)=>a),r=Math.min(...n.map((a)=>a.length-a.trimStart().length)),o=n.map((a)=>a.slice(r)).map((a)=>" ".repeat(this.indent*2)+a);for(let a of o)this.content.push(a)}compile(){let e=Function,t=this?.args,r=[...(this?.content??[""]).map((o)=>` ${o}`)];return new e(...t,r.join(`
@@ -268,7 +268,7 @@ ${t.map((n)=>` ${n}`).join(`
268
268
  ${JSON.stringify(o.previewItems,null,2)}`)}catch(t){k(t),process.exit(1)}}import{writeFile as vde}from"node:fs/promises";function Ede(e){switch(e.type){case"campaign":return`/api/v1/campaigns/${e.id}/render`;case"sequence-step":return`/api/v1/sequences/${e.sequenceId}/nodes/${e.nodeId}/render`;case"template":return`/api/v1/templates/${e.id}/render`}}function S2(e,t){let n={};for(let r of t??[]){let o=r.indexOf("=");if(o<=0)throw new A(`Invalid ${e} "${r}". Expected key=value.`,400);n[r.slice(0,o)]=r.slice(o+1)}return n}function O0(e){if(e.subscriber&&e.email)throw new A("Use either --subscriber or --email, not both.",400);let t={...Cf("--vars-json",e.varsJson),...S2("--var",e.var)},n={...Cf("--attrs-json",e.attrsJson),...S2("--attr",e.attr)},r=(e.tag??[]).map((a)=>a.trim()).filter(Boolean);if(e.emptyTags&&r.length>0)throw new A("Use either --tag or --empty-tags, not both.",400);let o=r.length>0||e.emptyTags===!0;if(o&&!e.email)throw new A(e.subscriber?"--tag/--empty-tags describe an ad-hoc --email contact. A --subscriber render already evaluates conditions against that contact's stored tags, so drop the flag.":"--tag/--empty-tags describe the contact from --email. Pass --email, or use --subscriber to render as a stored contact with its own tags.",400);if(Object.keys(n).length>0&&!e.email)throw new A(e.subscriber?"--attr/--attrs-json describe an ad-hoc --email contact. A --subscriber render already uses that contact's stored attributes, so drop these flags.":"--attr/--attrs-json describe the contact from --email. Pass --email, or use --subscriber to render as a stored contact with its own attributes.",400);return{...e.subscriber?{subscriberId:e.subscriber}:{},...e.email?{subscriber:{email:e.email,...e.firstName?{firstName:e.firstName}:{},...e.lastName?{lastName:e.lastName}:{},...Object.keys(n).length>0?{customAttributes:n}:{},...o?{tags:r}:{}}}:{},...Object.keys(t).length>0?{variables:t}:{},...e.locale?{locale:e.locale}:{},...e.variant?{variantId:e.variant}:{},...e.variation?{variationId:e.variation}:{},...e.tracking?{tracking:!0}:{}}}function P0(e){if(!e?.length)return;let t=e.filter((r)=>r.reason==="unknown"),n=e.filter((r)=>r.reason==="no_value");if(t.length>0)console.log(`Unrecognized merge tags (empty or defaulted for every recipient): ${t.map((r)=>`{{${r.tag}}}`).join(", ")}`);if(n.length>0)console.log(`Empty for this contact: ${n.map((r)=>`{{${r.tag}}}`).join(", ")}`)}function F0(e){if(!e?.length)return;console.log("Conditions not evaluated (rendered as false):");for(let t of e)console.log(` ${t.description} - ${t.hint}`)}async function cb(e,t){if(!await z())k(H()),process.exit(1);try{let n=O0(t),r=await E("POST",Ede(e),n,t.company);if(t.json){D(r);return}if(t.out==="-"){process.stdout.write(r.html);return}if(t.out)await vde(t.out,r.html,"utf8");if(console.log(`Subject: ${r.subject}`),console.log(`Preview text: ${r.previewText||"None"}`),console.log(`Locale: ${r.locale}`),r.entity.variantId)console.log(`Variant: ${r.entity.variantId}`);if(console.log(`Personalized: ${r.personalized?"Yes":"No (sample contact)"}`),console.log(`Tracking: ${r.trackingApplied?"Auto-UTM applied":"Clean links"}`),console.log(`HTML: ${r.html.length} bytes`),P0(r.unresolvedMergeTags),F0(r.unevaluatedConditions),t.out)console.log(`Written to: ${t.out}`);else console.log("Pass --out <file> to save the HTML, or --out - to stream it.")}catch(n){k(n instanceof A?n:n),process.exit(1)}}function Ide(e){switch(e.type){case"campaign":return`/api/v1/campaigns/${e.id}/check`;case"sequence-step":return`/api/v1/sequences/${e.sequenceId}/nodes/${e.nodeId}/check`;case"template":return`/api/v1/templates/${e.id}/check`}}function Cde(e){if(e===void 0)return null;let t=e.trim().toLowerCase();if(t==="error"||t==="warning")return t;throw new A(`Invalid --fail-on "${e}". Use error or warning.`,400)}function wde(e,t){return e.some((n)=>n.severity==="error"||t==="warning"&&n.severity==="warning")}var Sde={error:"x",warning:"!",info:"-"},Dde={ok:"OK",broken:"Broken",invalid:"Won't work",server_error:"Server error",unreachable:"Unreachable",restricted:"Couldn't verify",personalized:"Personalized",not_checked:"Not checked"};function q0(e,t){return`${e} ${t}${e===1?"":"s"}`}function Bde(e){let t=e.issues.filter((p)=>p.severity==="error"),n=e.issues.filter((p)=>p.severity==="warning"),r=e.issues.filter((p)=>p.severity==="info");if(console.log(`Email check: ${e.grade} (${e.score}/100), likely ${e.placement}`),e.entity.variantId)console.log(`Variant: ${e.entity.variantId}`);let o=e.linkSummary,a=[`${o.ok} ok`];if(o.broken>0)a.push(`${o.broken} broken`);let c=e.links.filter((p)=>p.status==="unreachable").length,l=e.links.filter((p)=>p.status==="server_error").length;if(c>0)a.push(`${c} unreachable`);if(l>0)a.push(`${l} server error${l===1?"":"s"}`);if(o.restricted>0)a.push(`${o.restricted} couldn't verify`);if(o.notChecked>0)a.push(`${o.notChecked} not checked`);console.log(`Links and images: ${o.total}${o.total>0?` (${a.join(", ")})`:""}${e.linksChecked?"":" - live checks skipped"}`);for(let p of e.links){if(p.status==="ok"||p.status==="personalized")continue;if(p.status==="not_checked"&&e.linksChecked===!1)continue;console.log(` ${Dde[p.status]??p.status}: ${p.label} ${p.url||"(no URL)"} - ${p.message}`)}if(e.issues.length===0)console.log("No issues found.");else{console.log(`Issues: ${q0(t.length,"error")}, ${q0(n.length,"warning")}, ${q0(r.length,"tip")}`);for(let p of[...t,...n,...r]){let f=p.blockId?` (block ${p.blockId})`:"";console.log(` ${Sde[p.severity]} ${p.message}${f}${p.rule?` [${p.rule}]`:""}`)}}P0(e.unresolvedMergeTags),F0(e.unevaluatedConditions)}async function lb(e,t){if(!await z())k(H()),process.exit(1);let n=!1;try{let r=Cde(t.failOn),o={...O0(t),...t.links===!1?{links:!1}:{}},a=await E("POST",Ide(e),o,t.company);if(t.json)D(a);else Bde(a);n=r!==null&&wde(a.issues,r)}catch(r){k(r),process.exit(1)}if(n)process.exit(1)}function xde(e){let t=e.domain?.trim(),n=e.name?.trim(),r=!!e.withoutWebsite&&!t,o=kn(e.description,e.descriptionFile,"description")?.trim();if(!e.domain&&!r)throw new A("Domain is required unless --without-website is set",400);if(r&&!n)throw new A("Name is required when starting without a website",400);if(o&&o.length>500)throw new A("Description must be 500 characters or fewer",400);return{...r?{noWebsite:!0,name:n}:{domain:e.domain,...e.name!==void 0?{name:e.name}:{}},...o?{description:o}:{},...e.withWelcomeSequence?{withWelcomeSequence:!0}:{}}}function x2(e){let t=e.supportedLocales.join(", "),n=e.subscriberLocaleAttribute??"not configured";return`${e.primaryLocale} -> [${t}] | fallback ${e.fallbackLocale} | attr ${n} | sync ${e.autoSyncMode}`}function _de(e){let t=kn(e.description,e.descriptionFile,"description"),n=kn(e.companyContext,e.companyContextFile,"company-context"),r=kn(e.emailDesignPrompt,e.emailDesignPromptFile,"email-design-prompt"),o=Fe(e.brandColorsJson,e.brandColorsFile,"brand-colors"),a=Fe(e.valuePropsJson,e.valuePropsFile,"value-props"),c=Fe(e.testimonialsJson,e.testimonialsFile,"testimonials"),l=Fe(e.socialLinksJson,e.socialLinksFile,"social-links"),p=Fe(e.pricingJson,e.pricingFile,"pricing"),f=Fe(e.emailThemeJson,e.emailThemeFile,"email-theme");if(o!==void 0&&(typeof o!=="object"||Array.isArray(o)||o===null))throw new A("brand-colors JSON must be an object",400);if(a!==void 0&&!Array.isArray(a))throw new A("value-props JSON must be an array",400);if(c!==void 0&&!Array.isArray(c))throw new A("testimonials JSON must be an array",400);if(l!==void 0&&(typeof l!=="object"||Array.isArray(l)||l===null))throw new A("social-links JSON must be an object",400);if(p!==void 0&&(typeof p!=="object"||Array.isArray(p)||p===null))throw new A("pricing JSON must be an object",400);if(f!==void 0&&f!==null&&(typeof f!=="object"||Array.isArray(f)))throw new A("email-theme JSON must be an object or null",400);if(e.enableReplyTracking&&e.disableReplyTracking)throw new A("Use only one of --enable-reply-tracking or --disable-reply-tracking",400);if(e.enableReplyForwarding&&e.disableReplyForwarding)throw new A("Use only one of --enable-reply-forwarding or --disable-reply-forwarding",400);if(e.replyTrackingDomainMode!==void 0&&e.replyTrackingDomainMode!=="sequenzy"&&e.replyTrackingDomainMode!=="custom")throw new A("reply-tracking-domain-mode must be sequenzy or custom",400);let h=e.defaultList??[];if([h.length>0,e.defaultListsNone===!0,e.defaultListsAll===!0].filter(Boolean).length>1)throw new A("--default-list, --default-lists-none, and --default-lists-all are mutually exclusive",400);let v={};if(e.renameMatchingFooters){if(!e.name?.trim()||e.previousCompanyName===void 0)throw new A("--rename-matching-footers requires --name and --previous-company-name",400);v.renameMatchingFooters=!0,v.previousCompanyName=e.previousCompanyName}let C=[["name","name"],["logoUrl","logoUrl"],["founderName","founderName"],["primaryColor","primaryColor"],["toneVoice","toneVoice"],["emailLengthPreference","emailLengthPreference"],["emailPreset","emailPreset"],["privacyPolicyUrl","privacyPolicyUrl"],["termsUrl","termsUrl"],["address","address"],["language","language"],["fontFamily","fontFamily"],["emailDirection","emailDirection"],["senderProfileId","senderProfileId"],["fromEmail","fromEmail"],["fromName","fromName"],["replyProfileId","replyProfileId"],["replyTo","replyTo"],["replyToName","replyToName"]];for(let[R,F]of C){let L=e[R];if(typeof L==="string")v[F]=L}if(e.emailStyle!==void 0){if(!["visual","plain","ask"].includes(e.emailStyle))throw new A("email-style must be visual, plain or ask",400);v.emailStylePreference=e.emailStyle==="ask"?null:e.emailStyle}if(t!==void 0)v.description=t;if(n!==void 0)v.companyContext=n;if(r!==void 0)v.emailDesignPrompt=r;if(o!==void 0)v.brandColors=o;if(a!==void 0)v.valueProps=a;if(c!==void 0)v.testimonials=c;if(l!==void 0)v.socialLinks=l;if(p!==void 0)v.pricing=p;if(f!==void 0)v.emailTheme=f;if(e.enableReplyTracking)v.replyTrackingEnabled=!0;if(e.disableReplyTracking)v.replyTrackingEnabled=!1;if(e.replyTrackingDomainMode!==void 0)v.replyTrackingDomainMode=e.replyTrackingDomainMode;if(e.enableReplyForwarding)v.forwardReplies=!0;if(e.disableReplyForwarding)v.forwardReplies=!1;if(e.defaultListsAll)v.defaultSubscriberListIds=null;else if(e.defaultListsNone)v.defaultSubscriberListIds=[];else if(h.length>0)v.defaultSubscriberListIds=h;if(Object.keys(v).length===0)throw new A("Provide at least one company update option",400);return v}function D2(e,t){if(!t)return"Not set";return e?`${e} <${t}>`:t}function kde(e){if(e===null)return"All lists (every current and future list)";if(e.length===0)return"No lists";return`${e.length} specific list${e.length===1?"":"s"}: ${e.join(", ")}`}function Rde(e){if(!e.visible)return e.reason==="email_partner"?"Hidden (email-partner entitlement)":`Hidden (paid plan${e.subscriptionTier?`: ${e.subscriptionTier}`:""})`;if(e.reason==="inactive_subscription")return`Visible (subscription ${e.subscriptionStatus??"inactive"}; renew to remove)`;return"Visible (free plan; upgrade to remove)"}function Qde(e){if(e==="plain")return"Simple text (plain)";if(e==="visual")return"Designed (visual)";return"Not chosen (designed until you pick)"}function B2(e){if(console.log(e.name),console.log(`ID: ${e.id}`),console.log(`Status: ${e.status}`),console.log(`Website: ${e.websiteUrl??"Not set"}`),console.log(`Logo: ${e.logoUrl??"Not set"}`),console.log(`Primary color: ${e.primaryColor??"Not set"}`),console.log(`Founder: ${e.founderName??"Not set"}`),console.log(`Description: ${e.description??"Not set"}`),console.log(`Tone: ${e.toneVoice??"Not set"}`),console.log(`Context: ${e.companyContext??"Not set"}`),console.log(`Design prompt: ${e.emailDesignPrompt??"Not set"}`),console.log(`Email length: ${e.emailLengthPreference}`),e.emailStylePreference!==void 0)console.log(`AI email style: ${Qde(e.emailStylePreference)}`);if(e.emailPreset)console.log(`Header and footer: ${e.emailPreset==="minimal"?"Compact footer, no logo (minimal)":"Logo and full footer (branded)"}`);console.log(`Primary language: ${e.language}`),console.log(`Email direction: ${e.emailDirection}`),console.log(`Sequenzy email branding: ${Rde(e.emailBranding)}`),console.log(`Subscription: ${e.emailBranding.subscriptionUrl}`),console.log(`Default lists for new contacts: ${kde(e.defaultSubscriberListIds)}`),console.log(`Default From: ${D2(e.defaultFromName,e.defaultFromEmail)}`),console.log(`Default Reply-To: ${D2(e.defaultReplyToName,e.defaultReplyToEmail)}`),console.log(`Reply tracking: ${e.replyTrackingEnabled?"Enabled":"Disabled"}`),console.log(`Reply domain mode: ${e.replyTrackingDomainMode}`),console.log(`Reply forwarding: ${e.forwardReplies?"Enabled":"Disabled"}`),console.log(`Reply retention: ${e.replyRetentionDays} days`),console.log(`Font family: ${e.fontFamily??"Not set"}`),console.log(`Email theme: ${e.emailTheme?`customized (${e.emailTheme.presetId??"default"} preset)`:"Platform default"}`),console.log(`Address: ${e.address??"Not set"}`),console.log(`Privacy policy: ${e.privacyPolicyUrl??"Not set"}`),console.log(`Terms: ${e.termsUrl??"Not set"}`),console.log(`Created: ${te(e.createdAt)}`),console.log(`Localization: ${x2(e.emailLocalizationConfig)}`)}async function Sf(e,t){if(!await z())k(H()),process.exit(1);try{if(e==="list"){let c=await E("GET","/api/v1/companies"),l=c.companies.map((f)=>{let h=ct({companyId:f.id});return{...f,url:h.urls.dashboard,settingsUrl:h.urls.settings,subscriptionUrl:h.urls.subscription}}),p=c.currentCompanyId!==null?ct({companyId:c.currentCompanyId}):void 0;if(t.json){D({...c,companies:l,...p!==void 0&&{appUrls:p.urls}});return}console.log(`Companies (${c.companies.length})`);for(let f of l){let h=f.id===c.currentCompanyId?" (current)":"";console.log(`- ${f.name} [${f.id}]${h}`),console.log(` Status: ${f.status}`),console.log(` Website: ${f.websiteUrl??"Not set"}`),Ce(" URL",f.url),Ce(" Settings",f.settingsUrl),Ce(" Subscription",f.subscriptionUrl),console.log(` Localization: ${x2(f.emailLocalizationConfig)}`)}return}if(!t.id){if(e!=="create")throw new A("Company ID is required",400)}if(e==="create"){let c=await E("POST","/api/v1/companies",xde(t)),l=ct({companyId:c.company.id});if(t.json){D({...c,company:{...c.company,url:l.urls.dashboard,settingsUrl:l.urls.settings,subscriptionUrl:l.urls.subscription},appUrls:l.urls,settingsUrls:l.settingsUrls});return}if(console.log(c.company.name),console.log(`ID: ${c.company.id}`),Ce("URL",l.urls.dashboard),Ce("Settings",l.urls.settings),Ce("Subscription",l.urls.subscription),console.log(`Status: ${c.company.status}`),console.log(`Website: ${c.company.websiteUrl??"Not set"}`),c.welcomeAutomationId)console.log(`Welcome sequence: ${c.welcomeAutomationId}`),console.log(`Generation job: ${c.welcomeEnrichmentJobId??"Not queued; open the editor to retry"}`);console.log(""),console.log(c.message);return}if(e==="update"){let c=t.id;if(!c)throw new A("Company ID is required",400);let l=await E("PATCH",`/api/v1/companies/${c}`,_de(t)),p=ct({companyId:c});if(t.json){D({...l,company:{...l.company,url:p.urls.dashboard,settingsUrl:p.urls.settings,subscriptionUrl:p.urls.subscription},appUrls:p.urls,settingsUrls:p.settingsUrls});return}console.log("Company updated"),B2(l.company),Ce("URL",p.urls.dashboard),Ce("Settings",p.urls.settings);return}let n=await E("GET",`/api/v1/companies/${t.id}`),r=ct({companyId:t.id});if(t.json){D({...n,company:{...n.company,url:r.urls.dashboard,settingsUrl:r.urls.settings,subscriptionUrl:r.urls.subscription},appUrls:r.urls,settingsUrls:r.settingsUrls});return}let o=n.company;Ce("URL",r.urls.dashboard),Ce("Settings",r.urls.settings),B2(o);let a=Object.entries(o.emailLocalizationConfig.valueMappings);if(a.length>0){console.log("Mappings:");for(let[c,l]of a)console.log(`- ${c} -> ${l}`)}}catch(n){k(n instanceof A?n:n),process.exit(1)}}var _2=["email_events","sms_events","custom_events","subscribers"],k2=["every_5_minutes","every_15_minutes","hourly","daily"],Tde=["s3","gcs"],R2=30,Ca="SEQUENZY_DATA_EXPORT_SECRET";function ec(e){k(new A(e,400)),process.exit(1)}function ub(e,t){if(!e||e.trim().length===0)ec(`${t} is required.`);return e.trim()}function L0(e,t,n){if(e===void 0)return;if(!t.includes(e))ec(`Invalid ${n} "${e}". Use one of: ${t.join(", ")}.`);return e}function Q2(e){if(e===void 0)return;let t=e.split(",").map((r)=>r.trim()).filter(Boolean),n=t.filter((r)=>!_2.includes(r));if(t.length===0||n.length>0)ec(`--datasets must be a comma-separated list of: ${_2.join(", ")}.`);return t}function $de(e,t=new Date){if(e===void 0)return;let n=Number(e);if(!Number.isInteger(n)||n<0||n>R2)ec(`--backfill-days must be a whole number from 0 to ${R2}.`);if(n===0)return;return new Date(t.getTime()-n*86400000+60000).toISOString()}function T2(e){return e??process.env[Ca]??void 0}function Nde(e){let t=e.provider==="gcs"?"gs":"s3",n=e.pathPrefix?`/${e.pathPrefix}`:"";return`${t}://${e.bucket}${n}/`}function Ode(e){if(!e.isEnabled)return"paused";return e.status==="failed"?"failing":e.status}function db(e){console.log(`- ${e.name} -> ${Nde(e)}`),console.log(` id: ${e.id} | ${e.frequency} | status: ${Ode(e)} | datasets: ${e.datasets.join(", ")}`),console.log(` last success: ${e.lastSuccessAt??"never"} | next run: ${e.nextRunAt??"not scheduled"} | rows exported: ${e.totalRowsExported}`);for(let[t,n]of Object.entries(e.exportedThrough))console.log(` ${t} exported through: ${n??"not started"}`);if(e.lastError)console.log(` last error: ${e.lastError}`)}async function tc(e,t){if(!await z())k(H()),process.exit(1);let n=(r,o)=>{if(t.json){console.log(JSON.stringify(r,null,2));return}o()};try{if(e==="list"){let c=await E("GET","/api/v1/data-exports",void 0,t.company);n(c,()=>{console.log(`Data exports (${c.dataExports.length})`);for(let l of c.dataExports)db(l)});return}if(e==="create"){let c=L0(t.provider,Tde,"--provider")??"s3",l=T2(t.secretAccessKey);if(!l)ec(`Provide --secret-access-key or set ${Ca} in the environment.`);let p=Q2(t.datasets),f=L0(t.frequency,k2,"--frequency"),h=$de(t.backfillDays),y=await E("POST","/api/v1/data-exports",{name:ub(t.name,"--name"),provider:c,bucket:ub(t.bucket,"--bucket"),...t.region!==void 0?{region:t.region}:{},...t.endpoint!==void 0?{endpoint:t.endpoint}:{},...t.prefix!==void 0?{pathPrefix:t.prefix}:{},accessKeyId:ub(t.accessKeyId,"--access-key-id"),secretAccessKey:l,...p?{datasets:p}:{},...f?{frequency:f}:{},...h?{startFrom:h}:{}},t.company);n(y,()=>{console.log(`Created data export ${y.dataExport.id}`),db(y.dataExport),console.log("Bucket access was verified with a test file. The first export is running now.")});return}let r=encodeURIComponent(ub(t.id,"<id>"));if(e==="get"){let c=await E("GET",`/api/v1/data-exports/${r}`,void 0,t.company);n(c,()=>db(c.dataExport));return}if(e==="update"){let c={};if(t.name!==void 0)c.name=t.name;if(t.bucket!==void 0)c.bucket=t.bucket;if(t.region!==void 0)c.region=t.region;if(t.endpoint!==void 0)c.endpoint=t.endpoint;if(t.prefix!==void 0)c.pathPrefix=t.prefix;let l=Q2(t.datasets);if(l)c.datasets=l;let p=L0(t.frequency,k2,"--frequency");if(p)c.frequency=p;if(t.enabled!==void 0){if(t.enabled!=="true"&&t.enabled!=="false")ec('--enabled must be "true" or "false".');c.isEnabled=t.enabled==="true"}if(t.accessKeyId!==void 0){let h=T2(t.secretAccessKey);if(!h)ec(`Rotating credentials needs --secret-access-key or ${Ca}.`);c.accessKeyId=t.accessKeyId,c.secretAccessKey=h}else if(t.secretAccessKey!==void 0)ec("Provide --access-key-id together with --secret-access-key.");if(Object.keys(c).length===0)ec("Nothing to update. Pass --name, --datasets, --frequency, --enabled, --bucket, --region, --endpoint, --prefix or new credentials.");let f=await E("PATCH",`/api/v1/data-exports/${r}`,c,t.company);n(f,()=>{console.log(`Updated data export ${f.dataExport.id}`),db(f.dataExport)});return}if(e==="delete"){if(!await mt(`Delete data export ${decodeURIComponent(r)}? Files already written stay in the bucket.`,t)){console.log("Cancelled.");return}let l=await E("DELETE",`/api/v1/data-exports/${r}`,void 0,t.company);n(l,()=>console.log(`Deleted data export ${l.dataExportId}. Files already written were kept.`));return}if(e==="test"){let c=await E("POST",`/api/v1/data-exports/${r}/test`,void 0,t.company);n(c,()=>console.log(`Connection works. Test file written at ${c.testedAt}.`));return}if(e==="run"){let c=await E("POST",`/api/v1/data-exports/${r}/run`,void 0,t.company);n(c,()=>console.log(`Queued an export for ${c.dataExport.name}. Check progress with \`sequenzy data-exports runs ${c.dataExport.id}\`.`));return}let o=t.limit?`?limit=${encodeURIComponent(t.limit)}`:"",a=await E("GET",`/api/v1/data-exports/${r}/runs${o}`,void 0,t.company);n(a,()=>{console.log(`Recent runs (${a.runs.length})`);for(let c of a.runs){let l=c.status==="running"?"in progress":`${c.rowCount} rows, ${c.fileCount} files, ${c.byteCount} bytes`;if(console.log(`- ${c.startedAt} ${c.status}${c.isManual?" (manual)":""}: ${l}`),c.error)console.log(` error: ${c.error}`)}})}catch(r){k(r),process.exit(1)}}import{readFileSync as Pde}from"node:fs";import{isatty as Fde}from"node:tty";function qde(e,t=(r)=>Pde(r,"utf8"),n=Fde(0)){if(e==="-"&&n)throw new A("Pass the design.md file to save, for example 'sequenzy design-md update design.md', or pipe it into stdin.",400);try{return t(e==="-"?0:e)}catch(r){throw new A(`Could not read ${e==="-"?"stdin":e}: ${r instanceof Error?r.message:String(r)}`,400)}}function Lde(e,t){if(!e.trim())throw new A("design.md is empty. Run 'sequenzy design-md get > design.md', edit it, then update from that file.",400);return{markdown:e,...t.expectedVersion?{expectedVersion:t.expectedVersion}:{},...t.dryRun?{dryRun:!0}:{}}}function Ude(e){return e.line?`line ${e.line}: ${e.message}`:e.message}async function U0(e,t){if(!await z())k(H()),process.exit(1);try{if(e==="get"){let o=await E("GET","/api/v1/design-md",void 0,t.company);if(t.json){D(o);return}process.stdout.write(o.markdown),console.error(`version: ${o.version}`);return}let n=qde(t.file??"-"),r=await E("PUT","/api/v1/design-md",Lde(n,t),t.company);if(t.json){D(r);return}if(r.message)console.log(r.message);for(let o of r.warnings??[])console.log(`Warning: ${Ude(o)}`);console.log(`version: ${r.version}`)}catch(n){k(n),process.exit(1)}}function jde(e){if(e.withoutLayoutRules&&e.layoutRules!==void 0)throw new A("Use either --layout-rules or --without-layout-rules, not both.",400);if(e.withoutLayoutRules)return[];if(e.layoutRules===void 0)return null;let t=e.layoutRules.split(",").map((n)=>n.trim()).filter(Boolean);if(!t.length)throw new A("Pass at least one rule ID to --layout-rules, or use --without-layout-rules.",400);return t}async function j0(e,t){try{if(!await z())throw H();let n;if(e!=="get"){let o=t.expectedStyleId?.trim();if(t.ifUnset&&t.expectedStyleId!==void 0)throw new A("Use either --if-unset or --expected-style-id, not both.",400);if(!o&&!(e==="save"&&t.ifUnset))throw new A("Get the current style first, then pass --expected-style-id <revisionId>. For an initial save, use --if-unset.",400);if(n={expectedStyleId:o??null},e==="save"){if(!t.emailId?.trim())throw new A("An email ID is required.",400);if(n.emailId=t.emailId,t.canvasFile)n.canvas=JSON.parse(kn(void 0,t.canvasFile,"canvas")??"");let a=jde(t);if(a)n.layoutRuleIds=a;if(t.notes!==void 0){if(t.notes.length>500)throw new A("Notes must be 500 characters or fewer.",400);n.notes=t.notes}}}let r=await E(e==="get"?"GET":e==="save"?"PUT":"DELETE","/api/v1/email-ai-style",n,t.company);if(t.json){D(r);return}if(r.style){console.log(`Saved AI style: ${r.style.sourceName}`),console.log(`Source email: ${r.style.sourceEmailId}`),console.log(`Saved at: ${r.style.savedAt}`);let o=r.style.layout?.rules??[];console.log(o.length?`Layout habits (${o.length}):`:"Layout habits: none");for(let a of o)console.log(` - ${a.description} [${a.id}]`);if(r.style.notes)console.log(`Notes: ${r.style.notes}`)}else console.log(e==="clear"?"AI style cleared. Future generations use your brand defaults.":"No active saved AI style.");console.log(`Revision: ${r.revisionId??"none"}`),console.log(`Can manage: ${r.canManage?"yes":"no"}`)}catch(n){k(n),process.exitCode=1}}function $2(e){let t=e.command("email-ai-style").description("Get, save or clear the company's saved AI email style").action(()=>t.help());S(t,{notes:["Saving snapshots appearance plus detected layout habits (for example dotted dividers around every button). Existing emails and source content stay unchanged.","All detected habits are kept unless you pass --layout-rules with the IDs to keep or --without-layout-rules. Review them with get after saving.","Read the current revision before replacing or clearing. A conflict requires a fresh review, not an automatic retry."],examples:["sequenzy email-ai-style get --json","sequenzy email-ai-style save email_123 --if-unset",'sequenzy email-ai-style save email_123 --expected-style-id style_123 --layout-rules "around|button|divider:dots" --notes "Keep the dots around buttons"',"sequenzy email-ai-style clear --expected-style-id style_123"]}),t.command("get").description("Show the current saved style and revision").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((n)=>j0("get",n)),t.command("save <email-id>").description("Capture an email's appearance as the company AI default").option("--if-unset","Save only when no style is stored").option("--expected-style-id <id>","Revision ID returned by get").option("--canvas-file <path>","Optional JSON snapshot with blocks, theme, fontFamily and emailPreset; otherwise use the stored email").option("--layout-rules <ids>","Comma-separated IDs of detected layout habits to keep; omit to keep all").option("--without-layout-rules","Keep appearance only, no layout habits").option("--notes <text>","Design notes for future generations (up to 500 characters)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((n,r)=>j0("save",{...r,emailId:n})),t.command("clear").description("Clear only the saved style you reviewed").requiredOption("--expected-style-id <id>","Revision ID returned by get").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((n)=>j0("clear",n))}function N2(e,t){let n=(c)=>{let l=c.values?.length?` (${c.values.map((p)=>String(p)).join(" | ")})`:"";return`${c.name}: ${c.type}${l}`},r=e.filter((c)=>c.required).map(n),o=e.filter((c)=>!c.required).map(n),a=[];if(r.length>0){let c=`{ ${r.join(", ")} }`;a.push(t?`[${c}]`:c)}else if(t)a.push("[{ }]");if(o.length>0)a.push(a.length>0?`+ optional ${o.join(", ")}`:`optional ${o.join(", ")}`);return a.join(" ")}function zde(e){if(e.values&&e.values.length>0)return e.values.map((t)=>String(t)).join(" | ");if(e.itemFields&&e.itemFields.length>0)return N2(e.itemFields,!0);if(e.fields&&e.fields.length>0)return N2(e.fields,!1);return""}var Mde={any_contact:"any contact",inline_tags_or_stored_subscriber:"--tag on an --email contact, or --subscriber",stored_subscriber:"--subscriber only"};function Hde(e){if(!e?.length)return;console.log(""),console.log("Condition fields (the `conditions` array on any block)"),console.log("");for(let t of e){if(console.log(` ${t.field} ${t.operators.join(", ")}`),console.log(` value: ${t.valueFormat}`),t.values?.length)console.log(` values: ${t.values.join(", ")}`);if(t.serverEvaluated)console.log(` preview: ${Mde[t.previewSupport]}`);console.log(` example: ${JSON.stringify(t.example)}`)}console.log(""),console.log('Fields with no preview line resolve from any contact. A condition a render cannot evaluate is rendered as false and listed under "Conditions not evaluated".')}function Gde(e){console.log(""),console.log("Every block also takes a `conditions` array, and each condition field accepts only its own operators."),console.log(`Run \`sequenzy blocks ${e} --conditions\` for the field, operator, and value table.`)}function Jde(e){console.log("Email block types"),console.log("");let t=Math.max(...e.map((n)=>n.type.length),4);for(let n of e){let r=n.required.length>0?`requires ${n.required.join(", ")}`:"no required fields",o=n.creatable?" ":"*";console.log(`${o} ${n.type.padEnd(t)} ${r}`)}console.log(""),console.log("* managed by the editor - prefer not to hand-author these. Pass --creatable-only to hide them."),console.log("Pass a block type for full field details, e.g. `sequenzy blocks list`."),console.log("Every block takes a `conditions` array. Run `sequenzy blocks conditional-group` for the field, operator, and value table.")}function Vde(e,t){if(console.log(`${e.type}${e.creatable?"":" (managed by the editor)"}`),e.reason)console.log(e.reason);console.log("");let n=Math.max(...e.fields.map((o)=>o.name.length),5),r=Math.max(...e.fields.map((o)=>o.type.length),8);for(let o of e.fields){let a=o.required?"required":"optional";console.log(` ${o.name.padEnd(n)} ${o.type.padEnd(r)} ${a} ${zde(o)}`.trimEnd())}if(e.notes&&e.notes.length>0){console.log("");for(let o of e.notes)console.log(`- ${o}`)}if(e.example)if(console.log(""),t.example)console.log("Example:"),console.log(JSON.stringify(e.example,null,2));else console.log(`Example: ${JSON.stringify(e.example)}`)}function Kde(e,t){let n=e?.trim();if(n){let r=`/api/v1/email-blocks/${encodeURIComponent(n)}`;return t.conditions?`${r}?conditionFields=true`:r}return t.creatableOnly?"/api/v1/email-blocks?creatableOnly=true":"/api/v1/email-blocks"}async function O2(e,t){if(!await z())k(H()),process.exit(1);try{let n=Kde(e,t),r=await E("GET",n,void 0,t.company);if(t.json){D(r);return}if("blockType"in r){if(Vde(r.blockType,t),r.conditionFields)Hde(r.conditionFields);else if(r.conditionFieldsHint)Gde(r.blockType.type);return}Jde(r.blockTypes)}catch(n){k(n instanceof A?n:n),process.exit(1)}}import{mkdir as Wde,writeFile as Yde}from"node:fs/promises";import{resolve as P2}from"node:path";function z0(e){let t=[...new Set(e.applyTo?.split(",").map((n)=>n.trim()).filter(Boolean)??[])];if(e.applyTo!==void 0&&!t.length)throw new A("--apply-to requires at least one category",400);if(t.some((n)=>!["sequences","campaigns","transactional","templates"].includes(n)))throw new A("--apply-to accepts sequences,campaigns,transactional,templates",400);if(e.includeCustomized&&!t.length)throw new A("--include-customized requires --apply-to",400);return{scopes:t,includeCustomized:e.includeCustomized??!1}}function M0(e){console.log(`Affected email versions: ${e.affected.length}`);for(let[t,n]of Object.entries(e.counts))console.log(` ${t}: ${n}`);console.log(`Skipped: ${e.skipped.length}`);for(let t of e.skipped)console.log(` ${t.name} (${t.kind}:${t.id}): ${t.reason}`);console.log(`Preview token: ${e.token}`)}async function F2(e,t){if(!e.renderedPreview)throw new A("The server did not return a rendered preview",500);let n=P2(t);await Wde(n,{recursive:!0});let r=[];async function o(a,c){let l=P2(n,a);await Yde(l,c,"utf8"),r.push(l)}await o("footer.html",e.renderedPreview.footerHtml);for(let[a,c]of e.renderedPreview.samples.entries())await o(`sample-${a+1}-before.html`,c.beforeHtml),await o(`sample-${a+1}-after.html`,c.afterHtml);return r}function Zde(e){let t=e.defaultSlot!==null?` [default ${e.defaultSlot}]`:"";return`${e.id} ${e.name}${t} v${e.version} ${e.blocks.length} block${e.blocks.length===1?"":"s"} updated ${te(e.updatedAt)}`}function q2(e){if(console.log(`ID: ${e.id}`),console.log(`Name: ${e.name}`),e.description)console.log(`Description: ${e.description}`);console.log(`Type: ${e.componentType}`),console.log(`Default slot: ${e.defaultSlot??"not pinned as a default"}`),console.log(`Version: ${e.version}`),console.log(`Blocks: ${e.blocks.length}`),console.log(`Updated: ${te(e.updatedAt)}`)}function pb(e,t){let n=Fe(e.blocksJson,e.blocksFile,"blocks");if(n===void 0){if(t)throw new A("Provide component blocks with --blocks-json or --blocks-file",400);return}let r=Array.isArray(n)?n:typeof n==="object"&&n!==null&&("component"in n)&&typeof n.component==="object"&&n.component!==null&&("blocks"in n.component)?n.component.blocks:void 0;if(!Array.isArray(r))throw new A("blocks JSON must be an array or a component response containing component.blocks",400);if(r.length===0)throw new A("blocks JSON must contain at least one block",400);return r}async function nc(e,t,n){if(!await z())k(H()),process.exit(1);try{if(e==="list"){let o=new URLSearchParams;if(n.type)o.set("type",n.type);if(n.defaultsOnly)o.set("defaultsOnly","true");let a=await E("GET",`/api/v1/email-components${o.size>0?`?${o}`:""}`,void 0,n.company);if(n.json){D(a);return}if(a.components.length===0){console.log("No email components found.");return}for(let c of a.components)console.log(Zde(c));return}if(e==="footer-get"){let o=await E("GET","/api/v1/email-components/defaults/footer",void 0,n.company);if(n.json){D(o);return}q2(o.component),console.log(`
269
269
  Edit these blocks and write them back with: sequenzy components footer set --blocks-file <file>`);return}if(e==="footer-preview"){let o={blocks:pb(n,!0),application:z0(n),renderPreview:n.renderPreview||Boolean(n.outputDir)};if(n.name!==void 0)o.name=n.name;if(n.description!==void 0)o.description=n.description;if(n.sampleId||n.sampleKind){if(!n.sampleId||!n.sampleKind||!["email","ab_variant","localization"].includes(n.sampleKind))throw new A("Provide --sample-id and --sample-kind (email, ab_variant, localization) together",400);o.sample={id:n.sampleId,kind:n.sampleKind},o.renderPreview=!0}let a=await E("POST","/api/v1/email-components/defaults/footer/preview",o,n.company),c=n.outputDir?await F2(a,n.outputDir):void 0;if(n.json){D({...a,...c?{previewFiles:c}:{}});return}if(M0(a.application),c)for(let l of c)console.log(`Preview HTML: ${l}`);if(a.renderedPreview)console.log(a.renderedPreview.note);console.log("Apply using footer set with the same blocks, metadata and scope options plus --preview-token <token>."),_n(a);return}if(e==="footer-set"){let o=pb(n,!0),a=z0(n),c=a.scopes.length>0;if(c&&!n.previewToken)throw new A("Run components footer preview with the same options, then provide --preview-token to apply to existing emails",400);if(!await mt(c?`Save the default footer and apply the reviewed preview to ${a.scopes.join(", ")}${a.includeCustomized?", including customized footers":""}?`:"Replace the company's default email footer for future emails? Existing emails keep their saved footer.",n)){console.log("Aborted.");return}let l={blocks:o};if(n.previewToken)l.application=a,l.previewToken=n.previewToken;if(n.name!==void 0)l.name=n.name;if(n.description!==void 0)l.description=n.description;let p=await E("PUT","/api/v1/email-components/defaults/footer",l,n.company);if(n.json){D(p);return}if(console.log(`Saved default footer "${p.component.name}" (v${p.component.version}).`),p.application)M0(p.application);_n(p);return}if(e==="create"){let o=t??n.name;if(!o)throw new A("Component name is required",400);let a=pb(n,!0),c={name:o,blocks:a};if(n.description!==void 0)c.description=n.description;if(n.type!==void 0)c.componentType=n.type;let l=await E("POST","/api/v1/email-components",c,n.company);if(n.json){D(l);return}console.log(`Created component "${l.component.name}" (${l.component.id}).`),_n(l);return}if(!t)throw new A("Component ID is required",400);if(e==="get"){let o=await E("GET",`/api/v1/email-components/${encodeURIComponent(t)}`,void 0,n.company);if(n.json){D(o);return}q2(o.component);return}if(e==="update"){let o=pb(n,!1),a={};if(n.name!==void 0)a.name=n.name;if(n.description!==void 0)a.description=n.description;if(n.type!==void 0)a.componentType=n.type;if(o!==void 0)a.blocks=o;if(Object.keys(a).length===0)throw new A("Provide at least one of: --name, --description, --type, --blocks-json, --blocks-file",400);let c=await E("PATCH",`/api/v1/email-components/${encodeURIComponent(t)}`,a,n.company);if(n.json){D(c);return}console.log(`Updated component "${c.component.name}" (v${c.component.version}).`),_n(c);return}if(!await mt(`Delete email component ${t}? Emails that already use it keep their copied blocks.`,n)){console.log("Aborted.");return}let r=await E("DELETE",`/api/v1/email-components/${encodeURIComponent(t)}`,void 0,n.company);if(n.json){D(r);return}console.log(`Deleted component ${r.id}.`)}catch(r){k(r instanceof A?r:r),process.exit(1)}}function Xde(e){let t=Object.entries({kickerStyle:e.kickerStyle,titleAlignment:e.titleAlignment,buttonShape:e.buttonShape,dividerStyle:e.dividerStyle,density:e.density,openerTreatments:e.openerTreatments?.split(",").map((r)=>r.trim()).filter(Boolean)}).filter(([,r])=>r!==void 0);if(e.reset){if(t.length>0||e.spine!==void 0)throw new A("--reset cannot be combined with other adjustments",400);return{reset:!0}}let n={};if(t.length>0)n.designCode=Object.fromEntries(t);if(e.spine!==void 0)n.compositionSpine=e.spine;if(Object.keys(n).length===0)throw new A("Provide at least one adjustment flag (e.g. --button-shape pill), or --reset",400);return n}function L2(e){let t=e.designSystem;if(console.log(`Email design system${e.isDefault?" (derived from brand context)":" (custom - carried by the design direction text)"}`),console.log(`- Composition spine: ${t.compositionSpine}`),console.log(`- Kicker style: ${t.designCode.kickerStyle}`),console.log(`- Title alignment: ${t.designCode.titleAlignment}`),console.log(`- Button shape: ${t.designCode.buttonShape}`),console.log(`- Divider style: ${t.designCode.dividerStyle}`),console.log(`- Density: ${t.designCode.density}`),console.log(`- Opener treatments: ${t.designCode.openerTreatments.join(", ")}`),e.directionText)console.log(`- Direction text:
270
270
  ${e.directionText}`)}async function H0(e,t){if(!await z())k(H()),process.exit(1);try{if(e==="get"){let o=await E("GET","/api/v1/email-design-system",void 0,t.company);if(t.json){D(o);return}L2(o);return}let n=Xde(t),r=await E("PATCH","/api/v1/email-design-system",n,t.company);if(t.json){D(r);return}if(r.message)console.log(r.message);L2(r)}catch(n){k(n instanceof A?n:n),process.exit(1)}}import{writeFile as npe}from"node:fs/promises";function epe(e){if(e===null||e===void 0)return"";if(typeof e==="string")return e;if(typeof e==="number"||typeof e==="boolean"||typeof e==="bigint")return String(e);return JSON.stringify(e)}function tpe(e){let t=0;while(t<e.length&&e.charCodeAt(t)<=32)t+=1;let n=e[t];return n!==void 0&&["=","+","-","@"].includes(n)}function U2(e){let t=epe(e),n=typeof e==="string"&&tpe(t)?`'${t}`:t;return/[",\r\n]/.test(n)?`"${n.replaceAll('"','""')}"`:n}function mb(e,t){return[e.map(U2).join(","),...t.map((n)=>e.map((r)=>U2(n[r])).join(","))].join(`\r
271
- `)}var rpe=["id","type","recipientEmail","subject","status","eventAt","sentAt","deliveredAt","openedAt","clickedAt","bouncedAt","complainedAt","campaignId","transactionalEmailId","automationNodeId","opened","clicked","url","subscriberId","abTestVariantId"];function ope(e){if(!e.senderEmail&&!e.senderName)return"Unknown";if(!e.senderName)return e.senderEmail??"Unknown";return e.senderEmail?`${e.senderName} <${e.senderEmail}>`:e.senderName}function Df(e,t,n){if(e!==void 0&&!n.includes(e))throw new A(`${t} must be one of: ${n.join(", ")}`,400)}function ipe(e){if(e.all&&e.page!==void 0)throw new A("--all cannot be combined with --page",400);if(e.csv!==void 0&&e.json)throw new A("--csv cannot be combined with --json",400)}function j2(e){Df(e.status,"--status",["pending","sent","delivered","opened","clicked","bounced","complained","failed","suppressed"]),Df(e.emailType,"--email-type",["campaign","transactional","sequence"]),Df(e.bounceType,"--bounce-type",["Permanent","Transient"]),Df(e.sort,"--sort",["recipientEmail","subject","status","eventAt","sentAt","createdAt"]),Df(e.order,"--order",["asc","desc"]);let t=new URLSearchParams,n=[["search",e.search],["subject",e.subject],["recipient",e.recipient],["status",e.status],["emailType",e.emailType],["bounceType",e.bounceType],["campaignId",e.campaign],["transactionalEmailId",e.transactional],["automationId",e.sequence],["automationNodeId",e.automationNodeId],["days",e.days],["page",e.page],["limit",e.limit],["sortField",e.sort],["sortOrder",e.order]];for(let[o,a]of n)if(a!==void 0&&a.trim()!=="")t.set(o,a.trim());let r=t.toString();return r?`?${r}`:""}function spe(e){let t=[e.clickedUrl?`url=${e.clickedUrl}`:null,e.bounceType?`bounce=${yz(e.bounceType)}`:null,e.bounceSubType?`subtype=${bz(e.bounceSubType)}`:null,e.complaintType?`complaint=${e.complaintType}`:null,e.ipAddress?`ip=${e.ipAddress}`:null,e.countryCode?`country=${e.countryCode}`:null].filter((n)=>n!==null);return`${te(e.eventTime)} ${e.eventType}${t.length>0?` (${t.join(", ")})`:""}`}function ape(e){if(e.isCopiedRecipient)return e.primaryEmailSendId?`HTML body: stored on primary email send ${e.primaryEmailSendId}`:"HTML body: unavailable for this copied-recipient delivery record";return"HTML body: unavailable (the email send row may have been cleaned up)"}function cpe(e){return`Reply destination: ${e??"None"}`}function lpe(e,t){let n=e.emailSend,r=ct({companyId:n.companyId,emailSendId:n.id,...n.campaignId?{campaignId:n.campaignId}:{},...n.transactionalEmailId?{transactionalId:n.transactionalEmailId}:{}});if(t.json){D({...e,emailSend:{...n,url:r.urls.emailSend},appUrls:r.urls});return}if(t.htmlOnly){console.log(n.emailBody??"");return}if(console.log(`Email send: ${n.id}`),Ce("URL",r.urls.emailSend),console.log(`Source: ${e.source}`),console.log(`Status: ${n.status}`),console.log(`Source type: ${n.type??"Unknown"}`),console.log(`Delivery policy: ${n.emailType??"Unknown"}`),n.isCopiedRecipient)console.log("Copied recipient: yes"),console.log(`Primary email send: ${n.primaryEmailSendId??"unavailable"}`);if(console.log(`Recipient: ${n.recipientEmail??"Unknown"}`),console.log(`Subject: ${n.subject??"Unknown"}`),console.log(`Sender: ${ope(n)}`),console.log(cpe(n.originalReplyTo)),console.log(`Created: ${te(n.createdAt)}`),console.log(`Sent: ${te(n.sentAt)}`),console.log(`Delivered: ${te(n.deliveredAt)}`),console.log(`Opened: ${te(n.openedAt)}`),console.log(`Clicked: ${te(n.clickedAt)}`),console.log(`Bounced: ${te(n.bouncedAt)}`),console.log(`Complained: ${te(n.complainedAt)}`),n.errorMessage)console.log(`Error: ${n.errorMessage}`);if(e.message)console.log(""),console.log(e.message);if(console.log(""),n.emailBody)if(console.log(`HTML body: ${n.emailBody.length} chars`),t.html)console.log(""),console.log(n.emailBody);else console.log("Run with --html to print the full HTML body.");else console.log(ape(n));if(console.log(""),console.log(`Events (${e.events.length})`),e.events.length===0){console.log(" None");return}for(let o of e.events)console.log(`- ${spe(o)}`)}async function upe(e){if(!e.id)throw new A("Email send ID is required",400);let t=await E("GET",`/api/v1/email-sends/${encodeURIComponent(e.id)}`,void 0,e.company);lpe(t,e)}async function dpe(e){if(ipe(e),!e.all)return E("GET",`/api/v1/email-sends${j2(e)}`,void 0,e.company);let t=e.limit??"100",n=new Map,r=1,o,a=0;while(!0){let c=await E("GET",`/api/v1/email-sends${j2({...e,page:String(r),limit:t})}`,void 0,e.company);o??=c,a=c.pagination.total;for(let l of c.emailSends)if(!n.has(l.id))n.set(l.id,l);if(c.emailSends.length===0||r>=c.pagination.totalPages)break;r+=1}return{...o??{success:!0,retentionDays:14,emailSends:[],pagination:{page:1,limit:Number(t),total:0,totalPages:0}},emailSends:Array.from(n.values()),pagination:{page:1,limit:Number(t),total:Math.max(a,n.size),totalPages:r}}}function ppe(e){return e.map((t)=>({...t}))}async function mpe(e){let t=await dpe(e),n=await Ht(e.company),r=t.emailSends.map((l)=>Ds(l,{emailSendId:l.id},"emailSend",n)),o=ct({companyId:n});if(e.csv!==void 0){let l=mb(rpe,ppe(r));if(typeof e.csv==="string")await npe(e.csv,`${l}\r
271
+ `)}var rpe=["id","type","recipientEmail","subject","status","eventAt","sentAt","deliveredAt","openedAt","clickedAt","bouncedAt","complainedAt","campaignId","transactionalEmailId","automationNodeId","opened","clicked","url","subscriberId","abTestVariantId"];function ope(e){if(!e.senderEmail&&!e.senderName)return"Unknown";if(!e.senderName)return e.senderEmail??"Unknown";return e.senderEmail?`${e.senderName} <${e.senderEmail}>`:e.senderName}function Df(e,t,n){if(e!==void 0&&!n.includes(e))throw new A(`${t} must be one of: ${n.join(", ")}`,400)}function ipe(e){if(e.all&&e.page!==void 0)throw new A("--all cannot be combined with --page",400);if(e.csv!==void 0&&e.json)throw new A("--csv cannot be combined with --json",400)}function j2(e){Df(e.status,"--status",["pending","sent","delivered","opened","clicked","bounced","complained","failed","suppressed"]),Df(e.emailType,"--email-type",["campaign","transactional","sequence"]),Df(e.bounceType,"--bounce-type",["Permanent","Transient"]),Df(e.sort,"--sort",["recipientEmail","subject","status","eventAt","sentAt","createdAt"]),Df(e.order,"--order",["asc","desc"]);let t=new URLSearchParams,n=[["search",e.search],["subject",e.subject],["recipient",e.recipient],["status",e.status],["emailType",e.emailType],["bounceType",e.bounceType],["campaignId",e.campaign],["transactionalEmailId",e.transactional],["automationId",e.sequence],["automationNodeId",e.automationNodeId],["mailboxProvider",e.mailboxProvider],["listId",e.list],["days",e.days],["page",e.page],["limit",e.limit],["sortField",e.sort],["sortOrder",e.order]];for(let[o,a]of n)if(a!==void 0&&a.trim()!=="")t.set(o,a.trim());let r=t.toString();return r?`?${r}`:""}function spe(e){let t=[e.clickedUrl?`url=${e.clickedUrl}`:null,e.bounceType?`bounce=${yz(e.bounceType)}`:null,e.bounceSubType?`subtype=${bz(e.bounceSubType)}`:null,e.complaintType?`complaint=${e.complaintType}`:null,e.ipAddress?`ip=${e.ipAddress}`:null,e.countryCode?`country=${e.countryCode}`:null].filter((n)=>n!==null);return`${te(e.eventTime)} ${e.eventType}${t.length>0?` (${t.join(", ")})`:""}`}function ape(e){if(e.isCopiedRecipient)return e.primaryEmailSendId?`HTML body: stored on primary email send ${e.primaryEmailSendId}`:"HTML body: unavailable for this copied-recipient delivery record";return"HTML body: unavailable (the email send row may have been cleaned up)"}function cpe(e){return`Reply destination: ${e??"None"}`}function lpe(e,t){let n=e.emailSend,r=ct({companyId:n.companyId,emailSendId:n.id,...n.campaignId?{campaignId:n.campaignId}:{},...n.transactionalEmailId?{transactionalId:n.transactionalEmailId}:{}});if(t.json){D({...e,emailSend:{...n,url:r.urls.emailSend},appUrls:r.urls});return}if(t.htmlOnly){console.log(n.emailBody??"");return}if(console.log(`Email send: ${n.id}`),Ce("URL",r.urls.emailSend),console.log(`Source: ${e.source}`),console.log(`Status: ${n.status}`),console.log(`Source type: ${n.type??"Unknown"}`),console.log(`Delivery policy: ${n.emailType??"Unknown"}`),n.isCopiedRecipient)console.log("Copied recipient: yes"),console.log(`Primary email send: ${n.primaryEmailSendId??"unavailable"}`);if(console.log(`Recipient: ${n.recipientEmail??"Unknown"}`),console.log(`Subject: ${n.subject??"Unknown"}`),console.log(`Sender: ${ope(n)}`),console.log(cpe(n.originalReplyTo)),console.log(`Created: ${te(n.createdAt)}`),console.log(`Sent: ${te(n.sentAt)}`),console.log(`Delivered: ${te(n.deliveredAt)}`),console.log(`Opened: ${te(n.openedAt)}`),console.log(`Clicked: ${te(n.clickedAt)}`),console.log(`Bounced: ${te(n.bouncedAt)}`),console.log(`Complained: ${te(n.complainedAt)}`),n.errorMessage)console.log(`Error: ${n.errorMessage}`);if(e.message)console.log(""),console.log(e.message);if(console.log(""),n.emailBody)if(console.log(`HTML body: ${n.emailBody.length} chars`),t.html)console.log(""),console.log(n.emailBody);else console.log("Run with --html to print the full HTML body.");else console.log(ape(n));if(console.log(""),console.log(`Events (${e.events.length})`),e.events.length===0){console.log(" None");return}for(let o of e.events)console.log(`- ${spe(o)}`)}async function upe(e){if(!e.id)throw new A("Email send ID is required",400);let t=await E("GET",`/api/v1/email-sends/${encodeURIComponent(e.id)}`,void 0,e.company);lpe(t,e)}async function dpe(e){if(ipe(e),!e.all)return E("GET",`/api/v1/email-sends${j2(e)}`,void 0,e.company);let t=e.limit??"100",n=new Map,r=1,o,a=0;while(!0){let c=await E("GET",`/api/v1/email-sends${j2({...e,page:String(r),limit:t})}`,void 0,e.company);o??=c,a=c.pagination.total;for(let l of c.emailSends)if(!n.has(l.id))n.set(l.id,l);if(c.emailSends.length===0||r>=c.pagination.totalPages)break;r+=1}return{...o??{success:!0,retentionDays:14,emailSends:[],pagination:{page:1,limit:Number(t),total:0,totalPages:0}},emailSends:Array.from(n.values()),pagination:{page:1,limit:Number(t),total:Math.max(a,n.size),totalPages:r}}}function ppe(e){return e.map((t)=>({...t}))}async function mpe(e){let t=await dpe(e),n=await Ht(e.company),r=t.emailSends.map((l)=>Ds(l,{emailSendId:l.id},"emailSend",n)),o=ct({companyId:n});if(e.csv!==void 0){let l=mb(rpe,ppe(r));if(typeof e.csv==="string")await npe(e.csv,`${l}\r
272
272
  `,"utf8"),console.log(`Exported ${r.length} sent emails to ${e.csv}`);else console.log(l);return}if(e.json){D({...t,emailSends:r,appUrls:o.urls});return}let{pagination:a}=t;if(console.log(`Sent emails (${a.total} total, page ${a.page}/${Math.max(1,a.totalPages)})`),console.log(`Delivery history retention: ${t.retentionDays} days`),t.emailSends.length===0){console.log("No sent emails matched the filters.");return}for(let l of r)console.log(""),console.log(`- ${l.id} [${l.status}] ${l.subject}`),console.log(` ${l.type} to ${l.recipientEmail} at ${te(l.eventAt)}`),console.log(` opened=${l.opened?"yes":"no"} clicked=${l.clicked?"yes":"no"}`),Ce(" URL",l.url);console.log("");let c=r[0];if(c)console.log(`Next: sequenzy email-sends get ${c.id} # complete event timeline`);if(!e.all)console.log("Export all matches: sequenzy email-sends list --all --csv email-sends.csv");if(e.transactional)console.log(`Template stats: sequenzy stats --transactional ${e.transactional}`)}async function G0(e,t){if(!await z())k(H()),process.exit(1);try{switch(e){case"get":await upe(t);break;case"list":await mpe(t);break}}catch(n){k(n instanceof A?n:n),process.exit(1)}}async function z2(e,t){if(!await z())k(H()),process.exit(1);try{let n=await E("GET",`/api/v1/events/sample?${new URLSearchParams({eventName:e})}`,void 0,t.company);if(t.json){D(n);return}if(!n.sample){console.log(`No previous event found for ${n.eventName}.`);return}console.log(`${n.eventName} received ${n.sample.eventTime} (subscriber ${n.sample.subscriberId})`),console.log(JSON.stringify(n.sample.properties,null,2)),console.log("Copy these properties into sequences test-run --event-properties. Your selected test recipient stays the same.")}catch(n){k(n),process.exit(1)}}var M2=`Only this provider's payload: ${Jj.join(", ")}`;function fpe(e,t){let n=new URLSearchParams,r=e?.trim();if(r)n.set("eventName",r);if(t.provider)n.set("provider",t.provider);let o=n.toString();return`/api/v1/events/schemas${o?`?${o}`:""}`}function H2(e){let t=e.label?` - ${e.label}${e.category?` (${e.category})`:""}`:"";return`${e.eventName}${t}`}function gpe(e){console.log("Documented event payloads"),console.log("");for(let t of e.events)console.log(`- ${H2(t)} [${t.documentedProviders.join(", ")}]`);console.log(""),console.log("Pass an event name for example payloads and property metadata, e.g. `sequenzy events schema ecommerce.order_placed`.")}function Ape(e){let t=Math.max(...e.map((r)=>r.path.length),4),n=Math.max(...e.map((r)=>r.type.length),4);for(let r of e)if(console.log(` ${r.path.padEnd(t)} ${r.type.padEnd(n)} ${r.mergeTag??""}`.trimEnd()),r.description)console.log(` ${" ".repeat(t)} ${r.description}`)}function hpe(e,t){if(console.log(H2(e)),e.description)console.log(e.description);if(!e.documented){console.log(""),console.log("No reference payload is published for this event name.");for(let n of e.notes??[])console.log(n);return}for(let n of e.providers??[])if(console.log(""),console.log(`${n.provider}:`),Ape(n.properties),t.example)console.log(""),console.log(` Example payload (${n.provider}):`),console.log(JSON.stringify(n.examplePayload,null,2));console.log("");for(let n of e.notes??[])console.log(n);if(!t.example)console.log("Add --example to print the full sample payload.")}async function G2(e,t){if(!await z())k(H()),process.exit(1);try{let n=await E("GET",fpe(e,t),void 0,t.company);if(t.json){D(n);return}let[r]=n.events;if(!n.eventName||!r){gpe(n);return}hpe(r,t)}catch(n){k(n instanceof A?n:n),process.exit(1)}}function J2(e){if(!e)return[];return e.split(",").map((t)=>t.trim()).filter((t)=>t.length>0)}function ype(e){let t=[...J2(e.type),...J2(e.eventTypes)],n=[...new Set(t)];return n.length>0?n.join(","):void 0}function V2(e,t){let n=ot(e,t);if(n!==void 0&&n<1)throw new A(`${t} must be a positive integer`,400);return n}function bpe(e){if(e.campaign&&e.sequence)throw new A("Provide either --campaign or --sequence, not both",400);if(!e.campaign&&!e.sequence)throw new A("Provide either --campaign or --sequence",400);if(e.automationNodeId&&!e.sequence)throw new A("--automation-node-id scopes a sequence event stream and requires --sequence",400);let t=new URLSearchParams;if(e.automationNodeId)t.set("automationNodeId",e.automationNodeId);let n=ype(e);if(n)t.set("eventTypes",n);if(e.start||e.end){if(e.start)t.set("start",e.start);if(e.end)t.set("end",e.end)}else if(e.period)t.set("period",e.period);let r=V2(e.page,"--page");if(r!==void 0)t.set("page",String(r));let o=V2(e.limit,"--limit");if(o!==void 0)t.set("limit",String(o));if(e.includeBots)t.set("includeMachineEngagement","true");let a=e.campaign?`/api/v1/metrics/campaigns/${encodeURIComponent(e.campaign)}/events`:`/api/v1/metrics/sequences/${encodeURIComponent(String(e.sequence))}/events`,c=t.toString();return c?`${a}?${c}`:a}function vpe(e){let t=[e.email?`email=${e.email}`:null,e.emailSendId?`send=${e.emailSendId}`:null,e.campaignId?`campaign=${e.campaignId}`:null,e.clickedUrl?`url=${e.clickedUrl}`:null,e.bounceType?`bounce=${e.bounceType}`:null,e.bounceSubType?`subtype=${e.bounceSubType}`:null,e.complaintType?`complaint=${e.complaintType}`:null,e.countryCode?`country=${e.countryCode}`:null].filter((n)=>n!==null);return`${te(e.eventTime)} ${e.eventType}${t.length>0?` (${t.join(", ")})`:""}`}function Epe(e,t){if(t.json){D(e);return}let n=e.campaignId?`Campaign ${e.campaignId}`:`Sequence ${e.sequenceId??"unknown"}`;if(console.log(`${n} events`),t.automationNodeId)console.log(`Step: ${t.automationNodeId}`);if(console.log(`Types: ${(e.eventTypes??["delivery"]).join(", ")}`),console.log(`Page: ${e.pagination.page}/${e.pagination.totalPages||1} (${e.pagination.total.toLocaleString()} total)`),e.events.length===0){console.log("No events found.");return}console.log("");for(let r of e.events)console.log(`- ${vpe(r)}`)}async function K2(e){if(!await z())k(H()),process.exit(1);try{let t=await E("GET",bpe(e),void 0,e.company);Epe(t,e)}catch(t){k(t instanceof A?t:t),process.exit(1)}}var W2=["missing_capability","bug","docs","ux","praise","other"];function Ipe(e){let[t,n,r]=e.split("|").map((o)=>o.trim());if(!t)throw new A(`Invalid --tool-call "${e}". Expected "<tool>" or "<tool> | <args summary>" or "<tool> | <args summary> | <error>"`,400);return{tool:t,...n&&{args:n},...r&&{error:r}}}function Cpe(e,t){if(!e||e.trim()==="")throw new A("Feedback message is required",400);if(t.category!==void 0&&!W2.includes(t.category))throw new A(`Invalid category "${t.category}". Valid categories: ${W2.join(", ")}`,400);return{message:e.trim(),source:"cli",...t.category!==void 0&&{category:t.category},...t.context!==void 0&&{context:t.context},...t.intent!==void 0&&{userIntent:t.intent},...t.expected!==void 0&&{expected:t.expected},...t.actual!==void 0&&{actual:t.actual},...t.toolCall!==void 0&&t.toolCall.length>0&&{toolCalls:t.toolCall.map(Ipe)},...t.resourceId!==void 0&&t.resourceId.length>0&&{resourceIds:t.resourceId}}}async function Y2(e,t){if(!await z())k(H()),process.exit(1);try{let n=Cpe(e,t),r=await E("POST","/api/v1/feedback",n,t.company);if(t.json){D(r);return}console.log(r.message??"Feedback sent. Thank you!")}catch(n){k(n instanceof A?n:n),process.exit(1)}}function Z2(e){let t=e.some((o)=>o.payload.recovery!==void 0),n=[...new Set(e.flatMap((o)=>Object.keys(o.payload.customAttributes)))].sort(),r=(o)=>{let a=o===void 0||o===null?"":typeof o==="string"?o:JSON.stringify(o),c=0;while(c<a.length&&(a.charCodeAt(c)<=32||/\s/.test(a[c]??"")))c+=1;return`"${(/^[=+@-]/.test(a.slice(c))?`'${a}`:a).replaceAll('"','""')}"`};return[["submission_id","submitted_at","email","first_name","last_name","phone",...n.map((o)=>`customAttributes.${o}`),...t?["record_origin","timestamp_meaning","recovered_at"]:[]],...e.map((o)=>[o.id,o.createdAt,o.payload.email,o.payload.firstName,o.payload.lastName,o.payload.phone,...n.map((a)=>o.payload.customAttributes[a]),...t?[o.payload.recovery?"reconstructed":"submission",o.payload.recovery?"event_time":"submission_time",o.payload.recovery?.recoveredAt]:[]])].map((o)=>o.map(r).join(",")).join(`\r
273
273
  `)}function wpe(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Spe(e){if(e.tag!==void 0&&e.clearTags)throw new A("Use either --tag or --clear-tags, not both",400);let t=Fe(e.themeJson,e.themeFile,"theme"),n=Fe(e.blocksJson,e.blocksFile,"blocks");if(t!==void 0&&!wpe(t))throw new A("theme JSON must be an object",400);if(n!==void 0&&!Array.isArray(n))throw new A("blocks JSON must be an array",400);if(e.duplicateStrategy!==void 0&&!["skip","merge","overwrite"].includes(e.duplicateStrategy))throw new A("duplicate strategy must be skip, merge, or overwrite",400);if(e.resubscribeBehavior!==void 0&&!Xy.includes(e.resubscribeBehavior))throw new A("resubscribe behavior must be reactivate or double_opt_in",400);let r={...e.name!==void 0&&{name:e.name},...e.list!==void 0&&{listIds:e.list},...e.tag!==void 0&&{tagIds:e.tag},...e.clearTags&&{tagIds:[]},...e.duplicateStrategy!==void 0&&{duplicateStrategy:e.duplicateStrategy},...e.resubscribeBehavior!==void 0&&{resubscribeBehavior:e.resubscribeBehavior},...e.botProtection!==void 0&&{botProtection:e.botProtection},...e.headline!==void 0&&{headline:e.headline},...e.description!==void 0&&{description:e.description},...e.buttonText!==void 0&&{buttonText:e.buttonText},...e.successMessage!==void 0&&{successMessage:e.successMessage},...e.redirectUrl!==void 0&&{redirectUrl:e.redirectUrl},...t!==void 0&&{theme:t},...n!==void 0&&{blocks:n}};if(Object.keys(r).length===0)throw new A("Provide at least one saved form update option",400);return r}function Dpe(e){console.log(`${e.name} [${e.id}]`),console.log(`Status: ${e.status}`),console.log(`Updated: ${te(e.updatedAt)}`),console.log(`Action URL: ${e.actionUrl}`);let t=tb(e.content);if(t)console.log(t);let n=eb(e.content);if(n)console.log(n);if(e.url)console.log(`URL: ${e.url}`)}async function Bf(e,t){if(!await z())k(H()),process.exit(1);try{if(e==="list"){let o=await E("GET","/api/v1/forms",void 0,t.company);if(t.json){D(o);return}console.log(`Saved forms (${o.forms.length})`);for(let a of o.forms)console.log(`- ${a.name} [${a.id}]`),console.log(` Status: ${a.status}`),console.log(` Updated: ${te(a.updatedAt)}`),console.log(` Action URL: ${a.actionUrl}`);return}if(!t.id)throw new A("Source ID is required",400);if(e==="submissions"){if(t.csv&&t.json)throw new A("Use either --csv or --json",400);let o=new URLSearchParams;for(let l of["cursor","limit","field","value"])if(t[l]!==void 0)o.set(l,t[l]);let a=[],c;do{let l=await E("GET",`/api/v1/submissions/${encodeURIComponent(t.type??"form")}/${encodeURIComponent(t.id)}?${o}`,void 0,t.company);if(!t.csv){if(t.json)D(l);else{for(let p of l.submissions)console.log(`${p.payload.recovery?"[Reconstructed; event time] ":""}${p.createdAt} ${p.payload.email} [${p.id}]
274
274
  ${JSON.stringify(p.payload,null,2)}`);console.log(l.nextCursor?`Next cursor: ${l.nextCursor}`:"End of submissions")}return}if(a.push(...l.submissions),c=l.nextCursor,c)o.set("cursor",c)}while(c);console.log(Z2(a));return}let n=Spe(t),r=await E("PATCH",`/api/v1/forms/${encodeURIComponent(t.id)}`,n,t.company);if(t.json){D(r);return}if(Dpe(r.form),r.message)console.log(r.message)}catch(n){k(n),process.exit(1)}}function Bpe(e){if(e===168)return"7 days";if(e%24===0&&e>=48)return`${e/24} days`;return e===1?"1 hour":`${e} hours`}function xpe(e){if(!e)return"Frequency cap: off";return`Frequency cap: ${e.maxEmails===1?"1 email":`${e.maxEmails} emails`} per ${Bpe(e.windowHours)} per contact`}function X2(e,t,n,r){let o=e===void 0?NaN:Number(e.trim());if(!Number.isInteger(o)||o<n||o>r)throw new A(`${t} must be a whole number from ${n} to ${r}`,400);return o}async function _pe(e,t){if(!await z())k(H()),process.exit(1);try{let n;if(e==="set"){let r={maxEmails:X2(t.maxEmails,"--max-emails",1,50),windowHours:X2(t.windowHours,"--window-hours",1,168)};n=await E("PUT","/api/v1/frequency-cap",r,t.company)}else n=await E(e==="clear"?"DELETE":"GET","/api/v1/frequency-cap",void 0,t.company);if(t.json){D(n);return}if(console.log(xpe(n.frequencyCap)),n.frequencyCap)console.log("Applies to sequences with --respect-frequency-cap. Campaigns count toward it but always send.")}catch(n){k(n),process.exit(1)}}function eM(e,t=_pe){let n=(l)=>l.optsWithGlobals(),r=e.command("frequency-cap").description("Show the company frequency cap for marketing emails").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").allowExcessArguments(!1).action((l,p)=>t("get",n(p)));S(r,{notes:["The cap limits how many marketing emails (campaigns plus marketing sequence emails) one contact gets in a rolling window.","Only sequences with --respect-frequency-cap are capped: an email step is skipped for a contact already at the cap, and the contact moves to the next step. Campaigns count toward the cap but always send. Transactional emails never count and are never skipped."],examples:["sequenzy frequency-cap","sequenzy frequency-cap set --max-emails 1 --window-hours 16","sequenzy frequency-cap clear"]});let o=r.command("get").description("Show the company frequency cap").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((l,p)=>t("get",n(p)));S(o,{examples:["sequenzy frequency-cap get --json"]});let a=r.command("set").description("Set or change the company frequency cap").requiredOption("--max-emails <count>","Most marketing emails one contact may get in the window (1-50)").requiredOption("--window-hours <hours>","Rolling window in hours (1-168)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((l,p)=>t("set",n(p)));S(a,{notes:["Turn it on per sequence with `sequenzy sequences update <id> --respect-frequency-cap`."],examples:["sequenzy frequency-cap set --max-emails 1 --window-hours 16","sequenzy frequency-cap set --max-emails 3 --window-hours 168"]});let c=r.command("clear").description("Turn the company frequency cap off").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((l,p)=>t("clear",n(p)));return S(c,{notes:["Sequences keep their --respect-frequency-cap setting, but nothing is skipped until a cap is set again."],examples:["sequenzy frequency-cap clear"]}),r}var kpe=/^([a-z0-9][a-z0-9-]*)\/([a-z0-9][a-z0-9-]*)$/i;function xf(e,t){let n=e.trim(),r=kpe.exec(n.replace(/\/+$/,""));if(r?.[1]&&r[2])return{brand:r[1].toLowerCase(),[t]:r[2].toLowerCase()};return{url:n}}function Rpe(e){let n=e.split(/[\s,]+/).filter(Boolean).map((r)=>/^\d+$/.test(r)?Number(r):NaN);if(n.length===0||n.some((r)=>!(r>=1)))throw new A("--steps must be email numbers from the example, like 1,2,4",400);return n}function Qpe(e,t){let n=Math.round(e/3600000);if(n<=0)return t?"right away":"same time";let r=n<24?`${n} hour${n===1?"":"s"}`:`${Math.round(n/24)} day${Math.round(n/24)===1?"":"s"}`;return t?`after ${r}`:`${r} later`}async function tM(){if(!await z())k(H()),process.exit(1)}function nM(e){return{...e.brief?{brief:e.brief}:{},...e.name?{name:e.name}:{}}}async function rM(e,t){await tM();try{let n=await E("POST","/api/v1/templates/from-example",{...xf(e,"email"),...nM(t)},t.company),r=await Ht(t.company),o=r?ct({companyId:r,emailId:n.template.id}).urls.email:void 0;if(t.json){D({...n,template:{...n.template,...o?{url:o}:{}}});return}if(console.log(`Created template: ${n.template.name}`),console.log(`ID: ${n.template.id}`),console.log(`Subject: ${n.template.subject??"(none)"}`),Ce("URL",o),console.log(`Modeled on: ${n.example.brand} (${n.example.url})`),n.message)console.log(n.message)}catch(n){k(n),process.exit(1)}}async function oM(e,t){await tM();try{let n=t.steps===void 0?void 0:Rpe(t.steps),r=await E("POST","/api/v1/sequences/from-example",{...xf(e,"sequence"),...nM(t),...t.emailStyle?{emailStyle:t.emailStyle}:{},...n?{stepNumbers:n}:{}},t.company),o=await Ht(t.company),a=o?ct({companyId:o,sequenceId:r.sequence.id}).urls.sequence:void 0;if(t.json){D({...r,sequence:{...r.sequence,...a?{url:a}:{}}});return}let{sequence:c}=r;if(console.log(`Created sequence: ${c.name}`),console.log(`ID: ${c.id}`),Ce("URL",a),console.log(`Status: ${c.status}`),console.log(`Starts: ${c.triggerDescription}`),console.log(c.enrichmentStatus==="processing"?`Emails: ${c.emailCount} (AI is writing them now)`:`Emails: ${c.emailCount} (writing has not started)`),c.steps.forEach((l,p)=>{console.log(` ${l.stepNumber}. ${l.title} - ${Qpe(l.delayMs,p===0)} (day ${l.originalDay} in the original)`)}),console.log(`Modeled on: ${r.example.name} by ${r.example.brand} (${r.example.url})`),r.example.omittedEmailCount>0)console.log(n?`Cloned emails ${(r.example.stepNumbers??n).join(", ")} of the original; ${r.example.omittedEmailCount} were left out.`:`The original has ${r.example.omittedEmailCount} more emails that were not cloned. Pick others with --steps.`);if(c.enrichmentStatus==="processing")console.log(`Check progress with: sequenzy sequences get ${c.id}`);else if(r.message)console.log(r.message)}catch(n){k(n),process.exit(1)}}function iM(e){return{...e.website?{website:e.website}:{},...e.brief?{brief:e.brief}:{}}}function sM(e){return e.website?`Written for ${e.brandName} (${e.website})`:`Written for ${e.brandName}`}async function aM(){if(!await z())k(H()),process.exit(1)}async function cM(e,t){await aM();try{let n=await E("POST","/api/v1/templates/from-example/preview",{...xf(e,"email"),...iM(t)},t.company);if(t.json){D(n);return}let{preview:r}=n;console.log(`Preview (nothing saved). ${sM(r)}`),console.log(`Subject: ${r.subject}`),console.log(`Preview text: ${r.previewText}`),console.log(`Modeled on: ${n.example.brand} (${n.example.url})`),console.log(`Use --json for the HTML. Save it with: sequenzy templates from-example ${e}`)}catch(n){k(n),process.exit(1)}}async function lM(e,t){await aM();try{let n=await E("POST","/api/v1/sequences/from-example/preview",{...xf(e,"sequence"),...iM(t)},t.company);if(t.json){D(n);return}let{preview:r}=n;console.log(`Preview (nothing saved). ${sM(r)}`);for(let o of r.emails)console.log(` ${o.stepNumber}. Day ${o.day}: ${o.subject}`);if(r.failedEmailCount>0)console.log(`${r.failedEmailCount} of the first emails could not be written this time.`);if(r.remainingEmailCount>0)console.log(`The example has ${r.remainingEmailCount} more emails; cloning writes them all.`);console.log(`Modeled on: ${n.example.name} by ${n.example.brand} (${n.example.url})`),console.log(`Use --json for the HTML. Clone it with: sequenzy sequences from-example ${e}`)}catch(n){k(n),process.exit(1)}}function tp(e,t={}){let n=t.json??ky()?JSON.stringify({type:t.type??"warning",message:e,...t.requestKey!==void 0?{requestKey:t.requestKey}:{}}):e;if(t.warn)console.warn(n);else console.error(n)}var uM=10,dM=80;function Tpe(e){if(e.length<=dM)return e;return`${e.slice(0,dM-3).trimEnd()}...`}function fb(e,t){let n=ot(e,t);if(n!==void 0&&n<1)throw new A(`${t} must be greater than 0`,400);return n}function $pe(e,t){return{prompt:$n(e,"Prompt").trim(),...t.style!==void 0&&{style:t.style},...t.tone!==void 0&&{tone:t.tone}}}function Npe(e,t){let n=fb(t.count,"--count"),r=fb(t.days,"--days");if(n!==void 0&&n>uM)throw new A(`--count must be no more than ${uM}`,400);let o=$n(e,"Goal").trim().replace(/\s+/g," ");return{name:t.name?.trim()||Tpe(o),goal:o,trigger:"contact_added",...t.listId!==void 0&&{listId:t.listId},...n!==void 0&&{emailCount:n},...r!==void 0&&{durationDays:r}}}function Ope(e,t){let n=fb(t.count,"--count");return{topic:$n(e,"Topic").trim(),...n!==void 0&&{count:n}}}var pM=10;function Ppe(e,t){let n=fb(t.count,"--count");if(n!==void 0&&n>pM)throw new A(`--count must be no more than ${pM}`,400);return{prompt:$n(e,"Prompt").trim(),...n!==void 0&&{count:n}}}function Fpe(e){if(e.subject)console.log(`Subject: ${e.subject}`);if(e.previewText)console.log(`Preview: ${e.previewText}`);if(e.subject||e.previewText)console.log();if(Array.isArray(e.blocks)&&e.blocks.length>0){console.log(JSON.stringify({blocks:e.blocks},null,2));return}if(e.html)console.log(e.html)}function qpe(e){if(console.log(`Created disabled sequence draft: ${e.sequence.name}`),console.log(`ID: ${e.sequence.id}`),console.log(`Status: ${e.sequence.status}`),console.log(`Emails: ${e.sequence.emailCount}`),console.log(`AI generation: ${e.sequence.enrichmentStatus}`),e.message)console.log(e.message)}function Lpe(e){console.log(`Subject lines for: ${e.topic}`),e.subjects.forEach((t,n)=>{console.log(`${n+1}. ${t}`)})}function Upe(e){console.log(`SMS messages for: ${e.prompt}`),e.messages.forEach((t,n)=>{console.log(),console.log(`${n+1}. ${t.text}`),console.log(` ${t.characterCount} chars, ${t.segments} segment${t.segments===1?"":"s"} (${t.encoding})`)})}async function _f(e,t){if(!await z())k(H()),process.exit(1);try{if(e==="email"){let r=await E("POST","/api/v1/generate/email",$pe(t.prompt??"",t),t.company);if(t.json){D(r);return}Fpe(r);return}if(e==="sequence"){tp("Deprecated: `sequenzy generate sequence` is an alias. Use `sequenzy sequences create <name> --trigger contact_added --goal <goal>`.",{json:t.json});let o={...await E("POST","/api/v1/sequences",Npe(t.goal??"",t),t.company),deprecated:!0,deprecationMessage:"`sequenzy generate sequence` is deprecated. Use `sequenzy sequences create` for new scripts."};if(t.json){D(o);return}qpe(o);return}if(e==="sms"){let r=await E("POST","/api/v1/generate/sms",Ppe(t.prompt??"",t),t.company);if(t.json){D(r);return}Upe(r);return}let n=await E("POST","/api/v1/generate/subjects",Ope(t.topic??"",t),t.company);if(t.json){D(n);return}Lpe(n)}catch(n){k(n instanceof A?n:n),process.exit(1)}}var jpe=["message","card"],zpe=["open","all"],Mpe=["displayed","clicked","dismissed","read"];function Hpe(e){let t=new URLSearchParams;for(let[r,o]of Object.entries(e))if(o!==void 0&&o!=="")t.set(r,o);let n=t.toString();return n?`?${n}`:""}function J0(e,t,n){if(e===void 0)return;if(!t.includes(e))throw Error(`${n} must be one of: ${t.join(", ")}`);return e}function Gpe(e){if(e.dismissedAt)return"dismissed";if(e.expiresAt&&Date.parse(e.expiresAt)<=Date.now())return"expired";if(e.clickedAt)return"clicked";if(e.kind==="message"&&e.displayedAt)return"shown";if(e.kind==="card")return e.readAt?"read":"unread";return"waiting"}function Jpe(e){if(!e.email&&!e.externalId&&!e.subscriberId)throw Error("Provide --email, --external-id or --subscriber-id to choose the contact.");return`/api/v1/in-app/messages${Hpe({email:e.email,externalId:e.externalId,subscriberId:e.subscriberId,kind:J0(e.kind,jpe,"--kind"),status:J0(e.status,zpe,"--status"),limit:e.limit})}`}async function Vpe(e,t){let n=t.company,r=(o,a)=>{if(t.json)D(o);else a()};switch(e){case"list":{let o=await E("GET",Jpe(t),void 0,n);return r(o,()=>{if(o.messages.length===0){console.log(o.status==="all"?"This contact has no in-app messages or cards.":"Nothing waiting in this contact's in-app feed.");return}for(let a of o.messages){let c=a.kind==="card"?`card${a.pinned?" (pinned)":""}`:`${a.format??"modal"} message`;console.log(`${a.id} ${c} ${Gpe(a)} ${a.title||a.body.slice(0,60)||"(no text)"} created ${a.createdAt}`)}})}case"event":{let o=$n(t.messageId??"","Message ID").trim(),a=J0($n(t.type??"","--type").trim(),Mpe,"--type"),c=await E("POST",`/api/v1/in-app/messages/${encodeURIComponent(o)}/events`,{type:a},n);return r(c,()=>console.log(c.recorded?`Recorded ${a}.`:a==="clicked"?"Recorded another click; the first-click timestamp is unchanged.":`Already recorded ${a}; nothing changed.`))}case"delete":{let o=$n(t.messageId??"","Message ID").trim();if(!await mt(`Delete in-app item ${o}? The contact's app stops showing it.`,t)){console.log("Aborted.");return}let a=await E("DELETE",`/api/v1/in-app/messages/${encodeURIComponent(o)}`,void 0,n);return r(a,()=>console.log(a.message))}case"stats":{let o=$n(t.stepId??"","Step ID").trim(),a=await E("GET",`/api/v1/in-app/steps/${encodeURIComponent(o)}/stats`,void 0,n);return r(a,()=>{let{stats:c}=a;console.log(`Created ${c.created}, displayed ${c.displayed}, clicked ${c.clicked}, dismissed ${c.dismissed}`)})}}}async function kf(e,t){if(!await z())k(H()),process.exit(1);try{await Vpe(e,t)}catch(n){k(n),process.exit(1)}}import{readFileSync as Kpe,statSync as Wpe}from"node:fs";import{basename as Ype}from"node:path";var mM=10,Zpe=15728640;function Xpe(e){if(!e||e.length===0)return[];if(e.length>mM)throw new A(`Attach at most ${mM} files with --attach`,400);let t=0;return e.map((n)=>{let r;try{r=Wpe(n).size}catch{throw new A(`Attachment not found: ${n}`,400)}if(t+=r,t>Zpe)throw new A("Attachments can total at most 15 MB",400);return{filename:Ype(n),content:Kpe(n).toString("base64")}})}var eme=new Set(["open","closed","all"]),fM=100;function gM(e){let t=Array.from(new Set((e.conversationIds??(e.conversationId===void 0?[]:[e.conversationId])).map((n)=>n.trim()).filter((n)=>n!=="")));if(t.length===0)throw new A("Conversation ID is required",400);if(t.length>fM)throw new A(`Pass at most ${fM} conversation IDs at a time`,400);return t}function tme(e){let t=new URLSearchParams;if(e.status!==void 0){if(!eme.has(e.status))throw new A("--status must be one of: open, closed, all",400);t.set("status",e.status)}if(e.search!==void 0&&e.search.trim()!=="")t.set("search",e.search);if(e.unread===!0)t.set("unread","true");if(e.spam===!0)t.set("spam","true");if(e.sentTo!==void 0){let o=e.sentTo.trim().toLowerCase();if(!o.includes("@"))throw new A("--sent-to must be an email address",400);t.set("recipient",o)}let n=ot(e.page,"--page");if(n!==void 0){if(n<1)throw new A("--page must be a positive integer",400);t.set("page",String(n))}let r=ot(e.limit,"--limit");if(r!==void 0){if(r<1||r>100)throw new A("--limit must be an integer between 1 and 100",400);t.set("limit",String(r))}return t}function nme(e){let t=kn(void 0,e.htmlFile,"html"),n=e.text!==void 0&&e.text.trim()!==""?e.text:void 0;if(n===void 0&&t===void 0)throw new A("Provide a message body with --text or --html-file",400);let r=e.senderProfileId?.trim();if(e.senderProfileId!==void 0&&!r)throw new A("--sender-profile-id cannot be empty",400);if(r!==void 0&&e.note===!0)throw new A("--sender-profile-id applies to emailed replies, not --note",400);let o=Xpe(e.attach);return{type:e.note===!0?"note":"outbound",...e.subject!==void 0&&{subject:e.subject},...n!==void 0&&{bodyText:n},...t!==void 0&&{bodyHtml:t},...r!==void 0&&{senderProfileId:r},...o.length>0&&{attachments:o}}}function rme(e){if(e.reset){if(e.localPart!==void 0||e.domain!==void 0)throw new A("--reset cannot be combined with --local-part or --domain",400);return{localPart:null,domain:null}}if(e.localPart===void 0&&e.domain===void 0)return null;let t=e.localPart?.trim(),n=e.domain?.trim();if(!t||!n)throw new A("Pass both --local-part and --domain",400);return{localPart:t,domain:n}}function ome(e){let t=e.to?.trim();if(!t)throw new A("Provide the address to forward to with --to",400);let n=e.senderProfileId?.trim();if(e.senderProfileId!==void 0&&!n)throw new A("--sender-profile-id cannot be empty",400);return{to:t,...n!==void 0&&{senderProfileId:n}}}function ime(e){let t=e.hasUnread?" unread":"",n=e.spam?" spam":"";console.log(`- [${e.status}]${t}${n} ${e.subject??"(no subject)"} [${e.id}]`);let r=e.subscriberName?`${e.subscriberName} <${e.subscriberEmail??"unknown"}>`:e.subscriberEmail??"Unknown";if(console.log(` From: ${r}`),console.log(` Messages: ${e.messageCount}`),e.lastMessageAt)console.log(` Last message: ${te(e.lastMessageAt)} (by ${e.lastMessageBy??"unknown"})`);if(e.lastMessagePreview){let o=e.lastMessagePreview.type==="outbound"?"Team":"Subscriber";console.log(` Last reply: ${o}: ${e.lastMessagePreview.text}`)}if(e.recipientAddress)console.log(` Sent to: ${e.recipientAddress}`);if(e.context.label)console.log(` Context: ${e.context.type} (${e.context.label})`)}function sme(e){let t=e.isRead?"":" unread";if(console.log(`- [${e.type}]${t} ${te(e.createdAt)} [${e.id}]`),e.fromEmail)console.log(` From: ${e.fromName?`${e.fromName} <${e.fromEmail}>`:e.fromEmail}`);if(e.subject)console.log(` Subject: ${e.subject}`);if(e.deliveryStatus)console.log(` Delivery: ${e.deliveryStatus}`);if(e.bodyText)console.log(` ${e.bodyText.split(`
@@ -337,4 +337,4 @@ ${hV}Quick Start${ko}
337
337
  ${_a}$${ko} sequenzy websites guide --framework nextjs --use-case transactional`,c=`
338
338
  ${hV}Notes${ko}
339
339
  ${_a}Generated content should be reviewed before sending.${ko}
340
- ${_a}Use 'sequenzy --help' and '<command> --help' for detailed examples and caveats.${ko}`;console.log(n),console.log(r),console.log(),console.log(o),console.log(a),console.log(c),console.log()}var Je=new aQ;b1(Je);Je.name("sequenzy").description("Sequenzy CLI - Email marketing from the terminal").version(bV).showHelpAfterError().showSuggestionAfterError().action(Vve);S(Je,{notes:["Use --json on data commands when another tool or agent should parse structured output.","Dashboard-aware JSON responses include appUrls when a company ID can be resolved.","Company-scoped commands accept --company for personal API keys that can access multiple companies.","Content commands prefer file flags such as --html-file, --blocks-file, --steps-file, and --emails-file to avoid shell escaping issues.","Sequence creation supports --goal for AI generation or explicit step JSON."],examples:['sequenzy templates create welcome --subject "Welcome" --html-file ./welcome.html','sequenzy campaigns update camp_123 --subject "Updated subject" --html-file ./campaign.html',"sequenzy sequences create onboarding --trigger contact_added --list-id list_123 --steps-file ./steps.json","sequenzy urls --company comp_123 --sequence seq_123 --settings-tab integrations","sequenzy websites guide --framework nextjs --use-case transactional",'sequenzy api-keys create --name "CI deploy key" --company comp_123']});var Kve=Je.command("login").description("Log in to your Sequenzy account").action(UM);S(Kve,{notes:["Starts device authentication and prints a verification URL plus approval code."],examples:["sequenzy login"]});var Wve=Je.command("logout").description("Log out of your Sequenzy account").action(jM);S(Wve,{examples:["sequenzy logout"]});var Yve=Je.command("whoami").description("Show the locally stored Sequenzy identity").action(gV);S(Yve,{notes:["This checks local CLI credential state only. Use 'sequenzy account' to make a live request and verify the active key, permissions, and company access."],examples:["sequenzy whoami"]});var Zve=Je.command("stats").description("Show account, campaign, sequence, or transactional email metrics").option("-p, --period <period>","Time period (7d, 30d, 90d)").option("--start <iso>","Start of custom time range (ISO 8601)").option("--end <iso>","End of custom time range (ISO 8601)").option("--campaign <id>","Get stats for a specific campaign").option("--sequence <id>","Get stats for a specific sequence").option("--transactional <id-or-slug>","Get stats for a saved transactional email").option("--email-type <type>","Filter account stats by campaign, transactional, or sequence").option("--emails","List per-email metrics: one row per campaign and per sequence email step").option("--clients","Show mail client and device shares of unique opens (account or --campaign)").option("--links","Show clicks per link destination across every email in the account").option("--step <number>","With --emails, keep only this 1-based sequence email step").option("--sort <field>","With --emails, sort by sent, delivered, opened, clicked, openRate, clickRate, unsubscribed, conversions, revenue, step, or name").option("--order <order>","With --emails, sort order: asc or desc").option("--page <number>","With --emails, page number").option("--limit <number>","With --emails, emails per page (maximum 500); with --links, links to show (maximum 50)").option("--mailbox-provider <provider>","Filter by recipient mailbox provider (gmail, microsoft, yahoo, ...)").option("--include-bots","Include machine-classified bot/scanner opens and clicks").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON, including poll and NPS results").action(S4);S(Zve,{notes:["Use exactly one of account-level stats, --campaign, --sequence, or --transactional. --email-type applies only to account-level stats.","--mailbox-provider scopes account or campaign engagement metrics to one recipient mailbox provider (e.g. gmail, microsoft, yahoo); replies, conversions, and revenue cannot be segmented per provider and report 0 under this filter.","Saved transactional email stats are all-time by default; pass --period for a window.","Use --email-type transactional for Send API open and click rates; use 'email-sends get <id>' for one delivery.","Bot/scanner opens and clicks are excluded by default; pass --include-bots to inspect raw engagement.","Sequence stats include per-step sent/delivered/opened/clicked counts, a live active/waiting enrollment breakdown by current node, and per-step failures.","--emails lists one row per campaign and per sequence email step, with totals across every matching email. Combine with --sequence (comma-separated) and --step to answer questions like 'how many step-4 emails went out across these sequences'.","--emails counts come from the retained event stream, so they are not limited to the 14-day `email-sends list` history. Omit --period for all-time totals.","Campaign stats include a Poll & NPS Results section when the email collected answers; use --json for the full polls array.","--clients shows which mail clients and devices opened your emails, as shares of unique opens (each send counts once, by its first open). Gmail, Yahoo, and Apple Mail privacy proxies hide the device. With --campaign it covers the whole campaign; account-level stats default to 90 days.","--links ranks link destinations by clicks across every email (default 90 days, top 10). Query strings, fragments and trailing slashes are ignored, so UTM-tagged variants of a page count as one link. For one campaign's links, read clickedLinks from 'stats --campaign <id> --json'."],examples:["sequenzy stats","sequenzy stats --period 30d","sequenzy stats --emails --step 4","sequenzy stats --emails --sequence seq_1,seq_2 --step 4 --json","sequenzy stats --emails --email-type sequence --sort openRate --limit 20","sequenzy stats --campaign camp_123","sequenzy stats --campaign camp_123 --json","sequenzy stats --campaign camp_123 --include-bots","sequenzy stats --sequence seq_123","sequenzy stats --transactional password-reset","sequenzy stats --transactional password-reset --period 30d","sequenzy stats --email-type transactional --period 30d","sequenzy stats --mailbox-provider gmail --period 30d","sequenzy stats --campaign camp_123 --mailbox-provider yahoo","sequenzy stats --clients --period 30d","sequenzy stats --clients --campaign camp_123 --json","sequenzy stats --links --period 30d","sequenzy stats --links --email-type campaign --limit 25 --json"]});var qB=Je.command("events").description("List raw campaign or sequence email events, or read event payload schemas").option("--campaign <id>","List events for a campaign").option("--sequence <id>","List events for a sequence").option("--automation-node-id <id>","Scope a --sequence stream to one email step").option("--type <type>","Single event type to include, such as delivery, open, or click").option("--event-types <types>","Comma-separated event types to include (default: delivery)").option("-p, --period <period>","Time period (1h, 24h, 7d, 30d, 90d)").option("--start <iso>","Start of custom time range (ISO 8601)").option("--end <iso>","End of custom time range (ISO 8601)").option("--page <number>","Page number").option("--limit <number>","Events per page, capped by the API").option("--include-bots","Include machine-classified bot/scanner opens and clicks").option("-c, --company <id>","Company ID").option("--json","Print JSON").action(K2);S(qB,{notes:["Use exactly one of --campaign or --sequence.","Defaults to delivery events. Use --event-types delivery,open,click when you need engagement events too.","--automation-node-id narrows a sequence stream to one email step; take the node ID from `stats --sequence <id>`.","This is the per-recipient stream. For per-step send totals use `stats --sequence <id>` or `stats --emails`, not a count of these pages.","Bot/scanner opens and clicks are excluded by default; pass --include-bots to inspect raw engagement."],examples:["sequenzy events --campaign camp_123","sequenzy events --sequence seq_123 --limit 100 --json","sequenzy events --sequence seq_123 --automation-node-id node_email_4","sequenzy events --campaign camp_123 --event-types delivery,click --period 30d","sequenzy events schema ecommerce.order_placed"]});qB.command("sample <event>").description("Read the latest received event payload in this workspace").option("-c, --company <id>","Company ID").option("--json","Print JSON").action((e,t)=>z2(e,t));var Xve=qB.command("schema [event]").description("Show the published payload of a built-in event, or list documented events").option("--provider <provider>",M2).option("--example","Print the full sample payload as JSON").option("-c, --company <id>","Company ID").option("--json","Print JSON").action((e,t)=>G2(e,t));S(Xve,{notes:["Read this before writing {{event.*}} merge tags or event property filters: an unrecognized merge tag renders as an empty string rather than an error.","Fields ending in Cents are minor units (8850 = $88.50); price is a preformatted display string, and predictedLtv is whole currency units.","Custom event names are supported everywhere even though they have no published payload here - `documented: false` never means the name is invalid.","This is static reference data. Use `sequenzy events sample <event>` to read the latest actual received payload."],examples:["sequenzy events schema","sequenzy events schema ecommerce.order_placed --provider shopify","sequenzy events schema ecommerce.browse_abandoned --example","sequenzy events schema ecommerce.cart_abandoned --json"]});var vV=Je.command("blocks [type]").description("Show the fields each email block type accepts, or list every block type").option("--creatable-only","Hide structural block types the editor manages for you").option("--example","Print the example block as formatted JSON").option("--conditions","Also print the condition field, operator, and value table for this block type").option("-c, --company <id>","Company ID").option("--json","Print JSON").action((e,t)=>O2(e,t));vV.command("preview-cart").description("Suggest cart fields and generate preview-only scenarios without saving or sending").option("--items <json>","JSON array of actual event items").option("--items-file <path>","Read event items from a JSON file").option("--fields <json>","Existing itemFields mapping").option("--price-unit <unit>","Numeric price units: minor or major").option("--scenario <name>","real, one, many, empty, missing-images, or long-names","real").option("-c, --company <id>","Company ID").option("--json","Print JSON").action(w2);S(vV,{notes:["Read this before hand-authoring a blocks array: the blocks parameter accepts a 37-type union, so field names are not guessable from the endpoint schema alone.",'Lists are their own block type, not a text variant. A numbered list is {"type":"list","variant":"numbered","items":[{"content":"First"}]}; a visual numbered walkthrough is {"type":"steps","variant":"numbered","items":[{"title":"Step one"},{"title":"Step two"}]}.',"`list` items carry `content`; `steps` items carry `title` and an optional `description`. The two are not interchangeable.","Every block also takes a `conditions` array, and each condition field accepts only its own operators. `blocks conditional-group` prints that table unprompted; any other type takes --conditions, since it is longer than the block reference itself.","This is static reference data derived from the same schemas that validate a write, so it cannot drift from what the API accepts."],examples:["sequenzy blocks","sequenzy blocks --creatable-only","sequenzy blocks list","sequenzy blocks steps --example","sequenzy blocks hero --json","sequenzy blocks conditional-group","sequenzy blocks text --conditions"]});var eEe=Je.command("poll-responses").description("List individual Poll and NPS responses for a campaign").option("--campaign <id>","Campaign ID (required)").option("--block-id <id>","Scope to one poll block").option("--page <number>","Page number").option("--limit <number>","Responses per page (maximum 500)").option("-c, --company <id>","Company ID").option("--json","Print JSON").action(VM);S(eEe,{notes:["Returns each respondent's latest answer per poll block with the response time, so counts match `stats --campaign <id>`.","Block IDs come from the polls array of `stats --campaign <id> --json`.","For a sequence email step, pass the step's automation node ID as --campaign.","Do not scan subscribers for the poll attribute instead: the attribute carries no response time and reflects the latest answer to any email."],examples:["sequenzy poll-responses --campaign camp_123","sequenzy poll-responses --campaign camp_123 --block-id poll_1 --json","sequenzy poll-responses --campaign camp_123 --limit 500 --page 2"]});var tEe=Je.command("urls").description("Generate Sequenzy dashboard URLs for known resource IDs").option("-c, --company <id>","Company ID").option("--campaign <id>","Campaign ID for campaign editor URL").option("--landing-page <id>","Landing page ID for landing page editor URL").option("--sequence <id>","Sequence ID for sequence editor URL").option("--template <id>","Template/email ID for email editor URL").option("--email <id>","Email ID for email editor URL").option("--transactional <id>","Transactional email ID").option("--email-send <id>","Email send ID").option("--domain <id>","Sending domain ID").option("--status <status>","Status for campaign/sequence list URLs").option("--settings-tab <tab>","Settings tab slug; billing/subscription opens Account -> Subscription").option("--json","Print JSON").action(Uz);S(tEe,{notes:["Uses SEQUENZY_APP_URL when set, otherwise https://sequenzy.com.","If --company is omitted, the CLI tries the current company from `sequenzy account`.","Useful after creating a campaign or sequence when the user wants a review/edit link."],examples:["sequenzy urls --company comp_123","sequenzy urls --company comp_123 --sequence seq_123","sequenzy urls --company comp_123 --campaign camp_123","sequenzy urls --company comp_123 --landing-page lp_123","sequenzy urls --company comp_123 --email-send send_123","sequenzy urls --company comp_123 --settings-tab integrations","sequenzy urls --company comp_123 --settings-tab billing","sequenzy urls --company comp_123 --json"]});var Ko=Je.command("subscribers").description("Manage subscribers").action(()=>Ko.help());S(Ko,{notes:["Subscriber list fetches every page by default so agents do not silently miss later results.","`subscribers get` includes tags, list memberships, sequence enrollments, email stats, and recent activity.","--attr expects repeated key=value pairs. Example: --attr firstName=Ana --attr plan=pro","--attr sends strings. Use --attrs-json on add and update for numbers, booleans, lists, or strings with leading zeros such as zip codes. `subscribers attributes` lists the names and types already in use."],examples:["sequenzy subscribers list --tag vip",'sequenzy subscribers list --list "Master List" --json',"sequenzy subscribers list --tag vip --limit 25 --json","sequenzy subscribers add user@example.com --tag trial --attr firstName=Ana","sequenzy subscribers attributes","sequenzy subscribers import copper-contacts.csv --list list_123 --opt-in-mode confirmed","sequenzy subscribers import-status import_123 --json","sequenzy subscribers get user@example.com --json",'sequenzy subscribers notes add user@example.com --body "Customer prefers quarterly reports"',"sequenzy subscribers remove user@example.com --hard"]});var LB=Ko.command("operations").description("Run and monitor background audience tagging");LB.command("start").requiredOption("--kind <kind>","add_tags").option("--audience-json <json>","Audience filters or subscriberIds as JSON (supports @file)").option("--tag <tags...>","Tags to add").option("--trigger-automations","Trigger tag automations (requires automations:trigger)").option("--request-key <key>","Idempotency key; reuse after an uncertain start response").option("-c, --company <id>","Company ID").option("--json","Print JSON").action((e)=>bv("start",e));LB.command("list").option("-c, --company <id>").option("--json").action((e)=>bv("list",e));for(let e of["get","cancel"])LB.command(`${e} <id>`).option("-c, --company <id>").option("--json").action((t,n)=>bv(e,{...n,id:t}));var nEe=Ko.command("list").description("List subscribers").option("-s, --segment <id>","Filter by segment").option("-t, --tag <tag>","Filter by tag").option("--list <id-or-name>","Filter by subscriber list ID or exact name").option("--status <status>","active, unsubscribed, bounced, or all").option("--unsubscribed-after <date>","Only contacts whose opt-out is on or after this ISO 8601 date or zoned datetime").option("--unsubscribed-before <date>","Only contacts whose opt-out is on or before this ISO 8601 date or zoned datetime").option("--attribute <name>",'Filter by custom attribute name, e.g. "plan". The "name:value" form also works').option("--attribute-value <value>","Value the custom attribute must match").option("--attribute-operator <operator>","is, contains, gt, gte, lt, lte, or is_not_empty (default: is)").option("-l, --limit <number>","Maximum results to return").option("--offset <number>","Matches to skip (maximum 999999; use --cursor for deeper pagination)").option("--page <number>","1-based page number; requires --limit").option("--cursor <token>","pagination.nextCursor from the previous response; cheaper than --offset").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>pi("list",e));S(nEe,{notes:["Without --limit the command walks every page and returns all matches in one call.","With --limit, page through the audience by re-running with --cursor set to the previous response's pagination.nextCursor. Fall back to --offset (or --page) when nextCursor is null.","--attribute filters on ClickHouse-backed custom attributes and cannot be combined with --segment. Use a saved segment for compound or is_not/is_empty attribute filters.","--unsubscribed-after/--unsubscribed-before match the opt-out date and exclude contacts that have none: active contacts, and contacts imported as already unsubscribed. Bare dates use UTC midnight; datetimes must include Z or an explicit offset."],examples:["sequenzy subscribers list",'sequenzy subscribers list --list "Master List"',"sequenzy subscribers list --segment seg_123","sequenzy subscribers list --tag onboarding --limit 100","sequenzy subscribers list --status unsubscribed --unsubscribed-after 2026-07-01 --json","sequenzy subscribers list --limit 50 --json","sequenzy subscribers list --limit 50 --cursor NEXT_CURSOR --json","sequenzy subscribers list --limit 50 --offset 50 --json","sequenzy subscribers list --attribute plan --attribute-value pro","sequenzy subscribers list --attribute mrr --attribute-value 50 --attribute-operator gte","sequenzy subscribers list --attribute prem_rouge_sample_received --attribute-operator is_not_empty --json"]});var rEe=Ko.command("add [email]").description("Add or upsert a subscriber").option("--external-id <id>","Customer-owned subscriber ID").option("--phone <phone>","Phone number (E.164 or national). With no email, creates a phone-only SMS contact").option("--phone-country <country>","Two-letter country used to read a national-format --phone (default US)").option("--sms-consent","Record express written SMS marketing consent for the phone number").option("--first-name <name>","Subscriber first name").option("--last-name <name>","Subscriber last name").option("--timezone <zone>","IANA timezone (e.g. America/New_York) used for recipient-local campaign delivery").option("-t, --tag <tags...>","Tags to apply").option("-l, --list <ids...>","List IDs to add the subscriber to").option("--no-lists","Add the subscriber to no lists").option("--skip-sequences","Do not enroll the subscriber in matching sequences").option("--enroll-sequences","Enroll matching sequences, including when --created-at is supplied (requires automations:trigger)").option("-a, --attr <attrs...>","Attributes (key=value)").option("--attrs-json <json>",`Attributes as a JSON object that keeps value types, e.g. '{"zip":"02134","seats":5}'`).option("--created-at <iso-date>","Original signup date when importing history from another platform (only ever moves an existing contact's date earlier; skips sequences unless --enroll-sequences is passed)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>pi("add",{email:e,...t,noLists:t.lists===!1}));S(rEe,{examples:["sequenzy subscribers add user@example.com","sequenzy subscribers add user@example.com --first-name Ana --tag trial --attr plan=pro",`sequenzy subscribers add user@example.com --attrs-json '{"zip":"02134","seats":5,"vip":true}'`,"sequenzy subscribers add user@example.com --list list_123","sequenzy subscribers add user@example.com --skip-sequences","sequenzy subscribers add user@example.com --created-at 2019-03-14T09:30:00Z","sequenzy subscribers add user@example.com --created-at 2019-03-14T09:30:00Z --enroll-sequences","sequenzy subscribers add --phone '+14155550123' --sms-consent"],notes:["--attr values are always sent as strings. Use --attrs-json for numbers, booleans and lists, or to keep a value such as a zip code as a quoted string. When both set the same key, --attr wins. Run `sequenzy subscribers attributes` to see the names and types your other contacts use.","--created-at preserves a contact's real signup date so date-relative segments are correct right after a migration. It never moves an existing contact's date later, and it suppresses sequence enrollment by default because it describes the past, not a signup happening now. Pass --enroll-sequences to opt in explicitly. New-subscriber account notifications remain eligible when the signup date is at most one hour old; older dates do not notify on creation. Double opt-in confirmation can notify even for imported contacts. Your notification preferences, double opt-in and the daily cap still apply."]});var oEe=Ko.command("import [file]").description("Queue a full-record subscriber import from CSV or JSON").option("--records-json <json>","Inline JSON array (alternative to a CSV/JSON file)").option("--duplicate-strategy <strategy>","Existing contact behavior: skip, merge, or overwrite","skip").option("--file-name <name>","Source label shown in import history").option("-l, --list <ids...>","List IDs for every imported subscriber (requires lists:write)").option("--enroll-sequences","Enroll matching subscribers (requires automations:trigger)").option("--default-phone-country <country>","Two-letter country for national phone numbers").option("--sms-consent","Assert express written SMS consent for every imported phone").option("--opt-in-mode <mode>","Email consent mode: default, confirmed, or double_opt_in (default may require automations:trigger; double_opt_in always does)","default").option("--idempotency-key <key>","Caller-owned key (1-255 chars) that makes retrying this request safe: resending the same content returns the already-queued import, while changed content under the same key queues a new import").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>pi("import",{file:e,...t}));S(oEe,{notes:["CSV columns for email, names, external ID, phone, status, and tags are detected automatically; other columns become custom attributes.","Status values from AWeber, Mailchimp, Kit, MailerLite, Brevo, ActiveCampaign, and beehiiv exports are mapped to active, unsubscribed, or bounced. A filled unsubscribe date column marks the row unsubscribed. Not-confirmed (pending double opt-in) and unrecognized values import as active; unrecognized ones are counted in the output.","Use --opt-in-mode confirmed only when these contacts already gave verified email consent.","Imports run asynchronously. Poll the returned ID with subscribers import-status.","Pass --idempotency-key from pipelines and retry loops so a timed-out request can be resent without double-queueing the batch.","If two identical keyed requests overlap, one may receive a retryable 503; honor Retry-After and resend the same request."],examples:["sequenzy subscribers import copper-contacts.csv --list list_123 --opt-in-mode confirmed",`sequenzy subscribers import --records-json '[{"email":"one@example.com","firstName":"Ana"}]' --opt-in-mode confirmed`,"sequenzy subscribers import contacts.csv --duplicate-strategy merge --idempotency-key nightly-sync-2026-08-25"]});var iEe=Ko.command("import-status <importId>").description("Get subscriber import progress and result counts").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>pi("import:get",{importId:e,...t}));S(iEe,{notes:["A completed import can still contain failed rows; inspect failed counts and --json reason maps."],examples:["sequenzy subscribers import-status import_123","sequenzy subscribers import-status import_123 --json"]});var sEe=Ko.command("events-import [file]").description("Record events for many subscribers from a JSON file").option("--events-json <json>","Inline JSON array (alternative to a JSON file)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>pi("events:import",{file:e,...t}));S(sEe,{notes:["Each event needs a name, an eventId, and an email or externalId; externalId-only rows must identify an existing contact because email is required for creation. At most 25 events per request.","History is classified per contact: only contacts whose events are all more than an hour old use the silent historical path. If any event for a contact is recent, every event for that contact uses the live path and can run sequences or webhooks.","Derive each required eventId from your source data so re-running the same file records nothing twice."],examples:["sequenzy subscribers events-import purchases.json",`sequenzy subscribers events-import --events-json '[{"email":"one@example.com","name":"purchase_completed","eventId":"order_1","occurredAt":"2026-08-01T12:00:00Z"}]'`]});var aEe=Ko.command("get [email]").description("Get subscriber details").option("--external-id <id>","Customer-owned subscriber ID").option("--include-bots","Include machine-classified bot/scanner opens and clicks in stats/activity").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>pi("get",{email:e,...t}));S(aEe,{notes:["Bot/scanner opens and clicks are excluded by default; pass --include-bots to inspect raw engagement."],examples:["sequenzy subscribers get user@example.com","sequenzy subscribers get user@example.com --include-bots"]});var dg=Ko.command("notes").description("Manage subscriber notes").action(()=>dg.help());S(dg,{examples:["sequenzy subscribers notes list user@example.com",'sequenzy subscribers notes add user@example.com --body "Prefers monthly digest"',"sequenzy subscribers notes delete note_123"]});var cEe=dg.command("list [email]").description("List subscriber notes").option("--external-id <id>","Customer-owned subscriber ID").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>pi("notes:list",{email:e,...t}));S(cEe,{examples:["sequenzy subscribers notes list user@example.com","sequenzy subscribers notes list --external-id user_123 --json"]});var lEe=dg.command("add [email]").description("Add a subscriber note").option("--external-id <id>","Customer-owned subscriber ID").requiredOption("-b, --body <body>","Note body").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>pi("notes:add",{email:e,...t}));S(lEe,{examples:['sequenzy subscribers notes add user@example.com --body "Asked about enterprise plan"','sequenzy subscribers notes add --external-id user_123 --body "Imported from sales call"']});var uEe=dg.command("delete <noteId>").description("Delete a subscriber note").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>pi("notes:delete",{noteId:e,...t}));S(uEe,{examples:["sequenzy subscribers notes delete note_123"]});var dEe=Ko.command("attributes").description("List the custom attributes your contacts use, with value types and examples").option("--include-nested","Also list nested paths such as profile.tier").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>pi("attributes",e));S(dEe,{notes:["Types and examples come from up to 100 recent contacts. Names that only older contacts use are listed too, with sampledContacts 0.",`A list attribute (isArray) holds several values. Set it with --attrs-json, e.g. --attrs-json '{"interests":["running"]}'.`],examples:["sequenzy subscribers attributes","sequenzy subscribers attributes --include-nested --json"]});var pEe=Ko.command("update [email]").description("Update subscriber status, name, phone, tags, or custom attributes").option("--external-id <id>","Customer-owned subscriber ID").option("--status <status>","Subscriber status").option("--first-name <name>","Subscriber first name").option("--last-name <name>","Subscriber last name").option("--timezone <zone>","IANA timezone (e.g. America/New_York). Pass an empty string to clear it").option("--phone <phone>","Phone number (E.164 or national). Pass an empty string to clear it").option("--phone-country <country>","Two-letter country used to read a national-format --phone (default US)").option("--sms-consent","Record express written SMS marketing consent for the phone number").option("--no-sms-consent","Unsubscribe the contact from SMS").option("-t, --tag <tags...>","Replacement tags").option("-a, --attr <attrs...>","Attributes (key=value)").option("--attrs-json <json>",`Attributes as a JSON object that keeps value types, e.g. '{"seats":5}'`).option("--merge","Merge custom attributes instead of replacing them").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>pi("update",{email:e,...t}));S(pEe,{notes:["--phone writes the native phone field shown on the contact, not a custom attribute.","--attr values are always sent as strings. Use --attrs-json to set numbers, booleans and lists or to change an attribute's type. When both set the same key, --attr wins.","Changing --phone resets SMS consent unless --sms-consent is passed in the same command."],examples:["sequenzy subscribers update user@example.com --status unsubscribed","sequenzy subscribers update user@example.com --first-name Ana --last-name Silva","sequenzy subscribers update user@example.com --phone '+390512345678'","sequenzy subscribers update user@example.com --phone '051 234 5678' --phone-country IT --sms-consent","sequenzy subscribers update user@example.com --tag churned --attr cancelReason=too_expensive","sequenzy subscribers update user@example.com --attr plan=pro --merge",`sequenzy subscribers update user@example.com --attrs-json '{"zip":"02134"}' --merge`]});var mEe=Ko.command("event [email]").description("Trigger an event for a subscriber").option("--external-id <id>","Customer-owned subscriber ID").requiredOption("-n, --name <event>","Event name").option("-p, --property <properties...>","Event properties (key=value)").option("-a, --attr <attrs...>","Subscriber attributes (key=value)").option("--account <externalId>","Attach the contact to this customer account (ignored with a warning until the workspace has Accounts on)").option("--account-json <json>","Account reference object with externalId and optional role, name, domain, attributes; cannot be combined with --account").option("--occurred-at <iso-date>","When the event actually happened; more than an hour ago records it as history without running sequences").option("--event-id <id>","Your own event ID, so re-sending the same event writes nothing new").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>pi("event",{email:e,...t}));S(mEe,{examples:["sequenzy subscribers event user@example.com --name saas.purchase","sequenzy subscribers event user@example.com --name saas.purchase --property plan=pro --property amount=99","sequenzy subscribers event user@example.com --name saas.purchase --occurred-at 2024-11-02T10:00:00Z --event-id inv_9182"],notes:["Without --occurred-at the event is live and runs the full chain: sync rules, sequence enrollment, waiting steps, goal conversions.","--event-id is an idempotency key on both paths: re-sending an ID this contact already has for this event name records nothing and runs no side effects. It is best-effort for live events sent within a second of each other, so a producer that needs a strict guarantee should keep its own ledger.","With an --occurred-at more than an hour in the past the event is recorded as history: stored with its real timestamp and counted by segments, but no sequences enroll and no webhooks fire. The contact's signup date also moves back to when the event occurred (never later). Use it for backfills, never to fake a live event."]});var kv=Ko.command("tags").description("Bulk add or remove tags across many existing subscribers").action(()=>kv.help());S(kv,{notes:["These commands only touch contacts that already exist. Unknown identifiers are reported, never created.","Use `subscribers add` or `subscribers update` for single-contact tag changes."],examples:["sequenzy subscribers tags add --tag legacy-plan --emails-file ./backlog.csv","sequenzy subscribers tags remove --tag legacy-plan --emails-file ./backlog.csv"]});var fEe=kv.command("add").description("Add tags to many existing subscribers").requiredOption("-t, --tag <tags...>","Tags to add").option("-e, --email <emails...>","Subscriber emails to tag").option("--emails-json <json>","JSON array of subscriber emails").option("--emails-file <file>","CSV or newline-separated file of emails").option("--external-id <ids...>","Customer-owned subscriber IDs to tag").option("--subscriber-id <ids...>","Sequenzy subscriber IDs to tag").option("--trigger-automations","Allow tag_added sequences to enroll these contacts (requires automations:trigger)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>CB("add",e));S(fEe,{notes:["Tag automations are skipped by default, which is what historical backfills want.","Requests are chunked at 500 targets each; totals in the output are combined across chunks."],examples:["sequenzy subscribers tags add --tag vip --email a@example.com --email b@example.com","sequenzy subscribers tags add --tag derived-churn --emails-file ./backlog.csv --json","sequenzy subscribers tags add --tag welcome --emails-file ./new.csv --trigger-automations"]});var gEe=kv.command("remove").description("Remove tags from many existing subscribers").requiredOption("-t, --tag <tags...>","Tags to remove").option("-e, --email <emails...>","Subscriber emails to untag").option("--emails-json <json>","JSON array of subscriber emails").option("--emails-file <file>","CSV or newline-separated file of emails").option("--external-id <ids...>","Customer-owned subscriber IDs to untag").option("--subscriber-id <ids...>","Sequenzy subscriber IDs to untag").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>CB("remove",e));S(gEe,{examples:["sequenzy subscribers tags remove --tag legacy-plan --emails-file ./backlog.csv","sequenzy subscribers tags remove --tag vip --subscriber-id sub_1 sub_2"]});var AEe=Ko.command("remove [email]").description("Unsubscribe or permanently delete a subscriber").option("--external-id <id>","Customer-owned subscriber ID").option("--hard","Permanently delete (not just unsubscribe); recorded data is erased or anonymized, suppressions are kept").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>pi("remove",{email:e,...t}));S(AEe,{examples:["sequenzy subscribers remove user@example.com","sequenzy subscribers remove user@example.com --hard"]});var Tu=Je.command("transactional").description("Manage transactional email templates").action(()=>Tu.help());S(Tu,{notes:["Use the top-level `sequenzy send` command to send email."],examples:["sequenzy transactional list","sequenzy transactional get welcome","sequenzy transactional update welcome --no-enabled","sequenzy transactional delete welcome --yes","sequenzy send user@example.com --template welcome --var firstName=Ana"]});var hEe=Tu.command("list").description("List transactional templates").option("--label <labels...>","Filter by label names (matches any)").option("--search <text>","Search name, slug, or email subject/title").option("--status <status>","Filter by all, active, or disabled","all").option("--sort <field>","Sort by date, sends, opens, open-rate, clicks, or ctr","date").option("--order <order>","Sort order: asc or desc","desc").option("--include-bots","Include machine opens and clicks").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>kp("list",e));S(hEe,{examples:['sequenzy transactional list --search "password reset" --status active',"sequenzy transactional list --sort open-rate --order desc","sequenzy transactional list --company comp_123 --json"]});var yEe=Tu.command("get <slug>").description("Get transactional template details by slug").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>kp("get",{slug:e,...t}));S(yEe,{examples:["sequenzy transactional get welcome"]});var bEe=Tu.command("create <name>").description("Create a transactional template").option("--label <labels...>","Label names to assign").option("--slug <slug>","API slug").option("-s, --subject <subject>","Subject (optional with --prompt)").option("--preview-text <text>","Preview text override").option("--prompt <prompt>","Generate branded transactional blocks").option("--style <style>","Prompt generation style. Pass designed or plain to force the designed or plain-text email style; other values are freeform guidance (defaults to the company's email style preference)").option("--tone <tone>","Prompt generation tone").option("--html <html>","Preserved HTML content").option("--html-file <file>","Read preserved HTML from file").option("--blocks-json <json>","Finished Sequenzy blocks JSON").option("--blocks-file <file>","Read finished Sequenzy blocks from file").option("--enabled","Enable immediately (prompt creates default disabled)").option("--no-enabled","Create the transactional template disabled").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>kp("create",{name:e,...t}));S(bEe,{notes:["Provide exactly one of prompt, HTML, or blocks.",ug],examples:['sequenzy transactional create password-reset --prompt "Write a password reset email"']});var vEe=Tu.command("update <slug>").description("Update a transactional template by ID or slug").option("--label <labels...>","Replace label names").option("--clear-labels","Remove all label assignments").option("--name <name>","Transactional template name").option("-s, --subject <subject>","Subject line").option("--preview-text <text>","Preview text").option("--clear-preview-text","Remove the preview text").option("--html <html>","Replace the body with preserved HTML").option("--html-file <file>","Replace the body with HTML read from file").option("--blocks-json <json>","Replace the body with Sequenzy blocks JSON").option("--blocks-file <file>","Replace the body with blocks read from file").option("--enabled","Allow this template to be sent").option("--no-enabled","Stop this template from being sent").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>kp("update",{slug:e,...t}));S(vEe,{notes:["Partial update: only the fields you pass change.","Replacing the body takes HTML or blocks, not both.","Use --no-enabled to stop sends while keeping the template and its stats.",ug],examples:["sequenzy transactional update password-reset --no-enabled",'sequenzy transactional update password-reset --subject "Reset your password"',"sequenzy transactional update password-reset --blocks-file ./reset.json"]});var EEe=Tu.command("delete <slug>").description("Delete a transactional template by ID or slug").option("-y, --yes","Skip the confirmation prompt").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>kp("delete",{slug:e,...t}));S(EEe,{notes:["Deleting frees the slug for reuse and stops any further sends through it.","Past deliveries and their stats are kept; only the saved template is removed.","Requires an API key with the transactional:delete scope."],examples:["sequenzy transactional delete password-reset --yes"]});var UB=Je.command("widgets").description("Widget helper commands").action(()=>UB.help());S(UB,{examples:["sequenzy widgets preferences-token user@example.com"]});var IEe=UB.command("preferences-token <email>").description("Generate a subscription preferences iframe token").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>AV("preferences-token",{email:e,...t}));S(IEe,{examples:["sequenzy widgets preferences-token user@example.com"]});var Rv=Je.command("email-sends").alias("emailsends").description("Inspect sent email snapshots and delivery events").action(()=>Rv.help());S(Rv,{notes:["Email send rows are short-lived; if the row was cleaned up, this falls back to retained ClickHouse events.","The list command matches the dashboard's 14-day delivery history and supports subject, recipient, status, type, and source filters.","Use --html to print the stored HTML body when it is still available."],examples:['sequenzy email-sends list --search "Welcome" --status opened',"sequenzy email-sends get send_123","sequenzy email-sends get send_123 --html","sequenzy email-sends get send_123 --json"]});var CEe=Rv.command("list").description("List and filter recent sent email deliveries").option("--search <text>","Search subject or recipient email").option("--subject <text>","Filter by subject/title").option("--recipient <text>","Filter by recipient email").option("--status <status>","Filter by delivery status").option("--email-type <type>","Filter by campaign, transactional, or sequence").option("--bounce-type <type>","Filter bounced sends by Permanent or Transient").option("--campaign <id>","Filter by campaign ID").option("--transactional <id>","Filter by saved transactional email ID").option("--sequence <id>","Filter by sequence ID").option("--automation-node-id <id>","Filter by one email step of a sequence").option("--days <days>","History window in days (maximum 14)","14").option("--page <page>","Page number").option("--limit <limit>","Results per page (maximum 100)").option("--all","Fetch every result page").option("--csv [path]","Export CSV to stdout, or write it to an optional file path").option("--sort <field>","Sort by recipientEmail, subject, status, eventAt, sentAt, or createdAt","createdAt").option("--order <order>","Sort order: asc or desc","desc").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>G0("list",e));S(CEe,{notes:["The opened status includes clicked deliveries, matching the dashboard.","Use a returned ID with `sequenzy email-sends get <id>` for timestamps and the complete event timeline.","Use --all --csv email-sends.csv to export every matching delivery.","--automation-node-id lists the recipients of one sequence step; the node ID comes from `stats --sequence <id>`.","This history only reaches back 14 days. For per-step send totals over the full retained window use `stats --sequence <id>` or `stats --emails`."],examples:['sequenzy email-sends list --search "Welcome" --status opened',"sequenzy email-sends list --email-type transactional --days 7","sequenzy email-sends list --sequence seq_123 --automation-node-id node_email_4","sequenzy email-sends list --transactional txn_123 --all --csv email-sends.csv","sequenzy email-sends list --subject receipt --recipient example.com --json"]});var wEe=Rv.command("get <emailSendId>").description("Get an email send by ID").option("-c, --company <id>","Company ID override for personal API keys").option("--html","Print the full stored HTML body in text output").option("--html-only","Print only the stored HTML body").option("--json","Print raw JSON").action((e,t)=>G0("get",{id:e,...t}));S(wEe,{examples:["sequenzy email-sends get send_123","sequenzy email-sends get send_123 --html","sequenzy email-sends get send_123 --company comp_123 --json"]});var pg=Je.command("suppressions").description("Inspect recipient suppression and clear workspace escalations").action(()=>pg.help());S(pg,{notes:["Suppression lookup is exact-address only because the SES account-level list is shared across companies.","Removal clears workspace soft-bounce escalations only; global invalid-recipient, workspace hard-bounce, SES, complaint, and unsubscribe protections are preserved."],examples:["sequenzy suppressions list","sequenzy suppressions get me@example.com","sequenzy suppressions remove me@example.com --yes"]});var SEe=pg.command("list").description("List recipients this workspace cannot reach").option("--search <query>","Filter by email substring").option("--page <page>","Page number (default 1)").option("--limit <limit>","Entries per page (max 100)").option("--sort <field>","Order by suppressedAt, email, or status").option("--order <direction>","asc or desc").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>Iv("list",e));S(SEe,{notes:["Shows protected global invalid-recipient suppressions for associated addresses, protected workspace hard bounces without conclusive invalid-inbox evidence, workspace soft-bounce escalations, and recipients who reported an email as spam.","Only workspace soft-bounce escalations can be removed.","--sort status lists removable escalations before protected suppressions. An unrecognized --sort falls back to newest first, and the applied order is printed with the results."],examples:["sequenzy suppressions list","sequenzy suppressions list --search example.com --json","sequenzy suppressions list --sort status --order desc"]});var DEe=pg.command("get <email>").description("Check local and Amazon SES suppression for one recipient").option("--region <region>","Check one AWS SES region").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Iv("get",{email:e,...t}));S(DEe,{examples:["sequenzy suppressions get me@example.com","sequenzy suppressions get me@example.com --region us-east-1 --json"]});var BEe=pg.command("remove <email>").description("Remove a workspace soft-bounce escalation").option("--region <region>","Inspect one AWS SES region after removal").option("-c, --company <id>","Company ID override for personal API keys").option("-y, --yes","Skip confirmation").option("--json","Print raw JSON").action((e,t)=>Iv("remove",{email:e,...t}));S(BEe,{examples:["sequenzy suppressions remove me@example.com","sequenzy suppressions remove me@example.com --region us-east-1 --yes"]});var xEe=_3(Je.command("send <email...>").description("Send through the transactional email API")).option("-t, --template <slug>","Transactional template slug to use").option("-s, --subject <subject>","Email subject").option("--html <html>","Email HTML content").option("--html-file <file>","Read HTML from file, or - for stdin").option("--track-as <name>","Track --html sends under one code-managed transactional email (e.g. weekly-report)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").option("--email-type <type>","Delivery policy: transactional (default) or marketing").option("--from-email <email>","Send from this verified sender address instead of the company default").option("--from-name <name>","Existing sender display name on --from-email when the address has several identities").option("--sender-profile-id <id>","Existing sender profile ID; omit --from-email. See sequenzy sender-profiles list").option("--reply-to <address>","Reply-To address or Name <email> value").option("--reply-to-name <name>","Display name for a bare --reply-to address").option("--reply-profile <id>","Existing reply profile ID; omit --reply-to. See sequenzy sender-profiles list").option("--attachments-json <json>","Attachments as JSON objects with filename and content or path").option("--header <header>",'Extra email header as "Name: value", e.g. a List-Unsubscribe for a transactional send (repeatable)',(e,t=[])=>[...t,e]).option("--no-track-clicks","Disable click tracking for this send to keep iOS/Android universal links working").option("--no-track-opens","Disable the open-tracking pixel for this send").option("--idempotency-key <key>","Retry key that prevents duplicate sends for 14 days").option("--vars-json <json>","Variables as a JSON object, including nested arrays for repeat blocks").option("-v, --var <vars...>","Variables (key=value)").action(T3);S(xEe,{notes:["Use either --template or --html/--html-file.","Use --html-file - for piped HTML. --json prints the accepted API receipt; failures print structured JSON to stderr.","--template takes a transactional API slug and cannot be combined with --subject.","--subject is required when sending raw HTML.","--track-as names a raw-HTML email type (for example weekly-report): every send with the same value is counted under one code-managed transactional email that the first send creates. Use stable ASCII names (letters, digits, spaces and . _ - : /), not per-recipient values; a workspace can have 100. It cannot be combined with --template.","Pass several recipients, --cc, or --bcc to send one email with a shared recipient list instead of one email per address. Each list accepts up to 50 addresses; repeat --cc/--bcc or use comma-separated values for several copy recipients.","Addresses repeated across the lists are dropped from the lower-priority one: to beats cc beats bcc.","--email-type marketing adds the standard unsubscribe footer and RFC 8058 one-click-unsubscribe headers; it supports one recipient only and rejects --cc and --bcc.","When --from-email and --sender-profile-id are omitted, a template send keeps its saved From identity and a direct send uses the company default. Pass --from-email (and --from-name if that address has several identities) to send as a non-default verified brand without looking up IDs.","Use either --from-email or --sender-profile-id, not both. --from-name requires --from-email. --sender-profile-id already carries the display name.","When --reply-to and --reply-profile are omitted, the saved template or company Reply-To default is used. Use either --reply-to or --reply-profile, not both. --reply-to-name requires a bare --reply-to address.","--attachments-json accepts up to 10 objects with filename plus Base64 content or a public path; contentId embeds a CID image and contentType overrides MIME detection.",`--header adds an email header (up to 50). Transactional sends can carry your own List-Unsubscribe and List-Unsubscribe-Post; marketing sends always use Sequenzy's. Headers Sequenzy manages, such as From, To, Subject, Reply-To and Message-ID, are not applied; the receipt lists any header that was not applied and why. A --header without "Name:" or a name given twice is rejected before sending.`,"--no-track-clicks and --no-track-opens are opt-out only for this send; they cannot enable tracking the account has disabled.","--vars-json accepts nested objects and arrays; --var overrides individual scalar keys.","If the recipient matches a subscriber, saved first and last names fill omitted name variables; --var values override them.","For retryable automation, generate one --idempotency-key per logical email and reuse that same key on every retry. Reusing it with different content is rejected."],examples:["sequenzy send user@example.com --template welcome --var firstName=Ana","sequenzy send buyer@example.com ops@example.com --cc billing@example.com --bcc archive@example.com --template order-confirmation",`sequenzy send user@example.com --template welcome --vars-json '{"event":{"items":[{"title":"Plan","description":"Pro"}]}}'`,'sequenzy send user@example.com --subject "Welcome" --html-file ./welcome.html','sequenzy send user@example.com --subject "Your week" --html-file ./weekly.html --track-as weekly-report',`sequenzy send user@example.com --subject "Ticket" --html '<img src="cid:ticket-qr">' --attachments-json '[{"filename":"ticket.png","path":"https://example.com/ticket.png","contentId":"ticket-qr","contentType":"image/png"}]'`,"sequenzy send user@example.com --template trial-reminder --email-type marketing --var firstName=Ana",'sequenzy send user@example.com --subject "StudyBoost test" --html "<p>Hi</p>" --from-email hello@studyboost.com --from-name StudyBoost --reply-to support@studyboost.com --reply-to-name "StudyBoost Support"',"sequenzy send user@example.com --template receipt --idempotency-key order-123-receipt",'sequenzy send user@example.com --template weekly-digest --header "List-Unsubscribe: <https://example.com/unsubscribe/abc>" --header "List-Unsubscribe-Post: List-Unsubscribe=One-Click"']});var Xn=Je.command("campaigns").description("Manage campaigns").action(()=>Xn.help());S(Xn,{notes:["Campaign creation supports HTML, Sequenzy blocks, or prompt-generated content.","Campaign updates support HTML, Sequenzy blocks, subject, name, labels, and reply-to changes.","Campaign scheduling requires a future ISO timestamp and a verified sending domain.","Use unschedule to return a scheduled campaign to draft, cancel to stop one permanently, and pause/resume to control an active send.",ug],examples:["sequenzy campaigns list --status draft --company comp_123",'sequenzy campaigns create "April Launch" --subject "We shipped" --html-file ./campaign.html','sequenzy campaigns create "API Launch" --subject "We shipped" --label edm api --html-file ./campaign.html','sequenzy campaigns schedule camp_123 --at "2026-06-01T14:00:00Z"',"sequenzy campaigns test camp_123 --to you@example.com","sequenzy campaigns unschedule camp_123","sequenzy campaigns cancel camp_123","sequenzy campaigns duplicate camp_123 --mode ab_test"]});Xn.command("from-audience").description("Create a draft for a frozen selection of contacts or email activity").option("--name <name>","Draft name").option("--selection-json <json>","Selection object: source contacts or email_activity, with matching contacts or activity settings").option("--selection-file <path>","Read the selection JSON from a file, or - for stdin").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>ur("from-audience",e));var _Ee=Xn.command("list").description("List campaigns").option("-s, --status <status>","Filter by status").option("--label <labels...>","Filter by label name").option("--limit <count>","Page size from 1 to 100 (defaults to 50)").option("--offset <count>","Zero-based result offset").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>ur("list",e));S(_Ee,{notes:["Results are paginated: the default page size is 50 and --limit is capped at 100.","Read the pagination object (--json) or the trailing hint to page through every campaign with --offset."],examples:["sequenzy campaigns list","sequenzy campaigns list --status draft --company comp_123","sequenzy campaigns list --label edm","sequenzy campaigns list --limit 100 --offset 100"]});var kEe=Xn.command("get <id>").description("Get campaign details").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ur("get",{id:e,...t}));S(kEe,{examples:["sequenzy campaigns get camp_123 --company comp_123"]});var REe=Xn.command("audience <id>").description("Show who a campaign will reach, with a live recipient count").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ur("audience",{id:e,...t}));S(REe,{notes:["Resolves list and segment names and recomputes the recipient count at read time.","Warns when targeting is unset, because scheduling then sends to every active subscriber."],examples:["sequenzy campaigns audience camp_123 --company comp_123"]});function EV(e){return e.option("--subscriber <id>","Personalize as a stored subscriber").option("--email <email>","Personalize as an ad-hoc contact").option("--first-name <name>","First name for --email").option("--last-name <name>","Last name for --email").option("--attr <key=value...>","Custom attribute for the --email contact (repeatable)").option("--attrs-json <json>","Custom attributes for the --email contact as a JSON object").option("--tag <tags...>","Tag the --email contact carries, for previewing tag conditions (repeatable)").option("--empty-tags","State that the --email contact carries no tags, for previewing empty-tag conditions").option("--var <key=value...>","Extra merge variable (repeatable)").option("--vars-json <json>","Extra merge variables as a JSON object").option("--locale <locale>","Force a localization locale")}function jB(e){return EV(e).option("--tracking","Apply the company's auto-UTM link decoration").option("--out <file>","Write the HTML to a file, or - for stdout").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON")}function zB(e){return EV(e).option("--no-links","Skip live link and image verification").option("--fail-on <severity>","Exit with code 1 when an issue of this severity or worse is found: error or warning").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON")}var MB=["Runs the same checks as the editor's email checker against the saved content, plus live verification of every link and image: broken pages, dead domains, certificate problems, redirect loops, missing https://, localhost/staging/preview URLs, placeholder domains, link shorteners, misleading link text, invalid mailto/tel links, and broken or oversized images.","Also flags leftover placeholder copy (lorem ipsum, [First Name], TODO), name merge tags without a fallback, missing alt text, spam-trigger wording, Gmail clipping risk and email-client compatibility problems.",'Links built from per-recipient merge tags are listed as "personalized" and only syntax-checked. {{company.url}} links are resolved from your company website.',`"Couldn't verify" means the site refused an automated check (for example 401, 403 or 429). It may work in a browser, so it is never counted as broken.`,"Sender settings are not part of this check. Use --fail-on error in CI or scripts to stop on problems."],HB=["Renders the email exactly as it would be sent, so an external builder or dashboard can show a true preview.","Without --subscriber or --email the email renders for a sample contact and contact-specific merge tags resolve to empty values.","Unresolved merge tags are listed in the summary and under unresolvedMergeTags with --json. Nothing is called unrecognized unless the render knows the contact's attributes, since a bare {{plan}} reads the same attributes as {{subscriber.plan}}, so pass --subscriber, or --email with --attr/--attrs-json, to catch typos. Rendering a transactional email also needs --var/--vars-json, since its tags come from the variables of each send call.",'Conditional blocks that read stored subscriber state (tag, segment, list, status, event, purchases, engagement) can only be evaluated for --subscriber, or for a tag condition with --email plus --tag/--empty-tags. Anything the render cannot evaluate is rendered as false and listed under "Conditions not evaluated", because an else branch in the HTML looks the same either way.',"Links are clean by default. Pass --tracking to apply the company's auto-UTM decoration.","Per-send click redirects and the open pixel are added at send time against a real email send record, so they never appear in a render."],QEe=jB(Xn.command("render <id>").description("Render a campaign to email-ready HTML").option("--variant <id>","Render a specific A/B test variant").option("--variation <id>","Render a design variation of the email (from variations list)")).action((e,t)=>cb({type:"campaign",id:e},t));S(QEe,{notes:HB,examples:["sequenzy campaigns render camp_123 --out preview.html","sequenzy campaigns render camp_123 --subscriber sub_123 --out -","sequenzy campaigns render camp_123 --email you@example.com --first-name Ada --var plan=Pro","sequenzy campaigns render camp_123 --email you@example.com --tag extended","sequenzy campaigns render camp_123 --email you@example.com --empty-tags","sequenzy campaigns render camp_123 --email you@example.com --attr plan=pro --attr mrr=99 --json","sequenzy campaigns render camp_123 --variant var_123 --tracking --json"]});var TEe=zB(Xn.command("check <id>").description("Check a campaign before sending: broken links and images, placeholders, content and client issues").option("--variant <id>","Check a specific A/B test variant")).action((e,t)=>lb({type:"campaign",id:e},t));S(TEe,{notes:MB,examples:["sequenzy campaigns check camp_123","sequenzy campaigns check camp_123 --fail-on error","sequenzy campaigns check camp_123 --no-links --json"]});var $Ee=Xn.command("create <name>").description("Create a campaign").option("-s, --subject <subject>","Email subject").option("--preview-text <text>","Inbox preview text").option("--preheader-text <text>","Alias for --preview-text").option("--tracking-code <code>","Optional campaign tracking code").option("--status <status>","Initial status: draft or sent").option("--sent-at <iso-date>","Sent timestamp when creating with --status sent").option("--html <html>","Email HTML content").option("--html-file <file>","Read HTML from file").option("--blocks-json <json>","Inline JSON array of Sequenzy email blocks").option("--blocks-file <file>","Path to a JSON file with Sequenzy email blocks").option("--prompt <prompt>","Generate campaign blocks from a prompt").option("--style <style>","Prompt generation style. Pass designed or plain to force the designed or plain-text email style; other values are freeform guidance (defaults to the company's email style preference)").option("--tone <tone>","Prompt generation tone: professional, casual, friendly").option("--email-preset <preset>","Style > Format for native blocks: branded or minimal").option("--from-email <email>","Campaign From address").option("--from-name <name>","Display name for --from-email; picks or creates the identity of that name on the address").option("--sender-profile-id <id>","Existing sender profile ID; carries its own name, so omit --from-email and --from-name").option("--reply-to <email>","Campaign Reply-To address").option("--reply-to-name <name>","Display name for --reply-to; a saved profile keeps its own name and the response warns").option("--reply-profile <id>","Existing Reply-To profile ID").option("--label <labels...>","Label names to assign").option("--segment <id>","Target a saved segment").option("--lists <ids...>","Target one or more lists by ID (shorthand for targetLists type 'lists')").option("--target-lists-json <json>","Inline campaign targetLists JSON object").option("--target-lists-file <file>","Path to a JSON file with campaign targetLists").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ur("create",{name:e,...t}));S($Ee,{notes:["--subject is required unless --prompt is provided. With --prompt, the generated subject is used unless --subject is also provided.","Use --preview-text or --preheader-text to set the inbox preview text. With --prompt, the generated preview is used unless one of these flags is provided.","Use --blocks-json or --blocks-file when you need editor-compatible blocks, including conditional content and per-block styles.","Use --email-preset branded or minimal to set Style > Format on native blocks. This is not --style, which is a prompt-generation hint.","Use --status sent only to archive an already-sent campaign; it does not send email or create per-recipient delivery history.","Do not combine prompt, HTML flags, and blocks flags in the same request.","Use --segment, --lists, or --target-lists-json to save the audience on the draft. Omit them to set targeting later with campaigns update or campaigns schedule. These audience flags are mutually exclusive.",'Target list examples include {"type":"all"}, {"type":"lists","listIds":["list_123"]}, and {"type":"segment","segmentId":"seg_123"}.'],examples:['sequenzy campaigns create "April Launch" --prompt "Announce our new analytics dashboard"','sequenzy campaigns create "April Launch" --subject "We shipped" --preheader-text "Your quick product update" --html-file ./campaign.html','sequenzy campaigns create "Imported launch" --subject "We shipped" --status sent --sent-at "2026-05-01T14:00:00Z" --html-file ./campaign.html','sequenzy campaigns create "API Launch" --subject "We shipped" --label edm api --html-file ./campaign.html','sequenzy campaigns create "Segmented Launch" --subject "We shipped" --blocks-file ./campaign-blocks.json','sequenzy campaigns create "Research note" --subject "Quick question" --blocks-file ./note.json --email-preset minimal',`sequenzy campaigns create "Partner Update" --subject "This month at HolaRuta" --target-lists-json '{"type":"lists","listIds":["list_123"]}'`]});var NEe=Xn.command("update <id>").description("Update a draft campaign").option("-n, --name <name>","Campaign name").option("-s, --subject <subject>","Email subject").option("--preview-text <text>","Inbox preview text").option("--preheader-text <text>","Alias for --preview-text").option("--tracking-code <code>","Optional campaign tracking code").option("--html <html>","Email HTML content").option("--html-file <file>","Read HTML from file").option("--blocks-json <json>","Inline JSON array of Sequenzy email blocks").option("--blocks-file <file>","Path to a JSON file with Sequenzy email blocks").option("--email-preset <preset>","Style > Format for native blocks: branded or minimal").option("--campaign-data-json <json>","Inline campaignData JSON object").option("--campaign-data-file <file>","Path to a JSON file with campaignData").option("--computed-lists-json <json>","Inline computedLists JSON array").option("--computed-lists-file <file>","Path to a JSON file with computedLists").option("--from-email <email>","Campaign From address").option("--from-name <name>","Display name for --from-email; picks or creates the identity of that name on the address").option("--sender-profile-id <id>","Existing sender profile ID; carries its own name, so omit --from-email and --from-name").option("--reply-to <email>","Set reply-to using an existing reply profile email").option("--reply-to-name <name>","Display name for --reply-to; a saved profile keeps its own name and the response warns").option("--reply-profile <id>","Set reply-to using a reply profile ID").option("--label <labels...>","Replace label names").option("--segment <id>","Retarget the draft at a saved segment").option("--lists <ids...>","Retarget the draft at one or more lists by ID (shorthand for targetLists type 'lists')").option("--target-lists-json <json>","Inline campaign targetLists JSON object").option("--target-lists-file <file>","Path to a JSON file with campaign targetLists").option("--clear-target-lists","Clear saved targeting so the audience is chosen when scheduling").option("--send-time-optimization","Enable per-recipient send-time optimization and clear other saved pacing modes").option("--disable-send-time-optimization","Disable send-time optimization on the draft").option("--send-time-window-hours <hours>","Set the send-time optimization window from 1-24 hours").option("--max-recipients <count>","Send to at most this many audience members (the first N by subscriber id) when the campaign is sent").option("--clear-max-recipients","Remove the recipient limit so the campaign goes to the whole audience").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ur("update",{id:e,...t}));S(NEe,{notes:["Provide at least one update flag, including subject, preview text, content, email preset, labels, reply-to, campaign data, computed lists, audience, or STO pacing.","Use --blocks-json or --blocks-file when you need editor-compatible blocks, including conditional content and per-block styles.","Use --email-preset branded or minimal to change Style > Format on native blocks without rewriting copy.","Use --campaign-data-file and --computed-lists-file to upload personalization data for repeat blocks.","Do not combine HTML flags with blocks flags in the same request.","Use either --reply-to or --reply-profile, not both.","Use --segment, --lists, or --target-lists-json to replace the saved audience, or --clear-target-lists to choose it later at schedule time. These audience flags are mutually exclusive.","Use --send-time-optimization with optional --send-time-window-hours (1-24, default 12), or --disable-send-time-optimization to turn STO off. Enabling STO clears a saved spread or recipient-timezone mode.","Use --max-recipients to send to only the first N matching subscribers (for example while ramping up a new domain), or --clear-max-recipients to remove the cap. The cap is applied when the audience is resolved at send time."],examples:['sequenzy campaigns update camp_123 --subject "Updated subject"','sequenzy campaigns update camp_123 --preheader-text "Updated preview"',"sequenzy campaigns update camp_123 --html-file ./campaign-v2.html","sequenzy campaigns update camp_123 --blocks-file ./campaign-v2-blocks.json","sequenzy campaigns update camp_123 --email-preset minimal","sequenzy campaigns update camp_123 --campaign-data-file ./campaign-data.json --computed-lists-file ./computed-lists.json","sequenzy campaigns update camp_123 --reply-to support@example.com","sequenzy campaigns update camp_123 --label edm api","sequenzy campaigns update camp_123 --segment seg_123","sequenzy campaigns update camp_123 --clear-target-lists","sequenzy campaigns update camp_123 --send-time-optimization --send-time-window-hours 8","sequenzy campaigns update camp_123 --max-recipients 100"]});var OEe=Xn.command("schedule <id>").description("Schedule a draft or scheduled campaign").requiredOption("--at <datetime>","Future ISO date/time to send, for example 2026-06-01T14:00:00Z").option("--segment <id>","Target a saved segment").option("--lists <ids...>","Target one or more lists by ID (shorthand for targetLists type 'lists')").option("--target-lists-json <json>","Inline campaign targetLists JSON object").option("--target-lists-file <file>","Path to a JSON file with campaign targetLists").option("--send-time-optimization","Enable send-time optimization for the scheduled send").option("--disable-send-time-optimization","Disable send-time optimization for the scheduled send").option("--send-time-window-hours <hours>","Set the send-time optimization window from 1-24 hours").option("--spread-over-hours <hours>","Spread delivery over 1-72 hours. Disables send-time optimization when set.").option("--max-recipients <count>","Send to at most this many audience members (the first N by subscriber id). Omit to keep the draft's saved cap.").option("--clear-max-recipients","Remove a saved recipient limit for this send").option("--repeat <interval>","Repeat the campaign weekly or monthly starting at --at. Audience membership is re-evaluated at every run.").option("--in-recipient-timezone","Deliver at --at's wall-clock time in each recipient's own timezone. Requires --scheduled-timezone.").option("--no-in-recipient-timezone","Disable recipient-timezone delivery and use the selected fixed-time pacing strategy.").option("--scheduled-timezone <zone>","IANA zone the --at wall-clock time refers to, for example America/New_York").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ur("schedule",{id:e,...t}));S(OEe,{notes:["The campaign must be draft or already scheduled.","Omit --segment, --lists, and target lists to reuse saved campaign targeting, or default to all active subscribers.","--segment, --lists, and the target list flags are mutually exclusive.",'Target list examples include {"type":"all"}, {"type":"lists","listIds":["list_123"]}, and {"type":"segment","segmentId":"seg_123"}.',"With --repeat, the campaign becomes a recurring template: each run is duplicated and sent automatically. Use campaigns unschedule to stop the series and return it to draft, or re-schedule without --repeat to keep a one-shot send.","With --in-recipient-timezone, every contact receives the campaign at --at's wall-clock time in their own timezone; contacts without a stored timezone get it at --at in --scheduled-timezone. Not combinable with --repeat or --spread-over-hours.","Use --send-time-optimization with optional --send-time-window-hours (1-24, default 12), or --disable-send-time-optimization to turn STO off. A spread or recipient-timezone send disables STO.","Use --max-recipients to send to only the first N matching subscribers; recipients already reached by this campaign count against the cap on resume. Duplicate the campaign and exclude contacts who already received it to send the next batch."],examples:['sequenzy campaigns schedule camp_123 --at "2026-06-01T14:00:00Z"','sequenzy campaigns schedule camp_123 --at "2026-06-01T14:00:00Z" --segment seg_123','sequenzy campaigns schedule camp_123 --at "2026-06-01T14:00:00Z" --lists list_123',`sequenzy campaigns schedule camp_123 --at "2026-06-01T14:00:00Z" --target-lists-json '{"type":"all"}'`,'sequenzy campaigns schedule camp_123 --at "2026-06-01T14:00:00Z" --target-lists-file ./target-lists.json','sequenzy campaigns schedule camp_123 --at "2026-06-01T14:00:00Z" --spread-over-hours 6','sequenzy campaigns schedule camp_123 --at "2026-06-01T14:00:00Z" --max-recipients 100','sequenzy campaigns schedule camp_123 --at "2026-06-01T14:00:00Z" --send-time-optimization --send-time-window-hours 8','sequenzy campaigns schedule camp_123 --at "2026-06-01T14:00:00Z" --repeat monthly','sequenzy campaigns schedule camp_123 --at "2026-06-01T20:00:00-04:00" --in-recipient-timezone --scheduled-timezone America/New_York']});var PEe=Xn.command("test <id>").description("Send a test email for a campaign").requiredOption("--to <email>","Recipient email for the test").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ur("test",{id:e,...t}));S(PEe,{examples:["sequenzy campaigns test camp_123 --to you@example.com"]});var FEe=Xn.command("cancel <id>").description("Cancel a scheduled, paused, or sending campaign").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ur("cancel",{id:e,...t}));S(FEe,{notes:["Cancelling stops scheduled, paused, waiting-approval, and actively sending campaigns immediately.","No confirmation prompt is shown so a bad send can be stopped fast."],examples:["sequenzy campaigns cancel camp_123"]});var qEe=Xn.command("unschedule <id>").description("Return a scheduled campaign to draft").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ur("unschedule",{id:e,...t}));S(qEe,{notes:["Only scheduled campaigns can be unscheduled.","Unscheduling removes the pending send and recurrence, then returns the campaign to an editable draft."],examples:["sequenzy campaigns unschedule camp_123"]});var LEe=Xn.command("pause <id>").description("Pause a campaign that is currently sending").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ur("pause",{id:e,...t}));S(LEe,{notes:["Only campaigns in sending status can be paused."],examples:["sequenzy campaigns pause camp_123"]});var UEe=Xn.command("resume <id>").description("Resume a paused campaign").option("--spread-over-hours <hours>","Spread the remaining delivery over 1-72 hours").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ur("resume",{id:e,...t}));S(UEe,{notes:["Only paused campaigns can be resumed."],examples:["sequenzy campaigns resume camp_123","sequenzy campaigns resume camp_123 --spread-over-hours 6"]});var jEe=Xn.command("delete <id>").description("Delete a campaign").option("-y, --yes","Skip the confirmation prompt").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ur("delete",{id:e,...t}));S(jEe,{notes:["Sending, scheduled, and paused campaigns must be cancelled before they can be deleted."],examples:["sequenzy campaigns delete camp_123 --yes"]});var zEe=Xn.command("share <id>").description("Create or fetch the campaign's public view-in-browser link").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ur("share",{id:e,...t}));S(zEe,{notes:["The hosted page is anonymized: sample contact, inert unsubscribe link, no open/click tracking.","Idempotent - rerunning returns the same URL until you run `campaigns unshare`."],examples:["sequenzy campaigns share camp_123"]});var MEe=Xn.command("unshare <id>").description("Revoke the campaign's public view-in-browser link").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ur("unshare",{id:e,...t}));S(MEe,{notes:["The shared URL returns 404 immediately after revocation."],examples:["sequenzy campaigns unshare camp_123"]});var HEe=Xn.command("duplicate <id>").description("Duplicate a campaign as a new draft").option("--mode <mode>","Duplicate mode: campaign, ab_test, or variant","campaign").option("--variant-id <id>","A/B test variant to copy when --mode is variant").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ur("duplicate",{id:e,...t}));S(HEe,{notes:["Mode campaign copies the campaign email, ab_test also copies the A/B test with all variants, and variant copies one variant's content as a plain campaign."],examples:["sequenzy campaigns duplicate camp_123","sequenzy campaigns duplicate camp_123 --mode ab_test","sequenzy campaigns duplicate camp_123 --mode variant --variant-id var_b"]});var GEe=Xn.command("resend-to-non-openers <id>").description("Create a draft resend to subscribers who didn't open a sent campaign").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ur("resend-to-non-openers",{id:e,...t}));S(GEe,{notes:["Only available 6 hours after a sent campaign finishes sending.","Unavailable for imported already-sent campaigns because Sequenzy has no opens for a send it did not deliver.",`Creates a draft targeting the same audience plus a "didn't open this campaign" rule. Review the draft, then schedule or send it.`,"The response includes an estimate of how many subscribers haven't opened the original.","Every audience format keeps hard opener exclusions across manual additions and repeated resends. Live audience membership can include new subscribers.","Recreate older drafts missing excludedCampaignOpenerIds from the original campaign and review before scheduling."],examples:["sequenzy campaigns resend-to-non-openers camp_123"]});function IV(e){return e.option("--description <text>","Goal description").option("--trigger-type <type>","Goal signal: event, attribute_change, or tag_added").option("--trigger-event-name <event>","Event goal signal name").option("--trigger-tag-name <tag>","Tag name for tag_added goals").option("--attribute-path <path>","Subscriber attribute goal path").option("--attribute-condition <condition>","changed, changed_to, or changed_from_to").option("--attribute-value <value>","Target subscriber attribute value").option("--attribute-previous-value <value>","Previous subscriber attribute value").option("--event-property-name <name>","Optional event property whose value is tracked").option("--event-property-label <label>","Display label for the tracked event property").option("--attribution-window-hours <hours>","Goal attribution window in hours")}var Qv=Xn.command("goals").description("Manage persisted campaign conversion goals");Qv.command("list <campaignId>").description("List campaign goals").option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t)=>ur("goals",{id:e,...t}));IV(Qv.command("create <campaignId> <name>").description("Create a campaign conversion goal")).option("--active","Create the goal with conversion tracking on (default)").option("--inactive","Create the goal with conversion tracking off").option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t,n)=>ur("goal-create",{id:e,name:t,isActive:n.active,notActive:n.inactive,...n}));IV(Qv.command("update <campaignId> <goalId>").description("Update a campaign conversion goal").option("--name <name>","Goal name")).option("--active","Enable the goal").option("--inactive","Disable the goal").option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t,n)=>ur("goal-update",{id:e,goalId:t,isActive:n.active,notActive:n.inactive,...n}));Qv.command("delete <campaignId> <goalId>").description("Delete a campaign conversion goal").option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t,n)=>ur("goal-delete",{id:e,goalId:t,...n}));var os=Xn.command("variations").description("Compare alternative versions of a campaign email (the editor's Canvas tab)").action(()=>os.help());S(os,{notes:["Variations never change what the campaign sends until you run `use`.","`generate` returns at once with variations in the generating state; pass --wait to block until each one is ready or failed.","`section-options` saves nothing: apply an option by swapping its replacement blocks into the variation and running `update`.","`edit` changes one variation with the AI and saves it (optionally only --sections).","--style close keeps the source's style, fresh takes different directions, bold designs each version anew with its own layout, colors and fonts."],examples:['sequenzy campaigns variations generate camp_123 --prompt "Three shorter, warmer versions" --wait','sequenzy campaigns variations generate camp_123 --prompt "Completely new style" --count 2 --style bold --parent var_456','sequenzy campaigns variations edit camp_123 var_456 --prompt "Make the hero dark" --sections hero_1',"sequenzy campaigns variations use camp_123 var_456"]});function CV(e){return e.option("--blocks-json <json>","Email blocks as JSON").option("--blocks-file <path>","Read email blocks JSON from a file").option("--html <html>","HTML content, converted to blocks").option("--html-file <path>","Read HTML content from a file").option("--subject <subject>","Subject this variation uses").option("--preview-text <text>","Preview text this variation uses").option("--summary <text>","What this version changes").option("--email-theme-json <json>","The variation's own email theme as JSON (partial themes are completed; null uses the email's)").option("--email-theme-file <path>","Read the variation's email theme JSON from a file").option("--font-family <family>","The variation's own body font (null uses the email's)")}var wV="close (edit, keep the source's style), fresh (default; new structure, brand look) or bold (new structure, colors and fonts)";os.command("list <campaignId>").description("List a campaign's variations").option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t)=>Bs("list",{id:e,...t}));os.command("get <campaignId> <variationId>").description("Show one variation").option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t,n)=>Bs("get",{id:e,variationId:t,...n}));os.command("generate <campaignId>").description("Generate variations with AI").requiredOption("--prompt <text>","Direction for the new versions").option("--count <n>","How many variations, 1-4 (default 3)").option("--parent <variationId>","Branch from this variation").option("--style <style>",`How far to move: ${wV}`).option("--wait","Wait until every variation is ready or failed").option("--timeout <seconds>","How long --wait waits (default 300)").option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t)=>Bs("generate",{id:e,...t}));CV(os.command("create <campaignId>").description("Save content as a new variation").requiredOption("--name <name>","Variation name").option("--parent <variationId>","Save it as a branch of this variation")).option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t)=>Bs("create",{id:e,...t}));CV(os.command("update <campaignId> <variationId>").description("Rename a variation, replace its content or move it").option("--name <name>","New name").option("--position <x,y>","Place it on the canvas at these coordinates").option("--reset-position","Let the canvas place it automatically")).option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t,n)=>Bs("update",{id:e,variationId:t,...n}));os.command("discard <campaignId> <variationId>").description("Discard a variation (restorable)").option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t,n)=>Bs("discard",{id:e,variationId:t,...n}));os.command("restore <campaignId> <variationId>").description("Bring back a discarded variation").option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t,n)=>Bs("restore",{id:e,variationId:t,...n}));os.command("use <campaignId> <variationId>").description("Put a variation's content in the campaign email (draft campaigns; the previous content is kept as a variation)").option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t,n)=>Bs("use",{id:e,variationId:t,...n}));os.command("edit <campaignId> <variationId>").description("Change one variation with AI and save it").requiredOption("--prompt <text>","What should change").option("--sections <ids>","Only change these comma-separated top-level block ids").option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t,n)=>Bs("edit",{id:e,variationId:t,...n}));os.command("section-options <campaignId>").description("Generate options for selected sections (nothing is saved)").requiredOption("--prompt <text>","What should change").requiredOption("--sections <ids>","Comma-separated top-level block ids").option("--variation <variationId>","Vary this variation instead of the email").option("--count <n>","How many options, 1-4 (default 3)").option("--style <style>",`How far to move: ${wV}`).option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t)=>Bs("section-options",{id:e,...t}));var mg=Je.command("forms").description("Inspect and update saved signup forms").action(()=>mg.help());S(mg,{notes:["Run `forms list --json` before replacing blocks so you can preserve the complete current block array.","Saved-form updates are partial: only the options you pass change.","When Webflow is connected, custom form embeds and their submission endpoints are disabled for that workspace; configure selected native forms in Settings -> Integrations -> Webflow."],examples:["sequenzy forms list --json",'sequenzy forms update form_123 --button-text "Join now"',"sequenzy forms update form_123 --theme-file ./theme.json"]});var JEe=mg.command("list").description("List saved forms and their current content").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON, including content blocks").action((e)=>Bf("list",e));S(JEe,{examples:["sequenzy forms list","sequenzy forms list --json"]});Je.command("submissions <type> <id>").description("Read form, popup or landing_page submission payloads").option("-c, --company <id>","Company ID override").option("--field <name>","Exact custom field name (requires --value)").option("--value <value>","Exact answer or array member (requires --field)").option("--limit <count>","Page size, 1 to 100 (default 50)").option("--cursor <cursor>","Resume from nextCursor").option("--json","Print complete JSON payloads and labels").option("--csv","Export all matching pages to stdout").action((e,t,n)=>Bf("submissions",{type:e,id:t,...n}));mg.command("submissions <id>").description("Read saved submitted answers and payloads; --csv exports all matching pages").option("-c, --company <id>","Company ID override").option("--field <name>","Exact custom field name (requires --value)").option("--value <value>","Exact answer or array member (requires --field)").option("--limit <count>","Page size, 1 to 100 (default 50)").option("--cursor <cursor>","Resume from nextCursor").option("--json","Print the complete page including labels and payloads").option("--csv","Export matching pages as CSV to stdout").action((e,t)=>Bf("submissions",{id:e,...t}));var VEe=mg.command("update <id>").description("Update a saved form").option("-n, --name <name>","Saved form name").option("-l, --list <ids...>","Replacement list IDs").option("-t, --tag <ids...>","Replacement tag IDs").option("--clear-tags","Remove every saved form tag").option("--duplicate-strategy <strategy>","Existing subscriber handling: skip, merge, or overwrite").option("--resubscribe-behavior <behavior>","Unsubscribed contacts who submit again: reactivate (default) or double_opt_in").option("--bot-protection","Run a Cloudflare bot check before each signup; failed checks confirm by email").option("--no-bot-protection","Turn the bot check off").option("--headline <text>","First main-form heading text").option("--description <text>","First main-form paragraph text").option("--button-text <text>","Submit button label").option("--success-message <text>","Success screen message").option("--redirect-url <url>","HTTP/HTTPS success redirect; pass an empty string to clear").option("--theme-json <json>","Inline partial capture theme JSON").option("--theme-file <file>","Path to partial capture theme JSON").option("--blocks-json <json>","Inline complete content blocks JSON").option("--blocks-file <file>","Path to complete content blocks JSON").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Bf("update",{id:e,...t}));S(VEe,{notes:["Use `forms list --json` and send the complete blocks array when replacing blocks.","The form must retain exactly one email field and one submit button.",'Group sibling blocks with { id, kind: "group", label, layout: "stack" | "row" | "grid" | "overlay", columns, gap, padding, overlayColor, overlayPosition, overlayShade, children }. In Overlay, gap spaces the foreground children while the direct image remains the background. Overlay needs exactly one direct image; nested images only enable their subgroup. Groups may nest three levels; IDs stay unique across the full tree.','Input blocks are { id, kind: "form-field", fieldType, name, label, required, mapsTo, options }. fieldType: text, email, phone, number, textarea, select, radio, checkbox, consent, hidden. mapsTo: email, firstName, lastName, phone, customAttribute (default; stores the answer under `name`). Choice fields need options: [{ value, label, id }] - label and id default to value.',"A hidden field with a defaultValue stores that server-owned value and ignores submitted values; a hidden field without one stores the value the page submits.",'Each block kind accepts only its own properties, and anything else is rejected by name: a custom-html block carries markup in "html" with a pixel "height", not "content".',"Use --clear-tags to replace the current tag targeting with an empty list."],examples:['sequenzy forms update form_123 --headline "Weekly planning" --button-text "Get the planner"',"sequenzy forms update form_123 --list list_123 list_456 --clear-tags","sequenzy forms update form_123 --theme-file ./form-theme.json --blocks-file ./form-blocks.json --json"]});var lc=Je.command("popups").description("Manage on-site signup popups").action(()=>lc.help());S(lc,{notes:["Popups are the on-site overlay capture surface; `forms` covers inline embedded forms.","A popup is deployed with one script tag - `popups embed <id>` prints it.","When Webflow is connected, `popups embed` returns the native Webflow configuration path instead of custom code, and existing popup scripts stop submitting for that workspace.","Popup updates are partial: only the options you pass change.","Trigger, targeting, schedule, frequency, visual, and reward patches are merged key by key, so setting one key keeps the rest.","A reward turns the popup into a scratch card: the visitor scratches a teaser, claims it with their email, and sees the reward value and code after submitting. The same value is saved to the subscriber's `discount` attribute for {{discount.code}} in emails."],examples:["sequenzy popups list --json",'sequenzy popups create --name "Welcome offer" --template discount-offer --list list_123',"sequenzy popups update pop_123 --status draft","sequenzy popups duplicate pop_123","sequenzy popups embed pop_123"]});var KEe=lc.command("list").description("List saved popups with their status and conversion stats").option("-c, --company <id>","Company ID override for personal API keys").option("--include-content","Include every popup's full content blocks (large)").option("--json","Print raw JSON").action((e)=>ul("list",e));S(KEe,{notes:["Content blocks are omitted by default because each popup adds roughly 1.8k characters. Use `popups get <id> --json` for one popup's full content."],examples:["sequenzy popups list","sequenzy popups list --json","sequenzy popups list --include-content --json"]});var WEe=lc.command("get <id>").description("Show one popup with its complete content").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON, including content blocks").action((e,t)=>ul("get",{id:e,...t}));S(WEe,{notes:["Run this with --json before replacing blocks so you can preserve the complete current block array."],examples:["sequenzy popups get pop_123 --json"]});var YEe=lc.command("create").description("Create a popup and print its embed script").requiredOption("-n, --name <name>","Internal popup name").option("--template <id>","Starting design: newsletter-modal, discount-offer, scratch-to-reveal, countdown-launch, minimal-slide-in, exit-lead-magnet, live-demo, launch-modal, paper-digest, stark-takeover, top-bar, announcement-bar, or fullscreen-welcome").option("--status <status>","draft or published (default: published)").option("-l, --list <ids...>","List IDs every signup is added to").option("--all-lists","Capture into every list (the default)").option("-t, --tag <ids...>","Tag IDs applied to every signup").option("--duplicate-strategy <strategy>","Existing subscriber handling: skip, merge, or overwrite").option("--resubscribe-behavior <behavior>","Unsubscribed contacts who submit again: reactivate (default) or double_opt_in").option("--bot-protection","Run a Cloudflare bot check before each signup; failed checks confirm by email").option("--no-bot-protection","Turn the bot check off").option("--headline <text>","First heading text").option("--description <text>","First paragraph text").option("--button-text <text>","Submit button label").option("--success-message <text>","Success screen message").option("--redirect-url <url>","HTTP/HTTPS success redirect").option("--presentation <mode>","modal, slide-in, floating-bar, or fullscreen").option("--placement <spot>","center, left, right, top, or bottom").option("--trigger-json <json>","Inline partial trigger JSON").option("--trigger-file <file>","Path to partial trigger JSON").option("--targeting-json <json>","Inline partial targeting JSON").option("--targeting-file <file>","Path to partial targeting JSON").option("--schedule-json <json>","Inline partial schedule JSON").option("--schedule-file <file>","Path to partial schedule JSON").option("--frequency-json <json>","Inline partial frequency JSON").option("--frequency-file <file>","Path to partial frequency JSON").option("--visual-json <json>","Inline partial visual JSON").option("--visual-file <file>","Path to partial visual JSON").option("--reward-json <json>","Inline partial scratch-to-reveal reward JSON").option("--reward-file <file>","Path to partial scratch-to-reveal reward JSON").option("--theme-json <json>","Inline partial capture theme JSON").option("--theme-file <file>","Path to partial capture theme JSON").option("--blocks-json <json>","Inline complete content blocks JSON").option("--blocks-file <file>","Path to complete content blocks JSON").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>ul("create",e));S(YEe,{notes:["Popups are published by default, so the embed script is live as soon as you paste it. Use --status draft to stage one.","Omit --list (or pass --all-lists) to capture into every list, matching the dashboard default.",`Trigger example: --trigger-json '{"type":"exit-intent"}' or '{"type":"delay","delaySeconds":10}'.`,`Reward example: --reward-json '{"enabled":true,"value":"10% off your first order","code":"WELCOME10","coverStyle":"gold"}'. The value and code are not in the embed script; the submit response returns them.`],examples:['sequenzy popups create --name "Welcome offer" --template discount-offer --list list_123',`sequenzy popups create --name "Scratch card" --template scratch-to-reveal --reward-json '{"value":"10% off your first order","code":"WELCOME10"}'`,`sequenzy popups create --name "Exit capture" --trigger-json '{"type":"exit-intent"}' --status draft`]});var ZEe=lc.command("update <id>").description("Update a popup, including publishing and unpublishing it").option("-n, --name <name>","Internal popup name").option("--status <status>","draft or published").option("-l, --list <ids...>","Replacement list IDs").option("--all-lists","Capture into every list").option("-t, --tag <ids...>","Replacement tag IDs").option("--clear-tags","Remove every popup tag").option("--duplicate-strategy <strategy>","Existing subscriber handling: skip, merge, or overwrite").option("--resubscribe-behavior <behavior>","Unsubscribed contacts who submit again: reactivate (default) or double_opt_in").option("--bot-protection","Run a Cloudflare bot check before each signup; failed checks confirm by email").option("--no-bot-protection","Turn the bot check off").option("--headline <text>","First heading text").option("--description <text>","First paragraph text").option("--button-text <text>","Submit button label").option("--success-message <text>","Success screen message").option("--redirect-url <url>","HTTP/HTTPS success redirect; pass an empty string to clear").option("--presentation <mode>","modal, slide-in, floating-bar, or fullscreen").option("--placement <spot>","center, left, right, top, or bottom").option("--trigger-json <json>","Inline partial trigger JSON").option("--trigger-file <file>","Path to partial trigger JSON").option("--targeting-json <json>","Inline partial targeting JSON").option("--targeting-file <file>","Path to partial targeting JSON").option("--schedule-json <json>","Inline partial schedule JSON").option("--schedule-file <file>","Path to partial schedule JSON").option("--frequency-json <json>","Inline partial frequency JSON").option("--frequency-file <file>","Path to partial frequency JSON").option("--visual-json <json>","Inline partial visual JSON").option("--visual-file <file>","Path to partial visual JSON").option("--reward-json <json>","Inline partial scratch-to-reveal reward JSON").option("--reward-file <file>","Path to partial scratch-to-reveal reward JSON").option("--theme-json <json>","Inline partial capture theme JSON").option("--theme-file <file>","Path to partial capture theme JSON").option("--blocks-json <json>","Inline complete content blocks JSON").option("--blocks-file <file>","Path to complete content blocks JSON").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ul("update",{id:e,...t}));S(ZEe,{notes:["Use `popups get <id> --json` and send the complete blocks array when replacing blocks.","The popup must retain exactly one email field and one submit button.",'Group sibling blocks with { id, kind: "group", label, layout: "stack" | "row" | "grid" | "overlay", columns, gap, padding, overlayColor, overlayPosition, overlayShade, children }. In Overlay, gap spaces the foreground children while the direct image remains the background. Overlay needs exactly one direct image; nested images only enable their subgroup. Groups may nest three levels; IDs stay unique across the full tree.','Each block kind accepts only its own properties, and anything else is rejected by name: a custom-html block carries markup in "html" with a pixel "height", not "content".',"`--status draft` stops a popup showing without deleting it or changing the embed script; `--status published` puts it back.","Use --clear-tags to replace the current tag targeting with an empty list, and --all-lists to capture into every list."],examples:['sequenzy popups update pop_123 --headline "Take 10% off" --button-text "Send my code"',"sequenzy popups update pop_123 --status draft",`sequenzy popups update pop_123 --targeting-json '{"paths":["/pricing"],"device":"desktop"}'`]});var XEe=lc.command("duplicate <id>").description("Copy a popup into a new draft with its own stats").option("-n, --name <name>",'Name for the copy (default: "... (copy)")').option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ul("duplicate",{id:e,...t}));S(XEe,{notes:["The copy starts as a draft with its own view and conversion counts, so the original keeps showing and keeps its stats.","Publish the copy with `popups update <new-id> --status published`."],examples:["sequenzy popups duplicate pop_123",'sequenzy popups duplicate pop_123 --name "Welcome offer v2"']});var eIe=lc.command("embed <id>").description("Print a published popup's embed snippets").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON, including React, WordPress, and Shopify").action((e,t)=>ul("embed",{id:e,...t}));S(eIe,{notes:["The popup must be published; publish it with `popups update <id> --status published`.","The snippet carries no API key - trigger, targeting, and audience rules stay server-side."],examples:["sequenzy popups embed pop_123","sequenzy popups embed pop_123 --json"]});var tIe=lc.command("delete <id>").description("Permanently delete a popup and its stats").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ul("delete",{id:e,...t}));S(tIe,{notes:["This also deletes the popup's view and conversion counts. To stop it showing while keeping its stats, use `popups update <id> --status draft`.","Subscribers the popup already captured are not affected."],examples:["sequenzy popups delete pop_123"]});var Wo=Je.command("landing-pages").description("Manage landing pages").action(()=>Wo.help());S(Wo,{notes:["Landing pages are created as drafts. Publish only after reviewing the page.","Use landing-pages render to open a signed, unlisted preview of a draft without publishing.","Use --content-json or --content-file for full editor-compatible landing page content.","Custom subdomains require a CNAME record pointing to pages.sequenzydns.com; root domains require an A record pointing to 76.76.21.21."],examples:["sequenzy landing-pages list --company comp_123",'sequenzy landing-pages create "Product Waitlist" --template waitlist',"sequenzy landing-pages render lp_123","sequenzy landing-pages stats lp_123 --period 30d","sequenzy landing-pages publish lp_123","sequenzy landing-pages connect-domain pages.example.com"]});var nIe=Wo.command("list").description("List landing pages").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>di("list",e));S(nIe,{examples:["sequenzy landing-pages list --company comp_123"]});var rIe=Wo.command("get <id>").description("Get landing page details").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>di("get",{id:e,...t}));S(rIe,{examples:["sequenzy landing-pages get lp_123 --company comp_123"]});var oIe=Wo.command("stats <id>").description("Get landing page visit analytics").option("-c, --company <id>","Company ID override for personal API keys").option("--period <period>","Time window: 7d, 30d, 90d, or all").option("--start <timestamp>","Custom range start, ISO 8601").option("--end <timestamp>","Custom range end, ISO 8601").option("--include-bots","Include known crawlers in visit totals").option("--json","Print raw JSON").action((e,t)=>di("stats",{id:e,...t}));S(oIe,{notes:["Reports visits, unique visits, clicks, subscribes, conversion rate, referrers, and crawler hits. Preview URLs and the editor are never counted."],examples:["sequenzy landing-pages stats lp_123 --period 30d"]});var iIe=Wo.command("render <id>").description("Preview a landing page without publishing it").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>di("render",{id:e,...t}));S(iIe,{notes:["Returns a signed, unlisted preview URL that works for drafts. Signup forms do not collect contacts until you publish."],examples:["sequenzy landing-pages render lp_123"]});var sIe=Wo.command("create [name]").description("Create a draft landing page").option("--slug <slug>","Landing page URL slug").option("--template <template>","Template key, e.g. waitlist").option("--content-json <json>","Inline landing page content JSON").option("--content-file <file>","Path to landing page content JSON").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>di("create",{name:e,...t}));S(sIe,{notes:["When --content-json/--content-file is omitted, a valid default page is generated from --template."],examples:['sequenzy landing-pages create "Product Waitlist" --template waitlist','sequenzy landing-pages create "Launch Page" --slug launch --content-file ./landing-page.json']});var aIe=Wo.command("update <id>").description("Edit a landing page").option("-n, --name <name>","Landing page name").option("--slug <slug>","Landing page URL slug").option("--content-json <json>","Inline landing page content JSON").option("--content-file <file>","Path to landing page content JSON").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>di("update",{id:e,...t}));S(aIe,{examples:['sequenzy landing-pages update lp_123 --name "Updated page"',"sequenzy landing-pages update lp_123 --content-file ./landing-page.json"]});var cIe=Wo.command("publish <id>").description("Publish a landing page").option("-n, --name <name>","Landing page name").option("--slug <slug>","Landing page URL slug").option("--content-json <json>","Inline landing page content JSON").option("--content-file <file>","Path to landing page content JSON").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>di("publish",{id:e,...t}));S(cIe,{examples:["sequenzy landing-pages publish lp_123"]});var lIe=Wo.command("unpublish <id>").description("Unpublish a landing page").option("-n, --name <name>","Landing page name").option("--slug <slug>","Landing page URL slug").option("--content-json <json>","Inline landing page content JSON").option("--content-file <file>","Path to landing page content JSON").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>di("unpublish",{id:e,...t}));S(lIe,{examples:["sequenzy landing-pages unpublish lp_123"]});var uIe=Wo.command("duplicate <id>").description("Duplicate a landing page as a new draft").option("-n, --name <name>","Name for the copy").option("--slug <slug>","URL slug for the copy").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>di("duplicate",{id:e,...t}));S(uIe,{notes:["The copy is always created as a draft with its own slug, views, and conversions.",'Without --name, the copy is named "<original name> (copy)".'],examples:["sequenzy landing-pages duplicate lp_123",'sequenzy landing-pages duplicate lp_123 --name "Spring Sale v2" --slug spring-sale-v2']});var dIe=Wo.command("delete <id>").description("Delete a landing page").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>di("delete",{id:e,...t}));S(dIe,{examples:["sequenzy landing-pages delete lp_123"]});var pIe=Wo.command("connect-domain <domain>").description("Connect a workspace or dedicated landing page domain").option("--landing-page <id>","Connect the domain only to this landing page").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>di("connect-domain",{domain:e,...t}));S(pIe,{examples:["sequenzy landing-pages connect-domain pages.example.com --company comp_123","sequenzy landing-pages connect-domain offer.example.com --landing-page lp_123","sequenzy landing-pages connect-domain example.com --landing-page lp_123"]});var mIe=Wo.command("update-domain-settings").description("Update or verify landing page domain settings").option("--domain <domain>","Replace the connected landing page domain").option("--verify","Refresh domain verification state").option("--landing-page <id>","Target a dedicated landing page domain").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>di("update-domain-settings",e));S(mIe,{examples:["sequenzy landing-pages update-domain-settings --domain pages.example.com","sequenzy landing-pages update-domain-settings --verify","sequenzy landing-pages update-domain-settings --landing-page lp_123 --verify"]});var fIe=Wo.command("remove-domain <landing-page-id>").description("Remove a dedicated domain from one landing page").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>di("remove-domain",{landingPage:e,...t}));S(fIe,{examples:["sequenzy landing-pages remove-domain lp_123"]});var Gt=Je.command("sequences").description("Manage email sequences").action(()=>Gt.help());S(Gt,{notes:["The CLI supports both AI goal-based sequence creation and explicit-step creation.","Trigger-specific options depend on --trigger. For example: contact_added needs --list-id (or --list-ids for several lists), tag_added needs --tag-name (or --tag-names), inactivity needs --event-name and --inactive-days.","Use --goal for AI generation, or --steps-file / --emails-file with JSON arrays that match the API step objects.","Use --enrollment-mode matching_field for product- or variant-specific event sequences.",'Explicit --steps-file input can include dynamic Stripe or Shopify discount actions with {"type":"create_discount","discount":{"provider":"stripe","discountType":"percent","percentOff":20,"duration":"once","appliesToAllPlans":true}}; the code is created when each subscriber reaches the step, and later emails can use {{discount.code}}.',"Discount action sequences require the selected provider integration, such as Stripe or Shopify, before enabling.",ug],examples:["sequenzy sequences list --company comp_123",'sequenzy sequences create onboarding --trigger event_received --event-name signup.completed --goal "Guide new users to activation"',"sequenzy sequences create onboarding --trigger contact_added --list-id list_123 --steps-file ./steps.json","sequenzy sequences update seq_123 --steps-file ./sequence-updates.json","sequenzy sequences enable seq_123","sequenzy sequences simulate seq_123","sequenzy sequences simulate seq_123 --email maya@example.com"]});var gIe=Gt.command("list").description("List sequences").option("--status <status>","Filter by draft, active, paused, or archived").option("--search <text>","Search sequence names and descriptions").option("--label <labels...>","Filter by dashboard label names").option("--limit <count>","Page size from 1 to 100").option("--offset <count>","Zero-based result offset").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>Cn("list",e));S(gIe,{examples:["sequenzy sequences list --company comp_123"]});var AIe=Gt.command("get <id>").description("Get sequence details").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Cn("get",{id:e,...t}));S(AIe,{examples:["sequenzy sequences get seq_123 --company comp_123"]});var hIe=Gt.command("edit-emails <id>").description("Change the sequence's emails with AI in one request: every email, the ones the prompt names, or the ones you list").requiredOption("--prompt <text>","What should change").option("--emails <ids>","Only these comma-separated email IDs (from sequences get)").option("--sections <ids>","Only these comma-separated top-level block IDs; needs exactly one --emails ID").option("--dry-run","Return the changes without saving them").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>M3({id:e,...t}));S(hIe,{notes:['Without --emails, the prompt decides: it changes every email unless it names some ("change the structure of email 2").',"A look change (background, colors, fonts) is made identical across the emails it touches.","A/B test steps, HTML emails and steps without an email are skipped and listed.","Each email succeeds or fails on its own; changed emails are saved unless --dry-run is set. One request edits up to 12 emails; edit longer sequences in batches with --emails. If the command times out, run sequences get before retrying: changes may already be saved."],examples:['sequenzy sequences edit-emails seq_123 --prompt "Make the background cream"','sequenzy sequences edit-emails seq_123 --prompt "Remove the header" --dry-run --json','sequenzy sequences edit-emails seq_123 --prompt "New structure" --emails email_2','sequenzy sequences edit-emails seq_123 --prompt "Stronger headline" --emails email_2 --sections hero_1']});var Qp=Gt.command("variations").description("Design variations of one email of a sequence, then use one for it or every email (the editor's Emails view)").action(()=>Qp.help());S(Qp,{notes:["Variations never change the email until you run `use`.","`generate` returns at once with variations in the generating state; pass --wait to block until each one is ready or failed.","`use` saves the variation's design (blocks, theme, font) into the email, which keeps its subject and preview text. With --all, every other email takes its style too, keeping its own words.","Preview one with: sequenzy sequences render <id> --node <nodeId> --variation <variationId>"],examples:['sequenzy sequences variations generate seq_123 --email email_1 --prompt "A few bolder versions" --wait',"sequenzy sequences variations list seq_123 --email email_1","sequenzy sequences variations use seq_123 var_456 --email email_1 --all --dry-run","sequenzy sequences variations discard seq_123 var_456 --email email_1"]});Qp.command("list <id>").description("List an email's variations").requiredOption("--email <emailId>","The email's ID (from sequences get)").option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t)=>ig("list",{id:e,...t}));Qp.command("generate <id>").description("Design variations of an email with AI").requiredOption("--email <emailId>","The email's ID (from sequences get)").requiredOption("--prompt <text>","What the variations should explore").option("--count <n>","How many variations, 1-4 (default 3)").option("--style <style>","close (keep its style), fresh (default; other structures, brand look) or bold (also its own look)").option("--wait","Wait until every variation is ready or failed").option("--timeout <seconds>","How long --wait waits (default 300)").option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t)=>ig("generate",{id:e,...t}));Qp.command("use <id> <variationId>").description("Save a variation's design into the email, or with --all every email's style").requiredOption("--email <emailId>","The email's ID (from sequences get)").option("--all","Every other email takes the variation's style too").option("--dry-run","Show what would change without saving").option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t,n)=>ig("use",{id:e,variationId:t,...n}));Qp.command("discard <id> <variationId>").description("Discard a variation").requiredOption("--email <emailId>","The email's ID (from sequences get)").option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t,n)=>ig("discard",{id:e,variationId:t,...n}));var yIe=jB(Gt.command("render <id>").description("Render one sequence email step to email-ready HTML").requiredOption("--node <nodeId>","Email step node ID from sequences get").option("--variant <id>","Render a specific A/B test variant").option("--variation <id>","Render a design variation of the email (from variations list)")).action((e,t)=>cb({type:"sequence-step",sequenceId:e,nodeId:t.node},t));S(yIe,{notes:HB,examples:["sequenzy sequences render seq_123 --node node_1 --out preview.html","sequenzy sequences render seq_123 --node node_1 --subscriber sub_123 --json","sequenzy sequences render seq_123 --node node_1 --email you@example.com --tag extended"]});var bIe=zB(Gt.command("check <id>").description("Check one sequence email step: broken links and images, placeholders, content and client issues").requiredOption("--node <nodeId>","Email step node ID from sequences get").option("--variant <id>","Check a specific A/B test variant")).action((e,t)=>lb({type:"sequence-step",sequenceId:e,nodeId:t.node},t));S(bIe,{notes:MB,examples:["sequenzy sequences check seq_123 --node node_1","sequenzy sequences check seq_123 --node node_1 --fail-on warning --json"]});var vIe=Gt.command("test <id>").description("Send a test email for one saved sequence step").requiredOption("--node <nodeId>","Email step node ID from sequences get").requiredOption("--to <emails...>","One or more reviewer email addresses (maximum 10)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Cn("test",{id:e,...t,nodeId:t.node}));S(vIe,{notes:["This sends only the selected saved email step; it does not enable the sequence or enroll subscribers.","Use sequences get first to find the email step nodeId."],examples:["sequenzy sequences test seq_123 --node node_email_2 --to reviewer@example.com","sequenzy sequences test seq_123 --node node_email_2 --to reviewer-one@example.com reviewer-two@example.com"]});Gt.command("test-run <id>").description("Run real sequence actions for one subscriber with optional event properties").requiredOption("--subscriber <id>","Active subscriber ID").option("--event-properties <json>","Trigger event properties as a JSON object, including arrays and nested objects").option("--speed-multiplier <number>","Delay acceleration, 60 to 10000","120").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Cn("test-run",{id:e,...t}));Gt.command("test-run-get <id> <runId>").description("Inspect live sequence test status and step logs").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON including step logs").action((e,t,n)=>Cn("test-run-get",{id:e,runId:t,...n}));var EIe=Gt.command("simulate <id>").description("Preview who a sequence would enroll and, optionally, one contact's path. Does not send mail or enroll anyone.").option("--subscriber <id>","Walk the graph for this stored subscriber").option("--email <address>","Walk the graph for this stored subscriber email").option("--limit <number>","Maximum current matches to sample (1-25)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Cn("simulate",{id:e,...t,simulateEmail:typeof t.email==="string"?t.email:void 0}));S(EIe,{notes:["Without --subscriber/--email this reports who currently matches and whether the sequence is ready. Nobody is auto-enrolled when you activate; list, tag, and segment matches can still be enrolled by hand.","This does not send mail, mint discounts, or write tags. Use sequences test to send one saved email step to a reviewer.","Readiness errors are the same checks that should be fixed before sequences enable."],examples:["sequenzy sequences simulate seq_123","sequenzy sequences simulate seq_123 --email maya@example.com","sequenzy sequences simulate seq_123 --subscriber sub_123 --limit 25 --json"]});function SV(e){return e.option("--description <text>","Goal description").option("--trigger-type <type>","Goal signal: event, attribute_change, or tag_added").option("--trigger-event-name <event>","Event goal signal name").option("--trigger-tag-name <tag>","Tag name for tag_added goals").option("--attribute-path <path>","Subscriber attribute goal path").option("--attribute-condition <condition>","changed, changed_to, or changed_from_to").option("--attribute-value <value>","Target subscriber attribute value").option("--attribute-previous-value <value>","Previous subscriber attribute value").option("--event-property-name <name>","Optional event property whose value is tracked").option("--event-property-label <label>","Display label for the tracked event property").option("--attribution-window-hours <hours>","Goal attribution window in hours")}var Tv=Gt.command("goals").description("Manage persisted sequence conversion goals");Tv.command("list <sequenceId>").description("List sequence goals").option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t)=>Cn("goals",{id:e,...t}));SV(Tv.command("create <sequenceId> <name>").description("Create a sequence conversion goal")).option("--active","Create the goal with conversion tracking on (default)").option("--inactive","Create the goal with conversion tracking off").option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t,n)=>Cn("goal-create",{id:e,name:t,isActive:n.active,notActive:n.inactive,...n}));SV(Tv.command("update <sequenceId> <goalId>").description("Update a sequence conversion goal").option("--name <name>","Goal name")).option("--active","Enable the goal").option("--inactive","Disable the goal").option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t,n)=>Cn("goal-update",{id:e,goalId:t,isActive:n.active,notActive:n.inactive,...n}));Tv.command("delete <sequenceId> <goalId>").description("Delete a sequence conversion goal").option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t,n)=>Cn("goal-delete",{id:e,goalId:t,...n}));var GB=Gt.command("webhook").description("Manage a sequence inbound webhook endpoint");GB.command("get <sequenceId>").description("Read a sequence inbound webhook URL and setup status").option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t)=>Cn("webhook-get",{id:e,...t}));GB.command("configure <sequenceId>").description("Create or update a sequence inbound webhook endpoint").option("--field-mapping-json <json>","Inline mapping with email, optional names, and property paths").option("--field-mapping-file <file>","JSON file containing the webhook field mapping").option("--sample-payload-json <json>","Inline representative webhook payload").option("--sample-payload-file <file>","JSON file containing a representative webhook payload").option("--clear-field-mapping","Clear the saved mapping and return the endpoint to pending setup").option("--clear-sample-payload","Clear the saved sample payload").option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t)=>Cn("webhook-configure",{id:e,...t}));GB.command("rotate <sequenceId>").description("Rotate a sequence inbound webhook secret and URL").option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t)=>Cn("webhook-rotate",{id:e,...t}));var IIe=Gt.command("create <name>").description("Create a blank, AI-generated, or explicit-step sequence").option("-t, --trigger <trigger>","Sequence trigger type (defaults to contact_added; manual never auto-enrolls)").option("--description <text>","Sequence description").option("--label <labels...>","Dashboard label names to assign").option("--user-cancellable","Allow subscribers to cancel enrollment").option("--not-user-cancellable","Prevent subscribers from cancelling enrollment").option("--from-email <email>","Sequence-level From address").option("--from-name <name>","Display name for --from-email; picks or creates the identity of that name on the address").option("--sender-profile-id <id>",A4).option("--reply-to <email>","Sequence-level Reply-To address").option("--reply-to-name <name>","Display name for --reply-to; a saved profile keeps its own name and the response warns").option("--reply-profile-id <id>","Existing reply profile ID; carries its own name, so omit --reply-to and --reply-to-name").option("--bcc-emails <emails>","Comma-separated sequence-level BCC addresses (max 10)").option("-g, --goal <goal>","AI generation goal for the sequence").option("--email-count <count>","Number of AI-generated emails when using --goal (1-10)").option("--duration-days <days>","Total duration in days for AI-generated sequence delays when using --goal").option("--email-style <style>","Style for AI-generated emails when using --goal: visual (designed) or plain (text-first)").option("--enrollment-mode <mode>","Enrollment mode: unlimited, one_time, or matching_field").option("--enrollment-field-path <path>","Event property dot path used by matching_field enrollment").option("--sending-window-start <time>","Earliest local send time for sequence emails (HH:mm, e.g. 08:00)").option("--sending-window-end <time>","Latest local send cutoff for sequence emails (HH:mm, e.g. 20:00)").option("--sending-window-timezone <timezone>","IANA timezone for the sequence sending window, e.g. Europe/Kiev").option("--sending-window-days <days>","Comma-separated days for sequence sends, e.g. weekdays or mon,tue,wed,thu,fri").option("--respect-frequency-cap","Skip email steps for contacts already at the company frequency cap").option("--key-date <entries...>",'Key date as "Label=2026-11-27T00:00:00" (repeatable; zone-less times are read in --key-dates-timezone); optionally "key:Label=..." to pin the key. Requires --key-dates-timezone').option("--key-dates-timezone <timezone>","IANA timezone the key dates are written in, e.g. America/New_York").option("--key-dates-json <json>",'Inline key dates: {"timezone":"America/New_York","dates":[{"label":"Black Friday starts","at":"2026-11-27T00:00:00-05:00"}]}').option("--key-dates-file <file>","JSON file with the key dates object").option("--list-id <id>","List ID for contact_added triggers").option("--list-ids <ids...>","Several list IDs for contact_added; joining any one of them enrols the contact").option("--list-scope <scope>","contact_added with no list: any_contact (default, includes contacts in no list) or any_list").option("--tag-name <name>","Tag name for tag_added triggers").option("--tag-names <names...>","Several tag names for tag_added; receiving any one of them enrols the contact").option("--segment-id <id>","Segment ID for segment_entered and segment_exited triggers").option("--stop-on-segment-exit","Cancel active enrollments when a contact leaves the trigger segment").option("--event-name <name>","Event name for event_received, inbound_webhook, inactivity, and frequency triggers").option("--integration-slug <slug>","Inbound webhook integration slug").option("--integration-event-key <key>","Inbound webhook integration event key").option("--custom-integration-json <json>","Inline custom inbound webhook integration descriptor").option("--custom-integration-file <file>","JSON file with a custom inbound webhook integration descriptor").option("--property-filters-json <json>","Inline JSON array of event property filters for event_received triggers").option("--property-filters-file <file>","Path to a JSON file with event property filters").option("--inactive-days <days>","Days of inactivity for inactivity triggers").option("--inactivity-baseline <baseline>","Inactivity baseline: sequence_created_at or subscriber_created_at").option("--min-count <count>","Minimum event count for frequency triggers").option("--time-window-days <days>","Time window for frequency triggers").option("--steps-json <json>","Inline JSON array of sequence steps").option("--steps-file <file>","Path to a JSON file with sequence steps").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Cn("create",{name:e,...t}));S(IIe,{notes:["Provide --goal for AI generation, --steps-json/--steps-file for explicit content, or omit both for a blank dashboard-compatible draft.","Each explicit email step needs subject plus either html or blocks. Discount action steps use type=create_discount to dynamically create a code before an email that references {{discount.code}}.",'SMS steps use type="sms" with a plain-text "text" field (optional label, ineligibleAction skip|exit, imageUrls). Generate copy with `sequenzy generate sms` and check `sequenzy sms settings` first.','Update Subscriber steps use type="update_subscriber", nodeType="action_update_attributes", and config values such as {{event.plan}}, {{event.amount}}, or {{event.active}}.',"For migrated provider flows, put the exact provider HTML in each step's html field; Sequenzy stores it as raw HTML. Use delay or delayMs for waits.",'A step may use waitUntilWeekday to hold until the next weekday window, e.g. {"waitUntilWeekday":{"day":"sunday","startTime":"09:00","endTime":"12:00","timezone":"America/Los_Angeles"},"subject":"Weekly digest","html":"..."}. Contacts already inside the window continue immediately; put it before the first email to guarantee the send day at the graph level. Add "timezoneSource":"subscriber" to use the timezone of each contact; timezone is then the fallback for contacts without one. Add "minimumWait":{"days":6} to wait at least 6 days first, then release at the next window, in one step.',"Prefer --steps-file for anything non-trivial. The CLI passes the JSON through to the API.","Shopify replenishment and back-in-stock event sequences default to matching_field.","Use --enrollment-field-path for custom event keys such as order.id or product.providerVariantId.",'Calendar countdowns: use --trigger manual with --key-date entries (plus --key-dates-timezone) and give steps a waitUntilKeyDate, e.g. {"subject":"7 days to go","waitUntilKeyDate":{"key":"black_friday_starts","days":7}}. Keys are slugs of the labels. Then enable the sequence and run sequenzy sequences enroll-audience.',"Use --property-filters-json/--property-filters-file with event_received triggers to only start the sequence when the event properties match, e.g. scope a purchase sequence to one product.","Use --sending-window-start/--sending-window-end/--sending-window-timezone to hold every email step until the allowed local send window. Add --sending-window-days weekdays for working days only.","Use --trigger segment_exited --segment-id <id> to enroll active contacts who stop matching a saved segment, for example a win-back flow. Unsubscribing or bouncing does not count as leaving, and nobody is enrolled when the sequence is turned on.","Discount action sequences require the selected provider integration, such as Stripe or Shopify, before enabling."],examples:['sequenzy sequences create onboarding --trigger event_received --event-name signup.completed --goal "Guide new users to activation" --email-count 4 --duration-days 10','sequenzy sequences create trial --trigger tag_added --tag-name trial --goal "Convert trial users" --sending-window-start 08:00 --sending-window-end 20:00 --sending-window-timezone Europe/Kiev --sending-window-days weekdays',"sequenzy sequences create restock --trigger event_received --event-name ecommerce.back_in_stock --enrollment-mode matching_field --steps-file ./steps.json",`sequenzy sequences create deliver-ebook --trigger event_received --event-name ecommerce.order_placed --property-filters-json '[{"path":"lineItems[].providerProductId","operator":"equals","value":"prod_123"}]' --steps-file ./steps.json`,"sequenzy sequences create post-purchase --trigger event_received --event-name ecommerce.order_placed --enrollment-mode matching_field --enrollment-field-path order.id --steps-file ./steps.json",'sequenzy sequences create "Black Friday countdown" --trigger manual --enrollment-mode one_time --key-dates-timezone America/New_York --key-date "Black Friday starts=2026-11-27T00:00:00" --key-date "Black Friday ends=2026-11-29T23:59:00" --steps-file ./countdown-steps.json',"sequenzy sequences create onboarding --trigger contact_added --list-id list_123 --steps-file ./steps.json",`sequenzy sequences create purchase-profile --trigger event_received --event-name saas.purchase --steps-json '[{"type":"update_subscriber","nodeType":"action_update_attributes","config":{"customAttributeUpdates":[{"name":"plan","value":"{{event.plan}}","valueType":"text"}]}},{"subject":"Thanks","html":"<p>Purchase received.</p>"}]'`,"sequenzy sequences create rescue --trigger inactivity --event-name login --inactive-days 14 --steps-file ./steps.json"]});var CIe=Gt.command("from-example <example>").description("Clone an email gallery sequence into a draft sequence written for your brand").option("--brief <text>","Extra direction for every email (takes priority over the example)").option("--name <name>","Sequence name (defaults to the sequence type)").option("--steps <numbers>","Which of the example's emails to clone, by position, e.g. 1,2,4 (default: the first 12)").option("--email-style <style>","Generated email style: visual or plain").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>oM(e,t));S(CIe,{notes:["<example> is a gallery sequence URL (https://sequenzy.com/email-examples/brands/{brand}/sequences/{sequence}) or brand/sequence.","Copies the trigger family and send timing (up to 12 emails; --steps picks which, and each kept email keeps its original timing). AI writes each email in your brand in the background; check progress with sequenzy sequences get <id>.","The sequence is created as a draft and sends nothing until you enable it. Running the command again creates another sequence."],examples:["sequenzy sequences from-example https://sequenzy.com/email-examples/brands/linear/sequences/onboarding",'sequenzy sequences from-example linear/onboarding --brief "Push people to invite a teammate"',"sequenzy sequences from-example linear/onboarding --steps 1,2,4"]});var wIe=Gt.command("preview-example <example>").description("Preview the first emails of an email gallery sequence written for your brand, without saving").option("--website <site>","Write it for another website instead of your brand, e.g. acme.com").option("--brief <text>","Extra direction for every email (takes priority over the example)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON, including each email's HTML").action((e,t)=>lM(e,t));S(wIe,{notes:["<example> is a gallery sequence URL (https://sequenzy.com/email-examples/brands/{brand}/sequences/{sequence}) or brand/sequence.","Rewrites the first 3 emails and saves nothing. Clone the sequence with sequenzy sequences from-example to write every email."],examples:["sequenzy sequences preview-example linear/onboarding","sequenzy sequences preview-example linear/onboarding --website acme.com --json"]});var SIe=Gt.command("update <id>").description("Update sequence metadata, email step content, stop conditions, or paths").option("-n, --name <name>","Sequence name").option("--description <text>","Sequence description").option("--label <labels...>","Replace dashboard label names").option("--clear-labels","Remove all dashboard labels from the sequence").option("--user-cancellable","Allow subscribers to cancel enrollment").option("--not-user-cancellable","Prevent subscribers from cancelling enrollment").option("--trigger <trigger>","Replace the sequence trigger type").option("--list-id <id>","List ID for contact_added").option("--list-ids <ids...>","Several list IDs for contact_added; joining any one of them enrols the contact").option("--list-scope <scope>","contact_added with no list: any_contact (default, includes contacts in no list) or any_list").option("--tag-name <name>","Tag name for tag_added").option("--tag-names <names...>","Several tag names for tag_added; receiving any one of them enrols the contact").option("--segment-id <id>","Segment ID for segment_entered or segment_exited").option("--stop-on-segment-exit","Stop active enrollments when a contact leaves the trigger segment").option("--no-stop-on-segment-exit","Keep active enrollments running when a contact leaves the trigger segment").option("--event-name <event>","Event name for event, webhook, inactivity, or frequency triggers").option("--integration-slug <slug>","Catalog integration slug for inbound_webhook").option("--integration-event-key <key>","Catalog event key for inbound_webhook").option("--custom-integration-json <json>","Inline custom inbound webhook integration descriptor").option("--custom-integration-file <file>","JSON file containing a custom inbound webhook integration descriptor").option("--property-filters-json <json>","Inline event trigger property filters").option("--property-filters-file <file>","JSON file containing event trigger property filters").option("--inactive-days <days>","Days required for inactivity").option("--inactivity-baseline <baseline>","Inactivity baseline: sequence_created_at or subscriber_created_at").option("--min-count <count>","Minimum frequency event count").option("--time-window-days <days>","Frequency lookback window").option("--from-email <email>","Sequence-level From address").option("--from-name <name>","Display name for --from-email; picks or creates the identity of that name on the address").option("--sender-profile-id <id>",h4).option("--reply-to <email>","Sequence-level Reply-To address").option("--reply-to-name <name>","Display name for --reply-to; a saved profile keeps its own name and the response warns").option("--reply-profile-id <id>","Existing reply profile ID; carries its own name, so omit --reply-to and --reply-to-name").option("--enrollment-mode <mode>","Enrollment mode: unlimited, one_time, or matching_field").option("--enrollment-field-path <path>","Event property dot path used by matching_field enrollment").option("--pause-new-enrollments","Stop new sequence enrollments while current recipients continue").option("--resume-new-enrollments","Resume new sequence enrollments while current recipients continue").option("--sending-window-start <time>","Earliest local send time for sequence emails (HH:mm, e.g. 08:00)").option("--sending-window-end <time>","Latest local send cutoff for sequence emails (HH:mm, e.g. 20:00)").option("--sending-window-timezone <timezone>","IANA timezone for the sequence sending window, e.g. Europe/Kiev").option("--sending-window-days <days>","Comma-separated days for sequence sends, e.g. weekdays or mon,tue,wed,thu,fri").option("--clear-sending-window","Disable the sequence sending window").option("--respect-frequency-cap","Skip email steps for contacts already at the company frequency cap").option("--ignore-frequency-cap","Stop applying the company frequency cap to this sequence").option("--key-date <entries...>",'Key date as "Label=2026-11-27T00:00:00" (repeatable; zone-less times are read in --key-dates-timezone); optionally "key:Label=..." to pin the key. Requires --key-dates-timezone').option("--key-dates-timezone <timezone>","IANA timezone the key dates are written in, e.g. America/New_York").option("--key-dates-json <json>",'Inline key dates: {"timezone":"America/New_York","dates":[{"label":"Black Friday starts","at":"2026-11-27T00:00:00-05:00"}]}').option("--key-dates-file <file>","JSON file with the key dates object").option("--clear-key-dates","Remove every key date from the sequence").option("--auto-enroll-all","Keep enrolling every new contact until the last key date (manual countdowns)").option("--auto-enroll-list-ids <ids...>","Keep enrolling people who join these lists until the last key date").option("--auto-enroll-segment-id <id>","Keep enrolling people who enter this segment until the last key date").option("--auto-enroll-json <json>","Keep enrolling later joiners of this audience object until the last key date").option("--auto-enroll-starts-at <datetime>","With --auto-enroll-*, do not sync before this ISO 8601 date-time (match a scheduled enroll-audience start)").option("--clear-auto-enroll","Stop auto-enrolling later joiners").option("--bcc-emails <emails>","Comma-separated BCC addresses copied on every email this sequence sends, e.g. a support inbox (max 10)").option("--clear-bcc-emails","Remove the sequence BCC addresses").option("--confirm-structural-change","Confirm an insertSteps or branch structural edit to an active sequence").option("--confirm-live-change","Confirm node config edits to an active sequence").option("--steps-json <json>","Inline JSON array of step updates").option("--steps-file <file>","Path to a JSON file with step updates").option("--emails-json <json>","Inline JSON array of email updates; native-block emails, including supported custom HTML blocks, may set emailPreset to branded or minimal, and emailTheme patches that one step's theme (null clears the override)").option("--emails-file <file>","Path to a JSON file with email updates; native-block emails, including supported custom HTML blocks, may set emailPreset to branded or minimal, and emailTheme patches that one step's theme (null clears the override)").option("--sms-steps-json <json>","Inline JSON array of SMS step content updates (targeted by nodeId)").option("--sms-steps-file <file>","Path to a JSON file with SMS step content updates").option("--subscriber-update-steps-json <json>","Inline JSON array of Update Subscriber configs targeted by nodeId").option("--subscriber-update-steps-file <file>","Path to a JSON file with Update Subscriber configs targeted by nodeId").option("--branch-json <json>","Inline JSON object for inserting an if/else branch, or a random A/B split, with path steps and/or existing target node IDs").option("--branch-file <file>","Path to a JSON file for inserting an if/else branch with path steps and/or existing target node IDs").option("--insert-steps-json <json>","Inline JSON object for inserting new linear steps").option("--insert-steps-file <file>","Path to a JSON file for inserting new linear steps").option("--node-updates-json <json>","Inline typed nodeUpdates array from sequences get; action_email changes accept emailTheme to restyle one step without touching the company theme").option("--node-updates-file <file>","JSON file containing typed nodeUpdates").option("--graph-edit-json <json>","Inline graphEdit object using the current graphRevision").option("--graph-edit-file <file>","JSON file containing a graphEdit operation").option("--stop-condition-json <json>","Inline JSON object for updating the sequence stop condition").option("--stop-condition-file <file>","Path to a JSON file for updating the sequence stop condition").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Cn("update",{id:e,...t}));S(SIe,{notes:["Use either the steps form or the emails form, not both.","Each update entry can target a step by nodeId, emailId, or by array order.","Use --insert-steps-json/--insert-steps-file to add new linear steps, including outbound webhooks and AI steps; use --steps-* or --emails-* to edit existing email steps.",'AI steps generate a short per-contact fragment at send time (a sentence or two that a later email inserts, not a whole email): {"nodeType":"action_ai","config":{"prompt":"Write a winback subject for {{first_name}}","resultKey":"winback","outputFields":[{"key":"subject_line","fallback":"We miss you"}]}}. Later steps use {{ai.winback.subject_line}}. Opt into context with includeTags, includeEventProperties, includeRecentEvents (plus recentEventLimit, 1-50), and includeAttributes.','Inserted steps can be SMS steps: {"type":"sms","text":"...","delay":{"days":1}}. Generate copy with `sequenzy generate sms`.','Edit existing SMS steps with --sms-steps-json/--sms-steps-file: [{"nodeId":"node_sms","text":"New message"}]. Entries may also update label and ineligibleAction.','Edit existing Update Subscriber steps with --subscriber-update-steps-json/--subscriber-update-steps-file: [{"nodeId":"node_update","config":{"customAttributeUpdates":[{"name":"plan","value":"{{event.plan}}","valueType":"text"}]}}].',"For migrated provider flow steps, use html/htmlContent to preserve exact HTML as raw HTML and use delay or delayMs for waits.",'A step may use waitUntilWeekday to hold until the next weekday window, e.g. {"type":"delay","waitUntilWeekday":{"day":"sunday","startTime":"09:00","endTime":"12:00","timezone":"America/Los_Angeles"}}. Contacts already inside the window continue immediately. Add "timezoneSource":"subscriber" to use the timezone of each contact, with timezone as the fallback for contacts without one. Add "minimumWait":{"days":6} to wait at least that long before the window. Place it before the first email to guarantee the send day at the graph level (a sequence sendingWindow only shifts send times).',"When inserting steps or branches into an active sequence, pass --confirm-structural-change after confirming the live-flow impact.",'Use --stop-condition-json/--stop-condition-file with values like {"type":"has_tag","value":"customer"}; use {"type":"none","value":null} to clear it.','event_received stop conditions only match events received after enrollment. Add matchConfig to narrow them: {"type":"event_received","value":"product.quota_used","matchConfig":{"mode":"event_property_filter","propertyFilters":[{"path":"quota_used","operator":"greater_than","value":1}]}} stops only when a later event matches every filter (operators: exists, not_exists, equals, not_equals, one_of, contains, greater_than, less_than). {"mode":"event_property","rules":[{"entryFieldPath":"orderId","eventFieldPath":"orderId"}]} stops only when the stop event matches the enrolling event on that field. For field_changed, {"mode":"field_value","operator":"equals","value":"pro"} stops only when the field changes to a matching value.','Stop conditions are re-evaluated before every step, including the first, so {"type":"does_not_have_tag","value":"allowlist"} and {"type":"removed_from_list","value":"list_123"} act as an allowlist: contacts without that tag or list are cancelled before any step sends. Use this to point a live trigger at a chosen set of contacts without editing the graph. Guarded-out contacts still enroll and are then cancelled at the trigger node, so they appear as cancellations there rather than in the active or waiting enrollment counts.',"Clearing the guard does not retry the contacts it already cancelled: nothing re-enrolls them, so they only receive the sequence if the trigger fires for them again, which one-shot triggers never do. On the one_time enrollment mode a repeated trigger is ignored too, because enrollment is blocked by the existence of any earlier run rather than by its outcome. Guard a duplicate sequence and leave the real one ungated, or enroll the missed contacts afterwards with `sequenzy sequences enroll`, which skips the one_time check.","Branch condition types include has_tag, does_not_have_tag, in_list, in_segment, event_received, link_clicked, and field_* comparisons. Use activityScope (this_sequence, previous_email, ever) for event and click checks.","Branch paths may set targetNodeId and elseTargetNodeId to wire directly to existing nodes from sequences get, including the completion node. If path steps are also provided, they run before that target.",'Set "splitMode":"random" with "randomPercentages" to route by percentage instead of by condition, which runs a concurrent A/B test inside the flow (for example two abandoned-cart offers at once instead of one after the other). Each branch then omits conditionType and condition-specific fields, the percentages must sum to 100, and no else path is allowed. To A/B test the content of a single existing email step and have a winner picked automatically, use `sequenzy ab-tests create --automation-node-id` instead.',"Use --clear-sending-window to remove a configured send window.","Use --respect-frequency-cap to skip an email step for contacts already at the company frequency cap (they continue to the next step; set the cap with `sequenzy frequency-cap set`); --ignore-frequency-cap turns it off. Transactional steps are never skipped.","Use --key-date/--key-dates-json to set the key dates a countdown sequence waits for; changing them re-times contacts already waiting. --clear-key-dates removes them (rejected while a step still waits for one).","Use --bcc-emails with a comma-separated list to blind-copy team inboxes on every sequence email; use --clear-bcc-emails to remove them."],examples:['sequenzy sequences update seq_123 --name "User Onboarding"',"sequenzy sequences update seq_123 --pause-new-enrollments","sequenzy sequences update seq_123 --resume-new-enrollments","sequenzy sequences update seq_123 --enrollment-mode matching_field","sequenzy sequences update seq_123 --enrollment-field-path order.id","sequenzy sequences update seq_123 --sending-window-start 08:00 --sending-window-end 20:00 --sending-window-timezone Europe/Kiev --sending-window-days weekdays","sequenzy sequences update seq_123 --clear-sending-window","sequenzy sequences update seq_123 --respect-frequency-cap",'sequenzy sequences update seq_123 --key-dates-timezone America/New_York --key-date "Black Friday starts=2026-11-27T00:00:00" --key-date "Black Friday ends=2026-11-29T23:59:00"','sequenzy sequences update seq_123 --bcc-emails "cs-team@yourcompany.com, founder@yourcompany.com"',"sequenzy sequences update seq_123 --clear-bcc-emails","sequenzy sequences update seq_123 --steps-file ./sequence-updates.json",`sequenzy sequences update seq_123 --stop-condition-json '{"type":"has_tag","value":"customer"}'`,`sequenzy sequences update seq_123 --stop-condition-json '{"type":"does_not_have_tag","value":"allowlist"}'`,`sequenzy sequences update seq_123 --stop-condition-json '{"type":"event_received","value":"product.quota_used","matchConfig":{"mode":"event_property_filter","propertyFilters":[{"path":"quota_used","operator":"greater_than","value":1}]}}'`,`sequenzy sequences update seq_123 --insert-steps-json '{"afterNodeId":"node_email","steps":[{"delay":{"days":1},"subject":"Migration check-in","html":"<p>Need help migrating?</p>"}]}' --confirm-structural-change`,`sequenzy sequences update seq_123 --insert-steps-json '{"afterNodeId":"node_email","steps":[{"nodeType":"logic_wait_for_event","config":{"label":"Wait for reply","eventName":"email.replied","timeoutDays":5,"timeoutAction":"continue"}}]}'`,`sequenzy sequences update seq_123 --insert-steps-json '{"afterNodeId":"node_trigger","steps":[{"nodeType":"action_ai","config":{"prompt":"Write a short winback subject line for {{first_name}} who cancelled because {{event.reason}}.","resultKey":"winback","outputFields":[{"key":"subject_line","maxLength":60,"fallback":"We miss you"}],"includeEventProperties":true}}]}' --confirm-structural-change`,`sequenzy sequences update seq_123 --branch-json '{"afterNodeId":"node_email","branches":[{"conditionType":"link_clicked","linkUrl":"project-invites","activityScope":"previous_email","steps":[{"subject":"Invite accepted","html":"<p>Thanks for accepting.</p>"}]}],"elseSteps":[{"subject":"Reminder","html":"<p>Please accept your invite.</p>"}]}'`,`sequenzy sequences update seq_123 --branch-json '{"afterNodeId":"node_email_1","branches":[{"id":"replied","conditionType":"event_received","eventName":"email.replied","activityScope":"this_sequence","targetNodeId":"node_complete"}],"elseTargetNodeId":"node_email_2"}'`,`sequenzy sequences update seq_123 --branch-json '{"afterNodeId":"node_cart_wait","splitMode":"random","randomPercentages":[50,50],"branches":[{"id":"discount","label":"10% off","steps":[{"subject":"Here is 10% off","html":"<p>Complete your order.</p>"}]},{"id":"bonus","label":"Free shipping + gift","steps":[{"subject":"Free shipping on us","html":"<p>Complete your order.</p>"}]}]}' --confirm-structural-change`,"sequenzy sequences update seq_123 --branch-file ./branch.json",`sequenzy sequences update seq_123 --sms-steps-json '[{"nodeId":"node_sms","text":"Hey {{FIRST_NAME}}, your order shipped!"}]'`,`sequenzy sequences update seq_123 --subscriber-update-steps-json '[{"nodeId":"node_update","config":{"customAttributeUpdates":[{"name":"mrr","value":"{{event.amount}}","valueType":"number"}]}}]'`]});var DIe=Gt.command("enable <id>").description("Enable a sequence").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Cn("enable",{id:e,...t}));S(DIe,{examples:["sequenzy sequences enable seq_123"]});var BIe=Gt.command("disable <id>").description("Disable a sequence").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Cn("disable",{id:e,...t}));S(BIe,{examples:["sequenzy sequences disable seq_123"]});var xIe=Gt.command("duplicate <id>").description("Create an independent draft copy of a sequence").option("-n, --name <name>","Name for the copied sequence").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Cn("duplicate",{id:e,...t}));S(xIe,{notes:["Email templates, graph topology, and sequence A/B tests are copied independently."],examples:["sequenzy sequences duplicate seq_123",'sequenzy sequences duplicate seq_123 --name "Welcome Series v2"']});var _Ie=Gt.command("archive <id>").description("Archive a sequence").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Cn("archive",{id:e,...t}));S(_Ie,{examples:["sequenzy sequences archive seq_123"]});var kIe=Gt.command("unarchive <id>").description("Restore an archived sequence as a draft").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Cn("unarchive",{id:e,...t}));S(kIe,{examples:["sequenzy sequences unarchive seq_123"]});var RIe=Gt.command("enrollments <id>").description("List the contacts currently enrolled in a sequence").option("--status <statuses...>","Enrollment statuses to include (active, waiting, completed, failed, cancelled); defaults to active and waiting").option("--node-id <nodeIds...>","Only show enrollments sitting on these sequence node IDs").option("--subscriber-id <ids...>","Only show enrollments for these subscriber IDs").option("--email <email>","Only show enrollments for this email address").option("--sort <sort>","enrolled_at_desc (default), enrolled_at_asc, wait_until_asc, or wait_until_desc").option("--stop-condition-match","Also report whether each in-flight enrollment's stop condition already matches (caps the page at 100)").option("--limit <n>","Enrollments per page, 1-500 (default 50)").option("--offset <n>","Number of enrollments to skip").option("--all","Fetch every page").option("--csv [file]","Print CSV, or write it to a file").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>n4(e,t));S(RIe,{notes:["Defaults to active and waiting enrollments, which is every contact still moving through the sequence.","Get node IDs from sequenzy sequences get <id>, or from enrollmentCounts.byCurrentNode in sequenzy stats --sequence <id>.","waitUntil is when a waiting enrollment resumes; it is empty for enrollments that are not scheduled.","A stop condition does not cancel a waiting enrollment when its event arrives. It is re-checked when the enrollment next runs a step, so a matching contact keeps reporting waiting until its delay expires. Use --stop-condition-match to inspect the current match. The result is a non-atomic snapshot; a step already past its stop check may still finish."],examples:["sequenzy sequences enrollments seq_123","sequenzy sequences enrollments seq_123 --node-id node_wave_1","sequenzy sequences enrollments seq_123 --status waiting --sort wait_until_asc","sequenzy sequences enrollments seq_123 --subscriber-id sub_123 --stop-condition-match","sequenzy sequences enrollments seq_123 --all --csv enrollments.csv"]});var QIe=Gt.command("enrollment <sequenceId> <enrollmentId>").description("Show how one enrollment entered and which branches it already took").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t,n)=>r4(e,t,n));S(QIe,{notes:["Use list_sequence_enrollments / sequenzy sequences enrollments to get enrollmentId.","nodeHistory is the recorded graph walk. Compared field values are redacted summaries, never the raw recipient value."],examples:["sequenzy sequences enrollment seq_123 tok_abc","sequenzy sequences enrollment seq_123 tok_abc --json"]});var TIe=Gt.command("move-enrollments <id>").description("Release a bounded batch of enrolled contacts from one sequence step onto another").requiredOption("--from-node <nodeId>","Node ID the contacts are currently waiting on").option("--to-node <nodeId>","Node ID to move them onto; defaults to the source step's only next step").option("--limit <n>","Maximum enrollments to move, 1-500 (default 100)").option("--sort <sort>","wait_until_asc (default), wait_until_desc, enrolled_at_asc, or enrolled_at_desc").option("--subscriber-ids <ids...>","Only move these subscriber IDs, up to 500").option("--daily-limit <n>","Refuse to move more than this many onto the target step in a rolling 24 hours").option("--tag <tags...>","Existing tag names to apply to the moved contacts").option("--reason <reason>","Note stored on every moved enrollment").option("--apply","Actually move the batch; otherwise only dry-run").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>a4(e,t));S(TIe,{notes:["Use this instead of cancelling and re-enrolling: the enrollment keeps its entry event properties, stop-condition snapshots, and start date.","Moved contacts become active on the target step immediately, so the sequence emails them as soon as the worker picks them up.","Without --apply, this command only reports which enrollments would move.","The batch is deliberately not auto-drained: re-run the command to release the next batch while remainingCount is above zero.","This works even while the sequence has new enrollment paused, because the contacts are already enrolled.","Get node IDs from sequenzy sequences enrollments <id> (currentNodeId) or sequenzy sequences get <id>."],examples:["sequenzy sequences move-enrollments seq_123 --from-node node_delay_2","sequenzy sequences move-enrollments seq_123 --from-node node_delay_2 --limit 180 --apply","sequenzy sequences move-enrollments seq_123 --from-node node_delay_2 --to-node node_email_3 --limit 180 --daily-limit 500 --tag wave-3-released --reason 'Wave 3' --apply"]});var $Ie=Gt.command("pause-enrollments <id>").description("Stop new enrollments while current sequence recipients continue").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Cn("pause-enrollments",{id:e,...t}));S($Ie,{notes:["The sequence must already be active. Existing active and waiting recipients keep moving through the sequence.","Use sequences disable when you want to freeze current recipients too."],examples:["sequenzy sequences pause-enrollments seq_123"]});var NIe=Gt.command("resume-enrollments <id>").description("Resume new enrollments for an active sequence without changing current recipients").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Cn("resume-enrollments",{id:e,...t}));S(NIe,{notes:["The sequence must already be active. Use sequences enable to resume a fully disabled sequence."],examples:["sequenzy sequences resume-enrollments seq_123"]});var OIe=Gt.command("enroll <id>").description("Manually enroll subscribers in a sequence").option("-e, --email <emails...>","Email addresses to enroll").option("--subscriber-ids <ids...>","Subscriber IDs to enroll").option("--emails-json <json>","JSON array of emails, or an object with emails/subscribers").option("--emails-file <file>","JSON, CSV, or newline-separated file with subscriber emails").option("--target-node-id <nodeId>","Sequence node to enroll at; defaults to the first step after the trigger").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Cn("enroll",{id:e,...t}));S(OIe,{notes:["Provide at least one target using --subscriber-ids or exactly one email source: --email, --emails-json, or --emails-file.","Subscribers must be active; unknown emails are reported as not found and inactive, unavailable, or already enrolled subscribers are skipped.","Enrollment requires the sequence to be accepting entrants (enabled and not paused for enrollment)."],examples:["sequenzy sequences enroll seq_123 --email one@example.com two@example.com","sequenzy sequences enroll seq_123 --subscriber-ids sub_123 sub_456 --target-node-id node_email_2","sequenzy sequences enroll seq_123 --emails-file ./vips.csv","sequenzy sequences enroll seq_123 --email one@example.com --target-node-id node_email_2"]});var PIe=Gt.command("enroll-audience <id>").description("Enroll a whole audience (everyone, lists, or a segment) in a sequence as a background run").option("--all","Enroll every active contact with an email").option("--list-ids <ids...>","Enroll members of these lists").option("--segment-id <id>","Enroll members of this segment").option("--audience-json <json>",'Campaign-style audience object, e.g. {"type":"rules","include":[{"type":"lists","listIds":["list_1"]}],"exclude":[{"type":"segments","segmentIds":["seg_2"]}]}').option("--audience-file <file>","JSON file with the audience object").option("--target-node-id <nodeId>","Sequence node to start at; defaults to the first step after the trigger").option("--apply","Start enrolling; otherwise only report the estimate").option("--schedule-at <datetime>","With --apply, start at this ISO 8601 date-time instead of now").option("--keep-enrolling","With --apply, also enroll people who join this audience later, until the last key date").option("--data-json <json>",'With --apply, run-level data shared by everyone in this run and read in emails as {{enrollment.<field>}}, e.g. {"sale_ends_at":"2026-11-29T23:59:00Z","discount_percent":20} (JSON object, up to 8 KB)').option("--data-file <file>","With --apply, JSON file with the run-level data object").option("--wait","With --apply, poll until the run finishes").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>J3(e,t));S(PIe,{notes:["Without --apply the command only estimates: matching contacts, how many are already in the sequence, and how many would be enrolled.","The sequence must be enabled and accepting entrants. Contacts already active or waiting in it are skipped; one_time sequences also skip anyone who completed or was cancelled before. Unsubscribed and bounced contacts are never enrolled.","Late enrollees in a countdown sequence skip the steps whose key date already passed and continue from the next one.","Only one audience enrollment per sequence can be queued or running at a time; use sequenzy sequences audience-enrollments (or audience-enrollment <id> <runId>) to watch it and cancel-audience-enrollment to stop it.","--data-json/--data-file attach run-level values that are the same for everyone in the run (a sale end time, a discount percentage). Every enrolled contact keeps a copy, and the sequence's emails and conditions read them as {{enrollment.<field>}}. Auto-enroll syncs (--keep-enrolling) do not carry run data."],examples:["sequenzy sequences enroll-audience seq_123 --all","sequenzy sequences enroll-audience seq_123 --segment-id seg_past_buyers --apply --wait","sequenzy sequences enroll-audience seq_123 --list-ids list_1 list_2 --apply","sequenzy sequences enroll-audience seq_123 --audience-file ./audience.json --apply --json",`sequenzy sequences enroll-audience seq_123 --segment-id seg_past_buyers --apply --data-json '{"sale_ends_at":"2026-11-29T23:59:00Z","discount_percent":20,"order_cutoff_utc":"2026-11-29T22:00:00Z"}'`]});var FIe=Gt.command("audience-enrollments <id>").description("List audience enrollment runs for a sequence").option("--limit <n>","Runs to return, 1-100 (default 20)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>V3(e,t));S(FIe,{notes:["Each run reports its status (queued, running, completed, cancelled, failed) and how many contacts were enrolled or skipped."],examples:["sequenzy sequences audience-enrollments seq_123","sequenzy sequences audience-enrollments seq_123 --limit 5 --json"]});var qIe=Gt.command("audience-enrollment <id> <runId>").description("Show one audience enrollment run with its progress").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t,n)=>K3(e,t,n));S(qIe,{notes:["Poll this while the status is queued or running; enroll-audience --wait does the polling for you."],examples:["sequenzy sequences audience-enrollment seq_123 run_abc --json"]});var LIe=Gt.command("cancel-audience-enrollment <id> <runId>").description("Stop a queued or running audience enrollment").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t,n)=>W3(e,t,n));S(LIe,{notes:["A queued run is cancelled immediately; a running run stops after the batch it is enrolling. Contacts already enrolled stay in the sequence (use cancel-enrollments to remove them)."],examples:["sequenzy sequences cancel-audience-enrollment seq_123 run_abc"]});var UIe=Gt.command("cancel-enrollments <id>").description("Cancel active or waiting subscriber enrollments in a sequence").option("--all","Cancel every active or waiting enrollment in the sequence").option("--subscriber-id <id>","Cancel enrollments for one subscriber ID").option("--subscriber-ids <ids...>","Cancel enrollments for up to 500 subscriber IDs").option("--field-path <path>","Entry event property dot path to match, such as order.id").option("--field-values <values>","Comma-separated entry field values to match").option("--reason <reason>","Reason stored on cancelled enrollments").option("--apply","Actually cancel matches; otherwise only dry-run").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Cn("cancel-enrollments",{id:e,...t}));S(UIe,{notes:["sequenceId is always required. Provide exactly one target: --all, --subscriber-id, --subscriber-ids, or --field-values.","Use --all to fully stop a live sequence when enrollments came from a segment and share no entry field value.","Without --apply, this command only reports matching enrollments.","With --apply, the command keeps calling the API until every match is drained and prints running progress.","When --field-path is omitted, the API uses the sequence enrollmentFieldPath if configured."],examples:["sequenzy sequences cancel-enrollments seq_123 --all","sequenzy sequences cancel-enrollments seq_123 --all --apply --reason 'Lifecycle cutover'","sequenzy sequences cancel-enrollments seq_123 --subscriber-id sub_123 --apply","sequenzy sequences cancel-enrollments seq_123 --subscriber-ids sub_1 sub_2 --apply","sequenzy sequences cancel-enrollments seq_123 --field-path order.id --field-values ord_123,ord_456"]});var jIe=Gt.command("realign-enrollments <id>").description("Move waiting enrollments to the start of the sequence sending window on the day they are already scheduled for").option("--node-ids <ids...>","Only realign enrollments sitting on these step IDs").option("--subscriber-ids <ids...>","Only realign enrollments for up to 500 subscriber IDs").option("--cursor <cursor>","Continue a capped scan from the cursor returned by the previous run").option("--job-id <job-id>","Check a previously queued realignment job instead of starting one").option("--apply","Actually move the wait times; otherwise only dry-run").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Cn("realign-enrollments",{id:e,...t}));S(jIe,{notes:["Run this after changing a live sequence's sending window: existing waits keep their original time, so a widened window never reaches them and a narrowed one defers them to the next allowed day.","A wait only ever moves earlier, never onto a different local day, and never before now. Nobody is cancelled or re-enrolled.","Without --apply, this command only reports the new wait times.","When more enrollments remain, run the complete continuation command printed in the result; applied runs retain --apply and any targeting filters.","Applied realignments run in the background. Use the printed --job-id command to read the result.","Use `sequenzy sequences enrollments <id> --status waiting --sort wait_until_asc` first to see who is affected."],examples:["sequenzy sequences realign-enrollments seq_123","sequenzy sequences realign-enrollments seq_123 --apply","sequenzy sequences realign-enrollments seq_123 --node-ids node_week_2 --apply","sequenzy sequences realign-enrollments seq_123 --subscriber-ids sub_1 sub_2 --apply","sequenzy sequences realign-enrollments seq_123 --job-id realign-sequence-enrollments-seq_123-..."]});var zIe=Gt.command("delete <id>").description("Delete a sequence").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Cn("delete",{id:e,...t}));S(zIe,{examples:["sequenzy sequences delete seq_123"]});var mi=Je.command("ab-tests").description("Inspect and edit A/B test variants").action(()=>mi.help());S(mi,{notes:["Use get to discover variant IDs, then update-variant to edit a specific A/B variant.","Campaign test time and audience can change during testing. Variant content stays locked after sending starts.","create, add-variant, and delete-variant work on campaign and sequence A/B tests; delete works on campaign A/B tests only."],examples:["sequenzy ab-tests list --sequence seq_123","sequenzy ab-tests get ab_123","sequenzy ab-tests update ab_123 --winner-criteria open_rate","sequenzy ab-tests stats ab_123 --period 7d","sequenzy ab-tests create camp_123 --test-percentage 20 --winner-criteria open_rate",'sequenzy ab-tests add-variant ab_123 --subject "Alternative subject"',"sequenzy ab-tests restart ab_123 --source-variant var_b","sequenzy ab-tests select-winner ab_123 var_b","sequenzy ab-tests resume ab_123",'sequenzy ab-tests update-variant ab_123 var_b --subject "New subject"',"sequenzy ab-tests update-variant ab_123 var_b --blocks-file ./variant-b.json"]});var MIe=mi.command("list").description("List A/B tests").option("--sequence <id>","Filter by sequence ID").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>ki("list",e));S(MIe,{examples:["sequenzy ab-tests list --sequence seq_123"]});var HIe=mi.command("get <id>").description("Get A/B test details and variants").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ki("get",{id:e,...t}));S(HIe,{examples:["sequenzy ab-tests get ab_123"]});var GIe=mi.command("update <id>").description("Update campaign or sequence A/B test settings").option("-n, --name <name>","A/B test name").option("--test-percentage <percent>","Campaign test audience share (5-50)").option("--duration-minutes <minutes>","Campaign test duration before winner selection (15-1440)").option("--winner-criteria <criteria>","Winner criteria: open_rate or click_rate").option("--test-type <type>","Sequence variant strategy: subject or content").option("--winner-threshold <count>","Sequence recipients before winner selection (10-1000)").option("--auto-select-winner","Sequence tests: pick the leading variant once the sample size is reached").option("--no-auto-select-winner","Sequence tests: keep splitting contacts until you select a winner").option("--confirm-live-change","Confirm a settings change to an active or already-used sequence test").option("--cancel-sample-update","Discard a failed campaign sample change").option("--expected-updated-at <timestamp>","Reject settings changes if the test has changed since this timestamp").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ki("update",{id:e,...t}));S(GIe,{notes:["During campaign testing, duration is measured from the original start; a past deadline starts winner selection immediately. Audience changes are queued and preserve committed sends. Retry the same percentage after a queue failure, or use --cancel-sample-update to discard a failed request.","Sequence tests use --test-type, --winner-threshold, --winner-criteria, and --auto-select-winner / --no-auto-select-winner.","Use --confirm-live-change when sequence settings affect an active test or a test with recorded activity."],examples:["sequenzy ab-tests update ab_123 --test-percentage 30 --duration-minutes 120 --winner-criteria open_rate","sequenzy ab-tests update ab_123 --test-type content --winner-criteria open_rate --winner-threshold 150 --confirm-live-change","sequenzy ab-tests update ab_123 --no-auto-select-winner --confirm-live-change"]});var JIe=mi.command("stats <id>").description("Get A/B test variant stats").option("-p, --period <period>","Time period (1h, 24h, 7d, 30d, 90d)").option("--start <iso>","Custom range start as ISO 8601").option("--end <iso>","Custom range end as ISO 8601").option("--include-bots","Include machine-classified bot/scanner opens and clicks").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ki("stats",{id:e,...t}));S(JIe,{notes:["Use --period or both --start and --end. Custom ranges max at 90 days.","Bot/scanner opens and clicks are excluded by default; pass --include-bots to inspect raw engagement."],examples:["sequenzy ab-tests stats ab_123","sequenzy ab-tests stats ab_123 --period 30d","sequenzy ab-tests stats ab_123 --include-bots"]});var VIe=mi.command("select-winner <id> <variantId>").description("Select a campaign A/B winner, or select or change a sequence A/B winner").option("--confirm-live-change","Confirm changing the winner of a test in an active sequence").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t,n)=>ki("select-winner",{id:e,variantId:t,...n}));S(VIe,{notes:["Campaign A/B tests must be in the testing phase; selection immediately queues winner delivery for the remaining audience.","Sequence A/B tests can change an existing winner, including one picked automatically. Contacts who already got a variant keep it; everyone who reaches the step afterwards gets the new winner.","Use --confirm-live-change when the sequence is active."],examples:["sequenzy ab-tests select-winner ab_123 var_b","sequenzy ab-tests select-winner ab_123 var_c --confirm-live-change"]});var KIe=mi.command("resume <id>").description("Clear a sequence A/B winner and keep testing until you select one").option("--confirm-live-change","Confirm resuming a test in an active sequence").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ki("resume",{id:e,...t}));S(KIe,{notes:["Contacts reaching the step are split across the variants again. Results collected so far are kept.","Automatic selection stays off for this test; finish it with `sequenzy ab-tests select-winner <id> <variantId>`.","Use --confirm-live-change when the sequence is active."],examples:["sequenzy ab-tests resume ab_123","sequenzy ab-tests resume ab_123 --confirm-live-change"]});var WIe=mi.command("restart <id>").description("Run another sequence A/B test from an existing variant").option("--source-variant <id>","Variant to use as the new control. Defaults to the selected winner.").option("--test-type <type>","Test type for generated variants: subject or content").option("--winner-threshold <count>","Subscribers before selecting a winner (10-1000)").option("--variant-count <count>","Total variants including control (2-4)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ki("restart",{id:e,...t}));S(WIe,{notes:["Only sequence A/B tests with a selected winner can be restarted.","Run `sequenzy ab-tests get <id>` first to find variant IDs."],examples:["sequenzy ab-tests restart ab_123","sequenzy ab-tests restart ab_123 --source-variant var_b --test-type content --variant-count 3"]});var YIe=mi.command("update-variant <id> <variantId>").description("Update an A/B test variant").option("-s, --subject <subject>","Variant subject").option("--preview-text <text>","Variant preview text").option("--html <html>","Replacement HTML body").option("--html-file <file>","Read replacement HTML from file").option("--blocks-json <json>","Inline JSON array of Sequenzy email blocks").option("--blocks-file <file>","Path to a JSON file with Sequenzy email blocks").option("--confirm-live-change","Confirm a sequence variant edit that may affect A/B test accuracy").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t,n)=>ki("update-variant",{id:e,variantId:t,...n}));S(YIe,{notes:["Provide either HTML or blocks, not both.","Campaign variants remain editable only in draft.","Use --confirm-live-change when a sequence is active or its test already has activity; earlier sends stay unchanged and combined results may be inaccurate.","Run `sequenzy ab-tests get <id>` first to find variant IDs."],examples:['sequenzy ab-tests update-variant ab_123 var_b --subject "New subject"',"sequenzy ab-tests update-variant ab_123 var_b --html-file ./variant-b.html",'sequenzy ab-tests update-variant ab_123 var_b --subject "Revised future send" --confirm-live-change']});var ZIe=mi.command("create [campaignId]").description("Create a campaign or sequence-node A/B test").option("--automation-node <nodeId>","Convert this sequence email node into an A/B test node").option("--confirm-live-change","Confirm conversion of an email node in an active sequence").option("-n, --name <name>","A/B test name").option("--test-percentage <percent>","Campaign test audience share (5-50, default 20)").option("--duration-minutes <minutes>","Campaign test duration before winner selection (15-1440, default 240)").option("--winner-criteria <criteria>","Winner criteria: open_rate or click_rate (campaign default open_rate; overrides sequence test-type default)").option("--test-type <type>","Sequence variant strategy: subject or content (default content)").option("--winner-threshold <count>","Sequence test sample size (10-1000, default 100)").option("--variants-json <json>","Inline JSON array of extra variants ({subject, previewText?, blocks?})").option("--variants-file <file>","Path to a JSON file with extra variants ({subject, previewText?, blocks?})").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ki("create",{campaignId:e,automationNodeId:t.automationNode,...t}));S(ZIe,{notes:["Provide either a campaign ID or --automation-node, but not both.","Campaigns must be in draft or rejected status. Sequence node IDs must reference an email node.","Campaigns use --test-percentage and --duration-minutes; sequences use --winner-threshold.","Variant A is created automatically from the campaign email; provided variants are added after it."],examples:["sequenzy ab-tests create camp_123",`sequenzy ab-tests create --automation-node node_123 --test-type content --winner-threshold 100 --variants-json '[{"subject":"Variant B"}]'`,"sequenzy ab-tests create camp_123 --test-percentage 30 --duration-minutes 120 --winner-criteria click_rate",`sequenzy ab-tests create camp_123 --variants-json '[{"subject":"Alternative subject"}]'`]});var XIe=mi.command("add-variant <id>").description("Add a variant to a draft campaign or sequence A/B test").requiredOption("-s, --subject <subject>","Variant subject").option("--preview-text <text>","Variant preview text").option("--blocks-json <json>","Inline JSON array of Sequenzy email blocks").option("--blocks-file <file>","Path to a JSON file with Sequenzy email blocks").option("--confirm-live-change","Confirm adding a variant to an A/B test in an active sequence").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ki("add-variant",{id:e,...t}));S(XIe,{notes:["Variants can only be added while the A/B test is in draft status.","A/B tests in an active sequence require --confirm-live-change."],examples:['sequenzy ab-tests add-variant ab_123 --subject "Alternative subject"','sequenzy ab-tests add-variant ab_123 --subject "Alternative subject" --blocks-file ./variant.json']});var eCe=mi.command("delete-variant <id> <variantId>").description("Remove a variant from a draft campaign or sequence A/B test").option("-y, --yes","Skip the confirmation prompt").option("--confirm-live-change","Confirm deleting a variant from an A/B test in an active sequence").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t,n)=>ki("delete-variant",{id:e,variantId:t,...n}));S(eCe,{notes:["Variant A is the control variant and cannot be deleted.","Variants can only be removed while the A/B test is in draft status.","A/B tests in an active sequence require --confirm-live-change."],examples:["sequenzy ab-tests delete-variant ab_123 var_b --yes"]});var tCe=mi.command("delete <id>").description("Delete a campaign A/B test").option("-y, --yes","Skip the confirmation prompt").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ki("delete",{id:e,...t}));S(tCe,{notes:["Running A/B tests cannot be deleted; the linked campaign must be draft or rejected."],examples:["sequenzy ab-tests delete ab_123 --yes"]});var Cl=Je.command("components").description("Manage reusable email components and the default email footer").action(()=>Cl.help());S(Cl,{notes:["Components are saved block groups you can reuse across emails.","The component pinned to the footer slot is the footer every new sequence, campaign, and AI-generated email gets. Edit it here to change the footer everywhere at once - editing one email's blocks only changes that email.","A default footer always keeps its unsubscribe link enabled. Transactional sends hide it at render time.","Existing emails change only with explicit --apply-to scopes and a reviewed --preview-token. Use footer preview first; --output-dir exports before/after HTML for visual inspection."],examples:["sequenzy components footer get --json > footer.json","sequenzy components footer set --blocks-file ./footer.json --yes","sequenzy components list --company comp_123","sequenzy components create 'Promo banner' --blocks-file ./banner.json"]});var $v=Cl.command("footer").description("Read or replace the company's default email footer").action(()=>$v.help()),nCe=$v.command("get").description("Print the current default email footer").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>nc("footer-get",void 0,e));S(nCe,{notes:["Exits with a not-found error when no default footer is set, which means emails fall back to the footer generated from the company profile.","Pipe --json to a file, edit the blocks, then write it back with `components footer set`."],examples:["sequenzy components footer get","sequenzy components footer get --json > footer.json"]});var rCe=$v.command("preview").description("Preview a footer change and optionally export before/after HTML without saving").option("--blocks-json <json>","Proposed footer blocks as inline JSON").option("--blocks-file <path>","Proposed footer blocks as a JSON file").option("--name <name>","Proposed component name").option("--description <text>","Proposed component description").option("--apply-to <scopes>","Comma-separated sequences,campaigns,transactional,templates; omit for future emails only").option("--include-customized","Also replace customized footers").option("--render-preview","Include footer and before/after HTML in JSON output").option("--output-dir <path>","Write visual HTML previews to this directory").option("--sample-id <id>","Render a specific affected item instead of category samples").option("--sample-kind <kind>","Sample kind: email, ab_variant, localization").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON, including the preview token").action((e)=>nc("footer-preview",void 0,e));S(rCe,{notes:["The preview does not save or send. Dynamic content is not personalized. Open exported HTML in a browser to inspect it visually.","Use the same blocks, metadata and scope options when applying the returned token. Stale previews return a conflict; review a fresh preview before retrying."],examples:["sequenzy components footer preview --blocks-file footer.json --apply-to sequences,campaigns,transactional,templates --output-dir ./footer-preview --json"]});var oCe=$v.command("set").description("Create or replace the company's default email footer").option("--blocks-json <json>","Footer blocks as inline JSON").option("--blocks-file <path>","Footer blocks as a JSON file").option("--apply-to <scopes>","Comma-separated sequences,campaigns,transactional,templates").option("--include-customized","Also replace customized footers, matching the preview").option("--preview-token <token>","Reviewed footer preview token; required with --apply-to").option("--name <name>","Component name (default: Default Footer)").option("--description <text>","Component description").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").option("-y, --yes","Skip the confirmation prompt").action((e)=>nc("footer-set",void 0,e));S(oCe,{notes:["Replaces the whole footer. Read the current one with `components footer get --json` first if you only mean to change part of it.","The unsubscribe link is always re-enabled on save."],examples:["sequenzy components footer set --blocks-file ./footer.json --yes",'sequenzy components footer set --blocks-file ./footer.json --name "2026 Footer"']});var iCe=Cl.command("list").description("List email components, newest first").option("--type <type>","Filter by component type (section, footer)").option("--defaults-only","Only components pinned as a company default").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>nc("list",void 0,e));S(iCe,{examples:["sequenzy components list","sequenzy components list --defaults-only --json"]});var sCe=Cl.command("get <componentId>").description("Show one email component").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>nc("get",e,t));S(sCe,{examples:["sequenzy components get cmp_123 --json"]});var aCe=Cl.command("create <name>").description("Create a reusable email component").option("--blocks-json <json>","Component blocks as inline JSON").option("--blocks-file <path>","Component blocks as a JSON file").option("--description <text>","Component description").option("--type <type>","Component type (section, footer). Default: section").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>nc("create",e,t));S(aCe,{notes:["Component names are unique per company.","Creating one with --type footer does not pin it as the default footer. Use `components footer set` for that."],examples:["sequenzy components create 'Promo banner' --blocks-file ./banner.json"]});var cCe=Cl.command("update <componentId>").description("Update an email component's metadata or blocks").option("--name <name>","New component name").option("--description <text>","New description").option("--type <type>","New component type (section, footer)").option("--blocks-json <json>","Replacement blocks as inline JSON").option("--blocks-file <path>","Replacement blocks as a JSON file").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>nc("update",e,t));S(cCe,{notes:["Replacing blocks bumps the component version. Emails built earlier keep the copy they were created with."],examples:["sequenzy components update cmp_123 --name 'Promo banner v2'","sequenzy components update cmp_123 --blocks-file ./banner-v2.json"]});var lCe=Cl.command("delete <componentId>").description("Delete an email component").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").option("-y, --yes","Skip the confirmation prompt").action((e,t)=>nc("delete",e,t));S(lCe,{notes:["Emails that already rendered the component keep their copied blocks.","Deleting the pinned default footer makes new emails fall back to the generated footer."],examples:["sequenzy components delete cmp_123 --yes"]});var fi=Je.command("templates").description("Manage email templates").action(()=>fi.help());S(fi,{notes:["Template content can be provided as raw HTML or as Sequenzy blocks JSON.","Templates can be assigned labels and listed by label for integration dashboards.","Use blocks when you need conditional content, per-block styles, or an exact editor-compatible structure.",ug],examples:["sequenzy templates list --company comp_123","sequenzy templates list --label edm --company comp_123",'sequenzy templates create welcome --subject "Welcome" --html-file ./welcome.html','sequenzy templates create welcome --subject "Welcome" --label edm template --html-file ./welcome.html','sequenzy templates create welcome --subject "Welcome" --blocks-file ./welcome-blocks.json','sequenzy templates update tmpl_123 --subject "Updated" --html-file ./welcome-v2.html','sequenzy templates localizations set tmpl_123 es --subject "Hola" --html-file ./welcome-es.html',"sequenzy templates localizations sync tmpl_123 --locale es fr"]});var uCe=fi.command("list").description("List templates, newest first").option("--label <labels...>","Filter by label name").option("--templates-only","Only reusable master designs (emails marked as templates)").option("-l, --limit <number>","Templates per page, 1-100 (default: 50)").option("--offset <number>","Templates to skip before returning results").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>xa("list",e));S(uCe,{notes:["Returns 50 templates per call by default. When pagination.hasMore is true, re-run with --offset advanced by pagination.count to read the rest.","Templates are every saved email body - standalone templates plus the bodies behind campaigns and transactional emails - so the count grows with your campaign history."],examples:["sequenzy templates list --company comp_123","sequenzy templates list --label edm --company comp_123","sequenzy templates list --templates-only --json","sequenzy templates list --limit 100 --json","sequenzy templates list --limit 100 --offset 100 --json"]});var dCe=fi.command("get <id>").description("Get template details").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>xa("get",{id:e,...t}));S(dCe,{examples:["sequenzy templates get tmpl_123 --company comp_123"]});var pCe=jB(fi.command("render <id>").description("Render a template to email-ready HTML")).action((e,t)=>cb({type:"template",id:e},t));S(pCe,{notes:HB,examples:["sequenzy templates render tmpl_123 --out preview.html","sequenzy templates render tmpl_123 --email you@example.com --var plan=Pro --json"]});var mCe=zB(fi.command("check <id>").description("Check a template: broken links and images, placeholders, content and client issues")).action((e,t)=>lb({type:"template",id:e},t));S(mCe,{notes:MB,examples:["sequenzy templates check tmpl_123","sequenzy templates check tmpl_123 --var resetUrl=https://acme.io/reset --json"]});var fCe=fi.command("create <name>").description("Create a template").option("-s, --subject <subject>","Email subject (optional with --prompt)").option("--preview-text <text>","Email preview text override").option("--prompt <prompt>","Generate branded native blocks from a prompt").option("--style <style>","Prompt generation style. Pass designed or plain to force the designed or plain-text email style; other values are freeform guidance (defaults to the company's email style preference)").option("--tone <tone>","Prompt generation tone").option("--html <html>","Email HTML content").option("--html-file <file>","Read HTML from file").option("--blocks-json <json>","Inline JSON array of Sequenzy email blocks").option("--blocks-file <file>","Path to a JSON file with Sequenzy email blocks").option("--label <labels...>","Label names to assign").option("--template","Save as a reusable master design that sequence steps and campaigns can start from").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>xa("create",{name:e,...t}));S(fCe,{notes:["Provide exactly one of prompt, HTML, or blocks JSON content.","Use blocks when you need conditional content, per-block styles, or exact editor parity."],examples:['sequenzy templates create welcome --prompt "Welcome new customers"','sequenzy templates create welcome --subject "Welcome" --html-file ./welcome.html','sequenzy templates create welcome --subject "Welcome" --label edm template --html-file ./welcome.html','sequenzy templates create welcome --subject "Welcome" --blocks-file ./welcome-blocks.json']});var gCe=fi.command("from-example <example>").description("Remix an email gallery example into a new template written for your brand").option("--brief <text>","Extra direction for the new email (takes priority over the example)").option("--name <name>","Template name (defaults to the generated subject)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>rM(e,t));S(gCe,{notes:["<example> is a gallery email URL (https://sequenzy.com/email-examples/brands/{brand}/emails/{email}, or a sequence page URL ending in #email-{email} for an email in a sequence) or brand/email.","Keeps the example's exact layout; every word is rewritten for your company and your logo, brand color and links are swapped in. Saved as an HTML template. The example brand is never named in the new email.","Saved as a reusable template. Nothing is saved if generation fails; running the command again creates another template."],examples:["sequenzy templates from-example https://sequenzy.com/email-examples/brands/linear/emails/welcome-to-linear",'sequenzy templates from-example linear/welcome-to-linear --brief "Mention our 14-day trial"']});var ACe=fi.command("preview-example <example>").description("Preview an email gallery example written for your brand, without saving").option("--website <site>","Write it for another website instead of your brand, e.g. acme.com").option("--brief <text>","Extra direction for the email (takes priority over the example)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON, including the HTML").action((e,t)=>cM(e,t));S(ACe,{notes:["<example> is a gallery email URL (https://sequenzy.com/email-examples/brands/{brand}/emails/{email}, or a sequence page URL ending in #email-{email}) or brand/email.","Same rewrite as sequenzy templates from-example, but nothing is saved. Run from-example to keep it as a template."],examples:["sequenzy templates preview-example linear/welcome-to-linear","sequenzy templates preview-example linear/welcome-to-linear --website acme.com --json"]});var hCe=fi.command("update <id>").description("Update a template").option("-n, --name <name>","Template name").option("-s, --subject <subject>","Email subject").option("--preview-text <text>","Inbox preview text").option("--html <html>","Email HTML content").option("--html-file <file>","Read HTML from file").option("--blocks-json <json>","Inline JSON array of Sequenzy email blocks").option("--blocks-file <file>","Path to a JSON file with Sequenzy email blocks").option("--label <labels...>","Replace label names").option("--template","Mark as a reusable master design").option("--no-template","Remove the reusable master design mark").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>xa("update",{id:e,...t}));S(hCe,{notes:["Provide at least one of --name, --subject, --preview-text, --label, --template/--no-template, --html, --html-file, --blocks-json, or --blocks-file.","Do not combine HTML flags with blocks flags in the same request."],examples:['sequenzy templates update tmpl_123 --subject "Updated"','sequenzy templates update tmpl_123 --preview-text "A warmer inbox preview"',"sequenzy templates update tmpl_123 --label edm template","sequenzy templates update tmpl_123 --html-file ./welcome-v2.html","sequenzy templates update tmpl_123 --blocks-file ./welcome-v2-blocks.json"]});var Nv=fi.command("localizations").description("Manage localized template variants").action(()=>Nv.help());S(Nv,{notes:["Set stores caller-supplied localized content immediately.","Sync queues AI translation for selected locales, or every enabled non-primary locale when --locale is omitted."],examples:['sequenzy templates localizations set tmpl_123 es --subject "Hola" --html-file ./welcome-es.html',"sequenzy templates localizations sync tmpl_123 --locale es fr","sequenzy templates localizations sync tmpl_123"]});var yCe=Nv.command("set <id> <locale>").description("Create or replace a localized template variant").requiredOption("-s, --subject <subject>","Localized email subject").option("--preview-text <text>","Localized email preview text").option("--html <html>","Localized email HTML content").option("--html-file <file>","Read localized HTML from file").option("--blocks-json <json>","Inline JSON array of localized Sequenzy email blocks").option("--blocks-file <file>","Path to a JSON file with localized Sequenzy email blocks").option("--keep-edits","Protect this localization from automatic translation on save").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t,n)=>xa("set-localization",{id:e,locale:t,...n}));S(yCe,{notes:["The locale must be enabled in the company's localization settings and cannot be the primary locale.","Provide exactly one HTML or blocks content source.","Without --keep-edits, saving the template retranslates it when automatic translation is on."],examples:['sequenzy templates localizations set tmpl_123 es --subject "Hola" --html-file ./welcome-es.html','sequenzy templates localizations set tmpl_123 fr-CA --subject "Bienvenue" --blocks-file ./welcome-fr-ca.json']});var bCe=Nv.command("sync <id>").description("Queue AI translation for template locales").option("--locale <locales...>","Enabled locales to sync; omit to sync every non-primary locale").option("--skip-edited","Keep localizations someone edited instead of retranslating them").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>xa("sync-localizations",{id:e,locales:t.locale,...t.skipEdited===!0&&{skipEdited:!0},company:t.company,json:t.json}));S(bCe,{examples:["sequenzy templates localizations sync tmpl_123 --locale es fr","sequenzy templates localizations sync tmpl_123","sequenzy templates localizations sync tmpl_123 --skip-edited"]});var vCe=fi.command("delete <id>").description("Delete a template").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>xa("delete",{id:e,...t}));S(vCe,{notes:["Deletion fails when the template is still referenced by a campaign or sequence."],examples:["sequenzy templates delete tmpl_123"]});var ECe=fi.command("share <id>").description("Create or fetch the email's public view-in-browser link").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>xa("share",{id:e,...t}));S(ECe,{notes:["Accepts an email ID or a transactional email's ID or slug, so transactional and sequence emails can be shared with the ID you already hold.","The hosted page is anonymized: sample contact, inert unsubscribe link, no open/click tracking.","Idempotent - rerunning returns the same URL until you run `templates unshare`.","Campaigns have their own link that follows the A/B winner - use `campaigns share`."],examples:["sequenzy templates share tmpl_123","sequenzy templates share order-confirmation"]});var ICe=fi.command("unshare <id>").description("Revoke the email's public view-in-browser link").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>xa("unshare",{id:e,...t}));S(ICe,{notes:["The shared URL returns 404 immediately after revocation."],examples:["sequenzy templates unshare tmpl_123"]});var Tp=Je.command("companies").description("Inspect or create companies").action(()=>Tp.help());S(Tp,{notes:["Creating a company with a domain starts background website processing automatically; --without-website creates a ready company."],examples:["sequenzy companies list","sequenzy companies get comp_123","sequenzy companies update comp_123 --primary-color '#0ea5e9'","sequenzy companies create example.com --name Example"]});var CCe=Tp.command("list").description("List accessible companies").option("--json","Print raw JSON").action((e)=>Sf("list",e));S(CCe,{examples:["sequenzy companies list"]});var wCe=Tp.command("get <id>").description("Get company details").option("--json","Print raw JSON").action((e,t)=>Sf("get",{id:e,...t}));S(wCe,{examples:["sequenzy companies get comp_123"]});var SCe=Tp.command("update <id>").description("Update company info, brand context, and reply tracking").option("-n, --name <name>","Company display name").option("--description <text>","Short product or company summary").option("--description-file <path>","Read description from a file").option("--logo-url <url>","Public logo URL").option("--founder-name <name>","Founder or sender name").option("--primary-color <hex>","Primary brand color, e.g. #f97316").option("--brand-colors-json <json>","Brand colors object as JSON").option("--brand-colors-file <path>","Read brand colors JSON from a file").option("--value-props-json <json>","Value propositions array as JSON").option("--value-props-file <path>","Read value propositions JSON from a file").option("--testimonials-json <json>","Testimonials array as JSON").option("--testimonials-file <path>","Read testimonials JSON from a file").option("--tone-voice <text>","Tone of voice guidance").option("--company-context <text>","Product knowledge for AI writing").option("--company-context-file <path>","Read product knowledge from a file").option("--email-design-prompt <text>","Art direction for AI-designed emails (layout, density, imagery)").option("--email-design-prompt-file <path>","Read the design prompt from a file").option("--email-length-preference <value>","Email length: concise, balanced, or detailed (new workspaces default to concise)").option("--email-style <style>","How AI writes emails by default: visual (designed), plain (simple text), or ask (clear the choice)").option("--email-preset <preset>","Default header and footer: branded (logo and full footer) or minimal (compact footer, no logo)").option("--social-links-json <json>","Social links object as JSON").option("--social-links-file <path>","Read social links JSON from a file").option("--privacy-policy-url <url>","Privacy policy URL").option("--terms-url <url>","Terms of service URL").option("--address <address>","Physical mailing address").option("--language <code>","Primary language code").option("--pricing-json <json>","Pricing object as JSON").option("--pricing-file <path>","Read pricing JSON from a file").option("--font-family <family>","Default email font family").option("--email-theme-json <json>","Default email theme as JSON (partial: presetId, colors, typography, layout; pass null to reset)").option("--email-theme-file <path>","Read the default email theme JSON from a file").option("--email-direction <direction>","Default email direction: ltr or rtl").option("--sender-profile-id <id>","Existing sender profile to make the default (see `sequenzy sender-profiles list`)").option("--from-email <email>","Account-wide default From address (domain must be verified)").option("--from-name <name>","Display name of the default From profile (alone, it renames the current one)").option("--reply-profile-id <id>","Existing reply profile to make the default (see `sequenzy sender-profiles list`)").option("--reply-to <email>","Account-wide default Reply-To address").option("--reply-to-name <name>","Display name of the default Reply-To profile (alone, it renames the current one)").option("--enable-reply-tracking","Enable inbound reply tracking").option("--disable-reply-tracking","Disable inbound reply tracking").option("--reply-tracking-domain-mode <mode>","Reply domain mode: sequenzy or custom").option("--enable-reply-forwarding","Enable captured reply forwarding").option("--disable-reply-forwarding","Disable captured reply forwarding").option("--default-list <id>","List new contacts join by default when nothing targets them (repeatable)",(e,t=[])=>[...t,e]).option("--default-lists-none","New contacts join no list unless something targets them").option("--rename-matching-footers","Rename exact matching footer names in editable emails and saved components; requires --name and --previous-company-name").option("--previous-company-name <name>","Current company name to match when renaming footers").option("--default-lists-all","New contacts join every current and future list").option("--json","Print raw JSON").action((e,t)=>Sf("update",{id:e,...t}));S(SCe,{notes:["The default-list flags set which lists a new contact joins when nothing targets it explicitly - forms, API writes, events, imports, and live ingestion from integrations without their own list targeting (Dodo Payments, PostHog, WooCommerce). Payment-provider backfills follow this setting; PostHog history imports instead create contacts without list memberships. `companies get <id>` reports the current value.","`--default-lists-all`, `--default-lists-none`, and `--default-list` are three different things: all lists, no list at all, and exactly the listed ones. They are mutually exclusive.","Changing this only affects later writes. Nobody is moved or removed from a list retroactively, so a list already polluted by a backfill still needs `sequenzy lists remove-subscribers`.","The default-list flags need an API key with the companies:manage scope. In the dashboard the same setting lives under Contacts -> Lists -> Default Lists.","`--enable-reply-tracking` turns Inbox on. A workspace that has never received a conversation needs a verified receiving domain first (otherwise the API answers 409 receiving_domain_required): add one with `sequenzy receiving-domains add <domain>`, and Inbox turns on by itself once its DNS records are verified."],examples:["sequenzy companies update comp_123 --primary-color '#0ea5e9'","sequenzy companies update comp_123 --default-list list_abc --default-list list_def","sequenzy companies update comp_123 --default-lists-none",`sequenzy companies update comp_123 --email-theme-json '{"colors":{"mutedText":"#4b5563"},"typography":{"baseFontSize":16}}'`,"sequenzy companies update comp_123 --company-context-file ./product.md --tone-voice 'clear, direct, warm'","sequenzy companies update comp_123 --from-name 'Example'","sequenzy companies update comp_123 --sender-profile-id sender_abc123 --from-name 'Example News'","sequenzy companies update comp_123 --enable-reply-tracking --reply-tracking-domain-mode sequenzy",`sequenzy companies update comp_123 --value-props-json '[{"title":"Fast setup","description":"Launch lifecycle emails in minutes."}]'`]});var DCe=Tp.command("create [domain]").description("Create a company with or without a website").option("-n, --name <name>","Company name").option("--without-website","Start without a website (requires --name)").option("-d, --description <text>","Business description, up to 500 characters. With a domain, website processing may replace it").option("--description-file <path>","Read the business description from a file").option("--with-welcome-sequence","Create and generate the four-email welcome sequence").option("--json","Print raw JSON").action((e,t)=>Sf("create",{domain:e,...t}));S(DCe,{examples:["sequenzy companies create example.com","sequenzy companies create https://example.com --name Example",'sequenzy companies create --without-website --name Acme --description "Meal plans for night-shift nurses" --with-welcome-sequence']});var Ro=Je.command("accounts").description("Manage your customers' accounts (B2B organizations) and their members").option("--search <text>","Match name, external ID or domain").option("--page <n>","Page number").option("--limit <n>","Results per page (max 100)").option("--sort <field>","Sort by updatedAt, createdAt, name, memberCount or lastEventAt").option("--order <dir>","asc or desc").option("--without-event-recipients","Only accounts with members but no owner or admin").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>Ri("list",e));S(Ro,{notes:["Running `sequenzy accounts` without a subcommand lists accounts.","These are your customers' organizations. For your own Sequenzy login, API key and workspaces, use `sequenzy account`.","The first account turns Accounts on for the workspace. It fails with a 409 error if contacts already use a custom attribute named `account` or `account.*`; rename that attribute first.","Accounts are identified by your own external ID (the organization or workspace id in your app).","Account attributes fan out to every member as `account.<name>` for segments and `{{account.<name>}}` merge tags."],examples:["sequenzy accounts list --search acme","sequenzy accounts get org_123","sequenzy accounts upsert org_123 --name Acme --domain acme.com --attr plan=pro --attr seats=5","sequenzy accounts add-member org_123 --email jane@acme.com --role owner","sequenzy accounts event org_123 trial_ending --property daysLeft=3 --recipients owners","sequenzy accounts suggestions","sequenzy accounts detect-org-ids"]});var BCe=Ro.command("list").description("List accounts").option("--search <text>","Match name, external ID or domain").option("--page <n>","Page number").option("--limit <n>","Results per page (max 100)").option("--sort <field>","updatedAt, createdAt, name, memberCount, lastEventAt").option("--order <dir>","asc or desc").option("--without-event-recipients","Only accounts with members but no owner or admin").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Ri("list",t.optsWithGlobals()));S(BCe,{notes:["Account events go to owners (or admins) by default. `--without-event-recipients` finds accounts whose alerts reach nobody, such as bulk-created accounts where everyone is a member."],examples:["sequenzy accounts list --sort memberCount --order desc","sequenzy accounts list --without-event-recipients"]});var xCe=Ro.command("get <externalId>").description("Show an account and its members").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Ri("get",{externalId:e,...t}));S(xCe,{examples:["sequenzy accounts get org_123"]});var _Ce=Ro.command("upsert <externalId>").description("Create or update an account by external ID").option("--name <name>","Display name").option("--domain <domain>","Primary domain, e.g. acme.com").option("--attr <key=value>","Account attribute (repeatable). `key=` clears a key.",(e,t=[])=>[...t,e]).option("--replace-attributes","Replace all attributes instead of merging").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Ri("upsert",{externalId:e,...t}));S(_Ce,{notes:["Numbers and booleans in --attr are coerced; everything else stays a string."],examples:["sequenzy accounts upsert org_123 --name Acme --attr plan=pro --attr seats=5","sequenzy accounts upsert org_123 --attr legacyPlan="]});var kCe=Ro.command("delete <externalId>").description("Delete an account (contacts are kept)").option("-y, --yes","Skip the confirmation prompt").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Ri("delete",{externalId:e,...t}));S(kCe,{examples:["sequenzy accounts delete org_123 --yes"]});var RCe=Ro.command("members <externalId>").description("List account members with roles").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Ri("members",{externalId:e,...t}));S(RCe,{examples:["sequenzy accounts members org_123"]});var QCe=Ro.command("add-member <externalId>").description("Add a contact to an account").option("--email <email>","Contact email (created when new)").option("--subscriber-external-id <id>","Contact external ID").option("--role <role>","owner, admin or member").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Ri("add-member",{externalId:e,...t}));S(QCe,{notes:["Re-adding a member without --role keeps the current role."],examples:["sequenzy accounts add-member org_123 --email jane@acme.com --role owner"]});var TCe=Ro.command("remove-member <externalId>").description("Remove a contact from an account").option("--email <email>","Contact email").option("--subscriber-external-id <id>","Contact external ID").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Ri("remove-member",{externalId:e,...t}));S(TCe,{examples:["sequenzy accounts remove-member org_123 --email bob@acme.com"]});var $Ce=Ro.command("events <externalId>").description("List recent account events").option("--limit <n>","Number of events (max 500)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Ri("events",{externalId:e,...t}));S($Ce,{examples:["sequenzy accounts events org_123 --limit 20"]});var NCe=Ro.command("event <externalId> <event>").description("Trigger an account event and deliver it to members").option("--property <key=value>","Event property (repeatable)",(e,t=[])=>[...t,e]).option("--recipients <rule>","owners (default), admins, all or none").option("--event-id <id>","Idempotency key for retries").option("--occurred-at <timestamp>","Original event time (ISO 8601)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t,n)=>Ri("event",{externalId:e,event:t,...n}));S(NCe,{notes:["Recipients receive the event as a contact event with `event.account.*` properties, so sequences and sync rules run per person.","Owners fall back to admins when an account has no owner."],examples:["sequenzy accounts event org_123 trial_ending --property daysLeft=3","sequenzy accounts event org_123 seat_limit_reached --recipients admins"]});var OCe=Ro.command("suggestions").description("Suggest accounts from work email domains contacts share").option("--min-contacts <n>","Contacts a domain needs (default 3)").option("--limit <n>","Number of suggestions (default 25, max 100)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>Ri("suggestions",e));S(OCe,{notes:["Skips personal and disposable email providers, your own sending domains, domains where any contact already belongs to an account, and domains an account already uses. Shows up to three sample emails per domain.","Read-only: nothing is created until you run `accept-suggestions`."],examples:["sequenzy accounts suggestions","sequenzy accounts suggestions --min-contacts 5 --json"]});var PCe=Ro.command("accept-suggestions <domains...>").description("Create accounts from suggested email domains").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Ri("accept-suggestions",{domains:e,...t}));S(PCe,{notes:["Each domain becomes an account (external ID and domain set to the domain) with the domain's contacts as members. Contacts already in another account stay there, and a domain already partly grouped is skipped.","When one account already uses the domain, contacts are added to it instead. Up to 25 domains per call; safe to retry. No sync rules or segment-entered sequences run."],examples:["sequenzy accounts accept-suggestions acme.com globex.com"]});var FCe=Ro.command("detect-org-ids").description("Find the organization ID your app already sends in events or contact attributes").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>wf("detect",e));S(FCe,{notes:["Looks for event properties from the last 180 days and contact attributes named like workspaceId, organization_id, team_id or account_id, with how many organizations each holds and the matching name key when there is one.","Read-only. Preview a key with `preview-org-id` before creating accounts from it."],examples:["sequenzy accounts detect-org-ids","sequenzy accounts detect-org-ids --json"]});var qCe=Ro.command("preview-org-id <propertyKey>").description("Preview the accounts an organization ID would create").option("--source <source>","event (default) or attribute").option("--name-key <key>","Property or attribute with the organization name").option("--limit <n>","Organizations to show (default 5, max 50)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>wf("preview",{propertyKey:e,...t}));S(qCe,{notes:["Shows the biggest organizations first: the name each account would get (from --name-key, otherwise the work email domain most of its contacts share), its contact count and sample emails.","Read-only: nothing is created until you run `create-from-org-id`."],examples:["sequenzy accounts preview-org-id workspaceId","sequenzy accounts preview-org-id account_id --source attribute --name-key company_name --limit 20"]});var LCe=Ro.command("create-from-org-id <propertyKey>").description("Create one account per organization ID and add its contacts").option("--source <source>","event (default) or attribute").option("--name-key <key>","Property or attribute with the organization name").option("--wait","Wait until the accounts are created").option("-y, --yes","Skip the preview and confirmation").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>wf("create",{propertyKey:e,...t}));S(LCe,{notes:["Shows a preview and asks before starting. Runs in the background; use --wait to wait, or check with `org-id-job`.","Accounts are named from --name-key, otherwise after the work email domain their contacts share. Existing names, domains and roles are kept, no emails are sent and no sequences start. Safe to rerun."],examples:["sequenzy accounts create-from-org-id workspaceId","sequenzy accounts create-from-org-id workspaceId --name-key workspaceName --yes --wait"]});var UCe=Ro.command("org-id-job <jobId>").description("Check a create-from-org-id run").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>wf("job",{jobId:e,...t}));S(UCe,{notes:["States: queued, running, completed (with accounts and memberships created) or failed (with the error)."],examples:["sequenzy accounts org-id-job backfill-accounts:comp_123:workspaceId"]});var fg=Je.command("tags").description("Manage tag definitions").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>_p("list",e));S(fg,{notes:["Running `sequenzy tags` without a subcommand lists tag definitions.","Tag names are normalized to lowercase with dashes; system tags cannot be changed or deleted."],examples:["sequenzy tags --company comp_123","sequenzy tags list","sequenzy tags create vip --color purple","sequenzy tags update tag_123 --color red","sequenzy tags delete tag_123 --yes"]});var jCe=fg.command("list").description("List tag definitions").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>_p("list",e));S(jCe,{examples:["sequenzy tags list --company comp_123"]});var zCe=fg.command("create <name>").description("Create a tag definition").option("--color <color>","Tag color, e.g. gray, red, green, blue, purple").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>_p("create",{name:e,...t}));S(zCe,{notes:["Names are normalized to lowercase with dashes, so `VIP Customer` becomes `vip-customer`."],examples:["sequenzy tags create vip","sequenzy tags create vip --color purple"]});var MCe=fg.command("update <tagId>").description("Update a tag definition color").requiredOption("--color <color>","New tag color").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>_p("update",{tagId:e,...t}));S(MCe,{notes:["System tags cannot be updated."],examples:["sequenzy tags update tag_123 --color red"]});var HCe=fg.command("delete <tagId>").description("Delete a tag definition").option("-y, --yes","Skip the confirmation prompt").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>_p("delete",{tagId:e,...t}));S(HCe,{notes:["Deleting a tag removes it from every subscriber.","Tags used by sequences cannot be deleted until those sequences stop referencing them."],examples:["sequenzy tags delete tag_123 --yes"]});var uc=Je.command("lists").description("Manage subscriber lists").action(()=>uc.help());S(uc,{examples:["sequenzy lists list --company comp_123",'sequenzy lists create Newsletter --description "Public newsletter list"','sequenzy lists update list_123 --name "Weekly Newsletter" --private',"sequenzy lists add-subscribers list_123 --emails-file ./batch-001.csv","sequenzy lists remove-subscribers list_123 --email one@example.com","sequenzy lists import list_123 --emails-file ./batch-001.csv","sequenzy lists delete list_123 --yes"]});var GCe=uc.command("list").description("List subscriber lists").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>ll("list",e));S(GCe,{examples:["sequenzy lists list --company comp_123"]});var JCe=uc.command("create <name>").description("Create a subscriber list").option("-d, --description <text>","List description").option("--private","Mark the list as private").option("--allow-member-unsubscribe","Allow existing private-list members to opt out").option("--no-allow-member-unsubscribe","Hide private lists from member preferences").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ll("create",{name:e,...t}));S(JCe,{examples:['sequenzy lists create Newsletter --description "Public newsletter list"',"sequenzy lists create VIP --private --company comp_123"]});var VCe=uc.command("add-subscribers <listId>").description("Add subscribers to a list from emails, JSON, or a file").option("-e, --email <emails...>","Email addresses to add").option("--emails-json <json>","JSON array of emails, or an object with emails/subscribers").option("--emails-file <file>","JSON, CSV, or newline-separated file with subscriber emails").option("--duplicate-strategy <strategy>","Duplicate strategy: skip, merge, or overwrite","skip").option("--enroll-sequences","Enroll newly created subscribers in matching sequences").option("--opt-in-mode <mode>","Consent mode: default, confirmed, or double_opt_in","default").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ll("add-subscribers",{listId:e,...t}));S(VCe,{notes:["Provide exactly one source: --email, --emails-json, or --emails-file.","Files may be newline-separated, CSV with an email column, a JSON email array, or a JSON object with emails/subscribers.","CSV headers named email, e-mail, email address, or mail are detected; otherwise the first column is used.","New subscribers are not enrolled in matching sequences unless --enroll-sequences is set."],examples:["sequenzy lists add-subscribers list_123 --email one@example.com two@example.com",`sequenzy lists add-subscribers list_123 --emails-json '["one@example.com","two@example.com"]'`,"sequenzy lists add-subscribers list_123 --emails-file ./batch-001.csv"]});var KCe=uc.command("import <listId>").description("Alias for add-subscribers; import subscribers into a list").option("-e, --email <emails...>","Email addresses to add").option("--emails-json <json>","JSON array of emails, or an object with emails/subscribers").option("--emails-file <file>","JSON, CSV, or newline-separated file with subscriber emails").option("--duplicate-strategy <strategy>","Duplicate strategy: skip, merge, or overwrite","skip").option("--enroll-sequences","Enroll newly created subscribers in matching sequences").option("--opt-in-mode <mode>","Consent mode: default, confirmed, or double_opt_in","default").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ll("add-subscribers",{listId:e,...t}));S(KCe,{notes:["`lists import` is an alias for `lists add-subscribers`.","Provide exactly one source: --email, --emails-json, or --emails-file.","Files may be newline-separated, CSV with an email column, a JSON email array, or a JSON object with emails/subscribers.","CSV headers named email, e-mail, email address, or mail are detected; otherwise the first column is used."],examples:["sequenzy lists import list_123 --emails-file ./batch-001.csv",`sequenzy lists import list_123 --emails-json '["one@example.com","two@example.com"]'`]});var WCe=uc.command("update <listId>").description("Update a subscriber list").option("-n, --name <name>","List name").option("-d, --description <text>","List description").option("--private","Mark the list as private").option("--allow-member-unsubscribe","Allow existing private-list members to opt out").option("--no-allow-member-unsubscribe","Hide private lists from member preferences").option("--no-private","Mark the list as public").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ll("update",{listId:e,...t}));S(WCe,{notes:["Provide at least one of --name, --description, --private, --no-private, --allow-member-unsubscribe, or --no-allow-member-unsubscribe."],examples:['sequenzy lists update list_123 --name "Weekly Newsletter"',"sequenzy lists update list_123 --private","sequenzy lists update list_123 --no-private"]});var YCe=uc.command("remove-subscribers <listId>").description("Remove subscribers from a list by email").option("-e, --email <emails...>","Email addresses to remove").option("--emails-json <json>","JSON array of emails, or an object with emails/subscribers").option("--emails-file <file>","JSON, CSV, or newline-separated file with subscriber emails").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ll("remove-subscribers",{listId:e,...t}));S(YCe,{notes:["Provide exactly one source: --email, --emails-json, or --emails-file.","Subscribers are only removed from the list; they stay in your audience.","Emails that do not match a subscriber are reported as not found."],examples:["sequenzy lists remove-subscribers list_123 --email one@example.com two@example.com","sequenzy lists remove-subscribers list_123 --emails-file ./churned.csv"]});var ZCe=uc.command("delete <listId>").description("Delete a subscriber list").option("-y, --yes","Skip the confirmation prompt").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ll("delete",{listId:e,...t}));S(ZCe,{notes:["Deleting a list removes all of its memberships; subscribers themselves are kept."],examples:["sequenzy lists delete list_123 --yes"]});var $u=Je.command("segments").description("Manage segments").action(()=>$u.help());S($u,{notes:["Use --filter-json for arbitrary segment filters. The CLI will fill in missing filter IDs.","Use --match any to create a segment that matches any filter instead of all filters.",'Engagement filters (emailSent, emailDelivered, emailOpened, emailClicked, emailBounced, emailComplained) accept a time range as the value ("24h", "7d", "30d", "90d", "180d", "all"; whole hours go from "1h" to "8760h", and count filters are exact up to "168h"), a specific campaign ("campaign:<campaign_id>"), or an email-type scope ("marketing:<timeRange>" for marketing-policy campaign, automation, and Send API traffic; "transactional:<timeRange>" for transactional-policy sends). Policy scopes use send-time policy snapshots; ambiguous older automation and Send API events without a snapshot are not assigned to either scope. Combine multiple engagement filters with --match all to build things like "bounced campaign A but not campaign B".','Push filters: pushDevice (is/is_not with "any", "web", "ios" or "android") matches active push devices; pushSent, pushDelivered and pushClicked take is/is_not with a time range ("30d", "all") and ignore test sends.'],examples:["sequenzy segments list --company comp_123",'sequenzy segments create --name "Bought Pro" --stripe-product prod_pro',`sequenzy segments create --name "VIP or Churn Risk" --match any --filter-json '[{"field":"tag","operator":"contains","value":"vip"},{"field":"emailOpened","operator":"is_not","value":"30d"}]'`,`sequenzy segments create --name "Bounced A not B" --filter-json '[{"field":"emailBounced","operator":"is","value":"campaign:cmp_abc"},{"field":"emailBounced","operator":"is_not","value":"campaign:cmp_xyz"}]'`,`sequenzy segments create --name "No marketing email this week" --filter-json '[{"field":"emailSent","operator":"is_not","value":"marketing:7d"}]'`,`sequenzy segments create --name "iOS, no push clicks" --filter-json '[{"field":"pushDevice","operator":"is","value":"ios"},{"field":"pushClicked","operator":"is_not","value":"30d"}]'`]});var XCe=$u.command("list").description("List all segments").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>op("list",e));S(XCe,{examples:["sequenzy segments list --company comp_123"]});var ewe=$u.command("create").description("Create a segment").requiredOption("-n, --name <name>","Segment name").option("-c, --company <id>","Company ID override for personal API keys").option("--match <mode>","How filters combine: all or any","all").option("--stripe-product <id>","Stripe product ID to segment on").option("--commerce-product <id>","Commerce product to segment on, as provider:productId (e.g. shopify:42); a bare ID matches any provider").option("--commerce-collection <key>","Commerce collection to segment on, as a collection ID or handle (e.g. skincare); optionally prefixed with a provider").option("--purchase-operator <operator>","Purchase operator (bought, didnt-buy, at-least, less-than)","bought").option("--payments <number>","Payment threshold for at-least/less-than").option("--orders <number>","Order threshold for at-least/less-than with --commerce-product or --commerce-collection").option("--engagement <field>","Email engagement field: emailSent, emailDelivered, emailOpened, emailClicked, emailBounced, or emailComplained").option("--engagement-operator <operator>","Engagement operator: is, is_not, is_temporary_bounce, is_permanent_bounce, at_least, or less_than_count","is").option("--engagement-scope <scope>","Engagement scope: any, marketing, transactional, or campaign","any").option("--engagement-range <range>","Engagement time range: hours such as 6h or 24h, days such as 7d or 30d, or all","all").option("--engagement-campaign <id>","Campaign ID when --engagement-scope is campaign").option("--engagement-count <number>","Event count for at_least/less_than_count engagement operators").option("--filter-json <json>","Raw JSON array of segment filters (IDs are optional)").option("--json","Print raw JSON").action((e)=>op("create",e));S(ewe,{notes:["For array-of-object attributes, positive filters sharing a wildcard array prefix (such as history_events[].venue and history_events[].date) and connected only by AND must match one shared array element. Negative is_not, not_contains, and is_empty filters remain independent."],examples:['sequenzy segments create --name "Bought Pro" --stripe-product prod_pro','sequenzy segments create --name "3+ Pro Payments" --stripe-product prod_pro --purchase-operator at-least --payments 3','sequenzy segments create --name "Starter Kit Buyers" --commerce-product api:prod-starter-kit','sequenzy segments create --name "Repeat Kit Buyers" --commerce-product api:prod-starter-kit --purchase-operator at-least --orders 2','sequenzy segments create --name "Skincare Buyers" --commerce-collection skincare','sequenzy segments create --name "Repeat Skincare Buyers" --commerce-collection skincare --purchase-operator at-least --orders 2','sequenzy segments create --name "Marketing openers" --engagement emailOpened --engagement-scope marketing --engagement-range all','sequenzy segments create --name "Did not open campaign" --engagement emailOpened --engagement-operator is_not --engagement-scope campaign --engagement-campaign cmp_abc',`sequenzy segments create --name "VIP or Churn Risk" --match any --filter-json '[{"field":"tag","operator":"contains","value":"vip"},{"field":"emailOpened","operator":"is_not","value":"30d"}]'`,`sequenzy segments create --name "Bounced A not B" --filter-json '[{"field":"emailBounced","operator":"is","value":"campaign:cmp_abc"},{"field":"emailBounced","operator":"is_not","value":"campaign:cmp_xyz"}]'`]});var twe=$u.command("count <id>").description("Get subscriber count for a segment").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>op("count",{id:e,...t}));S(twe,{examples:["sequenzy segments count seg_123 --company comp_123"]});var nwe=$u.command("update <id>").description("Update a segment name, filters, or join operator").option("-n, --name <name>","Segment name").option("--filters-json <json>","Raw JSON array of segment filters, or an object with a root group").option("--filters-file <file>","Path to a JSON file with segment filters or a root group").option("--join-operator <operator>","How filters combine: and or or").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>op("update",{id:e,...t}));S(nwe,{notes:["Provide at least one of --name, --filters-json, --filters-file, or --join-operator.","Filters replace the existing filter set; missing filter IDs are filled in by the CLI.","For array-of-object attributes, positive filters sharing a wildcard array prefix (such as history_events[].venue and history_events[].date) and connected only by AND must match one shared array element. Negative is_not, not_contains, and is_empty filters remain independent."],examples:['sequenzy segments update seg_123 --name "Churn Risk"',`sequenzy segments update seg_123 --filters-json '[{"field":"tag","operator":"contains","value":"vip"}]'`,"sequenzy segments update seg_123 --join-operator or"]});var rwe=$u.command("delete <id>").description("Delete a segment").option("-y, --yes","Skip the confirmation prompt").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>op("delete",{id:e,...t}));S(rwe,{examples:["sequenzy segments delete seg_123 --yes"]});var wl=Je.command("audience-syncs").description("Sync segments to Meta custom audiences").action(()=>wl.help());S(wl,{notes:["Requires the Meta Ads integration to be connected in the dashboard (Settings -> Integrations).",'Use --template to start from a ready-made segment ("zero-ltv", "no-purchase-1y", "recent-buyers", "high-spenders-ecom", "non-buyers", "engaged"); the segment is created automatically on first use.',"Audiences are add-only: subscribers who leave the segment stay in the Meta audience."],examples:["sequenzy audience-syncs list",'sequenzy audience-syncs create --template recent-buyers --ad-account act_123 --name "Sequenzy - Recent buyers"']});var owe=wl.command("list").description("List audience syncs with schedule and status").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>Au("list",e));S(owe,{examples:["sequenzy audience-syncs list --company comp_123"]});var iwe=wl.command("ad-accounts").description("List the connected Meta ad accounts").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>Au("ad-accounts",e));S(iwe,{examples:["sequenzy audience-syncs ad-accounts"]});var swe=wl.command("create").description("Create an audience sync (segment -> Meta custom audience)").option("--segment <id>","Existing segment ID to sync").option("--template <id>",'Predefined segment template (for example "recent-buyers", "zero-ltv", "no-purchase-1y")').requiredOption("--ad-account <id>","Meta ad account ID (see `sequenzy audience-syncs ad-accounts`)").requiredOption("-n, --name <name>","Audience name in Meta Ads Manager").option("--frequency <frequency>","Sync frequency: hourly, daily, or weekly","daily").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>Au("create",e));S(swe,{examples:['sequenzy audience-syncs create --template recent-buyers --ad-account act_123 --name "Sequenzy - Recent buyers"','sequenzy audience-syncs create --segment seg_123 --ad-account act_123 --name "Sequenzy - VIPs" --frequency hourly']});var awe=wl.command("update <id>").description("Change an audience sync's frequency or pause/resume it").option("--frequency <frequency>","Sync frequency: hourly, daily, or weekly").option("--active <bool>","true to resume, false to pause").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Au("update",{id:e,...t}));S(awe,{examples:["sequenzy audience-syncs update sync_123 --frequency weekly","sequenzy audience-syncs update sync_123 --active false"]});var cwe=wl.command("delete <id>").description("Remove an audience sync (the Meta audience itself is kept)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Au("delete",{id:e,...t}));S(cwe,{examples:["sequenzy audience-syncs delete sync_123"]});var lwe=wl.command("sync <id>").description("Trigger an immediate sync run").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Au("sync",{id:e,...t}));S(lwe,{examples:["sequenzy audience-syncs sync sync_123"]});var Ov=Je.command("warehouse").description("Sync contacts and events from Snowflake, BigQuery, Redshift or Postgres").action(()=>Ov.help());S(Ov,{notes:["Connect a warehouse with a read-only user, then create syncs that run a SELECT query on a schedule.","Subscriber syncs import contacts through the same pipeline as imports; event syncs record events on existing contacts.","Each run only sends rows that changed. Set --cursor-column (for example updated_at) so runs read only new rows."],examples:[`${yl}=... sequenzy warehouse connections create --provider postgres --name Analytics --host db.example.com --database analytics --username reader`,"sequenzy warehouse connections preview conn_123 --query 'select email, plan from customers'",`sequenzy warehouse syncs create --connection conn_123 --name Customers --query-file customers.sql --mapping-json '{"emailColumn":"email","attributes":[{"column":"plan","attribute":"plan"}]}' --cursor-column updated_at`]});var Sl=Ov.command("connections").description("Manage warehouse connections").action(()=>Sl.help());Sl.command("list").description("List warehouse connections").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>bl("list",e));Sl.command("get <id>").description("Show a warehouse connection").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>bl("get",{id:e,...t}));var uwe=Sl.command("create").description("Connect a warehouse (runs a test query before saving)").requiredOption("--provider <provider>","snowflake, bigquery, redshift or postgres").requiredOption("-n, --name <name>","Display name").option("--config-json <json>","Connection settings as JSON (merged with the flags below)").option("--account <account>","Snowflake account identifier").option("--username <user>","Database user").option("--warehouse <warehouse>","Snowflake warehouse").option("--database <database>","Database name").option("--schema <schema>","Snowflake schema").option("--role <role>","Snowflake role").option("--project-id <id>","BigQuery project ID").option("--location <location>","BigQuery location, for example US").option("--host <host>","Redshift/Postgres host").option("--port <port>","Redshift/Postgres port").option("--ssl-mode <mode>","require or verify-full").option("--private-key-file <path>","Snowflake PKCS#8 private key (PEM file)").option("--private-key-passphrase <passphrase>","Passphrase for an encrypted key").option("--service-account-file <path>","BigQuery service account key (JSON file)").option("--password <password>",`Redshift/Postgres password (or set ${yl})`).option("--credentials-file <path>","All credentials as a JSON file").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>bl("create",e));S(uwe,{examples:["sequenzy warehouse connections create --provider snowflake --name Snowflake --account myorg-myaccount --username SEQUENZY_READER --warehouse ANALYTICS_WH --database PROD --private-key-file rsa_key.p8","sequenzy warehouse connections create --provider bigquery --name BigQuery --project-id acme-analytics --service-account-file key.json",`${yl}=... sequenzy warehouse connections create --provider redshift --name Redshift --host cluster.abc.us-east-1.redshift.amazonaws.com --database analytics --username reader`]});Sl.command("update <id>").description("Rename, change settings or rotate credentials (re-tested before saving)").option("-n, --name <name>","Display name").option("--config-json <json>","Connection settings as JSON (merged with the flags below)").option("--account <account>","Snowflake account identifier").option("--username <user>","Database user").option("--warehouse <warehouse>","Snowflake warehouse").option("--database <database>","Database name").option("--schema <schema>","Snowflake schema").option("--role <role>","Snowflake role").option("--project-id <id>","BigQuery project ID").option("--location <location>","BigQuery location, for example US").option("--host <host>","Redshift/Postgres host").option("--port <port>","Redshift/Postgres port").option("--ssl-mode <mode>","require or verify-full").option("--private-key-file <path>","Snowflake PKCS#8 private key (PEM file)").option("--private-key-passphrase <passphrase>","Passphrase for an encrypted key").option("--service-account-file <path>","BigQuery service account key (JSON file)").option("--password <password>","New Redshift/Postgres password").option("--password-from-env",`Rotate the Redshift/Postgres password to ${yl}`).option("--credentials-file <path>","All credentials as a JSON file").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>bl("update",{id:e,...t}));Sl.command("delete <id>").description("Delete a connection (delete its syncs first)").option("-y, --yes","Skip the confirmation prompt").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>bl("delete",{id:e,...t}));Sl.command("test <id>").description("Run a test query with the stored credentials").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>bl("test",{id:e,...t}));Sl.command("preview <id>").description("Run a query with a 20-row limit to see its columns").option("--query <sql>","SELECT query").option("--query-file <path>","File with the SELECT query").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>bl("preview",{id:e,...t}));var Dl=Ov.command("syncs").description("Manage warehouse syncs").action(()=>Dl.help());Dl.command("list").description("List syncs with status and the latest run").option("--connection <id>","Only syncs of this connection").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>vl("list",e));Dl.command("get <id>").description("Show a sync").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>vl("get",{id:e,...t}));var dwe=Dl.command("create").description("Create a sync (columns are checked against the query; the first run starts now)").requiredOption("--connection <id>","Warehouse connection ID").requiredOption("-n, --name <name>","Display name").option("--kind <kind>","subscribers or events","subscribers").option("--query <sql>","SELECT query").option("--query-file <path>","File with the SELECT query").option("--mapping-json <json>","Column mapping as JSON").option("--mapping-file <path>","Column mapping as a JSON file").option("--cursor-column <column>","Column for incremental reads (for example updated_at)").option("--frequency <frequency>","every_15_minutes, hourly, daily, weekly or manual").option("--lists <ids>","Comma-separated list IDs for new contacts (subscriber syncs)").option("--opt-in-mode <mode>","confirmed or double_opt_in (subscriber syncs)").option("--trigger-automations","Let new contacts or recent events start automations").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>vl("create",e));S(dwe,{notes:['Subscriber mapping: {"emailColumn","phoneColumn","externalIdColumn","firstNameColumn","lastNameColumn","tagsColumn","attributes":[{"column","attribute"}]}.','Event mapping: {"emailColumn" or "externalIdColumn", "eventNameColumn" or "eventName", "eventIdColumn", "occurredAtColumn", "properties":[{"column","property"}]}.'],examples:[`sequenzy warehouse syncs create --connection conn_123 --name Customers --query 'select email, first_name, plan, updated_at from customers' --mapping-json '{"emailColumn":"email","firstNameColumn":"first_name","attributes":[{"column":"plan","attribute":"plan"}]}' --cursor-column updated_at --frequency hourly`,`sequenzy warehouse syncs create --connection conn_123 --name Orders --kind events --query-file orders.sql --mapping-json '{"emailColumn":"email","eventName":"order_placed","eventIdColumn":"order_id","occurredAtColumn":"placed_at"}'`]});Dl.command("update <id>").description("Change the query, mapping, schedule or options; pause or resume").option("-n, --name <name>","Display name").option("--query <sql>","SELECT query").option("--query-file <path>","File with the SELECT query").option("--mapping-json <json>","Column mapping as JSON").option("--mapping-file <path>","Column mapping as a JSON file").option("--cursor-column <column>","Column for incremental reads (for example updated_at)").option("--frequency <frequency>","every_15_minutes, hourly, daily, weekly or manual").option("--lists <ids>","Comma-separated list IDs for new contacts (subscriber syncs)").option("--opt-in-mode <mode>","confirmed or double_opt_in (subscriber syncs)").option("--trigger-automations","Let new contacts or recent events start automations").option("--no-trigger-automations","Stop starting automations").option("--enabled <bool>","true to resume, false to pause").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>vl("update",{id:e,...t}));Dl.command("delete <id>").description("Delete a sync (imported contacts and events stay)").option("-y, --yes","Skip the confirmation prompt").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>vl("delete",{id:e,...t}));Dl.command("run <id>").description("Run a sync now").option("--full-resync","Forget what was sent and send every row again").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>vl("run",{id:e,...t}));Dl.command("runs <id>").description("Show recent runs with row counts, import progress and errors").option("--limit <n>","Number of runs (1-100, default 20)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>vl("runs",{id:e,...t}));var ka=Je.command("data-exports").description("Stream events and subscriber snapshots to your S3 or GCS bucket").action(()=>ka.help());S(ka,{notes:["Files are gzipped JSON lines under <prefix>/<dataset>/date=YYYY-MM-DD/, ready for Snowflake, BigQuery, Redshift, Athena or DuckDB.","Datasets: email_events, sms_events, custom_events, subscribers (daily snapshot). Rows are delivered at least once; deduplicate on id.",`Pass the secret with --secret-access-key or the ${Ca} environment variable. It is never returned by the API.`],examples:["sequenzy data-exports list",`${Ca}=... sequenzy data-exports create --name "Lake" --bucket acme-exports --region us-east-1 --access-key-id AKIA...`,"sequenzy data-exports runs exp_123"]});var pwe=ka.command("list").description("List data exports with progress and status").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>tc("list",e));S(pwe,{examples:["sequenzy data-exports list --json"]});var mwe=ka.command("get <id>").description("Show one data export").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>tc("get",{id:e,...t}));S(mwe,{examples:["sequenzy data-exports get exp_123"]});var fwe=ka.command("create").description("Add a bucket destination (verifies access with a test file)").requiredOption("-n, --name <name>","Display name").option("--provider <provider>","s3 (AWS or S3-compatible) or gcs","s3").requiredOption("--bucket <bucket>","Bucket name").option("--region <region>","Bucket region (required for AWS S3)").option("--endpoint <url>","Custom S3-compatible endpoint (R2, MinIO, Backblaze)").option("--prefix <path>","Path prefix inside the bucket").requiredOption("--access-key-id <id>","Access key ID (GCS: HMAC access ID)").option("--secret-access-key <secret>",`Secret access key (or set ${Ca})`).option("--datasets <list>","Comma-separated: email_events,sms_events,custom_events,subscribers").option("--frequency <frequency>","every_5_minutes, every_15_minutes, hourly or daily").option("--backfill-days <days>","Include up to 30 days of events already recorded (default 0)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>tc("create",e));S(fwe,{examples:[`${Ca}=... sequenzy data-exports create --name "Lake" --bucket acme-exports --region us-east-1 --access-key-id AKIA... --prefix sequenzy`,`${Ca}=... sequenzy data-exports create --name "GCS" --provider gcs --bucket acme --access-key-id GOOG1... --datasets email_events,subscribers --backfill-days 7`]});var gwe=ka.command("update <id>").description("Change datasets, frequency, location or credentials; pause or resume").option("-n, --name <name>","Display name").option("--bucket <bucket>","Bucket name").option("--region <region>","Bucket region").option("--endpoint <url>","Custom S3-compatible endpoint").option("--prefix <path>","Path prefix inside the bucket").option("--access-key-id <id>","New access key ID (rotates credentials)").option("--secret-access-key <secret>",`New secret (or set ${Ca})`).option("--datasets <list>","Comma-separated datasets").option("--frequency <frequency>","every_5_minutes, every_15_minutes, hourly or daily").option("--enabled <bool>","true to resume, false to pause").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>tc("update",{id:e,...t}));S(gwe,{examples:["sequenzy data-exports update exp_123 --frequency hourly","sequenzy data-exports update exp_123 --enabled false","sequenzy data-exports update exp_123 --datasets email_events,custom_events"]});var Awe=ka.command("delete <id>").description("Delete a data export (files already written are kept)").option("-y, --yes","Skip the confirmation prompt").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>tc("delete",{id:e,...t}));S(Awe,{examples:["sequenzy data-exports delete exp_123 --yes"]});var hwe=ka.command("test <id>").description("Write a test file to confirm the credentials still work").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>tc("test",{id:e,...t}));S(hwe,{examples:["sequenzy data-exports test exp_123"]});var ywe=ka.command("run <id>").description("Start an export now instead of waiting for the schedule").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>tc("run",{id:e,...t}));S(ywe,{examples:["sequenzy data-exports run exp_123"]});var bwe=ka.command("runs <id>").description("Show recent export runs (last 14 days)").option("--limit <n>","Number of runs (1-100, default 20)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>tc("runs",{id:e,...t}));S(bwe,{examples:["sequenzy data-exports runs exp_123 --limit 5"]});var Bl=Je.command("products").description("Manage products and digital delivery files").action(()=>Bl.help());S(Bl,{notes:["Products sync from Stripe, Shopify, and WooCommerce integrations.","Attach a deliverable file to a Stripe product, then reference it in purchase sequence emails with {{event.download.url}} and {{event.download.name}}."],examples:["sequenzy products list --provider stripe","sequenzy products sync",'sequenzy products upsert my-ebook --title "The Ebook" --price-cents 1900 --file ./ebook.pdf',"sequenzy products attach-file prod_abc --file ./guide.pdf","sequenzy products attach-file prod_abc --url https://example.com/guide.pdf --name guide.pdf","sequenzy products detach-file prod_abc","sequenzy products delete my-ebook"]});var vwe=Bl.command("list").description("List synced products including attached delivery files").option("-c, --company <id>","Company ID override for personal API keys").option("--provider <provider>","Filter by provider (stripe, shopify, woocommerce, manual)").option("--search <query>","Filter products by title").option("--limit <number>","Products per page (1-100, default 50)").option("--offset <number>","Number of products to skip").option("--all","Fetch every page instead of just the first").option("--json","Print raw JSON").action((e)=>yu("list",e));S(vwe,{notes:["Returns one page by default. The header shows 'N of TOTAL' when the catalog is larger than the page.","Use --all to page through catalogs larger than the 100-per-request cap."],examples:["sequenzy products list --provider stripe","sequenzy products list --all","sequenzy products list --limit 100 --offset 100"]});var Ewe=Bl.command("sync").description("Queue a Stripe product catalog sync").option("-c, --company <id>","Company ID override for personal API keys").option("--integration <id>","Stripe integration ID to sync").option("--json","Print raw JSON").action((e)=>yu("sync",e));S(Ewe,{examples:["sequenzy products sync --company comp_123","sequenzy products sync --integration int_123"]});var Iwe=Bl.command("upsert [productId]").description("Create or update products in the catalog (Commerce API, keyed by your productId)").option("--title <title>","Product title (required for single upserts)").option("--description <text>","Product description").option("--price-cents <cents>","Price in the smallest currency unit").option("--currency <code>","ISO currency code, e.g. USD").option("--image-url <url>","Product image URL").option("--product-url <url>","Product page URL").option("--provider-created-at <iso>","Product creation time from the source catalog (ISO 8601)").option("--clear-provider-created-at","Clear the stored source-catalog creation time").option("--in-stock","Mark the product as in stock").option("--out-of-stock","Mark the product as out of stock").option("--file <path>","Deliverable file to upload and attach in one step").option("--url <link>","External deliverable http(s) link to attach in one step").option("--name <fileName>","Display name for the attached deliverable").option("--products-json <json>","Inline JSON array of products to upsert").option("--products-file <file>","Path to a JSON file with products to upsert").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>yu("upsert",t,e));S(Iwe,{notes:["Products are keyed by your own productId and stored under the api provider.","Combine --file or --url with a single-product upsert to attach the deliverable file in the same command.","Use --products-json/--products-file for bulk upserts of up to 100 products."],examples:['sequenzy products upsert my-ebook --title "The Ebook" --price-cents 1900 --currency USD --file ./ebook.pdf','sequenzy products upsert my-course --title "The Course" --url https://files.example.com/course.zip',"sequenzy products upsert --products-file ./products.json"]});var Cwe=Bl.command("delete <productId>").description("Delete a product previously pushed via the Commerce API").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>yu("delete",t,e));S(Cwe,{examples:["sequenzy products delete my-ebook"]});var wwe=Bl.command("attach-file <id>").description("Attach the deliverable file buyers receive after purchase").option("--file <path>","Local file to upload (PDF, ePub, ZIP, media)").option("--url <link>","External http(s) link instead of an upload").option("--name <fileName>","Display name for the file (e.g. guide.pdf)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>yu("attach-file",t,e));S(wwe,{examples:["sequenzy products attach-file prod_abc --file ./guide.pdf","sequenzy products attach-file prod_abc --url https://example.com/template.zip --name template.zip"]});var Swe=Bl.command("detach-file <id>").description("Remove the attached delivery file from a product").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>yu("detach-file",t,e));S(Swe,{examples:["sequenzy products detach-file prod_abc"]});var gg=Je.command("team").description("Manage team members and invitations").action(()=>gg.help());S(gg,{notes:["Inviting and cancelling invitations requires owner or admin access.","Billing access can only be granted by the company owner."],examples:["sequenzy team list","sequenzy team invite teammate@example.com --role admin","sequenzy team cancel-invitation inv_123"]});var Dwe=gg.command("list").description("List team members and pending invitations").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>Cv("list",e));S(Dwe,{examples:["sequenzy team list --company comp_123"]});var Bwe=gg.command("invite <email>").description("Invite a team member or add an existing user").requiredOption("--role <role>","Member role: admin, viewer, or restricted").option("--billing-access","Allow the member to manage billing (owner only)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Cv("invite",{email:e,...t}));S(Bwe,{notes:["Existing Sequenzy users are added to the team immediately; everyone else receives an email invitation.","Invitations expire automatically and can be re-sent by inviting the same email again after cancelling."],examples:["sequenzy team invite teammate@example.com --role admin","sequenzy team invite editor@example.com --role restricted","sequenzy team invite finance@example.com --role viewer --billing-access"]});var xwe=gg.command("cancel-invitation <invitationId>").description("Cancel a pending team invitation").option("-y, --yes","Skip the confirmation prompt").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Cv("cancel-invitation",{invitationId:e,...t}));S(xwe,{notes:["Run `sequenzy team list` first to find invitation IDs."],examples:["sequenzy team cancel-invitation inv_123 --yes"]});var gi=Je.command("inbox").description("Read and answer email in your inbox").action(()=>gi.help());S(gi,{notes:["The inbox receives replies to your campaigns, sequences, and transactional email, plus any email sent to your inbox address (sequenzy inbox address).","Use --note on replies to add an internal note instead of emailing the contact."],examples:["sequenzy inbox address","sequenzy inbox list --status open --unread","sequenzy inbox get conv_123","sequenzy inbox reply conv_123 --text 'Thanks for reaching out!'","sequenzy inbox close conv_123","sequenzy inbox close conv_123 conv_456"]});var _we=gi.command("address").description("Show or set the address anyone can email to reach your inbox").option("--local-part <name>","Use <name>@<domain> on one of your receiving domains (with --domain)").option("--domain <domain>","Receiving domain for --local-part").option("--reset","Go back to your Sequenzy inbox address").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>Qi("address",e));S(_we,{notes:["Email sent to this address arrives as a new conversation, or joins an existing thread when it answers one.","Receiving must be on (Settings > Inbox) for mail to arrive.","With --local-part and --domain the address becomes <name>@<domain>, where <domain> is one of your receiving domains (see `sequenzy receiving-domains`). It starts receiving once that domain is verified; inbox+{companyId}@inbound.sequenzy.com keeps working.","Any other address on a receiving domain also lands in Inbox."],examples:["sequenzy inbox address","sequenzy inbox address --local-part support --domain acme.com","sequenzy inbox address --reset"]});var kwe=gi.command("list").description("List conversations").option("-s, --status <status>","Filter by status: open, closed, or all").option("--search <query>","Search by contact email, name, or subject").option("--unread","Only conversations with unread messages").option("--spam","List the Spam folder instead of the inbox").option("--sent-to <address>","Only conversations that started at this inbox address").option("-p, --page <number>","Page number (default 1)").option("-l, --limit <number>","Results per page (1-100, default 20)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>Qi("list",e));S(kwe,{notes:["Mail the spam or virus scan flags goes to the Spam folder; other lists leave it out. See `sequenzy inbox recipients` for the addresses --sent-to accepts."],examples:["sequenzy inbox list","sequenzy inbox list --status open --unread",'sequenzy inbox list --search "refund" --limit 50',"sequenzy inbox list --spam","sequenzy inbox list --sent-to admin@example.com"]});var Rwe=gi.command("recipients").description("List the inbox addresses conversations started at").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>Qi("recipients",e));S(Rwe,{examples:["sequenzy inbox recipients"]});var Qwe=gi.command("get <conversationId>").description("Get a conversation with its full message history").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Qi("get",{conversationId:e,...t}));S(Qwe,{examples:["sequenzy inbox get conv_123","sequenzy inbox get conv_123 --json"]});var Twe=gi.command("reply <conversationId>").description("Reply to a conversation or add an internal note").option("-t, --text <text>","Plain text message body").option("--html-file <file>","Read an HTML message body from file").option("-s, --subject <subject>","Override the reply subject").option("--note","Add an internal note instead of emailing the subscriber").option("--sender-profile-id <id>","Reply from this sender profile instead of the default. See sequenzy sender-profiles list").option("--attach <file>","Attach a file (repeat for up to 10 files, 15 MB total)",(e,t=[])=>[...t,e]).option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Qi("reply",{conversationId:e,...t}));S(Twe,{notes:["Provide a body with --text and/or --html-file.","Outbound replies are emailed to the subscriber and reopen closed conversations; notes are internal only.","--sender-profile-id sends the reply from that sender profile; its domain must be verified. Without it, the reply uses the API key owner's address.","--attach can be repeated; attachments need attachment storage on the server (see sequenzy inbox address)."],examples:["sequenzy inbox reply conv_123 --text 'Thanks for reaching out!'","sequenzy inbox reply conv_123 --text 'Invoice attached' --attach ./invoice.pdf","sequenzy inbox reply conv_123 --text 'Happy to help' --sender-profile-id sp_123","sequenzy inbox reply conv_123 --html-file ./reply.html","sequenzy inbox reply conv_123 --text 'Customer asked for a refund' --note"]});var $we=gi.command("close <conversationIds...>").description("Close one or more conversations").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Qi("close",{conversationIds:e,...t}));S($we,{notes:["Pass up to 100 conversation IDs to close them in one request. Already closed conversations are reported as unchanged; missing IDs are reported and exit with status 1."],examples:["sequenzy inbox close conv_123","sequenzy inbox close conv_123 conv_456 conv_789"]});var Nwe=gi.command("reopen <conversationIds...>").description("Reopen one or more closed conversations").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Qi("reopen",{conversationIds:e,...t}));S(Nwe,{notes:["Pass up to 100 conversation IDs to reopen them in one request. Missing IDs are reported and exit with status 1."],examples:["sequenzy inbox reopen conv_123","sequenzy inbox reopen conv_123 conv_456"]});var Owe=gi.command("spam <conversationIds...>").description("Move one or more conversations to the Spam folder").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Qi("spam",{conversationIds:e,...t}));S(Owe,{notes:["Pass up to 100 conversation IDs. Missing IDs are reported and exit with status 1."],examples:["sequenzy inbox spam conv_123 conv_456"]});var Pwe=gi.command("not-spam <conversationIds...>").description("Move one or more conversations from Spam back to the inbox").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Qi("not-spam",{conversationIds:e,...t}));S(Pwe,{notes:["Pass up to 100 conversation IDs. Missing IDs are reported and exit with status 1."],examples:["sequenzy inbox not-spam conv_123"]});var Fwe=gi.command("mark-read <conversationId>").description("Mark all messages in a conversation as read").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Qi("mark-read",{conversationId:e,...t}));S(Fwe,{examples:["sequenzy inbox mark-read conv_123"]});var qwe=gi.command("mark-unread <conversationId>").description("Mark a conversation unread again").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Qi("mark-unread",{conversationId:e,...t}));S(qwe,{notes:["Its latest received message becomes unread again."],examples:["sequenzy inbox mark-unread conv_123"]});var Lwe=gi.command("forward <conversationId> <messageId>").description("Email a copy of one message to another address").requiredOption("--to <email>","Address to forward the message to").option("--sender-profile-id <id>","Forward from this sender profile instead of the company default").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t,n)=>Qi("forward",{conversationId:e,messageId:t,...n}));S(Lwe,{notes:["Get message IDs from sequenzy inbox get. Received and sent emails can be forwarded, including their attachments; notes cannot.","The forward is recorded in the conversation and does not change its status or unread state."],examples:["sequenzy inbox forward conv_123 msg_456 --to teammate@example.com"]});var dc=Je.command("webhooks").description("Manage outbound webhook endpoints").action(()=>dc.help());S(dc,{notes:["Webhook payloads are signed; the signing secret is only shown once at creation time.","Valid events cover email.*, sms.*, campaign.*, subscriber.*, and sequence.* types; omit --event to use the default set. campaign.sent is explicit-only."],examples:["sequenzy webhooks list","sequenzy webhooks create --name CI --url https://example.com/hook --event email.bounced","sequenzy webhooks deliveries wh_123 --limit 50","sequenzy webhooks replay wh_123 del_456"]});var Uwe=dc.command("list").description("List outbound webhook endpoints").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>El("list",e));S(Uwe,{examples:["sequenzy webhooks list --company comp_123"]});var jwe=dc.command("create").description("Create an outbound webhook endpoint").requiredOption("-n, --name <name>","Webhook name").requiredOption("-u, --url <url>","HTTPS endpoint URL").option("-e, --event <events...>","Event types to deliver, e.g. email.bounced campaign.sent subscriber.list_subscribed subscriber.list_unsubscribed").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>El("create",e));S(jwe,{notes:["The signing secret is printed once on creation and cannot be retrieved later - store it immediately.","Omit --event to subscribe to the default event set.","email.received (new mail to your inbox addresses and receiving domains, not replies to your emails; not sent for spam) is opt-in: pass it with --event."],examples:["sequenzy webhooks create --name CI --url https://example.com/hook --event email.bounced","sequenzy webhooks create --name Inbox --url https://example.com/hook --event email.received","sequenzy webhooks create --name 'All events' --url https://example.com/hook"]});var zwe=dc.command("update <id>").description("Update an outbound webhook endpoint").option("-n, --name <name>","Webhook name").option("-u, --url <url>","HTTPS endpoint URL").option("-e, --event <events...>","Replacement event types").option("--enable","Enable the webhook").option("--disable","Disable the webhook").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>El("update",{id:e,...t}));S(zwe,{notes:["Provide at least one of --name, --url, --event, --enable, or --disable.","Changing the URL or re-enabling resets the failure circuit breaker."],examples:["sequenzy webhooks update wh_123 --url https://example.com/new-hook","sequenzy webhooks update wh_123 --event email.bounced email.complained","sequenzy webhooks update wh_123 --disable"]});var Mwe=dc.command("delete <id>").description("Delete an outbound webhook endpoint").option("-y, --yes","Skip the confirmation prompt").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>El("delete",{id:e,...t}));S(Mwe,{examples:["sequenzy webhooks delete wh_123 --yes"]});var Hwe=dc.command("test <id>").description("Send a test event to a webhook endpoint").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>El("test",{id:e,...t}));S(Hwe,{notes:["The webhook must be enabled to receive a test event."],examples:["sequenzy webhooks test wh_123"]});var Gwe=dc.command("deliveries <id>").description("List recent deliveries for a webhook endpoint").option("-l, --limit <number>","Maximum deliveries to return (1-100)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>El("deliveries",{id:e,...t}));S(Gwe,{examples:["sequenzy webhooks deliveries wh_123","sequenzy webhooks deliveries wh_123 --limit 50"]});var Jwe=dc.command("replay <id> <deliveryId>").description("Replay a webhook delivery").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t,n)=>El("replay",{id:e,deliveryId:t,...n}));S(Jwe,{notes:["Run `sequenzy webhooks deliveries <id>` first to find delivery IDs."],examples:["sequenzy webhooks replay wh_123 del_456"]});var Vwe=Je.command("account").description("Verify the active API key, permissions, and your Sequenzy account context").option("--json","Print JSON").action(jz);S(Vwe,{notes:["Makes a live API request with the active credential. Compare its key name and prefix with Settings after replacing a key."],examples:["sequenzy account","sequenzy account --json"]});var JB=Je.command("notifications").description("Manage which account notifications Sequenzy emails you");JB.command("get").description("Show your notification settings for the current company").option("--json","Print JSON").action(HM);JB.command("set").description("Change your notification settings for the current company").option("--new-subscriber <mode>","Notify when a contact joins: off, instant, or daily").option("--form-submitted <mode>","Notify on form, popup, or landing-page submissions: off or instant (50/day cap)").option("--campaign-completed <mode>","Notify when a campaign finishes sending: off or instant").option("--weekly-report <mode>","Monday one-screen summary of last week's sends, engagement, revenue, and slipping sequences: off or weekly").option("--account-health <mode>","Findings of the scheduled account health check, inside the Monday report or as their own email: off or instant").option("--json","Print JSON").action(GM);S(JB,{notes:["These are your own settings, not the workspace's. Teammates choose their own and this never changes theirs.","New-subscriber notifications fall back to a daily summary automatically once a day passes the instant cap, and imports never trigger them.","'daily' is not valid for --form-submitted or --campaign-completed: each submission and each campaign finish is its own event.","The weekly report is on by default and only goes out for weeks in which the workspace sent more than 10 emails; 'weekly' is its only delivery mode.","Account health findings are on by default for the workspace owner. They ride inside the Monday report when you get it, otherwise they arrive as their own email; 'off' stops both."],examples:["sequenzy notifications get","sequenzy notifications set --new-subscriber daily","sequenzy notifications set --form-submitted instant","sequenzy notifications set --weekly-report off","sequenzy notifications set --account-health off","sequenzy notifications set --new-subscriber off --form-submitted off --campaign-completed off --weekly-report off"]});var yV=(e,t=[])=>[...t,e],Kwe=Je.command("feedback <message>").description("Send product feedback about Sequenzy to the Sequenzy team").option("--category <category>","Category: missing_capability, bug, docs, ux, praise, other (default: other)").option("--context <context>","What you were trying to accomplish when you hit the gap").option("--intent <text>","Bug reports: the user's request, verbatim or closely paraphrased").option("--expected <text>","Bug reports: what you expected to happen").option("--actual <text>","Bug reports: what actually happened instead").option("--tool-call <call>",'Bug reports: a command/tool call that led to the problem, as "<tool> | <args summary> | <error>" (args and error optional). Repeatable, in order.',yV).option("--resource-id <id>","Bug reports: ID of an affected resource (campaign, sequence, subscriber, ...). Repeatable.",yV).option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Y2(e,t));S(Kwe,{notes:["Agents: send feedback whenever the user wanted something the CLI, API, or MCP tools do not support. The Sequenzy team reads every submission.","When a command misbehaved or produced a wrong result, include --intent, --expected, --actual, --tool-call, and --resource-id so the team can reproduce it. Summarize arguments - do not paste raw subscriber data or secrets."],examples:['sequenzy feedback "No command to bulk-delete campaigns by label" --category missing_capability','sequenzy feedback "Segment count and list output disagree for seg_123" --category bug --context "Auditing a re-engagement segment"','sequenzy feedback "Campaign update dropped the scheduled time" --category bug --intent "Move the promo send to 9am Tuesday" --tool-call "campaigns update | --schedule 2026-08-11T09:00" --expected "Campaign rescheduled" --actual "Campaign reverted to draft" --resource-id cmp_123']});var xl=Je.command("api-keys").description("Manage company API keys").action(()=>xl.help());S(xl,{notes:["The plain API key is only returned on creation. Save it immediately.","Listing and revocation return metadata only; secrets and stored hashes are never returned.","Every subcommand except 'handoff' needs the api_keys:manage scope. Use 'handoff' when the active key does not have it."],examples:["sequenzy api-keys list --company comp_123","sequenzy api-keys create",'sequenzy api-keys create --name "CI deploy key" --company comp_123',"sequenzy api-keys update key_123 --preset agent_safe","sequenzy api-keys revoke key_123 --company comp_123 --yes","sequenzy api-keys handoff --preset agent_safe --replaces current"]});var Wwe=xl.command("create").description("Create a company API key").option("-n, --name <name>","Human-readable API key name").option("-c, --company <id>","Company ID override for personal API keys").option("--preset <preset>","Permission preset: full_access, read_only, agent_safe, ai_drafting, data_ingest_safe, data_ingest_automations, transactional_sender, marketing_sender (default: full_access)").option("--scopes <scopes>","Comma-separated explicit permission scopes (overrides --preset)").option("--json","Print raw JSON").action((e)=>gu("create",e));S(Wwe,{notes:["Keys default to full access. Pass --preset or --scopes to restrict what the key can do."],examples:["sequenzy api-keys create",'sequenzy api-keys create --name "CI deploy key" --company comp_123','sequenzy api-keys create --preset transactional_sender --name "Order emails"','sequenzy api-keys create --scopes "subscribers:read,subscribers:write,events:write"']});var Ywe=xl.command("handoff").description("Get an owner-confirmed dashboard link for creating or rotating a key").option("-n, --name <name>","Suggested name for the new API key").option("-c, --company <id>","Company ID override for personal API keys").option("--preset <preset>","Suggested permission preset: full_access, read_only, agent_safe, ai_drafting, data_ingest_safe, data_ingest_automations, transactional_sender, marketing_sender").option("--scopes <scopes>","Comma-separated explicit permission scopes (overrides --preset)").option("--replaces <api-key-id>","Key the new one replaces. Pass 'current' for the key you are authenticated with").option("--json","Print raw JSON").action((e)=>gu("handoff",e));S(Ywe,{notes:["Use this when key management fails because the active key lacks api_keys:manage. That scope fails closed on purpose and cannot be granted through the API by the key missing it.","This creates nothing and never prints a key. The link opens the dashboard create-key form prefilled; the owner reviews it, clicks Create, and copies the key from the browser.","With --replaces, the dashboard offers to revoke the predecessor once the replacement exists, which finishes a rotation in one visit."],examples:['sequenzy api-keys handoff --name "Production sync (rotated)" --preset agent_safe --replaces current','sequenzy api-keys handoff --scopes "subscribers:read,events:write" --company comp_123']});var Zwe=xl.command("list").description("List company API keys without secret values").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>gu("list",e));S(Zwe,{notes:["Use the returned ID, name, prefix, and current-key marker to identify a key before revoking it."],examples:["sequenzy api-keys list","sequenzy api-keys list --company comp_123 --json"]});var Xwe=xl.command("update").description("Rename a company API key or change its permissions in place").argument("<api-key-id>","Exact API key ID returned by api-keys list").option("-n, --name <name>","New human-readable API key name").option("-c, --company <id>","Company ID override for personal API keys").option("--preset <preset>","Replacement permission preset: full_access, read_only, agent_safe, ai_drafting, data_ingest_safe, data_ingest_automations, transactional_sender, marketing_sender").option("--scopes <scopes>","Comma-separated replacement permission scopes (overrides --preset)").option("--json","Print raw JSON").action((e,t)=>gu("update",{apiKeyId:e,...t}));S(Xwe,{notes:["The key value does not change, so clients holding it keep working with the new permissions.","--preset and --scopes replace the whole selection rather than merging into it. Run 'sequenzy api-keys list --json' first to see the current scopes."],examples:["sequenzy api-keys update key_123 --preset agent_safe",'sequenzy api-keys update key_123 --scopes "subscribers:read,subscribers:tag,tags:read"','sequenzy api-keys update key_123 --name "Agent key"']});var eSe=xl.command("revoke").description("Permanently revoke a company API key").argument("<api-key-id>","Exact API key ID returned by api-keys list").option("-y, --yes","Skip the confirmation prompt").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>gu("revoke",{apiKeyId:e,...t}));S(eSe,{notes:["Revocation cannot be undone. Run 'sequenzy api-keys list' first and verify the exact ID and prefix."],examples:["sequenzy api-keys revoke key_123 --company comp_123 --yes"]});var tSe=xl.command("delete").description("Alias for api-keys revoke").argument("<api-key-id>","Exact API key ID returned by api-keys list").option("-y, --yes","Skip the confirmation prompt").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>gu("delete",{apiKeyId:e,...t}));S(tSe,{notes:["This is a compatibility alias for 'sequenzy api-keys revoke'."],examples:["sequenzy api-keys delete key_123 --company comp_123 --yes"]});var pc=Je.command("websites").description("Manage sending domains and integration guides").action(()=>pc.help());S(pc,{notes:["Use 'guide' for code examples, 'check' to inspect current DNS verification details, and 'verify' to run a fresh check.","Use 'upgrade-dns' to move a domain on the previous record set onto the current DNS records without removing it."],examples:["sequenzy websites list --company comp_123","sequenzy websites add example.com --company comp_123","sequenzy websites guide --framework nextjs --use-case transactional"]});var nSe=pc.command("list").description("List sending domains for a company").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>Il("list",e));S(nSe,{examples:["sequenzy websites list --company comp_123"]});var rSe=pc.command("add <domain>").description("Add a sending domain").option("-c, --company <id>","Company ID override for personal API keys").option("--mail-from-prefix <label>","Return-path (MAIL FROM) subdomain label, default rp").option("--tracking-prefix <label>","Label of the company tracking domain (<label>.<root>) if the company has none yet, default links").option("--json","Print raw JSON").action((e,t)=>Il("add",{domain:e,...t}));S(rSe,{notes:["Publish the DKIM record, the bounce records on the `Bounce:` line (one CNAME for new domains; domains added earlier keep their SPF TXT and MX records) and DMARC when present; record shapes vary between unified and legacy domains.","Tracked links use the company tracking domain, shared by every sending domain. The first domain creates it on its root (links.<root>) and returns its CNAME as trackingRecord. It is optional: sending never waits for it, and links use the shared Sequenzy domain until it verifies. Manage it with `sequenzy tracking domain`.","A domain belongs to exactly one company and cannot be moved or removed from the CLI afterwards. Confirm --company before adding; moving it later requires removal in the dashboard and new DNS verification."],examples:["sequenzy websites add example.com --company comp_123","sequenzy websites add mail.example.com --mail-from-prefix bounce"]});var oSe=pc.command("check <domain>").description("Inspect sending domain verification details").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Il("check",{domain:e,...t}));S(oSe,{examples:["sequenzy websites check example.com --company comp_123"]});var iSe=pc.command("verify <domain>").description("Run a fresh DNS check for a sending domain").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Il("verify",{domain:e,...t}));S(iSe,{notes:["'verified' is the DNS verdict only. Sending is reported separately as 'Sending' - a domain with correct DNS can still be activating.","Receiving mail (inbox addresses and replies) is set up on receiving domains, not sending domains: see `sequenzy receiving-domains`."],examples:["sequenzy websites verify example.com --company comp_123"]});var sSe=pc.command("upgrade-dns <domain>").description("Recommended one-time upgrade of a verified sending domain to the current DNS records, without removing it").option("--mail-from-prefix <label>","Return-path subdomain label for the new records, default rp (rp1, then sqrp if taken)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Il("upgrade-dns",{domain:e,...t}));S(sSe,{notes:["Optional and needed only once: it improves deliverability and security. Once started it runs to the switch. Add the printed CNAMEs next to your current records and remove nothing yet. The domain keeps sending on its current records, then switches by itself about an hour after the required ones (DKIM and return path) are visible on public DNS. Sending is normally not interrupted at the switch; if that isn't possible for a domain, emails sent through Amazon SES can be held for a few minutes. `sequenzy websites verify <domain>` checks now but does not skip the wait.","After the switch, `websites check` lists the old records you can optionally delete and the date from which it is safe (8 days after the switch). For an older SES-only domain these include the old return path records (MX and TXT at send.<domain>) and the DKIM TXT; keep DMARC.",'Only verified domains on the previous record set can upgrade, including older SES-only domains that have a working DMARC record; `websites check` shows `DNS upgrade: available` for them. Without DMARC the start fails with "Add a DMARC record for this domain before upgrading its DNS records."'],examples:["sequenzy websites upgrade-dns mail.example.com --company comp_123","sequenzy websites upgrade-dns mail.example.com --mail-from-prefix bounce"]});var aSe=pc.command("configure <domain>").description("Deprecated: set <label>.<domain> as the company tracking domain; use `tracking domain set`").requiredOption("--tracking-prefix <label>","Label beneath the sending domain, e.g. links").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Il("configure",{domain:e,...t}));S(aSe,{notes:["Deprecated: tracking is company-wide. Sets <label>.<domain> as the company tracking domain when the company has none; the company's current hostname is a no-op, and a different one changes nothing (the response explains why).","Prefer `sequenzy tracking domain set <hostname>`, which also changes an existing tracking domain."],examples:["sequenzy websites configure mail.example.com --tracking-prefix links"]});var cSe=pc.command("guide").description("Print framework-specific integration code").option("--framework <name>","Framework name, e.g. nextjs, express, python").option("--use-case <name>","Use case, e.g. transactional, subscribe_form, event_tracking").option("--json","Print raw JSON").action((e)=>Il("guide",e));S(cSe,{examples:["sequenzy websites guide","sequenzy websites guide --framework nextjs --use-case transactional","sequenzy websites guide --framework python --use-case event_tracking"]});sH(Je);var ho=Je.command("integrations").description("Inspect and manage connected integrations").action(()=>ho.help());S(ho,{notes:["Credentials, access tokens, and webhook secrets are never returned.","`connect` covers API-key / webhook-secret providers (Polar, Paddle, Dodo, Lemon Squeezy, Whop, RevenueCat, Creem, Chargebee, Clerk, PostHog, Segment, Affonso, Attio). OAuth and app-install providers (Stripe, Shopify, Supabase, GitHub, WooCommerce) connect in the dashboard. Lemon Squeezy supports `disconnect`; other provider disconnects use the dashboard.","Use `catalog` to see what a provider does before connecting it, and `get` to see what a connected one is doing now."],examples:["sequenzy integrations list","sequenzy integrations catalog --provider stripe","sequenzy integrations connect clerk --webhook-secret whsec_...","sequenzy integrations get int_123","sequenzy integrations activity --status failed"]});ho.command("disconnect <id>").description("Disconnect Lemon Squeezy and remove its managed webhook; repeat to retry cleanup").option("--company <id>","Company ID").option("--json","Print raw JSON").action((e,t)=>yM(e,t));var lSe=ho.command("connect <provider>").description("Connect an API-key / webhook-secret integration").option("-c, --company <id>","Company ID override for personal API keys").option("--api-key <key>","Provider API key (or set SEQUENZY_INTEGRATION_API_KEY)").option("--webhook-secret <secret>","Webhook signing secret (Lemon Squeezy manual setup: 16-40 characters; or set SEQUENZY_INTEGRATION_WEBHOOK_SECRET)").option("--account-id <id>","Provider account id: Paddle seller ID, Dodo business ID, Lemon Squeezy numeric store ID, Whop company ID, Creem store ID, Chargebee site name, or RevenueCat project ID (only when the key can access several projects)").option("--attio-list <mapping...>","Attio only: map SEQUENZY_LIST_ID=ATTIO_LIST_ID_OR_SLUG (one or more)").option("--attio-clear-lists","Attio only: remove every saved Sequenzy-to-Attio list mapping").option("--attio-enable-company-domain","Attio only: create or match companies from work email domains").option("--attio-disable-company-domain","Attio only: do not create or match companies from work email domains").option("--event-allowlist <events...>","PostHog and Segment only: sync only these event names instead of everything").option("--history-region <region>","PostHog and Segment history import region: us or eu").option("--history-project-id <id>","PostHog history import project ID").option("--history-space-id <id>","Segment history import Unify space ID (spa_...)").option("--history-api-key <key>","History import credential: the PostHog personal API key (or SEQUENZY_POSTHOG_PERSONAL_API_KEY) or the Segment Profile API token (or SEQUENZY_SEGMENT_PROFILE_API_TOKEN)").option("--json","Print raw JSON").action((e,t)=>kM(e,t));S(lSe,{notes:["Run `sequenzy integrations catalog --provider <provider>` first: its connectFields list what this provider needs.","Pass secrets via the environment variables instead of flags to keep them out of shell history.","The response includes the webhook URL. Lemon Squeezy creates and manages it when --webhook-secret is omitted; other inbound providers use the supplied secret. Attio is outbound-only.","Reconnecting an already-connected provider replaces its stored credentials.","OAuth and app-install providers (Stripe, Shopify, Supabase, GitHub, WooCommerce) cannot be connected here - use the dashboard."],examples:["sequenzy integrations connect clerk --webhook-secret whsec_...","sequenzy integrations connect paddle --api-key pdl_... --webhook-secret pdl_ntf_... --account-id 12345","sequenzy integrations connect polar --api-key polar_oat_... --webhook-secret whsec_...","sequenzy integrations connect lemon_squeezy --api-key ls_... --account-id 12345","sequenzy integrations connect revenuecat --api-key sk_... --webhook-secret <authorization-header-value>","sequenzy integrations connect posthog --webhook-secret phc_shared_secret --history-region us --history-project-id 12345 --history-api-key phx_...","sequenzy integrations connect segment --webhook-secret my_shared_secret","sequenzy integrations connect segment --webhook-secret my_shared_secret --history-region us --history-space-id spa_abc123 --history-api-key profile_token","sequenzy integrations connect affonso --api-key aff_... --webhook-secret whsec_...","sequenzy integrations connect attio --api-key attio_... --attio-list list_123=field-guide"]});var uSe=ho.command("list").description("List connected integrations and their sync health").option("-c, --company <id>","Company ID override for personal API keys").option("--all","Include disconnected/inactive integrations").option("--json","Print raw JSON").action((e)=>$M(e));S(uSe,{examples:["sequenzy integrations list --company comp_123","sequenzy integrations list --all"]});var dSe=ho.command("catalog").description("Show what each integration provider syncs, emits, and supports").option("-c, --company <id>","Company ID override for personal API keys").option("--provider <provider>","Only show one provider, e.g. stripe").option("--category <category>","Filter by category: payments, ecommerce, auth, analytics, ads, affiliate, cms, crm, developer").option("--json","Print raw JSON").action((e)=>RM(e));S(dSe,{notes:["Works whether or not the provider is connected, so you can compare providers before picking one.","Events listed here are the ones a sequence can trigger on. A provider that emits nothing cannot drive automations."],examples:["sequenzy integrations catalog","sequenzy integrations catalog --provider stripe","sequenzy integrations catalog --category ecommerce --json"]});var pSe=ho.command("get <id>").description("Show one integration: what it does, its events, and its wiring").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>QM(e,t));S(pSe,{notes:["Lists every event the provider emits, the tags each one applies through your sync rules, and which sequences trigger on it.","Events with no sequence are reported so you can see what the integration is feeding you that nothing acts on.","Get the id from `sequenzy integrations list`."],examples:["sequenzy integrations get int_123","sequenzy integrations get int_123 --json"]});var mSe=ho.command("activity").description("Show recent integration webhook and sync activity").option("-c, --company <id>","Company ID override for personal API keys").option("--integration <id>","Only show one integration's activity").option("--provider <provider>","Only show one provider's activity").option("--status <status>","Filter by status: received, queued, processed, skipped, failed").option("--limit <n>","Rows to return (1-100, default 25)").option("--json","Print raw JSON").action((e)=>xM(e));S(mSe,{notes:["Activity is retained for 24 hours.","Use `--status failed` when an integration reports connected but contacts are not appearing."],examples:["sequenzy integrations activity","sequenzy integrations activity --status failed --limit 50","sequenzy integrations activity --integration int_123"]});var fSe=ho.command("sync <id>").description("Queue a manual re-sync for a connected integration").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>bM(e,t));S(fSe,{notes:["Supported for Stripe, Polar, Paddle, Dodo, Lemon Squeezy, Creem, Chargebee, Whop, Supabase, PostHog, and Segment. Other providers re-sync from the dashboard.","For Supabase this backfills users from the table already configured for the integration; it cannot target a different table. Run it once after connecting, because the database trigger only sends rows that change after it is installed.","For PostHog and Segment this re-runs the event-history import with the stored credentials and is the supported retry for one that failed. It restarts from the beginning; already-imported events dedupe.","Returns immediately; poll `sequenzy integrations get <id>` to watch syncStatus and lastSyncAt.","Fails with a conflict if a sync is already running."],examples:["sequenzy integrations sync int_123"]});var gSe=ho.command("enable-sync <id>").description("Turn sync back on for an integration").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>V0(e,!0,t));S(gSe,{examples:["sequenzy integrations enable-sync int_123"]});var ASe=ho.command("disable-sync <id>").description("Pause bulk imports without disconnecting the integration").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>V0(e,!1,t));S(ASe,{notes:["Stops bulk imports and backfills but keeps the connection, credentials, and live webhook delivery active.","This does NOT stop the integration creating contacts. The provider's live webhook keeps writing every new signup or customer. Use `set-lists` to control where they land, or use `disconnect` for Lemon Squeezy (the dashboard for other providers) to stop it entirely."],examples:["sequenzy integrations disable-sync int_123"]});var hSe=ho.command("set-lists <id>").description("Choose which lists this integration's new contacts join").option("-c, --company <id>","Company ID override for personal API keys").option("--list <id>","Target this list (repeatable)",(e,t=[])=>[...t,e]).option("--none","Target no list at all").option("--default","Fall back to the workspace default lists").option("--json","Print raw JSON").action((e,t)=>EM(e,t));S(hSe,{notes:["Takes effect on future provider writes. Nothing is applied retroactively and nobody is ever removed from a list. Wix/Webflow submissions, Shopify customer updates, and Supabase resubscriptions can add existing contacts to the new targets; Stripe applies targeting only when its webhook creates a subscriber.","This changes list membership only. Contacts are still created, their attributes still sync, sync-rule tags still apply, and sequences triggered by contact_added on any list still enroll them - pair it with `sequences pause-enrollments` if you need those stopped too.","`--none` and `--default` are different: --none means new contacts join no list, --default means they follow the workspace default lists setting.","Webflow requires explicit targeting, so --default is rejected for Webflow. Use --none or --list here; configure native forms, allowed fields, required double opt-in, and sequence enrollment in Settings -> Integrations -> Webflow. With no selected forms, capture is off and no contacts are created.","Supported for Supabase, Stripe, Shopify, Wix, and Webflow. `integrations get <id>` reports the current targeting under `ingestion`, with list names."],examples:["sequenzy integrations set-lists int_123 --list list_abc --list list_def","sequenzy integrations set-lists int_123 --none","sequenzy integrations set-lists int_123 --default"]});var ySe=ho.command("pixel <id>").description("Show the Shopify storefront tracking pixel state").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>CM(e,t));S(ySe,{notes:["Shopify only. Read live from the store, because a merchant can remove the pixel without notifying Sequenzy.","Check this before trusting product views, cart activity, or browse abandonment: without the pixel those events never arrive and any sequence triggered by them silently never fires."],examples:["sequenzy integrations pixel int_123"]});var bSe=ho.command("enable-pixel <id>").description("Install or repoint the Shopify storefront tracking pixel").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>wM(e,t));S(bSe,{notes:["Idempotent: an already-live pixel is reported with `changed: false`.","Events start arriving on the next storefront visit; nothing is backfilled for the period the pixel was off.","Fails with guidance if the store granted an older permission set - reconnect Shopify from the dashboard, then retry."],examples:["sequenzy integrations enable-pixel int_123"]});var vSe=ho.command("attio <id>").description("Show Attio list mappings and available people-lists").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>DM(e,t));S(vSe,{notes:["Attio only. Reads live people-lists from Attio using the stored access token — you do not need the secret again.","mappedListCount 0 means list joins are not synced. Map them with `set-attio-lists` rather than reconnecting."],examples:["sequenzy integrations attio int_123"]});var ESe=ho.command("set-attio-lists <id>").description("Map Sequenzy lists to Attio lists without reconnecting").option("-c, --company <id>","Company ID override for personal API keys").option("--map <mapping...>","Complete SEQUENZY_LIST_ID=ATTIO_LIST_ID_OR_SLUG map (one or more)").option("--clear-maps","Remove every saved Sequenzy-to-Attio list mapping").option("--enable-company-domain","Create or match companies from work email domains").option("--disable-company-domain","Do not create or match companies from work email domains").option("--json","Print raw JSON").action((e,t)=>BM(e,t));S(ESe,{notes:["Uses the stored Attio access token. Do not reconnect just to change mappings.","--map replaces the saved map entirely. Run `sequenzy integrations attio <id>` first to see Sequenzy list ids and live Attio list ids/slugs.","Unmapped lists are not synced. Unmapping does not remove anyone from Attio (add-only)."],examples:["sequenzy integrations set-attio-lists int_123 --map list_abc=field-guide list_def=benchmark","sequenzy integrations set-attio-lists int_123 --clear-maps","sequenzy integrations set-attio-lists int_123 --disable-company-domain"]});var ISe=ho.command("guide").description("Print integration code examples for your stack").option("-c, --company <id>","Company ID override for personal API keys").option("--framework <framework>","Framework or language, e.g. nextjs").option("--use-case <use-case>","transactional, subscribe_form, event_tracking, or ecommerce").option("--json","Print raw JSON").action((e)=>hM(e));S(ISe,{notes:["Same examples the MCP `get_integration_guide` tool returns.","For Stripe, Polar, Paddle, Dodo, Creem, Shopify, or WooCommerce, connect the native integration instead of writing tracking code by hand."],examples:["sequenzy integrations guide --use-case transactional --framework nextjs","sequenzy integrations guide --use-case ecommerce"]});var Ag=Je.command("sender-profiles").description("Inspect, rename, and delete sending identity profiles").action(()=>Ag.help());S(Ag,{notes:["Shows which profiles are account defaults and whether each sender address sits on a verified sending domain.","`update` renames one profile in place and never changes the account defaults. To change which profile is the default, use `sequenzy companies update <id> --sender-profile-id <id>`."],examples:["sequenzy sender-profiles list","sequenzy sender-profiles update sender_abc123 --name 'SnapCount'","sequenzy sender-profiles delete sender_abc123 --yes"]});var CSe=Ag.command("list").description("List sender and reply-to profiles").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>$3(e));S(CSe,{examples:["sequenzy sender-profiles list --company comp_123"]});var wSe=Ag.command("update <id>").description("Rename a sender or reply-to profile without changing defaults").requiredOption("--name <name>","New display name for the profile").option("--reply","Treat <id> as a reply-to profile instead of a sender").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>N3(e,t));S(wSe,{notes:["Renames the profile only. The account default From/Reply-To selection is left exactly as it was.","Get profile IDs from `sequenzy sender-profiles list`.","A company cannot have two sender identities with the same name on one address, so a colliding rename is rejected with the ID of the profile already using that name.","Requires the companies:manage scope."],examples:["sequenzy sender-profiles update sender_abc123 --name 'SnapCount'","sequenzy sender-profiles update reply_abc123 --name 'SnapCount' --reply","sequenzy sender-profiles update sender_abc123 --name 'SnapCount' --company comp_123 --json"]});var SSe=Ag.command("delete <id>").description("Permanently delete a sender (From) profile").option("--yes","Skip the confirmation prompt").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>O3(e,t));S(SSe,{notes:["This cannot be undone. Reply-to profiles are not supported by this command.","Deletion is blocked for the last sender and for profiles used by live campaigns, active sequences, or transactional emails.","Eligible draft campaigns and the account default move to the best remaining sender when needed; the result reports that fallback profile ID.","Requires the companies:manage scope."],examples:["sequenzy sender-profiles delete sender_abc123","sequenzy sender-profiles delete sender_abc123 --yes --json"]});var Pv=Je.command("sending").description("Check company-level sending status and restore paused sending").action(()=>Pv.help());S(Pv,{notes:["Company-level sending can be paused automatically when the permanent-bounce, temporary-bounce, or complaint rate crosses its threshold. While paused, every send is blocked - campaigns, sequence steps, transactional email, and test sends.","Sender-health enforcement uses all-time totals counted from a reset watermark, NOT a rolling window. A paused rate does not expire on its own, so waiting does not restore sending.","`status` needs account:read. `resume` needs companies:manage plus owner or admin access."],examples:["sequenzy sending status","sequenzy sending resume --confirm-list-sanitized"]});var DSe=Pv.command("status").description("Show sending status, sender-health rates, and how to restore sending").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>U3(e));S(DSe,{notes:["Run this first whenever a send or test send fails for a reason that is not a validation error.","Shows the exact pause reason, the measured rates against the thresholds that apply at your volume, the automated sender-health review state, whether one-click resume is available, and ordered remediation steps.","`metricsWindow` reports the enforcement watermarks. `expiresAt` is always null because there is no rolling window to wait out."],examples:["sequenzy sending status","sequenzy sending status --json","sequenzy sending status --company comp_123"]});var BSe=Pv.command("resume").description("Restore paused sending after fixing the cause of the bounces").option("--confirm-list-sanitized","Required. Confirms you fixed the source of the invalid addresses and left every permanent bounce suppressed").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>j3(e));S(BSe,{notes:["This is the supported remediation path, not a bypass. It never removes suppressions.","Only a permanent-bounce pause can be cleared this way, and only after the automated sender-health review has cleared it. Any other state needs a support review, and the error names which gate stopped you.","Check `selfResume.canSelfResume` with `sequenzy sending status` before calling this.","On success the bounce watermark resets, so the paused rate is recalculated from sends made after the resume, and the service attempts to requeue paused campaigns plus due sequence steps. If that handoff is only partial, the success message gives recovery guidance.","The confirmation is recorded on the account audit trail, so only pass --confirm-list-sanitized once the fix is actually shipped."],examples:["sequenzy sending resume --confirm-list-sanitized","sequenzy sending resume --confirm-list-sanitized --json"]});var hg=Je.command("tracking").description("Inspect and update email tracking configuration").action(()=>hg.help());S(hg,{notes:["Covers open/click/unsubscribe tracking, attribution window, double opt-in for new contacts, auto UTM, the company tracking domain, and reply tracking."],examples:["sequenzy tracking settings","sequenzy tracking update --opens off --clicks off","sequenzy tracking domain set links.example.com"]});H4(hg);eM(Je);Fz(Je);cH(Je);t2(Je);oV(Je);var xSe=hg.command("settings").description("Show the company's tracking configuration").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>P3(e));S(xSe,{examples:["sequenzy tracking settings --company comp_123"]});var _Se=hg.command("update").description("Update account-wide tracking defaults").option("--opens <on|off>","Enable or disable open tracking").option("--clicks <on|off>","Enable or disable click tracking").option("--transactional-opens <on|off>","Enable or disable open tracking by default for Transactional API sends").option("--transactional-clicks <on|off>","Enable or disable click tracking by default for Transactional API sends").option("--strict-bot-filtering <on|off>","Enable or disable aggressive bot filtering (can lower reported open/click rates)").option("--unsubscribes <on|off>","Track unsubscribe link clicks; off uses direct sequenzy.com links even with a custom domain").option("--store-content <on|off>","Keep sent email content and subjects, and the IP address, user agent and country of opens and clicks").option("--attribution-window-hours <hours>","Default revenue attribution window in hours (1-720)").option("--double-opt-in <on|off>","Require email confirmation before new contacts become subscribed").option("--double-opt-in-redirect-url <url>","Where the confirmation page sends subscribers after they confirm; pass an empty string to clear it").option("--auto-utm <on|off>","Enable or disable automatic UTM tagging").option("--utm-source <template>","utm_source template").option("--utm-medium <template>","utm_medium template").option("--utm-campaign <template>","utm_campaign template").option("--utm-content <template>","utm_content template").option("--utm-term <template>","utm_term template").option("--reset-utm","Reset every UTM parameter to the platform defaults").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>F3(e));S(_Se,{notes:["Partial update: omitted flags keep their current values.","--unsubscribes off routes unsubscribe links directly to sequenzy.com, even with a custom tracking domain. Actual unsubscribes and their email attribution are still recorded.","--store-content off keeps no copy of each sent email's content, stores the email's name instead of its subject, and stores no IP address, user agent or country for opens and clicks. View-in-browser links stop working.","Transactional API defaults can only narrow the account-wide open and click settings; per-send trackingSettings can opt out again.","Applies to emails sent afterwards; already-sent emails keep the links they were rendered with.","UTM templates support placeholders such as {{email.subject}} and {{link.text}}.","--double-opt-in on makes new contacts start pending until they confirm; it needs a sender profile and provisions the confirmation email automatically. Existing active contacts are unaffected.","--double-opt-in-redirect-url sends subscribers to your own page after they confirm; without it they stay on the branded confirmation page.","Reply tracking is set with `sequenzy companies update`; the company tracking domain is managed with `sequenzy tracking domain`."],examples:["sequenzy tracking update --opens off --clicks off","sequenzy tracking update --transactional-opens off --transactional-clicks off","sequenzy tracking update --attribution-window-hours 168","sequenzy tracking update --double-opt-in on","sequenzy tracking update --double-opt-in-redirect-url https://example.com/welcome",'sequenzy tracking update --auto-utm on --utm-source newsletter --utm-campaign "{{email.subject}}"',"sequenzy tracking update --reset-utm"]});var VB=Je.command("shopify").description("Manage the connected Shopify store's automation settings").action(()=>VB.help());S(VB,{notes:["Requires a connected Shopify integration on the company.","Browse abandonment emails shoppers who viewed a product but didn't buy; cart abandonment fires ecommerce.cart_abandoned with the full cart after the cart sits inactive; price drop alerts email recent viewers when a product's price falls."],examples:["sequenzy shopify settings get","sequenzy shopify settings update --price-drop off","sequenzy shopify settings update --browse-delay-hours 4 --browse-cooldown-hours 48"]});var KB=VB.command("settings").description("Browse-abandonment, cart-abandonment, and price-drop automation settings").action(()=>KB.help()),kSe=KB.command("get").description("Show the effective automation settings").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>EB("get",e));S(kSe,{notes:["Shows the effective values - platform defaults apply until the store overrides them."],examples:["sequenzy shopify settings get --json"]});var RSe=KB.command("update").description("Update browse-abandonment, cart-abandonment, and/or price-drop settings").option("--browse-abandonment <on|off>","Enable or disable browse abandonment").option("--browse-delay-hours <hours>","Hours to wait after a product view before the abandonment check (default 2)").option("--browse-cooldown-hours <hours>","Minimum hours between browse-abandoned events per subscriber (default 24)").option("--reset-browse-abandonment","Reset browse abandonment to the platform defaults").option("--cart-abandonment <on|off>","Enable or disable cart abandonment (ecommerce.cart_abandoned)").option("--cart-delay-hours <hours>","Hours of cart inactivity before abandonment (positive, max 168; default 1)").option("--cart-cooldown-hours <hours>","Minimum hours between cart-abandoned events (positive, max 720; default 24)").option("--cart-expire-after-hours <hours>","Drop a cart untouched this long instead of emailing about it (positive, max 720; default 72)").option("--reset-cart-abandonment","Reset cart abandonment to the platform defaults").option("--price-drop <on|off>","Enable or disable price drop alerts").option("--price-drop-min-percent <percent>","Minimum price decrease percent to alert on (default 5)").option("--price-drop-lookback-days <days>","How many days back viewers qualify as the audience (default 30)").option("--price-drop-cooldown-days <days>","Minimum days between price-drop events per subscriber and product (default 7)").option("--reset-price-drop","Reset price drop alerts to the platform defaults").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>EB("update",e));S(RSe,{notes:["Partial update: omitted flags keep their current values.","If no sequence handles ecommerce.price_drop, Sequenzy sends a default price-drop email to active subscribers."],examples:["sequenzy shopify settings update --browse-abandonment off","sequenzy shopify settings update --cart-delay-hours 2","sequenzy shopify settings update --price-drop-min-percent 10 --price-drop-lookback-days 14","sequenzy shopify settings update --reset-price-drop"]});var _l=Je.command("sms").description("Inspect the SMS add-on status for a company").action(()=>_l.help());S(_l,{notes:["SMS sequence steps only send when the add-on is enabled, the plan is eligible, and an active number exists.",'Add SMS steps to sequences with type: "sms" in sequences create --steps-* or update --insert-steps-*.','Generate SMS copy with `sequenzy generate sms "<prompt>"`.'],examples:["sequenzy sms settings","sequenzy sms settings --json"]});var QSe=_l.command("settings").description("Show SMS add-on status, credits, and phone numbers").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>ku("settings",e));S(QSe,{notes:["readyToSend in the JSON output tells you whether SMS sequence steps will actually send."],examples:["sequenzy sms settings --json"]});var TSe=_l.command("label <number-id> [label]").description("Set or clear the label shown for an SMS number").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t,n)=>ku("label",{numberId:e,label:t,...n}));S(TSe,{notes:["Run without a label to clear the current label.","Use `sequenzy sms settings` to find each number ID."],examples:['sequenzy sms label num_abc123 "Marketing"',"sequenzy sms label num_abc123"]});var $Se=_l.command("update <number-id>").description("Update an SMS number's label, brand prefix override, and/or link shortening").option("--label <label>","Label tag; pass an empty string to clear").option("--brand-prefix <prefix>","Per-number brand prefix override; empty string clears back to the account-wide prefix").option("--link-shortening <on|off>","on (default) turns links into click-tracked short links; off sends links from this number exactly as written").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ku("update",{numberId:e,...t}));S($Se,{notes:["Only the flags you pass are changed; omitted fields keep their value.",'Messages go out as "{prefix}: your message" - the number override wins over the account-wide prefix set in Settings > SMS.',"--link-shortening off keeps your own tracking links exactly as written; SMS clicks from that number are then not tracked and long links can add segments. Applies to messages prepared after the change.","Use `sequenzy sms settings` to find each number ID."],examples:['sequenzy sms update num_abc123 --label "Support" --brand-prefix "Acme Support"','sequenzy sms update num_abc123 --brand-prefix ""',"sequenzy sms update num_abc123 --link-shortening off"]});var NSe=_l.command("send-test <phone>").description("Send a test SMS to a phone number").option("-t, --text <text>","Plain-text message body").option("--image-url <url...>","Publicly reachable MMS image URL (repeat for up to 2)").option("--from-number <number-id>","Active SMS number ID to send from (defaults to the oldest active number)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ku("send-test",{phone:e,...t}));S(NSe,{notes:["Sends a real text and charges credits. Limited to 100 test sends per company per rolling 24 hours; bypasses quiet hours; excluded from step stats.","Requires the SMS add-on with a verified number - check `sequenzy sms settings` first.","Use --from-number with an active number ID from `sequenzy sms settings` to test a specific number."],examples:['sequenzy sms send-test +15550100123 --text "Test from Sequenzy"','sequenzy sms send-test +15550100123 --text "Test" --from-number num_abc123']});var OSe=_l.command("usage").description("Show per-number SMS usage (sends, credits, last sent)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>ku("usage",e));S(OSe,{notes:["Totals exclude test sends; test sends are counted separately per number."],examples:["sequenzy sms usage","sequenzy sms usage --json"]});var PSe=_l.command("release <number-id>").description("Release an SMS number back to the carrier (irreversible)").option("-y, --yes","Skip the confirmation prompt").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ku("release",{numberId:e,...t}));S(PSe,{notes:["Releasing is irreversible: the number is handed back to the carrier and cannot be recovered.","Released numbers stop counting toward the workspace number limit, freeing a slot for a new purchase.","Use `sequenzy sms settings` to find each number ID."],examples:["sequenzy sms release num_abc123 --yes"]});var mc=Je.command("push").description("Web and mobile push notifications: settings, devices, tests and campaigns").action(()=>mc.help());S(mc,{notes:["Web push uses VAPID keys Sequenzy generates; iOS uses your APNs .p8 key; Android uses your Firebase service account.",'Add push steps to sequences with type: "push" in sequences create --steps-* or update --insert-steps-*.'],examples:["sequenzy push settings","sequenzy push web --enable",'sequenzy push send-test --email you@example.com --title "Hello" --body "It works"']});var FSe=mc.command("settings").description("Show web push, APNs and Firebase status plus active device counts").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>yr("settings",e));S(FSe,{examples:["sequenzy push settings --json"]});var qSe=mc.command("web").description("Enable or disable web push and set the default notification icon").option("--enable","Turn web push on (generates VAPID keys the first time)").option("--disable","Turn web push off (keys are kept)").option("--icon <url>","Default https icon URL; pass an empty string to clear").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>yr("web",e));S(qSe,{notes:['Your site must serve /sequenzy-sw.js containing importScripts("https://api.sequenzy.com/sequenzy-sw.js") and call sequenzy.subscribeToPush() from a click.'],examples:["sequenzy push web --enable","sequenzy push web --icon https://example.com/icon-192.png"]});var WB=mc.command("ios").description("Manage APNs credentials for iOS push").action(()=>WB.help()),LSe=WB.command("set").description("Save an APNs auth key (.p8)").requiredOption("--key-file <path>","Path to the AuthKey_XXXXXXXXXX.p8 file").requiredOption("--key-id <id>","10-character APNs key ID").requiredOption("--team-id <id>","10-character Apple team ID").requiredOption("--bundle-id <id>","App bundle ID, e.g. com.example.app").option("--environment <env>","production (default) or sandbox").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>yr("ios-set",e));S(LSe,{examples:["sequenzy push ios set --key-file AuthKey_ABC123DEFG.p8 --key-id ABC123DEFG --team-id DEF123GHIJ --bundle-id com.example.app"]});WB.command("remove").description("Remove APNs credentials").option("-y, --yes","Skip the confirmation prompt").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>yr("ios-remove",e));var YB=mc.command("android").description("Manage Firebase credentials for Android push").action(()=>YB.help()),USe=YB.command("set").description("Save a Firebase service account key").requiredOption("--service-account-file <path>","Path to the service account JSON from Firebase project settings").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>yr("android-set",e));S(USe,{notes:["The service account needs the Firebase Cloud Messaging API Admin role."],examples:["sequenzy push android set --service-account-file ./firebase-key.json"]});YB.command("remove").description("Remove Firebase credentials").option("-y, --yes","Skip the confirmation prompt").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>yr("android-remove",e));var Fv=mc.command("devices").description("List, register and remove push devices").action(()=>Fv.help());Fv.command("list").description("List push devices, optionally for one contact").option("--email <email>","Only devices of this contact").option("--subscriber-id <id>","Only devices of this subscriber").option("--platform <platform>","web, ios or android").option("--status <status>","active, invalid or unsubscribed").option("--limit <n>","Page size (max 100)").option("--cursor <id>","Continue after this device ID").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>yr("devices-list",e));var jSe=Fv.command("register").description("Register a device token (usually done by your app backend)").requiredOption("--platform <platform>","ios, android or web").requiredOption("--token <token>","APNs device token, FCM registration token, or web subscription endpoint").option("--p256dh <key>","Web only: keys.p256dh from PushSubscription").option("--auth <secret>","Web only: keys.auth from PushSubscription").option("--email <email>","Contact to link (created quietly if new)").option("--subscriber-id <id>","Existing subscriber to link").option("--device-name <name>","Device label shown in the dashboard").option("--app-version <version>","App version").option("--os-version <version>","OS version").option("--locale <locale>","Device locale, e.g. en-US").option("--timezone <tz>","IANA timezone").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>yr("devices-register",e));S(jSe,{examples:["sequenzy push devices register --platform ios --token 8f2c...e1 --email jane@example.com"]});Fv.command("remove <device-id>").description("Unsubscribe a device").option("-y, --yes","Skip the confirmation prompt").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>yr("devices-remove",{deviceId:e,...t}));var zSe=mc.command("send-test").description("Send a test push to one device or to a contact's devices").option("--device <id>","Device ID from `sequenzy push devices list`").option("--email <email>","Send to every active device of this contact").option("--subscriber-id <id>","Send to every active device of this subscriber").option("--title <title>","Notification title").option("--body <body>","Notification message").option("--url <url>","https link or app deep link opened on tap").option("--image-url <url>","https image").option("--icon-url <url>","https icon (web)").option("--platforms <platform...>","Limit to web, ios and/or android").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>yr("send-test",{...e,deviceId:e.device}));S(zSe,{notes:["Limited to 200 test pushes per company per rolling 24 hours. Tests are excluded from stats."],examples:['sequenzy push send-test --email you@example.com --title "Test" --body "Hello from Sequenzy"']});var Qs=mc.command("campaigns").description("Create, send and inspect push campaigns").action(()=>Qs.help()),DV=(e)=>e.option("--name <name>","Campaign name").option("--title <title>","Notification title").option("--body <body>","Notification message").option("--url <url>","https link or app deep link; empty string clears").option("--image-url <url>","https image; empty string clears").option("--icon-url <url>","https icon; empty string clears").option("--platforms <platform...>","Limit to web, ios and/or android").option("--all-contacts","Target every contact with a device").option("--segment <id>","Target a segment").option("--lists <ids...>","Target one or more lists").option("--target-lists-json <json>","Raw targetLists JSON").option("--target-lists-file <path>","Raw targetLists JSON file").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON");Qs.command("list").description("List push campaigns").option("--status <status>","draft, scheduled, sending, sent or cancelled").option("--limit <n>","Page size (max 100)").option("--offset <n>","Skip this many campaigns").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>yr("campaigns-list",e));var MSe=DV(Qs.command("create").description("Create a push campaign draft")).action((e)=>yr("campaigns-create",e));S(MSe,{examples:['sequenzy push campaigns create --name "Flash sale" --title "24h sale" --body "30% off everything" --url https://example.com/sale --all-contacts']});DV(Qs.command("update <campaign-id>").description("Update a draft or scheduled push campaign")).action((e,t)=>yr("campaigns-update",{campaignId:e,...t}));Qs.command("get <campaign-id>").description("Show a push campaign and its stats").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>yr("campaigns-get",{campaignId:e,...t}));var HSe=Qs.command("send <campaign-id>").description("Send a push campaign now or schedule it").option("--schedule <iso-time>","Future ISO 8601 time to schedule instead").option("-y, --yes","Skip the confirmation prompt for immediate sends").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>yr("campaigns-send",{campaignId:e,...t}));S(HSe,{notes:["Only contacts with an active device on a set-up platform receive the push."],examples:["sequenzy push campaigns send cmp_123 --yes","sequenzy push campaigns send cmp_123 --schedule 2026-10-01T15:00:00Z"]});Qs.command("unschedule <campaign-id>").description("Move a scheduled push campaign back to draft").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>yr("campaigns-unschedule",{campaignId:e,...t}));Qs.command("cancel <campaign-id>").description("Stop a scheduled or sending push campaign").option("-y, --yes","Skip the confirmation prompt").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>yr("campaigns-cancel",{campaignId:e,...t}));Qs.command("duplicate <campaign-id>").description("Copy a push campaign into a new draft").option("--name <name>","Name for the copy").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>yr("campaigns-duplicate",{campaignId:e,...t}));var GSe=Qs.command("estimate").description("Count contacts in an audience who have an active push device").option("--all-contacts","Every contact with a device").option("--segment <id>","A segment").option("--lists <ids...>","One or more lists").option("--target-lists-json <json>","Raw targetLists JSON").option("--target-lists-file <path>","Raw targetLists JSON file").option("--platforms <platform...>","Limit to web, ios and/or android").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>yr("campaigns-estimate",e));S(GSe,{examples:["sequenzy push campaigns estimate --segment seg_123 --platforms ios"]});Qs.command("stats <campaign-id>").description("Show delivery and click stats for a push campaign").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>yr("campaigns-stats",{campaignId:e,...t}));var $p=Je.command("in-app").description("In-app messages and content cards: read a contact's feed, report engagement, step stats").action(()=>$p.help());S($p,{notes:['Create items with in_app sequence steps: type: "in_app" in sequences create --steps-* or update --insert-steps-* (kind message|card, format modal|banner|fullscreen).',"Your app fetches the feed with GET /api/v1/in-app/messages (API key, from your backend) or POST /api/v1/in-app/feed (publishable key + identity token, from the browser), renders it, and reports displayed/clicked/dismissed/read."],examples:["sequenzy in-app list --email ava@example.com","sequenzy in-app list --external-id user_42 --kind card --status all","sequenzy in-app event msg_123 --type dismissed","sequenzy in-app stats node_123"]});$p.command("list").description("List a contact's open in-app messages and cards (or history)").option("--email <email>","Contact email").option("--external-id <id>","Contact external ID").option("--subscriber-id <id>","Subscriber ID").option("--kind <kind>","message or card").option("--status <status>","open (default: what the app should show now) or all (history)").option("--limit <n>","Maximum items (max 100)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>kf("list",e));$p.command("event").description("Record that an item was displayed, clicked, dismissed or read").argument("<messageId>","In-app message ID").requiredOption("--type <type>","displayed, clicked, dismissed or read").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>kf("event",{messageId:e,...t}));$p.command("delete").description("Delete an in-app message or card from the contact's feed").argument("<messageId>","In-app message ID").option("-y, --yes","Skip confirmation").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>kf("delete",{messageId:e,...t}));$p.command("stats").description("Created, displayed, clicked and dismissed counts for a step").argument("<stepId>","In-app sequence step (node) ID").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>kf("stats",{stepId:e,...t}));$2(Je);var qv=Je.command("email-design-system").description("Manage the visual identity every AI-generated email renders inside").action(()=>qv.help());S(qv,{notes:["The design system fixes the company's visual grammar (kickers, alignment, buttons, dividers, density, openers) and the composition spine that anchors email structure.","It is stored as the company's design direction text (emailDesignPrompt): adjustments rewrite that text, and free prose in it is preserved. Tokens the text does not state derive from brand context."],examples:["sequenzy email-design-system get","sequenzy email-design-system update --button-shape pill --spine editorial","sequenzy email-design-system update --reset"]});var JSe=qv.command("get").description("Show the effective email design system").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>H0("get",e));S(JSe,{notes:["The JSON output includes isDefault: true while the identity is still derived from brand context."],examples:["sequenzy email-design-system get --json"]});var VSe=qv.command("update").description("Adjust the email design system (partial update) or reset it").option("--kicker-style <style>","chip | letterspaced | none").option("--title-alignment <alignment>","left | center").option("--button-shape <shape>","rounded | pill").option("--divider-style <style>","line | space").option("--density <density>","airy | compact").option("--opener-treatments <treatments>","Comma-separated: hero-image,hero-color,header-hero,editorial-masthead,title-led").option("--spine <spine>","hero-led | editorial | product-spec").option("--reset","Clear the design direction text; return to derived defaults").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>H0("update",e));S(VSe,{notes:["Only the passed flags change; everything else keeps its current value.","Adjustments apply to every future AI email generation and sequence enrichment.","The change is written into the design direction text; custom prose in that text is preserved below the new identity. For free-prose edits use 'companies update --email-design-prompt'."],examples:["sequenzy email-design-system update --spine editorial --kicker-style letterspaced","sequenzy email-design-system update --opener-treatments editorial-masthead,title-led","sequenzy email-design-system update --reset"]});var Lv=Je.command("design-md").description("Read and edit design.md, the company's email design brief in Markdown").action(()=>Lv.help());S(Lv,{notes:["design.md holds YAML frontmatter with the exact values AI-generated emails use (logo, colors, fonts, buttons, corner radius, layout tokens), then ## Voice and ## Design direction prose. ## Reference email is read-only.","Only values you change are saved. Removing a key or section leaves it unchanged; an empty section clears it."],examples:["sequenzy design-md get > design.md","sequenzy design-md update design.md --dry-run","sequenzy design-md update design.md --expected-version <version>"]});var KSe=Lv.command("get").alias("pull").description("Print design.md (the version is printed to stderr)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON with markdown, version and designSystem").action((e)=>U0("get",e));S(KSe,{examples:["sequenzy design-md get > design.md","sequenzy design-md pull --json"]});var WSe=Lv.command("update").alias("push").description("Save an edited design.md from a file, or stdin with -").argument("[file]","Path to design.md, or - for stdin","-").option("--dry-run","Validate and list changes without saving").option("--expected-version <version>","Fail instead of overwriting if design.md changed since this version").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>U0("update",{file:e,...t}));S(WSe,{notes:["Errors name the line to fix. Unknown keys and edits to the read-only Reference email section are reported as warnings.","A value left exactly as 'get' printed it is not saved; a changed value is pinned."],examples:["sequenzy design-md update design.md --dry-run","cat design.md | sequenzy design-md push -"]});var Uv=Je.command("sync-rules").description("Manage automatic tag changes applied when events fire").action(()=>Uv.help());S(Uv,{notes:["Sync rules map events to tag changes, e.g. an order-placed event adding a customer tag.","Rules can carry conditions: required/excluded subscriber tags, and a product match for commerce events (tag buyers by product tag, collection, type, or vendor)."],examples:["sequenzy sync-rules get","sequenzy sync-rules update --rules-file ./sync-rules.json","sequenzy sync-rules update --reset"]});var YSe=Uv.command("get").description("Show the effective sync rules").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>TB("get",e));S(YSe,{notes:["Shows the platform defaults until the company saves custom rules; the JSON output includes isDefault."],examples:["sequenzy sync-rules get --json"]});var ZSe=Uv.command("update").description("Replace the sync rules or reset them to the defaults").option("--rules-json <json>","Inline JSON array with the full rule set").option("--rules-file <file>","Path to a JSON file with the full rule set").option("--reset","Reset the company to the platform default rules").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>TB("update",e));S(ZSe,{notes:["This replaces the FULL rule set - fetch with 'sync-rules get --json', edit, then update.",'Each rule: {"triggerEvent":"...","actions":{"addTags":[...],"removeTags":[...]},"conditions":{...}}.'],examples:["sequenzy sync-rules update --rules-file ./sync-rules.json",`sequenzy sync-rules update --rules-json '[{"triggerEvent":"ecommerce.order_placed","actions":{"addTags":["vinyl-collector"],"removeTags":[]},"conditions":{"purchasedProduct":{"tags":["Vinyl"]}}}]'`,"sequenzy sync-rules update --reset"]});var Np=Je.command("generate").description("Generate email and SMS content with AI").action(()=>Np.help());S(Np,{notes:["Generated email and SMS content is returned as draft content. Review it before sending.","`generate sequence` is deprecated and persists a disabled draft. Use `sequences create <name> --trigger <trigger> --goal <goal>` instead.","Use --json when another tool or agent should parse the generated output."],examples:['sequenzy generate email "Welcome a new user to our analytics product"','sequenzy generate subjects "April product launch" --count 8','sequenzy generate sms "Cart reminder with a free-shipping hook" --count 3']});Np.command("email <prompt>").description("Generate email blocks from a prompt").option("-s, --style <style>","Prompt generation style. Pass designed or plain to force the designed or plain-text email style; other values are freeform guidance (defaults to the company's email style preference)").option("-t, --tone <tone>","Tone: professional, casual, friendly").option("--company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>_f("email",{prompt:e,...t}));Np.command("sequence <goal>").description("[DEPRECATED] Persist a disabled AI sequence draft; use `sequences create`").option("--name <name>","Optional sequence name; defaults to the goal").option("--list-id <id>","Optional list ID for the contact_added trigger").option("-c, --count <number>","Number of emails (1-10)","5").option("-d, --days <number>","Duration in days","14").option("--company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>_f("sequence",{goal:e,...t}));Np.command("subjects <topic>").description("Generate A/B subject line variants").option("-c, --count <number>","Number of variants","5").option("--company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>_f("subjects",{topic:e,...t}));var XSe=Np.command("sms <prompt>").description("Generate SMS message variants from a prompt").option("-c, --count <number>","Number of variants (1-10)","3").option("--company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>_f("sms",{prompt:e,...t}));S(XSe,{notes:["Messages are plain text with encoding and segment counts; use them as the text of an SMS sequence step.","Opt-out footers and the brand prefix are added automatically at send time - never include them in the message.","Check `sequenzy sms settings` to confirm the SMS add-on is ready before enabling SMS sequences."],examples:['sequenzy generate sms "Flash sale ends tonight" --count 5 --json']});var Nu=Je.command("web-tracking").description("Manage publishable keys for the browser tracking SDK").action(()=>Nu.help());S(Nu,{notes:["These keys are publishable: they ship in your site's page source, so they are readable by anyone. They authorize storefront events only, never the rest of the API.","Restrict every key with --origins. An empty allowlist lets any site send events with the key.","Shopify stores do not need a key - connect the integration and enable the pixel instead (`sequenzy integrations enable-pixel`).","Anonymous visits are buffered and replayed after `sequenzy.identify(email, identityToken)`. Mint the short-lived token from your authenticated backend; never expose a secret API key in browser code."],examples:['sequenzy web-tracking create --name "Storefront" --origins https://example.com,https://*.example.com',"sequenzy web-tracking list","sequenzy web-tracking update wtk_123 --origins https://example.com","sequenzy web-tracking update wtk_123 --deactivate"]});var e0e=Nu.command("list").description("List web tracking keys and where each one is allowed to run").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>aV(e));S(e0e,{examples:["sequenzy web-tracking list","sequenzy web-tracking list --json"]});var t0e=Nu.command("get <id>").description("Show one key with its install snippet").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>cV(e,t));S(t0e,{examples:["sequenzy web-tracking get wtk_123"]});var n0e=Nu.command("create").description("Create a publishable key and print the install snippet").requiredOption("--name <name>","Human-readable label, e.g. 'Storefront'").option("--origins <origins>","Comma-separated allowed origins, e.g. https://example.com,https://*.example.com").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>lV(e));S(n0e,{notes:["A bare domain is read as https. Use https://*.example.com to cover subdomains; it does not match the apex, so list that separately if you need it.","Include your local development origin (e.g. http://localhost:3000) while you are wiring the SDK up.","The snippet embeds both the key and the workspace id, so paste it as printed."],examples:['sequenzy web-tracking create --name "Storefront" --origins https://example.com','sequenzy web-tracking create --name "Dev" --origins http://localhost:3000']});var r0e=Nu.command("update <id>").description("Rename a key, change its origins, or revoke it").option("--name <name>","New label").option("--origins <origins>","Replace the allowed origins (pass an empty string to clear them)").option("--activate","Re-enable a revoked key").option("--deactivate","Revoke the key without deleting it").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>uV(e,t));S(r0e,{notes:["--origins replaces the whole list rather than appending to it.","Revoking keeps the key value, so you can still find the snippet to remove from your site. Events stop within a minute."],examples:["sequenzy web-tracking update wtk_123 --origins https://example.com,https://shop.example.com","sequenzy web-tracking update wtk_123 --deactivate"]});var o0e=Nu.command("delete <id>").description("Permanently delete a web tracking key").option("-y, --yes","Skip the confirmation prompt").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>dV(e,t));S(o0e,{notes:["Remove the snippet from your site too, otherwise it keeps posting events that are rejected.","Prefer `update --deactivate` if you may want the key back."],examples:["sequenzy web-tracking delete wtk_123 --yes"]});await v1(Je);process.exit(process.exitCode??0);
340
+ ${_a}Use 'sequenzy --help' and '<command> --help' for detailed examples and caveats.${ko}`;console.log(n),console.log(r),console.log(),console.log(o),console.log(a),console.log(c),console.log()}var Je=new aQ;b1(Je);Je.name("sequenzy").description("Sequenzy CLI - Email marketing from the terminal").version(bV).showHelpAfterError().showSuggestionAfterError().action(Vve);S(Je,{notes:["Use --json on data commands when another tool or agent should parse structured output.","Dashboard-aware JSON responses include appUrls when a company ID can be resolved.","Company-scoped commands accept --company for personal API keys that can access multiple companies.","Content commands prefer file flags such as --html-file, --blocks-file, --steps-file, and --emails-file to avoid shell escaping issues.","Sequence creation supports --goal for AI generation or explicit step JSON."],examples:['sequenzy templates create welcome --subject "Welcome" --html-file ./welcome.html','sequenzy campaigns update camp_123 --subject "Updated subject" --html-file ./campaign.html',"sequenzy sequences create onboarding --trigger contact_added --list-id list_123 --steps-file ./steps.json","sequenzy urls --company comp_123 --sequence seq_123 --settings-tab integrations","sequenzy websites guide --framework nextjs --use-case transactional",'sequenzy api-keys create --name "CI deploy key" --company comp_123']});var Kve=Je.command("login").description("Log in to your Sequenzy account").action(UM);S(Kve,{notes:["Starts device authentication and prints a verification URL plus approval code."],examples:["sequenzy login"]});var Wve=Je.command("logout").description("Log out of your Sequenzy account").action(jM);S(Wve,{examples:["sequenzy logout"]});var Yve=Je.command("whoami").description("Show the locally stored Sequenzy identity").action(gV);S(Yve,{notes:["This checks local CLI credential state only. Use 'sequenzy account' to make a live request and verify the active key, permissions, and company access."],examples:["sequenzy whoami"]});var Zve=Je.command("stats").description("Show account, campaign, sequence, or transactional email metrics").option("-p, --period <period>","Time period (7d, 30d, 90d)").option("--start <iso>","Start of custom time range (ISO 8601)").option("--end <iso>","End of custom time range (ISO 8601)").option("--campaign <id>","Get stats for a specific campaign").option("--sequence <id>","Get stats for a specific sequence").option("--transactional <id-or-slug>","Get stats for a saved transactional email").option("--email-type <type>","Filter account stats by campaign, transactional, or sequence").option("--emails","List per-email metrics: one row per campaign and per sequence email step").option("--clients","Show mail client and device shares of unique opens (account or --campaign)").option("--links","Show clicks per link destination across every email in the account").option("--step <number>","With --emails, keep only this 1-based sequence email step").option("--sort <field>","With --emails, sort by sent, delivered, opened, clicked, openRate, clickRate, unsubscribed, conversions, revenue, step, or name").option("--order <order>","With --emails, sort order: asc or desc").option("--page <number>","With --emails, page number").option("--limit <number>","With --emails, emails per page (maximum 500); with --links, links to show (maximum 50)").option("--mailbox-provider <provider>","Filter by recipient mailbox provider (gmail, microsoft, yahoo, ...)").option("--include-bots","Include machine-classified bot/scanner opens and clicks").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON, including poll and NPS results").action(S4);S(Zve,{notes:["Use exactly one of account-level stats, --campaign, --sequence, or --transactional. --email-type applies only to account-level stats.","--mailbox-provider scopes account or campaign engagement metrics to one recipient mailbox provider (e.g. gmail, microsoft, yahoo); replies, conversions, and revenue cannot be segmented per provider and report 0 under this filter.","Saved transactional email stats are all-time by default; pass --period for a window.","Use --email-type transactional for Send API open and click rates; use 'email-sends get <id>' for one delivery.","Bot/scanner opens and clicks are excluded by default; pass --include-bots to inspect raw engagement.","Sequence stats include per-step sent/delivered/opened/clicked counts, a live active/waiting enrollment breakdown by current node, and per-step failures.","--emails lists one row per campaign and per sequence email step, with totals across every matching email. Combine with --sequence (comma-separated) and --step to answer questions like 'how many step-4 emails went out across these sequences'.","--emails counts come from the retained event stream, so they are not limited to the 14-day `email-sends list` history. Omit --period for all-time totals.","Campaign stats include a Poll & NPS Results section when the email collected answers; use --json for the full polls array.","--clients shows which mail clients and devices opened your emails, as shares of unique opens (each send counts once, by its first open). Gmail, Yahoo, and Apple Mail privacy proxies hide the device. With --campaign it covers the whole campaign; account-level stats default to 90 days.","--links ranks link destinations by clicks across every email (default 90 days, top 10). Query strings, fragments and trailing slashes are ignored, so UTM-tagged variants of a page count as one link. For one campaign's links, read clickedLinks from 'stats --campaign <id> --json'."],examples:["sequenzy stats","sequenzy stats --period 30d","sequenzy stats --emails --step 4","sequenzy stats --emails --sequence seq_1,seq_2 --step 4 --json","sequenzy stats --emails --email-type sequence --sort openRate --limit 20","sequenzy stats --campaign camp_123","sequenzy stats --campaign camp_123 --json","sequenzy stats --campaign camp_123 --include-bots","sequenzy stats --sequence seq_123","sequenzy stats --transactional password-reset","sequenzy stats --transactional password-reset --period 30d","sequenzy stats --email-type transactional --period 30d","sequenzy stats --mailbox-provider gmail --period 30d","sequenzy stats --campaign camp_123 --mailbox-provider yahoo","sequenzy stats --clients --period 30d","sequenzy stats --clients --campaign camp_123 --json","sequenzy stats --links --period 30d","sequenzy stats --links --email-type campaign --limit 25 --json"]});var qB=Je.command("events").description("List raw campaign or sequence email events, or read event payload schemas").option("--campaign <id>","List events for a campaign").option("--sequence <id>","List events for a sequence").option("--automation-node-id <id>","Scope a --sequence stream to one email step").option("--type <type>","Single event type to include, such as delivery, open, or click").option("--event-types <types>","Comma-separated event types to include (default: delivery)").option("-p, --period <period>","Time period (1h, 24h, 7d, 30d, 90d)").option("--start <iso>","Start of custom time range (ISO 8601)").option("--end <iso>","End of custom time range (ISO 8601)").option("--page <number>","Page number").option("--limit <number>","Events per page, capped by the API").option("--include-bots","Include machine-classified bot/scanner opens and clicks").option("-c, --company <id>","Company ID").option("--json","Print JSON").action(K2);S(qB,{notes:["Use exactly one of --campaign or --sequence.","Defaults to delivery events. Use --event-types delivery,open,click when you need engagement events too.","--automation-node-id narrows a sequence stream to one email step; take the node ID from `stats --sequence <id>`.","This is the per-recipient stream. For per-step send totals use `stats --sequence <id>` or `stats --emails`, not a count of these pages.","Bot/scanner opens and clicks are excluded by default; pass --include-bots to inspect raw engagement."],examples:["sequenzy events --campaign camp_123","sequenzy events --sequence seq_123 --limit 100 --json","sequenzy events --sequence seq_123 --automation-node-id node_email_4","sequenzy events --campaign camp_123 --event-types delivery,click --period 30d","sequenzy events schema ecommerce.order_placed"]});qB.command("sample <event>").description("Read the latest received event payload in this workspace").option("-c, --company <id>","Company ID").option("--json","Print JSON").action((e,t)=>z2(e,t));var Xve=qB.command("schema [event]").description("Show the published payload of a built-in event, or list documented events").option("--provider <provider>",M2).option("--example","Print the full sample payload as JSON").option("-c, --company <id>","Company ID").option("--json","Print JSON").action((e,t)=>G2(e,t));S(Xve,{notes:["Read this before writing {{event.*}} merge tags or event property filters: an unrecognized merge tag renders as an empty string rather than an error.","Fields ending in Cents are minor units (8850 = $88.50); price is a preformatted display string, and predictedLtv is whole currency units.","Custom event names are supported everywhere even though they have no published payload here - `documented: false` never means the name is invalid.","This is static reference data. Use `sequenzy events sample <event>` to read the latest actual received payload."],examples:["sequenzy events schema","sequenzy events schema ecommerce.order_placed --provider shopify","sequenzy events schema ecommerce.browse_abandoned --example","sequenzy events schema ecommerce.cart_abandoned --json"]});var vV=Je.command("blocks [type]").description("Show the fields each email block type accepts, or list every block type").option("--creatable-only","Hide structural block types the editor manages for you").option("--example","Print the example block as formatted JSON").option("--conditions","Also print the condition field, operator, and value table for this block type").option("-c, --company <id>","Company ID").option("--json","Print JSON").action((e,t)=>O2(e,t));vV.command("preview-cart").description("Suggest cart fields and generate preview-only scenarios without saving or sending").option("--items <json>","JSON array of actual event items").option("--items-file <path>","Read event items from a JSON file").option("--fields <json>","Existing itemFields mapping").option("--price-unit <unit>","Numeric price units: minor or major").option("--scenario <name>","real, one, many, empty, missing-images, or long-names","real").option("-c, --company <id>","Company ID").option("--json","Print JSON").action(w2);S(vV,{notes:["Read this before hand-authoring a blocks array: the blocks parameter accepts a 37-type union, so field names are not guessable from the endpoint schema alone.",'Lists are their own block type, not a text variant. A numbered list is {"type":"list","variant":"numbered","items":[{"content":"First"}]}; a visual numbered walkthrough is {"type":"steps","variant":"numbered","items":[{"title":"Step one"},{"title":"Step two"}]}.',"`list` items carry `content`; `steps` items carry `title` and an optional `description`. The two are not interchangeable.","Every block also takes a `conditions` array, and each condition field accepts only its own operators. `blocks conditional-group` prints that table unprompted; any other type takes --conditions, since it is longer than the block reference itself.","This is static reference data derived from the same schemas that validate a write, so it cannot drift from what the API accepts."],examples:["sequenzy blocks","sequenzy blocks --creatable-only","sequenzy blocks list","sequenzy blocks steps --example","sequenzy blocks hero --json","sequenzy blocks conditional-group","sequenzy blocks text --conditions"]});var eEe=Je.command("poll-responses").description("List individual Poll and NPS responses for a campaign").option("--campaign <id>","Campaign ID (required)").option("--block-id <id>","Scope to one poll block").option("--page <number>","Page number").option("--limit <number>","Responses per page (maximum 500)").option("-c, --company <id>","Company ID").option("--json","Print JSON").action(VM);S(eEe,{notes:["Returns each respondent's latest answer per poll block with the response time, so counts match `stats --campaign <id>`.","Block IDs come from the polls array of `stats --campaign <id> --json`.","For a sequence email step, pass the step's automation node ID as --campaign.","Do not scan subscribers for the poll attribute instead: the attribute carries no response time and reflects the latest answer to any email."],examples:["sequenzy poll-responses --campaign camp_123","sequenzy poll-responses --campaign camp_123 --block-id poll_1 --json","sequenzy poll-responses --campaign camp_123 --limit 500 --page 2"]});var tEe=Je.command("urls").description("Generate Sequenzy dashboard URLs for known resource IDs").option("-c, --company <id>","Company ID").option("--campaign <id>","Campaign ID for campaign editor URL").option("--landing-page <id>","Landing page ID for landing page editor URL").option("--sequence <id>","Sequence ID for sequence editor URL").option("--template <id>","Template/email ID for email editor URL").option("--email <id>","Email ID for email editor URL").option("--transactional <id>","Transactional email ID").option("--email-send <id>","Email send ID").option("--domain <id>","Sending domain ID").option("--status <status>","Status for campaign/sequence list URLs").option("--settings-tab <tab>","Settings tab slug; billing/subscription opens Account -> Subscription").option("--json","Print JSON").action(Uz);S(tEe,{notes:["Uses SEQUENZY_APP_URL when set, otherwise https://sequenzy.com.","If --company is omitted, the CLI tries the current company from `sequenzy account`.","Useful after creating a campaign or sequence when the user wants a review/edit link."],examples:["sequenzy urls --company comp_123","sequenzy urls --company comp_123 --sequence seq_123","sequenzy urls --company comp_123 --campaign camp_123","sequenzy urls --company comp_123 --landing-page lp_123","sequenzy urls --company comp_123 --email-send send_123","sequenzy urls --company comp_123 --settings-tab integrations","sequenzy urls --company comp_123 --settings-tab billing","sequenzy urls --company comp_123 --json"]});var Ko=Je.command("subscribers").description("Manage subscribers").action(()=>Ko.help());S(Ko,{notes:["Subscriber list fetches every page by default so agents do not silently miss later results.","`subscribers get` includes tags, list memberships, sequence enrollments, email stats, and recent activity.","--attr expects repeated key=value pairs. Example: --attr firstName=Ana --attr plan=pro","--attr sends strings. Use --attrs-json on add and update for numbers, booleans, lists, or strings with leading zeros such as zip codes. `subscribers attributes` lists the names and types already in use."],examples:["sequenzy subscribers list --tag vip",'sequenzy subscribers list --list "Master List" --json',"sequenzy subscribers list --tag vip --limit 25 --json","sequenzy subscribers add user@example.com --tag trial --attr firstName=Ana","sequenzy subscribers attributes","sequenzy subscribers import copper-contacts.csv --list list_123 --opt-in-mode confirmed","sequenzy subscribers import-status import_123 --json","sequenzy subscribers get user@example.com --json",'sequenzy subscribers notes add user@example.com --body "Customer prefers quarterly reports"',"sequenzy subscribers remove user@example.com --hard"]});var LB=Ko.command("operations").description("Run and monitor background audience tagging");LB.command("start").requiredOption("--kind <kind>","add_tags").option("--audience-json <json>","Audience filters or subscriberIds as JSON (supports @file)").option("--tag <tags...>","Tags to add").option("--trigger-automations","Trigger tag automations (requires automations:trigger)").option("--request-key <key>","Idempotency key; reuse after an uncertain start response").option("-c, --company <id>","Company ID").option("--json","Print JSON").action((e)=>bv("start",e));LB.command("list").option("-c, --company <id>").option("--json").action((e)=>bv("list",e));for(let e of["get","cancel"])LB.command(`${e} <id>`).option("-c, --company <id>").option("--json").action((t,n)=>bv(e,{...n,id:t}));var nEe=Ko.command("list").description("List subscribers").option("-s, --segment <id>","Filter by segment").option("-t, --tag <tag>","Filter by tag").option("--list <id-or-name>","Filter by subscriber list ID or exact name").option("--status <status>","active, unsubscribed, bounced, or all").option("--unsubscribed-after <date>","Only contacts whose opt-out is on or after this ISO 8601 date or zoned datetime").option("--unsubscribed-before <date>","Only contacts whose opt-out is on or before this ISO 8601 date or zoned datetime").option("--attribute <name>",'Filter by custom attribute name, e.g. "plan". The "name:value" form also works').option("--attribute-value <value>","Value the custom attribute must match").option("--attribute-operator <operator>","is, contains, gt, gte, lt, lte, or is_not_empty (default: is)").option("-l, --limit <number>","Maximum results to return").option("--offset <number>","Matches to skip (maximum 999999; use --cursor for deeper pagination)").option("--page <number>","1-based page number; requires --limit").option("--cursor <token>","pagination.nextCursor from the previous response; cheaper than --offset").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>pi("list",e));S(nEe,{notes:["Without --limit the command walks every page and returns all matches in one call.","With --limit, page through the audience by re-running with --cursor set to the previous response's pagination.nextCursor. Fall back to --offset (or --page) when nextCursor is null.","--attribute filters on ClickHouse-backed custom attributes and cannot be combined with --segment. Use a saved segment for compound or is_not/is_empty attribute filters.","--unsubscribed-after/--unsubscribed-before match the opt-out date and exclude contacts that have none: active contacts, and contacts imported as already unsubscribed. Bare dates use UTC midnight; datetimes must include Z or an explicit offset."],examples:["sequenzy subscribers list",'sequenzy subscribers list --list "Master List"',"sequenzy subscribers list --segment seg_123","sequenzy subscribers list --tag onboarding --limit 100","sequenzy subscribers list --status unsubscribed --unsubscribed-after 2026-07-01 --json","sequenzy subscribers list --limit 50 --json","sequenzy subscribers list --limit 50 --cursor NEXT_CURSOR --json","sequenzy subscribers list --limit 50 --offset 50 --json","sequenzy subscribers list --attribute plan --attribute-value pro","sequenzy subscribers list --attribute mrr --attribute-value 50 --attribute-operator gte","sequenzy subscribers list --attribute prem_rouge_sample_received --attribute-operator is_not_empty --json"]});var rEe=Ko.command("add [email]").description("Add or upsert a subscriber").option("--external-id <id>","Customer-owned subscriber ID").option("--phone <phone>","Phone number (E.164 or national). With no email, creates a phone-only SMS contact").option("--phone-country <country>","Two-letter country used to read a national-format --phone (default US)").option("--sms-consent","Record express written SMS marketing consent for the phone number").option("--first-name <name>","Subscriber first name").option("--last-name <name>","Subscriber last name").option("--timezone <zone>","IANA timezone (e.g. America/New_York) used for recipient-local campaign delivery").option("-t, --tag <tags...>","Tags to apply").option("-l, --list <ids...>","List IDs to add the subscriber to").option("--no-lists","Add the subscriber to no lists").option("--skip-sequences","Do not enroll the subscriber in matching sequences").option("--enroll-sequences","Enroll matching sequences, including when --created-at is supplied (requires automations:trigger)").option("-a, --attr <attrs...>","Attributes (key=value)").option("--attrs-json <json>",`Attributes as a JSON object that keeps value types, e.g. '{"zip":"02134","seats":5}'`).option("--created-at <iso-date>","Original signup date when importing history from another platform (only ever moves an existing contact's date earlier; skips sequences unless --enroll-sequences is passed)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>pi("add",{email:e,...t,noLists:t.lists===!1}));S(rEe,{examples:["sequenzy subscribers add user@example.com","sequenzy subscribers add user@example.com --first-name Ana --tag trial --attr plan=pro",`sequenzy subscribers add user@example.com --attrs-json '{"zip":"02134","seats":5,"vip":true}'`,"sequenzy subscribers add user@example.com --list list_123","sequenzy subscribers add user@example.com --skip-sequences","sequenzy subscribers add user@example.com --created-at 2019-03-14T09:30:00Z","sequenzy subscribers add user@example.com --created-at 2019-03-14T09:30:00Z --enroll-sequences","sequenzy subscribers add --phone '+14155550123' --sms-consent"],notes:["--attr values are always sent as strings. Use --attrs-json for numbers, booleans and lists, or to keep a value such as a zip code as a quoted string. When both set the same key, --attr wins. Run `sequenzy subscribers attributes` to see the names and types your other contacts use.","--created-at preserves a contact's real signup date so date-relative segments are correct right after a migration. It never moves an existing contact's date later, and it suppresses sequence enrollment by default because it describes the past, not a signup happening now. Pass --enroll-sequences to opt in explicitly. New-subscriber account notifications remain eligible when the signup date is at most one hour old; older dates do not notify on creation. Double opt-in confirmation can notify even for imported contacts. Your notification preferences, double opt-in and the daily cap still apply."]});var oEe=Ko.command("import [file]").description("Queue a full-record subscriber import from CSV or JSON").option("--records-json <json>","Inline JSON array (alternative to a CSV/JSON file)").option("--duplicate-strategy <strategy>","Existing contact behavior: skip, merge, or overwrite","skip").option("--file-name <name>","Source label shown in import history").option("-l, --list <ids...>","List IDs for every imported subscriber (requires lists:write)").option("--enroll-sequences","Enroll matching subscribers (requires automations:trigger)").option("--default-phone-country <country>","Two-letter country for national phone numbers").option("--sms-consent","Assert express written SMS consent for every imported phone").option("--opt-in-mode <mode>","Email consent mode: default, confirmed, or double_opt_in (default may require automations:trigger; double_opt_in always does)","default").option("--idempotency-key <key>","Caller-owned key (1-255 chars) that makes retrying this request safe: resending the same content returns the already-queued import, while changed content under the same key queues a new import").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>pi("import",{file:e,...t}));S(oEe,{notes:["CSV columns for email, names, external ID, phone, status, and tags are detected automatically; other columns become custom attributes.","Status values from AWeber, Mailchimp, Kit, MailerLite, Brevo, ActiveCampaign, and beehiiv exports are mapped to active, unsubscribed, or bounced. A filled unsubscribe date column marks the row unsubscribed. Not-confirmed (pending double opt-in) and unrecognized values import as active; unrecognized ones are counted in the output.","Use --opt-in-mode confirmed only when these contacts already gave verified email consent.","Imports run asynchronously. Poll the returned ID with subscribers import-status.","Pass --idempotency-key from pipelines and retry loops so a timed-out request can be resent without double-queueing the batch.","If two identical keyed requests overlap, one may receive a retryable 503; honor Retry-After and resend the same request."],examples:["sequenzy subscribers import copper-contacts.csv --list list_123 --opt-in-mode confirmed",`sequenzy subscribers import --records-json '[{"email":"one@example.com","firstName":"Ana"}]' --opt-in-mode confirmed`,"sequenzy subscribers import contacts.csv --duplicate-strategy merge --idempotency-key nightly-sync-2026-08-25"]});var iEe=Ko.command("import-status <importId>").description("Get subscriber import progress and result counts").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>pi("import:get",{importId:e,...t}));S(iEe,{notes:["A completed import can still contain failed rows; inspect failed counts and --json reason maps."],examples:["sequenzy subscribers import-status import_123","sequenzy subscribers import-status import_123 --json"]});var sEe=Ko.command("events-import [file]").description("Record events for many subscribers from a JSON file").option("--events-json <json>","Inline JSON array (alternative to a JSON file)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>pi("events:import",{file:e,...t}));S(sEe,{notes:["Each event needs a name, an eventId, and an email or externalId; externalId-only rows must identify an existing contact because email is required for creation. At most 25 events per request.","History is classified per contact: only contacts whose events are all more than an hour old use the silent historical path. If any event for a contact is recent, every event for that contact uses the live path and can run sequences or webhooks.","Derive each required eventId from your source data so re-running the same file records nothing twice."],examples:["sequenzy subscribers events-import purchases.json",`sequenzy subscribers events-import --events-json '[{"email":"one@example.com","name":"purchase_completed","eventId":"order_1","occurredAt":"2026-08-01T12:00:00Z"}]'`]});var aEe=Ko.command("get [email]").description("Get subscriber details").option("--external-id <id>","Customer-owned subscriber ID").option("--include-bots","Include machine-classified bot/scanner opens and clicks in stats/activity").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>pi("get",{email:e,...t}));S(aEe,{notes:["Bot/scanner opens and clicks are excluded by default; pass --include-bots to inspect raw engagement."],examples:["sequenzy subscribers get user@example.com","sequenzy subscribers get user@example.com --include-bots"]});var dg=Ko.command("notes").description("Manage subscriber notes").action(()=>dg.help());S(dg,{examples:["sequenzy subscribers notes list user@example.com",'sequenzy subscribers notes add user@example.com --body "Prefers monthly digest"',"sequenzy subscribers notes delete note_123"]});var cEe=dg.command("list [email]").description("List subscriber notes").option("--external-id <id>","Customer-owned subscriber ID").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>pi("notes:list",{email:e,...t}));S(cEe,{examples:["sequenzy subscribers notes list user@example.com","sequenzy subscribers notes list --external-id user_123 --json"]});var lEe=dg.command("add [email]").description("Add a subscriber note").option("--external-id <id>","Customer-owned subscriber ID").requiredOption("-b, --body <body>","Note body").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>pi("notes:add",{email:e,...t}));S(lEe,{examples:['sequenzy subscribers notes add user@example.com --body "Asked about enterprise plan"','sequenzy subscribers notes add --external-id user_123 --body "Imported from sales call"']});var uEe=dg.command("delete <noteId>").description("Delete a subscriber note").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>pi("notes:delete",{noteId:e,...t}));S(uEe,{examples:["sequenzy subscribers notes delete note_123"]});var dEe=Ko.command("attributes").description("List the custom attributes your contacts use, with value types and examples").option("--include-nested","Also list nested paths such as profile.tier").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>pi("attributes",e));S(dEe,{notes:["Types and examples come from up to 100 recent contacts. Names that only older contacts use are listed too, with sampledContacts 0.",`A list attribute (isArray) holds several values. Set it with --attrs-json, e.g. --attrs-json '{"interests":["running"]}'.`],examples:["sequenzy subscribers attributes","sequenzy subscribers attributes --include-nested --json"]});var pEe=Ko.command("update [email]").description("Update subscriber status, name, phone, tags, or custom attributes").option("--external-id <id>","Customer-owned subscriber ID").option("--status <status>","Subscriber status").option("--first-name <name>","Subscriber first name").option("--last-name <name>","Subscriber last name").option("--timezone <zone>","IANA timezone (e.g. America/New_York). Pass an empty string to clear it").option("--phone <phone>","Phone number (E.164 or national). Pass an empty string to clear it").option("--phone-country <country>","Two-letter country used to read a national-format --phone (default US)").option("--sms-consent","Record express written SMS marketing consent for the phone number").option("--no-sms-consent","Unsubscribe the contact from SMS").option("-t, --tag <tags...>","Replacement tags").option("-a, --attr <attrs...>","Attributes (key=value)").option("--attrs-json <json>",`Attributes as a JSON object that keeps value types, e.g. '{"seats":5}'`).option("--merge","Merge custom attributes instead of replacing them").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>pi("update",{email:e,...t}));S(pEe,{notes:["--phone writes the native phone field shown on the contact, not a custom attribute.","--attr values are always sent as strings. Use --attrs-json to set numbers, booleans and lists or to change an attribute's type. When both set the same key, --attr wins.","Changing --phone resets SMS consent unless --sms-consent is passed in the same command."],examples:["sequenzy subscribers update user@example.com --status unsubscribed","sequenzy subscribers update user@example.com --first-name Ana --last-name Silva","sequenzy subscribers update user@example.com --phone '+390512345678'","sequenzy subscribers update user@example.com --phone '051 234 5678' --phone-country IT --sms-consent","sequenzy subscribers update user@example.com --tag churned --attr cancelReason=too_expensive","sequenzy subscribers update user@example.com --attr plan=pro --merge",`sequenzy subscribers update user@example.com --attrs-json '{"zip":"02134"}' --merge`]});var mEe=Ko.command("event [email]").description("Trigger an event for a subscriber").option("--external-id <id>","Customer-owned subscriber ID").requiredOption("-n, --name <event>","Event name").option("-p, --property <properties...>","Event properties (key=value)").option("-a, --attr <attrs...>","Subscriber attributes (key=value)").option("--account <externalId>","Attach the contact to this customer account (ignored with a warning until the workspace has Accounts on)").option("--account-json <json>","Account reference object with externalId and optional role, name, domain, attributes; cannot be combined with --account").option("--occurred-at <iso-date>","When the event actually happened; more than an hour ago records it as history without running sequences").option("--event-id <id>","Your own event ID, so re-sending the same event writes nothing new").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>pi("event",{email:e,...t}));S(mEe,{examples:["sequenzy subscribers event user@example.com --name saas.purchase","sequenzy subscribers event user@example.com --name saas.purchase --property plan=pro --property amount=99","sequenzy subscribers event user@example.com --name saas.purchase --occurred-at 2024-11-02T10:00:00Z --event-id inv_9182"],notes:["Without --occurred-at the event is live and runs the full chain: sync rules, sequence enrollment, waiting steps, goal conversions.","--event-id is an idempotency key on both paths: re-sending an ID this contact already has for this event name records nothing and runs no side effects. It is best-effort for live events sent within a second of each other, so a producer that needs a strict guarantee should keep its own ledger.","With an --occurred-at more than an hour in the past the event is recorded as history: stored with its real timestamp and counted by segments, but no sequences enroll and no webhooks fire. The contact's signup date also moves back to when the event occurred (never later). Use it for backfills, never to fake a live event."]});var kv=Ko.command("tags").description("Bulk add or remove tags across many existing subscribers").action(()=>kv.help());S(kv,{notes:["These commands only touch contacts that already exist. Unknown identifiers are reported, never created.","Use `subscribers add` or `subscribers update` for single-contact tag changes."],examples:["sequenzy subscribers tags add --tag legacy-plan --emails-file ./backlog.csv","sequenzy subscribers tags remove --tag legacy-plan --emails-file ./backlog.csv"]});var fEe=kv.command("add").description("Add tags to many existing subscribers").requiredOption("-t, --tag <tags...>","Tags to add").option("-e, --email <emails...>","Subscriber emails to tag").option("--emails-json <json>","JSON array of subscriber emails").option("--emails-file <file>","CSV or newline-separated file of emails").option("--external-id <ids...>","Customer-owned subscriber IDs to tag").option("--subscriber-id <ids...>","Sequenzy subscriber IDs to tag").option("--trigger-automations","Allow tag_added sequences to enroll these contacts (requires automations:trigger)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>CB("add",e));S(fEe,{notes:["Tag automations are skipped by default, which is what historical backfills want.","Requests are chunked at 500 targets each; totals in the output are combined across chunks."],examples:["sequenzy subscribers tags add --tag vip --email a@example.com --email b@example.com","sequenzy subscribers tags add --tag derived-churn --emails-file ./backlog.csv --json","sequenzy subscribers tags add --tag welcome --emails-file ./new.csv --trigger-automations"]});var gEe=kv.command("remove").description("Remove tags from many existing subscribers").requiredOption("-t, --tag <tags...>","Tags to remove").option("-e, --email <emails...>","Subscriber emails to untag").option("--emails-json <json>","JSON array of subscriber emails").option("--emails-file <file>","CSV or newline-separated file of emails").option("--external-id <ids...>","Customer-owned subscriber IDs to untag").option("--subscriber-id <ids...>","Sequenzy subscriber IDs to untag").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>CB("remove",e));S(gEe,{examples:["sequenzy subscribers tags remove --tag legacy-plan --emails-file ./backlog.csv","sequenzy subscribers tags remove --tag vip --subscriber-id sub_1 sub_2"]});var AEe=Ko.command("remove [email]").description("Unsubscribe or permanently delete a subscriber").option("--external-id <id>","Customer-owned subscriber ID").option("--hard","Permanently delete (not just unsubscribe); recorded data is erased or anonymized, suppressions are kept").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>pi("remove",{email:e,...t}));S(AEe,{examples:["sequenzy subscribers remove user@example.com","sequenzy subscribers remove user@example.com --hard"]});var Tu=Je.command("transactional").description("Manage transactional email templates").action(()=>Tu.help());S(Tu,{notes:["Use the top-level `sequenzy send` command to send email."],examples:["sequenzy transactional list","sequenzy transactional get welcome","sequenzy transactional update welcome --no-enabled","sequenzy transactional delete welcome --yes","sequenzy send user@example.com --template welcome --var firstName=Ana"]});var hEe=Tu.command("list").description("List transactional templates").option("--label <labels...>","Filter by label names (matches any)").option("--search <text>","Search name, slug, or email subject/title").option("--status <status>","Filter by all, active, or disabled","all").option("--sort <field>","Sort by date, sends, opens, open-rate, clicks, or ctr","date").option("--order <order>","Sort order: asc or desc","desc").option("--include-bots","Include machine opens and clicks").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>kp("list",e));S(hEe,{examples:['sequenzy transactional list --search "password reset" --status active',"sequenzy transactional list --sort open-rate --order desc","sequenzy transactional list --company comp_123 --json"]});var yEe=Tu.command("get <slug>").description("Get transactional template details by slug").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>kp("get",{slug:e,...t}));S(yEe,{examples:["sequenzy transactional get welcome"]});var bEe=Tu.command("create <name>").description("Create a transactional template").option("--label <labels...>","Label names to assign").option("--slug <slug>","API slug").option("-s, --subject <subject>","Subject (optional with --prompt)").option("--preview-text <text>","Preview text override").option("--prompt <prompt>","Generate branded transactional blocks").option("--style <style>","Prompt generation style. Pass designed or plain to force the designed or plain-text email style; other values are freeform guidance (defaults to the company's email style preference)").option("--tone <tone>","Prompt generation tone").option("--html <html>","Preserved HTML content").option("--html-file <file>","Read preserved HTML from file").option("--blocks-json <json>","Finished Sequenzy blocks JSON").option("--blocks-file <file>","Read finished Sequenzy blocks from file").option("--enabled","Enable immediately (prompt creates default disabled)").option("--no-enabled","Create the transactional template disabled").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>kp("create",{name:e,...t}));S(bEe,{notes:["Provide exactly one of prompt, HTML, or blocks.",ug],examples:['sequenzy transactional create password-reset --prompt "Write a password reset email"']});var vEe=Tu.command("update <slug>").description("Update a transactional template by ID or slug").option("--label <labels...>","Replace label names").option("--clear-labels","Remove all label assignments").option("--name <name>","Transactional template name").option("-s, --subject <subject>","Subject line").option("--preview-text <text>","Preview text").option("--clear-preview-text","Remove the preview text").option("--html <html>","Replace the body with preserved HTML").option("--html-file <file>","Replace the body with HTML read from file").option("--blocks-json <json>","Replace the body with Sequenzy blocks JSON").option("--blocks-file <file>","Replace the body with blocks read from file").option("--enabled","Allow this template to be sent").option("--no-enabled","Stop this template from being sent").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>kp("update",{slug:e,...t}));S(vEe,{notes:["Partial update: only the fields you pass change.","Replacing the body takes HTML or blocks, not both.","Use --no-enabled to stop sends while keeping the template and its stats.",ug],examples:["sequenzy transactional update password-reset --no-enabled",'sequenzy transactional update password-reset --subject "Reset your password"',"sequenzy transactional update password-reset --blocks-file ./reset.json"]});var EEe=Tu.command("delete <slug>").description("Delete a transactional template by ID or slug").option("-y, --yes","Skip the confirmation prompt").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>kp("delete",{slug:e,...t}));S(EEe,{notes:["Deleting frees the slug for reuse and stops any further sends through it.","Past deliveries and their stats are kept; only the saved template is removed.","Requires an API key with the transactional:delete scope."],examples:["sequenzy transactional delete password-reset --yes"]});var UB=Je.command("widgets").description("Widget helper commands").action(()=>UB.help());S(UB,{examples:["sequenzy widgets preferences-token user@example.com"]});var IEe=UB.command("preferences-token <email>").description("Generate a subscription preferences iframe token").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>AV("preferences-token",{email:e,...t}));S(IEe,{examples:["sequenzy widgets preferences-token user@example.com"]});var Rv=Je.command("email-sends").alias("emailsends").description("Inspect sent email snapshots and delivery events").action(()=>Rv.help());S(Rv,{notes:["Email send rows are short-lived; if the row was cleaned up, this falls back to retained ClickHouse events.","The list command matches the dashboard's 14-day delivery history and supports subject, recipient, status, type, and source filters.","Use --html to print the stored HTML body when it is still available."],examples:['sequenzy email-sends list --search "Welcome" --status opened',"sequenzy email-sends get send_123","sequenzy email-sends get send_123 --html","sequenzy email-sends get send_123 --json"]});var CEe=Rv.command("list").description("List and filter recent sent email deliveries").option("--search <text>","Search subject or recipient email").option("--subject <text>","Filter by subject/title").option("--recipient <text>","Filter by recipient email").option("--status <status>","Filter by delivery status").option("--email-type <type>","Filter by campaign, transactional, or sequence").option("--bounce-type <type>","Filter bounced sends by Permanent or Transient").option("--campaign <id>","Filter by campaign ID").option("--transactional <id>","Filter by saved transactional email ID").option("--sequence <id>","Filter by sequence ID").option("--automation-node-id <id>","Filter by one email step of a sequence").option("--mailbox-provider <provider>","Filter by recipient mailbox provider (e.g. gmail, orange, other)").option("--list <id>","Only sends to active subscribers currently on this list").option("--days <days>","History window in days (maximum 14)","14").option("--page <page>","Page number").option("--limit <limit>","Results per page (maximum 100)").option("--all","Fetch every result page").option("--csv [path]","Export CSV to stdout, or write it to an optional file path").option("--sort <field>","Sort by recipientEmail, subject, status, eventAt, sentAt, or createdAt","createdAt").option("--order <order>","Sort order: asc or desc","desc").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>G0("list",e));S(CEe,{notes:["The opened status includes clicked deliveries, matching the dashboard.","Use a returned ID with `sequenzy email-sends get <id>` for timestamps and the complete event timeline.","Use --all --csv email-sends.csv to export every matching delivery.","--automation-node-id lists the recipients of one sequence step; the node ID comes from `stats --sequence <id>`.","--mailbox-provider uses the same providers as `stats --mailbox-provider`, so it lists the sends behind a provider's numbers; `other` is every domain outside the named providers.","This history only reaches back 14 days. For per-step send totals over the full retained window use `stats --sequence <id>` or `stats --emails`."],examples:['sequenzy email-sends list --search "Welcome" --status opened',"sequenzy email-sends list --email-type transactional --days 7","sequenzy email-sends list --sequence seq_123 --automation-node-id node_email_4","sequenzy email-sends list --mailbox-provider orange --list list_123 --status opened","sequenzy email-sends list --transactional txn_123 --all --csv email-sends.csv","sequenzy email-sends list --subject receipt --recipient example.com --json"]});var wEe=Rv.command("get <emailSendId>").description("Get an email send by ID").option("-c, --company <id>","Company ID override for personal API keys").option("--html","Print the full stored HTML body in text output").option("--html-only","Print only the stored HTML body").option("--json","Print raw JSON").action((e,t)=>G0("get",{id:e,...t}));S(wEe,{examples:["sequenzy email-sends get send_123","sequenzy email-sends get send_123 --html","sequenzy email-sends get send_123 --company comp_123 --json"]});var pg=Je.command("suppressions").description("Inspect recipient suppression and clear workspace escalations").action(()=>pg.help());S(pg,{notes:["Suppression lookup is exact-address only because the SES account-level list is shared across companies.","Removal clears workspace soft-bounce escalations only; global invalid-recipient, workspace hard-bounce, SES, complaint, and unsubscribe protections are preserved."],examples:["sequenzy suppressions list","sequenzy suppressions get me@example.com","sequenzy suppressions remove me@example.com --yes"]});var SEe=pg.command("list").description("List recipients this workspace cannot reach").option("--search <query>","Filter by email substring").option("--page <page>","Page number (default 1)").option("--limit <limit>","Entries per page (max 100)").option("--sort <field>","Order by suppressedAt, email, or status").option("--order <direction>","asc or desc").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>Iv("list",e));S(SEe,{notes:["Shows protected global invalid-recipient suppressions for associated addresses, protected workspace hard bounces without conclusive invalid-inbox evidence, workspace soft-bounce escalations, and recipients who reported an email as spam.","Only workspace soft-bounce escalations can be removed.","--sort status lists removable escalations before protected suppressions. An unrecognized --sort falls back to newest first, and the applied order is printed with the results."],examples:["sequenzy suppressions list","sequenzy suppressions list --search example.com --json","sequenzy suppressions list --sort status --order desc"]});var DEe=pg.command("get <email>").description("Check local and Amazon SES suppression for one recipient").option("--region <region>","Check one AWS SES region").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Iv("get",{email:e,...t}));S(DEe,{examples:["sequenzy suppressions get me@example.com","sequenzy suppressions get me@example.com --region us-east-1 --json"]});var BEe=pg.command("remove <email>").description("Remove a workspace soft-bounce escalation").option("--region <region>","Inspect one AWS SES region after removal").option("-c, --company <id>","Company ID override for personal API keys").option("-y, --yes","Skip confirmation").option("--json","Print raw JSON").action((e,t)=>Iv("remove",{email:e,...t}));S(BEe,{examples:["sequenzy suppressions remove me@example.com","sequenzy suppressions remove me@example.com --region us-east-1 --yes"]});var xEe=_3(Je.command("send <email...>").description("Send through the transactional email API")).option("-t, --template <slug>","Transactional template slug to use").option("-s, --subject <subject>","Email subject").option("--html <html>","Email HTML content").option("--html-file <file>","Read HTML from file, or - for stdin").option("--track-as <name>","Track --html sends under one code-managed transactional email (e.g. weekly-report)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").option("--email-type <type>","Delivery policy: transactional (default) or marketing").option("--from-email <email>","Send from this verified sender address instead of the company default").option("--from-name <name>","Existing sender display name on --from-email when the address has several identities").option("--sender-profile-id <id>","Existing sender profile ID; omit --from-email. See sequenzy sender-profiles list").option("--reply-to <address>","Reply-To address or Name <email> value").option("--reply-to-name <name>","Display name for a bare --reply-to address").option("--reply-profile <id>","Existing reply profile ID; omit --reply-to. See sequenzy sender-profiles list").option("--attachments-json <json>","Attachments as JSON objects with filename and content or path").option("--header <header>",'Extra email header as "Name: value", e.g. a List-Unsubscribe for a transactional send (repeatable)',(e,t=[])=>[...t,e]).option("--no-track-clicks","Disable click tracking for this send to keep iOS/Android universal links working").option("--no-track-opens","Disable the open-tracking pixel for this send").option("--idempotency-key <key>","Retry key that prevents duplicate sends for 14 days").option("--vars-json <json>","Variables as a JSON object, including nested arrays for repeat blocks").option("-v, --var <vars...>","Variables (key=value)").action(T3);S(xEe,{notes:["Use either --template or --html/--html-file.","Use --html-file - for piped HTML. --json prints the accepted API receipt; failures print structured JSON to stderr.","--template takes a transactional API slug and cannot be combined with --subject.","--subject is required when sending raw HTML.","--track-as names a raw-HTML email type (for example weekly-report): every send with the same value is counted under one code-managed transactional email that the first send creates. Use stable ASCII names (letters, digits, spaces and . _ - : /), not per-recipient values; a workspace can have 100. It cannot be combined with --template.","Pass several recipients, --cc, or --bcc to send one email with a shared recipient list instead of one email per address. Each list accepts up to 50 addresses; repeat --cc/--bcc or use comma-separated values for several copy recipients.","Addresses repeated across the lists are dropped from the lower-priority one: to beats cc beats bcc.","--email-type marketing adds the standard unsubscribe footer and RFC 8058 one-click-unsubscribe headers; it supports one recipient only and rejects --cc and --bcc.","When --from-email and --sender-profile-id are omitted, a template send keeps its saved From identity and a direct send uses the company default. Pass --from-email (and --from-name if that address has several identities) to send as a non-default verified brand without looking up IDs.","Use either --from-email or --sender-profile-id, not both. --from-name requires --from-email. --sender-profile-id already carries the display name.","When --reply-to and --reply-profile are omitted, the saved template or company Reply-To default is used. Use either --reply-to or --reply-profile, not both. --reply-to-name requires a bare --reply-to address.","--attachments-json accepts up to 10 objects with filename plus Base64 content or a public path; contentId embeds a CID image and contentType overrides MIME detection.",`--header adds an email header (up to 50). Transactional sends can carry your own List-Unsubscribe and List-Unsubscribe-Post; marketing sends always use Sequenzy's. Headers Sequenzy manages, such as From, To, Subject, Reply-To and Message-ID, are not applied; the receipt lists any header that was not applied and why. A --header without "Name:" or a name given twice is rejected before sending.`,"--no-track-clicks and --no-track-opens are opt-out only for this send; they cannot enable tracking the account has disabled.","--vars-json accepts nested objects and arrays; --var overrides individual scalar keys.","If the recipient matches a subscriber, saved first and last names fill omitted name variables; --var values override them.","For retryable automation, generate one --idempotency-key per logical email and reuse that same key on every retry. Reusing it with different content is rejected."],examples:["sequenzy send user@example.com --template welcome --var firstName=Ana","sequenzy send buyer@example.com ops@example.com --cc billing@example.com --bcc archive@example.com --template order-confirmation",`sequenzy send user@example.com --template welcome --vars-json '{"event":{"items":[{"title":"Plan","description":"Pro"}]}}'`,'sequenzy send user@example.com --subject "Welcome" --html-file ./welcome.html','sequenzy send user@example.com --subject "Your week" --html-file ./weekly.html --track-as weekly-report',`sequenzy send user@example.com --subject "Ticket" --html '<img src="cid:ticket-qr">' --attachments-json '[{"filename":"ticket.png","path":"https://example.com/ticket.png","contentId":"ticket-qr","contentType":"image/png"}]'`,"sequenzy send user@example.com --template trial-reminder --email-type marketing --var firstName=Ana",'sequenzy send user@example.com --subject "StudyBoost test" --html "<p>Hi</p>" --from-email hello@studyboost.com --from-name StudyBoost --reply-to support@studyboost.com --reply-to-name "StudyBoost Support"',"sequenzy send user@example.com --template receipt --idempotency-key order-123-receipt",'sequenzy send user@example.com --template weekly-digest --header "List-Unsubscribe: <https://example.com/unsubscribe/abc>" --header "List-Unsubscribe-Post: List-Unsubscribe=One-Click"']});var Xn=Je.command("campaigns").description("Manage campaigns").action(()=>Xn.help());S(Xn,{notes:["Campaign creation supports HTML, Sequenzy blocks, or prompt-generated content.","Campaign updates support HTML, Sequenzy blocks, subject, name, labels, and reply-to changes.","Campaign scheduling requires a future ISO timestamp and a verified sending domain.","Use unschedule to return a scheduled campaign to draft, cancel to stop one permanently, and pause/resume to control an active send.",ug],examples:["sequenzy campaigns list --status draft --company comp_123",'sequenzy campaigns create "April Launch" --subject "We shipped" --html-file ./campaign.html','sequenzy campaigns create "API Launch" --subject "We shipped" --label edm api --html-file ./campaign.html','sequenzy campaigns schedule camp_123 --at "2026-06-01T14:00:00Z"',"sequenzy campaigns test camp_123 --to you@example.com","sequenzy campaigns unschedule camp_123","sequenzy campaigns cancel camp_123","sequenzy campaigns duplicate camp_123 --mode ab_test"]});Xn.command("from-audience").description("Create a draft for a frozen selection of contacts or email activity").option("--name <name>","Draft name").option("--selection-json <json>","Selection object: source contacts or email_activity, with matching contacts or activity settings").option("--selection-file <path>","Read the selection JSON from a file, or - for stdin").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>ur("from-audience",e));var _Ee=Xn.command("list").description("List campaigns").option("-s, --status <status>","Filter by status").option("--label <labels...>","Filter by label name").option("--limit <count>","Page size from 1 to 100 (defaults to 50)").option("--offset <count>","Zero-based result offset").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>ur("list",e));S(_Ee,{notes:["Results are paginated: the default page size is 50 and --limit is capped at 100.","Read the pagination object (--json) or the trailing hint to page through every campaign with --offset."],examples:["sequenzy campaigns list","sequenzy campaigns list --status draft --company comp_123","sequenzy campaigns list --label edm","sequenzy campaigns list --limit 100 --offset 100"]});var kEe=Xn.command("get <id>").description("Get campaign details").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ur("get",{id:e,...t}));S(kEe,{examples:["sequenzy campaigns get camp_123 --company comp_123"]});var REe=Xn.command("audience <id>").description("Show who a campaign will reach, with a live recipient count").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ur("audience",{id:e,...t}));S(REe,{notes:["Resolves list and segment names and recomputes the recipient count at read time.","Warns when targeting is unset, because scheduling then sends to every active subscriber."],examples:["sequenzy campaigns audience camp_123 --company comp_123"]});function EV(e){return e.option("--subscriber <id>","Personalize as a stored subscriber").option("--email <email>","Personalize as an ad-hoc contact").option("--first-name <name>","First name for --email").option("--last-name <name>","Last name for --email").option("--attr <key=value...>","Custom attribute for the --email contact (repeatable)").option("--attrs-json <json>","Custom attributes for the --email contact as a JSON object").option("--tag <tags...>","Tag the --email contact carries, for previewing tag conditions (repeatable)").option("--empty-tags","State that the --email contact carries no tags, for previewing empty-tag conditions").option("--var <key=value...>","Extra merge variable (repeatable)").option("--vars-json <json>","Extra merge variables as a JSON object").option("--locale <locale>","Force a localization locale")}function jB(e){return EV(e).option("--tracking","Apply the company's auto-UTM link decoration").option("--out <file>","Write the HTML to a file, or - for stdout").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON")}function zB(e){return EV(e).option("--no-links","Skip live link and image verification").option("--fail-on <severity>","Exit with code 1 when an issue of this severity or worse is found: error or warning").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON")}var MB=["Runs the same checks as the editor's email checker against the saved content, plus live verification of every link and image: broken pages, dead domains, certificate problems, redirect loops, missing https://, localhost/staging/preview URLs, placeholder domains, link shorteners, misleading link text, invalid mailto/tel links, and broken or oversized images.","Also flags leftover placeholder copy (lorem ipsum, [First Name], TODO), name merge tags without a fallback, missing alt text, spam-trigger wording, Gmail clipping risk and email-client compatibility problems.",'Links built from per-recipient merge tags are listed as "personalized" and only syntax-checked. {{company.url}} links are resolved from your company website.',`"Couldn't verify" means the site refused an automated check (for example 401, 403 or 429). It may work in a browser, so it is never counted as broken.`,"Sender settings are not part of this check. Use --fail-on error in CI or scripts to stop on problems."],HB=["Renders the email exactly as it would be sent, so an external builder or dashboard can show a true preview.","Without --subscriber or --email the email renders for a sample contact and contact-specific merge tags resolve to empty values.","Unresolved merge tags are listed in the summary and under unresolvedMergeTags with --json. Nothing is called unrecognized unless the render knows the contact's attributes, since a bare {{plan}} reads the same attributes as {{subscriber.plan}}, so pass --subscriber, or --email with --attr/--attrs-json, to catch typos. Rendering a transactional email also needs --var/--vars-json, since its tags come from the variables of each send call.",'Conditional blocks that read stored subscriber state (tag, segment, list, status, event, purchases, engagement) can only be evaluated for --subscriber, or for a tag condition with --email plus --tag/--empty-tags. Anything the render cannot evaluate is rendered as false and listed under "Conditions not evaluated", because an else branch in the HTML looks the same either way.',"Links are clean by default. Pass --tracking to apply the company's auto-UTM decoration.","Per-send click redirects and the open pixel are added at send time against a real email send record, so they never appear in a render."],QEe=jB(Xn.command("render <id>").description("Render a campaign to email-ready HTML").option("--variant <id>","Render a specific A/B test variant").option("--variation <id>","Render a design variation of the email (from variations list)")).action((e,t)=>cb({type:"campaign",id:e},t));S(QEe,{notes:HB,examples:["sequenzy campaigns render camp_123 --out preview.html","sequenzy campaigns render camp_123 --subscriber sub_123 --out -","sequenzy campaigns render camp_123 --email you@example.com --first-name Ada --var plan=Pro","sequenzy campaigns render camp_123 --email you@example.com --tag extended","sequenzy campaigns render camp_123 --email you@example.com --empty-tags","sequenzy campaigns render camp_123 --email you@example.com --attr plan=pro --attr mrr=99 --json","sequenzy campaigns render camp_123 --variant var_123 --tracking --json"]});var TEe=zB(Xn.command("check <id>").description("Check a campaign before sending: broken links and images, placeholders, content and client issues").option("--variant <id>","Check a specific A/B test variant")).action((e,t)=>lb({type:"campaign",id:e},t));S(TEe,{notes:MB,examples:["sequenzy campaigns check camp_123","sequenzy campaigns check camp_123 --fail-on error","sequenzy campaigns check camp_123 --no-links --json"]});var $Ee=Xn.command("create <name>").description("Create a campaign").option("-s, --subject <subject>","Email subject").option("--preview-text <text>","Inbox preview text").option("--preheader-text <text>","Alias for --preview-text").option("--tracking-code <code>","Optional campaign tracking code").option("--status <status>","Initial status: draft or sent").option("--sent-at <iso-date>","Sent timestamp when creating with --status sent").option("--html <html>","Email HTML content").option("--html-file <file>","Read HTML from file").option("--blocks-json <json>","Inline JSON array of Sequenzy email blocks").option("--blocks-file <file>","Path to a JSON file with Sequenzy email blocks").option("--prompt <prompt>","Generate campaign blocks from a prompt").option("--style <style>","Prompt generation style. Pass designed or plain to force the designed or plain-text email style; other values are freeform guidance (defaults to the company's email style preference)").option("--tone <tone>","Prompt generation tone: professional, casual, friendly").option("--email-preset <preset>","Style > Format for native blocks: branded or minimal").option("--from-email <email>","Campaign From address").option("--from-name <name>","Display name for --from-email; picks or creates the identity of that name on the address").option("--sender-profile-id <id>","Existing sender profile ID; carries its own name, so omit --from-email and --from-name").option("--reply-to <email>","Campaign Reply-To address").option("--reply-to-name <name>","Display name for --reply-to; a saved profile keeps its own name and the response warns").option("--reply-profile <id>","Existing Reply-To profile ID").option("--label <labels...>","Label names to assign").option("--segment <id>","Target a saved segment").option("--lists <ids...>","Target one or more lists by ID (shorthand for targetLists type 'lists')").option("--target-lists-json <json>","Inline campaign targetLists JSON object").option("--target-lists-file <file>","Path to a JSON file with campaign targetLists").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ur("create",{name:e,...t}));S($Ee,{notes:["--subject is required unless --prompt is provided. With --prompt, the generated subject is used unless --subject is also provided.","Use --preview-text or --preheader-text to set the inbox preview text. With --prompt, the generated preview is used unless one of these flags is provided.","Use --blocks-json or --blocks-file when you need editor-compatible blocks, including conditional content and per-block styles.","Use --email-preset branded or minimal to set Style > Format on native blocks. This is not --style, which is a prompt-generation hint.","Use --status sent only to archive an already-sent campaign; it does not send email or create per-recipient delivery history.","Do not combine prompt, HTML flags, and blocks flags in the same request.","Use --segment, --lists, or --target-lists-json to save the audience on the draft. Omit them to set targeting later with campaigns update or campaigns schedule. These audience flags are mutually exclusive.",'Target list examples include {"type":"all"}, {"type":"lists","listIds":["list_123"]}, and {"type":"segment","segmentId":"seg_123"}.'],examples:['sequenzy campaigns create "April Launch" --prompt "Announce our new analytics dashboard"','sequenzy campaigns create "April Launch" --subject "We shipped" --preheader-text "Your quick product update" --html-file ./campaign.html','sequenzy campaigns create "Imported launch" --subject "We shipped" --status sent --sent-at "2026-05-01T14:00:00Z" --html-file ./campaign.html','sequenzy campaigns create "API Launch" --subject "We shipped" --label edm api --html-file ./campaign.html','sequenzy campaigns create "Segmented Launch" --subject "We shipped" --blocks-file ./campaign-blocks.json','sequenzy campaigns create "Research note" --subject "Quick question" --blocks-file ./note.json --email-preset minimal',`sequenzy campaigns create "Partner Update" --subject "This month at HolaRuta" --target-lists-json '{"type":"lists","listIds":["list_123"]}'`]});var NEe=Xn.command("update <id>").description("Update a draft campaign").option("-n, --name <name>","Campaign name").option("-s, --subject <subject>","Email subject").option("--preview-text <text>","Inbox preview text").option("--preheader-text <text>","Alias for --preview-text").option("--tracking-code <code>","Optional campaign tracking code").option("--html <html>","Email HTML content").option("--html-file <file>","Read HTML from file").option("--blocks-json <json>","Inline JSON array of Sequenzy email blocks").option("--blocks-file <file>","Path to a JSON file with Sequenzy email blocks").option("--email-preset <preset>","Style > Format for native blocks: branded or minimal").option("--campaign-data-json <json>","Inline campaignData JSON object").option("--campaign-data-file <file>","Path to a JSON file with campaignData").option("--computed-lists-json <json>","Inline computedLists JSON array").option("--computed-lists-file <file>","Path to a JSON file with computedLists").option("--from-email <email>","Campaign From address").option("--from-name <name>","Display name for --from-email; picks or creates the identity of that name on the address").option("--sender-profile-id <id>","Existing sender profile ID; carries its own name, so omit --from-email and --from-name").option("--reply-to <email>","Set reply-to using an existing reply profile email").option("--reply-to-name <name>","Display name for --reply-to; a saved profile keeps its own name and the response warns").option("--reply-profile <id>","Set reply-to using a reply profile ID").option("--label <labels...>","Replace label names").option("--segment <id>","Retarget the draft at a saved segment").option("--lists <ids...>","Retarget the draft at one or more lists by ID (shorthand for targetLists type 'lists')").option("--target-lists-json <json>","Inline campaign targetLists JSON object").option("--target-lists-file <file>","Path to a JSON file with campaign targetLists").option("--clear-target-lists","Clear saved targeting so the audience is chosen when scheduling").option("--send-time-optimization","Enable per-recipient send-time optimization and clear other saved pacing modes").option("--disable-send-time-optimization","Disable send-time optimization on the draft").option("--send-time-window-hours <hours>","Set the send-time optimization window from 1-24 hours").option("--max-recipients <count>","Send to at most this many audience members (the first N by subscriber id) when the campaign is sent").option("--clear-max-recipients","Remove the recipient limit so the campaign goes to the whole audience").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ur("update",{id:e,...t}));S(NEe,{notes:["Provide at least one update flag, including subject, preview text, content, email preset, labels, reply-to, campaign data, computed lists, audience, or STO pacing.","Use --blocks-json or --blocks-file when you need editor-compatible blocks, including conditional content and per-block styles.","Use --email-preset branded or minimal to change Style > Format on native blocks without rewriting copy.","Use --campaign-data-file and --computed-lists-file to upload personalization data for repeat blocks.","Do not combine HTML flags with blocks flags in the same request.","Use either --reply-to or --reply-profile, not both.","Use --segment, --lists, or --target-lists-json to replace the saved audience, or --clear-target-lists to choose it later at schedule time. These audience flags are mutually exclusive.","Use --send-time-optimization with optional --send-time-window-hours (1-24, default 12), or --disable-send-time-optimization to turn STO off. Enabling STO clears a saved spread or recipient-timezone mode.","Use --max-recipients to send to only the first N matching subscribers (for example while ramping up a new domain), or --clear-max-recipients to remove the cap. The cap is applied when the audience is resolved at send time."],examples:['sequenzy campaigns update camp_123 --subject "Updated subject"','sequenzy campaigns update camp_123 --preheader-text "Updated preview"',"sequenzy campaigns update camp_123 --html-file ./campaign-v2.html","sequenzy campaigns update camp_123 --blocks-file ./campaign-v2-blocks.json","sequenzy campaigns update camp_123 --email-preset minimal","sequenzy campaigns update camp_123 --campaign-data-file ./campaign-data.json --computed-lists-file ./computed-lists.json","sequenzy campaigns update camp_123 --reply-to support@example.com","sequenzy campaigns update camp_123 --label edm api","sequenzy campaigns update camp_123 --segment seg_123","sequenzy campaigns update camp_123 --clear-target-lists","sequenzy campaigns update camp_123 --send-time-optimization --send-time-window-hours 8","sequenzy campaigns update camp_123 --max-recipients 100"]});var OEe=Xn.command("schedule <id>").description("Schedule a draft or scheduled campaign").requiredOption("--at <datetime>","Future ISO date/time to send, for example 2026-06-01T14:00:00Z").option("--segment <id>","Target a saved segment").option("--lists <ids...>","Target one or more lists by ID (shorthand for targetLists type 'lists')").option("--target-lists-json <json>","Inline campaign targetLists JSON object").option("--target-lists-file <file>","Path to a JSON file with campaign targetLists").option("--send-time-optimization","Enable send-time optimization for the scheduled send").option("--disable-send-time-optimization","Disable send-time optimization for the scheduled send").option("--send-time-window-hours <hours>","Set the send-time optimization window from 1-24 hours").option("--spread-over-hours <hours>","Spread delivery over 1-72 hours. Disables send-time optimization when set.").option("--max-recipients <count>","Send to at most this many audience members (the first N by subscriber id). Omit to keep the draft's saved cap.").option("--clear-max-recipients","Remove a saved recipient limit for this send").option("--repeat <interval>","Repeat the campaign weekly or monthly starting at --at. Audience membership is re-evaluated at every run.").option("--in-recipient-timezone","Deliver at --at's wall-clock time in each recipient's own timezone. Requires --scheduled-timezone.").option("--no-in-recipient-timezone","Disable recipient-timezone delivery and use the selected fixed-time pacing strategy.").option("--scheduled-timezone <zone>","IANA zone the --at wall-clock time refers to, for example America/New_York").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ur("schedule",{id:e,...t}));S(OEe,{notes:["The campaign must be draft or already scheduled.","Omit --segment, --lists, and target lists to reuse saved campaign targeting, or default to all active subscribers.","--segment, --lists, and the target list flags are mutually exclusive.",'Target list examples include {"type":"all"}, {"type":"lists","listIds":["list_123"]}, and {"type":"segment","segmentId":"seg_123"}.',"With --repeat, the campaign becomes a recurring template: each run is duplicated and sent automatically. Use campaigns unschedule to stop the series and return it to draft, or re-schedule without --repeat to keep a one-shot send.","With --in-recipient-timezone, every contact receives the campaign at --at's wall-clock time in their own timezone; contacts without a stored timezone get it at --at in --scheduled-timezone. Not combinable with --repeat or --spread-over-hours.","Use --send-time-optimization with optional --send-time-window-hours (1-24, default 12), or --disable-send-time-optimization to turn STO off. A spread or recipient-timezone send disables STO.","Use --max-recipients to send to only the first N matching subscribers; recipients already reached by this campaign count against the cap on resume. Duplicate the campaign and exclude contacts who already received it to send the next batch."],examples:['sequenzy campaigns schedule camp_123 --at "2026-06-01T14:00:00Z"','sequenzy campaigns schedule camp_123 --at "2026-06-01T14:00:00Z" --segment seg_123','sequenzy campaigns schedule camp_123 --at "2026-06-01T14:00:00Z" --lists list_123',`sequenzy campaigns schedule camp_123 --at "2026-06-01T14:00:00Z" --target-lists-json '{"type":"all"}'`,'sequenzy campaigns schedule camp_123 --at "2026-06-01T14:00:00Z" --target-lists-file ./target-lists.json','sequenzy campaigns schedule camp_123 --at "2026-06-01T14:00:00Z" --spread-over-hours 6','sequenzy campaigns schedule camp_123 --at "2026-06-01T14:00:00Z" --max-recipients 100','sequenzy campaigns schedule camp_123 --at "2026-06-01T14:00:00Z" --send-time-optimization --send-time-window-hours 8','sequenzy campaigns schedule camp_123 --at "2026-06-01T14:00:00Z" --repeat monthly','sequenzy campaigns schedule camp_123 --at "2026-06-01T20:00:00-04:00" --in-recipient-timezone --scheduled-timezone America/New_York']});var PEe=Xn.command("test <id>").description("Send a test email for a campaign").requiredOption("--to <email>","Recipient email for the test").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ur("test",{id:e,...t}));S(PEe,{examples:["sequenzy campaigns test camp_123 --to you@example.com"]});var FEe=Xn.command("cancel <id>").description("Cancel a scheduled, paused, or sending campaign").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ur("cancel",{id:e,...t}));S(FEe,{notes:["Cancelling stops scheduled, paused, waiting-approval, and actively sending campaigns immediately.","No confirmation prompt is shown so a bad send can be stopped fast."],examples:["sequenzy campaigns cancel camp_123"]});var qEe=Xn.command("unschedule <id>").description("Return a scheduled campaign to draft").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ur("unschedule",{id:e,...t}));S(qEe,{notes:["Only scheduled campaigns can be unscheduled.","Unscheduling removes the pending send and recurrence, then returns the campaign to an editable draft."],examples:["sequenzy campaigns unschedule camp_123"]});var LEe=Xn.command("pause <id>").description("Pause a campaign that is currently sending").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ur("pause",{id:e,...t}));S(LEe,{notes:["Only campaigns in sending status can be paused."],examples:["sequenzy campaigns pause camp_123"]});var UEe=Xn.command("resume <id>").description("Resume a paused campaign").option("--spread-over-hours <hours>","Spread the remaining delivery over 1-72 hours").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ur("resume",{id:e,...t}));S(UEe,{notes:["Only paused campaigns can be resumed."],examples:["sequenzy campaigns resume camp_123","sequenzy campaigns resume camp_123 --spread-over-hours 6"]});var jEe=Xn.command("delete <id>").description("Delete a campaign").option("-y, --yes","Skip the confirmation prompt").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ur("delete",{id:e,...t}));S(jEe,{notes:["Sending, scheduled, and paused campaigns must be cancelled before they can be deleted."],examples:["sequenzy campaigns delete camp_123 --yes"]});var zEe=Xn.command("share <id>").description("Create or fetch the campaign's public view-in-browser link").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ur("share",{id:e,...t}));S(zEe,{notes:["The hosted page is anonymized: sample contact, inert unsubscribe link, no open/click tracking.","Idempotent - rerunning returns the same URL until you run `campaigns unshare`."],examples:["sequenzy campaigns share camp_123"]});var MEe=Xn.command("unshare <id>").description("Revoke the campaign's public view-in-browser link").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ur("unshare",{id:e,...t}));S(MEe,{notes:["The shared URL returns 404 immediately after revocation."],examples:["sequenzy campaigns unshare camp_123"]});var HEe=Xn.command("duplicate <id>").description("Duplicate a campaign as a new draft").option("--mode <mode>","Duplicate mode: campaign, ab_test, or variant","campaign").option("--variant-id <id>","A/B test variant to copy when --mode is variant").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ur("duplicate",{id:e,...t}));S(HEe,{notes:["Mode campaign copies the campaign email, ab_test also copies the A/B test with all variants, and variant copies one variant's content as a plain campaign."],examples:["sequenzy campaigns duplicate camp_123","sequenzy campaigns duplicate camp_123 --mode ab_test","sequenzy campaigns duplicate camp_123 --mode variant --variant-id var_b"]});var GEe=Xn.command("resend-to-non-openers <id>").description("Create a draft resend to subscribers who didn't open a sent campaign").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ur("resend-to-non-openers",{id:e,...t}));S(GEe,{notes:["Only available 6 hours after a sent campaign finishes sending.","Unavailable for imported already-sent campaigns because Sequenzy has no opens for a send it did not deliver.",`Creates a draft targeting the same audience plus a "didn't open this campaign" rule. Review the draft, then schedule or send it.`,"The response includes an estimate of how many subscribers haven't opened the original.","Every audience format keeps hard opener exclusions across manual additions and repeated resends. Live audience membership can include new subscribers.","Recreate older drafts missing excludedCampaignOpenerIds from the original campaign and review before scheduling."],examples:["sequenzy campaigns resend-to-non-openers camp_123"]});function IV(e){return e.option("--description <text>","Goal description").option("--trigger-type <type>","Goal signal: event, attribute_change, or tag_added").option("--trigger-event-name <event>","Event goal signal name").option("--trigger-tag-name <tag>","Tag name for tag_added goals").option("--attribute-path <path>","Subscriber attribute goal path").option("--attribute-condition <condition>","changed, changed_to, or changed_from_to").option("--attribute-value <value>","Target subscriber attribute value").option("--attribute-previous-value <value>","Previous subscriber attribute value").option("--event-property-name <name>","Optional event property whose value is tracked").option("--event-property-label <label>","Display label for the tracked event property").option("--attribution-window-hours <hours>","Goal attribution window in hours")}var Qv=Xn.command("goals").description("Manage persisted campaign conversion goals");Qv.command("list <campaignId>").description("List campaign goals").option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t)=>ur("goals",{id:e,...t}));IV(Qv.command("create <campaignId> <name>").description("Create a campaign conversion goal")).option("--active","Create the goal with conversion tracking on (default)").option("--inactive","Create the goal with conversion tracking off").option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t,n)=>ur("goal-create",{id:e,name:t,isActive:n.active,notActive:n.inactive,...n}));IV(Qv.command("update <campaignId> <goalId>").description("Update a campaign conversion goal").option("--name <name>","Goal name")).option("--active","Enable the goal").option("--inactive","Disable the goal").option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t,n)=>ur("goal-update",{id:e,goalId:t,isActive:n.active,notActive:n.inactive,...n}));Qv.command("delete <campaignId> <goalId>").description("Delete a campaign conversion goal").option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t,n)=>ur("goal-delete",{id:e,goalId:t,...n}));var os=Xn.command("variations").description("Compare alternative versions of a campaign email (the editor's Canvas tab)").action(()=>os.help());S(os,{notes:["Variations never change what the campaign sends until you run `use`.","`generate` returns at once with variations in the generating state; pass --wait to block until each one is ready or failed.","`section-options` saves nothing: apply an option by swapping its replacement blocks into the variation and running `update`.","`edit` changes one variation with the AI and saves it (optionally only --sections).","--style close keeps the source's style, fresh takes different directions, bold designs each version anew with its own layout, colors and fonts."],examples:['sequenzy campaigns variations generate camp_123 --prompt "Three shorter, warmer versions" --wait','sequenzy campaigns variations generate camp_123 --prompt "Completely new style" --count 2 --style bold --parent var_456','sequenzy campaigns variations edit camp_123 var_456 --prompt "Make the hero dark" --sections hero_1',"sequenzy campaigns variations use camp_123 var_456"]});function CV(e){return e.option("--blocks-json <json>","Email blocks as JSON").option("--blocks-file <path>","Read email blocks JSON from a file").option("--html <html>","HTML content, converted to blocks").option("--html-file <path>","Read HTML content from a file").option("--subject <subject>","Subject this variation uses").option("--preview-text <text>","Preview text this variation uses").option("--summary <text>","What this version changes").option("--email-theme-json <json>","The variation's own email theme as JSON (partial themes are completed; null uses the email's)").option("--email-theme-file <path>","Read the variation's email theme JSON from a file").option("--font-family <family>","The variation's own body font (null uses the email's)")}var wV="close (edit, keep the source's style), fresh (default; new structure, brand look) or bold (new structure, colors and fonts)";os.command("list <campaignId>").description("List a campaign's variations").option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t)=>Bs("list",{id:e,...t}));os.command("get <campaignId> <variationId>").description("Show one variation").option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t,n)=>Bs("get",{id:e,variationId:t,...n}));os.command("generate <campaignId>").description("Generate variations with AI").requiredOption("--prompt <text>","Direction for the new versions").option("--count <n>","How many variations, 1-4 (default 3)").option("--parent <variationId>","Branch from this variation").option("--style <style>",`How far to move: ${wV}`).option("--wait","Wait until every variation is ready or failed").option("--timeout <seconds>","How long --wait waits (default 300)").option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t)=>Bs("generate",{id:e,...t}));CV(os.command("create <campaignId>").description("Save content as a new variation").requiredOption("--name <name>","Variation name").option("--parent <variationId>","Save it as a branch of this variation")).option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t)=>Bs("create",{id:e,...t}));CV(os.command("update <campaignId> <variationId>").description("Rename a variation, replace its content or move it").option("--name <name>","New name").option("--position <x,y>","Place it on the canvas at these coordinates").option("--reset-position","Let the canvas place it automatically")).option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t,n)=>Bs("update",{id:e,variationId:t,...n}));os.command("discard <campaignId> <variationId>").description("Discard a variation (restorable)").option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t,n)=>Bs("discard",{id:e,variationId:t,...n}));os.command("restore <campaignId> <variationId>").description("Bring back a discarded variation").option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t,n)=>Bs("restore",{id:e,variationId:t,...n}));os.command("use <campaignId> <variationId>").description("Put a variation's content in the campaign email (draft campaigns; the previous content is kept as a variation)").option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t,n)=>Bs("use",{id:e,variationId:t,...n}));os.command("edit <campaignId> <variationId>").description("Change one variation with AI and save it").requiredOption("--prompt <text>","What should change").option("--sections <ids>","Only change these comma-separated top-level block ids").option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t,n)=>Bs("edit",{id:e,variationId:t,...n}));os.command("section-options <campaignId>").description("Generate options for selected sections (nothing is saved)").requiredOption("--prompt <text>","What should change").requiredOption("--sections <ids>","Comma-separated top-level block ids").option("--variation <variationId>","Vary this variation instead of the email").option("--count <n>","How many options, 1-4 (default 3)").option("--style <style>",`How far to move: ${wV}`).option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t)=>Bs("section-options",{id:e,...t}));var mg=Je.command("forms").description("Inspect and update saved signup forms").action(()=>mg.help());S(mg,{notes:["Run `forms list --json` before replacing blocks so you can preserve the complete current block array.","Saved-form updates are partial: only the options you pass change.","When Webflow is connected, custom form embeds and their submission endpoints are disabled for that workspace; configure selected native forms in Settings -> Integrations -> Webflow."],examples:["sequenzy forms list --json",'sequenzy forms update form_123 --button-text "Join now"',"sequenzy forms update form_123 --theme-file ./theme.json"]});var JEe=mg.command("list").description("List saved forms and their current content").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON, including content blocks").action((e)=>Bf("list",e));S(JEe,{examples:["sequenzy forms list","sequenzy forms list --json"]});Je.command("submissions <type> <id>").description("Read form, popup or landing_page submission payloads").option("-c, --company <id>","Company ID override").option("--field <name>","Exact custom field name (requires --value)").option("--value <value>","Exact answer or array member (requires --field)").option("--limit <count>","Page size, 1 to 100 (default 50)").option("--cursor <cursor>","Resume from nextCursor").option("--json","Print complete JSON payloads and labels").option("--csv","Export all matching pages to stdout").action((e,t,n)=>Bf("submissions",{type:e,id:t,...n}));mg.command("submissions <id>").description("Read saved submitted answers and payloads; --csv exports all matching pages").option("-c, --company <id>","Company ID override").option("--field <name>","Exact custom field name (requires --value)").option("--value <value>","Exact answer or array member (requires --field)").option("--limit <count>","Page size, 1 to 100 (default 50)").option("--cursor <cursor>","Resume from nextCursor").option("--json","Print the complete page including labels and payloads").option("--csv","Export matching pages as CSV to stdout").action((e,t)=>Bf("submissions",{id:e,...t}));var VEe=mg.command("update <id>").description("Update a saved form").option("-n, --name <name>","Saved form name").option("-l, --list <ids...>","Replacement list IDs").option("-t, --tag <ids...>","Replacement tag IDs").option("--clear-tags","Remove every saved form tag").option("--duplicate-strategy <strategy>","Existing subscriber handling: skip, merge, or overwrite").option("--resubscribe-behavior <behavior>","Unsubscribed contacts who submit again: reactivate (default) or double_opt_in").option("--bot-protection","Run a Cloudflare bot check before each signup; failed checks confirm by email").option("--no-bot-protection","Turn the bot check off").option("--headline <text>","First main-form heading text").option("--description <text>","First main-form paragraph text").option("--button-text <text>","Submit button label").option("--success-message <text>","Success screen message").option("--redirect-url <url>","HTTP/HTTPS success redirect; pass an empty string to clear").option("--theme-json <json>","Inline partial capture theme JSON").option("--theme-file <file>","Path to partial capture theme JSON").option("--blocks-json <json>","Inline complete content blocks JSON").option("--blocks-file <file>","Path to complete content blocks JSON").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Bf("update",{id:e,...t}));S(VEe,{notes:["Use `forms list --json` and send the complete blocks array when replacing blocks.","The form must retain exactly one email field and one submit button.",'Group sibling blocks with { id, kind: "group", label, layout: "stack" | "row" | "grid" | "overlay", columns, gap, padding, overlayColor, overlayPosition, overlayShade, children }. In Overlay, gap spaces the foreground children while the direct image remains the background. Overlay needs exactly one direct image; nested images only enable their subgroup. Groups may nest three levels; IDs stay unique across the full tree.','Input blocks are { id, kind: "form-field", fieldType, name, label, required, mapsTo, options }. fieldType: text, email, phone, number, textarea, select, radio, checkbox, consent, hidden. mapsTo: email, firstName, lastName, phone, customAttribute (default; stores the answer under `name`). Choice fields need options: [{ value, label, id }] - label and id default to value.',"A hidden field with a defaultValue stores that server-owned value and ignores submitted values; a hidden field without one stores the value the page submits.",'Each block kind accepts only its own properties, and anything else is rejected by name: a custom-html block carries markup in "html" with a pixel "height", not "content".',"Use --clear-tags to replace the current tag targeting with an empty list."],examples:['sequenzy forms update form_123 --headline "Weekly planning" --button-text "Get the planner"',"sequenzy forms update form_123 --list list_123 list_456 --clear-tags","sequenzy forms update form_123 --theme-file ./form-theme.json --blocks-file ./form-blocks.json --json"]});var lc=Je.command("popups").description("Manage on-site signup popups").action(()=>lc.help());S(lc,{notes:["Popups are the on-site overlay capture surface; `forms` covers inline embedded forms.","A popup is deployed with one script tag - `popups embed <id>` prints it.","When Webflow is connected, `popups embed` returns the native Webflow configuration path instead of custom code, and existing popup scripts stop submitting for that workspace.","Popup updates are partial: only the options you pass change.","Trigger, targeting, schedule, frequency, visual, and reward patches are merged key by key, so setting one key keeps the rest.","A reward turns the popup into a scratch card: the visitor scratches a teaser, claims it with their email, and sees the reward value and code after submitting. The same value is saved to the subscriber's `discount` attribute for {{discount.code}} in emails."],examples:["sequenzy popups list --json",'sequenzy popups create --name "Welcome offer" --template discount-offer --list list_123',"sequenzy popups update pop_123 --status draft","sequenzy popups duplicate pop_123","sequenzy popups embed pop_123"]});var KEe=lc.command("list").description("List saved popups with their status and conversion stats").option("-c, --company <id>","Company ID override for personal API keys").option("--include-content","Include every popup's full content blocks (large)").option("--json","Print raw JSON").action((e)=>ul("list",e));S(KEe,{notes:["Content blocks are omitted by default because each popup adds roughly 1.8k characters. Use `popups get <id> --json` for one popup's full content."],examples:["sequenzy popups list","sequenzy popups list --json","sequenzy popups list --include-content --json"]});var WEe=lc.command("get <id>").description("Show one popup with its complete content").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON, including content blocks").action((e,t)=>ul("get",{id:e,...t}));S(WEe,{notes:["Run this with --json before replacing blocks so you can preserve the complete current block array."],examples:["sequenzy popups get pop_123 --json"]});var YEe=lc.command("create").description("Create a popup and print its embed script").requiredOption("-n, --name <name>","Internal popup name").option("--template <id>","Starting design: newsletter-modal, discount-offer, scratch-to-reveal, countdown-launch, minimal-slide-in, exit-lead-magnet, live-demo, launch-modal, paper-digest, stark-takeover, top-bar, announcement-bar, or fullscreen-welcome").option("--status <status>","draft or published (default: published)").option("-l, --list <ids...>","List IDs every signup is added to").option("--all-lists","Capture into every list (the default)").option("-t, --tag <ids...>","Tag IDs applied to every signup").option("--duplicate-strategy <strategy>","Existing subscriber handling: skip, merge, or overwrite").option("--resubscribe-behavior <behavior>","Unsubscribed contacts who submit again: reactivate (default) or double_opt_in").option("--bot-protection","Run a Cloudflare bot check before each signup; failed checks confirm by email").option("--no-bot-protection","Turn the bot check off").option("--headline <text>","First heading text").option("--description <text>","First paragraph text").option("--button-text <text>","Submit button label").option("--success-message <text>","Success screen message").option("--redirect-url <url>","HTTP/HTTPS success redirect").option("--presentation <mode>","modal, slide-in, floating-bar, or fullscreen").option("--placement <spot>","center, left, right, top, or bottom").option("--trigger-json <json>","Inline partial trigger JSON").option("--trigger-file <file>","Path to partial trigger JSON").option("--targeting-json <json>","Inline partial targeting JSON").option("--targeting-file <file>","Path to partial targeting JSON").option("--schedule-json <json>","Inline partial schedule JSON").option("--schedule-file <file>","Path to partial schedule JSON").option("--frequency-json <json>","Inline partial frequency JSON").option("--frequency-file <file>","Path to partial frequency JSON").option("--visual-json <json>","Inline partial visual JSON").option("--visual-file <file>","Path to partial visual JSON").option("--reward-json <json>","Inline partial scratch-to-reveal reward JSON").option("--reward-file <file>","Path to partial scratch-to-reveal reward JSON").option("--theme-json <json>","Inline partial capture theme JSON").option("--theme-file <file>","Path to partial capture theme JSON").option("--blocks-json <json>","Inline complete content blocks JSON").option("--blocks-file <file>","Path to complete content blocks JSON").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>ul("create",e));S(YEe,{notes:["Popups are published by default, so the embed script is live as soon as you paste it. Use --status draft to stage one.","Omit --list (or pass --all-lists) to capture into every list, matching the dashboard default.",`Trigger example: --trigger-json '{"type":"exit-intent"}' or '{"type":"delay","delaySeconds":10}'.`,`Reward example: --reward-json '{"enabled":true,"value":"10% off your first order","code":"WELCOME10","coverStyle":"gold"}'. The value and code are not in the embed script; the submit response returns them.`],examples:['sequenzy popups create --name "Welcome offer" --template discount-offer --list list_123',`sequenzy popups create --name "Scratch card" --template scratch-to-reveal --reward-json '{"value":"10% off your first order","code":"WELCOME10"}'`,`sequenzy popups create --name "Exit capture" --trigger-json '{"type":"exit-intent"}' --status draft`]});var ZEe=lc.command("update <id>").description("Update a popup, including publishing and unpublishing it").option("-n, --name <name>","Internal popup name").option("--status <status>","draft or published").option("-l, --list <ids...>","Replacement list IDs").option("--all-lists","Capture into every list").option("-t, --tag <ids...>","Replacement tag IDs").option("--clear-tags","Remove every popup tag").option("--duplicate-strategy <strategy>","Existing subscriber handling: skip, merge, or overwrite").option("--resubscribe-behavior <behavior>","Unsubscribed contacts who submit again: reactivate (default) or double_opt_in").option("--bot-protection","Run a Cloudflare bot check before each signup; failed checks confirm by email").option("--no-bot-protection","Turn the bot check off").option("--headline <text>","First heading text").option("--description <text>","First paragraph text").option("--button-text <text>","Submit button label").option("--success-message <text>","Success screen message").option("--redirect-url <url>","HTTP/HTTPS success redirect; pass an empty string to clear").option("--presentation <mode>","modal, slide-in, floating-bar, or fullscreen").option("--placement <spot>","center, left, right, top, or bottom").option("--trigger-json <json>","Inline partial trigger JSON").option("--trigger-file <file>","Path to partial trigger JSON").option("--targeting-json <json>","Inline partial targeting JSON").option("--targeting-file <file>","Path to partial targeting JSON").option("--schedule-json <json>","Inline partial schedule JSON").option("--schedule-file <file>","Path to partial schedule JSON").option("--frequency-json <json>","Inline partial frequency JSON").option("--frequency-file <file>","Path to partial frequency JSON").option("--visual-json <json>","Inline partial visual JSON").option("--visual-file <file>","Path to partial visual JSON").option("--reward-json <json>","Inline partial scratch-to-reveal reward JSON").option("--reward-file <file>","Path to partial scratch-to-reveal reward JSON").option("--theme-json <json>","Inline partial capture theme JSON").option("--theme-file <file>","Path to partial capture theme JSON").option("--blocks-json <json>","Inline complete content blocks JSON").option("--blocks-file <file>","Path to complete content blocks JSON").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ul("update",{id:e,...t}));S(ZEe,{notes:["Use `popups get <id> --json` and send the complete blocks array when replacing blocks.","The popup must retain exactly one email field and one submit button.",'Group sibling blocks with { id, kind: "group", label, layout: "stack" | "row" | "grid" | "overlay", columns, gap, padding, overlayColor, overlayPosition, overlayShade, children }. In Overlay, gap spaces the foreground children while the direct image remains the background. Overlay needs exactly one direct image; nested images only enable their subgroup. Groups may nest three levels; IDs stay unique across the full tree.','Each block kind accepts only its own properties, and anything else is rejected by name: a custom-html block carries markup in "html" with a pixel "height", not "content".',"`--status draft` stops a popup showing without deleting it or changing the embed script; `--status published` puts it back.","Use --clear-tags to replace the current tag targeting with an empty list, and --all-lists to capture into every list."],examples:['sequenzy popups update pop_123 --headline "Take 10% off" --button-text "Send my code"',"sequenzy popups update pop_123 --status draft",`sequenzy popups update pop_123 --targeting-json '{"paths":["/pricing"],"device":"desktop"}'`]});var XEe=lc.command("duplicate <id>").description("Copy a popup into a new draft with its own stats").option("-n, --name <name>",'Name for the copy (default: "... (copy)")').option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ul("duplicate",{id:e,...t}));S(XEe,{notes:["The copy starts as a draft with its own view and conversion counts, so the original keeps showing and keeps its stats.","Publish the copy with `popups update <new-id> --status published`."],examples:["sequenzy popups duplicate pop_123",'sequenzy popups duplicate pop_123 --name "Welcome offer v2"']});var eIe=lc.command("embed <id>").description("Print a published popup's embed snippets").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON, including React, WordPress, and Shopify").action((e,t)=>ul("embed",{id:e,...t}));S(eIe,{notes:["The popup must be published; publish it with `popups update <id> --status published`.","The snippet carries no API key - trigger, targeting, and audience rules stay server-side."],examples:["sequenzy popups embed pop_123","sequenzy popups embed pop_123 --json"]});var tIe=lc.command("delete <id>").description("Permanently delete a popup and its stats").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ul("delete",{id:e,...t}));S(tIe,{notes:["This also deletes the popup's view and conversion counts. To stop it showing while keeping its stats, use `popups update <id> --status draft`.","Subscribers the popup already captured are not affected."],examples:["sequenzy popups delete pop_123"]});var Wo=Je.command("landing-pages").description("Manage landing pages").action(()=>Wo.help());S(Wo,{notes:["Landing pages are created as drafts. Publish only after reviewing the page.","Use landing-pages render to open a signed, unlisted preview of a draft without publishing.","Use --content-json or --content-file for full editor-compatible landing page content.","Custom subdomains require a CNAME record pointing to pages.sequenzydns.com; root domains require an A record pointing to 76.76.21.21."],examples:["sequenzy landing-pages list --company comp_123",'sequenzy landing-pages create "Product Waitlist" --template waitlist',"sequenzy landing-pages render lp_123","sequenzy landing-pages stats lp_123 --period 30d","sequenzy landing-pages publish lp_123","sequenzy landing-pages connect-domain pages.example.com"]});var nIe=Wo.command("list").description("List landing pages").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>di("list",e));S(nIe,{examples:["sequenzy landing-pages list --company comp_123"]});var rIe=Wo.command("get <id>").description("Get landing page details").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>di("get",{id:e,...t}));S(rIe,{examples:["sequenzy landing-pages get lp_123 --company comp_123"]});var oIe=Wo.command("stats <id>").description("Get landing page visit analytics").option("-c, --company <id>","Company ID override for personal API keys").option("--period <period>","Time window: 7d, 30d, 90d, or all").option("--start <timestamp>","Custom range start, ISO 8601").option("--end <timestamp>","Custom range end, ISO 8601").option("--include-bots","Include known crawlers in visit totals").option("--json","Print raw JSON").action((e,t)=>di("stats",{id:e,...t}));S(oIe,{notes:["Reports visits, unique visits, clicks, subscribes, conversion rate, referrers, and crawler hits. Preview URLs and the editor are never counted."],examples:["sequenzy landing-pages stats lp_123 --period 30d"]});var iIe=Wo.command("render <id>").description("Preview a landing page without publishing it").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>di("render",{id:e,...t}));S(iIe,{notes:["Returns a signed, unlisted preview URL that works for drafts. Signup forms do not collect contacts until you publish."],examples:["sequenzy landing-pages render lp_123"]});var sIe=Wo.command("create [name]").description("Create a draft landing page").option("--slug <slug>","Landing page URL slug").option("--template <template>","Template key, e.g. waitlist").option("--content-json <json>","Inline landing page content JSON").option("--content-file <file>","Path to landing page content JSON").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>di("create",{name:e,...t}));S(sIe,{notes:["When --content-json/--content-file is omitted, a valid default page is generated from --template."],examples:['sequenzy landing-pages create "Product Waitlist" --template waitlist','sequenzy landing-pages create "Launch Page" --slug launch --content-file ./landing-page.json']});var aIe=Wo.command("update <id>").description("Edit a landing page").option("-n, --name <name>","Landing page name").option("--slug <slug>","Landing page URL slug").option("--content-json <json>","Inline landing page content JSON").option("--content-file <file>","Path to landing page content JSON").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>di("update",{id:e,...t}));S(aIe,{examples:['sequenzy landing-pages update lp_123 --name "Updated page"',"sequenzy landing-pages update lp_123 --content-file ./landing-page.json"]});var cIe=Wo.command("publish <id>").description("Publish a landing page").option("-n, --name <name>","Landing page name").option("--slug <slug>","Landing page URL slug").option("--content-json <json>","Inline landing page content JSON").option("--content-file <file>","Path to landing page content JSON").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>di("publish",{id:e,...t}));S(cIe,{examples:["sequenzy landing-pages publish lp_123"]});var lIe=Wo.command("unpublish <id>").description("Unpublish a landing page").option("-n, --name <name>","Landing page name").option("--slug <slug>","Landing page URL slug").option("--content-json <json>","Inline landing page content JSON").option("--content-file <file>","Path to landing page content JSON").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>di("unpublish",{id:e,...t}));S(lIe,{examples:["sequenzy landing-pages unpublish lp_123"]});var uIe=Wo.command("duplicate <id>").description("Duplicate a landing page as a new draft").option("-n, --name <name>","Name for the copy").option("--slug <slug>","URL slug for the copy").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>di("duplicate",{id:e,...t}));S(uIe,{notes:["The copy is always created as a draft with its own slug, views, and conversions.",'Without --name, the copy is named "<original name> (copy)".'],examples:["sequenzy landing-pages duplicate lp_123",'sequenzy landing-pages duplicate lp_123 --name "Spring Sale v2" --slug spring-sale-v2']});var dIe=Wo.command("delete <id>").description("Delete a landing page").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>di("delete",{id:e,...t}));S(dIe,{examples:["sequenzy landing-pages delete lp_123"]});var pIe=Wo.command("connect-domain <domain>").description("Connect a workspace or dedicated landing page domain").option("--landing-page <id>","Connect the domain only to this landing page").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>di("connect-domain",{domain:e,...t}));S(pIe,{examples:["sequenzy landing-pages connect-domain pages.example.com --company comp_123","sequenzy landing-pages connect-domain offer.example.com --landing-page lp_123","sequenzy landing-pages connect-domain example.com --landing-page lp_123"]});var mIe=Wo.command("update-domain-settings").description("Update or verify landing page domain settings").option("--domain <domain>","Replace the connected landing page domain").option("--verify","Refresh domain verification state").option("--landing-page <id>","Target a dedicated landing page domain").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>di("update-domain-settings",e));S(mIe,{examples:["sequenzy landing-pages update-domain-settings --domain pages.example.com","sequenzy landing-pages update-domain-settings --verify","sequenzy landing-pages update-domain-settings --landing-page lp_123 --verify"]});var fIe=Wo.command("remove-domain <landing-page-id>").description("Remove a dedicated domain from one landing page").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>di("remove-domain",{landingPage:e,...t}));S(fIe,{examples:["sequenzy landing-pages remove-domain lp_123"]});var Gt=Je.command("sequences").description("Manage email sequences").action(()=>Gt.help());S(Gt,{notes:["The CLI supports both AI goal-based sequence creation and explicit-step creation.","Trigger-specific options depend on --trigger. For example: contact_added needs --list-id (or --list-ids for several lists), tag_added needs --tag-name (or --tag-names), inactivity needs --event-name and --inactive-days.","Use --goal for AI generation, or --steps-file / --emails-file with JSON arrays that match the API step objects.","Use --enrollment-mode matching_field for product- or variant-specific event sequences.",'Explicit --steps-file input can include dynamic Stripe or Shopify discount actions with {"type":"create_discount","discount":{"provider":"stripe","discountType":"percent","percentOff":20,"duration":"once","appliesToAllPlans":true}}; the code is created when each subscriber reaches the step, and later emails can use {{discount.code}}.',"Discount action sequences require the selected provider integration, such as Stripe or Shopify, before enabling.",ug],examples:["sequenzy sequences list --company comp_123",'sequenzy sequences create onboarding --trigger event_received --event-name signup.completed --goal "Guide new users to activation"',"sequenzy sequences create onboarding --trigger contact_added --list-id list_123 --steps-file ./steps.json","sequenzy sequences update seq_123 --steps-file ./sequence-updates.json","sequenzy sequences enable seq_123","sequenzy sequences simulate seq_123","sequenzy sequences simulate seq_123 --email maya@example.com"]});var gIe=Gt.command("list").description("List sequences").option("--status <status>","Filter by draft, active, paused, or archived").option("--search <text>","Search sequence names and descriptions").option("--label <labels...>","Filter by dashboard label names").option("--limit <count>","Page size from 1 to 100").option("--offset <count>","Zero-based result offset").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>Cn("list",e));S(gIe,{examples:["sequenzy sequences list --company comp_123"]});var AIe=Gt.command("get <id>").description("Get sequence details").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Cn("get",{id:e,...t}));S(AIe,{examples:["sequenzy sequences get seq_123 --company comp_123"]});var hIe=Gt.command("edit-emails <id>").description("Change the sequence's emails with AI in one request: every email, the ones the prompt names, or the ones you list").requiredOption("--prompt <text>","What should change").option("--emails <ids>","Only these comma-separated email IDs (from sequences get)").option("--sections <ids>","Only these comma-separated top-level block IDs; needs exactly one --emails ID").option("--dry-run","Return the changes without saving them").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>M3({id:e,...t}));S(hIe,{notes:['Without --emails, the prompt decides: it changes every email unless it names some ("change the structure of email 2").',"A look change (background, colors, fonts) is made identical across the emails it touches.","A/B test steps, HTML emails and steps without an email are skipped and listed.","Each email succeeds or fails on its own; changed emails are saved unless --dry-run is set. One request edits up to 12 emails; edit longer sequences in batches with --emails. If the command times out, run sequences get before retrying: changes may already be saved."],examples:['sequenzy sequences edit-emails seq_123 --prompt "Make the background cream"','sequenzy sequences edit-emails seq_123 --prompt "Remove the header" --dry-run --json','sequenzy sequences edit-emails seq_123 --prompt "New structure" --emails email_2','sequenzy sequences edit-emails seq_123 --prompt "Stronger headline" --emails email_2 --sections hero_1']});var Qp=Gt.command("variations").description("Design variations of one email of a sequence, then use one for it or every email (the editor's Emails view)").action(()=>Qp.help());S(Qp,{notes:["Variations never change the email until you run `use`.","`generate` returns at once with variations in the generating state; pass --wait to block until each one is ready or failed.","`use` saves the variation's design (blocks, theme, font) into the email, which keeps its subject and preview text. With --all, every other email takes its style too, keeping its own words.","Preview one with: sequenzy sequences render <id> --node <nodeId> --variation <variationId>"],examples:['sequenzy sequences variations generate seq_123 --email email_1 --prompt "A few bolder versions" --wait',"sequenzy sequences variations list seq_123 --email email_1","sequenzy sequences variations use seq_123 var_456 --email email_1 --all --dry-run","sequenzy sequences variations discard seq_123 var_456 --email email_1"]});Qp.command("list <id>").description("List an email's variations").requiredOption("--email <emailId>","The email's ID (from sequences get)").option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t)=>ig("list",{id:e,...t}));Qp.command("generate <id>").description("Design variations of an email with AI").requiredOption("--email <emailId>","The email's ID (from sequences get)").requiredOption("--prompt <text>","What the variations should explore").option("--count <n>","How many variations, 1-4 (default 3)").option("--style <style>","close (keep its style), fresh (default; other structures, brand look) or bold (also its own look)").option("--wait","Wait until every variation is ready or failed").option("--timeout <seconds>","How long --wait waits (default 300)").option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t)=>ig("generate",{id:e,...t}));Qp.command("use <id> <variationId>").description("Save a variation's design into the email, or with --all every email's style").requiredOption("--email <emailId>","The email's ID (from sequences get)").option("--all","Every other email takes the variation's style too").option("--dry-run","Show what would change without saving").option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t,n)=>ig("use",{id:e,variationId:t,...n}));Qp.command("discard <id> <variationId>").description("Discard a variation").requiredOption("--email <emailId>","The email's ID (from sequences get)").option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t,n)=>ig("discard",{id:e,variationId:t,...n}));var yIe=jB(Gt.command("render <id>").description("Render one sequence email step to email-ready HTML").requiredOption("--node <nodeId>","Email step node ID from sequences get").option("--variant <id>","Render a specific A/B test variant").option("--variation <id>","Render a design variation of the email (from variations list)")).action((e,t)=>cb({type:"sequence-step",sequenceId:e,nodeId:t.node},t));S(yIe,{notes:HB,examples:["sequenzy sequences render seq_123 --node node_1 --out preview.html","sequenzy sequences render seq_123 --node node_1 --subscriber sub_123 --json","sequenzy sequences render seq_123 --node node_1 --email you@example.com --tag extended"]});var bIe=zB(Gt.command("check <id>").description("Check one sequence email step: broken links and images, placeholders, content and client issues").requiredOption("--node <nodeId>","Email step node ID from sequences get").option("--variant <id>","Check a specific A/B test variant")).action((e,t)=>lb({type:"sequence-step",sequenceId:e,nodeId:t.node},t));S(bIe,{notes:MB,examples:["sequenzy sequences check seq_123 --node node_1","sequenzy sequences check seq_123 --node node_1 --fail-on warning --json"]});var vIe=Gt.command("test <id>").description("Send a test email for one saved sequence step").requiredOption("--node <nodeId>","Email step node ID from sequences get").requiredOption("--to <emails...>","One or more reviewer email addresses (maximum 10)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Cn("test",{id:e,...t,nodeId:t.node}));S(vIe,{notes:["This sends only the selected saved email step; it does not enable the sequence or enroll subscribers.","Use sequences get first to find the email step nodeId."],examples:["sequenzy sequences test seq_123 --node node_email_2 --to reviewer@example.com","sequenzy sequences test seq_123 --node node_email_2 --to reviewer-one@example.com reviewer-two@example.com"]});Gt.command("test-run <id>").description("Run real sequence actions for one subscriber with optional event properties").requiredOption("--subscriber <id>","Active subscriber ID").option("--event-properties <json>","Trigger event properties as a JSON object, including arrays and nested objects").option("--speed-multiplier <number>","Delay acceleration, 60 to 10000","120").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Cn("test-run",{id:e,...t}));Gt.command("test-run-get <id> <runId>").description("Inspect live sequence test status and step logs").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON including step logs").action((e,t,n)=>Cn("test-run-get",{id:e,runId:t,...n}));var EIe=Gt.command("simulate <id>").description("Preview who a sequence would enroll and, optionally, one contact's path. Does not send mail or enroll anyone.").option("--subscriber <id>","Walk the graph for this stored subscriber").option("--email <address>","Walk the graph for this stored subscriber email").option("--limit <number>","Maximum current matches to sample (1-25)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Cn("simulate",{id:e,...t,simulateEmail:typeof t.email==="string"?t.email:void 0}));S(EIe,{notes:["Without --subscriber/--email this reports who currently matches and whether the sequence is ready. Nobody is auto-enrolled when you activate; list, tag, and segment matches can still be enrolled by hand.","This does not send mail, mint discounts, or write tags. Use sequences test to send one saved email step to a reviewer.","Readiness errors are the same checks that should be fixed before sequences enable."],examples:["sequenzy sequences simulate seq_123","sequenzy sequences simulate seq_123 --email maya@example.com","sequenzy sequences simulate seq_123 --subscriber sub_123 --limit 25 --json"]});function SV(e){return e.option("--description <text>","Goal description").option("--trigger-type <type>","Goal signal: event, attribute_change, or tag_added").option("--trigger-event-name <event>","Event goal signal name").option("--trigger-tag-name <tag>","Tag name for tag_added goals").option("--attribute-path <path>","Subscriber attribute goal path").option("--attribute-condition <condition>","changed, changed_to, or changed_from_to").option("--attribute-value <value>","Target subscriber attribute value").option("--attribute-previous-value <value>","Previous subscriber attribute value").option("--event-property-name <name>","Optional event property whose value is tracked").option("--event-property-label <label>","Display label for the tracked event property").option("--attribution-window-hours <hours>","Goal attribution window in hours")}var Tv=Gt.command("goals").description("Manage persisted sequence conversion goals");Tv.command("list <sequenceId>").description("List sequence goals").option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t)=>Cn("goals",{id:e,...t}));SV(Tv.command("create <sequenceId> <name>").description("Create a sequence conversion goal")).option("--active","Create the goal with conversion tracking on (default)").option("--inactive","Create the goal with conversion tracking off").option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t,n)=>Cn("goal-create",{id:e,name:t,isActive:n.active,notActive:n.inactive,...n}));SV(Tv.command("update <sequenceId> <goalId>").description("Update a sequence conversion goal").option("--name <name>","Goal name")).option("--active","Enable the goal").option("--inactive","Disable the goal").option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t,n)=>Cn("goal-update",{id:e,goalId:t,isActive:n.active,notActive:n.inactive,...n}));Tv.command("delete <sequenceId> <goalId>").description("Delete a sequence conversion goal").option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t,n)=>Cn("goal-delete",{id:e,goalId:t,...n}));var GB=Gt.command("webhook").description("Manage a sequence inbound webhook endpoint");GB.command("get <sequenceId>").description("Read a sequence inbound webhook URL and setup status").option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t)=>Cn("webhook-get",{id:e,...t}));GB.command("configure <sequenceId>").description("Create or update a sequence inbound webhook endpoint").option("--field-mapping-json <json>","Inline mapping with email, optional names, and property paths").option("--field-mapping-file <file>","JSON file containing the webhook field mapping").option("--sample-payload-json <json>","Inline representative webhook payload").option("--sample-payload-file <file>","JSON file containing a representative webhook payload").option("--clear-field-mapping","Clear the saved mapping and return the endpoint to pending setup").option("--clear-sample-payload","Clear the saved sample payload").option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t)=>Cn("webhook-configure",{id:e,...t}));GB.command("rotate <sequenceId>").description("Rotate a sequence inbound webhook secret and URL").option("-c, --company <id>","Company ID override").option("--json","Print raw JSON").action((e,t)=>Cn("webhook-rotate",{id:e,...t}));var IIe=Gt.command("create <name>").description("Create a blank, AI-generated, or explicit-step sequence").option("-t, --trigger <trigger>","Sequence trigger type (defaults to contact_added; manual never auto-enrolls)").option("--description <text>","Sequence description").option("--label <labels...>","Dashboard label names to assign").option("--user-cancellable","Allow subscribers to cancel enrollment").option("--not-user-cancellable","Prevent subscribers from cancelling enrollment").option("--from-email <email>","Sequence-level From address").option("--from-name <name>","Display name for --from-email; picks or creates the identity of that name on the address").option("--sender-profile-id <id>",A4).option("--reply-to <email>","Sequence-level Reply-To address").option("--reply-to-name <name>","Display name for --reply-to; a saved profile keeps its own name and the response warns").option("--reply-profile-id <id>","Existing reply profile ID; carries its own name, so omit --reply-to and --reply-to-name").option("--bcc-emails <emails>","Comma-separated sequence-level BCC addresses (max 10)").option("-g, --goal <goal>","AI generation goal for the sequence").option("--email-count <count>","Number of AI-generated emails when using --goal (1-10)").option("--duration-days <days>","Total duration in days for AI-generated sequence delays when using --goal").option("--email-style <style>","Style for AI-generated emails when using --goal: visual (designed) or plain (text-first)").option("--enrollment-mode <mode>","Enrollment mode: unlimited, one_time, or matching_field").option("--enrollment-field-path <path>","Event property dot path used by matching_field enrollment").option("--sending-window-start <time>","Earliest local send time for sequence emails (HH:mm, e.g. 08:00)").option("--sending-window-end <time>","Latest local send cutoff for sequence emails (HH:mm, e.g. 20:00)").option("--sending-window-timezone <timezone>","IANA timezone for the sequence sending window, e.g. Europe/Kiev").option("--sending-window-days <days>","Comma-separated days for sequence sends, e.g. weekdays or mon,tue,wed,thu,fri").option("--respect-frequency-cap","Skip email steps for contacts already at the company frequency cap").option("--key-date <entries...>",'Key date as "Label=2026-11-27T00:00:00" (repeatable; zone-less times are read in --key-dates-timezone); optionally "key:Label=..." to pin the key. Requires --key-dates-timezone').option("--key-dates-timezone <timezone>","IANA timezone the key dates are written in, e.g. America/New_York").option("--key-dates-json <json>",'Inline key dates: {"timezone":"America/New_York","dates":[{"label":"Black Friday starts","at":"2026-11-27T00:00:00-05:00"}]}').option("--key-dates-file <file>","JSON file with the key dates object").option("--list-id <id>","List ID for contact_added triggers").option("--list-ids <ids...>","Several list IDs for contact_added; joining any one of them enrols the contact").option("--list-scope <scope>","contact_added with no list: any_contact (default, includes contacts in no list) or any_list").option("--tag-name <name>","Tag name for tag_added triggers").option("--tag-names <names...>","Several tag names for tag_added; receiving any one of them enrols the contact").option("--segment-id <id>","Segment ID for segment_entered and segment_exited triggers").option("--stop-on-segment-exit","Cancel active enrollments when a contact leaves the trigger segment").option("--event-name <name>","Event name for event_received, inbound_webhook, inactivity, and frequency triggers").option("--integration-slug <slug>","Inbound webhook integration slug").option("--integration-event-key <key>","Inbound webhook integration event key").option("--custom-integration-json <json>","Inline custom inbound webhook integration descriptor").option("--custom-integration-file <file>","JSON file with a custom inbound webhook integration descriptor").option("--property-filters-json <json>","Inline JSON array of event property filters for event_received triggers").option("--property-filters-file <file>","Path to a JSON file with event property filters").option("--inactive-days <days>","Days of inactivity for inactivity triggers").option("--inactivity-baseline <baseline>","Inactivity baseline: sequence_created_at or subscriber_created_at").option("--min-count <count>","Minimum event count for frequency triggers").option("--time-window-days <days>","Time window for frequency triggers").option("--steps-json <json>","Inline JSON array of sequence steps").option("--steps-file <file>","Path to a JSON file with sequence steps").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Cn("create",{name:e,...t}));S(IIe,{notes:["Provide --goal for AI generation, --steps-json/--steps-file for explicit content, or omit both for a blank dashboard-compatible draft.","Each explicit email step needs subject plus either html or blocks. Discount action steps use type=create_discount to dynamically create a code before an email that references {{discount.code}}.",'SMS steps use type="sms" with a plain-text "text" field (optional label, ineligibleAction skip|exit, imageUrls). Generate copy with `sequenzy generate sms` and check `sequenzy sms settings` first.','Update Subscriber steps use type="update_subscriber", nodeType="action_update_attributes", and config values such as {{event.plan}}, {{event.amount}}, or {{event.active}}.',"For migrated provider flows, put the exact provider HTML in each step's html field; Sequenzy stores it as raw HTML. Use delay or delayMs for waits.",'A step may use waitUntilWeekday to hold until the next weekday window, e.g. {"waitUntilWeekday":{"day":"sunday","startTime":"09:00","endTime":"12:00","timezone":"America/Los_Angeles"},"subject":"Weekly digest","html":"..."}. Contacts already inside the window continue immediately; put it before the first email to guarantee the send day at the graph level. Add "timezoneSource":"subscriber" to use the timezone of each contact; timezone is then the fallback for contacts without one. Add "minimumWait":{"days":6} to wait at least 6 days first, then release at the next window, in one step.',"Prefer --steps-file for anything non-trivial. The CLI passes the JSON through to the API.","Shopify replenishment and back-in-stock event sequences default to matching_field.","Use --enrollment-field-path for custom event keys such as order.id or product.providerVariantId.",'Calendar countdowns: use --trigger manual with --key-date entries (plus --key-dates-timezone) and give steps a waitUntilKeyDate, e.g. {"subject":"7 days to go","waitUntilKeyDate":{"key":"black_friday_starts","days":7}}. Keys are slugs of the labels. Then enable the sequence and run sequenzy sequences enroll-audience.',"Use --property-filters-json/--property-filters-file with event_received triggers to only start the sequence when the event properties match, e.g. scope a purchase sequence to one product.","Use --sending-window-start/--sending-window-end/--sending-window-timezone to hold every email step until the allowed local send window. Add --sending-window-days weekdays for working days only.","Use --trigger segment_exited --segment-id <id> to enroll active contacts who stop matching a saved segment, for example a win-back flow. Unsubscribing or bouncing does not count as leaving, and nobody is enrolled when the sequence is turned on.","Discount action sequences require the selected provider integration, such as Stripe or Shopify, before enabling."],examples:['sequenzy sequences create onboarding --trigger event_received --event-name signup.completed --goal "Guide new users to activation" --email-count 4 --duration-days 10','sequenzy sequences create trial --trigger tag_added --tag-name trial --goal "Convert trial users" --sending-window-start 08:00 --sending-window-end 20:00 --sending-window-timezone Europe/Kiev --sending-window-days weekdays',"sequenzy sequences create restock --trigger event_received --event-name ecommerce.back_in_stock --enrollment-mode matching_field --steps-file ./steps.json",`sequenzy sequences create deliver-ebook --trigger event_received --event-name ecommerce.order_placed --property-filters-json '[{"path":"lineItems[].providerProductId","operator":"equals","value":"prod_123"}]' --steps-file ./steps.json`,"sequenzy sequences create post-purchase --trigger event_received --event-name ecommerce.order_placed --enrollment-mode matching_field --enrollment-field-path order.id --steps-file ./steps.json",'sequenzy sequences create "Black Friday countdown" --trigger manual --enrollment-mode one_time --key-dates-timezone America/New_York --key-date "Black Friday starts=2026-11-27T00:00:00" --key-date "Black Friday ends=2026-11-29T23:59:00" --steps-file ./countdown-steps.json',"sequenzy sequences create onboarding --trigger contact_added --list-id list_123 --steps-file ./steps.json",`sequenzy sequences create purchase-profile --trigger event_received --event-name saas.purchase --steps-json '[{"type":"update_subscriber","nodeType":"action_update_attributes","config":{"customAttributeUpdates":[{"name":"plan","value":"{{event.plan}}","valueType":"text"}]}},{"subject":"Thanks","html":"<p>Purchase received.</p>"}]'`,"sequenzy sequences create rescue --trigger inactivity --event-name login --inactive-days 14 --steps-file ./steps.json"]});var CIe=Gt.command("from-example <example>").description("Clone an email gallery sequence into a draft sequence written for your brand").option("--brief <text>","Extra direction for every email (takes priority over the example)").option("--name <name>","Sequence name (defaults to the sequence type)").option("--steps <numbers>","Which of the example's emails to clone, by position, e.g. 1,2,4 (default: the first 12)").option("--email-style <style>","Generated email style: visual or plain").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>oM(e,t));S(CIe,{notes:["<example> is a gallery sequence URL (https://sequenzy.com/email-examples/brands/{brand}/sequences/{sequence}) or brand/sequence.","Copies the trigger family and send timing (up to 12 emails; --steps picks which, and each kept email keeps its original timing). AI writes each email in your brand in the background; check progress with sequenzy sequences get <id>.","The sequence is created as a draft and sends nothing until you enable it. Running the command again creates another sequence."],examples:["sequenzy sequences from-example https://sequenzy.com/email-examples/brands/linear/sequences/onboarding",'sequenzy sequences from-example linear/onboarding --brief "Push people to invite a teammate"',"sequenzy sequences from-example linear/onboarding --steps 1,2,4"]});var wIe=Gt.command("preview-example <example>").description("Preview the first emails of an email gallery sequence written for your brand, without saving").option("--website <site>","Write it for another website instead of your brand, e.g. acme.com").option("--brief <text>","Extra direction for every email (takes priority over the example)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON, including each email's HTML").action((e,t)=>lM(e,t));S(wIe,{notes:["<example> is a gallery sequence URL (https://sequenzy.com/email-examples/brands/{brand}/sequences/{sequence}) or brand/sequence.","Rewrites the first 3 emails and saves nothing. Clone the sequence with sequenzy sequences from-example to write every email."],examples:["sequenzy sequences preview-example linear/onboarding","sequenzy sequences preview-example linear/onboarding --website acme.com --json"]});var SIe=Gt.command("update <id>").description("Update sequence metadata, email step content, stop conditions, or paths").option("-n, --name <name>","Sequence name").option("--description <text>","Sequence description").option("--label <labels...>","Replace dashboard label names").option("--clear-labels","Remove all dashboard labels from the sequence").option("--user-cancellable","Allow subscribers to cancel enrollment").option("--not-user-cancellable","Prevent subscribers from cancelling enrollment").option("--trigger <trigger>","Replace the sequence trigger type").option("--list-id <id>","List ID for contact_added").option("--list-ids <ids...>","Several list IDs for contact_added; joining any one of them enrols the contact").option("--list-scope <scope>","contact_added with no list: any_contact (default, includes contacts in no list) or any_list").option("--tag-name <name>","Tag name for tag_added").option("--tag-names <names...>","Several tag names for tag_added; receiving any one of them enrols the contact").option("--segment-id <id>","Segment ID for segment_entered or segment_exited").option("--stop-on-segment-exit","Stop active enrollments when a contact leaves the trigger segment").option("--no-stop-on-segment-exit","Keep active enrollments running when a contact leaves the trigger segment").option("--event-name <event>","Event name for event, webhook, inactivity, or frequency triggers").option("--integration-slug <slug>","Catalog integration slug for inbound_webhook").option("--integration-event-key <key>","Catalog event key for inbound_webhook").option("--custom-integration-json <json>","Inline custom inbound webhook integration descriptor").option("--custom-integration-file <file>","JSON file containing a custom inbound webhook integration descriptor").option("--property-filters-json <json>","Inline event trigger property filters").option("--property-filters-file <file>","JSON file containing event trigger property filters").option("--inactive-days <days>","Days required for inactivity").option("--inactivity-baseline <baseline>","Inactivity baseline: sequence_created_at or subscriber_created_at").option("--min-count <count>","Minimum frequency event count").option("--time-window-days <days>","Frequency lookback window").option("--from-email <email>","Sequence-level From address").option("--from-name <name>","Display name for --from-email; picks or creates the identity of that name on the address").option("--sender-profile-id <id>",h4).option("--reply-to <email>","Sequence-level Reply-To address").option("--reply-to-name <name>","Display name for --reply-to; a saved profile keeps its own name and the response warns").option("--reply-profile-id <id>","Existing reply profile ID; carries its own name, so omit --reply-to and --reply-to-name").option("--enrollment-mode <mode>","Enrollment mode: unlimited, one_time, or matching_field").option("--enrollment-field-path <path>","Event property dot path used by matching_field enrollment").option("--pause-new-enrollments","Stop new sequence enrollments while current recipients continue").option("--resume-new-enrollments","Resume new sequence enrollments while current recipients continue").option("--sending-window-start <time>","Earliest local send time for sequence emails (HH:mm, e.g. 08:00)").option("--sending-window-end <time>","Latest local send cutoff for sequence emails (HH:mm, e.g. 20:00)").option("--sending-window-timezone <timezone>","IANA timezone for the sequence sending window, e.g. Europe/Kiev").option("--sending-window-days <days>","Comma-separated days for sequence sends, e.g. weekdays or mon,tue,wed,thu,fri").option("--clear-sending-window","Disable the sequence sending window").option("--respect-frequency-cap","Skip email steps for contacts already at the company frequency cap").option("--ignore-frequency-cap","Stop applying the company frequency cap to this sequence").option("--key-date <entries...>",'Key date as "Label=2026-11-27T00:00:00" (repeatable; zone-less times are read in --key-dates-timezone); optionally "key:Label=..." to pin the key. Requires --key-dates-timezone').option("--key-dates-timezone <timezone>","IANA timezone the key dates are written in, e.g. America/New_York").option("--key-dates-json <json>",'Inline key dates: {"timezone":"America/New_York","dates":[{"label":"Black Friday starts","at":"2026-11-27T00:00:00-05:00"}]}').option("--key-dates-file <file>","JSON file with the key dates object").option("--clear-key-dates","Remove every key date from the sequence").option("--auto-enroll-all","Keep enrolling every new contact until the last key date (manual countdowns)").option("--auto-enroll-list-ids <ids...>","Keep enrolling people who join these lists until the last key date").option("--auto-enroll-segment-id <id>","Keep enrolling people who enter this segment until the last key date").option("--auto-enroll-json <json>","Keep enrolling later joiners of this audience object until the last key date").option("--auto-enroll-starts-at <datetime>","With --auto-enroll-*, do not sync before this ISO 8601 date-time (match a scheduled enroll-audience start)").option("--clear-auto-enroll","Stop auto-enrolling later joiners").option("--bcc-emails <emails>","Comma-separated BCC addresses copied on every email this sequence sends, e.g. a support inbox (max 10)").option("--clear-bcc-emails","Remove the sequence BCC addresses").option("--confirm-structural-change","Confirm an insertSteps or branch structural edit to an active sequence").option("--confirm-live-change","Confirm node config edits to an active sequence").option("--steps-json <json>","Inline JSON array of step updates").option("--steps-file <file>","Path to a JSON file with step updates").option("--emails-json <json>","Inline JSON array of email updates; native-block emails, including supported custom HTML blocks, may set emailPreset to branded or minimal, and emailTheme patches that one step's theme (null clears the override)").option("--emails-file <file>","Path to a JSON file with email updates; native-block emails, including supported custom HTML blocks, may set emailPreset to branded or minimal, and emailTheme patches that one step's theme (null clears the override)").option("--sms-steps-json <json>","Inline JSON array of SMS step content updates (targeted by nodeId)").option("--sms-steps-file <file>","Path to a JSON file with SMS step content updates").option("--subscriber-update-steps-json <json>","Inline JSON array of Update Subscriber configs targeted by nodeId").option("--subscriber-update-steps-file <file>","Path to a JSON file with Update Subscriber configs targeted by nodeId").option("--branch-json <json>","Inline JSON object for inserting an if/else branch, or a random A/B split, with path steps and/or existing target node IDs").option("--branch-file <file>","Path to a JSON file for inserting an if/else branch with path steps and/or existing target node IDs").option("--insert-steps-json <json>","Inline JSON object for inserting new linear steps").option("--insert-steps-file <file>","Path to a JSON file for inserting new linear steps").option("--node-updates-json <json>","Inline typed nodeUpdates array from sequences get; action_email changes accept emailTheme to restyle one step without touching the company theme").option("--node-updates-file <file>","JSON file containing typed nodeUpdates").option("--graph-edit-json <json>","Inline graphEdit object using the current graphRevision").option("--graph-edit-file <file>","JSON file containing a graphEdit operation").option("--stop-condition-json <json>","Inline JSON object for updating the sequence stop condition").option("--stop-condition-file <file>","Path to a JSON file for updating the sequence stop condition").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Cn("update",{id:e,...t}));S(SIe,{notes:["Use either the steps form or the emails form, not both.","Each update entry can target a step by nodeId, emailId, or by array order.","Use --insert-steps-json/--insert-steps-file to add new linear steps, including outbound webhooks and AI steps; use --steps-* or --emails-* to edit existing email steps.",'AI steps generate a short per-contact fragment at send time (a sentence or two that a later email inserts, not a whole email): {"nodeType":"action_ai","config":{"prompt":"Write a winback subject for {{first_name}}","resultKey":"winback","outputFields":[{"key":"subject_line","fallback":"We miss you"}]}}. Later steps use {{ai.winback.subject_line}}. Opt into context with includeTags, includeEventProperties, includeRecentEvents (plus recentEventLimit, 1-50), and includeAttributes.','Inserted steps can be SMS steps: {"type":"sms","text":"...","delay":{"days":1}}. Generate copy with `sequenzy generate sms`.','Edit existing SMS steps with --sms-steps-json/--sms-steps-file: [{"nodeId":"node_sms","text":"New message"}]. Entries may also update label and ineligibleAction.','Edit existing Update Subscriber steps with --subscriber-update-steps-json/--subscriber-update-steps-file: [{"nodeId":"node_update","config":{"customAttributeUpdates":[{"name":"plan","value":"{{event.plan}}","valueType":"text"}]}}].',"For migrated provider flow steps, use html/htmlContent to preserve exact HTML as raw HTML and use delay or delayMs for waits.",'A step may use waitUntilWeekday to hold until the next weekday window, e.g. {"type":"delay","waitUntilWeekday":{"day":"sunday","startTime":"09:00","endTime":"12:00","timezone":"America/Los_Angeles"}}. Contacts already inside the window continue immediately. Add "timezoneSource":"subscriber" to use the timezone of each contact, with timezone as the fallback for contacts without one. Add "minimumWait":{"days":6} to wait at least that long before the window. Place it before the first email to guarantee the send day at the graph level (a sequence sendingWindow only shifts send times).',"When inserting steps or branches into an active sequence, pass --confirm-structural-change after confirming the live-flow impact.",'Use --stop-condition-json/--stop-condition-file with values like {"type":"has_tag","value":"customer"}; use {"type":"none","value":null} to clear it.','event_received stop conditions only match events received after enrollment. Add matchConfig to narrow them: {"type":"event_received","value":"product.quota_used","matchConfig":{"mode":"event_property_filter","propertyFilters":[{"path":"quota_used","operator":"greater_than","value":1}]}} stops only when a later event matches every filter (operators: exists, not_exists, equals, not_equals, one_of, contains, greater_than, less_than). {"mode":"event_property","rules":[{"entryFieldPath":"orderId","eventFieldPath":"orderId"}]} stops only when the stop event matches the enrolling event on that field. For field_changed, {"mode":"field_value","operator":"equals","value":"pro"} stops only when the field changes to a matching value.','Stop conditions are re-evaluated before every step, including the first, so {"type":"does_not_have_tag","value":"allowlist"} and {"type":"removed_from_list","value":"list_123"} act as an allowlist: contacts without that tag or list are cancelled before any step sends. Use this to point a live trigger at a chosen set of contacts without editing the graph. Guarded-out contacts still enroll and are then cancelled at the trigger node, so they appear as cancellations there rather than in the active or waiting enrollment counts.',"Clearing the guard does not retry the contacts it already cancelled: nothing re-enrolls them, so they only receive the sequence if the trigger fires for them again, which one-shot triggers never do. On the one_time enrollment mode a repeated trigger is ignored too, because enrollment is blocked by the existence of any earlier run rather than by its outcome. Guard a duplicate sequence and leave the real one ungated, or enroll the missed contacts afterwards with `sequenzy sequences enroll`, which skips the one_time check.","Branch condition types include has_tag, does_not_have_tag, in_list, in_segment, event_received, link_clicked, and field_* comparisons. Use activityScope (this_sequence, previous_email, ever) for event and click checks.","Branch paths may set targetNodeId and elseTargetNodeId to wire directly to existing nodes from sequences get, including the completion node. If path steps are also provided, they run before that target.",'Set "splitMode":"random" with "randomPercentages" to route by percentage instead of by condition, which runs a concurrent A/B test inside the flow (for example two abandoned-cart offers at once instead of one after the other). Each branch then omits conditionType and condition-specific fields, the percentages must sum to 100, and no else path is allowed. To A/B test the content of a single existing email step and have a winner picked automatically, use `sequenzy ab-tests create --automation-node-id` instead.',"Use --clear-sending-window to remove a configured send window.","Use --respect-frequency-cap to skip an email step for contacts already at the company frequency cap (they continue to the next step; set the cap with `sequenzy frequency-cap set`); --ignore-frequency-cap turns it off. Transactional steps are never skipped.","Use --key-date/--key-dates-json to set the key dates a countdown sequence waits for; changing them re-times contacts already waiting. --clear-key-dates removes them (rejected while a step still waits for one).","Use --bcc-emails with a comma-separated list to blind-copy team inboxes on every sequence email; use --clear-bcc-emails to remove them."],examples:['sequenzy sequences update seq_123 --name "User Onboarding"',"sequenzy sequences update seq_123 --pause-new-enrollments","sequenzy sequences update seq_123 --resume-new-enrollments","sequenzy sequences update seq_123 --enrollment-mode matching_field","sequenzy sequences update seq_123 --enrollment-field-path order.id","sequenzy sequences update seq_123 --sending-window-start 08:00 --sending-window-end 20:00 --sending-window-timezone Europe/Kiev --sending-window-days weekdays","sequenzy sequences update seq_123 --clear-sending-window","sequenzy sequences update seq_123 --respect-frequency-cap",'sequenzy sequences update seq_123 --key-dates-timezone America/New_York --key-date "Black Friday starts=2026-11-27T00:00:00" --key-date "Black Friday ends=2026-11-29T23:59:00"','sequenzy sequences update seq_123 --bcc-emails "cs-team@yourcompany.com, founder@yourcompany.com"',"sequenzy sequences update seq_123 --clear-bcc-emails","sequenzy sequences update seq_123 --steps-file ./sequence-updates.json",`sequenzy sequences update seq_123 --stop-condition-json '{"type":"has_tag","value":"customer"}'`,`sequenzy sequences update seq_123 --stop-condition-json '{"type":"does_not_have_tag","value":"allowlist"}'`,`sequenzy sequences update seq_123 --stop-condition-json '{"type":"event_received","value":"product.quota_used","matchConfig":{"mode":"event_property_filter","propertyFilters":[{"path":"quota_used","operator":"greater_than","value":1}]}}'`,`sequenzy sequences update seq_123 --insert-steps-json '{"afterNodeId":"node_email","steps":[{"delay":{"days":1},"subject":"Migration check-in","html":"<p>Need help migrating?</p>"}]}' --confirm-structural-change`,`sequenzy sequences update seq_123 --insert-steps-json '{"afterNodeId":"node_email","steps":[{"nodeType":"logic_wait_for_event","config":{"label":"Wait for reply","eventName":"email.replied","timeoutDays":5,"timeoutAction":"continue"}}]}'`,`sequenzy sequences update seq_123 --insert-steps-json '{"afterNodeId":"node_trigger","steps":[{"nodeType":"action_ai","config":{"prompt":"Write a short winback subject line for {{first_name}} who cancelled because {{event.reason}}.","resultKey":"winback","outputFields":[{"key":"subject_line","maxLength":60,"fallback":"We miss you"}],"includeEventProperties":true}}]}' --confirm-structural-change`,`sequenzy sequences update seq_123 --branch-json '{"afterNodeId":"node_email","branches":[{"conditionType":"link_clicked","linkUrl":"project-invites","activityScope":"previous_email","steps":[{"subject":"Invite accepted","html":"<p>Thanks for accepting.</p>"}]}],"elseSteps":[{"subject":"Reminder","html":"<p>Please accept your invite.</p>"}]}'`,`sequenzy sequences update seq_123 --branch-json '{"afterNodeId":"node_email_1","branches":[{"id":"replied","conditionType":"event_received","eventName":"email.replied","activityScope":"this_sequence","targetNodeId":"node_complete"}],"elseTargetNodeId":"node_email_2"}'`,`sequenzy sequences update seq_123 --branch-json '{"afterNodeId":"node_cart_wait","splitMode":"random","randomPercentages":[50,50],"branches":[{"id":"discount","label":"10% off","steps":[{"subject":"Here is 10% off","html":"<p>Complete your order.</p>"}]},{"id":"bonus","label":"Free shipping + gift","steps":[{"subject":"Free shipping on us","html":"<p>Complete your order.</p>"}]}]}' --confirm-structural-change`,"sequenzy sequences update seq_123 --branch-file ./branch.json",`sequenzy sequences update seq_123 --sms-steps-json '[{"nodeId":"node_sms","text":"Hey {{FIRST_NAME}}, your order shipped!"}]'`,`sequenzy sequences update seq_123 --subscriber-update-steps-json '[{"nodeId":"node_update","config":{"customAttributeUpdates":[{"name":"mrr","value":"{{event.amount}}","valueType":"number"}]}}]'`]});var DIe=Gt.command("enable <id>").description("Enable a sequence").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Cn("enable",{id:e,...t}));S(DIe,{examples:["sequenzy sequences enable seq_123"]});var BIe=Gt.command("disable <id>").description("Disable a sequence").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Cn("disable",{id:e,...t}));S(BIe,{examples:["sequenzy sequences disable seq_123"]});var xIe=Gt.command("duplicate <id>").description("Create an independent draft copy of a sequence").option("-n, --name <name>","Name for the copied sequence").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Cn("duplicate",{id:e,...t}));S(xIe,{notes:["Email templates, graph topology, and sequence A/B tests are copied independently."],examples:["sequenzy sequences duplicate seq_123",'sequenzy sequences duplicate seq_123 --name "Welcome Series v2"']});var _Ie=Gt.command("archive <id>").description("Archive a sequence").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Cn("archive",{id:e,...t}));S(_Ie,{examples:["sequenzy sequences archive seq_123"]});var kIe=Gt.command("unarchive <id>").description("Restore an archived sequence as a draft").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Cn("unarchive",{id:e,...t}));S(kIe,{examples:["sequenzy sequences unarchive seq_123"]});var RIe=Gt.command("enrollments <id>").description("List the contacts currently enrolled in a sequence").option("--status <statuses...>","Enrollment statuses to include (active, waiting, completed, failed, cancelled); defaults to active and waiting").option("--node-id <nodeIds...>","Only show enrollments sitting on these sequence node IDs").option("--subscriber-id <ids...>","Only show enrollments for these subscriber IDs").option("--email <email>","Only show enrollments for this email address").option("--sort <sort>","enrolled_at_desc (default), enrolled_at_asc, wait_until_asc, or wait_until_desc").option("--stop-condition-match","Also report whether each in-flight enrollment's stop condition already matches (caps the page at 100)").option("--limit <n>","Enrollments per page, 1-500 (default 50)").option("--offset <n>","Number of enrollments to skip").option("--all","Fetch every page").option("--csv [file]","Print CSV, or write it to a file").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>n4(e,t));S(RIe,{notes:["Defaults to active and waiting enrollments, which is every contact still moving through the sequence.","Get node IDs from sequenzy sequences get <id>, or from enrollmentCounts.byCurrentNode in sequenzy stats --sequence <id>.","waitUntil is when a waiting enrollment resumes; it is empty for enrollments that are not scheduled.","A stop condition does not cancel a waiting enrollment when its event arrives. It is re-checked when the enrollment next runs a step, so a matching contact keeps reporting waiting until its delay expires. Use --stop-condition-match to inspect the current match. The result is a non-atomic snapshot; a step already past its stop check may still finish."],examples:["sequenzy sequences enrollments seq_123","sequenzy sequences enrollments seq_123 --node-id node_wave_1","sequenzy sequences enrollments seq_123 --status waiting --sort wait_until_asc","sequenzy sequences enrollments seq_123 --subscriber-id sub_123 --stop-condition-match","sequenzy sequences enrollments seq_123 --all --csv enrollments.csv"]});var QIe=Gt.command("enrollment <sequenceId> <enrollmentId>").description("Show how one enrollment entered and which branches it already took").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t,n)=>r4(e,t,n));S(QIe,{notes:["Use list_sequence_enrollments / sequenzy sequences enrollments to get enrollmentId.","nodeHistory is the recorded graph walk. Compared field values are redacted summaries, never the raw recipient value."],examples:["sequenzy sequences enrollment seq_123 tok_abc","sequenzy sequences enrollment seq_123 tok_abc --json"]});var TIe=Gt.command("move-enrollments <id>").description("Release a bounded batch of enrolled contacts from one sequence step onto another").requiredOption("--from-node <nodeId>","Node ID the contacts are currently waiting on").option("--to-node <nodeId>","Node ID to move them onto; defaults to the source step's only next step").option("--limit <n>","Maximum enrollments to move, 1-500 (default 100)").option("--sort <sort>","wait_until_asc (default), wait_until_desc, enrolled_at_asc, or enrolled_at_desc").option("--subscriber-ids <ids...>","Only move these subscriber IDs, up to 500").option("--daily-limit <n>","Refuse to move more than this many onto the target step in a rolling 24 hours").option("--tag <tags...>","Existing tag names to apply to the moved contacts").option("--reason <reason>","Note stored on every moved enrollment").option("--apply","Actually move the batch; otherwise only dry-run").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>a4(e,t));S(TIe,{notes:["Use this instead of cancelling and re-enrolling: the enrollment keeps its entry event properties, stop-condition snapshots, and start date.","Moved contacts become active on the target step immediately, so the sequence emails them as soon as the worker picks them up.","Without --apply, this command only reports which enrollments would move.","The batch is deliberately not auto-drained: re-run the command to release the next batch while remainingCount is above zero.","This works even while the sequence has new enrollment paused, because the contacts are already enrolled.","Get node IDs from sequenzy sequences enrollments <id> (currentNodeId) or sequenzy sequences get <id>."],examples:["sequenzy sequences move-enrollments seq_123 --from-node node_delay_2","sequenzy sequences move-enrollments seq_123 --from-node node_delay_2 --limit 180 --apply","sequenzy sequences move-enrollments seq_123 --from-node node_delay_2 --to-node node_email_3 --limit 180 --daily-limit 500 --tag wave-3-released --reason 'Wave 3' --apply"]});var $Ie=Gt.command("pause-enrollments <id>").description("Stop new enrollments while current sequence recipients continue").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Cn("pause-enrollments",{id:e,...t}));S($Ie,{notes:["The sequence must already be active. Existing active and waiting recipients keep moving through the sequence.","Use sequences disable when you want to freeze current recipients too."],examples:["sequenzy sequences pause-enrollments seq_123"]});var NIe=Gt.command("resume-enrollments <id>").description("Resume new enrollments for an active sequence without changing current recipients").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Cn("resume-enrollments",{id:e,...t}));S(NIe,{notes:["The sequence must already be active. Use sequences enable to resume a fully disabled sequence."],examples:["sequenzy sequences resume-enrollments seq_123"]});var OIe=Gt.command("enroll <id>").description("Manually enroll subscribers in a sequence").option("-e, --email <emails...>","Email addresses to enroll").option("--subscriber-ids <ids...>","Subscriber IDs to enroll").option("--emails-json <json>","JSON array of emails, or an object with emails/subscribers").option("--emails-file <file>","JSON, CSV, or newline-separated file with subscriber emails").option("--target-node-id <nodeId>","Sequence node to enroll at; defaults to the first step after the trigger").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Cn("enroll",{id:e,...t}));S(OIe,{notes:["Provide at least one target using --subscriber-ids or exactly one email source: --email, --emails-json, or --emails-file.","Subscribers must be active; unknown emails are reported as not found and inactive, unavailable, or already enrolled subscribers are skipped.","Enrollment requires the sequence to be accepting entrants (enabled and not paused for enrollment)."],examples:["sequenzy sequences enroll seq_123 --email one@example.com two@example.com","sequenzy sequences enroll seq_123 --subscriber-ids sub_123 sub_456 --target-node-id node_email_2","sequenzy sequences enroll seq_123 --emails-file ./vips.csv","sequenzy sequences enroll seq_123 --email one@example.com --target-node-id node_email_2"]});var PIe=Gt.command("enroll-audience <id>").description("Enroll a whole audience (everyone, lists, or a segment) in a sequence as a background run").option("--all","Enroll every active contact with an email").option("--list-ids <ids...>","Enroll members of these lists").option("--segment-id <id>","Enroll members of this segment").option("--audience-json <json>",'Campaign-style audience object, e.g. {"type":"rules","include":[{"type":"lists","listIds":["list_1"]}],"exclude":[{"type":"segments","segmentIds":["seg_2"]}]}').option("--audience-file <file>","JSON file with the audience object").option("--target-node-id <nodeId>","Sequence node to start at; defaults to the first step after the trigger").option("--apply","Start enrolling; otherwise only report the estimate").option("--schedule-at <datetime>","With --apply, start at this ISO 8601 date-time instead of now").option("--keep-enrolling","With --apply, also enroll people who join this audience later, until the last key date").option("--data-json <json>",'With --apply, run-level data shared by everyone in this run and read in emails as {{enrollment.<field>}}, e.g. {"sale_ends_at":"2026-11-29T23:59:00Z","discount_percent":20} (JSON object, up to 8 KB)').option("--data-file <file>","With --apply, JSON file with the run-level data object").option("--wait","With --apply, poll until the run finishes").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>J3(e,t));S(PIe,{notes:["Without --apply the command only estimates: matching contacts, how many are already in the sequence, and how many would be enrolled.","The sequence must be enabled and accepting entrants. Contacts already active or waiting in it are skipped; one_time sequences also skip anyone who completed or was cancelled before. Unsubscribed and bounced contacts are never enrolled.","Late enrollees in a countdown sequence skip the steps whose key date already passed and continue from the next one.","Only one audience enrollment per sequence can be queued or running at a time; use sequenzy sequences audience-enrollments (or audience-enrollment <id> <runId>) to watch it and cancel-audience-enrollment to stop it.","--data-json/--data-file attach run-level values that are the same for everyone in the run (a sale end time, a discount percentage). Every enrolled contact keeps a copy, and the sequence's emails and conditions read them as {{enrollment.<field>}}. Auto-enroll syncs (--keep-enrolling) do not carry run data."],examples:["sequenzy sequences enroll-audience seq_123 --all","sequenzy sequences enroll-audience seq_123 --segment-id seg_past_buyers --apply --wait","sequenzy sequences enroll-audience seq_123 --list-ids list_1 list_2 --apply","sequenzy sequences enroll-audience seq_123 --audience-file ./audience.json --apply --json",`sequenzy sequences enroll-audience seq_123 --segment-id seg_past_buyers --apply --data-json '{"sale_ends_at":"2026-11-29T23:59:00Z","discount_percent":20,"order_cutoff_utc":"2026-11-29T22:00:00Z"}'`]});var FIe=Gt.command("audience-enrollments <id>").description("List audience enrollment runs for a sequence").option("--limit <n>","Runs to return, 1-100 (default 20)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>V3(e,t));S(FIe,{notes:["Each run reports its status (queued, running, completed, cancelled, failed) and how many contacts were enrolled or skipped."],examples:["sequenzy sequences audience-enrollments seq_123","sequenzy sequences audience-enrollments seq_123 --limit 5 --json"]});var qIe=Gt.command("audience-enrollment <id> <runId>").description("Show one audience enrollment run with its progress").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t,n)=>K3(e,t,n));S(qIe,{notes:["Poll this while the status is queued or running; enroll-audience --wait does the polling for you."],examples:["sequenzy sequences audience-enrollment seq_123 run_abc --json"]});var LIe=Gt.command("cancel-audience-enrollment <id> <runId>").description("Stop a queued or running audience enrollment").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t,n)=>W3(e,t,n));S(LIe,{notes:["A queued run is cancelled immediately; a running run stops after the batch it is enrolling. Contacts already enrolled stay in the sequence (use cancel-enrollments to remove them)."],examples:["sequenzy sequences cancel-audience-enrollment seq_123 run_abc"]});var UIe=Gt.command("cancel-enrollments <id>").description("Cancel active or waiting subscriber enrollments in a sequence").option("--all","Cancel every active or waiting enrollment in the sequence").option("--subscriber-id <id>","Cancel enrollments for one subscriber ID").option("--subscriber-ids <ids...>","Cancel enrollments for up to 500 subscriber IDs").option("--field-path <path>","Entry event property dot path to match, such as order.id").option("--field-values <values>","Comma-separated entry field values to match").option("--reason <reason>","Reason stored on cancelled enrollments").option("--apply","Actually cancel matches; otherwise only dry-run").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Cn("cancel-enrollments",{id:e,...t}));S(UIe,{notes:["sequenceId is always required. Provide exactly one target: --all, --subscriber-id, --subscriber-ids, or --field-values.","Use --all to fully stop a live sequence when enrollments came from a segment and share no entry field value.","Without --apply, this command only reports matching enrollments.","With --apply, the command keeps calling the API until every match is drained and prints running progress.","When --field-path is omitted, the API uses the sequence enrollmentFieldPath if configured."],examples:["sequenzy sequences cancel-enrollments seq_123 --all","sequenzy sequences cancel-enrollments seq_123 --all --apply --reason 'Lifecycle cutover'","sequenzy sequences cancel-enrollments seq_123 --subscriber-id sub_123 --apply","sequenzy sequences cancel-enrollments seq_123 --subscriber-ids sub_1 sub_2 --apply","sequenzy sequences cancel-enrollments seq_123 --field-path order.id --field-values ord_123,ord_456"]});var jIe=Gt.command("realign-enrollments <id>").description("Move waiting enrollments to the start of the sequence sending window on the day they are already scheduled for").option("--node-ids <ids...>","Only realign enrollments sitting on these step IDs").option("--subscriber-ids <ids...>","Only realign enrollments for up to 500 subscriber IDs").option("--cursor <cursor>","Continue a capped scan from the cursor returned by the previous run").option("--job-id <job-id>","Check a previously queued realignment job instead of starting one").option("--apply","Actually move the wait times; otherwise only dry-run").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Cn("realign-enrollments",{id:e,...t}));S(jIe,{notes:["Run this after changing a live sequence's sending window: existing waits keep their original time, so a widened window never reaches them and a narrowed one defers them to the next allowed day.","A wait only ever moves earlier, never onto a different local day, and never before now. Nobody is cancelled or re-enrolled.","Without --apply, this command only reports the new wait times.","When more enrollments remain, run the complete continuation command printed in the result; applied runs retain --apply and any targeting filters.","Applied realignments run in the background. Use the printed --job-id command to read the result.","Use `sequenzy sequences enrollments <id> --status waiting --sort wait_until_asc` first to see who is affected."],examples:["sequenzy sequences realign-enrollments seq_123","sequenzy sequences realign-enrollments seq_123 --apply","sequenzy sequences realign-enrollments seq_123 --node-ids node_week_2 --apply","sequenzy sequences realign-enrollments seq_123 --subscriber-ids sub_1 sub_2 --apply","sequenzy sequences realign-enrollments seq_123 --job-id realign-sequence-enrollments-seq_123-..."]});var zIe=Gt.command("delete <id>").description("Delete a sequence").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Cn("delete",{id:e,...t}));S(zIe,{examples:["sequenzy sequences delete seq_123"]});var mi=Je.command("ab-tests").description("Inspect and edit A/B test variants").action(()=>mi.help());S(mi,{notes:["Use get to discover variant IDs, then update-variant to edit a specific A/B variant.","Campaign test time and audience can change during testing. Variant content stays locked after sending starts.","create, add-variant, and delete-variant work on campaign and sequence A/B tests; delete works on campaign A/B tests only."],examples:["sequenzy ab-tests list --sequence seq_123","sequenzy ab-tests get ab_123","sequenzy ab-tests update ab_123 --winner-criteria open_rate","sequenzy ab-tests stats ab_123 --period 7d","sequenzy ab-tests create camp_123 --test-percentage 20 --winner-criteria open_rate",'sequenzy ab-tests add-variant ab_123 --subject "Alternative subject"',"sequenzy ab-tests restart ab_123 --source-variant var_b","sequenzy ab-tests select-winner ab_123 var_b","sequenzy ab-tests resume ab_123",'sequenzy ab-tests update-variant ab_123 var_b --subject "New subject"',"sequenzy ab-tests update-variant ab_123 var_b --blocks-file ./variant-b.json"]});var MIe=mi.command("list").description("List A/B tests").option("--sequence <id>","Filter by sequence ID").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>ki("list",e));S(MIe,{examples:["sequenzy ab-tests list --sequence seq_123"]});var HIe=mi.command("get <id>").description("Get A/B test details and variants").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ki("get",{id:e,...t}));S(HIe,{examples:["sequenzy ab-tests get ab_123"]});var GIe=mi.command("update <id>").description("Update campaign or sequence A/B test settings").option("-n, --name <name>","A/B test name").option("--test-percentage <percent>","Campaign test audience share (5-50)").option("--duration-minutes <minutes>","Campaign test duration before winner selection (15-1440)").option("--winner-criteria <criteria>","Winner criteria: open_rate or click_rate").option("--test-type <type>","Sequence variant strategy: subject or content").option("--winner-threshold <count>","Sequence recipients before winner selection (10-1000)").option("--auto-select-winner","Sequence tests: pick the leading variant once the sample size is reached").option("--no-auto-select-winner","Sequence tests: keep splitting contacts until you select a winner").option("--confirm-live-change","Confirm a settings change to an active or already-used sequence test").option("--cancel-sample-update","Discard a failed campaign sample change").option("--expected-updated-at <timestamp>","Reject settings changes if the test has changed since this timestamp").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ki("update",{id:e,...t}));S(GIe,{notes:["During campaign testing, duration is measured from the original start; a past deadline starts winner selection immediately. Audience changes are queued and preserve committed sends. Retry the same percentage after a queue failure, or use --cancel-sample-update to discard a failed request.","Sequence tests use --test-type, --winner-threshold, --winner-criteria, and --auto-select-winner / --no-auto-select-winner.","Use --confirm-live-change when sequence settings affect an active test or a test with recorded activity."],examples:["sequenzy ab-tests update ab_123 --test-percentage 30 --duration-minutes 120 --winner-criteria open_rate","sequenzy ab-tests update ab_123 --test-type content --winner-criteria open_rate --winner-threshold 150 --confirm-live-change","sequenzy ab-tests update ab_123 --no-auto-select-winner --confirm-live-change"]});var JIe=mi.command("stats <id>").description("Get A/B test variant stats").option("-p, --period <period>","Time period (1h, 24h, 7d, 30d, 90d)").option("--start <iso>","Custom range start as ISO 8601").option("--end <iso>","Custom range end as ISO 8601").option("--include-bots","Include machine-classified bot/scanner opens and clicks").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ki("stats",{id:e,...t}));S(JIe,{notes:["Use --period or both --start and --end. Custom ranges max at 90 days.","Bot/scanner opens and clicks are excluded by default; pass --include-bots to inspect raw engagement."],examples:["sequenzy ab-tests stats ab_123","sequenzy ab-tests stats ab_123 --period 30d","sequenzy ab-tests stats ab_123 --include-bots"]});var VIe=mi.command("select-winner <id> <variantId>").description("Select a campaign A/B winner, or select or change a sequence A/B winner").option("--confirm-live-change","Confirm changing the winner of a test in an active sequence").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t,n)=>ki("select-winner",{id:e,variantId:t,...n}));S(VIe,{notes:["Campaign A/B tests must be in the testing phase; selection immediately queues winner delivery for the remaining audience.","Sequence A/B tests can change an existing winner, including one picked automatically. Contacts who already got a variant keep it; everyone who reaches the step afterwards gets the new winner.","Use --confirm-live-change when the sequence is active."],examples:["sequenzy ab-tests select-winner ab_123 var_b","sequenzy ab-tests select-winner ab_123 var_c --confirm-live-change"]});var KIe=mi.command("resume <id>").description("Clear a sequence A/B winner and keep testing until you select one").option("--confirm-live-change","Confirm resuming a test in an active sequence").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ki("resume",{id:e,...t}));S(KIe,{notes:["Contacts reaching the step are split across the variants again. Results collected so far are kept.","Automatic selection stays off for this test; finish it with `sequenzy ab-tests select-winner <id> <variantId>`.","Use --confirm-live-change when the sequence is active."],examples:["sequenzy ab-tests resume ab_123","sequenzy ab-tests resume ab_123 --confirm-live-change"]});var WIe=mi.command("restart <id>").description("Run another sequence A/B test from an existing variant").option("--source-variant <id>","Variant to use as the new control. Defaults to the selected winner.").option("--test-type <type>","Test type for generated variants: subject or content").option("--winner-threshold <count>","Subscribers before selecting a winner (10-1000)").option("--variant-count <count>","Total variants including control (2-4)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ki("restart",{id:e,...t}));S(WIe,{notes:["Only sequence A/B tests with a selected winner can be restarted.","Run `sequenzy ab-tests get <id>` first to find variant IDs."],examples:["sequenzy ab-tests restart ab_123","sequenzy ab-tests restart ab_123 --source-variant var_b --test-type content --variant-count 3"]});var YIe=mi.command("update-variant <id> <variantId>").description("Update an A/B test variant").option("-s, --subject <subject>","Variant subject").option("--preview-text <text>","Variant preview text").option("--html <html>","Replacement HTML body").option("--html-file <file>","Read replacement HTML from file").option("--blocks-json <json>","Inline JSON array of Sequenzy email blocks").option("--blocks-file <file>","Path to a JSON file with Sequenzy email blocks").option("--confirm-live-change","Confirm a sequence variant edit that may affect A/B test accuracy").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t,n)=>ki("update-variant",{id:e,variantId:t,...n}));S(YIe,{notes:["Provide either HTML or blocks, not both.","Campaign variants remain editable only in draft.","Use --confirm-live-change when a sequence is active or its test already has activity; earlier sends stay unchanged and combined results may be inaccurate.","Run `sequenzy ab-tests get <id>` first to find variant IDs."],examples:['sequenzy ab-tests update-variant ab_123 var_b --subject "New subject"',"sequenzy ab-tests update-variant ab_123 var_b --html-file ./variant-b.html",'sequenzy ab-tests update-variant ab_123 var_b --subject "Revised future send" --confirm-live-change']});var ZIe=mi.command("create [campaignId]").description("Create a campaign or sequence-node A/B test").option("--automation-node <nodeId>","Convert this sequence email node into an A/B test node").option("--confirm-live-change","Confirm conversion of an email node in an active sequence").option("-n, --name <name>","A/B test name").option("--test-percentage <percent>","Campaign test audience share (5-50, default 20)").option("--duration-minutes <minutes>","Campaign test duration before winner selection (15-1440, default 240)").option("--winner-criteria <criteria>","Winner criteria: open_rate or click_rate (campaign default open_rate; overrides sequence test-type default)").option("--test-type <type>","Sequence variant strategy: subject or content (default content)").option("--winner-threshold <count>","Sequence test sample size (10-1000, default 100)").option("--variants-json <json>","Inline JSON array of extra variants ({subject, previewText?, blocks?})").option("--variants-file <file>","Path to a JSON file with extra variants ({subject, previewText?, blocks?})").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ki("create",{campaignId:e,automationNodeId:t.automationNode,...t}));S(ZIe,{notes:["Provide either a campaign ID or --automation-node, but not both.","Campaigns must be in draft or rejected status. Sequence node IDs must reference an email node.","Campaigns use --test-percentage and --duration-minutes; sequences use --winner-threshold.","Variant A is created automatically from the campaign email; provided variants are added after it."],examples:["sequenzy ab-tests create camp_123",`sequenzy ab-tests create --automation-node node_123 --test-type content --winner-threshold 100 --variants-json '[{"subject":"Variant B"}]'`,"sequenzy ab-tests create camp_123 --test-percentage 30 --duration-minutes 120 --winner-criteria click_rate",`sequenzy ab-tests create camp_123 --variants-json '[{"subject":"Alternative subject"}]'`]});var XIe=mi.command("add-variant <id>").description("Add a variant to a draft campaign or sequence A/B test").requiredOption("-s, --subject <subject>","Variant subject").option("--preview-text <text>","Variant preview text").option("--blocks-json <json>","Inline JSON array of Sequenzy email blocks").option("--blocks-file <file>","Path to a JSON file with Sequenzy email blocks").option("--confirm-live-change","Confirm adding a variant to an A/B test in an active sequence").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ki("add-variant",{id:e,...t}));S(XIe,{notes:["Variants can only be added while the A/B test is in draft status.","A/B tests in an active sequence require --confirm-live-change."],examples:['sequenzy ab-tests add-variant ab_123 --subject "Alternative subject"','sequenzy ab-tests add-variant ab_123 --subject "Alternative subject" --blocks-file ./variant.json']});var eCe=mi.command("delete-variant <id> <variantId>").description("Remove a variant from a draft campaign or sequence A/B test").option("-y, --yes","Skip the confirmation prompt").option("--confirm-live-change","Confirm deleting a variant from an A/B test in an active sequence").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t,n)=>ki("delete-variant",{id:e,variantId:t,...n}));S(eCe,{notes:["Variant A is the control variant and cannot be deleted.","Variants can only be removed while the A/B test is in draft status.","A/B tests in an active sequence require --confirm-live-change."],examples:["sequenzy ab-tests delete-variant ab_123 var_b --yes"]});var tCe=mi.command("delete <id>").description("Delete a campaign A/B test").option("-y, --yes","Skip the confirmation prompt").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ki("delete",{id:e,...t}));S(tCe,{notes:["Running A/B tests cannot be deleted; the linked campaign must be draft or rejected."],examples:["sequenzy ab-tests delete ab_123 --yes"]});var Cl=Je.command("components").description("Manage reusable email components and the default email footer").action(()=>Cl.help());S(Cl,{notes:["Components are saved block groups you can reuse across emails.","The component pinned to the footer slot is the footer every new sequence, campaign, and AI-generated email gets. Edit it here to change the footer everywhere at once - editing one email's blocks only changes that email.","A default footer always keeps its unsubscribe link enabled. Transactional sends hide it at render time.","Existing emails change only with explicit --apply-to scopes and a reviewed --preview-token. Use footer preview first; --output-dir exports before/after HTML for visual inspection."],examples:["sequenzy components footer get --json > footer.json","sequenzy components footer set --blocks-file ./footer.json --yes","sequenzy components list --company comp_123","sequenzy components create 'Promo banner' --blocks-file ./banner.json"]});var $v=Cl.command("footer").description("Read or replace the company's default email footer").action(()=>$v.help()),nCe=$v.command("get").description("Print the current default email footer").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>nc("footer-get",void 0,e));S(nCe,{notes:["Exits with a not-found error when no default footer is set, which means emails fall back to the footer generated from the company profile.","Pipe --json to a file, edit the blocks, then write it back with `components footer set`."],examples:["sequenzy components footer get","sequenzy components footer get --json > footer.json"]});var rCe=$v.command("preview").description("Preview a footer change and optionally export before/after HTML without saving").option("--blocks-json <json>","Proposed footer blocks as inline JSON").option("--blocks-file <path>","Proposed footer blocks as a JSON file").option("--name <name>","Proposed component name").option("--description <text>","Proposed component description").option("--apply-to <scopes>","Comma-separated sequences,campaigns,transactional,templates; omit for future emails only").option("--include-customized","Also replace customized footers").option("--render-preview","Include footer and before/after HTML in JSON output").option("--output-dir <path>","Write visual HTML previews to this directory").option("--sample-id <id>","Render a specific affected item instead of category samples").option("--sample-kind <kind>","Sample kind: email, ab_variant, localization").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON, including the preview token").action((e)=>nc("footer-preview",void 0,e));S(rCe,{notes:["The preview does not save or send. Dynamic content is not personalized. Open exported HTML in a browser to inspect it visually.","Use the same blocks, metadata and scope options when applying the returned token. Stale previews return a conflict; review a fresh preview before retrying."],examples:["sequenzy components footer preview --blocks-file footer.json --apply-to sequences,campaigns,transactional,templates --output-dir ./footer-preview --json"]});var oCe=$v.command("set").description("Create or replace the company's default email footer").option("--blocks-json <json>","Footer blocks as inline JSON").option("--blocks-file <path>","Footer blocks as a JSON file").option("--apply-to <scopes>","Comma-separated sequences,campaigns,transactional,templates").option("--include-customized","Also replace customized footers, matching the preview").option("--preview-token <token>","Reviewed footer preview token; required with --apply-to").option("--name <name>","Component name (default: Default Footer)").option("--description <text>","Component description").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").option("-y, --yes","Skip the confirmation prompt").action((e)=>nc("footer-set",void 0,e));S(oCe,{notes:["Replaces the whole footer. Read the current one with `components footer get --json` first if you only mean to change part of it.","The unsubscribe link is always re-enabled on save."],examples:["sequenzy components footer set --blocks-file ./footer.json --yes",'sequenzy components footer set --blocks-file ./footer.json --name "2026 Footer"']});var iCe=Cl.command("list").description("List email components, newest first").option("--type <type>","Filter by component type (section, footer)").option("--defaults-only","Only components pinned as a company default").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>nc("list",void 0,e));S(iCe,{examples:["sequenzy components list","sequenzy components list --defaults-only --json"]});var sCe=Cl.command("get <componentId>").description("Show one email component").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>nc("get",e,t));S(sCe,{examples:["sequenzy components get cmp_123 --json"]});var aCe=Cl.command("create <name>").description("Create a reusable email component").option("--blocks-json <json>","Component blocks as inline JSON").option("--blocks-file <path>","Component blocks as a JSON file").option("--description <text>","Component description").option("--type <type>","Component type (section, footer). Default: section").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>nc("create",e,t));S(aCe,{notes:["Component names are unique per company.","Creating one with --type footer does not pin it as the default footer. Use `components footer set` for that."],examples:["sequenzy components create 'Promo banner' --blocks-file ./banner.json"]});var cCe=Cl.command("update <componentId>").description("Update an email component's metadata or blocks").option("--name <name>","New component name").option("--description <text>","New description").option("--type <type>","New component type (section, footer)").option("--blocks-json <json>","Replacement blocks as inline JSON").option("--blocks-file <path>","Replacement blocks as a JSON file").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>nc("update",e,t));S(cCe,{notes:["Replacing blocks bumps the component version. Emails built earlier keep the copy they were created with."],examples:["sequenzy components update cmp_123 --name 'Promo banner v2'","sequenzy components update cmp_123 --blocks-file ./banner-v2.json"]});var lCe=Cl.command("delete <componentId>").description("Delete an email component").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").option("-y, --yes","Skip the confirmation prompt").action((e,t)=>nc("delete",e,t));S(lCe,{notes:["Emails that already rendered the component keep their copied blocks.","Deleting the pinned default footer makes new emails fall back to the generated footer."],examples:["sequenzy components delete cmp_123 --yes"]});var fi=Je.command("templates").description("Manage email templates").action(()=>fi.help());S(fi,{notes:["Template content can be provided as raw HTML or as Sequenzy blocks JSON.","Templates can be assigned labels and listed by label for integration dashboards.","Use blocks when you need conditional content, per-block styles, or an exact editor-compatible structure.",ug],examples:["sequenzy templates list --company comp_123","sequenzy templates list --label edm --company comp_123",'sequenzy templates create welcome --subject "Welcome" --html-file ./welcome.html','sequenzy templates create welcome --subject "Welcome" --label edm template --html-file ./welcome.html','sequenzy templates create welcome --subject "Welcome" --blocks-file ./welcome-blocks.json','sequenzy templates update tmpl_123 --subject "Updated" --html-file ./welcome-v2.html','sequenzy templates localizations set tmpl_123 es --subject "Hola" --html-file ./welcome-es.html',"sequenzy templates localizations sync tmpl_123 --locale es fr"]});var uCe=fi.command("list").description("List templates, newest first").option("--label <labels...>","Filter by label name").option("--templates-only","Only reusable master designs (emails marked as templates)").option("-l, --limit <number>","Templates per page, 1-100 (default: 50)").option("--offset <number>","Templates to skip before returning results").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>xa("list",e));S(uCe,{notes:["Returns 50 templates per call by default. When pagination.hasMore is true, re-run with --offset advanced by pagination.count to read the rest.","Templates are every saved email body - standalone templates plus the bodies behind campaigns and transactional emails - so the count grows with your campaign history."],examples:["sequenzy templates list --company comp_123","sequenzy templates list --label edm --company comp_123","sequenzy templates list --templates-only --json","sequenzy templates list --limit 100 --json","sequenzy templates list --limit 100 --offset 100 --json"]});var dCe=fi.command("get <id>").description("Get template details").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>xa("get",{id:e,...t}));S(dCe,{examples:["sequenzy templates get tmpl_123 --company comp_123"]});var pCe=jB(fi.command("render <id>").description("Render a template to email-ready HTML")).action((e,t)=>cb({type:"template",id:e},t));S(pCe,{notes:HB,examples:["sequenzy templates render tmpl_123 --out preview.html","sequenzy templates render tmpl_123 --email you@example.com --var plan=Pro --json"]});var mCe=zB(fi.command("check <id>").description("Check a template: broken links and images, placeholders, content and client issues")).action((e,t)=>lb({type:"template",id:e},t));S(mCe,{notes:MB,examples:["sequenzy templates check tmpl_123","sequenzy templates check tmpl_123 --var resetUrl=https://acme.io/reset --json"]});var fCe=fi.command("create <name>").description("Create a template").option("-s, --subject <subject>","Email subject (optional with --prompt)").option("--preview-text <text>","Email preview text override").option("--prompt <prompt>","Generate branded native blocks from a prompt").option("--style <style>","Prompt generation style. Pass designed or plain to force the designed or plain-text email style; other values are freeform guidance (defaults to the company's email style preference)").option("--tone <tone>","Prompt generation tone").option("--html <html>","Email HTML content").option("--html-file <file>","Read HTML from file").option("--blocks-json <json>","Inline JSON array of Sequenzy email blocks").option("--blocks-file <file>","Path to a JSON file with Sequenzy email blocks").option("--label <labels...>","Label names to assign").option("--template","Save as a reusable master design that sequence steps and campaigns can start from").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>xa("create",{name:e,...t}));S(fCe,{notes:["Provide exactly one of prompt, HTML, or blocks JSON content.","Use blocks when you need conditional content, per-block styles, or exact editor parity."],examples:['sequenzy templates create welcome --prompt "Welcome new customers"','sequenzy templates create welcome --subject "Welcome" --html-file ./welcome.html','sequenzy templates create welcome --subject "Welcome" --label edm template --html-file ./welcome.html','sequenzy templates create welcome --subject "Welcome" --blocks-file ./welcome-blocks.json']});var gCe=fi.command("from-example <example>").description("Remix an email gallery example into a new template written for your brand").option("--brief <text>","Extra direction for the new email (takes priority over the example)").option("--name <name>","Template name (defaults to the generated subject)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>rM(e,t));S(gCe,{notes:["<example> is a gallery email URL (https://sequenzy.com/email-examples/brands/{brand}/emails/{email}, or a sequence page URL ending in #email-{email} for an email in a sequence) or brand/email.","Keeps the example's exact layout; every word is rewritten for your company and your logo, brand color and links are swapped in. Saved as an HTML template. The example brand is never named in the new email.","Saved as a reusable template. Nothing is saved if generation fails; running the command again creates another template."],examples:["sequenzy templates from-example https://sequenzy.com/email-examples/brands/linear/emails/welcome-to-linear",'sequenzy templates from-example linear/welcome-to-linear --brief "Mention our 14-day trial"']});var ACe=fi.command("preview-example <example>").description("Preview an email gallery example written for your brand, without saving").option("--website <site>","Write it for another website instead of your brand, e.g. acme.com").option("--brief <text>","Extra direction for the email (takes priority over the example)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON, including the HTML").action((e,t)=>cM(e,t));S(ACe,{notes:["<example> is a gallery email URL (https://sequenzy.com/email-examples/brands/{brand}/emails/{email}, or a sequence page URL ending in #email-{email}) or brand/email.","Same rewrite as sequenzy templates from-example, but nothing is saved. Run from-example to keep it as a template."],examples:["sequenzy templates preview-example linear/welcome-to-linear","sequenzy templates preview-example linear/welcome-to-linear --website acme.com --json"]});var hCe=fi.command("update <id>").description("Update a template").option("-n, --name <name>","Template name").option("-s, --subject <subject>","Email subject").option("--preview-text <text>","Inbox preview text").option("--html <html>","Email HTML content").option("--html-file <file>","Read HTML from file").option("--blocks-json <json>","Inline JSON array of Sequenzy email blocks").option("--blocks-file <file>","Path to a JSON file with Sequenzy email blocks").option("--label <labels...>","Replace label names").option("--template","Mark as a reusable master design").option("--no-template","Remove the reusable master design mark").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>xa("update",{id:e,...t}));S(hCe,{notes:["Provide at least one of --name, --subject, --preview-text, --label, --template/--no-template, --html, --html-file, --blocks-json, or --blocks-file.","Do not combine HTML flags with blocks flags in the same request."],examples:['sequenzy templates update tmpl_123 --subject "Updated"','sequenzy templates update tmpl_123 --preview-text "A warmer inbox preview"',"sequenzy templates update tmpl_123 --label edm template","sequenzy templates update tmpl_123 --html-file ./welcome-v2.html","sequenzy templates update tmpl_123 --blocks-file ./welcome-v2-blocks.json"]});var Nv=fi.command("localizations").description("Manage localized template variants").action(()=>Nv.help());S(Nv,{notes:["Set stores caller-supplied localized content immediately.","Sync queues AI translation for selected locales, or every enabled non-primary locale when --locale is omitted."],examples:['sequenzy templates localizations set tmpl_123 es --subject "Hola" --html-file ./welcome-es.html',"sequenzy templates localizations sync tmpl_123 --locale es fr","sequenzy templates localizations sync tmpl_123"]});var yCe=Nv.command("set <id> <locale>").description("Create or replace a localized template variant").requiredOption("-s, --subject <subject>","Localized email subject").option("--preview-text <text>","Localized email preview text").option("--html <html>","Localized email HTML content").option("--html-file <file>","Read localized HTML from file").option("--blocks-json <json>","Inline JSON array of localized Sequenzy email blocks").option("--blocks-file <file>","Path to a JSON file with localized Sequenzy email blocks").option("--keep-edits","Protect this localization from automatic translation on save").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t,n)=>xa("set-localization",{id:e,locale:t,...n}));S(yCe,{notes:["The locale must be enabled in the company's localization settings and cannot be the primary locale.","Provide exactly one HTML or blocks content source.","Without --keep-edits, saving the template retranslates it when automatic translation is on."],examples:['sequenzy templates localizations set tmpl_123 es --subject "Hola" --html-file ./welcome-es.html','sequenzy templates localizations set tmpl_123 fr-CA --subject "Bienvenue" --blocks-file ./welcome-fr-ca.json']});var bCe=Nv.command("sync <id>").description("Queue AI translation for template locales").option("--locale <locales...>","Enabled locales to sync; omit to sync every non-primary locale").option("--skip-edited","Keep localizations someone edited instead of retranslating them").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>xa("sync-localizations",{id:e,locales:t.locale,...t.skipEdited===!0&&{skipEdited:!0},company:t.company,json:t.json}));S(bCe,{examples:["sequenzy templates localizations sync tmpl_123 --locale es fr","sequenzy templates localizations sync tmpl_123","sequenzy templates localizations sync tmpl_123 --skip-edited"]});var vCe=fi.command("delete <id>").description("Delete a template").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>xa("delete",{id:e,...t}));S(vCe,{notes:["Deletion fails when the template is still referenced by a campaign or sequence."],examples:["sequenzy templates delete tmpl_123"]});var ECe=fi.command("share <id>").description("Create or fetch the email's public view-in-browser link").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>xa("share",{id:e,...t}));S(ECe,{notes:["Accepts an email ID or a transactional email's ID or slug, so transactional and sequence emails can be shared with the ID you already hold.","The hosted page is anonymized: sample contact, inert unsubscribe link, no open/click tracking.","Idempotent - rerunning returns the same URL until you run `templates unshare`.","Campaigns have their own link that follows the A/B winner - use `campaigns share`."],examples:["sequenzy templates share tmpl_123","sequenzy templates share order-confirmation"]});var ICe=fi.command("unshare <id>").description("Revoke the email's public view-in-browser link").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>xa("unshare",{id:e,...t}));S(ICe,{notes:["The shared URL returns 404 immediately after revocation."],examples:["sequenzy templates unshare tmpl_123"]});var Tp=Je.command("companies").description("Inspect or create companies").action(()=>Tp.help());S(Tp,{notes:["Creating a company with a domain starts background website processing automatically; --without-website creates a ready company."],examples:["sequenzy companies list","sequenzy companies get comp_123","sequenzy companies update comp_123 --primary-color '#0ea5e9'","sequenzy companies create example.com --name Example"]});var CCe=Tp.command("list").description("List accessible companies").option("--json","Print raw JSON").action((e)=>Sf("list",e));S(CCe,{examples:["sequenzy companies list"]});var wCe=Tp.command("get <id>").description("Get company details").option("--json","Print raw JSON").action((e,t)=>Sf("get",{id:e,...t}));S(wCe,{examples:["sequenzy companies get comp_123"]});var SCe=Tp.command("update <id>").description("Update company info, brand context, and reply tracking").option("-n, --name <name>","Company display name").option("--description <text>","Short product or company summary").option("--description-file <path>","Read description from a file").option("--logo-url <url>","Public logo URL").option("--founder-name <name>","Founder or sender name").option("--primary-color <hex>","Primary brand color, e.g. #f97316").option("--brand-colors-json <json>","Brand colors object as JSON").option("--brand-colors-file <path>","Read brand colors JSON from a file").option("--value-props-json <json>","Value propositions array as JSON").option("--value-props-file <path>","Read value propositions JSON from a file").option("--testimonials-json <json>","Testimonials array as JSON").option("--testimonials-file <path>","Read testimonials JSON from a file").option("--tone-voice <text>","Tone of voice guidance").option("--company-context <text>","Product knowledge for AI writing").option("--company-context-file <path>","Read product knowledge from a file").option("--email-design-prompt <text>","Art direction for AI-designed emails (layout, density, imagery)").option("--email-design-prompt-file <path>","Read the design prompt from a file").option("--email-length-preference <value>","Email length: concise, balanced, or detailed (new workspaces default to concise)").option("--email-style <style>","How AI writes emails by default: visual (designed), plain (simple text), or ask (clear the choice)").option("--email-preset <preset>","Default header and footer: branded (logo and full footer) or minimal (compact footer, no logo)").option("--social-links-json <json>","Social links object as JSON").option("--social-links-file <path>","Read social links JSON from a file").option("--privacy-policy-url <url>","Privacy policy URL").option("--terms-url <url>","Terms of service URL").option("--address <address>","Physical mailing address").option("--language <code>","Primary language code").option("--pricing-json <json>","Pricing object as JSON").option("--pricing-file <path>","Read pricing JSON from a file").option("--font-family <family>","Default email font family").option("--email-theme-json <json>","Default email theme as JSON (partial: presetId, colors, typography, layout; pass null to reset)").option("--email-theme-file <path>","Read the default email theme JSON from a file").option("--email-direction <direction>","Default email direction: ltr or rtl").option("--sender-profile-id <id>","Existing sender profile to make the default (see `sequenzy sender-profiles list`)").option("--from-email <email>","Account-wide default From address (domain must be verified)").option("--from-name <name>","Display name of the default From profile (alone, it renames the current one)").option("--reply-profile-id <id>","Existing reply profile to make the default (see `sequenzy sender-profiles list`)").option("--reply-to <email>","Account-wide default Reply-To address").option("--reply-to-name <name>","Display name of the default Reply-To profile (alone, it renames the current one)").option("--enable-reply-tracking","Enable inbound reply tracking").option("--disable-reply-tracking","Disable inbound reply tracking").option("--reply-tracking-domain-mode <mode>","Reply domain mode: sequenzy or custom").option("--enable-reply-forwarding","Enable captured reply forwarding").option("--disable-reply-forwarding","Disable captured reply forwarding").option("--default-list <id>","List new contacts join by default when nothing targets them (repeatable)",(e,t=[])=>[...t,e]).option("--default-lists-none","New contacts join no list unless something targets them").option("--rename-matching-footers","Rename exact matching footer names in editable emails and saved components; requires --name and --previous-company-name").option("--previous-company-name <name>","Current company name to match when renaming footers").option("--default-lists-all","New contacts join every current and future list").option("--json","Print raw JSON").action((e,t)=>Sf("update",{id:e,...t}));S(SCe,{notes:["The default-list flags set which lists a new contact joins when nothing targets it explicitly - forms, API writes, events, imports, and live ingestion from integrations without their own list targeting (Dodo Payments, PostHog, WooCommerce). Payment-provider backfills follow this setting; PostHog history imports instead create contacts without list memberships. `companies get <id>` reports the current value.","`--default-lists-all`, `--default-lists-none`, and `--default-list` are three different things: all lists, no list at all, and exactly the listed ones. They are mutually exclusive.","Changing this only affects later writes. Nobody is moved or removed from a list retroactively, so a list already polluted by a backfill still needs `sequenzy lists remove-subscribers`.","The default-list flags need an API key with the companies:manage scope. In the dashboard the same setting lives under Contacts -> Lists -> Default Lists.","`--enable-reply-tracking` turns Inbox on. A workspace that has never received a conversation needs a verified receiving domain first (otherwise the API answers 409 receiving_domain_required): add one with `sequenzy receiving-domains add <domain>`, and Inbox turns on by itself once its DNS records are verified."],examples:["sequenzy companies update comp_123 --primary-color '#0ea5e9'","sequenzy companies update comp_123 --default-list list_abc --default-list list_def","sequenzy companies update comp_123 --default-lists-none",`sequenzy companies update comp_123 --email-theme-json '{"colors":{"mutedText":"#4b5563"},"typography":{"baseFontSize":16}}'`,"sequenzy companies update comp_123 --company-context-file ./product.md --tone-voice 'clear, direct, warm'","sequenzy companies update comp_123 --from-name 'Example'","sequenzy companies update comp_123 --sender-profile-id sender_abc123 --from-name 'Example News'","sequenzy companies update comp_123 --enable-reply-tracking --reply-tracking-domain-mode sequenzy",`sequenzy companies update comp_123 --value-props-json '[{"title":"Fast setup","description":"Launch lifecycle emails in minutes."}]'`]});var DCe=Tp.command("create [domain]").description("Create a company with or without a website").option("-n, --name <name>","Company name").option("--without-website","Start without a website (requires --name)").option("-d, --description <text>","Business description, up to 500 characters. With a domain, website processing may replace it").option("--description-file <path>","Read the business description from a file").option("--with-welcome-sequence","Create and generate the four-email welcome sequence").option("--json","Print raw JSON").action((e,t)=>Sf("create",{domain:e,...t}));S(DCe,{examples:["sequenzy companies create example.com","sequenzy companies create https://example.com --name Example",'sequenzy companies create --without-website --name Acme --description "Meal plans for night-shift nurses" --with-welcome-sequence']});var Ro=Je.command("accounts").description("Manage your customers' accounts (B2B organizations) and their members").option("--search <text>","Match name, external ID or domain").option("--page <n>","Page number").option("--limit <n>","Results per page (max 100)").option("--sort <field>","Sort by updatedAt, createdAt, name, memberCount or lastEventAt").option("--order <dir>","asc or desc").option("--without-event-recipients","Only accounts with members but no owner or admin").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>Ri("list",e));S(Ro,{notes:["Running `sequenzy accounts` without a subcommand lists accounts.","These are your customers' organizations. For your own Sequenzy login, API key and workspaces, use `sequenzy account`.","The first account turns Accounts on for the workspace. It fails with a 409 error if contacts already use a custom attribute named `account` or `account.*`; rename that attribute first.","Accounts are identified by your own external ID (the organization or workspace id in your app).","Account attributes fan out to every member as `account.<name>` for segments and `{{account.<name>}}` merge tags."],examples:["sequenzy accounts list --search acme","sequenzy accounts get org_123","sequenzy accounts upsert org_123 --name Acme --domain acme.com --attr plan=pro --attr seats=5","sequenzy accounts add-member org_123 --email jane@acme.com --role owner","sequenzy accounts event org_123 trial_ending --property daysLeft=3 --recipients owners","sequenzy accounts suggestions","sequenzy accounts detect-org-ids"]});var BCe=Ro.command("list").description("List accounts").option("--search <text>","Match name, external ID or domain").option("--page <n>","Page number").option("--limit <n>","Results per page (max 100)").option("--sort <field>","updatedAt, createdAt, name, memberCount, lastEventAt").option("--order <dir>","asc or desc").option("--without-event-recipients","Only accounts with members but no owner or admin").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Ri("list",t.optsWithGlobals()));S(BCe,{notes:["Account events go to owners (or admins) by default. `--without-event-recipients` finds accounts whose alerts reach nobody, such as bulk-created accounts where everyone is a member."],examples:["sequenzy accounts list --sort memberCount --order desc","sequenzy accounts list --without-event-recipients"]});var xCe=Ro.command("get <externalId>").description("Show an account and its members").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Ri("get",{externalId:e,...t}));S(xCe,{examples:["sequenzy accounts get org_123"]});var _Ce=Ro.command("upsert <externalId>").description("Create or update an account by external ID").option("--name <name>","Display name").option("--domain <domain>","Primary domain, e.g. acme.com").option("--attr <key=value>","Account attribute (repeatable). `key=` clears a key.",(e,t=[])=>[...t,e]).option("--replace-attributes","Replace all attributes instead of merging").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Ri("upsert",{externalId:e,...t}));S(_Ce,{notes:["Numbers and booleans in --attr are coerced; everything else stays a string."],examples:["sequenzy accounts upsert org_123 --name Acme --attr plan=pro --attr seats=5","sequenzy accounts upsert org_123 --attr legacyPlan="]});var kCe=Ro.command("delete <externalId>").description("Delete an account (contacts are kept)").option("-y, --yes","Skip the confirmation prompt").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Ri("delete",{externalId:e,...t}));S(kCe,{examples:["sequenzy accounts delete org_123 --yes"]});var RCe=Ro.command("members <externalId>").description("List account members with roles").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Ri("members",{externalId:e,...t}));S(RCe,{examples:["sequenzy accounts members org_123"]});var QCe=Ro.command("add-member <externalId>").description("Add a contact to an account").option("--email <email>","Contact email (created when new)").option("--subscriber-external-id <id>","Contact external ID").option("--role <role>","owner, admin or member").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Ri("add-member",{externalId:e,...t}));S(QCe,{notes:["Re-adding a member without --role keeps the current role."],examples:["sequenzy accounts add-member org_123 --email jane@acme.com --role owner"]});var TCe=Ro.command("remove-member <externalId>").description("Remove a contact from an account").option("--email <email>","Contact email").option("--subscriber-external-id <id>","Contact external ID").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Ri("remove-member",{externalId:e,...t}));S(TCe,{examples:["sequenzy accounts remove-member org_123 --email bob@acme.com"]});var $Ce=Ro.command("events <externalId>").description("List recent account events").option("--limit <n>","Number of events (max 500)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Ri("events",{externalId:e,...t}));S($Ce,{examples:["sequenzy accounts events org_123 --limit 20"]});var NCe=Ro.command("event <externalId> <event>").description("Trigger an account event and deliver it to members").option("--property <key=value>","Event property (repeatable)",(e,t=[])=>[...t,e]).option("--recipients <rule>","owners (default), admins, all or none").option("--event-id <id>","Idempotency key for retries").option("--occurred-at <timestamp>","Original event time (ISO 8601)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t,n)=>Ri("event",{externalId:e,event:t,...n}));S(NCe,{notes:["Recipients receive the event as a contact event with `event.account.*` properties, so sequences and sync rules run per person.","Owners fall back to admins when an account has no owner."],examples:["sequenzy accounts event org_123 trial_ending --property daysLeft=3","sequenzy accounts event org_123 seat_limit_reached --recipients admins"]});var OCe=Ro.command("suggestions").description("Suggest accounts from work email domains contacts share").option("--min-contacts <n>","Contacts a domain needs (default 3)").option("--limit <n>","Number of suggestions (default 25, max 100)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>Ri("suggestions",e));S(OCe,{notes:["Skips personal and disposable email providers, your own sending domains, domains where any contact already belongs to an account, and domains an account already uses. Shows up to three sample emails per domain.","Read-only: nothing is created until you run `accept-suggestions`."],examples:["sequenzy accounts suggestions","sequenzy accounts suggestions --min-contacts 5 --json"]});var PCe=Ro.command("accept-suggestions <domains...>").description("Create accounts from suggested email domains").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Ri("accept-suggestions",{domains:e,...t}));S(PCe,{notes:["Each domain becomes an account (external ID and domain set to the domain) with the domain's contacts as members. Contacts already in another account stay there, and a domain already partly grouped is skipped.","When one account already uses the domain, contacts are added to it instead. Up to 25 domains per call; safe to retry. No sync rules or segment-entered sequences run."],examples:["sequenzy accounts accept-suggestions acme.com globex.com"]});var FCe=Ro.command("detect-org-ids").description("Find the organization ID your app already sends in events or contact attributes").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>wf("detect",e));S(FCe,{notes:["Looks for event properties from the last 180 days and contact attributes named like workspaceId, organization_id, team_id or account_id, with how many organizations each holds and the matching name key when there is one.","Read-only. Preview a key with `preview-org-id` before creating accounts from it."],examples:["sequenzy accounts detect-org-ids","sequenzy accounts detect-org-ids --json"]});var qCe=Ro.command("preview-org-id <propertyKey>").description("Preview the accounts an organization ID would create").option("--source <source>","event (default) or attribute").option("--name-key <key>","Property or attribute with the organization name").option("--limit <n>","Organizations to show (default 5, max 50)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>wf("preview",{propertyKey:e,...t}));S(qCe,{notes:["Shows the biggest organizations first: the name each account would get (from --name-key, otherwise the work email domain most of its contacts share), its contact count and sample emails.","Read-only: nothing is created until you run `create-from-org-id`."],examples:["sequenzy accounts preview-org-id workspaceId","sequenzy accounts preview-org-id account_id --source attribute --name-key company_name --limit 20"]});var LCe=Ro.command("create-from-org-id <propertyKey>").description("Create one account per organization ID and add its contacts").option("--source <source>","event (default) or attribute").option("--name-key <key>","Property or attribute with the organization name").option("--wait","Wait until the accounts are created").option("-y, --yes","Skip the preview and confirmation").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>wf("create",{propertyKey:e,...t}));S(LCe,{notes:["Shows a preview and asks before starting. Runs in the background; use --wait to wait, or check with `org-id-job`.","Accounts are named from --name-key, otherwise after the work email domain their contacts share. Existing names, domains and roles are kept, no emails are sent and no sequences start. Safe to rerun."],examples:["sequenzy accounts create-from-org-id workspaceId","sequenzy accounts create-from-org-id workspaceId --name-key workspaceName --yes --wait"]});var UCe=Ro.command("org-id-job <jobId>").description("Check a create-from-org-id run").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>wf("job",{jobId:e,...t}));S(UCe,{notes:["States: queued, running, completed (with accounts and memberships created) or failed (with the error)."],examples:["sequenzy accounts org-id-job backfill-accounts:comp_123:workspaceId"]});var fg=Je.command("tags").description("Manage tag definitions").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>_p("list",e));S(fg,{notes:["Running `sequenzy tags` without a subcommand lists tag definitions.","Tag names are normalized to lowercase with dashes; system tags cannot be changed or deleted."],examples:["sequenzy tags --company comp_123","sequenzy tags list","sequenzy tags create vip --color purple","sequenzy tags update tag_123 --color red","sequenzy tags delete tag_123 --yes"]});var jCe=fg.command("list").description("List tag definitions").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>_p("list",e));S(jCe,{examples:["sequenzy tags list --company comp_123"]});var zCe=fg.command("create <name>").description("Create a tag definition").option("--color <color>","Tag color, e.g. gray, red, green, blue, purple").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>_p("create",{name:e,...t}));S(zCe,{notes:["Names are normalized to lowercase with dashes, so `VIP Customer` becomes `vip-customer`."],examples:["sequenzy tags create vip","sequenzy tags create vip --color purple"]});var MCe=fg.command("update <tagId>").description("Update a tag definition color").requiredOption("--color <color>","New tag color").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>_p("update",{tagId:e,...t}));S(MCe,{notes:["System tags cannot be updated."],examples:["sequenzy tags update tag_123 --color red"]});var HCe=fg.command("delete <tagId>").description("Delete a tag definition").option("-y, --yes","Skip the confirmation prompt").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>_p("delete",{tagId:e,...t}));S(HCe,{notes:["Deleting a tag removes it from every subscriber.","Tags used by sequences cannot be deleted until those sequences stop referencing them."],examples:["sequenzy tags delete tag_123 --yes"]});var uc=Je.command("lists").description("Manage subscriber lists").action(()=>uc.help());S(uc,{examples:["sequenzy lists list --company comp_123",'sequenzy lists create Newsletter --description "Public newsletter list"','sequenzy lists update list_123 --name "Weekly Newsletter" --private',"sequenzy lists add-subscribers list_123 --emails-file ./batch-001.csv","sequenzy lists remove-subscribers list_123 --email one@example.com","sequenzy lists import list_123 --emails-file ./batch-001.csv","sequenzy lists delete list_123 --yes"]});var GCe=uc.command("list").description("List subscriber lists").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>ll("list",e));S(GCe,{examples:["sequenzy lists list --company comp_123"]});var JCe=uc.command("create <name>").description("Create a subscriber list").option("-d, --description <text>","List description").option("--private","Mark the list as private").option("--allow-member-unsubscribe","Allow existing private-list members to opt out").option("--no-allow-member-unsubscribe","Hide private lists from member preferences").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ll("create",{name:e,...t}));S(JCe,{examples:['sequenzy lists create Newsletter --description "Public newsletter list"',"sequenzy lists create VIP --private --company comp_123"]});var VCe=uc.command("add-subscribers <listId>").description("Add subscribers to a list from emails, JSON, or a file").option("-e, --email <emails...>","Email addresses to add").option("--emails-json <json>","JSON array of emails, or an object with emails/subscribers").option("--emails-file <file>","JSON, CSV, or newline-separated file with subscriber emails").option("--duplicate-strategy <strategy>","Duplicate strategy: skip, merge, or overwrite","skip").option("--enroll-sequences","Enroll newly created subscribers in matching sequences").option("--opt-in-mode <mode>","Consent mode: default, confirmed, or double_opt_in","default").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ll("add-subscribers",{listId:e,...t}));S(VCe,{notes:["Provide exactly one source: --email, --emails-json, or --emails-file.","Files may be newline-separated, CSV with an email column, a JSON email array, or a JSON object with emails/subscribers.","CSV headers named email, e-mail, email address, or mail are detected; otherwise the first column is used.","New subscribers are not enrolled in matching sequences unless --enroll-sequences is set."],examples:["sequenzy lists add-subscribers list_123 --email one@example.com two@example.com",`sequenzy lists add-subscribers list_123 --emails-json '["one@example.com","two@example.com"]'`,"sequenzy lists add-subscribers list_123 --emails-file ./batch-001.csv"]});var KCe=uc.command("import <listId>").description("Alias for add-subscribers; import subscribers into a list").option("-e, --email <emails...>","Email addresses to add").option("--emails-json <json>","JSON array of emails, or an object with emails/subscribers").option("--emails-file <file>","JSON, CSV, or newline-separated file with subscriber emails").option("--duplicate-strategy <strategy>","Duplicate strategy: skip, merge, or overwrite","skip").option("--enroll-sequences","Enroll newly created subscribers in matching sequences").option("--opt-in-mode <mode>","Consent mode: default, confirmed, or double_opt_in","default").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ll("add-subscribers",{listId:e,...t}));S(KCe,{notes:["`lists import` is an alias for `lists add-subscribers`.","Provide exactly one source: --email, --emails-json, or --emails-file.","Files may be newline-separated, CSV with an email column, a JSON email array, or a JSON object with emails/subscribers.","CSV headers named email, e-mail, email address, or mail are detected; otherwise the first column is used."],examples:["sequenzy lists import list_123 --emails-file ./batch-001.csv",`sequenzy lists import list_123 --emails-json '["one@example.com","two@example.com"]'`]});var WCe=uc.command("update <listId>").description("Update a subscriber list").option("-n, --name <name>","List name").option("-d, --description <text>","List description").option("--private","Mark the list as private").option("--allow-member-unsubscribe","Allow existing private-list members to opt out").option("--no-allow-member-unsubscribe","Hide private lists from member preferences").option("--no-private","Mark the list as public").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ll("update",{listId:e,...t}));S(WCe,{notes:["Provide at least one of --name, --description, --private, --no-private, --allow-member-unsubscribe, or --no-allow-member-unsubscribe."],examples:['sequenzy lists update list_123 --name "Weekly Newsletter"',"sequenzy lists update list_123 --private","sequenzy lists update list_123 --no-private"]});var YCe=uc.command("remove-subscribers <listId>").description("Remove subscribers from a list by email").option("-e, --email <emails...>","Email addresses to remove").option("--emails-json <json>","JSON array of emails, or an object with emails/subscribers").option("--emails-file <file>","JSON, CSV, or newline-separated file with subscriber emails").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ll("remove-subscribers",{listId:e,...t}));S(YCe,{notes:["Provide exactly one source: --email, --emails-json, or --emails-file.","Subscribers are only removed from the list; they stay in your audience.","Emails that do not match a subscriber are reported as not found."],examples:["sequenzy lists remove-subscribers list_123 --email one@example.com two@example.com","sequenzy lists remove-subscribers list_123 --emails-file ./churned.csv"]});var ZCe=uc.command("delete <listId>").description("Delete a subscriber list").option("-y, --yes","Skip the confirmation prompt").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ll("delete",{listId:e,...t}));S(ZCe,{notes:["Deleting a list removes all of its memberships; subscribers themselves are kept."],examples:["sequenzy lists delete list_123 --yes"]});var $u=Je.command("segments").description("Manage segments").action(()=>$u.help());S($u,{notes:["Use --filter-json for arbitrary segment filters. The CLI will fill in missing filter IDs.","Use --match any to create a segment that matches any filter instead of all filters.",'Engagement filters (emailSent, emailDelivered, emailOpened, emailClicked, emailBounced, emailComplained) accept a time range as the value ("24h", "7d", "30d", "90d", "180d", "all"; whole hours go from "1h" to "8760h", and count filters are exact up to "168h"), a specific campaign ("campaign:<campaign_id>"), or an email-type scope ("marketing:<timeRange>" for marketing-policy campaign, automation, and Send API traffic; "transactional:<timeRange>" for transactional-policy sends). Policy scopes use send-time policy snapshots; ambiguous older automation and Send API events without a snapshot are not assigned to either scope. Combine multiple engagement filters with --match all to build things like "bounced campaign A but not campaign B".','Push filters: pushDevice (is/is_not with "any", "web", "ios" or "android") matches active push devices; pushSent, pushDelivered and pushClicked take is/is_not with a time range ("30d", "all") and ignore test sends.'],examples:["sequenzy segments list --company comp_123",'sequenzy segments create --name "Bought Pro" --stripe-product prod_pro',`sequenzy segments create --name "VIP or Churn Risk" --match any --filter-json '[{"field":"tag","operator":"contains","value":"vip"},{"field":"emailOpened","operator":"is_not","value":"30d"}]'`,`sequenzy segments create --name "Bounced A not B" --filter-json '[{"field":"emailBounced","operator":"is","value":"campaign:cmp_abc"},{"field":"emailBounced","operator":"is_not","value":"campaign:cmp_xyz"}]'`,`sequenzy segments create --name "No marketing email this week" --filter-json '[{"field":"emailSent","operator":"is_not","value":"marketing:7d"}]'`,`sequenzy segments create --name "iOS, no push clicks" --filter-json '[{"field":"pushDevice","operator":"is","value":"ios"},{"field":"pushClicked","operator":"is_not","value":"30d"}]'`]});var XCe=$u.command("list").description("List all segments").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>op("list",e));S(XCe,{examples:["sequenzy segments list --company comp_123"]});var ewe=$u.command("create").description("Create a segment").requiredOption("-n, --name <name>","Segment name").option("-c, --company <id>","Company ID override for personal API keys").option("--match <mode>","How filters combine: all or any","all").option("--stripe-product <id>","Stripe product ID to segment on").option("--commerce-product <id>","Commerce product to segment on, as provider:productId (e.g. shopify:42); a bare ID matches any provider").option("--commerce-collection <key>","Commerce collection to segment on, as a collection ID or handle (e.g. skincare); optionally prefixed with a provider").option("--purchase-operator <operator>","Purchase operator (bought, didnt-buy, at-least, less-than)","bought").option("--payments <number>","Payment threshold for at-least/less-than").option("--orders <number>","Order threshold for at-least/less-than with --commerce-product or --commerce-collection").option("--engagement <field>","Email engagement field: emailSent, emailDelivered, emailOpened, emailClicked, emailBounced, or emailComplained").option("--engagement-operator <operator>","Engagement operator: is, is_not, is_temporary_bounce, is_permanent_bounce, at_least, or less_than_count","is").option("--engagement-scope <scope>","Engagement scope: any, marketing, transactional, or campaign","any").option("--engagement-range <range>","Engagement time range: hours such as 6h or 24h, days such as 7d or 30d, or all","all").option("--engagement-campaign <id>","Campaign ID when --engagement-scope is campaign").option("--engagement-count <number>","Event count for at_least/less_than_count engagement operators").option("--filter-json <json>","Raw JSON array of segment filters (IDs are optional)").option("--json","Print raw JSON").action((e)=>op("create",e));S(ewe,{notes:["For array-of-object attributes, positive filters sharing a wildcard array prefix (such as history_events[].venue and history_events[].date) and connected only by AND must match one shared array element. Negative is_not, not_contains, and is_empty filters remain independent."],examples:['sequenzy segments create --name "Bought Pro" --stripe-product prod_pro','sequenzy segments create --name "3+ Pro Payments" --stripe-product prod_pro --purchase-operator at-least --payments 3','sequenzy segments create --name "Starter Kit Buyers" --commerce-product api:prod-starter-kit','sequenzy segments create --name "Repeat Kit Buyers" --commerce-product api:prod-starter-kit --purchase-operator at-least --orders 2','sequenzy segments create --name "Skincare Buyers" --commerce-collection skincare','sequenzy segments create --name "Repeat Skincare Buyers" --commerce-collection skincare --purchase-operator at-least --orders 2','sequenzy segments create --name "Marketing openers" --engagement emailOpened --engagement-scope marketing --engagement-range all','sequenzy segments create --name "Did not open campaign" --engagement emailOpened --engagement-operator is_not --engagement-scope campaign --engagement-campaign cmp_abc',`sequenzy segments create --name "VIP or Churn Risk" --match any --filter-json '[{"field":"tag","operator":"contains","value":"vip"},{"field":"emailOpened","operator":"is_not","value":"30d"}]'`,`sequenzy segments create --name "Bounced A not B" --filter-json '[{"field":"emailBounced","operator":"is","value":"campaign:cmp_abc"},{"field":"emailBounced","operator":"is_not","value":"campaign:cmp_xyz"}]'`]});var twe=$u.command("count <id>").description("Get subscriber count for a segment").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>op("count",{id:e,...t}));S(twe,{examples:["sequenzy segments count seg_123 --company comp_123"]});var nwe=$u.command("update <id>").description("Update a segment name, filters, or join operator").option("-n, --name <name>","Segment name").option("--filters-json <json>","Raw JSON array of segment filters, or an object with a root group").option("--filters-file <file>","Path to a JSON file with segment filters or a root group").option("--join-operator <operator>","How filters combine: and or or").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>op("update",{id:e,...t}));S(nwe,{notes:["Provide at least one of --name, --filters-json, --filters-file, or --join-operator.","Filters replace the existing filter set; missing filter IDs are filled in by the CLI.","For array-of-object attributes, positive filters sharing a wildcard array prefix (such as history_events[].venue and history_events[].date) and connected only by AND must match one shared array element. Negative is_not, not_contains, and is_empty filters remain independent."],examples:['sequenzy segments update seg_123 --name "Churn Risk"',`sequenzy segments update seg_123 --filters-json '[{"field":"tag","operator":"contains","value":"vip"}]'`,"sequenzy segments update seg_123 --join-operator or"]});var rwe=$u.command("delete <id>").description("Delete a segment").option("-y, --yes","Skip the confirmation prompt").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>op("delete",{id:e,...t}));S(rwe,{examples:["sequenzy segments delete seg_123 --yes"]});var wl=Je.command("audience-syncs").description("Sync segments to Meta custom audiences").action(()=>wl.help());S(wl,{notes:["Requires the Meta Ads integration to be connected in the dashboard (Settings -> Integrations).",'Use --template to start from a ready-made segment ("zero-ltv", "no-purchase-1y", "recent-buyers", "high-spenders-ecom", "non-buyers", "engaged"); the segment is created automatically on first use.',"Audiences are add-only: subscribers who leave the segment stay in the Meta audience."],examples:["sequenzy audience-syncs list",'sequenzy audience-syncs create --template recent-buyers --ad-account act_123 --name "Sequenzy - Recent buyers"']});var owe=wl.command("list").description("List audience syncs with schedule and status").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>Au("list",e));S(owe,{examples:["sequenzy audience-syncs list --company comp_123"]});var iwe=wl.command("ad-accounts").description("List the connected Meta ad accounts").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>Au("ad-accounts",e));S(iwe,{examples:["sequenzy audience-syncs ad-accounts"]});var swe=wl.command("create").description("Create an audience sync (segment -> Meta custom audience)").option("--segment <id>","Existing segment ID to sync").option("--template <id>",'Predefined segment template (for example "recent-buyers", "zero-ltv", "no-purchase-1y")').requiredOption("--ad-account <id>","Meta ad account ID (see `sequenzy audience-syncs ad-accounts`)").requiredOption("-n, --name <name>","Audience name in Meta Ads Manager").option("--frequency <frequency>","Sync frequency: hourly, daily, or weekly","daily").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>Au("create",e));S(swe,{examples:['sequenzy audience-syncs create --template recent-buyers --ad-account act_123 --name "Sequenzy - Recent buyers"','sequenzy audience-syncs create --segment seg_123 --ad-account act_123 --name "Sequenzy - VIPs" --frequency hourly']});var awe=wl.command("update <id>").description("Change an audience sync's frequency or pause/resume it").option("--frequency <frequency>","Sync frequency: hourly, daily, or weekly").option("--active <bool>","true to resume, false to pause").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Au("update",{id:e,...t}));S(awe,{examples:["sequenzy audience-syncs update sync_123 --frequency weekly","sequenzy audience-syncs update sync_123 --active false"]});var cwe=wl.command("delete <id>").description("Remove an audience sync (the Meta audience itself is kept)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Au("delete",{id:e,...t}));S(cwe,{examples:["sequenzy audience-syncs delete sync_123"]});var lwe=wl.command("sync <id>").description("Trigger an immediate sync run").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Au("sync",{id:e,...t}));S(lwe,{examples:["sequenzy audience-syncs sync sync_123"]});var Ov=Je.command("warehouse").description("Sync contacts and events from Snowflake, BigQuery, Redshift or Postgres").action(()=>Ov.help());S(Ov,{notes:["Connect a warehouse with a read-only user, then create syncs that run a SELECT query on a schedule.","Subscriber syncs import contacts through the same pipeline as imports; event syncs record events on existing contacts.","Each run only sends rows that changed. Set --cursor-column (for example updated_at) so runs read only new rows."],examples:[`${yl}=... sequenzy warehouse connections create --provider postgres --name Analytics --host db.example.com --database analytics --username reader`,"sequenzy warehouse connections preview conn_123 --query 'select email, plan from customers'",`sequenzy warehouse syncs create --connection conn_123 --name Customers --query-file customers.sql --mapping-json '{"emailColumn":"email","attributes":[{"column":"plan","attribute":"plan"}]}' --cursor-column updated_at`]});var Sl=Ov.command("connections").description("Manage warehouse connections").action(()=>Sl.help());Sl.command("list").description("List warehouse connections").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>bl("list",e));Sl.command("get <id>").description("Show a warehouse connection").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>bl("get",{id:e,...t}));var uwe=Sl.command("create").description("Connect a warehouse (runs a test query before saving)").requiredOption("--provider <provider>","snowflake, bigquery, redshift or postgres").requiredOption("-n, --name <name>","Display name").option("--config-json <json>","Connection settings as JSON (merged with the flags below)").option("--account <account>","Snowflake account identifier").option("--username <user>","Database user").option("--warehouse <warehouse>","Snowflake warehouse").option("--database <database>","Database name").option("--schema <schema>","Snowflake schema").option("--role <role>","Snowflake role").option("--project-id <id>","BigQuery project ID").option("--location <location>","BigQuery location, for example US").option("--host <host>","Redshift/Postgres host").option("--port <port>","Redshift/Postgres port").option("--ssl-mode <mode>","require or verify-full").option("--private-key-file <path>","Snowflake PKCS#8 private key (PEM file)").option("--private-key-passphrase <passphrase>","Passphrase for an encrypted key").option("--service-account-file <path>","BigQuery service account key (JSON file)").option("--password <password>",`Redshift/Postgres password (or set ${yl})`).option("--credentials-file <path>","All credentials as a JSON file").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>bl("create",e));S(uwe,{examples:["sequenzy warehouse connections create --provider snowflake --name Snowflake --account myorg-myaccount --username SEQUENZY_READER --warehouse ANALYTICS_WH --database PROD --private-key-file rsa_key.p8","sequenzy warehouse connections create --provider bigquery --name BigQuery --project-id acme-analytics --service-account-file key.json",`${yl}=... sequenzy warehouse connections create --provider redshift --name Redshift --host cluster.abc.us-east-1.redshift.amazonaws.com --database analytics --username reader`]});Sl.command("update <id>").description("Rename, change settings or rotate credentials (re-tested before saving)").option("-n, --name <name>","Display name").option("--config-json <json>","Connection settings as JSON (merged with the flags below)").option("--account <account>","Snowflake account identifier").option("--username <user>","Database user").option("--warehouse <warehouse>","Snowflake warehouse").option("--database <database>","Database name").option("--schema <schema>","Snowflake schema").option("--role <role>","Snowflake role").option("--project-id <id>","BigQuery project ID").option("--location <location>","BigQuery location, for example US").option("--host <host>","Redshift/Postgres host").option("--port <port>","Redshift/Postgres port").option("--ssl-mode <mode>","require or verify-full").option("--private-key-file <path>","Snowflake PKCS#8 private key (PEM file)").option("--private-key-passphrase <passphrase>","Passphrase for an encrypted key").option("--service-account-file <path>","BigQuery service account key (JSON file)").option("--password <password>","New Redshift/Postgres password").option("--password-from-env",`Rotate the Redshift/Postgres password to ${yl}`).option("--credentials-file <path>","All credentials as a JSON file").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>bl("update",{id:e,...t}));Sl.command("delete <id>").description("Delete a connection (delete its syncs first)").option("-y, --yes","Skip the confirmation prompt").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>bl("delete",{id:e,...t}));Sl.command("test <id>").description("Run a test query with the stored credentials").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>bl("test",{id:e,...t}));Sl.command("preview <id>").description("Run a query with a 20-row limit to see its columns").option("--query <sql>","SELECT query").option("--query-file <path>","File with the SELECT query").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>bl("preview",{id:e,...t}));var Dl=Ov.command("syncs").description("Manage warehouse syncs").action(()=>Dl.help());Dl.command("list").description("List syncs with status and the latest run").option("--connection <id>","Only syncs of this connection").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>vl("list",e));Dl.command("get <id>").description("Show a sync").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>vl("get",{id:e,...t}));var dwe=Dl.command("create").description("Create a sync (columns are checked against the query; the first run starts now)").requiredOption("--connection <id>","Warehouse connection ID").requiredOption("-n, --name <name>","Display name").option("--kind <kind>","subscribers or events","subscribers").option("--query <sql>","SELECT query").option("--query-file <path>","File with the SELECT query").option("--mapping-json <json>","Column mapping as JSON").option("--mapping-file <path>","Column mapping as a JSON file").option("--cursor-column <column>","Column for incremental reads (for example updated_at)").option("--frequency <frequency>","every_15_minutes, hourly, daily, weekly or manual").option("--lists <ids>","Comma-separated list IDs for new contacts (subscriber syncs)").option("--opt-in-mode <mode>","confirmed or double_opt_in (subscriber syncs)").option("--trigger-automations","Let new contacts or recent events start automations").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>vl("create",e));S(dwe,{notes:['Subscriber mapping: {"emailColumn","phoneColumn","externalIdColumn","firstNameColumn","lastNameColumn","tagsColumn","attributes":[{"column","attribute"}]}.','Event mapping: {"emailColumn" or "externalIdColumn", "eventNameColumn" or "eventName", "eventIdColumn", "occurredAtColumn", "properties":[{"column","property"}]}.'],examples:[`sequenzy warehouse syncs create --connection conn_123 --name Customers --query 'select email, first_name, plan, updated_at from customers' --mapping-json '{"emailColumn":"email","firstNameColumn":"first_name","attributes":[{"column":"plan","attribute":"plan"}]}' --cursor-column updated_at --frequency hourly`,`sequenzy warehouse syncs create --connection conn_123 --name Orders --kind events --query-file orders.sql --mapping-json '{"emailColumn":"email","eventName":"order_placed","eventIdColumn":"order_id","occurredAtColumn":"placed_at"}'`]});Dl.command("update <id>").description("Change the query, mapping, schedule or options; pause or resume").option("-n, --name <name>","Display name").option("--query <sql>","SELECT query").option("--query-file <path>","File with the SELECT query").option("--mapping-json <json>","Column mapping as JSON").option("--mapping-file <path>","Column mapping as a JSON file").option("--cursor-column <column>","Column for incremental reads (for example updated_at)").option("--frequency <frequency>","every_15_minutes, hourly, daily, weekly or manual").option("--lists <ids>","Comma-separated list IDs for new contacts (subscriber syncs)").option("--opt-in-mode <mode>","confirmed or double_opt_in (subscriber syncs)").option("--trigger-automations","Let new contacts or recent events start automations").option("--no-trigger-automations","Stop starting automations").option("--enabled <bool>","true to resume, false to pause").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>vl("update",{id:e,...t}));Dl.command("delete <id>").description("Delete a sync (imported contacts and events stay)").option("-y, --yes","Skip the confirmation prompt").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>vl("delete",{id:e,...t}));Dl.command("run <id>").description("Run a sync now").option("--full-resync","Forget what was sent and send every row again").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>vl("run",{id:e,...t}));Dl.command("runs <id>").description("Show recent runs with row counts, import progress and errors").option("--limit <n>","Number of runs (1-100, default 20)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>vl("runs",{id:e,...t}));var ka=Je.command("data-exports").description("Stream events and subscriber snapshots to your S3 or GCS bucket").action(()=>ka.help());S(ka,{notes:["Files are gzipped JSON lines under <prefix>/<dataset>/date=YYYY-MM-DD/, ready for Snowflake, BigQuery, Redshift, Athena or DuckDB.","Datasets: email_events, sms_events, custom_events, subscribers (daily snapshot). Rows are delivered at least once; deduplicate on id.",`Pass the secret with --secret-access-key or the ${Ca} environment variable. It is never returned by the API.`],examples:["sequenzy data-exports list",`${Ca}=... sequenzy data-exports create --name "Lake" --bucket acme-exports --region us-east-1 --access-key-id AKIA...`,"sequenzy data-exports runs exp_123"]});var pwe=ka.command("list").description("List data exports with progress and status").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>tc("list",e));S(pwe,{examples:["sequenzy data-exports list --json"]});var mwe=ka.command("get <id>").description("Show one data export").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>tc("get",{id:e,...t}));S(mwe,{examples:["sequenzy data-exports get exp_123"]});var fwe=ka.command("create").description("Add a bucket destination (verifies access with a test file)").requiredOption("-n, --name <name>","Display name").option("--provider <provider>","s3 (AWS or S3-compatible) or gcs","s3").requiredOption("--bucket <bucket>","Bucket name").option("--region <region>","Bucket region (required for AWS S3)").option("--endpoint <url>","Custom S3-compatible endpoint (R2, MinIO, Backblaze)").option("--prefix <path>","Path prefix inside the bucket").requiredOption("--access-key-id <id>","Access key ID (GCS: HMAC access ID)").option("--secret-access-key <secret>",`Secret access key (or set ${Ca})`).option("--datasets <list>","Comma-separated: email_events,sms_events,custom_events,subscribers").option("--frequency <frequency>","every_5_minutes, every_15_minutes, hourly or daily").option("--backfill-days <days>","Include up to 30 days of events already recorded (default 0)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>tc("create",e));S(fwe,{examples:[`${Ca}=... sequenzy data-exports create --name "Lake" --bucket acme-exports --region us-east-1 --access-key-id AKIA... --prefix sequenzy`,`${Ca}=... sequenzy data-exports create --name "GCS" --provider gcs --bucket acme --access-key-id GOOG1... --datasets email_events,subscribers --backfill-days 7`]});var gwe=ka.command("update <id>").description("Change datasets, frequency, location or credentials; pause or resume").option("-n, --name <name>","Display name").option("--bucket <bucket>","Bucket name").option("--region <region>","Bucket region").option("--endpoint <url>","Custom S3-compatible endpoint").option("--prefix <path>","Path prefix inside the bucket").option("--access-key-id <id>","New access key ID (rotates credentials)").option("--secret-access-key <secret>",`New secret (or set ${Ca})`).option("--datasets <list>","Comma-separated datasets").option("--frequency <frequency>","every_5_minutes, every_15_minutes, hourly or daily").option("--enabled <bool>","true to resume, false to pause").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>tc("update",{id:e,...t}));S(gwe,{examples:["sequenzy data-exports update exp_123 --frequency hourly","sequenzy data-exports update exp_123 --enabled false","sequenzy data-exports update exp_123 --datasets email_events,custom_events"]});var Awe=ka.command("delete <id>").description("Delete a data export (files already written are kept)").option("-y, --yes","Skip the confirmation prompt").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>tc("delete",{id:e,...t}));S(Awe,{examples:["sequenzy data-exports delete exp_123 --yes"]});var hwe=ka.command("test <id>").description("Write a test file to confirm the credentials still work").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>tc("test",{id:e,...t}));S(hwe,{examples:["sequenzy data-exports test exp_123"]});var ywe=ka.command("run <id>").description("Start an export now instead of waiting for the schedule").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>tc("run",{id:e,...t}));S(ywe,{examples:["sequenzy data-exports run exp_123"]});var bwe=ka.command("runs <id>").description("Show recent export runs (last 14 days)").option("--limit <n>","Number of runs (1-100, default 20)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>tc("runs",{id:e,...t}));S(bwe,{examples:["sequenzy data-exports runs exp_123 --limit 5"]});var Bl=Je.command("products").description("Manage products and digital delivery files").action(()=>Bl.help());S(Bl,{notes:["Products sync from Stripe, Shopify, and WooCommerce integrations.","Attach a deliverable file to a Stripe product, then reference it in purchase sequence emails with {{event.download.url}} and {{event.download.name}}."],examples:["sequenzy products list --provider stripe","sequenzy products sync",'sequenzy products upsert my-ebook --title "The Ebook" --price-cents 1900 --file ./ebook.pdf',"sequenzy products attach-file prod_abc --file ./guide.pdf","sequenzy products attach-file prod_abc --url https://example.com/guide.pdf --name guide.pdf","sequenzy products detach-file prod_abc","sequenzy products delete my-ebook"]});var vwe=Bl.command("list").description("List synced products including attached delivery files").option("-c, --company <id>","Company ID override for personal API keys").option("--provider <provider>","Filter by provider (stripe, shopify, woocommerce, manual)").option("--search <query>","Filter products by title").option("--limit <number>","Products per page (1-100, default 50)").option("--offset <number>","Number of products to skip").option("--all","Fetch every page instead of just the first").option("--json","Print raw JSON").action((e)=>yu("list",e));S(vwe,{notes:["Returns one page by default. The header shows 'N of TOTAL' when the catalog is larger than the page.","Use --all to page through catalogs larger than the 100-per-request cap."],examples:["sequenzy products list --provider stripe","sequenzy products list --all","sequenzy products list --limit 100 --offset 100"]});var Ewe=Bl.command("sync").description("Queue a Stripe product catalog sync").option("-c, --company <id>","Company ID override for personal API keys").option("--integration <id>","Stripe integration ID to sync").option("--json","Print raw JSON").action((e)=>yu("sync",e));S(Ewe,{examples:["sequenzy products sync --company comp_123","sequenzy products sync --integration int_123"]});var Iwe=Bl.command("upsert [productId]").description("Create or update products in the catalog (Commerce API, keyed by your productId)").option("--title <title>","Product title (required for single upserts)").option("--description <text>","Product description").option("--price-cents <cents>","Price in the smallest currency unit").option("--currency <code>","ISO currency code, e.g. USD").option("--image-url <url>","Product image URL").option("--product-url <url>","Product page URL").option("--provider-created-at <iso>","Product creation time from the source catalog (ISO 8601)").option("--clear-provider-created-at","Clear the stored source-catalog creation time").option("--in-stock","Mark the product as in stock").option("--out-of-stock","Mark the product as out of stock").option("--file <path>","Deliverable file to upload and attach in one step").option("--url <link>","External deliverable http(s) link to attach in one step").option("--name <fileName>","Display name for the attached deliverable").option("--products-json <json>","Inline JSON array of products to upsert").option("--products-file <file>","Path to a JSON file with products to upsert").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>yu("upsert",t,e));S(Iwe,{notes:["Products are keyed by your own productId and stored under the api provider.","Combine --file or --url with a single-product upsert to attach the deliverable file in the same command.","Use --products-json/--products-file for bulk upserts of up to 100 products."],examples:['sequenzy products upsert my-ebook --title "The Ebook" --price-cents 1900 --currency USD --file ./ebook.pdf','sequenzy products upsert my-course --title "The Course" --url https://files.example.com/course.zip',"sequenzy products upsert --products-file ./products.json"]});var Cwe=Bl.command("delete <productId>").description("Delete a product previously pushed via the Commerce API").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>yu("delete",t,e));S(Cwe,{examples:["sequenzy products delete my-ebook"]});var wwe=Bl.command("attach-file <id>").description("Attach the deliverable file buyers receive after purchase").option("--file <path>","Local file to upload (PDF, ePub, ZIP, media)").option("--url <link>","External http(s) link instead of an upload").option("--name <fileName>","Display name for the file (e.g. guide.pdf)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>yu("attach-file",t,e));S(wwe,{examples:["sequenzy products attach-file prod_abc --file ./guide.pdf","sequenzy products attach-file prod_abc --url https://example.com/template.zip --name template.zip"]});var Swe=Bl.command("detach-file <id>").description("Remove the attached delivery file from a product").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>yu("detach-file",t,e));S(Swe,{examples:["sequenzy products detach-file prod_abc"]});var gg=Je.command("team").description("Manage team members and invitations").action(()=>gg.help());S(gg,{notes:["Inviting and cancelling invitations requires owner or admin access.","Billing access can only be granted by the company owner."],examples:["sequenzy team list","sequenzy team invite teammate@example.com --role admin","sequenzy team cancel-invitation inv_123"]});var Dwe=gg.command("list").description("List team members and pending invitations").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>Cv("list",e));S(Dwe,{examples:["sequenzy team list --company comp_123"]});var Bwe=gg.command("invite <email>").description("Invite a team member or add an existing user").requiredOption("--role <role>","Member role: admin, viewer, or restricted").option("--billing-access","Allow the member to manage billing (owner only)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Cv("invite",{email:e,...t}));S(Bwe,{notes:["Existing Sequenzy users are added to the team immediately; everyone else receives an email invitation.","Invitations expire automatically and can be re-sent by inviting the same email again after cancelling."],examples:["sequenzy team invite teammate@example.com --role admin","sequenzy team invite editor@example.com --role restricted","sequenzy team invite finance@example.com --role viewer --billing-access"]});var xwe=gg.command("cancel-invitation <invitationId>").description("Cancel a pending team invitation").option("-y, --yes","Skip the confirmation prompt").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Cv("cancel-invitation",{invitationId:e,...t}));S(xwe,{notes:["Run `sequenzy team list` first to find invitation IDs."],examples:["sequenzy team cancel-invitation inv_123 --yes"]});var gi=Je.command("inbox").description("Read and answer email in your inbox").action(()=>gi.help());S(gi,{notes:["The inbox receives replies to your campaigns, sequences, and transactional email, plus any email sent to your inbox address (sequenzy inbox address).","Use --note on replies to add an internal note instead of emailing the contact."],examples:["sequenzy inbox address","sequenzy inbox list --status open --unread","sequenzy inbox get conv_123","sequenzy inbox reply conv_123 --text 'Thanks for reaching out!'","sequenzy inbox close conv_123","sequenzy inbox close conv_123 conv_456"]});var _we=gi.command("address").description("Show or set the address anyone can email to reach your inbox").option("--local-part <name>","Use <name>@<domain> on one of your receiving domains (with --domain)").option("--domain <domain>","Receiving domain for --local-part").option("--reset","Go back to your Sequenzy inbox address").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>Qi("address",e));S(_we,{notes:["Email sent to this address arrives as a new conversation, or joins an existing thread when it answers one.","Receiving must be on (Settings > Inbox) for mail to arrive.","With --local-part and --domain the address becomes <name>@<domain>, where <domain> is one of your receiving domains (see `sequenzy receiving-domains`). It starts receiving once that domain is verified; inbox+{companyId}@inbound.sequenzy.com keeps working.","Any other address on a receiving domain also lands in Inbox."],examples:["sequenzy inbox address","sequenzy inbox address --local-part support --domain acme.com","sequenzy inbox address --reset"]});var kwe=gi.command("list").description("List conversations").option("-s, --status <status>","Filter by status: open, closed, or all").option("--search <query>","Search by contact email, name, or subject").option("--unread","Only conversations with unread messages").option("--spam","List the Spam folder instead of the inbox").option("--sent-to <address>","Only conversations that started at this inbox address").option("-p, --page <number>","Page number (default 1)").option("-l, --limit <number>","Results per page (1-100, default 20)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>Qi("list",e));S(kwe,{notes:["Mail the spam or virus scan flags goes to the Spam folder; other lists leave it out. See `sequenzy inbox recipients` for the addresses --sent-to accepts."],examples:["sequenzy inbox list","sequenzy inbox list --status open --unread",'sequenzy inbox list --search "refund" --limit 50',"sequenzy inbox list --spam","sequenzy inbox list --sent-to admin@example.com"]});var Rwe=gi.command("recipients").description("List the inbox addresses conversations started at").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>Qi("recipients",e));S(Rwe,{examples:["sequenzy inbox recipients"]});var Qwe=gi.command("get <conversationId>").description("Get a conversation with its full message history").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Qi("get",{conversationId:e,...t}));S(Qwe,{examples:["sequenzy inbox get conv_123","sequenzy inbox get conv_123 --json"]});var Twe=gi.command("reply <conversationId>").description("Reply to a conversation or add an internal note").option("-t, --text <text>","Plain text message body").option("--html-file <file>","Read an HTML message body from file").option("-s, --subject <subject>","Override the reply subject").option("--note","Add an internal note instead of emailing the subscriber").option("--sender-profile-id <id>","Reply from this sender profile instead of the default. See sequenzy sender-profiles list").option("--attach <file>","Attach a file (repeat for up to 10 files, 15 MB total)",(e,t=[])=>[...t,e]).option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Qi("reply",{conversationId:e,...t}));S(Twe,{notes:["Provide a body with --text and/or --html-file.","Outbound replies are emailed to the subscriber and reopen closed conversations; notes are internal only.","--sender-profile-id sends the reply from that sender profile; its domain must be verified. Without it, the reply uses the API key owner's address.","--attach can be repeated; attachments need attachment storage on the server (see sequenzy inbox address)."],examples:["sequenzy inbox reply conv_123 --text 'Thanks for reaching out!'","sequenzy inbox reply conv_123 --text 'Invoice attached' --attach ./invoice.pdf","sequenzy inbox reply conv_123 --text 'Happy to help' --sender-profile-id sp_123","sequenzy inbox reply conv_123 --html-file ./reply.html","sequenzy inbox reply conv_123 --text 'Customer asked for a refund' --note"]});var $we=gi.command("close <conversationIds...>").description("Close one or more conversations").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Qi("close",{conversationIds:e,...t}));S($we,{notes:["Pass up to 100 conversation IDs to close them in one request. Already closed conversations are reported as unchanged; missing IDs are reported and exit with status 1."],examples:["sequenzy inbox close conv_123","sequenzy inbox close conv_123 conv_456 conv_789"]});var Nwe=gi.command("reopen <conversationIds...>").description("Reopen one or more closed conversations").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Qi("reopen",{conversationIds:e,...t}));S(Nwe,{notes:["Pass up to 100 conversation IDs to reopen them in one request. Missing IDs are reported and exit with status 1."],examples:["sequenzy inbox reopen conv_123","sequenzy inbox reopen conv_123 conv_456"]});var Owe=gi.command("spam <conversationIds...>").description("Move one or more conversations to the Spam folder").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Qi("spam",{conversationIds:e,...t}));S(Owe,{notes:["Pass up to 100 conversation IDs. Missing IDs are reported and exit with status 1."],examples:["sequenzy inbox spam conv_123 conv_456"]});var Pwe=gi.command("not-spam <conversationIds...>").description("Move one or more conversations from Spam back to the inbox").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Qi("not-spam",{conversationIds:e,...t}));S(Pwe,{notes:["Pass up to 100 conversation IDs. Missing IDs are reported and exit with status 1."],examples:["sequenzy inbox not-spam conv_123"]});var Fwe=gi.command("mark-read <conversationId>").description("Mark all messages in a conversation as read").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Qi("mark-read",{conversationId:e,...t}));S(Fwe,{examples:["sequenzy inbox mark-read conv_123"]});var qwe=gi.command("mark-unread <conversationId>").description("Mark a conversation unread again").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Qi("mark-unread",{conversationId:e,...t}));S(qwe,{notes:["Its latest received message becomes unread again."],examples:["sequenzy inbox mark-unread conv_123"]});var Lwe=gi.command("forward <conversationId> <messageId>").description("Email a copy of one message to another address").requiredOption("--to <email>","Address to forward the message to").option("--sender-profile-id <id>","Forward from this sender profile instead of the company default").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t,n)=>Qi("forward",{conversationId:e,messageId:t,...n}));S(Lwe,{notes:["Get message IDs from sequenzy inbox get. Received and sent emails can be forwarded, including their attachments; notes cannot.","The forward is recorded in the conversation and does not change its status or unread state."],examples:["sequenzy inbox forward conv_123 msg_456 --to teammate@example.com"]});var dc=Je.command("webhooks").description("Manage outbound webhook endpoints").action(()=>dc.help());S(dc,{notes:["Webhook payloads are signed; the signing secret is only shown once at creation time.","Valid events cover email.*, sms.*, campaign.*, subscriber.*, and sequence.* types; omit --event to use the default set. campaign.sent is explicit-only."],examples:["sequenzy webhooks list","sequenzy webhooks create --name CI --url https://example.com/hook --event email.bounced","sequenzy webhooks deliveries wh_123 --limit 50","sequenzy webhooks replay wh_123 del_456"]});var Uwe=dc.command("list").description("List outbound webhook endpoints").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>El("list",e));S(Uwe,{examples:["sequenzy webhooks list --company comp_123"]});var jwe=dc.command("create").description("Create an outbound webhook endpoint").requiredOption("-n, --name <name>","Webhook name").requiredOption("-u, --url <url>","HTTPS endpoint URL").option("-e, --event <events...>","Event types to deliver, e.g. email.bounced campaign.sent subscriber.list_subscribed subscriber.list_unsubscribed").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>El("create",e));S(jwe,{notes:["The signing secret is printed once on creation and cannot be retrieved later - store it immediately.","Omit --event to subscribe to the default event set.","email.received (new mail to your inbox addresses and receiving domains, not replies to your emails; not sent for spam) is opt-in: pass it with --event."],examples:["sequenzy webhooks create --name CI --url https://example.com/hook --event email.bounced","sequenzy webhooks create --name Inbox --url https://example.com/hook --event email.received","sequenzy webhooks create --name 'All events' --url https://example.com/hook"]});var zwe=dc.command("update <id>").description("Update an outbound webhook endpoint").option("-n, --name <name>","Webhook name").option("-u, --url <url>","HTTPS endpoint URL").option("-e, --event <events...>","Replacement event types").option("--enable","Enable the webhook").option("--disable","Disable the webhook").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>El("update",{id:e,...t}));S(zwe,{notes:["Provide at least one of --name, --url, --event, --enable, or --disable.","Changing the URL or re-enabling resets the failure circuit breaker."],examples:["sequenzy webhooks update wh_123 --url https://example.com/new-hook","sequenzy webhooks update wh_123 --event email.bounced email.complained","sequenzy webhooks update wh_123 --disable"]});var Mwe=dc.command("delete <id>").description("Delete an outbound webhook endpoint").option("-y, --yes","Skip the confirmation prompt").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>El("delete",{id:e,...t}));S(Mwe,{examples:["sequenzy webhooks delete wh_123 --yes"]});var Hwe=dc.command("test <id>").description("Send a test event to a webhook endpoint").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>El("test",{id:e,...t}));S(Hwe,{notes:["The webhook must be enabled to receive a test event."],examples:["sequenzy webhooks test wh_123"]});var Gwe=dc.command("deliveries <id>").description("List recent deliveries for a webhook endpoint").option("-l, --limit <number>","Maximum deliveries to return (1-100)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>El("deliveries",{id:e,...t}));S(Gwe,{examples:["sequenzy webhooks deliveries wh_123","sequenzy webhooks deliveries wh_123 --limit 50"]});var Jwe=dc.command("replay <id> <deliveryId>").description("Replay a webhook delivery").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t,n)=>El("replay",{id:e,deliveryId:t,...n}));S(Jwe,{notes:["Run `sequenzy webhooks deliveries <id>` first to find delivery IDs."],examples:["sequenzy webhooks replay wh_123 del_456"]});var Vwe=Je.command("account").description("Verify the active API key, permissions, and your Sequenzy account context").option("--json","Print JSON").action(jz);S(Vwe,{notes:["Makes a live API request with the active credential. Compare its key name and prefix with Settings after replacing a key."],examples:["sequenzy account","sequenzy account --json"]});var JB=Je.command("notifications").description("Manage which account notifications Sequenzy emails you");JB.command("get").description("Show your notification settings for the current company").option("--json","Print JSON").action(HM);JB.command("set").description("Change your notification settings for the current company").option("--new-subscriber <mode>","Notify when a contact joins: off, instant, or daily").option("--form-submitted <mode>","Notify on form, popup, or landing-page submissions: off or instant (50/day cap)").option("--campaign-completed <mode>","Notify when a campaign finishes sending: off or instant").option("--weekly-report <mode>","Monday one-screen summary of last week's sends, engagement, revenue, and slipping sequences: off or weekly").option("--account-health <mode>","Findings of the scheduled account health check, inside the Monday report or as their own email: off or instant").option("--json","Print JSON").action(GM);S(JB,{notes:["These are your own settings, not the workspace's. Teammates choose their own and this never changes theirs.","New-subscriber notifications fall back to a daily summary automatically once a day passes the instant cap, and imports never trigger them.","'daily' is not valid for --form-submitted or --campaign-completed: each submission and each campaign finish is its own event.","The weekly report is on by default and only goes out for weeks in which the workspace sent more than 10 emails; 'weekly' is its only delivery mode.","Account health findings are on by default for the workspace owner. They ride inside the Monday report when you get it, otherwise they arrive as their own email; 'off' stops both."],examples:["sequenzy notifications get","sequenzy notifications set --new-subscriber daily","sequenzy notifications set --form-submitted instant","sequenzy notifications set --weekly-report off","sequenzy notifications set --account-health off","sequenzy notifications set --new-subscriber off --form-submitted off --campaign-completed off --weekly-report off"]});var yV=(e,t=[])=>[...t,e],Kwe=Je.command("feedback <message>").description("Send product feedback about Sequenzy to the Sequenzy team").option("--category <category>","Category: missing_capability, bug, docs, ux, praise, other (default: other)").option("--context <context>","What you were trying to accomplish when you hit the gap").option("--intent <text>","Bug reports: the user's request, verbatim or closely paraphrased").option("--expected <text>","Bug reports: what you expected to happen").option("--actual <text>","Bug reports: what actually happened instead").option("--tool-call <call>",'Bug reports: a command/tool call that led to the problem, as "<tool> | <args summary> | <error>" (args and error optional). Repeatable, in order.',yV).option("--resource-id <id>","Bug reports: ID of an affected resource (campaign, sequence, subscriber, ...). Repeatable.",yV).option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Y2(e,t));S(Kwe,{notes:["Agents: send feedback whenever the user wanted something the CLI, API, or MCP tools do not support. The Sequenzy team reads every submission.","When a command misbehaved or produced a wrong result, include --intent, --expected, --actual, --tool-call, and --resource-id so the team can reproduce it. Summarize arguments - do not paste raw subscriber data or secrets."],examples:['sequenzy feedback "No command to bulk-delete campaigns by label" --category missing_capability','sequenzy feedback "Segment count and list output disagree for seg_123" --category bug --context "Auditing a re-engagement segment"','sequenzy feedback "Campaign update dropped the scheduled time" --category bug --intent "Move the promo send to 9am Tuesday" --tool-call "campaigns update | --schedule 2026-08-11T09:00" --expected "Campaign rescheduled" --actual "Campaign reverted to draft" --resource-id cmp_123']});var xl=Je.command("api-keys").description("Manage company API keys").action(()=>xl.help());S(xl,{notes:["The plain API key is only returned on creation. Save it immediately.","Listing and revocation return metadata only; secrets and stored hashes are never returned.","Every subcommand except 'handoff' needs the api_keys:manage scope. Use 'handoff' when the active key does not have it."],examples:["sequenzy api-keys list --company comp_123","sequenzy api-keys create",'sequenzy api-keys create --name "CI deploy key" --company comp_123',"sequenzy api-keys update key_123 --preset agent_safe","sequenzy api-keys revoke key_123 --company comp_123 --yes","sequenzy api-keys handoff --preset agent_safe --replaces current"]});var Wwe=xl.command("create").description("Create a company API key").option("-n, --name <name>","Human-readable API key name").option("-c, --company <id>","Company ID override for personal API keys").option("--preset <preset>","Permission preset: full_access, read_only, agent_safe, ai_drafting, data_ingest_safe, data_ingest_automations, transactional_sender, marketing_sender (default: full_access)").option("--scopes <scopes>","Comma-separated explicit permission scopes (overrides --preset)").option("--json","Print raw JSON").action((e)=>gu("create",e));S(Wwe,{notes:["Keys default to full access. Pass --preset or --scopes to restrict what the key can do."],examples:["sequenzy api-keys create",'sequenzy api-keys create --name "CI deploy key" --company comp_123','sequenzy api-keys create --preset transactional_sender --name "Order emails"','sequenzy api-keys create --scopes "subscribers:read,subscribers:write,events:write"']});var Ywe=xl.command("handoff").description("Get an owner-confirmed dashboard link for creating or rotating a key").option("-n, --name <name>","Suggested name for the new API key").option("-c, --company <id>","Company ID override for personal API keys").option("--preset <preset>","Suggested permission preset: full_access, read_only, agent_safe, ai_drafting, data_ingest_safe, data_ingest_automations, transactional_sender, marketing_sender").option("--scopes <scopes>","Comma-separated explicit permission scopes (overrides --preset)").option("--replaces <api-key-id>","Key the new one replaces. Pass 'current' for the key you are authenticated with").option("--json","Print raw JSON").action((e)=>gu("handoff",e));S(Ywe,{notes:["Use this when key management fails because the active key lacks api_keys:manage. That scope fails closed on purpose and cannot be granted through the API by the key missing it.","This creates nothing and never prints a key. The link opens the dashboard create-key form prefilled; the owner reviews it, clicks Create, and copies the key from the browser.","With --replaces, the dashboard offers to revoke the predecessor once the replacement exists, which finishes a rotation in one visit."],examples:['sequenzy api-keys handoff --name "Production sync (rotated)" --preset agent_safe --replaces current','sequenzy api-keys handoff --scopes "subscribers:read,events:write" --company comp_123']});var Zwe=xl.command("list").description("List company API keys without secret values").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>gu("list",e));S(Zwe,{notes:["Use the returned ID, name, prefix, and current-key marker to identify a key before revoking it."],examples:["sequenzy api-keys list","sequenzy api-keys list --company comp_123 --json"]});var Xwe=xl.command("update").description("Rename a company API key or change its permissions in place").argument("<api-key-id>","Exact API key ID returned by api-keys list").option("-n, --name <name>","New human-readable API key name").option("-c, --company <id>","Company ID override for personal API keys").option("--preset <preset>","Replacement permission preset: full_access, read_only, agent_safe, ai_drafting, data_ingest_safe, data_ingest_automations, transactional_sender, marketing_sender").option("--scopes <scopes>","Comma-separated replacement permission scopes (overrides --preset)").option("--json","Print raw JSON").action((e,t)=>gu("update",{apiKeyId:e,...t}));S(Xwe,{notes:["The key value does not change, so clients holding it keep working with the new permissions.","--preset and --scopes replace the whole selection rather than merging into it. Run 'sequenzy api-keys list --json' first to see the current scopes."],examples:["sequenzy api-keys update key_123 --preset agent_safe",'sequenzy api-keys update key_123 --scopes "subscribers:read,subscribers:tag,tags:read"','sequenzy api-keys update key_123 --name "Agent key"']});var eSe=xl.command("revoke").description("Permanently revoke a company API key").argument("<api-key-id>","Exact API key ID returned by api-keys list").option("-y, --yes","Skip the confirmation prompt").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>gu("revoke",{apiKeyId:e,...t}));S(eSe,{notes:["Revocation cannot be undone. Run 'sequenzy api-keys list' first and verify the exact ID and prefix."],examples:["sequenzy api-keys revoke key_123 --company comp_123 --yes"]});var tSe=xl.command("delete").description("Alias for api-keys revoke").argument("<api-key-id>","Exact API key ID returned by api-keys list").option("-y, --yes","Skip the confirmation prompt").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>gu("delete",{apiKeyId:e,...t}));S(tSe,{notes:["This is a compatibility alias for 'sequenzy api-keys revoke'."],examples:["sequenzy api-keys delete key_123 --company comp_123 --yes"]});var pc=Je.command("websites").description("Manage sending domains and integration guides").action(()=>pc.help());S(pc,{notes:["Use 'guide' for code examples, 'check' to inspect current DNS verification details, and 'verify' to run a fresh check.","Use 'upgrade-dns' to move a domain on the previous record set onto the current DNS records without removing it."],examples:["sequenzy websites list --company comp_123","sequenzy websites add example.com --company comp_123","sequenzy websites guide --framework nextjs --use-case transactional"]});var nSe=pc.command("list").description("List sending domains for a company").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>Il("list",e));S(nSe,{examples:["sequenzy websites list --company comp_123"]});var rSe=pc.command("add <domain>").description("Add a sending domain").option("-c, --company <id>","Company ID override for personal API keys").option("--mail-from-prefix <label>","Return-path (MAIL FROM) subdomain label, default rp").option("--tracking-prefix <label>","Label of the company tracking domain (<label>.<root>) if the company has none yet, default links").option("--json","Print raw JSON").action((e,t)=>Il("add",{domain:e,...t}));S(rSe,{notes:["Publish the DKIM record, the bounce records on the `Bounce:` line (one CNAME for new domains; domains added earlier keep their SPF TXT and MX records) and DMARC when present; record shapes vary between unified and legacy domains.","Tracked links use the company tracking domain, shared by every sending domain. The first domain creates it on its root (links.<root>) and returns its CNAME as trackingRecord. It is optional: sending never waits for it, and links use the shared Sequenzy domain until it verifies. Manage it with `sequenzy tracking domain`.","A domain belongs to exactly one company and cannot be moved or removed from the CLI afterwards. Confirm --company before adding; moving it later requires removal in the dashboard and new DNS verification."],examples:["sequenzy websites add example.com --company comp_123","sequenzy websites add mail.example.com --mail-from-prefix bounce"]});var oSe=pc.command("check <domain>").description("Inspect sending domain verification details").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Il("check",{domain:e,...t}));S(oSe,{examples:["sequenzy websites check example.com --company comp_123"]});var iSe=pc.command("verify <domain>").description("Run a fresh DNS check for a sending domain").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Il("verify",{domain:e,...t}));S(iSe,{notes:["'verified' is the DNS verdict only. Sending is reported separately as 'Sending' - a domain with correct DNS can still be activating.","Receiving mail (inbox addresses and replies) is set up on receiving domains, not sending domains: see `sequenzy receiving-domains`."],examples:["sequenzy websites verify example.com --company comp_123"]});var sSe=pc.command("upgrade-dns <domain>").description("Recommended one-time upgrade of a verified sending domain to the current DNS records, without removing it").option("--mail-from-prefix <label>","Return-path subdomain label for the new records, default rp (rp1, then sqrp if taken)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Il("upgrade-dns",{domain:e,...t}));S(sSe,{notes:["Optional and needed only once: it improves deliverability and security. Once started it runs to the switch. Add the printed CNAMEs next to your current records and remove nothing yet. The domain keeps sending on its current records, then switches by itself about an hour after the required ones (DKIM and return path) are visible on public DNS. Sending is normally not interrupted at the switch; if that isn't possible for a domain, emails sent through Amazon SES can be held for a few minutes. `sequenzy websites verify <domain>` checks now but does not skip the wait.","After the switch, `websites check` lists the old records you can optionally delete and the date from which it is safe (8 days after the switch). For an older SES-only domain these include the old return path records (MX and TXT at send.<domain>) and the DKIM TXT; keep DMARC.",'Only verified domains on the previous record set can upgrade, including older SES-only domains that have a working DMARC record; `websites check` shows `DNS upgrade: available` for them. Without DMARC the start fails with "Add a DMARC record for this domain before upgrading its DNS records."'],examples:["sequenzy websites upgrade-dns mail.example.com --company comp_123","sequenzy websites upgrade-dns mail.example.com --mail-from-prefix bounce"]});var aSe=pc.command("configure <domain>").description("Deprecated: set <label>.<domain> as the company tracking domain; use `tracking domain set`").requiredOption("--tracking-prefix <label>","Label beneath the sending domain, e.g. links").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>Il("configure",{domain:e,...t}));S(aSe,{notes:["Deprecated: tracking is company-wide. Sets <label>.<domain> as the company tracking domain when the company has none; the company's current hostname is a no-op, and a different one changes nothing (the response explains why).","Prefer `sequenzy tracking domain set <hostname>`, which also changes an existing tracking domain."],examples:["sequenzy websites configure mail.example.com --tracking-prefix links"]});var cSe=pc.command("guide").description("Print framework-specific integration code").option("--framework <name>","Framework name, e.g. nextjs, express, python").option("--use-case <name>","Use case, e.g. transactional, subscribe_form, event_tracking").option("--json","Print raw JSON").action((e)=>Il("guide",e));S(cSe,{examples:["sequenzy websites guide","sequenzy websites guide --framework nextjs --use-case transactional","sequenzy websites guide --framework python --use-case event_tracking"]});sH(Je);var ho=Je.command("integrations").description("Inspect and manage connected integrations").action(()=>ho.help());S(ho,{notes:["Credentials, access tokens, and webhook secrets are never returned.","`connect` covers API-key / webhook-secret providers (Polar, Paddle, Dodo, Lemon Squeezy, Whop, RevenueCat, Superwall, Creem, Chargebee, Clerk, PostHog, Segment, Affonso, Attio). OAuth and app-install providers (Stripe, Shopify, Supabase, GitHub, WooCommerce) connect in the dashboard. Lemon Squeezy supports `disconnect`; other provider disconnects use the dashboard.","Use `catalog` to see what a provider does before connecting it, and `get` to see what a connected one is doing now."],examples:["sequenzy integrations list","sequenzy integrations catalog --provider stripe","sequenzy integrations connect clerk --webhook-secret whsec_...","sequenzy integrations get int_123","sequenzy integrations activity --status failed"]});ho.command("disconnect <id>").description("Disconnect Lemon Squeezy and remove its managed webhook; repeat to retry cleanup").option("--company <id>","Company ID").option("--json","Print raw JSON").action((e,t)=>yM(e,t));var lSe=ho.command("connect <provider>").description("Connect an API-key / webhook-secret integration").option("-c, --company <id>","Company ID override for personal API keys").option("--api-key <key>","Provider API key (or set SEQUENZY_INTEGRATION_API_KEY)").option("--webhook-secret <secret>","Webhook signing secret (Lemon Squeezy manual setup: 16-40 characters; Superwall: the webhook's whsec_ signing secret; or set SEQUENZY_INTEGRATION_WEBHOOK_SECRET)").option("--account-id <id>","Provider account id: Paddle seller ID, Dodo business ID, Lemon Squeezy numeric store ID, Whop company ID, Creem store ID, Chargebee site name, or RevenueCat project ID (only when the key can access several projects)").option("--attio-list <mapping...>","Attio only: map SEQUENZY_LIST_ID=ATTIO_LIST_ID_OR_SLUG (one or more)").option("--attio-clear-lists","Attio only: remove every saved Sequenzy-to-Attio list mapping").option("--attio-enable-company-domain","Attio only: create or match companies from work email domains").option("--attio-disable-company-domain","Attio only: do not create or match companies from work email domains").option("--event-allowlist <events...>","PostHog and Segment only: sync only these event names instead of everything").option("--history-region <region>","PostHog and Segment history import region: us or eu").option("--history-project-id <id>","PostHog history import project ID").option("--history-space-id <id>","Segment history import Unify space ID (spa_...)").option("--history-api-key <key>","History import credential: the PostHog personal API key (or SEQUENZY_POSTHOG_PERSONAL_API_KEY) or the Segment Profile API token (or SEQUENZY_SEGMENT_PROFILE_API_TOKEN)").option("--json","Print raw JSON").action((e,t)=>kM(e,t));S(lSe,{notes:["Run `sequenzy integrations catalog --provider <provider>` first: its connectFields list what this provider needs.","Pass secrets via the environment variables instead of flags to keep them out of shell history.","The response includes the webhook URL. Lemon Squeezy creates and manages it when --webhook-secret is omitted; other inbound providers use the supplied secret. Attio is outbound-only.","Reconnecting an already-connected provider replaces its stored credentials.","OAuth and app-install providers (Stripe, Shopify, Supabase, GitHub, WooCommerce) cannot be connected here - use the dashboard."],examples:["sequenzy integrations connect clerk --webhook-secret whsec_...","sequenzy integrations connect paddle --api-key pdl_... --webhook-secret pdl_ntf_... --account-id 12345","sequenzy integrations connect polar --api-key polar_oat_... --webhook-secret whsec_...","sequenzy integrations connect lemon_squeezy --api-key ls_... --account-id 12345","sequenzy integrations connect revenuecat --api-key sk_... --webhook-secret <authorization-header-value>","sequenzy integrations connect superwall --webhook-secret whsec_...","sequenzy integrations connect posthog --webhook-secret phc_shared_secret --history-region us --history-project-id 12345 --history-api-key phx_...","sequenzy integrations connect segment --webhook-secret my_shared_secret","sequenzy integrations connect segment --webhook-secret my_shared_secret --history-region us --history-space-id spa_abc123 --history-api-key profile_token","sequenzy integrations connect affonso --api-key aff_... --webhook-secret whsec_...","sequenzy integrations connect attio --api-key attio_... --attio-list list_123=field-guide"]});var uSe=ho.command("list").description("List connected integrations and their sync health").option("-c, --company <id>","Company ID override for personal API keys").option("--all","Include disconnected/inactive integrations").option("--json","Print raw JSON").action((e)=>$M(e));S(uSe,{examples:["sequenzy integrations list --company comp_123","sequenzy integrations list --all"]});var dSe=ho.command("catalog").description("Show what each integration provider syncs, emits, and supports").option("-c, --company <id>","Company ID override for personal API keys").option("--provider <provider>","Only show one provider, e.g. stripe").option("--category <category>","Filter by category: payments, ecommerce, auth, analytics, ads, affiliate, cms, crm, developer").option("--json","Print raw JSON").action((e)=>RM(e));S(dSe,{notes:["Works whether or not the provider is connected, so you can compare providers before picking one.","Events listed here are the ones a sequence can trigger on. A provider that emits nothing cannot drive automations."],examples:["sequenzy integrations catalog","sequenzy integrations catalog --provider stripe","sequenzy integrations catalog --category ecommerce --json"]});var pSe=ho.command("get <id>").description("Show one integration: what it does, its events, and its wiring").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>QM(e,t));S(pSe,{notes:["Lists every event the provider emits, the tags each one applies through your sync rules, and which sequences trigger on it.","Events with no sequence are reported so you can see what the integration is feeding you that nothing acts on.","Get the id from `sequenzy integrations list`."],examples:["sequenzy integrations get int_123","sequenzy integrations get int_123 --json"]});var mSe=ho.command("activity").description("Show recent integration webhook and sync activity").option("-c, --company <id>","Company ID override for personal API keys").option("--integration <id>","Only show one integration's activity").option("--provider <provider>","Only show one provider's activity").option("--status <status>","Filter by status: received, queued, processed, skipped, failed").option("--limit <n>","Rows to return (1-100, default 25)").option("--json","Print raw JSON").action((e)=>xM(e));S(mSe,{notes:["Activity is retained for 24 hours.","Use `--status failed` when an integration reports connected but contacts are not appearing."],examples:["sequenzy integrations activity","sequenzy integrations activity --status failed --limit 50","sequenzy integrations activity --integration int_123"]});var fSe=ho.command("sync <id>").description("Queue a manual re-sync for a connected integration").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>bM(e,t));S(fSe,{notes:["Supported for Stripe, Polar, Paddle, Dodo, Lemon Squeezy, Creem, Chargebee, Whop, Supabase, PostHog, and Segment. Other providers re-sync from the dashboard.","For Supabase this backfills users from the table already configured for the integration; it cannot target a different table. Run it once after connecting, because the database trigger only sends rows that change after it is installed.","For PostHog and Segment this re-runs the event-history import with the stored credentials and is the supported retry for one that failed. It restarts from the beginning; already-imported events dedupe.","Returns immediately; poll `sequenzy integrations get <id>` to watch syncStatus and lastSyncAt.","Fails with a conflict if a sync is already running."],examples:["sequenzy integrations sync int_123"]});var gSe=ho.command("enable-sync <id>").description("Turn sync back on for an integration").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>V0(e,!0,t));S(gSe,{examples:["sequenzy integrations enable-sync int_123"]});var ASe=ho.command("disable-sync <id>").description("Pause bulk imports without disconnecting the integration").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>V0(e,!1,t));S(ASe,{notes:["Stops bulk imports and backfills but keeps the connection, credentials, and live webhook delivery active.","This does NOT stop the integration creating contacts. The provider's live webhook keeps writing every new signup or customer. Use `set-lists` to control where they land, or use `disconnect` for Lemon Squeezy (the dashboard for other providers) to stop it entirely."],examples:["sequenzy integrations disable-sync int_123"]});var hSe=ho.command("set-lists <id>").description("Choose which lists this integration's new contacts join").option("-c, --company <id>","Company ID override for personal API keys").option("--list <id>","Target this list (repeatable)",(e,t=[])=>[...t,e]).option("--none","Target no list at all").option("--default","Fall back to the workspace default lists").option("--json","Print raw JSON").action((e,t)=>EM(e,t));S(hSe,{notes:["Takes effect on future provider writes. Nothing is applied retroactively and nobody is ever removed from a list. Wix/Webflow submissions, Shopify customer updates, and Supabase resubscriptions can add existing contacts to the new targets; Stripe applies targeting only when its webhook creates a subscriber.","This changes list membership only. Contacts are still created, their attributes still sync, sync-rule tags still apply, and sequences triggered by contact_added on any list still enroll them - pair it with `sequences pause-enrollments` if you need those stopped too.","`--none` and `--default` are different: --none means new contacts join no list, --default means they follow the workspace default lists setting.","Webflow requires explicit targeting, so --default is rejected for Webflow. Use --none or --list here; configure native forms, allowed fields, required double opt-in, and sequence enrollment in Settings -> Integrations -> Webflow. With no selected forms, capture is off and no contacts are created.","Supported for Supabase, Stripe, Shopify, Wix, and Webflow. `integrations get <id>` reports the current targeting under `ingestion`, with list names."],examples:["sequenzy integrations set-lists int_123 --list list_abc --list list_def","sequenzy integrations set-lists int_123 --none","sequenzy integrations set-lists int_123 --default"]});var ySe=ho.command("pixel <id>").description("Show the Shopify storefront tracking pixel state").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>CM(e,t));S(ySe,{notes:["Shopify only. Read live from the store, because a merchant can remove the pixel without notifying Sequenzy.","Check this before trusting product views, cart activity, or browse abandonment: without the pixel those events never arrive and any sequence triggered by them silently never fires."],examples:["sequenzy integrations pixel int_123"]});var bSe=ho.command("enable-pixel <id>").description("Install or repoint the Shopify storefront tracking pixel").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>wM(e,t));S(bSe,{notes:["Idempotent: an already-live pixel is reported with `changed: false`.","Events start arriving on the next storefront visit; nothing is backfilled for the period the pixel was off.","Fails with guidance if the store granted an older permission set - reconnect Shopify from the dashboard, then retry."],examples:["sequenzy integrations enable-pixel int_123"]});var vSe=ho.command("attio <id>").description("Show Attio list mappings and available people-lists").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>DM(e,t));S(vSe,{notes:["Attio only. Reads live people-lists from Attio using the stored access token — you do not need the secret again.","mappedListCount 0 means list joins are not synced. Map them with `set-attio-lists` rather than reconnecting."],examples:["sequenzy integrations attio int_123"]});var ESe=ho.command("set-attio-lists <id>").description("Map Sequenzy lists to Attio lists without reconnecting").option("-c, --company <id>","Company ID override for personal API keys").option("--map <mapping...>","Complete SEQUENZY_LIST_ID=ATTIO_LIST_ID_OR_SLUG map (one or more)").option("--clear-maps","Remove every saved Sequenzy-to-Attio list mapping").option("--enable-company-domain","Create or match companies from work email domains").option("--disable-company-domain","Do not create or match companies from work email domains").option("--json","Print raw JSON").action((e,t)=>BM(e,t));S(ESe,{notes:["Uses the stored Attio access token. Do not reconnect just to change mappings.","--map replaces the saved map entirely. Run `sequenzy integrations attio <id>` first to see Sequenzy list ids and live Attio list ids/slugs.","Unmapped lists are not synced. Unmapping does not remove anyone from Attio (add-only)."],examples:["sequenzy integrations set-attio-lists int_123 --map list_abc=field-guide list_def=benchmark","sequenzy integrations set-attio-lists int_123 --clear-maps","sequenzy integrations set-attio-lists int_123 --disable-company-domain"]});var ISe=ho.command("guide").description("Print integration code examples for your stack").option("-c, --company <id>","Company ID override for personal API keys").option("--framework <framework>","Framework or language, e.g. nextjs").option("--use-case <use-case>","transactional, subscribe_form, event_tracking, or ecommerce").option("--json","Print raw JSON").action((e)=>hM(e));S(ISe,{notes:["Same examples the MCP `get_integration_guide` tool returns.","For Stripe, Polar, Paddle, Dodo, Creem, Shopify, or WooCommerce, connect the native integration instead of writing tracking code by hand."],examples:["sequenzy integrations guide --use-case transactional --framework nextjs","sequenzy integrations guide --use-case ecommerce"]});var Ag=Je.command("sender-profiles").description("Inspect, rename, and delete sending identity profiles").action(()=>Ag.help());S(Ag,{notes:["Shows which profiles are account defaults and whether each sender address sits on a verified sending domain.","`update` renames one profile in place and never changes the account defaults. To change which profile is the default, use `sequenzy companies update <id> --sender-profile-id <id>`."],examples:["sequenzy sender-profiles list","sequenzy sender-profiles update sender_abc123 --name 'SnapCount'","sequenzy sender-profiles delete sender_abc123 --yes"]});var CSe=Ag.command("list").description("List sender and reply-to profiles").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>$3(e));S(CSe,{examples:["sequenzy sender-profiles list --company comp_123"]});var wSe=Ag.command("update <id>").description("Rename a sender or reply-to profile without changing defaults").requiredOption("--name <name>","New display name for the profile").option("--reply","Treat <id> as a reply-to profile instead of a sender").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>N3(e,t));S(wSe,{notes:["Renames the profile only. The account default From/Reply-To selection is left exactly as it was.","Get profile IDs from `sequenzy sender-profiles list`.","A company cannot have two sender identities with the same name on one address, so a colliding rename is rejected with the ID of the profile already using that name.","Requires the companies:manage scope."],examples:["sequenzy sender-profiles update sender_abc123 --name 'SnapCount'","sequenzy sender-profiles update reply_abc123 --name 'SnapCount' --reply","sequenzy sender-profiles update sender_abc123 --name 'SnapCount' --company comp_123 --json"]});var SSe=Ag.command("delete <id>").description("Permanently delete a sender (From) profile").option("--yes","Skip the confirmation prompt").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>O3(e,t));S(SSe,{notes:["This cannot be undone. Reply-to profiles are not supported by this command.","Deletion is blocked for the last sender and for profiles used by live campaigns, active sequences, or transactional emails.","Eligible draft campaigns and the account default move to the best remaining sender when needed; the result reports that fallback profile ID.","Requires the companies:manage scope."],examples:["sequenzy sender-profiles delete sender_abc123","sequenzy sender-profiles delete sender_abc123 --yes --json"]});var Pv=Je.command("sending").description("Check company-level sending status and restore paused sending").action(()=>Pv.help());S(Pv,{notes:["Company-level sending can be paused automatically when the permanent-bounce, temporary-bounce, or complaint rate crosses its threshold. While paused, every send is blocked - campaigns, sequence steps, transactional email, and test sends.","Sender-health enforcement uses all-time totals counted from a reset watermark, NOT a rolling window. A paused rate does not expire on its own, so waiting does not restore sending.","`status` needs account:read. `resume` needs companies:manage plus owner or admin access."],examples:["sequenzy sending status","sequenzy sending resume --confirm-list-sanitized"]});var DSe=Pv.command("status").description("Show sending status, sender-health rates, and how to restore sending").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>U3(e));S(DSe,{notes:["Run this first whenever a send or test send fails for a reason that is not a validation error.","Shows the exact pause reason, the measured rates against the thresholds that apply at your volume, the automated sender-health review state, whether one-click resume is available, and ordered remediation steps.","`metricsWindow` reports the enforcement watermarks. `expiresAt` is always null because there is no rolling window to wait out."],examples:["sequenzy sending status","sequenzy sending status --json","sequenzy sending status --company comp_123"]});var BSe=Pv.command("resume").description("Restore paused sending after fixing the cause of the bounces").option("--confirm-list-sanitized","Required. Confirms you fixed the source of the invalid addresses and left every permanent bounce suppressed").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>j3(e));S(BSe,{notes:["This is the supported remediation path, not a bypass. It never removes suppressions.","Only a permanent-bounce pause can be cleared this way, and only after the automated sender-health review has cleared it. Any other state needs a support review, and the error names which gate stopped you.","Check `selfResume.canSelfResume` with `sequenzy sending status` before calling this.","On success the bounce watermark resets, so the paused rate is recalculated from sends made after the resume, and the service attempts to requeue paused campaigns plus due sequence steps. If that handoff is only partial, the success message gives recovery guidance.","The confirmation is recorded on the account audit trail, so only pass --confirm-list-sanitized once the fix is actually shipped."],examples:["sequenzy sending resume --confirm-list-sanitized","sequenzy sending resume --confirm-list-sanitized --json"]});var hg=Je.command("tracking").description("Inspect and update email tracking configuration").action(()=>hg.help());S(hg,{notes:["Covers open/click/unsubscribe tracking, attribution window, double opt-in for new contacts, auto UTM, the company tracking domain, and reply tracking."],examples:["sequenzy tracking settings","sequenzy tracking update --opens off --clicks off","sequenzy tracking domain set links.example.com"]});H4(hg);eM(Je);Fz(Je);cH(Je);t2(Je);oV(Je);var xSe=hg.command("settings").description("Show the company's tracking configuration").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>P3(e));S(xSe,{examples:["sequenzy tracking settings --company comp_123"]});var _Se=hg.command("update").description("Update account-wide tracking defaults").option("--opens <on|off>","Enable or disable open tracking").option("--clicks <on|off>","Enable or disable click tracking").option("--transactional-opens <on|off>","Enable or disable open tracking by default for Transactional API sends").option("--transactional-clicks <on|off>","Enable or disable click tracking by default for Transactional API sends").option("--strict-bot-filtering <on|off>","Enable or disable aggressive bot filtering (can lower reported open/click rates)").option("--unsubscribes <on|off>","Track unsubscribe link clicks; off uses direct sequenzy.com links even with a custom domain").option("--store-content <on|off>","Keep sent email content and subjects, and the IP address, user agent and country of opens and clicks").option("--attribution-window-hours <hours>","Default revenue attribution window in hours (1-720)").option("--double-opt-in <on|off>","Require email confirmation before new contacts become subscribed").option("--double-opt-in-redirect-url <url>","Where the confirmation page sends subscribers after they confirm; pass an empty string to clear it").option("--auto-utm <on|off>","Enable or disable automatic UTM tagging").option("--utm-source <template>","utm_source template").option("--utm-medium <template>","utm_medium template").option("--utm-campaign <template>","utm_campaign template").option("--utm-content <template>","utm_content template").option("--utm-term <template>","utm_term template").option("--reset-utm","Reset every UTM parameter to the platform defaults").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>F3(e));S(_Se,{notes:["Partial update: omitted flags keep their current values.","--unsubscribes off routes unsubscribe links directly to sequenzy.com, even with a custom tracking domain. Actual unsubscribes and their email attribution are still recorded.","--store-content off keeps no copy of each sent email's content, stores the email's name instead of its subject, and stores no IP address, user agent or country for opens and clicks. View-in-browser links stop working.","Transactional API defaults can only narrow the account-wide open and click settings; per-send trackingSettings can opt out again.","Applies to emails sent afterwards; already-sent emails keep the links they were rendered with.","UTM templates support placeholders such as {{email.subject}} and {{link.text}}.","--double-opt-in on makes new contacts start pending until they confirm; it needs a sender profile and provisions the confirmation email automatically. Existing active contacts are unaffected.","--double-opt-in-redirect-url sends subscribers to your own page after they confirm; without it they stay on the branded confirmation page.","Reply tracking is set with `sequenzy companies update`; the company tracking domain is managed with `sequenzy tracking domain`."],examples:["sequenzy tracking update --opens off --clicks off","sequenzy tracking update --transactional-opens off --transactional-clicks off","sequenzy tracking update --attribution-window-hours 168","sequenzy tracking update --double-opt-in on","sequenzy tracking update --double-opt-in-redirect-url https://example.com/welcome",'sequenzy tracking update --auto-utm on --utm-source newsletter --utm-campaign "{{email.subject}}"',"sequenzy tracking update --reset-utm"]});var VB=Je.command("shopify").description("Manage the connected Shopify store's automation settings").action(()=>VB.help());S(VB,{notes:["Requires a connected Shopify integration on the company.","Browse abandonment emails shoppers who viewed a product but didn't buy; cart abandonment fires ecommerce.cart_abandoned with the full cart after the cart sits inactive; price drop alerts email recent viewers when a product's price falls."],examples:["sequenzy shopify settings get","sequenzy shopify settings update --price-drop off","sequenzy shopify settings update --browse-delay-hours 4 --browse-cooldown-hours 48"]});var KB=VB.command("settings").description("Browse-abandonment, cart-abandonment, and price-drop automation settings").action(()=>KB.help()),kSe=KB.command("get").description("Show the effective automation settings").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>EB("get",e));S(kSe,{notes:["Shows the effective values - platform defaults apply until the store overrides them."],examples:["sequenzy shopify settings get --json"]});var RSe=KB.command("update").description("Update browse-abandonment, cart-abandonment, and/or price-drop settings").option("--browse-abandonment <on|off>","Enable or disable browse abandonment").option("--browse-delay-hours <hours>","Hours to wait after a product view before the abandonment check (default 2)").option("--browse-cooldown-hours <hours>","Minimum hours between browse-abandoned events per subscriber (default 24)").option("--reset-browse-abandonment","Reset browse abandonment to the platform defaults").option("--cart-abandonment <on|off>","Enable or disable cart abandonment (ecommerce.cart_abandoned)").option("--cart-delay-hours <hours>","Hours of cart inactivity before abandonment (positive, max 168; default 1)").option("--cart-cooldown-hours <hours>","Minimum hours between cart-abandoned events (positive, max 720; default 24)").option("--cart-expire-after-hours <hours>","Drop a cart untouched this long instead of emailing about it (positive, max 720; default 72)").option("--reset-cart-abandonment","Reset cart abandonment to the platform defaults").option("--price-drop <on|off>","Enable or disable price drop alerts").option("--price-drop-min-percent <percent>","Minimum price decrease percent to alert on (default 5)").option("--price-drop-lookback-days <days>","How many days back viewers qualify as the audience (default 30)").option("--price-drop-cooldown-days <days>","Minimum days between price-drop events per subscriber and product (default 7)").option("--reset-price-drop","Reset price drop alerts to the platform defaults").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>EB("update",e));S(RSe,{notes:["Partial update: omitted flags keep their current values.","If no sequence handles ecommerce.price_drop, Sequenzy sends a default price-drop email to active subscribers."],examples:["sequenzy shopify settings update --browse-abandonment off","sequenzy shopify settings update --cart-delay-hours 2","sequenzy shopify settings update --price-drop-min-percent 10 --price-drop-lookback-days 14","sequenzy shopify settings update --reset-price-drop"]});var _l=Je.command("sms").description("Inspect the SMS add-on status for a company").action(()=>_l.help());S(_l,{notes:["SMS sequence steps only send when the add-on is enabled, the plan is eligible, and an active number exists.",'Add SMS steps to sequences with type: "sms" in sequences create --steps-* or update --insert-steps-*.','Generate SMS copy with `sequenzy generate sms "<prompt>"`.'],examples:["sequenzy sms settings","sequenzy sms settings --json"]});var QSe=_l.command("settings").description("Show SMS add-on status, credits, and phone numbers").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>ku("settings",e));S(QSe,{notes:["readyToSend in the JSON output tells you whether SMS sequence steps will actually send."],examples:["sequenzy sms settings --json"]});var TSe=_l.command("label <number-id> [label]").description("Set or clear the label shown for an SMS number").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t,n)=>ku("label",{numberId:e,label:t,...n}));S(TSe,{notes:["Run without a label to clear the current label.","Use `sequenzy sms settings` to find each number ID."],examples:['sequenzy sms label num_abc123 "Marketing"',"sequenzy sms label num_abc123"]});var $Se=_l.command("update <number-id>").description("Update an SMS number's label, brand prefix override, and/or link shortening").option("--label <label>","Label tag; pass an empty string to clear").option("--brand-prefix <prefix>","Per-number brand prefix override; empty string clears back to the account-wide prefix").option("--link-shortening <on|off>","on (default) turns links into click-tracked short links; off sends links from this number exactly as written").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ku("update",{numberId:e,...t}));S($Se,{notes:["Only the flags you pass are changed; omitted fields keep their value.",'Messages go out as "{prefix}: your message" - the number override wins over the account-wide prefix set in Settings > SMS.',"--link-shortening off keeps your own tracking links exactly as written; SMS clicks from that number are then not tracked and long links can add segments. Applies to messages prepared after the change.","Use `sequenzy sms settings` to find each number ID."],examples:['sequenzy sms update num_abc123 --label "Support" --brand-prefix "Acme Support"','sequenzy sms update num_abc123 --brand-prefix ""',"sequenzy sms update num_abc123 --link-shortening off"]});var NSe=_l.command("send-test <phone>").description("Send a test SMS to a phone number").option("-t, --text <text>","Plain-text message body").option("--image-url <url...>","Publicly reachable MMS image URL (repeat for up to 2)").option("--from-number <number-id>","Active SMS number ID to send from (defaults to the oldest active number)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ku("send-test",{phone:e,...t}));S(NSe,{notes:["Sends a real text and charges credits. Limited to 100 test sends per company per rolling 24 hours; bypasses quiet hours; excluded from step stats.","Requires the SMS add-on with a verified number - check `sequenzy sms settings` first.","Use --from-number with an active number ID from `sequenzy sms settings` to test a specific number."],examples:['sequenzy sms send-test +15550100123 --text "Test from Sequenzy"','sequenzy sms send-test +15550100123 --text "Test" --from-number num_abc123']});var OSe=_l.command("usage").description("Show per-number SMS usage (sends, credits, last sent)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>ku("usage",e));S(OSe,{notes:["Totals exclude test sends; test sends are counted separately per number."],examples:["sequenzy sms usage","sequenzy sms usage --json"]});var PSe=_l.command("release <number-id>").description("Release an SMS number back to the carrier (irreversible)").option("-y, --yes","Skip the confirmation prompt").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>ku("release",{numberId:e,...t}));S(PSe,{notes:["Releasing is irreversible: the number is handed back to the carrier and cannot be recovered.","Released numbers stop counting toward the workspace number limit, freeing a slot for a new purchase.","Use `sequenzy sms settings` to find each number ID."],examples:["sequenzy sms release num_abc123 --yes"]});var mc=Je.command("push").description("Web and mobile push notifications: settings, devices, tests and campaigns").action(()=>mc.help());S(mc,{notes:["Web push uses VAPID keys Sequenzy generates; iOS uses your APNs .p8 key; Android uses your Firebase service account.",'Add push steps to sequences with type: "push" in sequences create --steps-* or update --insert-steps-*.'],examples:["sequenzy push settings","sequenzy push web --enable",'sequenzy push send-test --email you@example.com --title "Hello" --body "It works"']});var FSe=mc.command("settings").description("Show web push, APNs and Firebase status plus active device counts").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>yr("settings",e));S(FSe,{examples:["sequenzy push settings --json"]});var qSe=mc.command("web").description("Enable or disable web push and set the default notification icon").option("--enable","Turn web push on (generates VAPID keys the first time)").option("--disable","Turn web push off (keys are kept)").option("--icon <url>","Default https icon URL; pass an empty string to clear").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>yr("web",e));S(qSe,{notes:['Your site must serve /sequenzy-sw.js containing importScripts("https://api.sequenzy.com/sequenzy-sw.js") and call sequenzy.subscribeToPush() from a click.'],examples:["sequenzy push web --enable","sequenzy push web --icon https://example.com/icon-192.png"]});var WB=mc.command("ios").description("Manage APNs credentials for iOS push").action(()=>WB.help()),LSe=WB.command("set").description("Save an APNs auth key (.p8)").requiredOption("--key-file <path>","Path to the AuthKey_XXXXXXXXXX.p8 file").requiredOption("--key-id <id>","10-character APNs key ID").requiredOption("--team-id <id>","10-character Apple team ID").requiredOption("--bundle-id <id>","App bundle ID, e.g. com.example.app").option("--environment <env>","production (default) or sandbox").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>yr("ios-set",e));S(LSe,{examples:["sequenzy push ios set --key-file AuthKey_ABC123DEFG.p8 --key-id ABC123DEFG --team-id DEF123GHIJ --bundle-id com.example.app"]});WB.command("remove").description("Remove APNs credentials").option("-y, --yes","Skip the confirmation prompt").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>yr("ios-remove",e));var YB=mc.command("android").description("Manage Firebase credentials for Android push").action(()=>YB.help()),USe=YB.command("set").description("Save a Firebase service account key").requiredOption("--service-account-file <path>","Path to the service account JSON from Firebase project settings").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>yr("android-set",e));S(USe,{notes:["The service account needs the Firebase Cloud Messaging API Admin role."],examples:["sequenzy push android set --service-account-file ./firebase-key.json"]});YB.command("remove").description("Remove Firebase credentials").option("-y, --yes","Skip the confirmation prompt").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>yr("android-remove",e));var Fv=mc.command("devices").description("List, register and remove push devices").action(()=>Fv.help());Fv.command("list").description("List push devices, optionally for one contact").option("--email <email>","Only devices of this contact").option("--subscriber-id <id>","Only devices of this subscriber").option("--platform <platform>","web, ios or android").option("--status <status>","active, invalid or unsubscribed").option("--limit <n>","Page size (max 100)").option("--cursor <id>","Continue after this device ID").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>yr("devices-list",e));var jSe=Fv.command("register").description("Register a device token (usually done by your app backend)").requiredOption("--platform <platform>","ios, android or web").requiredOption("--token <token>","APNs device token, FCM registration token, or web subscription endpoint").option("--p256dh <key>","Web only: keys.p256dh from PushSubscription").option("--auth <secret>","Web only: keys.auth from PushSubscription").option("--email <email>","Contact to link (created quietly if new)").option("--subscriber-id <id>","Existing subscriber to link").option("--device-name <name>","Device label shown in the dashboard").option("--app-version <version>","App version").option("--os-version <version>","OS version").option("--locale <locale>","Device locale, e.g. en-US").option("--timezone <tz>","IANA timezone").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>yr("devices-register",e));S(jSe,{examples:["sequenzy push devices register --platform ios --token 8f2c...e1 --email jane@example.com"]});Fv.command("remove <device-id>").description("Unsubscribe a device").option("-y, --yes","Skip the confirmation prompt").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>yr("devices-remove",{deviceId:e,...t}));var zSe=mc.command("send-test").description("Send a test push to one device or to a contact's devices").option("--device <id>","Device ID from `sequenzy push devices list`").option("--email <email>","Send to every active device of this contact").option("--subscriber-id <id>","Send to every active device of this subscriber").option("--title <title>","Notification title").option("--body <body>","Notification message").option("--url <url>","https link or app deep link opened on tap").option("--image-url <url>","https image").option("--icon-url <url>","https icon (web)").option("--platforms <platform...>","Limit to web, ios and/or android").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>yr("send-test",{...e,deviceId:e.device}));S(zSe,{notes:["Limited to 200 test pushes per company per rolling 24 hours. Tests are excluded from stats."],examples:['sequenzy push send-test --email you@example.com --title "Test" --body "Hello from Sequenzy"']});var Qs=mc.command("campaigns").description("Create, send and inspect push campaigns").action(()=>Qs.help()),DV=(e)=>e.option("--name <name>","Campaign name").option("--title <title>","Notification title").option("--body <body>","Notification message").option("--url <url>","https link or app deep link; empty string clears").option("--image-url <url>","https image; empty string clears").option("--icon-url <url>","https icon; empty string clears").option("--platforms <platform...>","Limit to web, ios and/or android").option("--all-contacts","Target every contact with a device").option("--segment <id>","Target a segment").option("--lists <ids...>","Target one or more lists").option("--target-lists-json <json>","Raw targetLists JSON").option("--target-lists-file <path>","Raw targetLists JSON file").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON");Qs.command("list").description("List push campaigns").option("--status <status>","draft, scheduled, sending, sent or cancelled").option("--limit <n>","Page size (max 100)").option("--offset <n>","Skip this many campaigns").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>yr("campaigns-list",e));var MSe=DV(Qs.command("create").description("Create a push campaign draft")).action((e)=>yr("campaigns-create",e));S(MSe,{examples:['sequenzy push campaigns create --name "Flash sale" --title "24h sale" --body "30% off everything" --url https://example.com/sale --all-contacts']});DV(Qs.command("update <campaign-id>").description("Update a draft or scheduled push campaign")).action((e,t)=>yr("campaigns-update",{campaignId:e,...t}));Qs.command("get <campaign-id>").description("Show a push campaign and its stats").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>yr("campaigns-get",{campaignId:e,...t}));var HSe=Qs.command("send <campaign-id>").description("Send a push campaign now or schedule it").option("--schedule <iso-time>","Future ISO 8601 time to schedule instead").option("-y, --yes","Skip the confirmation prompt for immediate sends").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>yr("campaigns-send",{campaignId:e,...t}));S(HSe,{notes:["Only contacts with an active device on a set-up platform receive the push."],examples:["sequenzy push campaigns send cmp_123 --yes","sequenzy push campaigns send cmp_123 --schedule 2026-10-01T15:00:00Z"]});Qs.command("unschedule <campaign-id>").description("Move a scheduled push campaign back to draft").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>yr("campaigns-unschedule",{campaignId:e,...t}));Qs.command("cancel <campaign-id>").description("Stop a scheduled or sending push campaign").option("-y, --yes","Skip the confirmation prompt").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>yr("campaigns-cancel",{campaignId:e,...t}));Qs.command("duplicate <campaign-id>").description("Copy a push campaign into a new draft").option("--name <name>","Name for the copy").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>yr("campaigns-duplicate",{campaignId:e,...t}));var GSe=Qs.command("estimate").description("Count contacts in an audience who have an active push device").option("--all-contacts","Every contact with a device").option("--segment <id>","A segment").option("--lists <ids...>","One or more lists").option("--target-lists-json <json>","Raw targetLists JSON").option("--target-lists-file <path>","Raw targetLists JSON file").option("--platforms <platform...>","Limit to web, ios and/or android").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>yr("campaigns-estimate",e));S(GSe,{examples:["sequenzy push campaigns estimate --segment seg_123 --platforms ios"]});Qs.command("stats <campaign-id>").description("Show delivery and click stats for a push campaign").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>yr("campaigns-stats",{campaignId:e,...t}));var $p=Je.command("in-app").description("In-app messages and content cards: read a contact's feed, report engagement, step stats").action(()=>$p.help());S($p,{notes:['Create items with in_app sequence steps: type: "in_app" in sequences create --steps-* or update --insert-steps-* (kind message|card, format modal|banner|fullscreen).',"Your app fetches the feed with GET /api/v1/in-app/messages (API key, from your backend) or POST /api/v1/in-app/feed (publishable key + identity token, from the browser), renders it, and reports displayed/clicked/dismissed/read."],examples:["sequenzy in-app list --email ava@example.com","sequenzy in-app list --external-id user_42 --kind card --status all","sequenzy in-app event msg_123 --type dismissed","sequenzy in-app stats node_123"]});$p.command("list").description("List a contact's open in-app messages and cards (or history)").option("--email <email>","Contact email").option("--external-id <id>","Contact external ID").option("--subscriber-id <id>","Subscriber ID").option("--kind <kind>","message or card").option("--status <status>","open (default: what the app should show now) or all (history)").option("--limit <n>","Maximum items (max 100)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>kf("list",e));$p.command("event").description("Record that an item was displayed, clicked, dismissed or read").argument("<messageId>","In-app message ID").requiredOption("--type <type>","displayed, clicked, dismissed or read").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>kf("event",{messageId:e,...t}));$p.command("delete").description("Delete an in-app message or card from the contact's feed").argument("<messageId>","In-app message ID").option("-y, --yes","Skip confirmation").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>kf("delete",{messageId:e,...t}));$p.command("stats").description("Created, displayed, clicked and dismissed counts for a step").argument("<stepId>","In-app sequence step (node) ID").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>kf("stats",{stepId:e,...t}));$2(Je);var qv=Je.command("email-design-system").description("Manage the visual identity every AI-generated email renders inside").action(()=>qv.help());S(qv,{notes:["The design system fixes the company's visual grammar (kickers, alignment, buttons, dividers, density, openers) and the composition spine that anchors email structure.","It is stored as the company's design direction text (emailDesignPrompt): adjustments rewrite that text, and free prose in it is preserved. Tokens the text does not state derive from brand context."],examples:["sequenzy email-design-system get","sequenzy email-design-system update --button-shape pill --spine editorial","sequenzy email-design-system update --reset"]});var JSe=qv.command("get").description("Show the effective email design system").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>H0("get",e));S(JSe,{notes:["The JSON output includes isDefault: true while the identity is still derived from brand context."],examples:["sequenzy email-design-system get --json"]});var VSe=qv.command("update").description("Adjust the email design system (partial update) or reset it").option("--kicker-style <style>","chip | letterspaced | none").option("--title-alignment <alignment>","left | center").option("--button-shape <shape>","rounded | pill").option("--divider-style <style>","line | space").option("--density <density>","airy | compact").option("--opener-treatments <treatments>","Comma-separated: hero-image,hero-color,header-hero,editorial-masthead,title-led").option("--spine <spine>","hero-led | editorial | product-spec").option("--reset","Clear the design direction text; return to derived defaults").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>H0("update",e));S(VSe,{notes:["Only the passed flags change; everything else keeps its current value.","Adjustments apply to every future AI email generation and sequence enrichment.","The change is written into the design direction text; custom prose in that text is preserved below the new identity. For free-prose edits use 'companies update --email-design-prompt'."],examples:["sequenzy email-design-system update --spine editorial --kicker-style letterspaced","sequenzy email-design-system update --opener-treatments editorial-masthead,title-led","sequenzy email-design-system update --reset"]});var Lv=Je.command("design-md").description("Read and edit design.md, the company's email design brief in Markdown").action(()=>Lv.help());S(Lv,{notes:["design.md holds YAML frontmatter with the exact values AI-generated emails use (logo, colors, fonts, buttons, corner radius, layout tokens), then ## Voice and ## Design direction prose. ## Reference email is read-only.","Only values you change are saved. Removing a key or section leaves it unchanged; an empty section clears it."],examples:["sequenzy design-md get > design.md","sequenzy design-md update design.md --dry-run","sequenzy design-md update design.md --expected-version <version>"]});var KSe=Lv.command("get").alias("pull").description("Print design.md (the version is printed to stderr)").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON with markdown, version and designSystem").action((e)=>U0("get",e));S(KSe,{examples:["sequenzy design-md get > design.md","sequenzy design-md pull --json"]});var WSe=Lv.command("update").alias("push").description("Save an edited design.md from a file, or stdin with -").argument("[file]","Path to design.md, or - for stdin","-").option("--dry-run","Validate and list changes without saving").option("--expected-version <version>","Fail instead of overwriting if design.md changed since this version").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>U0("update",{file:e,...t}));S(WSe,{notes:["Errors name the line to fix. Unknown keys and edits to the read-only Reference email section are reported as warnings.","A value left exactly as 'get' printed it is not saved; a changed value is pinned."],examples:["sequenzy design-md update design.md --dry-run","cat design.md | sequenzy design-md push -"]});var Uv=Je.command("sync-rules").description("Manage automatic tag changes applied when events fire").action(()=>Uv.help());S(Uv,{notes:["Sync rules map events to tag changes, e.g. an order-placed event adding a customer tag.","Rules can carry conditions: required/excluded subscriber tags, and a product match for commerce events (tag buyers by product tag, collection, type, or vendor)."],examples:["sequenzy sync-rules get","sequenzy sync-rules update --rules-file ./sync-rules.json","sequenzy sync-rules update --reset"]});var YSe=Uv.command("get").description("Show the effective sync rules").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>TB("get",e));S(YSe,{notes:["Shows the platform defaults until the company saves custom rules; the JSON output includes isDefault."],examples:["sequenzy sync-rules get --json"]});var ZSe=Uv.command("update").description("Replace the sync rules or reset them to the defaults").option("--rules-json <json>","Inline JSON array with the full rule set").option("--rules-file <file>","Path to a JSON file with the full rule set").option("--reset","Reset the company to the platform default rules").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>TB("update",e));S(ZSe,{notes:["This replaces the FULL rule set - fetch with 'sync-rules get --json', edit, then update.",'Each rule: {"triggerEvent":"...","actions":{"addTags":[...],"removeTags":[...]},"conditions":{...}}.'],examples:["sequenzy sync-rules update --rules-file ./sync-rules.json",`sequenzy sync-rules update --rules-json '[{"triggerEvent":"ecommerce.order_placed","actions":{"addTags":["vinyl-collector"],"removeTags":[]},"conditions":{"purchasedProduct":{"tags":["Vinyl"]}}}]'`,"sequenzy sync-rules update --reset"]});var Np=Je.command("generate").description("Generate email and SMS content with AI").action(()=>Np.help());S(Np,{notes:["Generated email and SMS content is returned as draft content. Review it before sending.","`generate sequence` is deprecated and persists a disabled draft. Use `sequences create <name> --trigger <trigger> --goal <goal>` instead.","Use --json when another tool or agent should parse the generated output."],examples:['sequenzy generate email "Welcome a new user to our analytics product"','sequenzy generate subjects "April product launch" --count 8','sequenzy generate sms "Cart reminder with a free-shipping hook" --count 3']});Np.command("email <prompt>").description("Generate email blocks from a prompt").option("-s, --style <style>","Prompt generation style. Pass designed or plain to force the designed or plain-text email style; other values are freeform guidance (defaults to the company's email style preference)").option("-t, --tone <tone>","Tone: professional, casual, friendly").option("--company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>_f("email",{prompt:e,...t}));Np.command("sequence <goal>").description("[DEPRECATED] Persist a disabled AI sequence draft; use `sequences create`").option("--name <name>","Optional sequence name; defaults to the goal").option("--list-id <id>","Optional list ID for the contact_added trigger").option("-c, --count <number>","Number of emails (1-10)","5").option("-d, --days <number>","Duration in days","14").option("--company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>_f("sequence",{goal:e,...t}));Np.command("subjects <topic>").description("Generate A/B subject line variants").option("-c, --count <number>","Number of variants","5").option("--company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>_f("subjects",{topic:e,...t}));var XSe=Np.command("sms <prompt>").description("Generate SMS message variants from a prompt").option("-c, --count <number>","Number of variants (1-10)","3").option("--company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>_f("sms",{prompt:e,...t}));S(XSe,{notes:["Messages are plain text with encoding and segment counts; use them as the text of an SMS sequence step.","Opt-out footers and the brand prefix are added automatically at send time - never include them in the message.","Check `sequenzy sms settings` to confirm the SMS add-on is ready before enabling SMS sequences."],examples:['sequenzy generate sms "Flash sale ends tonight" --count 5 --json']});var Nu=Je.command("web-tracking").description("Manage publishable keys for the browser tracking SDK").action(()=>Nu.help());S(Nu,{notes:["These keys are publishable: they ship in your site's page source, so they are readable by anyone. They authorize storefront events only, never the rest of the API.","Restrict every key with --origins. An empty allowlist lets any site send events with the key.","Shopify stores do not need a key - connect the integration and enable the pixel instead (`sequenzy integrations enable-pixel`).","Anonymous visits are buffered and replayed after `sequenzy.identify(email, identityToken)`. Mint the short-lived token from your authenticated backend; never expose a secret API key in browser code."],examples:['sequenzy web-tracking create --name "Storefront" --origins https://example.com,https://*.example.com',"sequenzy web-tracking list","sequenzy web-tracking update wtk_123 --origins https://example.com","sequenzy web-tracking update wtk_123 --deactivate"]});var e0e=Nu.command("list").description("List web tracking keys and where each one is allowed to run").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>aV(e));S(e0e,{examples:["sequenzy web-tracking list","sequenzy web-tracking list --json"]});var t0e=Nu.command("get <id>").description("Show one key with its install snippet").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>cV(e,t));S(t0e,{examples:["sequenzy web-tracking get wtk_123"]});var n0e=Nu.command("create").description("Create a publishable key and print the install snippet").requiredOption("--name <name>","Human-readable label, e.g. 'Storefront'").option("--origins <origins>","Comma-separated allowed origins, e.g. https://example.com,https://*.example.com").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e)=>lV(e));S(n0e,{notes:["A bare domain is read as https. Use https://*.example.com to cover subdomains; it does not match the apex, so list that separately if you need it.","Include your local development origin (e.g. http://localhost:3000) while you are wiring the SDK up.","The snippet embeds both the key and the workspace id, so paste it as printed."],examples:['sequenzy web-tracking create --name "Storefront" --origins https://example.com','sequenzy web-tracking create --name "Dev" --origins http://localhost:3000']});var r0e=Nu.command("update <id>").description("Rename a key, change its origins, or revoke it").option("--name <name>","New label").option("--origins <origins>","Replace the allowed origins (pass an empty string to clear them)").option("--activate","Re-enable a revoked key").option("--deactivate","Revoke the key without deleting it").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>uV(e,t));S(r0e,{notes:["--origins replaces the whole list rather than appending to it.","Revoking keeps the key value, so you can still find the snippet to remove from your site. Events stop within a minute."],examples:["sequenzy web-tracking update wtk_123 --origins https://example.com,https://shop.example.com","sequenzy web-tracking update wtk_123 --deactivate"]});var o0e=Nu.command("delete <id>").description("Permanently delete a web tracking key").option("-y, --yes","Skip the confirmation prompt").option("-c, --company <id>","Company ID override for personal API keys").option("--json","Print raw JSON").action((e,t)=>dV(e,t));S(o0e,{notes:["Remove the snippet from your site too, otherwise it keeps posting events that are rejected.","Prefer `update --deactivate` if you may want the key back."],examples:["sequenzy web-tracking delete wtk_123 --yes"]});await v1(Je);process.exit(process.exitCode??0);