aicommits 2.0.0-develop.12 → 2.0.0-develop.13

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.
@@ -19,7 +19,7 @@ var Zm=Object.defineProperty;var i=(e,t)=>Zm(e,"name",{value:t,configurable:!0})
19
19
  `:"")+(n?this.indentText({text:this.render(n),spaces:r}):"")}
20
20
  `}table({tableData:t,tableOptions:n,tableBreakpoints:r}){return qf(t.map(a=>a.map(s=>this.render(s))),r?Lf(r):n)}flagParameter(t){return t===Boolean?"":t===String?"<string>":t===Number?"<number>":Array.isArray(t)?this.flagParameter(t[0]):"<value>"}flagOperator(t){return" "}flagName(t){const{flag:n,flagFormatted:r,aliasesEnabled:a,aliasFormatted:s}=t;let o="";if(s?o+=`${s}, `:a&&(o+=" "),o+=r,"placeholder"in n&&typeof n.placeholder=="string")o+=`${this.flagOperator(t)}${n.placeholder}`;else{const u=this.flagParameter("type"in n?n.type:n);u&&(o+=`${this.flagOperator(t)}${u}`)}return o}flagDefault(t){return JSON.stringify(t)}flagDescription({flag:t}){let n="description"in t?t.description??"":"";if("default"in t){let{default:r}=t;typeof r=="function"&&(r=r()),r&&(n+=` (default: ${this.flagDefault(r)})`)}return n}render(t){if(typeof t=="string")return t;if(Array.isArray(t))return t.map(n=>this.render(n)).join(`
21
21
  `);if("type"in t&&this[t.type]){const n=this[t.type];if(typeof n=="function")return n.call(this,t.data)}throw new Error(`Invalid node type: ${JSON.stringify(t)}`)}},i(gn,"_z"),gn);ge(Gi,"Renderers");let Yf=Gi;const Lo=ge(e=>e.length>0&&!e.includes(" "),"isValidScriptName"),{stringify:mt}=JSON,Xf=/[|\\{}()[\]^$+*?.]/;function Lr(e){const t=[];let n,r;for(const a of e){if(r)throw new Error(`Invalid parameter: Spread parameter ${mt(r)} must be last`);const s=a[0],o=a.at(-1);let u;if(s==="<"&&o===">"&&(u=!0,n))throw new Error(`Invalid parameter: Required parameter ${mt(a)} cannot come after optional parameter ${mt(n)}`);if(s==="["&&o==="]"&&(u=!1,n=a),u===void 0)throw new Error(`Invalid parameter: ${mt(a)}. Must be wrapped in <> (required parameter) or [] (optional parameter)`);let l=a.slice(1,-1);const c=l.slice(-3)==="...";c&&(r=a,l=l.slice(0,-3));const d=l.match(Xf);if(d)throw new Error(`Invalid parameter: ${mt(a)}. Invalid character found ${mt(d[0])}`);t.push({name:l,required:u,spread:c})}return t}i(Lr,"b$1"),ge(Lr,"parseParameters");function Vr(e,t,n,r){for(let a=0;a<t.length;a+=1){const{name:s,required:o,spread:u}=t[a],l=Gf(s);if(l in e)throw new Error(`Invalid parameter: ${mt(s)} is used more than once.`);const c=u?n.slice(a):n[a];if(u&&(a=t.length),o&&(!c||u&&c.length===0))return console.error(`Error: Missing required parameter ${mt(s)}
22
- `),r(),process.exit(1);e[l]=c}}i(Vr,"v"),ge(Vr,"mapParametersToArguments");function Wi(e){return e===void 0||e!==!1}i(Wi,"G$2"),ge(Wi,"helpEnabled");function Vo(e,t,n,r){const a={...t.flags},s=t.version&&!("version"in a);s&&(a.version={type:Boolean,description:"Show version"});const{help:o}=t,u=Wi(o);u&&!("help"in a)&&(a.help={type:Boolean,alias:"h",description:"Show help"});const l=_f(a,r,{ignore:t.ignoreArgv}),c=ge(()=>{console.log(t.version)},"showVersion");if(s&&l.flags.version===!0)return c(),process.exit(0);const d=new Yf,m=u&&o?.render?o.render:v=>d.render(v),h=ge(v=>{const y=Jf({...t,...v?{help:v}:{},flags:a});console.log(m(y,d))},"showHelp");if(u&&l.flags.help===!0)return h(),process.exit(0);if(t.parameters){let{parameters:v}=t,y=l._;const F=v.indexOf("--"),E=v.slice(F+1),b=Object.create(null);if(F>-1&&E.length>0){v=v.slice(0,F);const w=l._["--"];y=y.slice(0,-w.length||void 0),Vr(b,Lr(v),y,h),Vr(b,Lr(E),w,h)}else Vr(b,Lr(v),y,h);Object.assign(l._,b)}const D={...l,showVersion:c,showHelp:h},f={command:e,...D};if(typeof n=="function"){const v=n(D);if(v&&"then"in v)return Object.assign(Promise.resolve(v),f)}return f}i(Vo,"j"),ge(Vo,"cliBase");function Hi(e,t){const n=new Map;for(const r of t){const a=[r.options.name],{alias:s}=r.options;s&&(Array.isArray(s)?a.push(...s):a.push(s));for(const o of a){if(n.has(o))throw new Error(`Duplicate command name found: ${mt(o)}`);n.set(o,r)}}return n.get(e)}i(Hi,"K$1"),ge(Hi,"getCommand");function Ji(e,t,n=process.argv.slice(2)){if(!e)throw new Error("Options is required");if("name"in e&&(!e.name||!Lo(e.name)))throw new Error(`Invalid script name: ${mt(e.name)}`);const r=n[0];if(e.commands&&r&&Lo(r)){const a=Hi(r,e.commands);if(a)return Vo(a.options.name,{...a.options,parent:e},a.callback,n.slice(1))}return Vo(void 0,e,t,n)}i(Ji,"Q"),ge(Ji,"cli");function rn(e,t){if(!e)throw new Error("Command options are required");const{name:n}=e;if(n===void 0)throw new Error("Command name is required");if(!Lo(n))throw new Error(`Invalid command name ${JSON.stringify(n)}. Command names must be one word.`);return{options:e,callback:t}}i(rn,"X"),ge(rn,"command");var Qf="aicommits",eh="2.0.0-develop.12",th="Writes your git commit messages for you with AI",nh=["ai","git","commit","code changes"],rh="MIT",oh={type:"git",url:"git+https://github.com/Nutlope/aicommits.git"},ah="Hassan El Mghari (@nutlope)",sh="module",ih=["dist"],uh={aicommits:"dist/cli.mjs",aic:"dist/cli.mjs"},lh={build:"pkgroll --minify",lint:"","type-check":"tsc",test:"tsx tests",prepack:"pnpm build && clean-pkg-json"},ch={"@clack/prompts":"^0.11.0","@types/ini":"^1.3.31","@types/node":"^24.10.1","@types/update-notifier":"^6.0.8","clean-pkg-json":"^1.3.0",cleye:"^2.0.0",clipboardy:"^5.0.0",execa:"^7.0.0","fs-fixture":"^1.2.0",ini:"^3.0.1",kolorist:"^1.8.0",manten:"^0.7.0",ai:"^6.0.13","@ai-sdk/openai":"^3.0.5","@ai-sdk/openai-compatible":"^2.0.4",pkgroll:"^2.20.1",tsx:"^4.20.6",typescript:"^5.9.3"},ph={branches:["main",{name:"develop",prerelease:!0}]},dh={"update-notifier":"^7.3.1"},Gr={name:Qf,version:eh,description:th,keywords:nh,license:rh,repository:oh,author:ah,type:sh,files:ih,bin:uh,scripts:lh,devDependencies:ch,release:ph,dependencies:dh},wt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function St(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}i(St,"getDefaultExportFromCjs");var Ot={exports:{}},Go,Ki;function mh(){if(Ki)return Go;Ki=1,Go=r,r.sync=a;var e=No;function t(s,o){var u=o.pathExt!==void 0?o.pathExt:process.env.PATHEXT;if(!u||(u=u.split(";"),u.indexOf("")!==-1))return!0;for(var l=0;l<u.length;l++){var c=u[l].toLowerCase();if(c&&s.substr(-c.length).toLowerCase()===c)return!0}return!1}i(t,"checkPathExt");function n(s,o,u){return!s.isSymbolicLink()&&!s.isFile()?!1:t(o,u)}i(n,"checkStat");function r(s,o,u){e.stat(s,function(l,c){u(l,l?!1:n(c,s,o))})}i(r,"isexe");function a(s,o){return n(e.statSync(s),s,o)}return i(a,"sync"),Go}i(mh,"requireWindows");var Wo,Yi;function fh(){if(Yi)return Wo;Yi=1,Wo=t,t.sync=n;var e=No;function t(s,o,u){e.stat(s,function(l,c){u(l,l?!1:r(c,o))})}i(t,"isexe");function n(s,o){return r(e.statSync(s),o)}i(n,"sync");function r(s,o){return s.isFile()&&a(s,o)}i(r,"checkStat");function a(s,o){var u=s.mode,l=s.uid,c=s.gid,d=o.uid!==void 0?o.uid:process.getuid&&process.getuid(),m=o.gid!==void 0?o.gid:process.getgid&&process.getgid(),h=parseInt("100",8),D=parseInt("010",8),f=parseInt("001",8),v=h|D,y=u&f||u&D&&c===m||u&h&&l===d||u&v&&d===0;return y}return i(a,"checkMode"),Wo}i(fh,"requireMode");var Ho,Xi;function hh(){if(Xi)return Ho;Xi=1;var e;process.platform==="win32"||wt.TESTING_WINDOWS?e=mh():e=fh(),Ho=t,t.sync=n;function t(r,a,s){if(typeof a=="function"&&(s=a,a={}),!s){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(o,u){t(r,a||{},function(l,c){l?u(l):o(c)})})}e(r,a||{},function(o,u){o&&(o.code==="EACCES"||a&&a.ignoreErrors)&&(o=null,u=!1),s(o,u)})}i(t,"isexe");function n(r,a){try{return e.sync(r,a||{})}catch(s){if(a&&a.ignoreErrors||s.code==="EACCES")return!1;throw s}}return i(n,"sync"),Ho}i(hh,"requireIsexe");var Jo,Qi;function Dh(){if(Qi)return Jo;Qi=1;const e=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",t=at,n=e?";":":",r=hh(),a=i(l=>Object.assign(new Error(`not found: ${l}`),{code:"ENOENT"}),"getNotFoundError"),s=i((l,c)=>{const d=c.colon||n,m=l.match(/\//)||e&&l.match(/\\/)?[""]:[...e?[process.cwd()]:[],...(c.path||process.env.PATH||"").split(d)],h=e?c.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",D=e?h.split(d):[""];return e&&l.indexOf(".")!==-1&&D[0]!==""&&D.unshift(""),{pathEnv:m,pathExt:D,pathExtExe:h}},"getPathInfo"),o=i((l,c,d)=>{typeof c=="function"&&(d=c,c={}),c||(c={});const{pathEnv:m,pathExt:h,pathExtExe:D}=s(l,c),f=[],v=i(F=>new Promise((E,b)=>{if(F===m.length)return c.all&&f.length?E(f):b(a(l));const w=m[F],S=/^".*"$/.test(w)?w.slice(1,-1):w,k=t.join(S,l),C=!S&&/^\.[\\\/]/.test(l)?l.slice(0,2)+k:k;E(y(C,F,0))}),"step"),y=i((F,E,b)=>new Promise((w,S)=>{if(b===h.length)return w(v(E+1));const k=h[b];r(F+k,{pathExt:D},(C,z)=>{if(!C&&z)if(c.all)f.push(F+k);else return w(F+k);return w(y(F,E,b+1))})}),"subStep");return d?v(0).then(F=>d(null,F),d):v(0)},"which"),u=i((l,c)=>{c=c||{};const{pathEnv:d,pathExt:m,pathExtExe:h}=s(l,c),D=[];for(let f=0;f<d.length;f++){const v=d[f],y=/^".*"$/.test(v)?v.slice(1,-1):v,F=t.join(y,l),E=!y&&/^\.[\\\/]/.test(l)?l.slice(0,2)+F:F;for(let b=0;b<m.length;b++){const w=E+m[b];try{if(r.sync(w,{pathExt:h}))if(c.all)D.push(w);else return w}catch{}}}if(c.all&&D.length)return D;if(c.nothrow)return null;throw a(l)},"whichSync");return Jo=o,o.sync=u,Jo}i(Dh,"requireWhich");var Wr={exports:{}},eu;function gh(){if(eu)return Wr.exports;eu=1;const e=i((t={})=>{const n=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(n).reverse().find(a=>a.toUpperCase()==="PATH")||"Path"},"pathKey");return Wr.exports=e,Wr.exports.default=e,Wr.exports}i(gh,"requirePathKey");var Ko,tu;function vh(){if(tu)return Ko;tu=1;const e=at,t=Dh(),n=gh();function r(s,o){const u=s.options.env||process.env,l=process.cwd(),c=s.options.cwd!=null,d=c&&process.chdir!==void 0&&!process.chdir.disabled;if(d)try{process.chdir(s.options.cwd)}catch{}let m;try{m=t.sync(s.command,{path:u[n({env:u})],pathExt:o?e.delimiter:void 0})}catch{}finally{d&&process.chdir(l)}return m&&(m=e.resolve(c?s.options.cwd:"",m)),m}i(r,"resolveCommandAttempt");function a(s){return r(s)||r(s,!0)}return i(a,"resolveCommand"),Ko=a,Ko}i(vh,"requireResolveCommand");var Hr={},nu;function yh(){if(nu)return Hr;nu=1;const e=/([()\][%!^"`<>&|;, *?])/g;function t(r){return r=r.replace(e,"^$1"),r}i(t,"escapeCommand");function n(r,a){return r=`${r}`,r=r.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),r=r.replace(/(?=(\\+?)?)\1$/,"$1$1"),r=`"${r}"`,r=r.replace(e,"^$1"),a&&(r=r.replace(e,"^$1")),r}return i(n,"escapeArgument"),Hr.command=t,Hr.argument=n,Hr}i(yh,"require_escape");var Yo,ru;function _h(){return ru||(ru=1,Yo=/^#!(.*)/),Yo}i(_h,"requireShebangRegex");var Xo,ou;function Fh(){if(ou)return Xo;ou=1;const e=_h();return Xo=i((t="")=>{const n=t.match(e);if(!n)return null;const[r,a]=n[0].replace(/#! ?/,"").split(" "),s=r.split("/").pop();return s==="env"?a:a?`${s} ${a}`:s},"shebangCommand"),Xo}i(Fh,"requireShebangCommand");var Qo,au;function Ch(){if(au)return Qo;au=1;const e=No,t=Fh();function n(r){const s=Buffer.alloc(150);let o;try{o=e.openSync(r,"r"),e.readSync(o,s,0,150,0),e.closeSync(o)}catch{}return t(s.toString())}return i(n,"readShebang"),Qo=n,Qo}i(Ch,"requireReadShebang");var ea,su;function bh(){if(su)return ea;su=1;const e=at,t=vh(),n=yh(),r=Ch(),a=process.platform==="win32",s=/\.(?:com|exe)$/i,o=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function u(d){d.file=t(d);const m=d.file&&r(d.file);return m?(d.args.unshift(d.file),d.command=m,t(d)):d.file}i(u,"detectShebang");function l(d){if(!a)return d;const m=u(d),h=!s.test(m);if(d.options.forceShell||h){const D=o.test(m);d.command=e.normalize(d.command),d.command=n.command(d.command),d.args=d.args.map(v=>n.argument(v,D));const f=[d.command].concat(d.args).join(" ");d.args=["/d","/s","/c",`"${f}"`],d.command=process.env.comspec||"cmd.exe",d.options.windowsVerbatimArguments=!0}return d}i(l,"parseNonShell");function c(d,m,h){m&&!Array.isArray(m)&&(h=m,m=null),m=m?m.slice(0):[],h=Object.assign({},h);const D={command:d,args:m,options:h,file:void 0,original:{command:d,args:m}};return h.shell?D:l(D)}return i(c,"parse"),ea=c,ea}i(bh,"requireParse");var ta,iu;function Eh(){if(iu)return ta;iu=1;const e=process.platform==="win32";function t(s,o){return Object.assign(new Error(`${o} ${s.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${o} ${s.command}`,path:s.command,spawnargs:s.args})}i(t,"notFoundError");function n(s,o){if(!e)return;const u=s.emit;s.emit=function(l,c){if(l==="exit"){const d=r(c,o);if(d)return u.call(s,"error",d)}return u.apply(s,arguments)}}i(n,"hookChildProcess");function r(s,o){return e&&s===1&&!o.file?t(o.original,"spawn"):null}i(r,"verifyENOENT");function a(s,o){return e&&s===1&&!o.file?t(o.original,"spawnSync"):null}return i(a,"verifyENOENTSync"),ta={hookChildProcess:n,verifyENOENT:r,verifyENOENTSync:a,notFoundError:t},ta}i(Eh,"requireEnoent");var uu;function wh(){if(uu)return Ot.exports;uu=1;const e=Gm,t=bh(),n=Eh();function r(s,o,u){const l=t(s,o,u),c=e.spawn(l.command,l.args,l.options);return n.hookChildProcess(c,l),c}i(r,"spawn");function a(s,o,u){const l=t(s,o,u),c=e.spawnSync(l.command,l.args,l.options);return c.error=c.error||n.verifyENOENTSync(c.status,l),c}return i(a,"spawnSync"),Ot.exports=r,Ot.exports.spawn=r,Ot.exports.sync=a,Ot.exports._parse=t,Ot.exports._enoent=n,Ot.exports}i(wh,"requireCrossSpawn");var Ah=wh(),Ih=St(Ah);function xh(e){const t=typeof e=="string"?`
22
+ `),r(),process.exit(1);e[l]=c}}i(Vr,"v"),ge(Vr,"mapParametersToArguments");function Wi(e){return e===void 0||e!==!1}i(Wi,"G$2"),ge(Wi,"helpEnabled");function Vo(e,t,n,r){const a={...t.flags},s=t.version&&!("version"in a);s&&(a.version={type:Boolean,description:"Show version"});const{help:o}=t,u=Wi(o);u&&!("help"in a)&&(a.help={type:Boolean,alias:"h",description:"Show help"});const l=_f(a,r,{ignore:t.ignoreArgv}),c=ge(()=>{console.log(t.version)},"showVersion");if(s&&l.flags.version===!0)return c(),process.exit(0);const d=new Yf,m=u&&o?.render?o.render:v=>d.render(v),h=ge(v=>{const y=Jf({...t,...v?{help:v}:{},flags:a});console.log(m(y,d))},"showHelp");if(u&&l.flags.help===!0)return h(),process.exit(0);if(t.parameters){let{parameters:v}=t,y=l._;const F=v.indexOf("--"),E=v.slice(F+1),b=Object.create(null);if(F>-1&&E.length>0){v=v.slice(0,F);const w=l._["--"];y=y.slice(0,-w.length||void 0),Vr(b,Lr(v),y,h),Vr(b,Lr(E),w,h)}else Vr(b,Lr(v),y,h);Object.assign(l._,b)}const D={...l,showVersion:c,showHelp:h},f={command:e,...D};if(typeof n=="function"){const v=n(D);if(v&&"then"in v)return Object.assign(Promise.resolve(v),f)}return f}i(Vo,"j"),ge(Vo,"cliBase");function Hi(e,t){const n=new Map;for(const r of t){const a=[r.options.name],{alias:s}=r.options;s&&(Array.isArray(s)?a.push(...s):a.push(s));for(const o of a){if(n.has(o))throw new Error(`Duplicate command name found: ${mt(o)}`);n.set(o,r)}}return n.get(e)}i(Hi,"K$1"),ge(Hi,"getCommand");function Ji(e,t,n=process.argv.slice(2)){if(!e)throw new Error("Options is required");if("name"in e&&(!e.name||!Lo(e.name)))throw new Error(`Invalid script name: ${mt(e.name)}`);const r=n[0];if(e.commands&&r&&Lo(r)){const a=Hi(r,e.commands);if(a)return Vo(a.options.name,{...a.options,parent:e},a.callback,n.slice(1))}return Vo(void 0,e,t,n)}i(Ji,"Q"),ge(Ji,"cli");function rn(e,t){if(!e)throw new Error("Command options are required");const{name:n}=e;if(n===void 0)throw new Error("Command name is required");if(!Lo(n))throw new Error(`Invalid command name ${JSON.stringify(n)}. Command names must be one word.`);return{options:e,callback:t}}i(rn,"X"),ge(rn,"command");var Qf="aicommits",eh="2.0.0-develop.13",th="Writes your git commit messages for you with AI",nh=["ai","git","commit","code changes"],rh="MIT",oh={type:"git",url:"git+https://github.com/Nutlope/aicommits.git"},ah="Hassan El Mghari (@nutlope)",sh="module",ih=["dist"],uh={aicommits:"dist/cli.mjs",aic:"dist/cli.mjs"},lh={build:"pkgroll --minify",lint:"","type-check":"tsc",test:"tsx tests",prepack:"pnpm build && clean-pkg-json"},ch={"@clack/prompts":"^0.11.0","@types/ini":"^1.3.31","@types/node":"^24.10.1","@types/update-notifier":"^6.0.8","clean-pkg-json":"^1.3.0",cleye:"^2.0.0",clipboardy:"^5.0.0",execa:"^7.0.0","fs-fixture":"^1.2.0",ini:"^3.0.1",kolorist:"^1.8.0",manten:"^0.7.0",ai:"^6.0.13","@ai-sdk/openai":"^3.0.5","@ai-sdk/openai-compatible":"^2.0.4",pkgroll:"^2.20.1",tsx:"^4.20.6",typescript:"^5.9.3"},ph={branches:["main",{name:"develop",prerelease:!0}]},dh={"update-notifier":"^7.3.1"},Gr={name:Qf,version:eh,description:th,keywords:nh,license:rh,repository:oh,author:ah,type:sh,files:ih,bin:uh,scripts:lh,devDependencies:ch,release:ph,dependencies:dh},wt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function St(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}i(St,"getDefaultExportFromCjs");var Ot={exports:{}},Go,Ki;function mh(){if(Ki)return Go;Ki=1,Go=r,r.sync=a;var e=No;function t(s,o){var u=o.pathExt!==void 0?o.pathExt:process.env.PATHEXT;if(!u||(u=u.split(";"),u.indexOf("")!==-1))return!0;for(var l=0;l<u.length;l++){var c=u[l].toLowerCase();if(c&&s.substr(-c.length).toLowerCase()===c)return!0}return!1}i(t,"checkPathExt");function n(s,o,u){return!s.isSymbolicLink()&&!s.isFile()?!1:t(o,u)}i(n,"checkStat");function r(s,o,u){e.stat(s,function(l,c){u(l,l?!1:n(c,s,o))})}i(r,"isexe");function a(s,o){return n(e.statSync(s),s,o)}return i(a,"sync"),Go}i(mh,"requireWindows");var Wo,Yi;function fh(){if(Yi)return Wo;Yi=1,Wo=t,t.sync=n;var e=No;function t(s,o,u){e.stat(s,function(l,c){u(l,l?!1:r(c,o))})}i(t,"isexe");function n(s,o){return r(e.statSync(s),o)}i(n,"sync");function r(s,o){return s.isFile()&&a(s,o)}i(r,"checkStat");function a(s,o){var u=s.mode,l=s.uid,c=s.gid,d=o.uid!==void 0?o.uid:process.getuid&&process.getuid(),m=o.gid!==void 0?o.gid:process.getgid&&process.getgid(),h=parseInt("100",8),D=parseInt("010",8),f=parseInt("001",8),v=h|D,y=u&f||u&D&&c===m||u&h&&l===d||u&v&&d===0;return y}return i(a,"checkMode"),Wo}i(fh,"requireMode");var Ho,Xi;function hh(){if(Xi)return Ho;Xi=1;var e;process.platform==="win32"||wt.TESTING_WINDOWS?e=mh():e=fh(),Ho=t,t.sync=n;function t(r,a,s){if(typeof a=="function"&&(s=a,a={}),!s){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(o,u){t(r,a||{},function(l,c){l?u(l):o(c)})})}e(r,a||{},function(o,u){o&&(o.code==="EACCES"||a&&a.ignoreErrors)&&(o=null,u=!1),s(o,u)})}i(t,"isexe");function n(r,a){try{return e.sync(r,a||{})}catch(s){if(a&&a.ignoreErrors||s.code==="EACCES")return!1;throw s}}return i(n,"sync"),Ho}i(hh,"requireIsexe");var Jo,Qi;function Dh(){if(Qi)return Jo;Qi=1;const e=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",t=at,n=e?";":":",r=hh(),a=i(l=>Object.assign(new Error(`not found: ${l}`),{code:"ENOENT"}),"getNotFoundError"),s=i((l,c)=>{const d=c.colon||n,m=l.match(/\//)||e&&l.match(/\\/)?[""]:[...e?[process.cwd()]:[],...(c.path||process.env.PATH||"").split(d)],h=e?c.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",D=e?h.split(d):[""];return e&&l.indexOf(".")!==-1&&D[0]!==""&&D.unshift(""),{pathEnv:m,pathExt:D,pathExtExe:h}},"getPathInfo"),o=i((l,c,d)=>{typeof c=="function"&&(d=c,c={}),c||(c={});const{pathEnv:m,pathExt:h,pathExtExe:D}=s(l,c),f=[],v=i(F=>new Promise((E,b)=>{if(F===m.length)return c.all&&f.length?E(f):b(a(l));const w=m[F],S=/^".*"$/.test(w)?w.slice(1,-1):w,k=t.join(S,l),C=!S&&/^\.[\\\/]/.test(l)?l.slice(0,2)+k:k;E(y(C,F,0))}),"step"),y=i((F,E,b)=>new Promise((w,S)=>{if(b===h.length)return w(v(E+1));const k=h[b];r(F+k,{pathExt:D},(C,z)=>{if(!C&&z)if(c.all)f.push(F+k);else return w(F+k);return w(y(F,E,b+1))})}),"subStep");return d?v(0).then(F=>d(null,F),d):v(0)},"which"),u=i((l,c)=>{c=c||{};const{pathEnv:d,pathExt:m,pathExtExe:h}=s(l,c),D=[];for(let f=0;f<d.length;f++){const v=d[f],y=/^".*"$/.test(v)?v.slice(1,-1):v,F=t.join(y,l),E=!y&&/^\.[\\\/]/.test(l)?l.slice(0,2)+F:F;for(let b=0;b<m.length;b++){const w=E+m[b];try{if(r.sync(w,{pathExt:h}))if(c.all)D.push(w);else return w}catch{}}}if(c.all&&D.length)return D;if(c.nothrow)return null;throw a(l)},"whichSync");return Jo=o,o.sync=u,Jo}i(Dh,"requireWhich");var Wr={exports:{}},eu;function gh(){if(eu)return Wr.exports;eu=1;const e=i((t={})=>{const n=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(n).reverse().find(a=>a.toUpperCase()==="PATH")||"Path"},"pathKey");return Wr.exports=e,Wr.exports.default=e,Wr.exports}i(gh,"requirePathKey");var Ko,tu;function vh(){if(tu)return Ko;tu=1;const e=at,t=Dh(),n=gh();function r(s,o){const u=s.options.env||process.env,l=process.cwd(),c=s.options.cwd!=null,d=c&&process.chdir!==void 0&&!process.chdir.disabled;if(d)try{process.chdir(s.options.cwd)}catch{}let m;try{m=t.sync(s.command,{path:u[n({env:u})],pathExt:o?e.delimiter:void 0})}catch{}finally{d&&process.chdir(l)}return m&&(m=e.resolve(c?s.options.cwd:"",m)),m}i(r,"resolveCommandAttempt");function a(s){return r(s)||r(s,!0)}return i(a,"resolveCommand"),Ko=a,Ko}i(vh,"requireResolveCommand");var Hr={},nu;function yh(){if(nu)return Hr;nu=1;const e=/([()\][%!^"`<>&|;, *?])/g;function t(r){return r=r.replace(e,"^$1"),r}i(t,"escapeCommand");function n(r,a){return r=`${r}`,r=r.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),r=r.replace(/(?=(\\+?)?)\1$/,"$1$1"),r=`"${r}"`,r=r.replace(e,"^$1"),a&&(r=r.replace(e,"^$1")),r}return i(n,"escapeArgument"),Hr.command=t,Hr.argument=n,Hr}i(yh,"require_escape");var Yo,ru;function _h(){return ru||(ru=1,Yo=/^#!(.*)/),Yo}i(_h,"requireShebangRegex");var Xo,ou;function Fh(){if(ou)return Xo;ou=1;const e=_h();return Xo=i((t="")=>{const n=t.match(e);if(!n)return null;const[r,a]=n[0].replace(/#! ?/,"").split(" "),s=r.split("/").pop();return s==="env"?a:a?`${s} ${a}`:s},"shebangCommand"),Xo}i(Fh,"requireShebangCommand");var Qo,au;function Ch(){if(au)return Qo;au=1;const e=No,t=Fh();function n(r){const s=Buffer.alloc(150);let o;try{o=e.openSync(r,"r"),e.readSync(o,s,0,150,0),e.closeSync(o)}catch{}return t(s.toString())}return i(n,"readShebang"),Qo=n,Qo}i(Ch,"requireReadShebang");var ea,su;function bh(){if(su)return ea;su=1;const e=at,t=vh(),n=yh(),r=Ch(),a=process.platform==="win32",s=/\.(?:com|exe)$/i,o=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function u(d){d.file=t(d);const m=d.file&&r(d.file);return m?(d.args.unshift(d.file),d.command=m,t(d)):d.file}i(u,"detectShebang");function l(d){if(!a)return d;const m=u(d),h=!s.test(m);if(d.options.forceShell||h){const D=o.test(m);d.command=e.normalize(d.command),d.command=n.command(d.command),d.args=d.args.map(v=>n.argument(v,D));const f=[d.command].concat(d.args).join(" ");d.args=["/d","/s","/c",`"${f}"`],d.command=process.env.comspec||"cmd.exe",d.options.windowsVerbatimArguments=!0}return d}i(l,"parseNonShell");function c(d,m,h){m&&!Array.isArray(m)&&(h=m,m=null),m=m?m.slice(0):[],h=Object.assign({},h);const D={command:d,args:m,options:h,file:void 0,original:{command:d,args:m}};return h.shell?D:l(D)}return i(c,"parse"),ea=c,ea}i(bh,"requireParse");var ta,iu;function Eh(){if(iu)return ta;iu=1;const e=process.platform==="win32";function t(s,o){return Object.assign(new Error(`${o} ${s.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${o} ${s.command}`,path:s.command,spawnargs:s.args})}i(t,"notFoundError");function n(s,o){if(!e)return;const u=s.emit;s.emit=function(l,c){if(l==="exit"){const d=r(c,o);if(d)return u.call(s,"error",d)}return u.apply(s,arguments)}}i(n,"hookChildProcess");function r(s,o){return e&&s===1&&!o.file?t(o.original,"spawn"):null}i(r,"verifyENOENT");function a(s,o){return e&&s===1&&!o.file?t(o.original,"spawnSync"):null}return i(a,"verifyENOENTSync"),ta={hookChildProcess:n,verifyENOENT:r,verifyENOENTSync:a,notFoundError:t},ta}i(Eh,"requireEnoent");var uu;function wh(){if(uu)return Ot.exports;uu=1;const e=Gm,t=bh(),n=Eh();function r(s,o,u){const l=t(s,o,u),c=e.spawn(l.command,l.args,l.options);return n.hookChildProcess(c,l),c}i(r,"spawn");function a(s,o,u){const l=t(s,o,u),c=e.spawnSync(l.command,l.args,l.options);return c.error=c.error||n.verifyENOENTSync(c.status,l),c}return i(a,"spawnSync"),Ot.exports=r,Ot.exports.spawn=r,Ot.exports.sync=a,Ot.exports._parse=t,Ot.exports._enoent=n,Ot.exports}i(wh,"requireCrossSpawn");var Ah=wh(),Ih=St(Ah);function xh(e){const t=typeof e=="string"?`
23
23
  `:10,n=typeof e=="string"?"\r":13;return e[e.length-1]===t&&(e=e.slice(0,-1)),e[e.length-1]===n&&(e=e.slice(0,-1)),e}i(xh,"stripFinalNewline");function lu(e={}){const{env:t=process.env,platform:n=process.platform}=e;return n!=="win32"?"PATH":Object.keys(t).reverse().find(r=>r.toUpperCase()==="PATH")||"Path"}i(lu,"pathKey");const kh=i(({cwd:e=ke.cwd(),path:t=ke.env[lu()],preferLocal:n=!0,execPath:r=ke.execPath,addExecPath:a=!0}={})=>{const s=e instanceof URL?ii(e):e,o=nn.resolve(s),u=[];return n&&$h(u,o),a&&Th(u,r,o),[...u,t].join(nn.delimiter)},"npmRunPath"),$h=i((e,t)=>{let n;for(;n!==t;)e.push(nn.join(t,"node_modules/.bin")),n=t,t=nn.resolve(t,"..")},"applyPreferLocal"),Th=i((e,t,n)=>{const r=t instanceof URL?ii(t):t;e.push(nn.resolve(n,r,".."))},"applyExecPath"),Bh=i(({env:e=ke.env,...t}={})=>{e={...e};const n=lu({env:e});return t.path=e[n],e[n]=kh(t),e},"npmRunPathEnv"),Sh=i((e,t,n,r)=>{if(n==="length"||n==="prototype"||n==="arguments"||n==="caller")return;const a=Object.getOwnPropertyDescriptor(e,n),s=Object.getOwnPropertyDescriptor(t,n);!Oh(a,s)&&r||Object.defineProperty(e,n,s)},"copyProperty"),Oh=i(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)},"canCopyProperty"),Rh=i((e,t)=>{const n=Object.getPrototypeOf(t);n!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,n)},"changePrototype"),Nh=i((e,t)=>`/* Wrapped ${e}*/
24
24
  ${t}`,"wrappedToString"),Ph=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Mh=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),jh=i((e,t,n)=>{const r=n===""?"":`with ${n.trim()}() `,a=Nh.bind(null,r,t.toString());Object.defineProperty(a,"name",Mh),Object.defineProperty(e,"toString",{...Ph,value:a})},"changeToString");function zh(e,t,{ignoreNonConfigurable:n=!1}={}){const{name:r}=e;for(const a of Reflect.ownKeys(t))Sh(e,t,a,n);return Rh(e,t),jh(e,t,r),e}i(zh,"mimicFunction");const Jr=new WeakMap,cu=i((e,t={})=>{if(typeof e!="function")throw new TypeError("Expected a function");let n,r=0;const a=e.displayName||e.name||"<anonymous>",s=i(function(...o){if(Jr.set(s,++r),r===1)n=e.apply(this,o),e=null;else if(t.throw===!0)throw new Error(`Function \`${a}\` can only be called once`);return n},"onetime2");return zh(s,e),Jr.set(s,r),s},"onetime");cu.callCount=e=>{if(!Jr.has(e))throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return Jr.get(e)};const qh=i(()=>{const e=du-pu+1;return Array.from({length:e},Zh)},"getRealtimeSignals"),Zh=i((e,t)=>({name:`SIGRT${t+1}`,number:pu+t,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),"getRealtimeSignal"),pu=34,du=64,Uh=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}],mu=i(()=>{const e=qh();return[...Uh,...e].map(Lh)},"getSignals"),Lh=i(({name:e,number:t,description:n,action:r,forced:a=!1,standard:s})=>{const{signals:{[e]:o}}=ui,u=o!==void 0;return{name:e,number:u?o:t,description:n,supported:u,action:r,forced:a,standard:s}},"normalizeSignal"),Vh=i(()=>{const e=mu();return Object.fromEntries(e.map(Gh))},"getSignalsByName"),Gh=i(({name:e,number:t,description:n,supported:r,action:a,forced:s,standard:o})=>[e,{name:e,number:t,description:n,supported:r,action:a,forced:s,standard:o}],"getSignalByName"),Wh=Vh(),Hh=i(()=>{const e=mu(),t=du+1,n=Array.from({length:t},(r,a)=>Jh(a,e));return Object.assign({},...n)},"getSignalsByNumber"),Jh=i((e,t)=>{const n=Kh(e,t);if(n===void 0)return{};const{name:r,description:a,supported:s,action:o,forced:u,standard:l}=n;return{[e]:{name:r,number:e,description:a,supported:s,action:o,forced:u,standard:l}}},"getSignalByNumber"),Kh=i((e,t)=>{const n=t.find(({name:r})=>ui.signals[r]===e);return n!==void 0?n:t.find(r=>r.number===e)},"findSignalByNumber");Hh();const Yh=i(({timedOut:e,timeout:t,errorCode:n,signal:r,signalDescription:a,exitCode:s,isCanceled:o})=>e?`timed out after ${t} milliseconds`:o?"was canceled":n!==void 0?`failed with ${n}`:r!==void 0?`was killed with ${r} (${a})`:s!==void 0?`failed with exit code ${s}`:"failed","getErrorPrefix"),fu=i(({stdout:e,stderr:t,all:n,error:r,signal:a,exitCode:s,command:o,escapedCommand:u,timedOut:l,isCanceled:c,killed:d,parsed:{options:{timeout:m,cwd:h=ke.cwd()}}})=>{s=s===null?void 0:s,a=a===null?void 0:a;const D=a===void 0?void 0:Wh[a].description,f=r&&r.code,y=`Command ${Yh({timedOut:l,timeout:m,errorCode:f,signal:a,signalDescription:D,exitCode:s,isCanceled:c})}: ${o}`,F=Object.prototype.toString.call(r)==="[object Error]",E=F?`${y}
25
25
  ${r.message}`:y,b=[E,t,e].filter(Boolean).join(`
@@ -119,7 +119,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
119
119
  ]))`;continue}else if(a[c]==="$"){s+=`($|(?=[\r
120
120
  ]))`;continue}}if(r.s&&a[c]==="."){s+=u?`${a[c]}\r
121
121
  `:`[${a[c]}\r
122
- ]`;continue}s+=a[c],a[c]==="\\"?o=!0:u&&a[c]==="]"?u=!1:!u&&a[c]==="["&&(u=!0)}try{new RegExp(s)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return s}i(np,"stringifyRegExpWithFlags");function rp(e,t){var n,r,a,s,o,u;const l={type:"object",additionalProperties:(n=le(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))!=null?n:t.allowedAdditionalProperties};if(((r=e.keyType)==null?void 0:r._def.typeName)===Y.ZodString&&((a=e.keyType._def.checks)!=null&&a.length)){const{type:c,...d}=tp(e.keyType._def,t);return{...l,propertyNames:d}}else{if(((s=e.keyType)==null?void 0:s._def.typeName)===Y.ZodEnum)return{...l,propertyNames:{enum:e.keyType._def.values}};if(((o=e.keyType)==null?void 0:o._def.typeName)===Y.ZodBranded&&e.keyType._def.type._def.typeName===Y.ZodString&&((u=e.keyType._def.type._def.checks)!=null&&u.length)){const{type:c,...d}=Qc(e.keyType._def,t);return{...l,propertyNames:d}}}return l}i(rp,"parseRecordDef");function GF(e,t){if(t.mapStrategy==="record")return rp(e,t);const n=le(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||Je(),r=le(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||Je();return{type:"array",maxItems:125,items:{type:"array",items:[n,r],minItems:2,maxItems:2}}}i(GF,"parseMapDef");function WF(e){const t=e.values,r=Object.keys(e.values).filter(s=>typeof t[t[s]]!="number").map(s=>t[s]),a=Array.from(new Set(r.map(s=>typeof s)));return{type:a.length===1?a[0]==="string"?"string":"number":["string","number"],enum:r}}i(WF,"parseNativeEnumDef");function HF(){return{not:Je()}}i(HF,"parseNeverDef");function JF(){return{type:"null"}}i(JF,"parseNullDef");var rs={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function KF(e,t){const n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(r=>r._def.typeName in rs&&(!r._def.checks||!r._def.checks.length))){const r=n.reduce((a,s)=>{const o=rs[s._def.typeName];return o&&!a.includes(o)?[...a,o]:a},[]);return{type:r.length>1?r:r[0]}}else if(n.every(r=>r._def.typeName==="ZodLiteral"&&!r.description)){const r=n.reduce((a,s)=>{const o=typeof s._def.value;switch(o){case"string":case"number":case"boolean":return[...a,o];case"bigint":return[...a,"integer"];case"object":if(s._def.value===null)return[...a,"null"];case"symbol":case"undefined":case"function":default:return a}},[]);if(r.length===n.length){const a=r.filter((s,o,u)=>u.indexOf(s)===o);return{type:a.length>1?a:a[0],enum:n.reduce((s,o)=>s.includes(o._def.value)?s:[...s,o._def.value],[])}}}else if(n.every(r=>r._def.typeName==="ZodEnum"))return{type:"string",enum:n.reduce((r,a)=>[...r,...a._def.values.filter(s=>!r.includes(s))],[])};return YF(e,t)}i(KF,"parseUnionDef");var YF=i((e,t)=>{const n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((r,a)=>le(r._def,{...t,currentPath:[...t.currentPath,"anyOf",`${a}`]})).filter(r=>!!r&&(!t.strictUnions||typeof r=="object"&&Object.keys(r).length>0));return n.length?{anyOf:n}:void 0},"asAnyOf");function XF(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[rs[e.innerType._def.typeName],"null"]};const n=le(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}i(XF,"parseNullableDef");function QF(e){const t={type:"number"};if(!e.checks)return t;for(const n of e.checks)switch(n.kind){case"int":t.type="integer";break;case"min":n.inclusive?t.minimum=n.value:t.exclusiveMinimum=n.value;break;case"max":n.inclusive?t.maximum=n.value:t.exclusiveMaximum=n.value;break;case"multipleOf":t.multipleOf=n.value;break}return t}i(QF,"parseNumberDef");function e2(e,t){const n={type:"object",properties:{}},r=[],a=e.shape();for(const o in a){let u=a[o];if(u===void 0||u._def===void 0)continue;const l=n2(u),c=le(u._def,{...t,currentPath:[...t.currentPath,"properties",o],propertyPath:[...t.currentPath,"properties",o]});c!==void 0&&(n.properties[o]=c,l||r.push(o))}r.length&&(n.required=r);const s=t2(e,t);return s!==void 0&&(n.additionalProperties=s),n}i(e2,"parseObjectDef");function t2(e,t){if(e.catchall._def.typeName!=="ZodNever")return le(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}i(t2,"decideAdditionalProperties");function n2(e){try{return e.isOptional()}catch{return!0}}i(n2,"safeIsOptional");var r2=i((e,t)=>{var n;if(t.currentPath.toString()===((n=t.propertyPath)==null?void 0:n.toString()))return le(e.innerType._def,t);const r=le(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:Je()},r]}:Je()},"parseOptionalDef"),o2=i((e,t)=>{if(t.pipeStrategy==="input")return le(e.in._def,t);if(t.pipeStrategy==="output")return le(e.out._def,t);const n=le(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),r=le(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",n?"1":"0"]});return{allOf:[n,r].filter(a=>a!==void 0)}},"parsePipelineDef");function a2(e,t){return le(e.type._def,t)}i(a2,"parsePromiseDef");function s2(e,t){const r={type:"array",uniqueItems:!0,items:le(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&(r.minItems=e.minSize.value),e.maxSize&&(r.maxItems=e.maxSize.value),r}i(s2,"parseSetDef");function i2(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((n,r)=>le(n._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[]),additionalItems:le(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((n,r)=>le(n._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[])}}i(i2,"parseTupleDef");function u2(){return{not:Je()}}i(u2,"parseUndefinedDef");function l2(){return Je()}i(l2,"parseUnknownDef");var c2=i((e,t)=>le(e.innerType._def,t),"parseReadonlyDef"),p2=i((e,t,n)=>{switch(t){case Y.ZodString:return tp(e,n);case Y.ZodNumber:return QF(e);case Y.ZodObject:return e2(e,n);case Y.ZodBigInt:return OF(e);case Y.ZodBoolean:return RF();case Y.ZodDate:return ep(e,n);case Y.ZodUndefined:return u2();case Y.ZodNull:return JF();case Y.ZodArray:return SF(e,n);case Y.ZodUnion:case Y.ZodDiscriminatedUnion:return KF(e,n);case Y.ZodIntersection:return ZF(e,n);case Y.ZodTuple:return i2(e,n);case Y.ZodRecord:return rp(e,n);case Y.ZodLiteral:return UF(e);case Y.ZodEnum:return zF(e);case Y.ZodNativeEnum:return WF(e);case Y.ZodNullable:return XF(e,n);case Y.ZodOptional:return r2(e,n);case Y.ZodMap:return GF(e,n);case Y.ZodSet:return s2(e,n);case Y.ZodLazy:return()=>e.getter()._def;case Y.ZodPromise:return a2(e,n);case Y.ZodNaN:case Y.ZodNever:return HF();case Y.ZodEffects:return jF(e,n);case Y.ZodAny:return Je();case Y.ZodUnknown:return l2();case Y.ZodDefault:return MF(e,n);case Y.ZodBranded:return Qc(e,n);case Y.ZodReadonly:return c2(e,n);case Y.ZodCatch:return NF(e,n);case Y.ZodPipeline:return o2(e,n);case Y.ZodFunction:case Y.ZodVoid:case Y.ZodSymbol:return;default:return(r=>{})()}},"selectParser"),d2=i((e,t)=>{let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];n++);return[(e.length-n).toString(),...t.slice(n)].join("/")},"getRelativePath");function le(e,t,n=!1){var r;const a=t.seen.get(e);if(t.override){const l=(r=t.override)==null?void 0:r.call(t,e,t,a,n);if(l!==TF)return l}if(a&&!n){const l=m2(a,t);if(l!==void 0)return l}const s={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,s);const o=p2(e,e.typeName,t),u=typeof o=="function"?le(o(),t):o;if(u&&f2(e,t,u),t.postProcess){const l=t.postProcess(u,e,t);return s.jsonSchema=u,l}return s.jsonSchema=u,u}i(le,"parseDef");var m2=i((e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:d2(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((n,r)=>t.currentPath[r]===n)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),Je()):t.$refStrategy==="seen"?Je():void 0}},"get$ref"),f2=i((e,t,n)=>(e.description&&(n.description=e.description),n),"addMeta"),h2=i(e=>{const t=BF(e),n=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([r,a])=>[a._def,{def:a._def,path:[...t.basePath,t.definitionPath,r],jsonSchema:void 0}]))}},"getRefs"),D2=i((e,t)=>{var n;const r=h2(t);let a=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((c,[d,m])=>{var h;return{...c,[d]:(h=le(m._def,{...r,currentPath:[...r.basePath,r.definitionPath,d]},!0))!=null?h:Je()}},{}):void 0;const s=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,o=(n=le(e._def,s===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,s]},!1))!=null?n:Je(),u=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;u!==void 0&&(o.title=u);const l=s===void 0?a?{...o,[r.definitionPath]:a}:o:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,s].join("/"),[r.definitionPath]:{...a,[s]:o}};return l.$schema="http://json-schema.org/draft-07/schema#",l},"zod3ToJsonSchema"),os=Symbol.for("vercel.ai.schema");function J(e){let t;return()=>(t==null&&(t=e()),t)}i(J,"lazySchema");function Eo(e,{validate:t}={}){return{[os]:!0,_type:void 0,get jsonSchema(){return typeof e=="function"&&(e=e()),e},validate:t}}i(Eo,"jsonSchema");function g2(e){return typeof e=="object"&&e!==null&&os in e&&e[os]===!0&&"jsonSchema"in e&&"validate"in e}i(g2,"isSchema");function mn(e){return e==null?Eo({properties:{},additionalProperties:!1}):g2(e)?e:"~standard"in e?e["~standard"].vendor==="zod"?G(e):v2(e):e()}i(mn,"asSchema");function v2(e){return Eo(()=>e["~standard"].jsonSchema.input({target:"draft-07"}),{validate:i(async t=>{const n=await e["~standard"].validate(t);return"value"in n?{success:!0,value:n.value}:{success:!1,error:new zt({value:t,cause:n.issues})}},"validate")})}i(v2,"standardSchema");function y2(e,t){var n;const r=(n=void 0)!=null?n:!1;return Eo(()=>D2(e,{$refStrategy:r?"root":"none"}),{validate:i(async a=>{const s=await e.safeParseAsync(a);return s.success?{success:!0,value:s.data}:{success:!1,error:s.error}},"validate")})}i(y2,"zod3Schema");function _2(e,t){var n;const r=(n=void 0)!=null?n:!1;return Eo(()=>Yc(o_(e,{target:"draft-7",io:"input",reused:r?"ref":"inline"})),{validate:i(async a=>{const s=await kc(e,a);return s.success?{success:!0,value:s.data}:{success:!1,error:s.error}},"validate")})}i(_2,"zod4Schema");function F2(e){return"_zod"in e}i(F2,"isZod4Schema");function G(e,t){return F2(e)?_2(e):y2(e)}i(G,"zodSchema");async function et({value:e,schema:t}){const n=await ut({value:e,schema:t});if(!n.success)throw zt.wrap({value:e,cause:n.error});return n.value}i(et,"validateTypes");async function ut({value:e,schema:t}){const n=mn(t);try{if(n.validate==null)return{success:!0,value:e,rawValue:e};const r=await n.validate(e);return r.success?{success:!0,value:r.value,rawValue:e}:{success:!1,error:zt.wrap({value:e,cause:r.error}),rawValue:e}}catch(r){return{success:!1,error:zt.wrap({value:e,cause:r}),rawValue:e}}}i(ut,"safeValidateTypes");async function C2({text:e,schema:t}){try{const n=es(e);return t==null?n:et({value:n,schema:t})}catch(n){throw lo.isInstance(n)||zt.isInstance(n)?n:new lo({text:e,cause:n})}}i(C2,"parseJSON");async function lt({text:e,schema:t}){try{const n=es(e);return t==null?{success:!0,value:n,rawValue:n}:await ut({value:n,schema:t})}catch(n){return{success:!1,error:lo.isInstance(n)?n:new lo({text:e,cause:n}),rawValue:void 0}}}i(lt,"safeParseJSON");function wo(e){try{return es(e),!0}catch{return!1}}i(wo,"isParsableJson");function b2({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new Ya).pipeThrough(new TransformStream({async transform({data:n},r){n!=="[DONE]"&&r.enqueue(await lt({text:n,schema:t}))}}))}i(b2,"parseJsonEventStream");async function Le({provider:e,providerOptions:t,schema:n}){if(t?.[e]==null)return;const r=await ut({value:t[e],schema:n});if(!r.success)throw new _l({argument:"providerOptions",message:`invalid ${e} provider options`,cause:r.error});return r.value}i(Le,"parseProviderOptions");var E2=i(()=>globalThis.fetch,"getOriginalFetch2"),Se=i(async({url:e,headers:t,body:n,failedResponseHandler:r,successfulResponseHandler:a,abortSignal:s,fetch:o})=>op({url:e,headers:{"Content-Type":"application/json",...t},body:{content:JSON.stringify(n),values:n},failedResponseHandler:r,successfulResponseHandler:a,abortSignal:s,fetch:o}),"postJsonToApi"),as=i(async({url:e,headers:t,formData:n,failedResponseHandler:r,successfulResponseHandler:a,abortSignal:s,fetch:o})=>op({url:e,headers:t,body:{content:n,values:Object.fromEntries(n.entries())},failedResponseHandler:r,successfulResponseHandler:a,abortSignal:s,fetch:o}),"postFormDataToApi"),op=i(async({url:e,headers:t={},body:n,successfulResponseHandler:r,failedResponseHandler:a,abortSignal:s,fetch:o=E2()})=>{try{const u=await o(e,{method:"POST",headers:Gt(t,`ai-sdk/provider-utils/${Hc}`,Qa()),body:n.content,signal:s}),l=cn(u);if(!u.ok){let c;try{c=await a({response:u,url:e,requestBodyValues:n.values})}catch(d){throw dn(d)||Re.isInstance(d)?d:new Re({message:"Failed to process error response",cause:d,statusCode:u.status,url:e,responseHeaders:l,requestBodyValues:n.values})}throw c.value}try{return await r({response:u,url:e,requestBodyValues:n.values})}catch(c){throw c instanceof Error&&(dn(c)||Re.isInstance(c))?c:new Re({message:"Failed to process successful response",cause:c,statusCode:u.status,url:e,responseHeaders:l,requestBodyValues:n.values})}}catch(u){throw Wc({error:u,url:e,requestBodyValues:n.values})}},"postToApi");function z1(e){return e}i(z1,"tool");function yt({id:e,inputSchema:t,outputSchema:n,supportsDeferredResults:r}){return({execute:a,needsApproval:s,toModelOutput:o,onInputStart:u,onInputDelta:l,onInputAvailable:c,...d})=>({type:"provider",id:e,args:d,inputSchema:t,outputSchema:n,execute:a,needsApproval:s,toModelOutput:o,onInputStart:u,onInputDelta:l,onInputAvailable:c,supportsDeferredResults:r})}i(yt,"createProviderToolFactoryWithOutputSchema");async function tt(e){return typeof e=="function"&&(e=e()),Promise.resolve(e)}i(tt,"resolve");var nt=i(({errorSchema:e,errorToMessage:t,isRetryable:n})=>async({response:r,url:a,requestBodyValues:s})=>{const o=await r.text(),u=cn(r);if(o.trim()==="")return{responseHeaders:u,value:new Re({message:r.statusText,url:a,requestBodyValues:s,statusCode:r.status,responseHeaders:u,responseBody:o,isRetryable:n?.(r)})};try{const l=await C2({text:o,schema:e});return{responseHeaders:u,value:new Re({message:t(l),url:a,requestBodyValues:s,statusCode:r.status,responseHeaders:u,responseBody:o,data:l,isRetryable:n?.(r,l)})}}catch{return{responseHeaders:u,value:new Re({message:r.statusText,url:a,requestBodyValues:s,statusCode:r.status,responseHeaders:u,responseBody:o,isRetryable:n?.(r)})}}},"createJsonErrorResponseHandler"),fn=i(e=>async({response:t})=>{const n=cn(t);if(t.body==null)throw new tv({});return{responseHeaders:n,value:b2({stream:t.body,schema:e})}},"createEventSourceResponseHandler"),Pe=i(e=>async({response:t,url:n,requestBodyValues:r})=>{const a=await t.text(),s=await lt({text:a,schema:e}),o=cn(t);if(!s.success)throw new Re({message:"Invalid JSON response",cause:s.error,statusCode:t.status,responseHeaders:o,responseBody:a,url:n,requestBodyValues:r});return{responseHeaders:o,value:s.value,rawValue:s.rawValue}},"createJsonResponseHandler"),w2=i(()=>async({response:e,url:t,requestBodyValues:n})=>{const r=cn(e);if(!e.body)throw new Re({message:"Response body is empty",url:t,requestBodyValues:n,statusCode:e.status,responseHeaders:r,responseBody:void 0});try{const a=await e.arrayBuffer();return{responseHeaders:r,value:new Uint8Array(a)}}catch(a){throw new Re({message:"Failed to read response as array buffer",url:t,requestBodyValues:n,statusCode:e.status,responseHeaders:r,responseBody:void 0,cause:a})}},"createBinaryResponseHandler");function ss(e){return e?.replace(/\/$/,"")}i(ss,"withoutTrailingSlash");function A2(e){return e!=null&&typeof e[Symbol.asyncIterator]=="function"}i(A2,"isAsyncIterable");async function*I2({execute:e,input:t,options:n}){const r=e(t,n);if(A2(r)){let a;for await(const s of r)a=s,yield{type:"preliminary",output:s};yield{type:"final",output:a}}else yield{type:"final",output:await r}}i(I2,"executeTool");var is,ap;function sp(){if(ap)return is;ap=1;var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,a=i((d,m)=>{for(var h in m)e(d,h,{get:m[h],enumerable:!0})},"__export"),s=i((d,m,h,D)=>{if(m&&typeof m=="object"||typeof m=="function")for(let f of n(m))!r.call(d,f)&&f!==h&&e(d,f,{get:i(()=>m[f],"get"),enumerable:!(D=t(m,f))||D.enumerable});return d},"__copyProps"),o=i(d=>s(e({},"__esModule",{value:!0}),d),"__toCommonJS"),u={};a(u,{SYMBOL_FOR_REQ_CONTEXT:i(()=>l,"SYMBOL_FOR_REQ_CONTEXT"),getContext:i(()=>c,"getContext")}),is=o(u);const l=Symbol.for("@vercel/request-context");function c(){return globalThis[l]?.get?.()??{}}return i(c,"getContext"),is}i(sp,"requireGetContext");var us,ip;function up(){if(ip)return us;ip=1;var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,a=i((d,m)=>{for(var h in m)e(d,h,{get:m[h],enumerable:!0})},"__export"),s=i((d,m,h,D)=>{if(m&&typeof m=="object"||typeof m=="function")for(let f of n(m))!r.call(d,f)&&f!==h&&e(d,f,{get:i(()=>m[f],"get"),enumerable:!(D=t(m,f))||D.enumerable});return d},"__copyProps"),o=i(d=>s(e({},"__esModule",{value:!0}),d),"__toCommonJS"),u={};a(u,{VercelOidcTokenError:i(()=>l,"VercelOidcTokenError")}),us=o(u);const c=class c extends Error{constructor(m,h){super(m),this.name="VercelOidcTokenError",this.cause=h}toString(){return this.cause?`${this.name}: ${this.message}: ${this.cause}`:`${this.name}: ${this.message}`}};i(c,"VercelOidcTokenError");let l=c;return us}i(up,"requireTokenError");var ls,lp;function x2(){if(lp)return ls;lp=1;var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,a=i((h,D)=>{for(var f in D)e(h,f,{get:D[f],enumerable:!0})},"__export"),s=i((h,D,f,v)=>{if(D&&typeof D=="object"||typeof D=="function")for(let y of n(D))!r.call(h,y)&&y!==f&&e(h,y,{get:i(()=>D[y],"get"),enumerable:!(v=t(D,y))||v.enumerable});return h},"__copyProps"),o=i(h=>s(e({},"__esModule",{value:!0}),h),"__toCommonJS"),u={};a(u,{getVercelOidcToken:i(()=>d,"getVercelOidcToken"),getVercelOidcTokenSync:i(()=>m,"getVercelOidcTokenSync")}),ls=o(u);var l=sp(),c=up();async function d(){let h="",D;try{h=m()}catch(f){D=f}try{const[{getTokenPayload:f,isExpired:v},{refreshToken:y}]=await Promise.all([await import("./token-util-DHPwkGN_.mjs").then(function(F){return F.t}),await import("./token-B4wZymUi.mjs").then(function(F){return F.t})]);(!h||v(f(h)))&&(await y(),h=m())}catch(f){let v=D instanceof Error?D.message:"";throw f instanceof Error&&(v=`${v}
122
+ ]`;continue}s+=a[c],a[c]==="\\"?o=!0:u&&a[c]==="]"?u=!1:!u&&a[c]==="["&&(u=!0)}try{new RegExp(s)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return s}i(np,"stringifyRegExpWithFlags");function rp(e,t){var n,r,a,s,o,u;const l={type:"object",additionalProperties:(n=le(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))!=null?n:t.allowedAdditionalProperties};if(((r=e.keyType)==null?void 0:r._def.typeName)===Y.ZodString&&((a=e.keyType._def.checks)!=null&&a.length)){const{type:c,...d}=tp(e.keyType._def,t);return{...l,propertyNames:d}}else{if(((s=e.keyType)==null?void 0:s._def.typeName)===Y.ZodEnum)return{...l,propertyNames:{enum:e.keyType._def.values}};if(((o=e.keyType)==null?void 0:o._def.typeName)===Y.ZodBranded&&e.keyType._def.type._def.typeName===Y.ZodString&&((u=e.keyType._def.type._def.checks)!=null&&u.length)){const{type:c,...d}=Qc(e.keyType._def,t);return{...l,propertyNames:d}}}return l}i(rp,"parseRecordDef");function GF(e,t){if(t.mapStrategy==="record")return rp(e,t);const n=le(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||Je(),r=le(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||Je();return{type:"array",maxItems:125,items:{type:"array",items:[n,r],minItems:2,maxItems:2}}}i(GF,"parseMapDef");function WF(e){const t=e.values,r=Object.keys(e.values).filter(s=>typeof t[t[s]]!="number").map(s=>t[s]),a=Array.from(new Set(r.map(s=>typeof s)));return{type:a.length===1?a[0]==="string"?"string":"number":["string","number"],enum:r}}i(WF,"parseNativeEnumDef");function HF(){return{not:Je()}}i(HF,"parseNeverDef");function JF(){return{type:"null"}}i(JF,"parseNullDef");var rs={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function KF(e,t){const n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(r=>r._def.typeName in rs&&(!r._def.checks||!r._def.checks.length))){const r=n.reduce((a,s)=>{const o=rs[s._def.typeName];return o&&!a.includes(o)?[...a,o]:a},[]);return{type:r.length>1?r:r[0]}}else if(n.every(r=>r._def.typeName==="ZodLiteral"&&!r.description)){const r=n.reduce((a,s)=>{const o=typeof s._def.value;switch(o){case"string":case"number":case"boolean":return[...a,o];case"bigint":return[...a,"integer"];case"object":if(s._def.value===null)return[...a,"null"];case"symbol":case"undefined":case"function":default:return a}},[]);if(r.length===n.length){const a=r.filter((s,o,u)=>u.indexOf(s)===o);return{type:a.length>1?a:a[0],enum:n.reduce((s,o)=>s.includes(o._def.value)?s:[...s,o._def.value],[])}}}else if(n.every(r=>r._def.typeName==="ZodEnum"))return{type:"string",enum:n.reduce((r,a)=>[...r,...a._def.values.filter(s=>!r.includes(s))],[])};return YF(e,t)}i(KF,"parseUnionDef");var YF=i((e,t)=>{const n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((r,a)=>le(r._def,{...t,currentPath:[...t.currentPath,"anyOf",`${a}`]})).filter(r=>!!r&&(!t.strictUnions||typeof r=="object"&&Object.keys(r).length>0));return n.length?{anyOf:n}:void 0},"asAnyOf");function XF(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[rs[e.innerType._def.typeName],"null"]};const n=le(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}i(XF,"parseNullableDef");function QF(e){const t={type:"number"};if(!e.checks)return t;for(const n of e.checks)switch(n.kind){case"int":t.type="integer";break;case"min":n.inclusive?t.minimum=n.value:t.exclusiveMinimum=n.value;break;case"max":n.inclusive?t.maximum=n.value:t.exclusiveMaximum=n.value;break;case"multipleOf":t.multipleOf=n.value;break}return t}i(QF,"parseNumberDef");function e2(e,t){const n={type:"object",properties:{}},r=[],a=e.shape();for(const o in a){let u=a[o];if(u===void 0||u._def===void 0)continue;const l=n2(u),c=le(u._def,{...t,currentPath:[...t.currentPath,"properties",o],propertyPath:[...t.currentPath,"properties",o]});c!==void 0&&(n.properties[o]=c,l||r.push(o))}r.length&&(n.required=r);const s=t2(e,t);return s!==void 0&&(n.additionalProperties=s),n}i(e2,"parseObjectDef");function t2(e,t){if(e.catchall._def.typeName!=="ZodNever")return le(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}i(t2,"decideAdditionalProperties");function n2(e){try{return e.isOptional()}catch{return!0}}i(n2,"safeIsOptional");var r2=i((e,t)=>{var n;if(t.currentPath.toString()===((n=t.propertyPath)==null?void 0:n.toString()))return le(e.innerType._def,t);const r=le(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:Je()},r]}:Je()},"parseOptionalDef"),o2=i((e,t)=>{if(t.pipeStrategy==="input")return le(e.in._def,t);if(t.pipeStrategy==="output")return le(e.out._def,t);const n=le(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),r=le(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",n?"1":"0"]});return{allOf:[n,r].filter(a=>a!==void 0)}},"parsePipelineDef");function a2(e,t){return le(e.type._def,t)}i(a2,"parsePromiseDef");function s2(e,t){const r={type:"array",uniqueItems:!0,items:le(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&(r.minItems=e.minSize.value),e.maxSize&&(r.maxItems=e.maxSize.value),r}i(s2,"parseSetDef");function i2(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((n,r)=>le(n._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[]),additionalItems:le(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((n,r)=>le(n._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[])}}i(i2,"parseTupleDef");function u2(){return{not:Je()}}i(u2,"parseUndefinedDef");function l2(){return Je()}i(l2,"parseUnknownDef");var c2=i((e,t)=>le(e.innerType._def,t),"parseReadonlyDef"),p2=i((e,t,n)=>{switch(t){case Y.ZodString:return tp(e,n);case Y.ZodNumber:return QF(e);case Y.ZodObject:return e2(e,n);case Y.ZodBigInt:return OF(e);case Y.ZodBoolean:return RF();case Y.ZodDate:return ep(e,n);case Y.ZodUndefined:return u2();case Y.ZodNull:return JF();case Y.ZodArray:return SF(e,n);case Y.ZodUnion:case Y.ZodDiscriminatedUnion:return KF(e,n);case Y.ZodIntersection:return ZF(e,n);case Y.ZodTuple:return i2(e,n);case Y.ZodRecord:return rp(e,n);case Y.ZodLiteral:return UF(e);case Y.ZodEnum:return zF(e);case Y.ZodNativeEnum:return WF(e);case Y.ZodNullable:return XF(e,n);case Y.ZodOptional:return r2(e,n);case Y.ZodMap:return GF(e,n);case Y.ZodSet:return s2(e,n);case Y.ZodLazy:return()=>e.getter()._def;case Y.ZodPromise:return a2(e,n);case Y.ZodNaN:case Y.ZodNever:return HF();case Y.ZodEffects:return jF(e,n);case Y.ZodAny:return Je();case Y.ZodUnknown:return l2();case Y.ZodDefault:return MF(e,n);case Y.ZodBranded:return Qc(e,n);case Y.ZodReadonly:return c2(e,n);case Y.ZodCatch:return NF(e,n);case Y.ZodPipeline:return o2(e,n);case Y.ZodFunction:case Y.ZodVoid:case Y.ZodSymbol:return;default:return(r=>{})()}},"selectParser"),d2=i((e,t)=>{let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];n++);return[(e.length-n).toString(),...t.slice(n)].join("/")},"getRelativePath");function le(e,t,n=!1){var r;const a=t.seen.get(e);if(t.override){const l=(r=t.override)==null?void 0:r.call(t,e,t,a,n);if(l!==TF)return l}if(a&&!n){const l=m2(a,t);if(l!==void 0)return l}const s={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,s);const o=p2(e,e.typeName,t),u=typeof o=="function"?le(o(),t):o;if(u&&f2(e,t,u),t.postProcess){const l=t.postProcess(u,e,t);return s.jsonSchema=u,l}return s.jsonSchema=u,u}i(le,"parseDef");var m2=i((e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:d2(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((n,r)=>t.currentPath[r]===n)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),Je()):t.$refStrategy==="seen"?Je():void 0}},"get$ref"),f2=i((e,t,n)=>(e.description&&(n.description=e.description),n),"addMeta"),h2=i(e=>{const t=BF(e),n=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([r,a])=>[a._def,{def:a._def,path:[...t.basePath,t.definitionPath,r],jsonSchema:void 0}]))}},"getRefs"),D2=i((e,t)=>{var n;const r=h2(t);let a=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((c,[d,m])=>{var h;return{...c,[d]:(h=le(m._def,{...r,currentPath:[...r.basePath,r.definitionPath,d]},!0))!=null?h:Je()}},{}):void 0;const s=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,o=(n=le(e._def,s===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,s]},!1))!=null?n:Je(),u=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;u!==void 0&&(o.title=u);const l=s===void 0?a?{...o,[r.definitionPath]:a}:o:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,s].join("/"),[r.definitionPath]:{...a,[s]:o}};return l.$schema="http://json-schema.org/draft-07/schema#",l},"zod3ToJsonSchema"),os=Symbol.for("vercel.ai.schema");function J(e){let t;return()=>(t==null&&(t=e()),t)}i(J,"lazySchema");function Eo(e,{validate:t}={}){return{[os]:!0,_type:void 0,get jsonSchema(){return typeof e=="function"&&(e=e()),e},validate:t}}i(Eo,"jsonSchema");function g2(e){return typeof e=="object"&&e!==null&&os in e&&e[os]===!0&&"jsonSchema"in e&&"validate"in e}i(g2,"isSchema");function mn(e){return e==null?Eo({properties:{},additionalProperties:!1}):g2(e)?e:"~standard"in e?e["~standard"].vendor==="zod"?G(e):v2(e):e()}i(mn,"asSchema");function v2(e){return Eo(()=>e["~standard"].jsonSchema.input({target:"draft-07"}),{validate:i(async t=>{const n=await e["~standard"].validate(t);return"value"in n?{success:!0,value:n.value}:{success:!1,error:new zt({value:t,cause:n.issues})}},"validate")})}i(v2,"standardSchema");function y2(e,t){var n;const r=(n=void 0)!=null?n:!1;return Eo(()=>D2(e,{$refStrategy:r?"root":"none"}),{validate:i(async a=>{const s=await e.safeParseAsync(a);return s.success?{success:!0,value:s.data}:{success:!1,error:s.error}},"validate")})}i(y2,"zod3Schema");function _2(e,t){var n;const r=(n=void 0)!=null?n:!1;return Eo(()=>Yc(o_(e,{target:"draft-7",io:"input",reused:r?"ref":"inline"})),{validate:i(async a=>{const s=await kc(e,a);return s.success?{success:!0,value:s.data}:{success:!1,error:s.error}},"validate")})}i(_2,"zod4Schema");function F2(e){return"_zod"in e}i(F2,"isZod4Schema");function G(e,t){return F2(e)?_2(e):y2(e)}i(G,"zodSchema");async function et({value:e,schema:t}){const n=await ut({value:e,schema:t});if(!n.success)throw zt.wrap({value:e,cause:n.error});return n.value}i(et,"validateTypes");async function ut({value:e,schema:t}){const n=mn(t);try{if(n.validate==null)return{success:!0,value:e,rawValue:e};const r=await n.validate(e);return r.success?{success:!0,value:r.value,rawValue:e}:{success:!1,error:zt.wrap({value:e,cause:r.error}),rawValue:e}}catch(r){return{success:!1,error:zt.wrap({value:e,cause:r}),rawValue:e}}}i(ut,"safeValidateTypes");async function C2({text:e,schema:t}){try{const n=es(e);return t==null?n:et({value:n,schema:t})}catch(n){throw lo.isInstance(n)||zt.isInstance(n)?n:new lo({text:e,cause:n})}}i(C2,"parseJSON");async function lt({text:e,schema:t}){try{const n=es(e);return t==null?{success:!0,value:n,rawValue:n}:await ut({value:n,schema:t})}catch(n){return{success:!1,error:lo.isInstance(n)?n:new lo({text:e,cause:n}),rawValue:void 0}}}i(lt,"safeParseJSON");function wo(e){try{return es(e),!0}catch{return!1}}i(wo,"isParsableJson");function b2({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new Ya).pipeThrough(new TransformStream({async transform({data:n},r){n!=="[DONE]"&&r.enqueue(await lt({text:n,schema:t}))}}))}i(b2,"parseJsonEventStream");async function Le({provider:e,providerOptions:t,schema:n}){if(t?.[e]==null)return;const r=await ut({value:t[e],schema:n});if(!r.success)throw new _l({argument:"providerOptions",message:`invalid ${e} provider options`,cause:r.error});return r.value}i(Le,"parseProviderOptions");var E2=i(()=>globalThis.fetch,"getOriginalFetch2"),Se=i(async({url:e,headers:t,body:n,failedResponseHandler:r,successfulResponseHandler:a,abortSignal:s,fetch:o})=>op({url:e,headers:{"Content-Type":"application/json",...t},body:{content:JSON.stringify(n),values:n},failedResponseHandler:r,successfulResponseHandler:a,abortSignal:s,fetch:o}),"postJsonToApi"),as=i(async({url:e,headers:t,formData:n,failedResponseHandler:r,successfulResponseHandler:a,abortSignal:s,fetch:o})=>op({url:e,headers:t,body:{content:n,values:Object.fromEntries(n.entries())},failedResponseHandler:r,successfulResponseHandler:a,abortSignal:s,fetch:o}),"postFormDataToApi"),op=i(async({url:e,headers:t={},body:n,successfulResponseHandler:r,failedResponseHandler:a,abortSignal:s,fetch:o=E2()})=>{try{const u=await o(e,{method:"POST",headers:Gt(t,`ai-sdk/provider-utils/${Hc}`,Qa()),body:n.content,signal:s}),l=cn(u);if(!u.ok){let c;try{c=await a({response:u,url:e,requestBodyValues:n.values})}catch(d){throw dn(d)||Re.isInstance(d)?d:new Re({message:"Failed to process error response",cause:d,statusCode:u.status,url:e,responseHeaders:l,requestBodyValues:n.values})}throw c.value}try{return await r({response:u,url:e,requestBodyValues:n.values})}catch(c){throw c instanceof Error&&(dn(c)||Re.isInstance(c))?c:new Re({message:"Failed to process successful response",cause:c,statusCode:u.status,url:e,responseHeaders:l,requestBodyValues:n.values})}}catch(u){throw Wc({error:u,url:e,requestBodyValues:n.values})}},"postToApi");function z1(e){return e}i(z1,"tool");function yt({id:e,inputSchema:t,outputSchema:n,supportsDeferredResults:r}){return({execute:a,needsApproval:s,toModelOutput:o,onInputStart:u,onInputDelta:l,onInputAvailable:c,...d})=>({type:"provider",id:e,args:d,inputSchema:t,outputSchema:n,execute:a,needsApproval:s,toModelOutput:o,onInputStart:u,onInputDelta:l,onInputAvailable:c,supportsDeferredResults:r})}i(yt,"createProviderToolFactoryWithOutputSchema");async function tt(e){return typeof e=="function"&&(e=e()),Promise.resolve(e)}i(tt,"resolve");var nt=i(({errorSchema:e,errorToMessage:t,isRetryable:n})=>async({response:r,url:a,requestBodyValues:s})=>{const o=await r.text(),u=cn(r);if(o.trim()==="")return{responseHeaders:u,value:new Re({message:r.statusText,url:a,requestBodyValues:s,statusCode:r.status,responseHeaders:u,responseBody:o,isRetryable:n?.(r)})};try{const l=await C2({text:o,schema:e});return{responseHeaders:u,value:new Re({message:t(l),url:a,requestBodyValues:s,statusCode:r.status,responseHeaders:u,responseBody:o,data:l,isRetryable:n?.(r,l)})}}catch{return{responseHeaders:u,value:new Re({message:r.statusText,url:a,requestBodyValues:s,statusCode:r.status,responseHeaders:u,responseBody:o,isRetryable:n?.(r)})}}},"createJsonErrorResponseHandler"),fn=i(e=>async({response:t})=>{const n=cn(t);if(t.body==null)throw new tv({});return{responseHeaders:n,value:b2({stream:t.body,schema:e})}},"createEventSourceResponseHandler"),Pe=i(e=>async({response:t,url:n,requestBodyValues:r})=>{const a=await t.text(),s=await lt({text:a,schema:e}),o=cn(t);if(!s.success)throw new Re({message:"Invalid JSON response",cause:s.error,statusCode:t.status,responseHeaders:o,responseBody:a,url:n,requestBodyValues:r});return{responseHeaders:o,value:s.value,rawValue:s.rawValue}},"createJsonResponseHandler"),w2=i(()=>async({response:e,url:t,requestBodyValues:n})=>{const r=cn(e);if(!e.body)throw new Re({message:"Response body is empty",url:t,requestBodyValues:n,statusCode:e.status,responseHeaders:r,responseBody:void 0});try{const a=await e.arrayBuffer();return{responseHeaders:r,value:new Uint8Array(a)}}catch(a){throw new Re({message:"Failed to read response as array buffer",url:t,requestBodyValues:n,statusCode:e.status,responseHeaders:r,responseBody:void 0,cause:a})}},"createBinaryResponseHandler");function ss(e){return e?.replace(/\/$/,"")}i(ss,"withoutTrailingSlash");function A2(e){return e!=null&&typeof e[Symbol.asyncIterator]=="function"}i(A2,"isAsyncIterable");async function*I2({execute:e,input:t,options:n}){const r=e(t,n);if(A2(r)){let a;for await(const s of r)a=s,yield{type:"preliminary",output:s};yield{type:"final",output:a}}else yield{type:"final",output:await r}}i(I2,"executeTool");var is,ap;function sp(){if(ap)return is;ap=1;var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,a=i((d,m)=>{for(var h in m)e(d,h,{get:m[h],enumerable:!0})},"__export"),s=i((d,m,h,D)=>{if(m&&typeof m=="object"||typeof m=="function")for(let f of n(m))!r.call(d,f)&&f!==h&&e(d,f,{get:i(()=>m[f],"get"),enumerable:!(D=t(m,f))||D.enumerable});return d},"__copyProps"),o=i(d=>s(e({},"__esModule",{value:!0}),d),"__toCommonJS"),u={};a(u,{SYMBOL_FOR_REQ_CONTEXT:i(()=>l,"SYMBOL_FOR_REQ_CONTEXT"),getContext:i(()=>c,"getContext")}),is=o(u);const l=Symbol.for("@vercel/request-context");function c(){return globalThis[l]?.get?.()??{}}return i(c,"getContext"),is}i(sp,"requireGetContext");var us,ip;function up(){if(ip)return us;ip=1;var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,a=i((d,m)=>{for(var h in m)e(d,h,{get:m[h],enumerable:!0})},"__export"),s=i((d,m,h,D)=>{if(m&&typeof m=="object"||typeof m=="function")for(let f of n(m))!r.call(d,f)&&f!==h&&e(d,f,{get:i(()=>m[f],"get"),enumerable:!(D=t(m,f))||D.enumerable});return d},"__copyProps"),o=i(d=>s(e({},"__esModule",{value:!0}),d),"__toCommonJS"),u={};a(u,{VercelOidcTokenError:i(()=>l,"VercelOidcTokenError")}),us=o(u);const c=class c extends Error{constructor(m,h){super(m),this.name="VercelOidcTokenError",this.cause=h}toString(){return this.cause?`${this.name}: ${this.message}: ${this.cause}`:`${this.name}: ${this.message}`}};i(c,"VercelOidcTokenError");let l=c;return us}i(up,"requireTokenError");var ls,lp;function x2(){if(lp)return ls;lp=1;var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,a=i((h,D)=>{for(var f in D)e(h,f,{get:D[f],enumerable:!0})},"__export"),s=i((h,D,f,v)=>{if(D&&typeof D=="object"||typeof D=="function")for(let y of n(D))!r.call(h,y)&&y!==f&&e(h,y,{get:i(()=>D[y],"get"),enumerable:!(v=t(D,y))||v.enumerable});return h},"__copyProps"),o=i(h=>s(e({},"__esModule",{value:!0}),h),"__toCommonJS"),u={};a(u,{getVercelOidcToken:i(()=>d,"getVercelOidcToken"),getVercelOidcTokenSync:i(()=>m,"getVercelOidcTokenSync")}),ls=o(u);var l=sp(),c=up();async function d(){let h="",D;try{h=m()}catch(f){D=f}try{const[{getTokenPayload:f,isExpired:v},{refreshToken:y}]=await Promise.all([await import("./token-util-BzJTZhGZ.mjs").then(function(F){return F.t}),await import("./token-i3hmhHaC.mjs").then(function(F){return F.t})]);(!h||v(f(h)))&&(await y(),h=m())}catch(f){let v=D instanceof Error?D.message:"";throw f instanceof Error&&(v=`${v}
123
123
  ${f.message}`),v?new c.VercelOidcTokenError(v):f}return h}i(d,"getVercelOidcToken");function m(){const h=(0,l.getContext)().headers?.["x-vercel-oidc-token"]??process.env.VERCEL_OIDC_TOKEN;if(!h)throw new Error("The 'x-vercel-oidc-token' header is missing from the request. Do you have the OIDC option enabled in the Vercel project settings?");return h}return i(m,"getVercelOidcTokenSync"),ls}i(x2,"requireGetVercelOidcToken");var cs,cp;function k2(){if(cp)return cs;cp=1;var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,a=i((d,m)=>{for(var h in m)e(d,h,{get:m[h],enumerable:!0})},"__export"),s=i((d,m,h,D)=>{if(m&&typeof m=="object"||typeof m=="function")for(let f of n(m))!r.call(d,f)&&f!==h&&e(d,f,{get:i(()=>m[f],"get"),enumerable:!(D=t(m,f))||D.enumerable});return d},"__copyProps"),o=i(d=>s(e({},"__esModule",{value:!0}),d),"__toCommonJS"),u={};a(u,{getContext:i(()=>c.getContext,"getContext"),getVercelOidcToken:i(()=>l.getVercelOidcToken,"getVercelOidcToken"),getVercelOidcTokenSync:i(()=>l.getVercelOidcTokenSync,"getVercelOidcTokenSync")}),cs=o(u);var l=x2(),c=sp();return cs}i(k2,"requireDist");var pp=k2(),$2="vercel.ai.gateway.error",ps=Symbol.for($2),dp,mp,Ke=(Yt=class extends(mp=Error,dp=ps,mp){constructor({message:t,statusCode:n=500,cause:r}){super(t),this[dp]=!0,this.statusCode=n,this.cause=r}static isInstance(t){return Yt.hasMarker(t)}static hasMarker(t){return typeof t=="object"&&t!==null&&ps in t&&t[ps]===!0}},i(Yt,"_GatewayError"),Yt),fp="GatewayAuthenticationError",T2=`vercel.ai.gateway.error.${fp}`,hp=Symbol.for(T2),Dp,gp,ds=(Xt=class extends(gp=Ke,Dp=hp,gp){constructor({message:t="Authentication failed",statusCode:n=401,cause:r}={}){super({message:t,statusCode:n,cause:r}),this[Dp]=!0,this.name=fp,this.type="authentication_error"}static isInstance(t){return Ke.hasMarker(t)&&hp in t}static createContextualError({apiKeyProvided:t,oidcTokenProvided:n,message:r="Authentication failed",statusCode:a=401,cause:s}){let o;return t?o=`AI Gateway authentication failed: Invalid API key.
124
124
 
125
125
  Create a new API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys
@@ -200,4 +200,4 @@ import(${JSON.stringify(af(So))})
200
200
  `.trim();var i1=rn({name:"hook",description:"Install or uninstall the Git hook for automatic commit messages",help:{description:"Install or uninstall the Git hook for automatic commit messages"},parameters:["<install/uninstall>"]},e=>{(async()=>{const t=await xa(),{installUninstall:n}=e._,r=at.join(t,Nm),a=await $a(r);if(n==="install"){if(a){if(await Ne.realpath(r).catch(()=>{})===So){console.warn("The hook is already installed");return}throw new ue(`A different ${Rm} hook seems to be installed. Please remove it before installing aicommits.`)}await Ne.mkdir(at.dirname(r),{recursive:!0}),Pm?await Ne.writeFile(r,Mm):(await Ne.symlink(So,r,"file"),await Ne.chmod(r,493)),console.log(`${ft("\u2714")} Hook installed`);return}if(n==="uninstall"){if(!a){console.warn("Hook is not installed");return}if(Pm){if(await Ne.readFile(r,"utf8")!==Mm){console.warn("Hook is not installed");return}}else if(await Ne.realpath(r)!==So){console.warn("Hook is not installed");return}await Ne.rm(r),console.log(`${ft("\u2714")} Hook uninstalled`);return}throw new ue(`Invalid mode: ${n}`)})().catch(t=>{console.error(`${pa("\u2716")} ${t.message}`),Gu(t),process.exit(1)})}),u1=rn({name:"pr",description:"[beta \u{1F6A7}] Generate and create a PR on GitHub based on branch diff",help:{description:"[beta \u{1F6A7}] Generate and create a PR on GitHub based on branch diff"}},()=>{(async()=>{ao(Qr(Xr(" aicommits pr "))),await xa();const{stdout:e}=await Ge("git",["branch","--show-current"]);if(!e.trim())throw new ue("Not on a branch");const{stdout:t}=await Ge("git",["remote","get-url","origin"]),n=t.match(/github\.com[\/:]([^\/]+)\/([^\/\.]+)/);if(!n)throw new ue("Could not determine GitHub repository from remote URL");const[,r,a]=n;let s="main";try{const{stdout:B}=await Ge("git",["symbolic-ref","refs/remotes/origin/HEAD"]);s=B.trim().replace("refs/remotes/origin/","")}catch{}if(e.trim()===s)throw new ue("PR creation requires being on a feature branch, not the default branch. Please switch to a feature branch with changes.");let o;try{const{stdout:B}=await Ge("git",["diff",`origin/${s}..HEAD`]);o=B}catch{throw new ue(`Could not get diff from origin/${s}`)}if(!o)throw new ue("No changes to create PR from");const u=o.split(`
201
201
  `).filter(B=>B.startsWith("diff --git")).length,l=3e4;o.length>l&&(o=o.substring(0,l)+`
202
202
 
203
- [Diff truncated due to size]`);const c=await jt(),d=await ln(c);if(!d)throw new ue("No provider configured");let m=d.getBaseUrl();if(!m||m==="")throw new ue("Base URL not configured. Please run `aicommits setup` to configure your provider.");m.endsWith("/v1")||(m+="/v1");const h=d.getApiKey();if(!h)throw new ue("API key not configured. Please run `aicommits setup` to configure your provider.");const D=m==="https://api.openai.com/v1"?To({apiKey:h}):Ts({name:"custom",apiKey:h,baseURL:m}),f=Mt();f.start(`Generating PR title and description (${u} files changed)`);const v=Date.now(),F=(await Nr({model:D(c.model),system:"Generate a concise PR title based on the following git diff. The title should be under 72 characters.",prompt:o,maxRetries:2})).text,b=(await Nr({model:D(c.model),system:"Generate a concise PR description based on the following git diff. Format using Markdown with headings like ### Summary, ### Changes, ### Review Notes. Provide a high-level summary of the changes, what was implemented or fixed, and any specific details reviewers should consider. Avoid listing individual files.",prompt:o,maxRetries:2})).text,w=Date.now(),S=Math.round((w-v)/1e3);f.stop(`Generated PR content for ${u} files in ${S}s`),console.log(`${ft("Title:")} ${F.replace(/\n/g," ")}`),console.log(`${ft("Body:")} ${b.length>100?b.substring(0,100)+"...":b}`);const{text:k}=await Promise.resolve().then(function(){return gr}),C=await k({message:"Press Enter to open PR creation in browser, or Ctrl+C to cancel",placeholder:"Press Enter"});if(Dr(C)){ve("PR creation cancelled");return}const z=`https://github.com/${r}/${a}/compare/${s}...${e.trim()}?expand=1&title=${encodeURIComponent(F)}&body=${encodeURIComponent(b)}`,W=Mt();W.start("Opening PR creation page in browser");try{const B=process.platform==="darwin"?"open":process.platform==="win32"?"start":"xdg-open";await Ge(B,[z]),W.stop("PR creation page opened in browser"),ve(ft("PR creation page opened! Please review and submit the PR."))}catch{W.stop("Failed to open browser"),ve(`${ft("PR URL:")} ${z}`),ve("Please open the URL above in your browser to create the PR.")}})().catch(e=>{so(e)})});const l1=ef(si);async function c1(e){const{pkg:t,distTag:n="latest",autoUpdate:r=!0}=e;if(t.version==="0.0.0-semantic-release")return;const a=ni({pkg:t,distTag:t.version.includes("-")?"develop":n}),s=a.update;if(!s||!r){s&&!r&&a.notify();return}if(!await p1(t.name)){a.notify();return}console.log(`Updating ${t.name} from v${s.current} to v${s.latest}...`);try{await d1(t.name),console.log(`\u2713 ${t.name} updated to v${s.latest}`),console.log("Please restart to use the new version.")}catch{console.log("Auto-update failed. You can manually update with:"),console.log(` npm update -g ${t.name}`),a.notify()}}i(c1,"checkAndAutoUpdate");async function p1(e){try{const{stdout:t}=await l1(`npm list -g ${e} --depth=0`);return t.includes(e)}catch{return!1}}i(p1,"checkIfGlobalInstallation");async function d1(e){return new Promise((t,n)=>{const r=si(`npm update -g ${e}`,{timeout:6e4,env:{...process.env,NPM_CONFIG_PROGRESS:"false"}});r.on("error",a=>{n(a)}),r.on("exit",a=>{a===0||a===null?t():n(new Error(`npm update exited with code ${a}`))})})}i(d1,"runBackgroundUpdate");const{description:m1,version:jr}=Gr,f1=ni({pkg:Gr,distTag:jr.includes("-")?"develop":"latest"});jr!=="0.0.0-semantic-release"&&jr.includes("-")&&c1({pkg:Gr,distTag:jr.includes("-")?"develop":"latest",autoUpdate:!0}).catch(()=>{f1.notify()});const jm=process.argv.slice(2);Ji({name:"aicommits",flags:{generate:{type:Number,description:"Number of messages to generate (Warning: generating multiple costs more) (default: 1)",alias:"g"},exclude:{type:[String],description:"Files to exclude from AI analysis",alias:"x"},all:{type:Boolean,description:"Automatically stage changes in tracked files for the commit",alias:"a",default:!1},type:{type:String,description:"Git commit message format (default: conventional). Supports conventional and gitmoji",alias:"t"},confirm:{type:Boolean,description:"Skip confirmation when committing after message generation (default: false)",alias:"y",default:!1},clipboard:{type:Boolean,description:"Copy the selected message to the clipboard instead of committing (default: false)",alias:"c",default:!1},noVerify:{type:Boolean,description:"Bypass pre-commit hooks while committing (default: false)",alias:"n",default:!1},version:{type:Boolean,description:"Show version number",alias:"v"}},commands:[r1,o1,a1,i1,u1],help:{description:m1},ignoreArgv:i(e=>e==="unknown-flag"||e==="argument","ignoreArgv")},e=>{e.flags.version&&(console.log(jr),process.exit(0)),s1?n1():e1(e.flags.generate,e.flags.exclude,e.flags.all,e.flags.type,e.flags.confirm,e.flags.clipboard,e.flags.noVerify,jm)},jm);export{St as g,up as r};
203
+ [Diff truncated due to size]`);const c=await jt(),d=await ln(c);if(!d)throw new ue("No provider configured");let m=d.getBaseUrl();if(!m||m==="")throw new ue("Base URL not configured. Please run `aicommits setup` to configure your provider.");m.endsWith("/v1")||(m+="/v1");const h=d.getApiKey();if(!h)throw new ue("API key not configured. Please run `aicommits setup` to configure your provider.");const D=m==="https://api.openai.com/v1"?To({apiKey:h}):Ts({name:"custom",apiKey:h,baseURL:m}),f=Mt();f.start(`Generating PR title and description (${u} files changed)`);const v=Date.now(),F=(await Nr({model:D(c.model),system:"Generate a concise PR title based on the following git diff. The title should be under 72 characters.",prompt:o,maxRetries:2})).text,b=(await Nr({model:D(c.model),system:"Generate a concise PR description based on the following git diff. Format using Markdown with headings like ### Summary, ### Changes, ### Review Notes. Provide a high-level summary of the changes, what was implemented or fixed, and any specific details reviewers should consider. Avoid listing individual files.",prompt:o,maxRetries:2})).text,w=Date.now(),S=Math.round((w-v)/1e3);f.stop(`Generated PR content for ${u} files in ${S}s`),console.log(`${ft("Title:")} ${F.replace(/\n/g," ")}`),console.log(`${ft("Body:")} ${b.length>100?b.substring(0,100)+"...":b}`);const{text:k}=await Promise.resolve().then(function(){return gr}),C=await k({message:"Press Enter to open PR creation in browser, or Ctrl+C to cancel",placeholder:"Press Enter"});if(Dr(C)){ve("PR creation cancelled");return}const z=`https://github.com/${r}/${a}/compare/${s}...${e.trim()}?expand=1&title=${encodeURIComponent(F)}&body=${encodeURIComponent(b)}`,W=Mt();W.start("Opening PR creation page in browser");try{const B=process.platform==="darwin"?"open":process.platform==="win32"?"start":"xdg-open";await Ge(B,[z]),W.stop("PR creation page opened in browser"),ve(ft("PR creation page opened! Please review and submit the PR."))}catch{W.stop("Failed to open browser"),ve(`${ft("PR URL:")} ${z}`),ve("Please open the URL above in your browser to create the PR.")}})().catch(e=>{so(e)})});const l1=ef(si);async function c1(e){const{pkg:t,distTag:n="latest",autoUpdate:r=!0}=e;if(t.version==="0.0.0-semantic-release")return;const a=ni({pkg:t,distTag:t.version.includes("-")?"develop":n}),s=a.update;if(!s||!r){s&&!r&&a.notify();return}if(!await p1(t.name)){a.notify();return}console.log(`Updating ${t.name} from v${s.current} to v${s.latest}...`);try{await d1(t.name,n),console.log(`\u2713 ${t.name} updated to v${s.latest}`),console.log("Please restart to use the new version.")}catch{console.log("Auto-update failed. You can manually update with:"),console.log(` npm update -g ${t.name}@${n}`),a.notify()}}i(c1,"checkAndAutoUpdate");async function p1(e){try{const{stdout:t}=await l1(`npm list -g ${e} --depth=0`);return t.includes(e)}catch{return!1}}i(p1,"checkIfGlobalInstallation");async function d1(e,t){return new Promise((n,r)=>{const a=si(`npm update -g ${e}@${t}`,{timeout:6e4,env:{...process.env,NPM_CONFIG_PROGRESS:"false"}});a.on("error",s=>{r(s)}),a.on("exit",s=>{s===0||s===null?n():r(new Error(`npm update exited with code ${s}`))})})}i(d1,"runBackgroundUpdate");const{description:m1,version:jr}=Gr,f1=ni({pkg:Gr,distTag:jr.includes("-")?"develop":"latest"});jr!=="0.0.0-semantic-release"&&jr.includes("-")&&c1({pkg:Gr,distTag:jr.includes("-")?"develop":"latest",autoUpdate:!0}).catch(()=>{f1.notify()});const jm=process.argv.slice(2);Ji({name:"aicommits",flags:{generate:{type:Number,description:"Number of messages to generate (Warning: generating multiple costs more) (default: 1)",alias:"g"},exclude:{type:[String],description:"Files to exclude from AI analysis",alias:"x"},all:{type:Boolean,description:"Automatically stage changes in tracked files for the commit",alias:"a",default:!1},type:{type:String,description:"Git commit message format (default: conventional). Supports conventional and gitmoji",alias:"t"},confirm:{type:Boolean,description:"Skip confirmation when committing after message generation (default: false)",alias:"y",default:!1},clipboard:{type:Boolean,description:"Copy the selected message to the clipboard instead of committing (default: false)",alias:"c",default:!1},noVerify:{type:Boolean,description:"Bypass pre-commit hooks while committing (default: false)",alias:"n",default:!1},version:{type:Boolean,description:"Show version number",alias:"v"}},commands:[r1,o1,a1,i1,u1],help:{description:m1},ignoreArgv:i(e=>e==="unknown-flag"||e==="argument","ignoreArgv")},e=>{e.flags.version&&(console.log(jr),process.exit(0)),s1?n1():e1(e.flags.generate,e.flags.exclude,e.flags.all,e.flags.type,e.flags.confirm,e.flags.clipboard,e.flags.noVerify,jm)},jm);export{St as g,up as r};
package/dist/cli.mjs CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import"./cli-D6HFl2Cc.mjs";import"update-notifier";import"tty";import"node:buffer";import"node:path";import"node:child_process";import"node:process";import"child_process";import"path";import"fs";import"node:url";import"node:os";import"assert";import"events";import"node:fs";import"buffer";import"stream";import"util";import"node:util";import"node:readline";import"node:stream";import"fs/promises";import"os";import"crypto";import"url";
2
+ import"./cli-xI2bTfOI.mjs";import"update-notifier";import"tty";import"node:buffer";import"node:path";import"node:child_process";import"node:process";import"child_process";import"path";import"fs";import"node:url";import"node:os";import"assert";import"events";import"node:fs";import"buffer";import"stream";import"util";import"node:util";import"node:readline";import"node:stream";import"fs/promises";import"os";import"crypto";import"url";
@@ -1 +1 @@
1
- var T=Object.defineProperty;var o=(n,p)=>T(n,"name",{value:p,configurable:!0});import{r as w,g as h}from"./cli-D6HFl2Cc.mjs";import{r as b}from"./token-util-CpHGAYOA.mjs";function j(n,p){return p.forEach(function(a){a&&typeof a!="string"&&!Array.isArray(a)&&Object.keys(a).forEach(function(i){if(i!=="default"&&!(i in n)){var s=Object.getOwnPropertyDescriptor(a,i);Object.defineProperty(n,i,s.get?s:{enumerable:!0,get:o(function(){return a[i]},"get")})}})}),Object.freeze(n)}o(j,"_mergeNamespaces");var k,O;function m(){if(O)return k;O=1;var n=Object.defineProperty,p=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,s=o((e,r)=>{for(var t in r)n(e,t,{get:r[t],enumerable:!0})},"__export"),y=o((e,r,t,f)=>{if(r&&typeof r=="object"||typeof r=="function")for(let u of a(r))!i.call(e,u)&&u!==t&&n(e,u,{get:o(()=>r[u],"get"),enumerable:!(f=p(r,u))||f.enumerable});return e},"__copyProps"),d=o(e=>y(n({},"__esModule",{value:!0}),e),"__toCommonJS"),_={};s(_,{refreshToken:o(()=>g,"refreshToken")}),k=d(_);var l=w(),c=b();async function g(){const{projectId:e,teamId:r}=(0,c.findProjectInfo)();let t=(0,c.loadToken)(e);if(!t||(0,c.isExpired)((0,c.getTokenPayload)(t.token))){const f=await(0,c.getVercelCliToken)();if(!f)throw new l.VercelOidcTokenError("Failed to refresh OIDC token: Log in to Vercel CLI and link your project with `vc link`");if(!e)throw new l.VercelOidcTokenError("Failed to refresh OIDC token: Try re-linking your project with `vc link`");if(t=await(0,c.getVercelOidcToken)(f,e,r),!t)throw new l.VercelOidcTokenError("Failed to refresh OIDC token");(0,c.saveToken)(t,e)}process.env.VERCEL_OIDC_TOKEN=t.token}return o(g,"refreshToken"),k}o(m,"requireToken");var v=m(),P=h(v),E=j({__proto__:null,default:P},[v]);export{E as t};
1
+ var T=Object.defineProperty;var o=(n,p)=>T(n,"name",{value:p,configurable:!0});import{r as w,g as h}from"./cli-xI2bTfOI.mjs";import{r as b}from"./token-util-B8oenGOC.mjs";function j(n,p){return p.forEach(function(a){a&&typeof a!="string"&&!Array.isArray(a)&&Object.keys(a).forEach(function(i){if(i!=="default"&&!(i in n)){var s=Object.getOwnPropertyDescriptor(a,i);Object.defineProperty(n,i,s.get?s:{enumerable:!0,get:o(function(){return a[i]},"get")})}})}),Object.freeze(n)}o(j,"_mergeNamespaces");var k,O;function m(){if(O)return k;O=1;var n=Object.defineProperty,p=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,s=o((e,r)=>{for(var t in r)n(e,t,{get:r[t],enumerable:!0})},"__export"),y=o((e,r,t,f)=>{if(r&&typeof r=="object"||typeof r=="function")for(let u of a(r))!i.call(e,u)&&u!==t&&n(e,u,{get:o(()=>r[u],"get"),enumerable:!(f=p(r,u))||f.enumerable});return e},"__copyProps"),d=o(e=>y(n({},"__esModule",{value:!0}),e),"__toCommonJS"),_={};s(_,{refreshToken:o(()=>g,"refreshToken")}),k=d(_);var l=w(),c=b();async function g(){const{projectId:e,teamId:r}=(0,c.findProjectInfo)();let t=(0,c.loadToken)(e);if(!t||(0,c.isExpired)((0,c.getTokenPayload)(t.token))){const f=await(0,c.getVercelCliToken)();if(!f)throw new l.VercelOidcTokenError("Failed to refresh OIDC token: Log in to Vercel CLI and link your project with `vc link`");if(!e)throw new l.VercelOidcTokenError("Failed to refresh OIDC token: Try re-linking your project with `vc link`");if(t=await(0,c.getVercelOidcToken)(f,e,r),!t)throw new l.VercelOidcTokenError("Failed to refresh OIDC token");(0,c.saveToken)(t,e)}process.env.VERCEL_OIDC_TOKEN=t.token}return o(g,"refreshToken"),k}o(m,"requireToken");var v=m(),P=h(v),E=j({__proto__:null,default:P},[v]);export{E as t};
@@ -1 +1 @@
1
- var z=Object.defineProperty;var e=(y,p)=>z(y,"name",{value:p,configurable:!0});import S from"path";import A from"fs";import{r as R}from"./cli-D6HFl2Cc.mjs";import N from"os";var x,$;function G(){if($)return x;$=1;var y=Object.create,p=Object.defineProperty,P=Object.getOwnPropertyDescriptor,j=Object.getOwnPropertyNames,b=Object.getPrototypeOf,T=Object.prototype.hasOwnProperty,m=e((t,r)=>{for(var o in r)p(t,o,{get:r[o],enumerable:!0})},"__export"),k=e((t,r,o,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let O of j(r))!T.call(t,O)&&O!==o&&p(t,O,{get:e(()=>r[O],"get"),enumerable:!(s=P(r,O))||s.enumerable});return t},"__copyProps"),v=e((t,r,o)=>(o=t!=null?y(b(t)):{},k(!t||!t.__esModule?p(o,"default",{value:t,enumerable:!0}):o,t)),"__toESM"),D=e(t=>k(p({},"__esModule",{value:!0}),t),"__toCommonJS"),g={};m(g,{findRootDir:e(()=>h,"findRootDir"),getUserDataDir:e(()=>c,"getUserDataDir")}),x=D(g);var u=v(S),f=v(A),_=v(N),w=R();function h(){try{let t=process.cwd();for(;t!==u.default.dirname(t);){const r=u.default.join(t,".vercel");if(f.default.existsSync(r))return t;t=u.default.dirname(t)}}catch{throw new w.VercelOidcTokenError("Token refresh only supported in node server environments")}return null}e(h,"findRootDir");function c(){if(process.env.XDG_DATA_HOME)return process.env.XDG_DATA_HOME;switch(_.default.platform()){case"darwin":return u.default.join(_.default.homedir(),"Library/Application Support");case"linux":return u.default.join(_.default.homedir(),".local/share");case"win32":return process.env.LOCALAPPDATA?process.env.LOCALAPPDATA:null;default:return null}}return e(c,"getUserDataDir"),x}e(G,"requireTokenIo");var C,U;function X(){if(U)return C;U=1;var y=Object.create,p=Object.defineProperty,P=Object.getOwnPropertyDescriptor,j=Object.getOwnPropertyNames,b=Object.getPrototypeOf,T=Object.prototype.hasOwnProperty,m=e((r,o)=>{for(var s in o)p(r,s,{get:o[s],enumerable:!0})},"__export"),k=e((r,o,s,O)=>{if(o&&typeof o=="object"||typeof o=="function")for(let E of j(o))!T.call(r,E)&&E!==s&&p(r,E,{get:e(()=>o[E],"get"),enumerable:!(O=P(o,E))||O.enumerable});return r},"__copyProps"),v=e((r,o,s)=>(s=r!=null?y(b(r)):{},k(!r||!r.__esModule?p(s,"default",{value:r,enumerable:!0}):s,r)),"__toESM"),D=e(r=>k(p({},"__esModule",{value:!0}),r),"__toCommonJS"),g={};m(g,{isValidAccessToken:e(()=>t,"isValidAccessToken"),readAuthConfig:e(()=>h,"readAuthConfig"),writeAuthConfig:e(()=>c,"writeAuthConfig")}),C=D(g);var u=v(A),f=v(S),_=J();function w(){const r=(0,_.getVercelDataDir)();if(!r)throw new Error(`Unable to find Vercel CLI data directory. Your platform: ${process.platform}. Supported: darwin, linux, win32.`);return f.join(r,"auth.json")}e(w,"getAuthConfigPath");function h(){try{const r=w();if(!u.existsSync(r))return null;const o=u.readFileSync(r,"utf8");return o?JSON.parse(o):null}catch{return null}}e(h,"readAuthConfig");function c(r){const o=w(),s=f.dirname(o);u.existsSync(s)||u.mkdirSync(s,{mode:504,recursive:!0}),u.writeFileSync(o,JSON.stringify(r,null,2),{mode:384})}e(c,"writeAuthConfig");function t(r){if(!r.token)return!1;if(typeof r.expiresAt!="number")return!0;const o=Math.floor(Date.now()/1e3);return r.expiresAt>=o}return e(t,"isValidAccessToken"),C}e(X,"requireAuthConfig");var V,q;function Y(){if(q)return V;q=1;var y=Object.defineProperty,p=Object.getOwnPropertyDescriptor,P=Object.getOwnPropertyNames,j=Object.prototype.hasOwnProperty,b=e((c,t)=>{for(var r in t)y(c,r,{get:t[r],enumerable:!0})},"__export"),T=e((c,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of P(t))!j.call(c,s)&&s!==r&&y(c,s,{get:e(()=>t[s],"get"),enumerable:!(o=p(t,s))||o.enumerable});return c},"__copyProps"),m=e(c=>T(y({},"__esModule",{value:!0}),c),"__toCommonJS"),k={};b(k,{processTokenResponse:e(()=>h,"processTokenResponse"),refreshTokenRequest:e(()=>w,"refreshTokenRequest")}),V=m(k);var v=N;const D="https://vercel.com",g="cl_HYyOPBNtFMfHhaUn9L4QPfTZz6TP47bp",u=`@vercel/oidc node-${process.version} ${(0,v.platform)()} (${(0,v.arch)()}) ${(0,v.hostname)()}`;let f=null;async function _(){if(f)return f;const c=`${D}/.well-known/openid-configuration`,t=await fetch(c,{headers:{"user-agent":u}});if(!t.ok)throw new Error("Failed to discover OAuth endpoints");const r=await t.json();if(!r||typeof r.token_endpoint!="string")throw new Error("Invalid OAuth discovery response");const o=r.token_endpoint;return f=o,o}e(_,"getTokenEndpoint");async function w(c){const t=await _();return await fetch(t,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded","user-agent":u},body:new URLSearchParams({client_id:g,grant_type:"refresh_token",...c})})}e(w,"refreshTokenRequest");async function h(c){const t=await c.json();if(!c.ok){const r=typeof t=="object"&&t&&"error"in t?String(t.error):"Token refresh failed";return[new Error(r)]}return typeof t!="object"||t===null?[new Error("Invalid token response")]:typeof t.access_token!="string"?[new Error("Missing access_token in response")]:t.token_type!=="Bearer"?[new Error("Invalid token_type in response")]:typeof t.expires_in!="number"?[new Error("Missing expires_in in response")]:[null,t]}return e(h,"processTokenResponse"),V}e(Y,"requireOauth");var I,L;function J(){if(L)return I;L=1;var y=Object.create,p=Object.defineProperty,P=Object.getOwnPropertyDescriptor,j=Object.getOwnPropertyNames,b=Object.getPrototypeOf,T=Object.prototype.hasOwnProperty,m=e((n,i)=>{for(var a in i)p(n,a,{get:i[a],enumerable:!0})},"__export"),k=e((n,i,a,l)=>{if(i&&typeof i=="object"||typeof i=="function")for(let d of j(i))!T.call(n,d)&&d!==a&&p(n,d,{get:e(()=>i[d],"get"),enumerable:!(l=P(i,d))||l.enumerable});return n},"__copyProps"),v=e((n,i,a)=>(a=n!=null?y(b(n)):{},k(!n||!n.__esModule?p(a,"default",{value:n,enumerable:!0}):a,n)),"__toESM"),D=e(n=>k(p({},"__esModule",{value:!0}),n),"__toCommonJS"),g={};m(g,{assertVercelOidcTokenResponse:e(()=>s,"assertVercelOidcTokenResponse"),findProjectInfo:e(()=>O,"findProjectInfo"),getTokenPayload:e(()=>H,"getTokenPayload"),getVercelCliToken:e(()=>r,"getVercelCliToken"),getVercelDataDir:e(()=>t,"getVercelDataDir"),getVercelOidcToken:e(()=>o,"getVercelOidcToken"),isExpired:e(()=>B,"isExpired"),loadToken:e(()=>F,"loadToken"),saveToken:e(()=>E,"saveToken")}),I=D(g);var u=v(S),f=v(A),_=R(),w=G(),h=X(),c=Y();function t(){const n="com.vercel.cli",i=(0,w.getUserDataDir)();return i?u.join(i,n):null}e(t,"getVercelDataDir");async function r(){const n=(0,h.readAuthConfig)();if(!n)return null;if((0,h.isValidAccessToken)(n))return n.token||null;if(!n.refreshToken)return(0,h.writeAuthConfig)({}),null;try{const i=await(0,c.refreshTokenRequest)({refresh_token:n.refreshToken}),[a,l]=await(0,c.processTokenResponse)(i);if(a||!l)return(0,h.writeAuthConfig)({}),null;const d={token:l.access_token,expiresAt:Math.floor(Date.now()/1e3)+l.expires_in};return l.refresh_token&&(d.refreshToken=l.refresh_token),(0,h.writeAuthConfig)(d),d.token??null}catch{return(0,h.writeAuthConfig)({}),null}}e(r,"getVercelCliToken");async function o(n,i,a){const l=`https://api.vercel.com/v1/projects/${i}/token?source=vercel-oidc-refresh${a?`&teamId=${a}`:""}`,d=await fetch(l,{method:"POST",headers:{Authorization:`Bearer ${n}`}});if(!d.ok)throw new _.VercelOidcTokenError(`Failed to refresh OIDC token: ${d.statusText}`);const M=await d.json();return s(M),M}e(o,"getVercelOidcToken");function s(n){if(!n||typeof n!="object")throw new TypeError("Vercel OIDC token is malformed. Expected an object. Please run `vc env pull` and try again");if(!("token"in n)||typeof n.token!="string")throw new TypeError("Vercel OIDC token is malformed. Expected a string-valued token property. Please run `vc env pull` and try again")}e(s,"assertVercelOidcTokenResponse");function O(){const n=(0,w.findRootDir)();if(!n)throw new _.VercelOidcTokenError("Unable to find project root directory. Have you linked your project with `vc link?`");const i=u.join(n,".vercel","project.json");if(!f.existsSync(i))throw new _.VercelOidcTokenError("project.json not found, have you linked your project with `vc link?`");const a=JSON.parse(f.readFileSync(i,"utf8"));if(typeof a.projectId!="string"&&typeof a.orgId!="string")throw new TypeError("Expected a string-valued projectId property. Try running `vc link` to re-link your project.");return{projectId:a.projectId,teamId:a.orgId}}e(O,"findProjectInfo");function E(n,i){const a=(0,w.getUserDataDir)();if(!a)throw new _.VercelOidcTokenError("Unable to find user data directory. Please reach out to Vercel support.");const l=u.join(a,"com.vercel.token",`${i}.json`),d=JSON.stringify(n);f.mkdirSync(u.dirname(l),{mode:504,recursive:!0}),f.writeFileSync(l,d),f.chmodSync(l,432)}e(E,"saveToken");function F(n){const i=(0,w.getUserDataDir)();if(!i)throw new _.VercelOidcTokenError("Unable to find user data directory. Please reach out to Vercel support.");const a=u.join(i,"com.vercel.token",`${n}.json`);if(!f.existsSync(a))return null;const l=JSON.parse(f.readFileSync(a,"utf8"));return s(l),l}e(F,"loadToken");function H(n){const i=n.split(".");if(i.length!==3)throw new _.VercelOidcTokenError("Invalid token. Please run `vc env pull` and try again");const a=i[1].replace(/-/g,"+").replace(/_/g,"/"),l=a.padEnd(a.length+(4-a.length%4)%4,"=");return JSON.parse(Buffer.from(l,"base64").toString("utf8"))}e(H,"getTokenPayload");function B(n){return n.exp*1e3<Date.now()}return e(B,"isExpired"),I}e(J,"requireTokenUtil");export{J as r};
1
+ var z=Object.defineProperty;var e=(y,p)=>z(y,"name",{value:p,configurable:!0});import S from"path";import A from"fs";import{r as R}from"./cli-xI2bTfOI.mjs";import N from"os";var x,$;function G(){if($)return x;$=1;var y=Object.create,p=Object.defineProperty,P=Object.getOwnPropertyDescriptor,j=Object.getOwnPropertyNames,b=Object.getPrototypeOf,T=Object.prototype.hasOwnProperty,m=e((t,r)=>{for(var o in r)p(t,o,{get:r[o],enumerable:!0})},"__export"),k=e((t,r,o,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let O of j(r))!T.call(t,O)&&O!==o&&p(t,O,{get:e(()=>r[O],"get"),enumerable:!(s=P(r,O))||s.enumerable});return t},"__copyProps"),v=e((t,r,o)=>(o=t!=null?y(b(t)):{},k(!t||!t.__esModule?p(o,"default",{value:t,enumerable:!0}):o,t)),"__toESM"),D=e(t=>k(p({},"__esModule",{value:!0}),t),"__toCommonJS"),g={};m(g,{findRootDir:e(()=>h,"findRootDir"),getUserDataDir:e(()=>c,"getUserDataDir")}),x=D(g);var u=v(S),f=v(A),_=v(N),w=R();function h(){try{let t=process.cwd();for(;t!==u.default.dirname(t);){const r=u.default.join(t,".vercel");if(f.default.existsSync(r))return t;t=u.default.dirname(t)}}catch{throw new w.VercelOidcTokenError("Token refresh only supported in node server environments")}return null}e(h,"findRootDir");function c(){if(process.env.XDG_DATA_HOME)return process.env.XDG_DATA_HOME;switch(_.default.platform()){case"darwin":return u.default.join(_.default.homedir(),"Library/Application Support");case"linux":return u.default.join(_.default.homedir(),".local/share");case"win32":return process.env.LOCALAPPDATA?process.env.LOCALAPPDATA:null;default:return null}}return e(c,"getUserDataDir"),x}e(G,"requireTokenIo");var C,U;function X(){if(U)return C;U=1;var y=Object.create,p=Object.defineProperty,P=Object.getOwnPropertyDescriptor,j=Object.getOwnPropertyNames,b=Object.getPrototypeOf,T=Object.prototype.hasOwnProperty,m=e((r,o)=>{for(var s in o)p(r,s,{get:o[s],enumerable:!0})},"__export"),k=e((r,o,s,O)=>{if(o&&typeof o=="object"||typeof o=="function")for(let E of j(o))!T.call(r,E)&&E!==s&&p(r,E,{get:e(()=>o[E],"get"),enumerable:!(O=P(o,E))||O.enumerable});return r},"__copyProps"),v=e((r,o,s)=>(s=r!=null?y(b(r)):{},k(!r||!r.__esModule?p(s,"default",{value:r,enumerable:!0}):s,r)),"__toESM"),D=e(r=>k(p({},"__esModule",{value:!0}),r),"__toCommonJS"),g={};m(g,{isValidAccessToken:e(()=>t,"isValidAccessToken"),readAuthConfig:e(()=>h,"readAuthConfig"),writeAuthConfig:e(()=>c,"writeAuthConfig")}),C=D(g);var u=v(A),f=v(S),_=J();function w(){const r=(0,_.getVercelDataDir)();if(!r)throw new Error(`Unable to find Vercel CLI data directory. Your platform: ${process.platform}. Supported: darwin, linux, win32.`);return f.join(r,"auth.json")}e(w,"getAuthConfigPath");function h(){try{const r=w();if(!u.existsSync(r))return null;const o=u.readFileSync(r,"utf8");return o?JSON.parse(o):null}catch{return null}}e(h,"readAuthConfig");function c(r){const o=w(),s=f.dirname(o);u.existsSync(s)||u.mkdirSync(s,{mode:504,recursive:!0}),u.writeFileSync(o,JSON.stringify(r,null,2),{mode:384})}e(c,"writeAuthConfig");function t(r){if(!r.token)return!1;if(typeof r.expiresAt!="number")return!0;const o=Math.floor(Date.now()/1e3);return r.expiresAt>=o}return e(t,"isValidAccessToken"),C}e(X,"requireAuthConfig");var V,q;function Y(){if(q)return V;q=1;var y=Object.defineProperty,p=Object.getOwnPropertyDescriptor,P=Object.getOwnPropertyNames,j=Object.prototype.hasOwnProperty,b=e((c,t)=>{for(var r in t)y(c,r,{get:t[r],enumerable:!0})},"__export"),T=e((c,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of P(t))!j.call(c,s)&&s!==r&&y(c,s,{get:e(()=>t[s],"get"),enumerable:!(o=p(t,s))||o.enumerable});return c},"__copyProps"),m=e(c=>T(y({},"__esModule",{value:!0}),c),"__toCommonJS"),k={};b(k,{processTokenResponse:e(()=>h,"processTokenResponse"),refreshTokenRequest:e(()=>w,"refreshTokenRequest")}),V=m(k);var v=N;const D="https://vercel.com",g="cl_HYyOPBNtFMfHhaUn9L4QPfTZz6TP47bp",u=`@vercel/oidc node-${process.version} ${(0,v.platform)()} (${(0,v.arch)()}) ${(0,v.hostname)()}`;let f=null;async function _(){if(f)return f;const c=`${D}/.well-known/openid-configuration`,t=await fetch(c,{headers:{"user-agent":u}});if(!t.ok)throw new Error("Failed to discover OAuth endpoints");const r=await t.json();if(!r||typeof r.token_endpoint!="string")throw new Error("Invalid OAuth discovery response");const o=r.token_endpoint;return f=o,o}e(_,"getTokenEndpoint");async function w(c){const t=await _();return await fetch(t,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded","user-agent":u},body:new URLSearchParams({client_id:g,grant_type:"refresh_token",...c})})}e(w,"refreshTokenRequest");async function h(c){const t=await c.json();if(!c.ok){const r=typeof t=="object"&&t&&"error"in t?String(t.error):"Token refresh failed";return[new Error(r)]}return typeof t!="object"||t===null?[new Error("Invalid token response")]:typeof t.access_token!="string"?[new Error("Missing access_token in response")]:t.token_type!=="Bearer"?[new Error("Invalid token_type in response")]:typeof t.expires_in!="number"?[new Error("Missing expires_in in response")]:[null,t]}return e(h,"processTokenResponse"),V}e(Y,"requireOauth");var I,L;function J(){if(L)return I;L=1;var y=Object.create,p=Object.defineProperty,P=Object.getOwnPropertyDescriptor,j=Object.getOwnPropertyNames,b=Object.getPrototypeOf,T=Object.prototype.hasOwnProperty,m=e((n,i)=>{for(var a in i)p(n,a,{get:i[a],enumerable:!0})},"__export"),k=e((n,i,a,l)=>{if(i&&typeof i=="object"||typeof i=="function")for(let d of j(i))!T.call(n,d)&&d!==a&&p(n,d,{get:e(()=>i[d],"get"),enumerable:!(l=P(i,d))||l.enumerable});return n},"__copyProps"),v=e((n,i,a)=>(a=n!=null?y(b(n)):{},k(!n||!n.__esModule?p(a,"default",{value:n,enumerable:!0}):a,n)),"__toESM"),D=e(n=>k(p({},"__esModule",{value:!0}),n),"__toCommonJS"),g={};m(g,{assertVercelOidcTokenResponse:e(()=>s,"assertVercelOidcTokenResponse"),findProjectInfo:e(()=>O,"findProjectInfo"),getTokenPayload:e(()=>H,"getTokenPayload"),getVercelCliToken:e(()=>r,"getVercelCliToken"),getVercelDataDir:e(()=>t,"getVercelDataDir"),getVercelOidcToken:e(()=>o,"getVercelOidcToken"),isExpired:e(()=>B,"isExpired"),loadToken:e(()=>F,"loadToken"),saveToken:e(()=>E,"saveToken")}),I=D(g);var u=v(S),f=v(A),_=R(),w=G(),h=X(),c=Y();function t(){const n="com.vercel.cli",i=(0,w.getUserDataDir)();return i?u.join(i,n):null}e(t,"getVercelDataDir");async function r(){const n=(0,h.readAuthConfig)();if(!n)return null;if((0,h.isValidAccessToken)(n))return n.token||null;if(!n.refreshToken)return(0,h.writeAuthConfig)({}),null;try{const i=await(0,c.refreshTokenRequest)({refresh_token:n.refreshToken}),[a,l]=await(0,c.processTokenResponse)(i);if(a||!l)return(0,h.writeAuthConfig)({}),null;const d={token:l.access_token,expiresAt:Math.floor(Date.now()/1e3)+l.expires_in};return l.refresh_token&&(d.refreshToken=l.refresh_token),(0,h.writeAuthConfig)(d),d.token??null}catch{return(0,h.writeAuthConfig)({}),null}}e(r,"getVercelCliToken");async function o(n,i,a){const l=`https://api.vercel.com/v1/projects/${i}/token?source=vercel-oidc-refresh${a?`&teamId=${a}`:""}`,d=await fetch(l,{method:"POST",headers:{Authorization:`Bearer ${n}`}});if(!d.ok)throw new _.VercelOidcTokenError(`Failed to refresh OIDC token: ${d.statusText}`);const M=await d.json();return s(M),M}e(o,"getVercelOidcToken");function s(n){if(!n||typeof n!="object")throw new TypeError("Vercel OIDC token is malformed. Expected an object. Please run `vc env pull` and try again");if(!("token"in n)||typeof n.token!="string")throw new TypeError("Vercel OIDC token is malformed. Expected a string-valued token property. Please run `vc env pull` and try again")}e(s,"assertVercelOidcTokenResponse");function O(){const n=(0,w.findRootDir)();if(!n)throw new _.VercelOidcTokenError("Unable to find project root directory. Have you linked your project with `vc link?`");const i=u.join(n,".vercel","project.json");if(!f.existsSync(i))throw new _.VercelOidcTokenError("project.json not found, have you linked your project with `vc link?`");const a=JSON.parse(f.readFileSync(i,"utf8"));if(typeof a.projectId!="string"&&typeof a.orgId!="string")throw new TypeError("Expected a string-valued projectId property. Try running `vc link` to re-link your project.");return{projectId:a.projectId,teamId:a.orgId}}e(O,"findProjectInfo");function E(n,i){const a=(0,w.getUserDataDir)();if(!a)throw new _.VercelOidcTokenError("Unable to find user data directory. Please reach out to Vercel support.");const l=u.join(a,"com.vercel.token",`${i}.json`),d=JSON.stringify(n);f.mkdirSync(u.dirname(l),{mode:504,recursive:!0}),f.writeFileSync(l,d),f.chmodSync(l,432)}e(E,"saveToken");function F(n){const i=(0,w.getUserDataDir)();if(!i)throw new _.VercelOidcTokenError("Unable to find user data directory. Please reach out to Vercel support.");const a=u.join(i,"com.vercel.token",`${n}.json`);if(!f.existsSync(a))return null;const l=JSON.parse(f.readFileSync(a,"utf8"));return s(l),l}e(F,"loadToken");function H(n){const i=n.split(".");if(i.length!==3)throw new _.VercelOidcTokenError("Invalid token. Please run `vc env pull` and try again");const a=i[1].replace(/-/g,"+").replace(/_/g,"/"),l=a.padEnd(a.length+(4-a.length%4)%4,"=");return JSON.parse(Buffer.from(l,"base64").toString("utf8"))}e(H,"getTokenPayload");function B(n){return n.exp*1e3<Date.now()}return e(B,"isExpired"),I}e(J,"requireTokenUtil");export{J as r};
@@ -1 +1 @@
1
- var f=Object.defineProperty;var n=(t,o)=>f(t,"name",{value:o,configurable:!0});import{g as u}from"./cli-D6HFl2Cc.mjs";import{r as c}from"./token-util-CpHGAYOA.mjs";function p(t,o){return o.forEach(function(r){r&&typeof r!="string"&&!Array.isArray(r)&&Object.keys(r).forEach(function(e){if(e!=="default"&&!(e in t)){var a=Object.getOwnPropertyDescriptor(r,e);Object.defineProperty(t,e,a.get?a:{enumerable:!0,get:n(function(){return r[e]},"get")})}})}),Object.freeze(t)}n(p,"_mergeNamespaces");var i=c(),s=u(i),l=p({__proto__:null,default:s},[i]);export{l as t};
1
+ var f=Object.defineProperty;var n=(t,o)=>f(t,"name",{value:o,configurable:!0});import{g as u}from"./cli-xI2bTfOI.mjs";import{r as c}from"./token-util-B8oenGOC.mjs";function p(t,o){return o.forEach(function(r){r&&typeof r!="string"&&!Array.isArray(r)&&Object.keys(r).forEach(function(e){if(e!=="default"&&!(e in t)){var a=Object.getOwnPropertyDescriptor(r,e);Object.defineProperty(t,e,a.get?a:{enumerable:!0,get:n(function(){return r[e]},"get")})}})}),Object.freeze(t)}n(p,"_mergeNamespaces");var i=c(),s=u(i),l=p({__proto__:null,default:s},[i]);export{l as t};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aicommits",
3
- "version": "2.0.0-develop.12",
3
+ "version": "2.0.0-develop.13",
4
4
  "description": "Writes your git commit messages for you with AI",
5
5
  "keywords": [
6
6
  "ai",