aicommits 1.12.0-develop.3 → 1.12.0-develop.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/cli.mjs +2 -2
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -20,7 +20,7 @@ var Pl=Object.defineProperty;var o=(e,t)=>Pl(e,"name",{value:t,configurable:!0})
20
20
  `:"")+(n?this.indentText({text:this.render(n),spaces:s}):"")}
21
21
  `}table({tableData:t,tableOptions:n,tableBreakpoints:s}){return kD(t.map(r=>r.map(i=>this.render(i))),s?ND(s):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:s,aliasesEnabled:r,aliasFormatted:i}=t;let u="";if(i?u+=`${i}, `:r&&(u+=" "),u+=s,"placeholder"in n&&typeof n.placeholder=="string")u+=`${this.flagOperator(t)}${n.placeholder}`;else{const a=this.flagParameter("type"in n?n.type:n);a&&(u+=`${this.flagOperator(t)}${a}`)}return u}flagDefault(t){return JSON.stringify(t)}flagDescription({flag:t}){let n="description"in t?t.description??"":"";if("default"in t){let{default:s}=t;typeof s=="function"&&(s=s()),s&&(n+=` (default: ${this.flagDefault(s)})`)}return n}render(t){if(typeof t=="string")return t;if(Array.isArray(t))return t.map(n=>this.render(n)).join(`
22
22
  `);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)}`)}},o(ot,"_z"),ot);P(Jo,"Renderers");let GD=Jo;const Js=P(e=>e.length>0&&!e.includes(" "),"isValidScriptName"),{stringify:le}=JSON,KD=/[|\\{}()[\]^$+*?.]/;function on(e){const t=[];let n,s;for(const r of e){if(s)throw new Error(`Invalid parameter: Spread parameter ${le(s)} must be last`);const i=r[0],u=r.at(-1);let a;if(i==="<"&&u===">"&&(a=!0,n))throw new Error(`Invalid parameter: Required parameter ${le(r)} cannot come after optional parameter ${le(n)}`);if(i==="["&&u==="]"&&(a=!1,n=r),a===void 0)throw new Error(`Invalid parameter: ${le(r)}. Must be wrapped in <> (required parameter) or [] (optional parameter)`);let c=r.slice(1,-1);const l=c.slice(-3)==="...";l&&(s=r,c=c.slice(0,-3));const D=c.match(KD);if(D)throw new Error(`Invalid parameter: ${le(r)}. Invalid character found ${le(D[0])}`);t.push({name:c,required:a,spread:l})}return t}o(on,"b$1"),P(on,"parseParameters");function an(e,t,n,s){for(let r=0;r<t.length;r+=1){const{name:i,required:u,spread:a}=t[r],c=LD(i);if(c in e)throw new Error(`Invalid parameter: ${le(i)} is used more than once.`);const l=a?n.slice(r):n[r];if(a&&(r=t.length),u&&(!l||a&&l.length===0))return console.error(`Error: Missing required parameter ${le(i)}
23
- `),s(),process.exit(1);e[c]=l}}o(an,"v"),P(an,"mapParametersToArguments");function Xo(e){return e===void 0||e!==!1}o(Xo,"G$2"),P(Xo,"helpEnabled");function Xs(e,t,n,s){const r={...t.flags},i=t.version&&!("version"in r);i&&(r.version={type:Boolean,description:"Show version"});const{help:u}=t,a=Xo(u);a&&!("help"in r)&&(r.help={type:Boolean,alias:"h",description:"Show help"});const c=hD(r,s,{ignore:t.ignoreArgv}),l=P(()=>{console.log(t.version)},"showVersion");if(i&&c.flags.version===!0)return l(),process.exit(0);const D=new GD,d=a&&u?.render?u.render:m=>D.render(m),f=P(m=>{const E=WD({...t,...m?{help:m}:{},flags:r});console.log(d(E,D))},"showHelp");if(a&&c.flags.help===!0)return f(),process.exit(0);if(t.parameters){let{parameters:m}=t,E=c._;const y=m.indexOf("--"),g=m.slice(y+1),b=Object.create(null);if(y>-1&&g.length>0){m=m.slice(0,y);const B=c._["--"];E=E.slice(0,-B.length||void 0),an(b,on(m),E,f),an(b,on(g),B,f)}else an(b,on(m),E,f);Object.assign(c._,b)}const h={...c,showVersion:l,showHelp:f},F={command:e,...h};if(typeof n=="function"){const m=n(h);if(m&&"then"in m)return Object.assign(Promise.resolve(m),F)}return F}o(Xs,"j"),P(Xs,"cliBase");function Yo(e,t){const n=new Map;for(const s of t){const r=[s.options.name],{alias:i}=s.options;i&&(Array.isArray(i)?r.push(...i):r.push(i));for(const u of r){if(n.has(u))throw new Error(`Duplicate command name found: ${le(u)}`);n.set(u,s)}}return n.get(e)}o(Yo,"K$1"),P(Yo,"getCommand");function Qo(e,t,n=process.argv.slice(2)){if(!e)throw new Error("Options is required");if("name"in e&&(!e.name||!Js(e.name)))throw new Error(`Invalid script name: ${le(e.name)}`);const s=n[0];if(e.commands&&s&&Js(s)){const r=Yo(s,e.commands);if(r)return Xs(r.options.name,{...r.options,parent:e},r.callback,n.slice(1))}return Xs(void 0,e,t,n)}o(Qo,"Q"),P(Qo,"cli");function Ct(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(!Js(n))throw new Error(`Invalid command name ${JSON.stringify(n)}. Command names must be one word.`);return{options:e,callback:t}}o(Ct,"X"),P(Ct,"command");var HD="aicommits",zD="1.12.0-develop.3",VD="Writes your git commit messages for you with AI",JD=["ai","git","commit","code changes"],XD="MIT",YD="Nutlope/aicommits",QD="Hassan El Mghari (@nutlope)",ZD="module",ed=["dist"],td={aicommits:"./dist/cli.mjs",aic:"./dist/cli.mjs"},nd={build:"pkgroll --minify",lint:"","type-check":"tsc",test:"tsx tests",prepack:"pnpm build && clean-pkg-json"},sd={"@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",openai:"^6.9.0",pkgroll:"^2.20.1",tsx:"^4.20.6",typescript:"^5.9.3"},rd={branches:["main",{name:"develop",prerelease:!0}]},ud={"update-notifier":"^7.3.1"},Ys={name:HD,version:zD,description:VD,keywords:JD,license:XD,repository:YD,author:QD,type:ZD,files:ed,bin:td,scripts:nd,devDependencies:sd,release:rd,dependencies:ud},ge=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Le(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}o(Le,"getDefaultExportFromCjs");var be={exports:{}},Qs,Zo;function id(){if(Zo)return Qs;Zo=1,Qs=s,s.sync=r;var e=Us;function t(i,u){var a=u.pathExt!==void 0?u.pathExt:process.env.PATHEXT;if(!a||(a=a.split(";"),a.indexOf("")!==-1))return!0;for(var c=0;c<a.length;c++){var l=a[c].toLowerCase();if(l&&i.substr(-l.length).toLowerCase()===l)return!0}return!1}o(t,"checkPathExt");function n(i,u,a){return!i.isSymbolicLink()&&!i.isFile()?!1:t(u,a)}o(n,"checkStat");function s(i,u,a){e.stat(i,function(c,l){a(c,c?!1:n(l,i,u))})}o(s,"isexe");function r(i,u){return n(e.statSync(i),i,u)}return o(r,"sync"),Qs}o(id,"requireWindows");var Zs,ea;function od(){if(ea)return Zs;ea=1,Zs=t,t.sync=n;var e=Us;function t(i,u,a){e.stat(i,function(c,l){a(c,c?!1:s(l,u))})}o(t,"isexe");function n(i,u){return s(e.statSync(i),u)}o(n,"sync");function s(i,u){return i.isFile()&&r(i,u)}o(s,"checkStat");function r(i,u){var a=i.mode,c=i.uid,l=i.gid,D=u.uid!==void 0?u.uid:process.getuid&&process.getuid(),d=u.gid!==void 0?u.gid:process.getgid&&process.getgid(),f=parseInt("100",8),h=parseInt("010",8),F=parseInt("001",8),m=f|h,E=a&F||a&h&&l===d||a&f&&c===D||a&m&&D===0;return E}return o(r,"checkMode"),Zs}o(od,"requireMode");var er,ta;function ad(){if(ta)return er;ta=1;var e;process.platform==="win32"||ge.TESTING_WINDOWS?e=id():e=od(),er=t,t.sync=n;function t(s,r,i){if(typeof r=="function"&&(i=r,r={}),!i){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(u,a){t(s,r||{},function(c,l){c?a(c):u(l)})})}e(s,r||{},function(u,a){u&&(u.code==="EACCES"||r&&r.ignoreErrors)&&(u=null,a=!1),i(u,a)})}o(t,"isexe");function n(s,r){try{return e.sync(s,r||{})}catch(i){if(r&&r.ignoreErrors||i.code==="EACCES")return!1;throw i}}return o(n,"sync"),er}o(ad,"requireIsexe");var tr,na;function cd(){if(na)return tr;na=1;const e=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",t=ae,n=e?";":":",s=ad(),r=o(c=>Object.assign(new Error(`not found: ${c}`),{code:"ENOENT"}),"getNotFoundError"),i=o((c,l)=>{const D=l.colon||n,d=c.match(/\//)||e&&c.match(/\\/)?[""]:[...e?[process.cwd()]:[],...(l.path||process.env.PATH||"").split(D)],f=e?l.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",h=e?f.split(D):[""];return e&&c.indexOf(".")!==-1&&h[0]!==""&&h.unshift(""),{pathEnv:d,pathExt:h,pathExtExe:f}},"getPathInfo"),u=o((c,l,D)=>{typeof l=="function"&&(D=l,l={}),l||(l={});const{pathEnv:d,pathExt:f,pathExtExe:h}=i(c,l),F=[],m=o(y=>new Promise((g,b)=>{if(y===d.length)return l.all&&F.length?g(F):b(r(c));const B=d[y],I=/^".*"$/.test(B)?B.slice(1,-1):B,O=t.join(I,c),R=!I&&/^\.[\\\/]/.test(c)?c.slice(0,2)+O:O;g(E(R,y,0))}),"step"),E=o((y,g,b)=>new Promise((B,I)=>{if(b===f.length)return B(m(g+1));const O=f[b];s(y+O,{pathExt:h},(R,L)=>{if(!R&&L)if(l.all)F.push(y+O);else return B(y+O);return B(E(y,g,b+1))})}),"subStep");return D?m(0).then(y=>D(null,y),D):m(0)},"which"),a=o((c,l)=>{l=l||{};const{pathEnv:D,pathExt:d,pathExtExe:f}=i(c,l),h=[];for(let F=0;F<D.length;F++){const m=D[F],E=/^".*"$/.test(m)?m.slice(1,-1):m,y=t.join(E,c),g=!E&&/^\.[\\\/]/.test(c)?c.slice(0,2)+y:y;for(let b=0;b<d.length;b++){const B=g+d[b];try{if(s.sync(B,{pathExt:f}))if(l.all)h.push(B);else return B}catch{}}}if(l.all&&h.length)return h;if(l.nothrow)return null;throw r(c)},"whichSync");return tr=u,u.sync=a,tr}o(cd,"requireWhich");var cn={exports:{}},sa;function ld(){if(sa)return cn.exports;sa=1;const e=o((t={})=>{const n=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(n).reverse().find(r=>r.toUpperCase()==="PATH")||"Path"},"pathKey");return cn.exports=e,cn.exports.default=e,cn.exports}o(ld,"requirePathKey");var nr,ra;function Dd(){if(ra)return nr;ra=1;const e=ae,t=cd(),n=ld();function s(i,u){const a=i.options.env||process.env,c=process.cwd(),l=i.options.cwd!=null,D=l&&process.chdir!==void 0&&!process.chdir.disabled;if(D)try{process.chdir(i.options.cwd)}catch{}let d;try{d=t.sync(i.command,{path:a[n({env:a})],pathExt:u?e.delimiter:void 0})}catch{}finally{D&&process.chdir(c)}return d&&(d=e.resolve(l?i.options.cwd:"",d)),d}o(s,"resolveCommandAttempt");function r(i){return s(i)||s(i,!0)}return o(r,"resolveCommand"),nr=r,nr}o(Dd,"requireResolveCommand");var ln={},ua;function dd(){if(ua)return ln;ua=1;const e=/([()\][%!^"`<>&|;, *?])/g;function t(s){return s=s.replace(e,"^$1"),s}o(t,"escapeCommand");function n(s,r){return s=`${s}`,s=s.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),s=s.replace(/(?=(\\+?)?)\1$/,"$1$1"),s=`"${s}"`,s=s.replace(e,"^$1"),r&&(s=s.replace(e,"^$1")),s}return o(n,"escapeArgument"),ln.command=t,ln.argument=n,ln}o(dd,"require_escape");var sr,ia;function hd(){return ia||(ia=1,sr=/^#!(.*)/),sr}o(hd,"requireShebangRegex");var rr,oa;function fd(){if(oa)return rr;oa=1;const e=hd();return rr=o((t="")=>{const n=t.match(e);if(!n)return null;const[s,r]=n[0].replace(/#! ?/,"").split(" "),i=s.split("/").pop();return i==="env"?r:r?`${i} ${r}`:i},"shebangCommand"),rr}o(fd,"requireShebangCommand");var ur,aa;function pd(){if(aa)return ur;aa=1;const e=Us,t=fd();function n(s){const i=Buffer.alloc(150);let u;try{u=e.openSync(s,"r"),e.readSync(u,i,0,150,0),e.closeSync(u)}catch{}return t(i.toString())}return o(n,"readShebang"),ur=n,ur}o(pd,"requireReadShebang");var ir,ca;function md(){if(ca)return ir;ca=1;const e=ae,t=Dd(),n=dd(),s=pd(),r=process.platform==="win32",i=/\.(?:com|exe)$/i,u=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function a(D){D.file=t(D);const d=D.file&&s(D.file);return d?(D.args.unshift(D.file),D.command=d,t(D)):D.file}o(a,"detectShebang");function c(D){if(!r)return D;const d=a(D),f=!i.test(d);if(D.options.forceShell||f){const h=u.test(d);D.command=e.normalize(D.command),D.command=n.command(D.command),D.args=D.args.map(m=>n.argument(m,h));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}o(c,"parseNonShell");function l(D,d,f){d&&!Array.isArray(d)&&(f=d,d=null),d=d?d.slice(0):[],f=Object.assign({},f);const h={command:D,args:d,options:f,file:void 0,original:{command:D,args:d}};return f.shell?h:c(h)}return o(l,"parse"),ir=l,ir}o(md,"requireParse");var or,la;function Fd(){if(la)return or;la=1;const e=process.platform==="win32";function t(i,u){return Object.assign(new Error(`${u} ${i.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${u} ${i.command}`,path:i.command,spawnargs:i.args})}o(t,"notFoundError");function n(i,u){if(!e)return;const a=i.emit;i.emit=function(c,l){if(c==="exit"){const D=s(l,u);if(D)return a.call(i,"error",D)}return a.apply(i,arguments)}}o(n,"hookChildProcess");function s(i,u){return e&&i===1&&!u.file?t(u.original,"spawn"):null}o(s,"verifyENOENT");function r(i,u){return e&&i===1&&!u.file?t(u.original,"spawnSync"):null}return o(r,"verifyENOENTSync"),or={hookChildProcess:n,verifyENOENT:s,verifyENOENTSync:r,notFoundError:t},or}o(Fd,"requireEnoent");var Da;function gd(){if(Da)return be.exports;Da=1;const e=jl,t=md(),n=Fd();function s(i,u,a){const c=t(i,u,a),l=e.spawn(c.command,c.args,c.options);return n.hookChildProcess(l,c),l}o(s,"spawn");function r(i,u,a){const c=t(i,u,a),l=e.spawnSync(c.command,c.args,c.options);return l.error=l.error||n.verifyENOENTSync(l.status,c),l}return o(r,"spawnSync"),be.exports=s,be.exports.spawn=s,be.exports.sync=r,be.exports._parse=t,be.exports._enoent=n,be.exports}o(gd,"requireCrossSpawn");var Cd=gd(),Ed=Le(Cd);function yd(e){const t=typeof e=="string"?`
23
+ `),s(),process.exit(1);e[c]=l}}o(an,"v"),P(an,"mapParametersToArguments");function Xo(e){return e===void 0||e!==!1}o(Xo,"G$2"),P(Xo,"helpEnabled");function Xs(e,t,n,s){const r={...t.flags},i=t.version&&!("version"in r);i&&(r.version={type:Boolean,description:"Show version"});const{help:u}=t,a=Xo(u);a&&!("help"in r)&&(r.help={type:Boolean,alias:"h",description:"Show help"});const c=hD(r,s,{ignore:t.ignoreArgv}),l=P(()=>{console.log(t.version)},"showVersion");if(i&&c.flags.version===!0)return l(),process.exit(0);const D=new GD,d=a&&u?.render?u.render:m=>D.render(m),f=P(m=>{const E=WD({...t,...m?{help:m}:{},flags:r});console.log(d(E,D))},"showHelp");if(a&&c.flags.help===!0)return f(),process.exit(0);if(t.parameters){let{parameters:m}=t,E=c._;const y=m.indexOf("--"),g=m.slice(y+1),b=Object.create(null);if(y>-1&&g.length>0){m=m.slice(0,y);const B=c._["--"];E=E.slice(0,-B.length||void 0),an(b,on(m),E,f),an(b,on(g),B,f)}else an(b,on(m),E,f);Object.assign(c._,b)}const h={...c,showVersion:l,showHelp:f},F={command:e,...h};if(typeof n=="function"){const m=n(h);if(m&&"then"in m)return Object.assign(Promise.resolve(m),F)}return F}o(Xs,"j"),P(Xs,"cliBase");function Yo(e,t){const n=new Map;for(const s of t){const r=[s.options.name],{alias:i}=s.options;i&&(Array.isArray(i)?r.push(...i):r.push(i));for(const u of r){if(n.has(u))throw new Error(`Duplicate command name found: ${le(u)}`);n.set(u,s)}}return n.get(e)}o(Yo,"K$1"),P(Yo,"getCommand");function Qo(e,t,n=process.argv.slice(2)){if(!e)throw new Error("Options is required");if("name"in e&&(!e.name||!Js(e.name)))throw new Error(`Invalid script name: ${le(e.name)}`);const s=n[0];if(e.commands&&s&&Js(s)){const r=Yo(s,e.commands);if(r)return Xs(r.options.name,{...r.options,parent:e},r.callback,n.slice(1))}return Xs(void 0,e,t,n)}o(Qo,"Q"),P(Qo,"cli");function Ct(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(!Js(n))throw new Error(`Invalid command name ${JSON.stringify(n)}. Command names must be one word.`);return{options:e,callback:t}}o(Ct,"X"),P(Ct,"command");var HD="aicommits",zD="1.12.0-develop.4",VD="Writes your git commit messages for you with AI",JD=["ai","git","commit","code changes"],XD="MIT",YD="Nutlope/aicommits",QD="Hassan El Mghari (@nutlope)",ZD="module",ed=["dist"],td={aicommits:"./dist/cli.mjs",aic:"./dist/cli.mjs"},nd={build:"pkgroll --minify",lint:"","type-check":"tsc",test:"tsx tests",prepack:"pnpm build && clean-pkg-json"},sd={"@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",openai:"^6.9.0",pkgroll:"^2.20.1",tsx:"^4.20.6",typescript:"^5.9.3"},rd={branches:["main",{name:"develop",prerelease:!0}]},ud={"update-notifier":"^7.3.1"},Ys={name:HD,version:zD,description:VD,keywords:JD,license:XD,repository:YD,author:QD,type:ZD,files:ed,bin:td,scripts:nd,devDependencies:sd,release:rd,dependencies:ud},ge=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Le(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}o(Le,"getDefaultExportFromCjs");var be={exports:{}},Qs,Zo;function id(){if(Zo)return Qs;Zo=1,Qs=s,s.sync=r;var e=Us;function t(i,u){var a=u.pathExt!==void 0?u.pathExt:process.env.PATHEXT;if(!a||(a=a.split(";"),a.indexOf("")!==-1))return!0;for(var c=0;c<a.length;c++){var l=a[c].toLowerCase();if(l&&i.substr(-l.length).toLowerCase()===l)return!0}return!1}o(t,"checkPathExt");function n(i,u,a){return!i.isSymbolicLink()&&!i.isFile()?!1:t(u,a)}o(n,"checkStat");function s(i,u,a){e.stat(i,function(c,l){a(c,c?!1:n(l,i,u))})}o(s,"isexe");function r(i,u){return n(e.statSync(i),i,u)}return o(r,"sync"),Qs}o(id,"requireWindows");var Zs,ea;function od(){if(ea)return Zs;ea=1,Zs=t,t.sync=n;var e=Us;function t(i,u,a){e.stat(i,function(c,l){a(c,c?!1:s(l,u))})}o(t,"isexe");function n(i,u){return s(e.statSync(i),u)}o(n,"sync");function s(i,u){return i.isFile()&&r(i,u)}o(s,"checkStat");function r(i,u){var a=i.mode,c=i.uid,l=i.gid,D=u.uid!==void 0?u.uid:process.getuid&&process.getuid(),d=u.gid!==void 0?u.gid:process.getgid&&process.getgid(),f=parseInt("100",8),h=parseInt("010",8),F=parseInt("001",8),m=f|h,E=a&F||a&h&&l===d||a&f&&c===D||a&m&&D===0;return E}return o(r,"checkMode"),Zs}o(od,"requireMode");var er,ta;function ad(){if(ta)return er;ta=1;var e;process.platform==="win32"||ge.TESTING_WINDOWS?e=id():e=od(),er=t,t.sync=n;function t(s,r,i){if(typeof r=="function"&&(i=r,r={}),!i){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(u,a){t(s,r||{},function(c,l){c?a(c):u(l)})})}e(s,r||{},function(u,a){u&&(u.code==="EACCES"||r&&r.ignoreErrors)&&(u=null,a=!1),i(u,a)})}o(t,"isexe");function n(s,r){try{return e.sync(s,r||{})}catch(i){if(r&&r.ignoreErrors||i.code==="EACCES")return!1;throw i}}return o(n,"sync"),er}o(ad,"requireIsexe");var tr,na;function cd(){if(na)return tr;na=1;const e=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",t=ae,n=e?";":":",s=ad(),r=o(c=>Object.assign(new Error(`not found: ${c}`),{code:"ENOENT"}),"getNotFoundError"),i=o((c,l)=>{const D=l.colon||n,d=c.match(/\//)||e&&c.match(/\\/)?[""]:[...e?[process.cwd()]:[],...(l.path||process.env.PATH||"").split(D)],f=e?l.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",h=e?f.split(D):[""];return e&&c.indexOf(".")!==-1&&h[0]!==""&&h.unshift(""),{pathEnv:d,pathExt:h,pathExtExe:f}},"getPathInfo"),u=o((c,l,D)=>{typeof l=="function"&&(D=l,l={}),l||(l={});const{pathEnv:d,pathExt:f,pathExtExe:h}=i(c,l),F=[],m=o(y=>new Promise((g,b)=>{if(y===d.length)return l.all&&F.length?g(F):b(r(c));const B=d[y],I=/^".*"$/.test(B)?B.slice(1,-1):B,O=t.join(I,c),R=!I&&/^\.[\\\/]/.test(c)?c.slice(0,2)+O:O;g(E(R,y,0))}),"step"),E=o((y,g,b)=>new Promise((B,I)=>{if(b===f.length)return B(m(g+1));const O=f[b];s(y+O,{pathExt:h},(R,L)=>{if(!R&&L)if(l.all)F.push(y+O);else return B(y+O);return B(E(y,g,b+1))})}),"subStep");return D?m(0).then(y=>D(null,y),D):m(0)},"which"),a=o((c,l)=>{l=l||{};const{pathEnv:D,pathExt:d,pathExtExe:f}=i(c,l),h=[];for(let F=0;F<D.length;F++){const m=D[F],E=/^".*"$/.test(m)?m.slice(1,-1):m,y=t.join(E,c),g=!E&&/^\.[\\\/]/.test(c)?c.slice(0,2)+y:y;for(let b=0;b<d.length;b++){const B=g+d[b];try{if(s.sync(B,{pathExt:f}))if(l.all)h.push(B);else return B}catch{}}}if(l.all&&h.length)return h;if(l.nothrow)return null;throw r(c)},"whichSync");return tr=u,u.sync=a,tr}o(cd,"requireWhich");var cn={exports:{}},sa;function ld(){if(sa)return cn.exports;sa=1;const e=o((t={})=>{const n=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(n).reverse().find(r=>r.toUpperCase()==="PATH")||"Path"},"pathKey");return cn.exports=e,cn.exports.default=e,cn.exports}o(ld,"requirePathKey");var nr,ra;function Dd(){if(ra)return nr;ra=1;const e=ae,t=cd(),n=ld();function s(i,u){const a=i.options.env||process.env,c=process.cwd(),l=i.options.cwd!=null,D=l&&process.chdir!==void 0&&!process.chdir.disabled;if(D)try{process.chdir(i.options.cwd)}catch{}let d;try{d=t.sync(i.command,{path:a[n({env:a})],pathExt:u?e.delimiter:void 0})}catch{}finally{D&&process.chdir(c)}return d&&(d=e.resolve(l?i.options.cwd:"",d)),d}o(s,"resolveCommandAttempt");function r(i){return s(i)||s(i,!0)}return o(r,"resolveCommand"),nr=r,nr}o(Dd,"requireResolveCommand");var ln={},ua;function dd(){if(ua)return ln;ua=1;const e=/([()\][%!^"`<>&|;, *?])/g;function t(s){return s=s.replace(e,"^$1"),s}o(t,"escapeCommand");function n(s,r){return s=`${s}`,s=s.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),s=s.replace(/(?=(\\+?)?)\1$/,"$1$1"),s=`"${s}"`,s=s.replace(e,"^$1"),r&&(s=s.replace(e,"^$1")),s}return o(n,"escapeArgument"),ln.command=t,ln.argument=n,ln}o(dd,"require_escape");var sr,ia;function hd(){return ia||(ia=1,sr=/^#!(.*)/),sr}o(hd,"requireShebangRegex");var rr,oa;function fd(){if(oa)return rr;oa=1;const e=hd();return rr=o((t="")=>{const n=t.match(e);if(!n)return null;const[s,r]=n[0].replace(/#! ?/,"").split(" "),i=s.split("/").pop();return i==="env"?r:r?`${i} ${r}`:i},"shebangCommand"),rr}o(fd,"requireShebangCommand");var ur,aa;function pd(){if(aa)return ur;aa=1;const e=Us,t=fd();function n(s){const i=Buffer.alloc(150);let u;try{u=e.openSync(s,"r"),e.readSync(u,i,0,150,0),e.closeSync(u)}catch{}return t(i.toString())}return o(n,"readShebang"),ur=n,ur}o(pd,"requireReadShebang");var ir,ca;function md(){if(ca)return ir;ca=1;const e=ae,t=Dd(),n=dd(),s=pd(),r=process.platform==="win32",i=/\.(?:com|exe)$/i,u=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function a(D){D.file=t(D);const d=D.file&&s(D.file);return d?(D.args.unshift(D.file),D.command=d,t(D)):D.file}o(a,"detectShebang");function c(D){if(!r)return D;const d=a(D),f=!i.test(d);if(D.options.forceShell||f){const h=u.test(d);D.command=e.normalize(D.command),D.command=n.command(D.command),D.args=D.args.map(m=>n.argument(m,h));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}o(c,"parseNonShell");function l(D,d,f){d&&!Array.isArray(d)&&(f=d,d=null),d=d?d.slice(0):[],f=Object.assign({},f);const h={command:D,args:d,options:f,file:void 0,original:{command:D,args:d}};return f.shell?h:c(h)}return o(l,"parse"),ir=l,ir}o(md,"requireParse");var or,la;function Fd(){if(la)return or;la=1;const e=process.platform==="win32";function t(i,u){return Object.assign(new Error(`${u} ${i.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${u} ${i.command}`,path:i.command,spawnargs:i.args})}o(t,"notFoundError");function n(i,u){if(!e)return;const a=i.emit;i.emit=function(c,l){if(c==="exit"){const D=s(l,u);if(D)return a.call(i,"error",D)}return a.apply(i,arguments)}}o(n,"hookChildProcess");function s(i,u){return e&&i===1&&!u.file?t(u.original,"spawn"):null}o(s,"verifyENOENT");function r(i,u){return e&&i===1&&!u.file?t(u.original,"spawnSync"):null}return o(r,"verifyENOENTSync"),or={hookChildProcess:n,verifyENOENT:s,verifyENOENTSync:r,notFoundError:t},or}o(Fd,"requireEnoent");var Da;function gd(){if(Da)return be.exports;Da=1;const e=jl,t=md(),n=Fd();function s(i,u,a){const c=t(i,u,a),l=e.spawn(c.command,c.args,c.options);return n.hookChildProcess(l,c),l}o(s,"spawn");function r(i,u,a){const c=t(i,u,a),l=e.spawnSync(c.command,c.args,c.options);return l.error=l.error||n.verifyENOENTSync(l.status,c),l}return o(r,"spawnSync"),be.exports=s,be.exports.spawn=s,be.exports.sync=r,be.exports._parse=t,be.exports._enoent=n,be.exports}o(gd,"requireCrossSpawn");var Cd=gd(),Ed=Le(Cd);function yd(e){const t=typeof e=="string"?`
24
24
  `: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}o(yd,"stripFinalNewline");function da(e={}){const{env:t=process.env,platform:n=process.platform}=e;return n!=="win32"?"PATH":Object.keys(t).reverse().find(s=>s.toUpperCase()==="PATH")||"Path"}o(da,"pathKey");const wd=o(({cwd:e=j.cwd(),path:t=j.env[da()],preferLocal:n=!0,execPath:s=j.execPath,addExecPath:r=!0}={})=>{const i=e instanceof URL?co(e):e,u=Me.resolve(i),a=[];return n&&bd(a,u),r&&_d(a,s,u),[...a,t].join(Me.delimiter)},"npmRunPath"),bd=o((e,t)=>{let n;for(;n!==t;)e.push(Me.join(t,"node_modules/.bin")),n=t,t=Me.resolve(t,"..")},"applyPreferLocal"),_d=o((e,t,n)=>{const s=t instanceof URL?co(t):t;e.push(Me.resolve(n,s,".."))},"applyExecPath"),Bd=o(({env:e=j.env,...t}={})=>{e={...e};const n=da({env:e});return t.path=e[n],e[n]=wd(t),e},"npmRunPathEnv"),Ad=o((e,t,n,s)=>{if(n==="length"||n==="prototype"||n==="arguments"||n==="caller")return;const r=Object.getOwnPropertyDescriptor(e,n),i=Object.getOwnPropertyDescriptor(t,n);!vd(r,i)&&s||Object.defineProperty(e,n,i)},"copyProperty"),vd=o(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"),$d=o((e,t)=>{const n=Object.getPrototypeOf(t);n!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,n)},"changePrototype"),xd=o((e,t)=>`/* Wrapped ${e}*/
25
25
  ${t}`,"wrappedToString"),Sd=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Id=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Od=o((e,t,n)=>{const s=n===""?"":`with ${n.trim()}() `,r=xd.bind(null,s,t.toString());Object.defineProperty(r,"name",Id),Object.defineProperty(e,"toString",{...Sd,value:r})},"changeToString");function Rd(e,t,{ignoreNonConfigurable:n=!1}={}){const{name:s}=e;for(const r of Reflect.ownKeys(t))Ad(e,t,r,n);return $d(e,t),Od(e,t,s),e}o(Rd,"mimicFunction");const Dn=new WeakMap,ha=o((e,t={})=>{if(typeof e!="function")throw new TypeError("Expected a function");let n,s=0;const r=e.displayName||e.name||"<anonymous>",i=o(function(...u){if(Dn.set(i,++s),s===1)n=e.apply(this,u),e=null;else if(t.throw===!0)throw new Error(`Function \`${r}\` can only be called once`);return n},"onetime2");return Rd(i,e),Dn.set(i,s),i},"onetime");ha.callCount=e=>{if(!Dn.has(e))throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return Dn.get(e)};const kd=o(()=>{const e=pa-fa+1;return Array.from({length:e},Pd)},"getRealtimeSignals"),Pd=o((e,t)=>({name:`SIGRT${t+1}`,number:fa+t,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),"getRealtimeSignal"),fa=34,pa=64,Td=[{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"}],ma=o(()=>{const e=kd();return[...Td,...e].map(Nd)},"getSignals"),Nd=o(({name:e,number:t,description:n,action:s,forced:r=!1,standard:i})=>{const{signals:{[e]:u}}=lo,a=u!==void 0;return{name:e,number:a?u:t,description:n,supported:a,action:s,forced:r,standard:i}},"normalizeSignal"),Md=o(()=>{const e=ma();return Object.fromEntries(e.map(Ld))},"getSignalsByName"),Ld=o(({name:e,number:t,description:n,supported:s,action:r,forced:i,standard:u})=>[e,{name:e,number:t,description:n,supported:s,action:r,forced:i,standard:u}],"getSignalByName"),jd=Md(),Ud=o(()=>{const e=ma(),t=pa+1,n=Array.from({length:t},(s,r)=>Wd(r,e));return Object.assign({},...n)},"getSignalsByNumber"),Wd=o((e,t)=>{const n=qd(e,t);if(n===void 0)return{};const{name:s,description:r,supported:i,action:u,forced:a,standard:c}=n;return{[e]:{name:s,number:e,description:r,supported:i,action:u,forced:a,standard:c}}},"getSignalByNumber"),qd=o((e,t)=>{const n=t.find(({name:s})=>lo.signals[s]===e);return n!==void 0?n:t.find(s=>s.number===e)},"findSignalByNumber");Ud();const Gd=o(({timedOut:e,timeout:t,errorCode:n,signal:s,signalDescription:r,exitCode:i,isCanceled:u})=>e?`timed out after ${t} milliseconds`:u?"was canceled":n!==void 0?`failed with ${n}`:s!==void 0?`was killed with ${s} (${r})`:i!==void 0?`failed with exit code ${i}`:"failed","getErrorPrefix"),Fa=o(({stdout:e,stderr:t,all:n,error:s,signal:r,exitCode:i,command:u,escapedCommand:a,timedOut:c,isCanceled:l,killed:D,parsed:{options:{timeout:d,cwd:f=j.cwd()}}})=>{i=i===null?void 0:i,r=r===null?void 0:r;const h=r===void 0?void 0:jd[r].description,F=s&&s.code,E=`Command ${Gd({timedOut:c,timeout:d,errorCode:F,signal:r,signalDescription:h,exitCode:i,isCanceled:l})}: ${u}`,y=Object.prototype.toString.call(s)==="[object Error]",g=y?`${E}
26
26
  ${s.message}`:E,b=[g,t,e].filter(Boolean).join(`
@@ -82,7 +82,7 @@ ${Pr}Please open a Bug report with the information above:`),console.error(`${Pr}
82
82
  `),Ja(e),process.exit(1)},"handleCommandError"),Xa=o(async()=>{const{stdout:e,failed:t}=await Et("git",["rev-parse","--show-toplevel"],{reject:!1});if(t)throw new G("The current directory must be a Git repository!");return e},"assertGitRepo"),Nr=o(e=>`:(exclude)${e}`,"excludeFromDiff"),Ya=["package-lock.json","pnpm-lock.yaml","*.lock"].map(Nr),Qa=o(async e=>{const t=["diff","--cached","--diff-algorithm=minimal"],{stdout:n}=await Et("git",[...t,"--name-only",...Ya,...e?e.map(Nr):[]]);if(!n)return;const{stdout:s}=await Et("git",[...t,...Ya,...e?e.map(Nr):[]]);return{files:n.split(`
83
83
  `),diff:s}},"getStagedDiff"),gf=o(e=>`Detected ${e.length.toLocaleString()} staged file${e.length>1?"s":""}`,"getDetectedMessage");var Mr,Za;function Cf(){if(Za)return Mr;Za=1;const{hasOwnProperty:e}=Object.prototype,t=typeof process<"u"&&process.platform==="win32"?`\r
84
84
  `:`
85
- `,n=o((c,l)=>{const D=[];let d="";typeof l=="string"?l={section:l,whitespace:!1}:(l=l||Object.create(null),l.whitespace=l.whitespace===!0);const f=l.whitespace?" = ":"=";for(const h of Object.keys(c)){const F=c[h];if(F&&Array.isArray(F))for(const m of F)d+=u(h+"[]")+f+u(m)+t;else F&&typeof F=="object"?D.push(h):d+=u(h)+f+u(F)+t}l.section&&d.length&&(d="["+u(l.section)+"]"+t+d);for(const h of D){const F=s(h).join("\\."),m=(l.section?l.section+".":"")+F,{whitespace:E}=l,y=n(c[h],{section:m,whitespace:E});d.length&&y.length&&(d+=t),d+=y}return d},"encode"),s=o(c=>c.replace(/\1/g,"LITERAL\\1LITERAL").replace(/\\\./g,"").split(/\./).map(l=>l.replace(/\1/g,"\\.").replace(/\2LITERAL\\1LITERAL\2/g,"")),"dotSplit"),r=o(c=>{const l=Object.create(null);let D=l,d=null;const f=/^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i,h=c.split(/[\r\n]+/g);for(const m of h){if(!m||m.match(/^\s*[;#]/))continue;const E=m.match(f);if(!E)continue;if(E[1]!==void 0){if(d=a(E[1]),d==="__proto__"){D=Object.create(null);continue}D=l[d]=l[d]||Object.create(null);continue}const y=a(E[2]),g=y.length>2&&y.slice(-2)==="[]",b=g?y.slice(0,-2):y;if(b==="__proto__")continue;const B=E[3]?a(E[4]):!0,I=B==="true"||B==="false"||B==="null"?JSON.parse(B):B;g&&(e.call(D,b)?Array.isArray(D[b])||(D[b]=[D[b]]):D[b]=[]),Array.isArray(D[b])?D[b].push(I):D[b]=I}const F=[];for(const m of Object.keys(l)){if(!e.call(l,m)||typeof l[m]!="object"||Array.isArray(l[m]))continue;const E=s(m);D=l;const y=E.pop(),g=y.replace(/\\\./g,".");for(const b of E)b!=="__proto__"&&((!e.call(D,b)||typeof D[b]!="object")&&(D[b]=Object.create(null)),D=D[b]);D===l&&g===y||(D[g]=l[m],F.push(m))}for(const m of F)delete l[m];return l},"decode"),i=o(c=>c.startsWith('"')&&c.endsWith('"')||c.startsWith("'")&&c.endsWith("'"),"isQuoted"),u=o(c=>typeof c!="string"||c.match(/[=\r\n]/)||c.match(/^\[/)||c.length>1&&i(c)||c!==c.trim()?JSON.stringify(c):c.split(";").join("\\;").split("#").join("\\#"),"safe"),a=o((c,l)=>{if(c=(c||"").trim(),i(c)){c.charAt(0)==="'"&&(c=c.slice(1,-1));try{c=JSON.parse(c)}catch{}}else{let D=!1,d="";for(let f=0,h=c.length;f<h;f++){const F=c.charAt(f);if(D)"\\;#".indexOf(F)!==-1?d+=F:d+="\\"+F,D=!1;else{if(";#".indexOf(F)!==-1)break;F==="\\"?D=!0:d+=F}}return D&&(d+="\\"),d.trim()}return c},"unsafe");return Mr={parse:r,decode:r,stringify:n,encode:n,safe:u,unsafe:a},Mr}o(Cf,"requireIni");var Ef=Cf(),ec=Le(Ef);const Lr=o(e=>Q.lstat(e).then(()=>!0,()=>!1),"fileExists"),yf=["","conventional","gitmoji"],{hasOwnProperty:wf}=Object.prototype,tc=o((e,t)=>wf.call(e,t),"hasOwn$1"),de=o((e,t,n)=>{if(!t)throw new G(`Invalid config property ${e}: ${n}`)},"parseAssert"),wn={OPENAI_API_KEY(e){return e},OPENAI_BASE_URL(e){return e},OPENAI_MODEL(e){return e||""},locale(e){return e?(de("locale",!!e,"Cannot be empty"),de("locale",/^[a-z-]+$/i.test(e),"Must be a valid locale (letters and dashes/underscores)."),e):"en"},generate(e){if(!e)return 1;de("generate",/^\d+$/.test(e),"Must be an integer");const t=Number(e);return de("generate",t>0,"Must be greater than 0"),de("generate",t<=5,"Must be less or equal to 5"),t},type(e){return e?(de("type",yf.includes(e),"Invalid commit type"),e):""},proxy(e){if(!(!e||e.length===0))throw new G('The "proxy" config property is deprecated and no longer supported.')},timeout(e){if(!e)return;de("timeout",/^\d+$/.test(e),"Must be an integer");const t=Number(e);return de("timeout",t>=500,"Must be greater than 500ms"),t},"max-length"(e){if(!e)return 72;de("max-length",/^\d+$/.test(e),"Must be an integer");const t=Number(e);return de("max-length",t>=20,"Must be greater than 20 characters"),t}},bf={name:"togetherai",displayName:"Together AI (recommended)",baseUrl:"https://api.together.xyz/v1",apiKeyFormat:"tgp_",modelsFilter:o(e=>e.filter(t=>!t.type||t.type==="chat"||t.type==="language").map(t=>t.id),"modelsFilter"),defaultModel:"meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo",requiresApiKey:!0},_f={name:"openai",displayName:"OpenAI",baseUrl:"https://api.openai.com/v1",apiKeyFormat:"sk-",modelsFilter:o(e=>e.filter(t=>t.id&&(t.id.includes("gpt")||t.id.includes("o1")||t.id.includes("o3")||t.id.includes("o4")||t.id.includes("o5")||!t.type||t.type==="chat")).map(t=>t.id),"modelsFilter"),defaultModel:"gpt-4o",requiresApiKey:!0},Bf={name:"ollama",displayName:"Ollama (local)",baseUrl:"http://localhost:11434/v1",modelsFilter:o(e=>e.filter(t=>t.name).map(t=>t.name),"modelsFilter"),defaultModel:"llama2",requiresApiKey:!1},Af={name:"custom",displayName:"Custom (OpenAI-compatible)",baseUrl:"",modelsFilter:o(e=>e.filter(t=>!t.type||t.type==="chat"||t.type==="language").map(t=>t.id),"modelsFilter"),defaultModel:"",requiresApiKey:!0},Bt=[bf,_f,Bf,Af],vf=o(()=>Bt.find(t=>t.name==="openai")?.baseUrl||"","getDefaultBaseUrl"),$f=o((e,t)=>{if(e){const n=Bt.find(s=>s.baseUrl===e||s.name==="ollama"&&e.startsWith(s.baseUrl.slice(0,-3)));return n?n.name:"custom"}else if(t)return"openai"},"detectProvider"),jr=o(()=>ae.join(ho.homedir(),".aicommits"),"getConfigPath"),nc=o(async()=>{if(!await Lr(jr()))return Object.create(null);const t=await Q.readFile(jr(),"utf8");return ec.parse(t)},"readConfigFile"),Ge=o(async(e,t,n)=>{const s=await nc(),r={},{env:i}=process,u=t??{OPENAI_API_KEY:i.OPENAI_API_KEY||i.OPENAI_KEY,OPENAI_BASE_URL:i.OPENAI_BASE_URL,OPENAI_MODEL:i.OPENAI_MODEL};for(const D of Object.keys(wn)){const d=wn[D],f=e?.[D]??u?.[D]??s[D];if(n)try{r[D]=d(f)}catch{}else r[D]=d(f)}let a,c=r.OPENAI_BASE_URL;const l=r.OPENAI_API_KEY;return!c&&l&&(c=vf(),r.OPENAI_BASE_URL=c),a=$f(c,l),{...r,provider:a}},"getConfig"),At=o(async e=>{const t=await nc();for(const[n,s]of e){if(!tc(wn,n))throw new G(`Invalid config property: ${n}`);if(s==="")delete t[n];else{const r=wn[n](s);t[n]=r}}await Q.writeFile(jr(),ec.stringify(t),"utf8")},"setConfigs");function $(e,t,n,s,r){if(typeof t=="function"?e!==t||!0:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}o($,"__classPrivateFieldSet");function p(e,t,n,s){if(n==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?s:n==="a"?s.call(e):s?s.value:t.get(e)}o(p,"__classPrivateFieldGet");let sc=o(function(){const{crypto:e}=globalThis;if(e?.randomUUID)return sc=e.randomUUID.bind(e),e.randomUUID();const t=new Uint8Array(1),n=e?()=>e.getRandomValues(t)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,s=>(+s^n()&15>>+s/4).toString(16))},"uuid4");function Ur(e){return typeof e=="object"&&e!==null&&("name"in e&&e.name==="AbortError"||"message"in e&&String(e.message).includes("FetchRequestCanceledException"))}o(Ur,"isAbortError");const Wr=o(e=>{if(e instanceof Error)return e;if(typeof e=="object"&&e!==null){try{if(Object.prototype.toString.call(e)==="[object Error]"){const t=new Error(e.message,e.cause?{cause:e.cause}:{});return e.stack&&(t.stack=e.stack),e.cause&&!t.cause&&(t.cause=e.cause),e.name&&(t.name=e.name),t}}catch{}try{return new Error(JSON.stringify(e))}catch{}}return new Error(e)},"castToError"),Pu=class Pu extends Error{};o(Pu,"OpenAIError");let v=Pu;const Zt=class Zt extends v{constructor(t,n,s,r){super(`${Zt.makeMessage(t,n,s)}`),this.status=t,this.headers=r,this.requestID=r?.get("x-request-id"),this.error=n;const i=n;this.code=i?.code,this.param=i?.param,this.type=i?.type}static makeMessage(t,n,s){const r=n?.message?typeof n.message=="string"?n.message:JSON.stringify(n.message):n?JSON.stringify(n):s;return t&&r?`${t} ${r}`:t?`${t} status code (no body)`:r||"(no status code or body)"}static generate(t,n,s,r){if(!t||!r)return new Ke({message:s,cause:Wr(n)});const i=n?.error;return t===400?new bn(t,i,s,r):t===401?new _n(t,i,s,r):t===403?new Bn(t,i,s,r):t===404?new An(t,i,s,r):t===409?new vn(t,i,s,r):t===422?new $n(t,i,s,r):t===429?new xn(t,i,s,r):t>=500?new Sn(t,i,s,r):new Zt(t,i,s,r)}};o(Zt,"APIError");let ee=Zt;const Tu=class Tu extends ee{constructor({message:t}={}){super(void 0,void 0,t||"Request was aborted.",void 0)}};o(Tu,"APIUserAbortError");let ne=Tu;const Nu=class Nu extends ee{constructor({message:t,cause:n}){super(void 0,void 0,t||"Connection error.",void 0),n&&(this.cause=n)}};o(Nu,"APIConnectionError");let Ke=Nu;const Mu=class Mu extends Ke{constructor({message:t}={}){super({message:t??"Request timed out."})}};o(Mu,"APIConnectionTimeoutError");let vt=Mu;const Lu=class Lu extends ee{};o(Lu,"BadRequestError");let bn=Lu;const ju=class ju extends ee{};o(ju,"AuthenticationError");let _n=ju;const Uu=class Uu extends ee{};o(Uu,"PermissionDeniedError");let Bn=Uu;const Wu=class Wu extends ee{};o(Wu,"NotFoundError");let An=Wu;const qu=class qu extends ee{};o(qu,"ConflictError");let vn=qu;const Gu=class Gu extends ee{};o(Gu,"UnprocessableEntityError");let $n=Gu;const Ku=class Ku extends ee{};o(Ku,"RateLimitError");let xn=Ku;const Hu=class Hu extends ee{};o(Hu,"InternalServerError");let Sn=Hu;const zu=class zu extends v{constructor(){super("Could not parse response content as the length limit was reached")}};o(zu,"LengthFinishReasonError");let In=zu;const Vu=class Vu extends v{constructor(){super("Could not parse response content as the request was rejected by the content filter")}};o(Vu,"ContentFilterFinishReasonError");let On=Vu;const Ju=class Ju extends Error{constructor(t){super(t)}};o(Ju,"InvalidWebhookSignatureError");let ve=Ju;const xf=/^[a-z][a-z0-9+.-]*:/i,Sf=o(e=>xf.test(e),"isAbsoluteURL");let se=o(e=>(se=Array.isArray,se(e)),"isArray"),rc=se;function uc(e){return typeof e!="object"?{}:e??{}}o(uc,"maybeObj");function If(e){if(!e)return!0;for(const t in e)return!1;return!0}o(If,"isEmptyObj");function Of(e,t){return Object.prototype.hasOwnProperty.call(e,t)}o(Of,"hasOwn");function qr(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)}o(qr,"isObj");const Rf=o((e,t)=>{if(typeof t!="number"||!Number.isInteger(t))throw new v(`${e} must be an integer`);if(t<0)throw new v(`${e} must be a positive integer`);return t},"validatePositiveInteger"),kf=o(e=>{try{return JSON.parse(e)}catch{return}},"safeJSON"),$t=o(e=>new Promise(t=>setTimeout(t,e)),"sleep$1"),He="6.9.0",Pf=o(()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u","isRunningInBrowser");function Tf(){return typeof Deno<"u"&&Deno.build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]"?"node":"unknown"}o(Tf,"getDetectedPlatform");const Nf=o(()=>{const e=Tf();if(e==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":He,"X-Stainless-OS":oc(Deno.build.os),"X-Stainless-Arch":ic(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":He,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(e==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":He,"X-Stainless-OS":oc(globalThis.process.platform??"unknown"),"X-Stainless-Arch":ic(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};const t=Mf();return t?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":He,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${t.browser}`,"X-Stainless-Runtime-Version":t.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":He,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}},"getPlatformProperties");function Mf(){if(typeof navigator>"u"||!navigator)return null;const e=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(const{key:t,pattern:n}of e){const s=n.exec(navigator.userAgent);if(s){const r=s[1]||0,i=s[2]||0,u=s[3]||0;return{browser:t,version:`${r}.${i}.${u}`}}}return null}o(Mf,"getBrowserInfo");const ic=o(e=>e==="x32"?"x32":e==="x86_64"||e==="x64"?"x64":e==="arm"?"arm":e==="aarch64"||e==="arm64"?"arm64":e?`other:${e}`:"unknown","normalizeArch"),oc=o(e=>(e=e.toLowerCase(),e.includes("ios")?"iOS":e==="android"?"Android":e==="darwin"?"MacOS":e==="win32"?"Windows":e==="freebsd"?"FreeBSD":e==="openbsd"?"OpenBSD":e==="linux"?"Linux":e?`Other:${e}`:"Unknown"),"normalizePlatform");let ac;const Lf=o(()=>ac??(ac=Nf()),"getPlatformHeaders");function jf(){if(typeof fetch<"u")return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}o(jf,"getDefaultFetch");function cc(...e){const t=globalThis.ReadableStream;if(typeof t>"u")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new t(...e)}o(cc,"makeReadableStream");function lc(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator]();return cc({start(){},async pull(n){const{done:s,value:r}=await t.next();s?n.close():n.enqueue(r)},async cancel(){await t.return?.()}})}o(lc,"ReadableStreamFrom");function Dc(e){if(e[Symbol.asyncIterator])return e;const t=e.getReader();return{async next(){try{const n=await t.read();return n?.done&&t.releaseLock(),n}catch(n){throw t.releaseLock(),n}},async return(){const n=t.cancel();return t.releaseLock(),await n,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}o(Dc,"ReadableStreamToAsyncIterable");async function Uf(e){if(e===null||typeof e!="object")return;if(e[Symbol.asyncIterator]){await e[Symbol.asyncIterator]().return?.();return}const t=e.getReader(),n=t.cancel();t.releaseLock(),await n}o(Uf,"CancelReadableStream");const Wf=o(({headers:e,body:t})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(t)}),"FallbackEncoder"),dc="RFC3986",hc=o(e=>String(e),"default_formatter"),fc={RFC1738:o(e=>String(e).replace(/%20/g,"+"),"RFC1738"),RFC3986:hc},qf="RFC1738";let Gr=o((e,t)=>(Gr=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),Gr(e,t)),"has");const he=(()=>{const e=[];for(let t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e})(),Kr=1024,Gf=o((e,t,n,s,r)=>{if(e.length===0)return e;let i=e;if(typeof e=="symbol"?i=Symbol.prototype.toString.call(e):typeof e!="string"&&(i=String(e)),n==="iso-8859-1")return escape(i).replace(/%u[0-9a-f]{4}/gi,function(a){return"%26%23"+parseInt(a.slice(2),16)+"%3B"});let u="";for(let a=0;a<i.length;a+=Kr){const c=i.length>=Kr?i.slice(a,a+Kr):i,l=[];for(let D=0;D<c.length;++D){let d=c.charCodeAt(D);if(d===45||d===46||d===95||d===126||d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||r===qf&&(d===40||d===41)){l[l.length]=c.charAt(D);continue}if(d<128){l[l.length]=he[d];continue}if(d<2048){l[l.length]=he[192|d>>6]+he[128|d&63];continue}if(d<55296||d>=57344){l[l.length]=he[224|d>>12]+he[128|d>>6&63]+he[128|d&63];continue}D+=1,d=65536+((d&1023)<<10|c.charCodeAt(D)&1023),l[l.length]=he[240|d>>18]+he[128|d>>12&63]+he[128|d>>6&63]+he[128|d&63]}u+=l.join("")}return u},"encode");function Kf(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))}o(Kf,"is_buffer");function pc(e,t){if(se(e)){const n=[];for(let s=0;s<e.length;s+=1)n.push(t(e[s]));return n}return t(e)}o(pc,"maybe_map");const mc={brackets(e){return String(e)+"[]"},comma:"comma",indices(e,t){return String(e)+"["+t+"]"},repeat(e){return String(e)}},Fc=o(function(e,t){Array.prototype.push.apply(e,se(t)?t:[t])},"push_to_array");let gc;const K={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:Gf,encodeValuesOnly:!1,format:dc,formatter:hc,indices:!1,serializeDate(e){return(gc??(gc=Function.prototype.call.bind(Date.prototype.toISOString)))(e)},skipNulls:!1,strictNullHandling:!1};function Hf(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"}o(Hf,"is_non_nullish_primitive");const Hr={};function Cc(e,t,n,s,r,i,u,a,c,l,D,d,f,h,F,m,E,y){let g=e,b=y,B=0,I=!1;for(;(b=b.get(Hr))!==void 0&&!I;){const U=b.get(e);if(B+=1,typeof U<"u"){if(U===B)throw new RangeError("Cyclic object value");I=!0}typeof b.get(Hr)>"u"&&(B=0)}if(typeof l=="function"?g=l(t,g):g instanceof Date?g=f?.(g):n==="comma"&&se(g)&&(g=pc(g,function(U){return U instanceof Date?f?.(U):U})),g===null){if(i)return c&&!m?c(t,K.encoder,E,"key",h):t;g=""}if(Hf(g)||Kf(g)){if(c){const U=m?t:c(t,K.encoder,E,"key",h);return[F?.(U)+"="+F?.(c(g,K.encoder,E,"value",h))]}return[F?.(t)+"="+F?.(String(g))]}const O=[];if(typeof g>"u")return O;let R;if(n==="comma"&&se(g))m&&c&&(g=pc(g,c)),R=[{value:g.length>0?g.join(",")||null:void 0}];else if(se(l))R=l;else{const U=Object.keys(g);R=D?U.sort(D):U}const L=a?String(t).replace(/\./g,"%2E"):String(t),z=s&&se(g)&&g.length===1?L+"[]":L;if(r&&se(g)&&g.length===0)return z+"[]";for(let U=0;U<R.length;++U){const W=R[U],ro=typeof W=="object"&&typeof W.value<"u"?W.value:g[W];if(u&&ro===null)continue;const js=d&&a?W.replace(/\./g,"%2E"):W,kl=se(g)?typeof n=="function"?n(z,js):z:z+(d?"."+js:"["+js+"]");y.set(e,B);const uo=new WeakMap;uo.set(Hr,y),Fc(O,Cc(ro,kl,n,s,r,i,u,a,n==="comma"&&m&&se(g)?null:c,l,D,d,f,h,F,m,E,uo))}return O}o(Cc,"inner_stringify");function zf(e=K){if(typeof e.allowEmptyArrays<"u"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.encodeDotInKeys<"u"&&typeof e.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(e.encoder!==null&&typeof e.encoder<"u"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");const t=e.charset||K.charset;if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let n=dc;if(typeof e.format<"u"){if(!Gr(fc,e.format))throw new TypeError("Unknown format option provided.");n=e.format}const s=fc[n];let r=K.filter;(typeof e.filter=="function"||se(e.filter))&&(r=e.filter);let i;if(e.arrayFormat&&e.arrayFormat in mc?i=e.arrayFormat:"indices"in e?i=e.indices?"indices":"repeat":i=K.arrayFormat,"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");const u=typeof e.allowDots>"u"?e.encodeDotInKeys?!0:K.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:K.addQueryPrefix,allowDots:u,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:K.allowEmptyArrays,arrayFormat:i,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:K.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:typeof e.delimiter>"u"?K.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:K.encode,encodeDotInKeys:typeof e.encodeDotInKeys=="boolean"?e.encodeDotInKeys:K.encodeDotInKeys,encoder:typeof e.encoder=="function"?e.encoder:K.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:K.encodeValuesOnly,filter:r,format:n,formatter:s,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:K.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:K.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:K.strictNullHandling}}o(zf,"normalize_stringify_options");function Vf(e,t={}){let n=e;const s=zf(t);let r,i;typeof s.filter=="function"?(i=s.filter,n=i("",n)):se(s.filter)&&(i=s.filter,r=i);const u=[];if(typeof n!="object"||n===null)return"";const a=mc[s.arrayFormat],c=a==="comma"&&s.commaRoundTrip;r||(r=Object.keys(n)),s.sort&&r.sort(s.sort);const l=new WeakMap;for(let f=0;f<r.length;++f){const h=r[f];s.skipNulls&&n[h]===null||Fc(u,Cc(n[h],h,a,c,s.allowEmptyArrays,s.strictNullHandling,s.skipNulls,s.encodeDotInKeys,s.encode?s.encoder:null,s.filter,s.sort,s.allowDots,s.serializeDate,s.format,s.formatter,s.encodeValuesOnly,s.charset,l))}const D=u.join(s.delimiter);let d=s.addQueryPrefix===!0?"?":"";return s.charsetSentinel&&(s.charset==="iso-8859-1"?d+="utf8=%26%2310003%3B&":d+="utf8=%E2%9C%93&"),D.length>0?d+D:""}o(Vf,"stringify");function Jf(e){let t=0;for(const r of e)t+=r.length;const n=new Uint8Array(t);let s=0;for(const r of e)n.set(r,s),s+=r.length;return n}o(Jf,"concatBytes");let Ec;function zr(e){let t;return(Ec??(t=new globalThis.TextEncoder,Ec=t.encode.bind(t)))(e)}o(zr,"encodeUTF8");let yc;function wc(e){let t;return(yc??(t=new globalThis.TextDecoder,yc=t.decode.bind(t)))(e)}o(wc,"decodeUTF8");var ue,ie;const Xu=class Xu{constructor(){ue.set(this,void 0),ie.set(this,void 0),$(this,ue,new Uint8Array),$(this,ie,null)}decode(t){if(t==null)return[];const n=t instanceof ArrayBuffer?new Uint8Array(t):typeof t=="string"?zr(t):t;$(this,ue,Jf([p(this,ue,"f"),n]));const s=[];let r;for(;(r=Xf(p(this,ue,"f"),p(this,ie,"f")))!=null;){if(r.carriage&&p(this,ie,"f")==null){$(this,ie,r.index);continue}if(p(this,ie,"f")!=null&&(r.index!==p(this,ie,"f")+1||r.carriage)){s.push(wc(p(this,ue,"f").subarray(0,p(this,ie,"f")-1))),$(this,ue,p(this,ue,"f").subarray(p(this,ie,"f"))),$(this,ie,null);continue}const i=p(this,ie,"f")!==null?r.preceding-1:r.preceding,u=wc(p(this,ue,"f").subarray(0,i));s.push(u),$(this,ue,p(this,ue,"f").subarray(r.index)),$(this,ie,null)}return s}flush(){return p(this,ue,"f").length?this.decode(`
85
+ `,n=o((c,l)=>{const D=[];let d="";typeof l=="string"?l={section:l,whitespace:!1}:(l=l||Object.create(null),l.whitespace=l.whitespace===!0);const f=l.whitespace?" = ":"=";for(const h of Object.keys(c)){const F=c[h];if(F&&Array.isArray(F))for(const m of F)d+=u(h+"[]")+f+u(m)+t;else F&&typeof F=="object"?D.push(h):d+=u(h)+f+u(F)+t}l.section&&d.length&&(d="["+u(l.section)+"]"+t+d);for(const h of D){const F=s(h).join("\\."),m=(l.section?l.section+".":"")+F,{whitespace:E}=l,y=n(c[h],{section:m,whitespace:E});d.length&&y.length&&(d+=t),d+=y}return d},"encode"),s=o(c=>c.replace(/\1/g,"LITERAL\\1LITERAL").replace(/\\\./g,"").split(/\./).map(l=>l.replace(/\1/g,"\\.").replace(/\2LITERAL\\1LITERAL\2/g,"")),"dotSplit"),r=o(c=>{const l=Object.create(null);let D=l,d=null;const f=/^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i,h=c.split(/[\r\n]+/g);for(const m of h){if(!m||m.match(/^\s*[;#]/))continue;const E=m.match(f);if(!E)continue;if(E[1]!==void 0){if(d=a(E[1]),d==="__proto__"){D=Object.create(null);continue}D=l[d]=l[d]||Object.create(null);continue}const y=a(E[2]),g=y.length>2&&y.slice(-2)==="[]",b=g?y.slice(0,-2):y;if(b==="__proto__")continue;const B=E[3]?a(E[4]):!0,I=B==="true"||B==="false"||B==="null"?JSON.parse(B):B;g&&(e.call(D,b)?Array.isArray(D[b])||(D[b]=[D[b]]):D[b]=[]),Array.isArray(D[b])?D[b].push(I):D[b]=I}const F=[];for(const m of Object.keys(l)){if(!e.call(l,m)||typeof l[m]!="object"||Array.isArray(l[m]))continue;const E=s(m);D=l;const y=E.pop(),g=y.replace(/\\\./g,".");for(const b of E)b!=="__proto__"&&((!e.call(D,b)||typeof D[b]!="object")&&(D[b]=Object.create(null)),D=D[b]);D===l&&g===y||(D[g]=l[m],F.push(m))}for(const m of F)delete l[m];return l},"decode"),i=o(c=>c.startsWith('"')&&c.endsWith('"')||c.startsWith("'")&&c.endsWith("'"),"isQuoted"),u=o(c=>typeof c!="string"||c.match(/[=\r\n]/)||c.match(/^\[/)||c.length>1&&i(c)||c!==c.trim()?JSON.stringify(c):c.split(";").join("\\;").split("#").join("\\#"),"safe"),a=o((c,l)=>{if(c=(c||"").trim(),i(c)){c.charAt(0)==="'"&&(c=c.slice(1,-1));try{c=JSON.parse(c)}catch{}}else{let D=!1,d="";for(let f=0,h=c.length;f<h;f++){const F=c.charAt(f);if(D)"\\;#".indexOf(F)!==-1?d+=F:d+="\\"+F,D=!1;else{if(";#".indexOf(F)!==-1)break;F==="\\"?D=!0:d+=F}}return D&&(d+="\\"),d.trim()}return c},"unsafe");return Mr={parse:r,decode:r,stringify:n,encode:n,safe:u,unsafe:a},Mr}o(Cf,"requireIni");var Ef=Cf(),ec=Le(Ef);const Lr=o(e=>Q.lstat(e).then(()=>!0,()=>!1),"fileExists"),yf=["","conventional","gitmoji"],{hasOwnProperty:wf}=Object.prototype,tc=o((e,t)=>wf.call(e,t),"hasOwn$1"),de=o((e,t,n)=>{if(!t)throw new G(`Invalid config property ${e}: ${n}`)},"parseAssert"),wn={OPENAI_API_KEY(e){return e},OPENAI_BASE_URL(e){return e},OPENAI_MODEL(e){return e||""},locale(e){return e?(de("locale",!!e,"Cannot be empty"),de("locale",/^[a-z-]+$/i.test(e),"Must be a valid locale (letters and dashes/underscores)."),e):"en"},generate(e){if(!e)return 1;de("generate",/^\d+$/.test(e),"Must be an integer");const t=Number(e);return de("generate",t>0,"Must be greater than 0"),de("generate",t<=5,"Must be less or equal to 5"),t},type(e){return e?(de("type",yf.includes(e),"Invalid commit type"),e):""},proxy(e){if(!(!e||e.length===0))throw new G('The "proxy" config property is deprecated and no longer supported.')},timeout(e){if(!e)return;de("timeout",/^\d+$/.test(e),"Must be an integer");const t=Number(e);return de("timeout",t>=500,"Must be greater than 500ms"),t},"max-length"(e){if(!e)return 72;de("max-length",/^\d+$/.test(e),"Must be an integer");const t=Number(e);return de("max-length",t>=20,"Must be greater than 20 characters"),t}},bf={name:"togetherai",displayName:"Together AI (recommended)",baseUrl:"https://api.together.xyz/v1",apiKeyFormat:"tgp_",modelsFilter:o(e=>e.filter(t=>!t.type||t.type==="chat"||t.type==="language").map(t=>t.id),"modelsFilter"),defaultModel:"meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo",requiresApiKey:!0},_f={name:"openai",displayName:"OpenAI",baseUrl:"https://api.openai.com/v1",apiKeyFormat:"sk-",modelsFilter:o(e=>e.filter(t=>t.id&&(t.id.includes("gpt")||t.id.includes("o1")||t.id.includes("o3")||t.id.includes("o4")||t.id.includes("o5")||!t.type||t.type==="chat")).map(t=>t.id),"modelsFilter"),defaultModel:"gpt-4o",requiresApiKey:!0},Bf={name:"ollama",displayName:"Ollama (local)",baseUrl:"http://localhost:11434/v1",modelsFilter:o(e=>e.filter(t=>t.name).map(t=>t.name),"modelsFilter"),defaultModel:"llama2",requiresApiKey:!1},Af={name:"custom",displayName:"Custom (OpenAI-compatible)",baseUrl:"",modelsFilter:o(e=>e.filter(t=>!t.type||t.type==="chat"||t.type==="language").map(t=>t.id),"modelsFilter"),defaultModel:"",requiresApiKey:!0},Bt=[bf,_f,Bf,Af],vf=o(()=>Bt.find(t=>t.name==="openai")?.baseUrl||"","getDefaultBaseUrl"),$f=o((e,t)=>{if(e){const n=Bt.find(s=>s.baseUrl===e||s.name==="ollama"&&e.startsWith(s.baseUrl.slice(0,-3)));return n?n.name:"custom"}else if(t)return"openai"},"detectProvider"),jr=o(()=>ae.join(ho.homedir(),".aicommits"),"getConfigPath"),nc=o(async()=>{if(!await Lr(jr()))return Object.create(null);const t=await Q.readFile(jr(),"utf8");return ec.parse(t)},"readConfigFile"),Ge=o(async(e,t,n)=>{const s=await nc(),r={},{env:i}=process,u=t??{OPENAI_API_KEY:i.OPENAI_API_KEY||i.OPENAI_KEY,OPENAI_BASE_URL:i.OPENAI_BASE_URL,OPENAI_MODEL:i.OPENAI_MODEL};for(const D of Object.keys(wn)){const d=wn[D],f=e?.[D]??u?.[D]??s[D];if(n)try{r[D]=d(f)}catch{}else r[D]=d(f)}let a,c=r.OPENAI_BASE_URL;const l=r.OPENAI_API_KEY;return!c&&l&&(c=vf(),r.OPENAI_BASE_URL=c),a=$f(c,l),{...r,model:r.OPENAI_MODEL,provider:a}},"getConfig"),At=o(async e=>{const t=await nc();for(const[n,s]of e){if(!tc(wn,n))throw new G(`Invalid config property: ${n}`);if(s==="")delete t[n];else{const r=wn[n](s);t[n]=r}}await Q.writeFile(jr(),ec.stringify(t),"utf8")},"setConfigs");function $(e,t,n,s,r){if(typeof t=="function"?e!==t||!0:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}o($,"__classPrivateFieldSet");function p(e,t,n,s){if(n==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?s:n==="a"?s.call(e):s?s.value:t.get(e)}o(p,"__classPrivateFieldGet");let sc=o(function(){const{crypto:e}=globalThis;if(e?.randomUUID)return sc=e.randomUUID.bind(e),e.randomUUID();const t=new Uint8Array(1),n=e?()=>e.getRandomValues(t)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,s=>(+s^n()&15>>+s/4).toString(16))},"uuid4");function Ur(e){return typeof e=="object"&&e!==null&&("name"in e&&e.name==="AbortError"||"message"in e&&String(e.message).includes("FetchRequestCanceledException"))}o(Ur,"isAbortError");const Wr=o(e=>{if(e instanceof Error)return e;if(typeof e=="object"&&e!==null){try{if(Object.prototype.toString.call(e)==="[object Error]"){const t=new Error(e.message,e.cause?{cause:e.cause}:{});return e.stack&&(t.stack=e.stack),e.cause&&!t.cause&&(t.cause=e.cause),e.name&&(t.name=e.name),t}}catch{}try{return new Error(JSON.stringify(e))}catch{}}return new Error(e)},"castToError"),Pu=class Pu extends Error{};o(Pu,"OpenAIError");let v=Pu;const Zt=class Zt extends v{constructor(t,n,s,r){super(`${Zt.makeMessage(t,n,s)}`),this.status=t,this.headers=r,this.requestID=r?.get("x-request-id"),this.error=n;const i=n;this.code=i?.code,this.param=i?.param,this.type=i?.type}static makeMessage(t,n,s){const r=n?.message?typeof n.message=="string"?n.message:JSON.stringify(n.message):n?JSON.stringify(n):s;return t&&r?`${t} ${r}`:t?`${t} status code (no body)`:r||"(no status code or body)"}static generate(t,n,s,r){if(!t||!r)return new Ke({message:s,cause:Wr(n)});const i=n?.error;return t===400?new bn(t,i,s,r):t===401?new _n(t,i,s,r):t===403?new Bn(t,i,s,r):t===404?new An(t,i,s,r):t===409?new vn(t,i,s,r):t===422?new $n(t,i,s,r):t===429?new xn(t,i,s,r):t>=500?new Sn(t,i,s,r):new Zt(t,i,s,r)}};o(Zt,"APIError");let ee=Zt;const Tu=class Tu extends ee{constructor({message:t}={}){super(void 0,void 0,t||"Request was aborted.",void 0)}};o(Tu,"APIUserAbortError");let ne=Tu;const Nu=class Nu extends ee{constructor({message:t,cause:n}){super(void 0,void 0,t||"Connection error.",void 0),n&&(this.cause=n)}};o(Nu,"APIConnectionError");let Ke=Nu;const Mu=class Mu extends Ke{constructor({message:t}={}){super({message:t??"Request timed out."})}};o(Mu,"APIConnectionTimeoutError");let vt=Mu;const Lu=class Lu extends ee{};o(Lu,"BadRequestError");let bn=Lu;const ju=class ju extends ee{};o(ju,"AuthenticationError");let _n=ju;const Uu=class Uu extends ee{};o(Uu,"PermissionDeniedError");let Bn=Uu;const Wu=class Wu extends ee{};o(Wu,"NotFoundError");let An=Wu;const qu=class qu extends ee{};o(qu,"ConflictError");let vn=qu;const Gu=class Gu extends ee{};o(Gu,"UnprocessableEntityError");let $n=Gu;const Ku=class Ku extends ee{};o(Ku,"RateLimitError");let xn=Ku;const Hu=class Hu extends ee{};o(Hu,"InternalServerError");let Sn=Hu;const zu=class zu extends v{constructor(){super("Could not parse response content as the length limit was reached")}};o(zu,"LengthFinishReasonError");let In=zu;const Vu=class Vu extends v{constructor(){super("Could not parse response content as the request was rejected by the content filter")}};o(Vu,"ContentFilterFinishReasonError");let On=Vu;const Ju=class Ju extends Error{constructor(t){super(t)}};o(Ju,"InvalidWebhookSignatureError");let ve=Ju;const xf=/^[a-z][a-z0-9+.-]*:/i,Sf=o(e=>xf.test(e),"isAbsoluteURL");let se=o(e=>(se=Array.isArray,se(e)),"isArray"),rc=se;function uc(e){return typeof e!="object"?{}:e??{}}o(uc,"maybeObj");function If(e){if(!e)return!0;for(const t in e)return!1;return!0}o(If,"isEmptyObj");function Of(e,t){return Object.prototype.hasOwnProperty.call(e,t)}o(Of,"hasOwn");function qr(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)}o(qr,"isObj");const Rf=o((e,t)=>{if(typeof t!="number"||!Number.isInteger(t))throw new v(`${e} must be an integer`);if(t<0)throw new v(`${e} must be a positive integer`);return t},"validatePositiveInteger"),kf=o(e=>{try{return JSON.parse(e)}catch{return}},"safeJSON"),$t=o(e=>new Promise(t=>setTimeout(t,e)),"sleep$1"),He="6.9.0",Pf=o(()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u","isRunningInBrowser");function Tf(){return typeof Deno<"u"&&Deno.build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]"?"node":"unknown"}o(Tf,"getDetectedPlatform");const Nf=o(()=>{const e=Tf();if(e==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":He,"X-Stainless-OS":oc(Deno.build.os),"X-Stainless-Arch":ic(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":He,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(e==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":He,"X-Stainless-OS":oc(globalThis.process.platform??"unknown"),"X-Stainless-Arch":ic(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};const t=Mf();return t?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":He,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${t.browser}`,"X-Stainless-Runtime-Version":t.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":He,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}},"getPlatformProperties");function Mf(){if(typeof navigator>"u"||!navigator)return null;const e=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(const{key:t,pattern:n}of e){const s=n.exec(navigator.userAgent);if(s){const r=s[1]||0,i=s[2]||0,u=s[3]||0;return{browser:t,version:`${r}.${i}.${u}`}}}return null}o(Mf,"getBrowserInfo");const ic=o(e=>e==="x32"?"x32":e==="x86_64"||e==="x64"?"x64":e==="arm"?"arm":e==="aarch64"||e==="arm64"?"arm64":e?`other:${e}`:"unknown","normalizeArch"),oc=o(e=>(e=e.toLowerCase(),e.includes("ios")?"iOS":e==="android"?"Android":e==="darwin"?"MacOS":e==="win32"?"Windows":e==="freebsd"?"FreeBSD":e==="openbsd"?"OpenBSD":e==="linux"?"Linux":e?`Other:${e}`:"Unknown"),"normalizePlatform");let ac;const Lf=o(()=>ac??(ac=Nf()),"getPlatformHeaders");function jf(){if(typeof fetch<"u")return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}o(jf,"getDefaultFetch");function cc(...e){const t=globalThis.ReadableStream;if(typeof t>"u")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new t(...e)}o(cc,"makeReadableStream");function lc(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator]();return cc({start(){},async pull(n){const{done:s,value:r}=await t.next();s?n.close():n.enqueue(r)},async cancel(){await t.return?.()}})}o(lc,"ReadableStreamFrom");function Dc(e){if(e[Symbol.asyncIterator])return e;const t=e.getReader();return{async next(){try{const n=await t.read();return n?.done&&t.releaseLock(),n}catch(n){throw t.releaseLock(),n}},async return(){const n=t.cancel();return t.releaseLock(),await n,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}o(Dc,"ReadableStreamToAsyncIterable");async function Uf(e){if(e===null||typeof e!="object")return;if(e[Symbol.asyncIterator]){await e[Symbol.asyncIterator]().return?.();return}const t=e.getReader(),n=t.cancel();t.releaseLock(),await n}o(Uf,"CancelReadableStream");const Wf=o(({headers:e,body:t})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(t)}),"FallbackEncoder"),dc="RFC3986",hc=o(e=>String(e),"default_formatter"),fc={RFC1738:o(e=>String(e).replace(/%20/g,"+"),"RFC1738"),RFC3986:hc},qf="RFC1738";let Gr=o((e,t)=>(Gr=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),Gr(e,t)),"has");const he=(()=>{const e=[];for(let t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e})(),Kr=1024,Gf=o((e,t,n,s,r)=>{if(e.length===0)return e;let i=e;if(typeof e=="symbol"?i=Symbol.prototype.toString.call(e):typeof e!="string"&&(i=String(e)),n==="iso-8859-1")return escape(i).replace(/%u[0-9a-f]{4}/gi,function(a){return"%26%23"+parseInt(a.slice(2),16)+"%3B"});let u="";for(let a=0;a<i.length;a+=Kr){const c=i.length>=Kr?i.slice(a,a+Kr):i,l=[];for(let D=0;D<c.length;++D){let d=c.charCodeAt(D);if(d===45||d===46||d===95||d===126||d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||r===qf&&(d===40||d===41)){l[l.length]=c.charAt(D);continue}if(d<128){l[l.length]=he[d];continue}if(d<2048){l[l.length]=he[192|d>>6]+he[128|d&63];continue}if(d<55296||d>=57344){l[l.length]=he[224|d>>12]+he[128|d>>6&63]+he[128|d&63];continue}D+=1,d=65536+((d&1023)<<10|c.charCodeAt(D)&1023),l[l.length]=he[240|d>>18]+he[128|d>>12&63]+he[128|d>>6&63]+he[128|d&63]}u+=l.join("")}return u},"encode");function Kf(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))}o(Kf,"is_buffer");function pc(e,t){if(se(e)){const n=[];for(let s=0;s<e.length;s+=1)n.push(t(e[s]));return n}return t(e)}o(pc,"maybe_map");const mc={brackets(e){return String(e)+"[]"},comma:"comma",indices(e,t){return String(e)+"["+t+"]"},repeat(e){return String(e)}},Fc=o(function(e,t){Array.prototype.push.apply(e,se(t)?t:[t])},"push_to_array");let gc;const K={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:Gf,encodeValuesOnly:!1,format:dc,formatter:hc,indices:!1,serializeDate(e){return(gc??(gc=Function.prototype.call.bind(Date.prototype.toISOString)))(e)},skipNulls:!1,strictNullHandling:!1};function Hf(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"}o(Hf,"is_non_nullish_primitive");const Hr={};function Cc(e,t,n,s,r,i,u,a,c,l,D,d,f,h,F,m,E,y){let g=e,b=y,B=0,I=!1;for(;(b=b.get(Hr))!==void 0&&!I;){const U=b.get(e);if(B+=1,typeof U<"u"){if(U===B)throw new RangeError("Cyclic object value");I=!0}typeof b.get(Hr)>"u"&&(B=0)}if(typeof l=="function"?g=l(t,g):g instanceof Date?g=f?.(g):n==="comma"&&se(g)&&(g=pc(g,function(U){return U instanceof Date?f?.(U):U})),g===null){if(i)return c&&!m?c(t,K.encoder,E,"key",h):t;g=""}if(Hf(g)||Kf(g)){if(c){const U=m?t:c(t,K.encoder,E,"key",h);return[F?.(U)+"="+F?.(c(g,K.encoder,E,"value",h))]}return[F?.(t)+"="+F?.(String(g))]}const O=[];if(typeof g>"u")return O;let R;if(n==="comma"&&se(g))m&&c&&(g=pc(g,c)),R=[{value:g.length>0?g.join(",")||null:void 0}];else if(se(l))R=l;else{const U=Object.keys(g);R=D?U.sort(D):U}const L=a?String(t).replace(/\./g,"%2E"):String(t),z=s&&se(g)&&g.length===1?L+"[]":L;if(r&&se(g)&&g.length===0)return z+"[]";for(let U=0;U<R.length;++U){const W=R[U],ro=typeof W=="object"&&typeof W.value<"u"?W.value:g[W];if(u&&ro===null)continue;const js=d&&a?W.replace(/\./g,"%2E"):W,kl=se(g)?typeof n=="function"?n(z,js):z:z+(d?"."+js:"["+js+"]");y.set(e,B);const uo=new WeakMap;uo.set(Hr,y),Fc(O,Cc(ro,kl,n,s,r,i,u,a,n==="comma"&&m&&se(g)?null:c,l,D,d,f,h,F,m,E,uo))}return O}o(Cc,"inner_stringify");function zf(e=K){if(typeof e.allowEmptyArrays<"u"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.encodeDotInKeys<"u"&&typeof e.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(e.encoder!==null&&typeof e.encoder<"u"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");const t=e.charset||K.charset;if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let n=dc;if(typeof e.format<"u"){if(!Gr(fc,e.format))throw new TypeError("Unknown format option provided.");n=e.format}const s=fc[n];let r=K.filter;(typeof e.filter=="function"||se(e.filter))&&(r=e.filter);let i;if(e.arrayFormat&&e.arrayFormat in mc?i=e.arrayFormat:"indices"in e?i=e.indices?"indices":"repeat":i=K.arrayFormat,"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");const u=typeof e.allowDots>"u"?e.encodeDotInKeys?!0:K.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:K.addQueryPrefix,allowDots:u,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:K.allowEmptyArrays,arrayFormat:i,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:K.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:typeof e.delimiter>"u"?K.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:K.encode,encodeDotInKeys:typeof e.encodeDotInKeys=="boolean"?e.encodeDotInKeys:K.encodeDotInKeys,encoder:typeof e.encoder=="function"?e.encoder:K.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:K.encodeValuesOnly,filter:r,format:n,formatter:s,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:K.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:K.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:K.strictNullHandling}}o(zf,"normalize_stringify_options");function Vf(e,t={}){let n=e;const s=zf(t);let r,i;typeof s.filter=="function"?(i=s.filter,n=i("",n)):se(s.filter)&&(i=s.filter,r=i);const u=[];if(typeof n!="object"||n===null)return"";const a=mc[s.arrayFormat],c=a==="comma"&&s.commaRoundTrip;r||(r=Object.keys(n)),s.sort&&r.sort(s.sort);const l=new WeakMap;for(let f=0;f<r.length;++f){const h=r[f];s.skipNulls&&n[h]===null||Fc(u,Cc(n[h],h,a,c,s.allowEmptyArrays,s.strictNullHandling,s.skipNulls,s.encodeDotInKeys,s.encode?s.encoder:null,s.filter,s.sort,s.allowDots,s.serializeDate,s.format,s.formatter,s.encodeValuesOnly,s.charset,l))}const D=u.join(s.delimiter);let d=s.addQueryPrefix===!0?"?":"";return s.charsetSentinel&&(s.charset==="iso-8859-1"?d+="utf8=%26%2310003%3B&":d+="utf8=%E2%9C%93&"),D.length>0?d+D:""}o(Vf,"stringify");function Jf(e){let t=0;for(const r of e)t+=r.length;const n=new Uint8Array(t);let s=0;for(const r of e)n.set(r,s),s+=r.length;return n}o(Jf,"concatBytes");let Ec;function zr(e){let t;return(Ec??(t=new globalThis.TextEncoder,Ec=t.encode.bind(t)))(e)}o(zr,"encodeUTF8");let yc;function wc(e){let t;return(yc??(t=new globalThis.TextDecoder,yc=t.decode.bind(t)))(e)}o(wc,"decodeUTF8");var ue,ie;const Xu=class Xu{constructor(){ue.set(this,void 0),ie.set(this,void 0),$(this,ue,new Uint8Array),$(this,ie,null)}decode(t){if(t==null)return[];const n=t instanceof ArrayBuffer?new Uint8Array(t):typeof t=="string"?zr(t):t;$(this,ue,Jf([p(this,ue,"f"),n]));const s=[];let r;for(;(r=Xf(p(this,ue,"f"),p(this,ie,"f")))!=null;){if(r.carriage&&p(this,ie,"f")==null){$(this,ie,r.index);continue}if(p(this,ie,"f")!=null&&(r.index!==p(this,ie,"f")+1||r.carriage)){s.push(wc(p(this,ue,"f").subarray(0,p(this,ie,"f")-1))),$(this,ue,p(this,ue,"f").subarray(p(this,ie,"f"))),$(this,ie,null);continue}const i=p(this,ie,"f")!==null?r.preceding-1:r.preceding,u=wc(p(this,ue,"f").subarray(0,i));s.push(u),$(this,ue,p(this,ue,"f").subarray(r.index)),$(this,ie,null)}return s}flush(){return p(this,ue,"f").length?this.decode(`
86
86
  `):[]}};o(Xu,"LineDecoder");let ze=Xu;ue=new WeakMap,ie=new WeakMap,ze.NEWLINE_CHARS=new Set([`
87
87
  `,"\r"]),ze.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function Xf(e,t){for(let r=t??0;r<e.length;r++){if(e[r]===10)return{preceding:r,index:r+1,carriage:!1};if(e[r]===13)return{preceding:r,index:r+1,carriage:!0}}return null}o(Xf,"findNewlineIndex");function Yf(e){for(let s=0;s<e.length-1;s++){if(e[s]===10&&e[s+1]===10||e[s]===13&&e[s+1]===13)return s+2;if(e[s]===13&&e[s+1]===10&&s+3<e.length&&e[s+2]===13&&e[s+3]===10)return s+4}return-1}o(Yf,"findDoubleNewlineIndex");const Rn={off:0,error:200,warn:300,info:400,debug:500},bc=o((e,t,n)=>{if(e){if(Of(Rn,e))return e;X(n).warn(`${t} was set to ${JSON.stringify(e)}, expected one of ${JSON.stringify(Object.keys(Rn))}`)}},"parseLogLevel");function xt(){}o(xt,"noop");function kn(e,t,n){return!t||Rn[e]>Rn[n]?xt:t[e].bind(t)}o(kn,"makeLogFn");const Qf={error:xt,warn:xt,info:xt,debug:xt};let _c=new WeakMap;function X(e){const t=e.logger,n=e.logLevel??"off";if(!t)return Qf;const s=_c.get(t);if(s&&s[0]===n)return s[1];const r={error:kn("error",t,n),warn:kn("warn",t,n),info:kn("info",t,n),debug:kn("debug",t,n)};return _c.set(t,[n,r]),r}o(X,"loggerFor");const $e=o(e=>(e.options&&(e.options={...e.options},delete e.options.headers),e.headers&&(e.headers=Object.fromEntries((e.headers instanceof Headers?[...e.headers]:Object.entries(e.headers)).map(([t,n])=>[t,t.toLowerCase()==="authorization"||t.toLowerCase()==="cookie"||t.toLowerCase()==="set-cookie"?"***":n]))),"retryOfRequestLogID"in e&&(e.retryOfRequestLogID&&(e.retryOf=e.retryOfRequestLogID),delete e.retryOfRequestLogID),e),"formatRequestDetails");var St;const Ne=class Ne{constructor(t,n,s){this.iterator=t,St.set(this,void 0),this.controller=n,$(this,St,s)}static fromSSEResponse(t,n,s){let r=!1;const i=s?X(s):console;async function*u(){if(r)throw new v("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");r=!0;let a=!1;try{for await(const c of Zf(t,n))if(!a){if(c.data.startsWith("[DONE]")){a=!0;continue}if(c.event===null||!c.event.startsWith("thread.")){let l;try{l=JSON.parse(c.data)}catch(D){throw i.error("Could not parse message into JSON:",c.data),i.error("From chunk:",c.raw),D}if(l&&l.error)throw new ee(void 0,l.error,void 0,t.headers);yield l}else{let l;try{l=JSON.parse(c.data)}catch(D){throw console.error("Could not parse message into JSON:",c.data),console.error("From chunk:",c.raw),D}if(c.event=="error")throw new ee(void 0,l.error,l.message,void 0);yield{event:c.event,data:l}}}a=!0}catch(c){if(Ur(c))return;throw c}finally{a||n.abort()}}return o(u,"iterator"),new Ne(u,n,s)}static fromReadableStream(t,n,s){let r=!1;async function*i(){const a=new ze,c=Dc(t);for await(const l of c)for(const D of a.decode(l))yield D;for(const l of a.flush())yield l}o(i,"iterLines");async function*u(){if(r)throw new v("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");r=!0;let a=!1;try{for await(const c of i())a||c&&(yield JSON.parse(c));a=!0}catch(c){if(Ur(c))return;throw c}finally{a||n.abort()}}return o(u,"iterator"),new Ne(u,n,s)}[(St=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){const t=[],n=[],s=this.iterator(),r=o(i=>({next:o(()=>{if(i.length===0){const u=s.next();t.push(u),n.push(u)}return i.shift()},"next")}),"teeIterator");return[new Ne(()=>r(t),this.controller,p(this,St,"f")),new Ne(()=>r(n),this.controller,p(this,St,"f"))]}toReadableStream(){const t=this;let n;return cc({async start(){n=t[Symbol.asyncIterator]()},async pull(s){try{const{value:r,done:i}=await n.next();if(i)return s.close();const u=zr(JSON.stringify(r)+`
88
88
  `);s.enqueue(u)}catch(r){s.error(r)}},async cancel(){await n.return?.()}})}};o(Ne,"Stream");let xe=Ne;async function*Zf(e,t){if(!e.body)throw t.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new v("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new v("Attempted to iterate over a response with no body");const n=new Vr,s=new ze,r=Dc(e.body);for await(const i of ep(r))for(const u of s.decode(i)){const a=n.decode(u);a&&(yield a)}for(const i of s.flush()){const u=n.decode(i);u&&(yield u)}}o(Zf,"_iterSSEMessages");async function*ep(e){let t=new Uint8Array;for await(const n of e){if(n==null)continue;const s=n instanceof ArrayBuffer?new Uint8Array(n):typeof n=="string"?zr(n):n;let r=new Uint8Array(t.length+s.length);r.set(t),r.set(s,t.length),t=r;let i;for(;(i=Yf(t))!==-1;)yield t.slice(0,i),t=t.slice(i)}t.length>0&&(yield t)}o(ep,"iterSSEChunks");const Yu=class Yu{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(t){if(t.endsWith("\r")&&(t=t.substring(0,t.length-1)),!t){if(!this.event&&!this.data.length)return null;const i={event:this.event,data:this.data.join(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aicommits",
3
- "version": "1.12.0-develop.3",
3
+ "version": "1.12.0-develop.4",
4
4
  "description": "Writes your git commit messages for you with AI",
5
5
  "keywords": [
6
6
  "ai",