ts-pantry 0.11.37 → 0.11.38
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.
- package/dist/bin/cli.js +3 -3
- package/dist/chunk-3981va6j.js +2 -0
- package/dist/{chunk-63t6cwcs.js → chunk-dg3m62qj.js} +2 -2
- package/dist/{chunk-7dz33118.js → chunk-g0fyaqj2.js} +1 -1
- package/dist/{chunk-b9105y5x.js → chunk-r2x07fgr.js} +1 -1
- package/dist/{chunk-9maq76y2.js → chunk-rq61h9w2.js} +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/packages/anthropic.com/claude-code.d.ts +1 -1
- package/dist/src/packages/apps/zeddev.d.ts +1 -1
- package/dist/src/packages/arkadedev.d.ts +1 -1
- package/dist/src/packages/circlecicom.d.ts +1 -1
- package/dist/src/packages/cnqueryio.d.ts +1 -1
- package/dist/src/packages/flyio.d.ts +1 -1
- package/dist/src/packages/github.com/chainguard-dev/apko.d.ts +1 -1
- package/dist/src/packages/github.com/router-for-me/CLIProxyAPI.d.ts +1 -1
- package/dist/src/packages/moonrepo.dev/moon.d.ts +1 -1
- package/dist/src/packages/nginxorg.d.ts +1 -1
- package/dist/src/packages/planetscalecom.d.ts +1 -1
- package/dist/src/packages/pulumiio.d.ts +1 -1
- package/dist/src/packages/stripecom.d.ts +1 -1
- package/package.json +1 -1
- package/dist/chunk-ve2dx3d9.js +0 -2
package/dist/bin/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{E as y6,L as k6,M as G6,O as j6,Qa as l6,Ra as n6,S as K6,Ta as p6,Wa as r6,Ya as a6,bb as s6,cb as t6,db as o6,ga as h6,ha as _6,ia as g6,ja as f6,ka as m6,oa as H6,pa as c6,qa as i6}from"../chunk-
|
|
2
|
+
import{E as y6,L as k6,M as G6,O as j6,Qa as l6,Ra as n6,S as K6,Ta as p6,Wa as r6,Ya as a6,bb as s6,cb as t6,db as o6,ga as h6,ha as _6,ia as g6,ja as f6,ka as m6,oa as H6,pa as c6,qa as i6}from"../chunk-dg3m62qj.js";import"../chunk-1d97zpdr.js";import"../chunk-4pgde91f.js";import"../chunk-fndnz9td.js";import{Ib as p,Jb as d6,Lb as X6,Mb as r,Rb as u6,Vb as U6}from"../chunk-4dmq776q.js";import"../chunk-gqzj0edb.js";import"../chunk-hh0g2d6f.js";import{lc as n,mc as q6,nc as J6}from"../chunk-cye3q2ph.js";import"../chunk-r2x07fgr.js";import"../chunk-3981va6j.js";import{Jc as v6,Kc as J4}from"../chunk-gzwcsenc.js";import{Oc as h}from"../chunk-6zb03z2q.js";import H from"node:fs";import w from"node:path";import j from"node:process";import{existsSync as $z}from"node:fs";import a from"node:fs/promises";import F6 from"node:os";import s from"node:path";import k from"node:process";import{EventEmitter as Qz}from"node:events";import v from"node:process";import L6 from"node:process";import z6 from"node:process";import u from"node:process";import f from"node:process";import O6 from"node:tty";import cz,{stdin as P4,stdout as C4}from"node:process";import N6,{stdin as nz,stdout as pz}from"node:process";import rz from"node:readline";class D6{configPath;config=null;events=[];retryCount=0;maxRetries=3;retryDelayMs=1000;constructor(){let z=F6.homedir(),$=s.join(z,".config","clapp");this.configPath=s.join($,"telemetry.json")}async isEnabled(){if(k.env.DO_NOT_TRACK==="1"||k.env.DO_NOT_TRACK==="true")return!1;if(k.env.NO_TELEMETRY==="1"||k.env.NO_TELEMETRY==="true")return!1;return(await this.loadConfig()).enabled}async enable(){let z=await this.loadConfig();if(z.enabled=!0,!z.userId)z.userId=this.generateUserId();await this.saveConfig(z)}async disable(){let z=await this.loadConfig();z.enabled=!1,await this.saveConfig(z)}async track(z,$){if(!await this.isEnabled())return;let Z={event:z,...$,timestamp:Date.now(),platform:F6.platform(),nodeVersion:k.version};if(this.events.push(Z),this.events.length>=10)await this.send()}async trackCommand(z,$){await this.track("command",{command:z,duration:$})}async trackError(z,$){await this.track("error",{error:z,command:$})}async send(){if(!await this.isEnabled()||this.events.length===0)return!0;try{this.events=[],this.retryCount=0;let $=await this.loadConfig();return $.lastSent=Date.now(),await this.saveConfig($),!0}catch{if(this.retryCount<this.maxRetries){this.retryCount++;let $=this.retryDelayMs*2**(this.retryCount-1);return await this.sleep($),this.send()}return this.events=[],this.retryCount=0,!1}}async flush(){if(this.events.length===0)return!0;return this.send()}sleep(z){return new Promise(($)=>setTimeout($,z))}async status(){let z=await this.loadConfig();return{enabled:z.enabled,doNotTrack:k.env.DO_NOT_TRACK==="1"||k.env.DO_NOT_TRACK==="true",eventsQueued:this.events.length,lastSent:z.lastSent}}async loadConfig(){if(this.config)return this.config;try{if($z(this.configPath)){let z=await a.readFile(this.configPath,"utf-8");return this.config=JSON.parse(z),this.config}}catch{}return this.config={enabled:!1},this.config}async saveConfig(z){this.config=z;try{let $=s.dirname(this.configPath);await a.mkdir($,{recursive:!0}),await a.writeFile(this.configPath,JSON.stringify(z,null,2),"utf-8")}catch{}}generateUserId(){let z=Math.random().toString(36).substring(2,15),$=Date.now().toString(36);return`${z}-${$}`}}var M4=new D6;function Zz(z,$={}){let Q={_:[]},Z=$.alias||{},Y=new Set($.boolean||[]),q={};for(let U of Object.keys(Z))for(let J of Z[U])q[J]=U;for(let U of Y)if(Z[U])for(let J of Z[U])Y.add(J);function X(U,J){let G=q[U]||U;if(Q[G]=J,Z[G])for(let V of Z[G])Q[V]=J;if(q[U]&&Z[q[U]])for(let V of Z[q[U]])Q[V]=J;Q[U]=J}for(let U=0;U<z.length;U++){let J=z[U];if(J==="--"){Q._.push(...z.slice(U+1));break}if(J.startsWith("--")){let G=J.indexOf("=");if(G!==-1){let V=J.slice(2,G),W=J.slice(G+1);X(V,W)}else{let V=J.slice(2);if(V.startsWith("no-")){let K=V.slice(3);X(K,!1);continue}let W=q[V]||V;if(Y.has(W)||Y.has(V))X(V,!0);else{let K=z[U+1];if(K!==void 0&&!K.startsWith("-"))X(V,K),U++;else X(V,!0)}}}else if(J.startsWith("-")&&J.length>1){let G=J.slice(1);for(let V=0;V<G.length;V++){let W=G[V],K=q[W]||W;if(V===G.length-1&&!Y.has(K)&&!Y.has(W)){let F=z[U+1];if(F!==void 0&&!F.startsWith("-"))X(W,F),U++;else X(W,!0)}else X(W,!0)}}else Q._.push(J)}return Q}function e(z){return z.replace(/[<[].+/,"").trim()}function Yz(z){let $=/<([^>]+)>/g,Q=/\[([^\]]+)\]/g,Z=[],Y=(U)=>{let J=!1,G=U[1];if(G.startsWith("..."))G=G.slice(3),J=!0;return{required:U[0].startsWith("<"),value:G,variadic:J}},q;while(q=$.exec(z))Z.push(Y(q));let X;while(X=Q.exec(z))Z.push(Y(X));return Z}function qz(z){let $={alias:{},boolean:[]};for(let[Q,Z]of z.entries()){if(Z.names.length>1)$.alias[Z.names[0]]=Z.names.slice(1);if(Z.isBoolean)if(Z.negated){if(!z.some((q,X)=>{return X!==Q&&q.names.some((U)=>Z.names.includes(U))&&typeof q.required==="boolean"}))$.boolean.push(Z.names[0])}else $.boolean.push(Z.names[0])}return $}function w6(z){return z.reduce(($,Q)=>$.length>=Q.length?$:Q,"")}function t(z,$){return z.length>=$?z:`${z}${" ".repeat($-z.length)}`}function Jz(z){return z.replace(/([a-z])-([a-z])/g,($,Q,Z)=>{return Q+Z.toUpperCase()})}function Xz(z,$,Q){let Z=0,Y=$.length,q=z,X;for(;Z<Y;++Z)X=q[$[Z]],q=q[$[Z]]=Z===Y-1?Q:X!=null?X:!!~$[Z+1].indexOf(".")||!(+$[Z+1]>-1)?{}:[]}function Uz(z,$){for(let Q of Object.keys($)){let Z=$[Q];if(Z.shouldTransform){if(z[Q]=Array.prototype.concat.call([],z[Q]),typeof Z.transformFunction==="function")z[Q]=z[Q].map(Z.transformFunction)}}}function Gz(z){let $=/([^\\/]+)$/.exec(z);return $?$[1]:""}function T6(z){return z.split(".").map(($,Q)=>{return Q===0?Jz($):$}).join(".")}class d extends Error{exitCode=2;isUsageError=!0;constructor(z){super(z);if(this.name=this.constructor.name,typeof Error.captureStackTrace==="function")Error.captureStackTrace(this,this.constructor);else this.stack=Error(z).stack}format(z=!1){if(z&&this.stack)return`${this.message}
|
|
3
3
|
|
|
4
4
|
Stack trace:
|
|
5
5
|
${this.stack}`;return this.message}}function jz(){let{env:z}=L6,{TERM:$,TERM_PROGRAM:Q}=z;if(L6.platform!=="win32")return $!=="linux";return Boolean(z.WT_SESSION)||Boolean(z.TERMINUS_SUBLIME)||z.ConEmuTask==="{cmd::Cmder}"||Q==="Terminus-Sublime"||Q==="vscode"||$==="xterm-256color"||$==="alacritty"||$==="rxvt-unicode"||$==="rxvt-unicode-256color"||z.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var l="\x1B",I=`${l}[`;var S={to(z,$){if(!$)return`${I}${z+1}G`;return`${I}${$+1};${z+1}H`},move(z,$){let Q="";if(z<0)Q+=`${I}${-z}D`;else if(z>0)Q+=`${I}${z}C`;if($<0)Q+=`${I}${-$}A`;else if($>0)Q+=`${I}${$}B`;return Q},up:(z=1)=>`${I}${z}A`,down:(z=1)=>`${I}${z}B`,forward:(z=1)=>`${I}${z}C`,backward:(z=1)=>`${I}${z}D`,nextLine:(z=1)=>`${I}E`.repeat(z),prevLine:(z=1)=>`${I}F`.repeat(z),left:`${I}G`,hide:`${I}?25l`,show:`${I}?25h`,save:`${l}7`,restore:`${l}8`};var o={screen:`${I}2J`,up:(z=1)=>`${I}1J`.repeat(z),down:(z=1)=>`${I}J`.repeat(z),line:`${I}2K`,lineEnd:`${I}K`,lineStart:`${I}1K`,lines(z){let $="";for(let Q=0;Q<z;Q++)$+=this.line+(Q<z-1?S.up():"");if(z)$+=S.left;return $}},b4={screen:`${l}c`};function Kz(z,$){let Q=[];for(let Z=0;Z<=$.length;Z++)Q[Z]=[Z];for(let Z=0;Z<=z.length;Z++)Q[0][Z]=Z;for(let Z=1;Z<=$.length;Z++)for(let Y=1;Y<=z.length;Y++)if($.charAt(Z-1)===z.charAt(Y-1))Q[Z][Y]=Q[Z-1][Y-1];else Q[Z][Y]=Math.min(Q[Z-1][Y-1]+1,Q[Z][Y-1]+1,Q[Z-1][Y]+1);return Q[$.length][z.length]}function E6(z,$,Q=2,Z=3){return $.map((Y)=>({cmd:Y,distance:Kz(z,Y)})).filter(({distance:Y})=>Y<=Q).sort((Y,q)=>Y.distance-q.distance).slice(0,Z).map(({cmd:Y})=>Y)}class x6{rawName;description;name;names;isBoolean;required;config;negated;constructor(z,$,Q){if(this.rawName=z,this.description=$,this.config=Object.assign({},Q),z=z.replace(/\.\*/g,""),this.negated=!1,this.names=e(z).split(",").map((Z)=>{let Y=Z.trim().replace(/^-{1,2}/,"");if(Y.startsWith("no-"))this.negated=!0,Y=Y.replace(/^no-/,"");return T6(Y)}).sort((Z,Y)=>Z.length>Y.length?1:-1),this.name=this.names[this.names.length-1],this.negated&&this.config.default==null)this.config.default=!0;if(z.includes("<"))this.required=!0;else if(z.includes("["))this.required=!1;else this.isBoolean=!0}}var T4=z6.argv,Hz=`${z6.platform}-${z6.arch} bun-v${typeof Bun<"u"?Bun.version:"unknown"}`,M6=u.argv,Vz=`${u.platform}-${u.arch} node-${u.version}`;class $6{rawName;description;config;cli;options;aliasNames;name;namespace;args;commandAction;usageText;versionNumber;examples;helpCallback;globalCommand;beforeHooks;afterHooks;middleware;constructor(z,$,Q,Z){this.rawName=z,this.description=$,this.config=Q,this.cli=Z,this.options=[],this.aliasNames=[],this.name=e(z);let Y=e(z),q=Y.indexOf(":");if(q>0)this.namespace=Y.substring(0,q),this.name=Y.substring(q+1);if(this.args=Yz(z),this.examples=[],this.beforeHooks=[],this.afterHooks=[],this.middleware=[],!Q)this.config={}}usage(z){return this.usageText=z,this}allowUnknownOptions(){return this.config.allowUnknownOptions=!0,this}ignoreOptionDefaultValue(){return this.config.ignoreOptionDefaultValue=!0,this}version(z,$="-v, --version"){return this.versionNumber=z,this.option($,"Display version number"),this}example(z){return this.examples.push(z),this}option(z,$,Q){let Z=new x6(z,$,Q);return this.options.push(Z),this}alias(z){return this.aliasNames.push(z),this}action(z){return this.commandAction=z,this}before(z){return this.beforeHooks.push(z),this}after(z){return this.afterHooks.push(z),this}use(z){return this.middleware.push(z),this}isMatched(z){if(this.aliasNames.includes(z))return!0;if(this.namespace)return`${this.namespace}:${this.name}`===z;return this.name===z}get isDefaultCommand(){return this.name===""||this.aliasNames.includes("!")}get isGlobalCommand(){return this instanceof Q6}get displayName(){return this.namespace?`${this.namespace}:${this.name}`:this.name}hasOption(z){return z=z.split(".")[0],!!this.options.find(($)=>{return $.names.includes(z)})}outputHelp(){let{name:z,commands:$}=this.cli,{versionNumber:Q,options:Z,helpCallback:Y}=this.cli.globalCommand,q=[{body:`${z}${Q?`/${Q}`:""}`}];if(q.push({title:"Usage",body:` $ ${z} ${this.usageText||this.rawName}`}),(this.isGlobalCommand||this.isDefaultCommand)&&$.length>0){let J=w6($.map((F)=>F.rawName)),G=new Map,V=[];for(let F of $)if(F.namespace){if(!G.has(F.namespace))G.set(F.namespace,[]);G.get(F.namespace).push(F)}else V.push(F);let W="";if(V.length>0)W+=V.map((F)=>{return` ${t(F.rawName,J.length)} ${F.description}`}).join(`
|
|
@@ -37,7 +37,7 @@ Run \`${this.name??"cli"} --help\` for usage.`;v.stderr.write(`${q}${Y}${X}
|
|
|
37
37
|
`).length-1;this.output.write(S.move(-999,z*-1))}render(){let z=b6(this._render(this)??"",N6.stdout.columns,{hard:!0,trim:!1});if(z===this._prevFrame)return;if(this.state==="initial")this.output.write(S.hide);else{let $=lz(this._prevFrame,z);if(this.restoreCursor(),$&&$?.length===1){let Q=$[0];this.output.write(S.move(0,Q)),this.output.write(o.lines(1));let Z=z.split(`
|
|
38
38
|
`);this.output.write(Z[Q]),this._prevFrame=z,this.output.write(S.move(0,Z.length-Q-1));return}if($&&$?.length>1){let Q=$[0];this.output.write(S.move(0,Q)),this.output.write(o.down());let Y=z.split(`
|
|
39
39
|
`).slice(Q);this.output.write(Y.join(`
|
|
40
|
-
`)),this._prevFrame=z;return}this.output.write(o.down())}if(this.output.write(z),this.state==="initial")this.state="active";this._prevFrame=z}}function tz(z,$){if(z===void 0)return 0;if($.length===0)return 0;let Z=$.findIndex((Y)=>Y.value===z);return Z!==-1?Z:0}function oz(z,$){return($.label??String($.value)).toLowerCase().includes(z.toLowerCase())}function ez(z,$){if(!$)return;if(z)return $;return $[0]}class z4 extends Y6{filteredOptions;multiple;isNavigating=!1;selectedValues=[];focusedValue;#z=0;#Q="";#Z;#$;get cursor(){return this.#z}get userInputWithCursor(){if(!this.userInput)return c.inverse(c.hidden("_"));if(this._cursor>=this.userInput.length)return`${this.userInput}█`;let z=this.userInput.slice(0,this._cursor),[$,...Q]=this.userInput.slice(this._cursor);return`${z}${c.inverse($)}${Q.join("")}`}get options(){if(typeof this.#$==="function")return this.#$();return this.#$}constructor(z){super(z);this.#$=z.options;let $=this.options;this.filteredOptions=[...$],this.multiple=z.multiple===!0,this.#Z=z.filter??oz;let Q;if(z.initialValue&&Array.isArray(z.initialValue))if(this.multiple)Q=z.initialValue;else Q=z.initialValue.slice(0,1);else if(!this.multiple&&this.options.length>0)Q=[this.options[0].value];if(Q)for(let Z of Q){let Y=$.findIndex((q)=>q.value===Z);if(Y!==-1)this.toggleSelected(Z),this.#z=Y}this.focusedValue=this.options[this.#z]?.value,this.on("key",(Z,Y)=>this.#Y(Z,Y)),this.on("userInput",(Z)=>this.#q(Z))}_isActionKey(z,$){return z==="\t"||this.multiple&&this.isNavigating&&$.name==="space"&&z!==void 0&&z!==""}#Y(z,$){let Q=$.name==="up",Z=$.name==="down",Y=$.name==="return";if(Q||Z){if(this.#z=Math.max(0,Math.min(this.#z+(Q?-1:1),this.filteredOptions.length-1)),this.focusedValue=this.filteredOptions[this.#z]?.value,!this.multiple)this.selectedValues=[this.focusedValue];this.isNavigating=!0}else if(Y)this.value=ez(this.multiple,this.selectedValues);else if(this.multiple)if(this.focusedValue!==void 0&&($.name==="tab"||this.isNavigating&&$.name==="space"))this.toggleSelected(this.focusedValue);else this.isNavigating=!1;else{if(this.focusedValue)this.selectedValues=[this.focusedValue];this.isNavigating=!1}}deselectAll(){this.selectedValues=[]}toggleSelected(z){if(this.filteredOptions.length===0)return;if(this.multiple)if(this.selectedValues.includes(z))this.selectedValues=this.selectedValues.filter(($)=>$!==z);else this.selectedValues=[...this.selectedValues,z];else this.selectedValues=[z]}#q(z){if(z!==this.#Q){this.#Q=z;let $=this.options;if(z)this.filteredOptions=$.filter((Q)=>this.#Z(z,Q));else this.filteredOptions=[...$];if(this.#z=tz(this.focusedValue,this.filteredOptions),this.focusedValue=this.filteredOptions[this.#z]?.value,!this.multiple)if(this.focusedValue!==void 0)this.toggleSelected(this.focusedValue);else this.deselectAll()}}}class $4 extends Y6{options;cursor=0;#z;getGroupItems(z){return this.options.filter(($)=>$.group===z)}isGroupSelected(z){let $=this.getGroupItems(z),Q=this.value;if(Q===void 0)return!1;return $.every((Z)=>Q.includes(Z.value))}toggleValue(){let z=this.options[this.cursor];if(this.value===void 0)this.value=[];if(z.group===!0){let $=String(z.value),Q=this.getGroupItems($);if(this.isGroupSelected($))this.value=this.value.filter((Z)=>Q.findIndex((Y)=>Y.value===Z)===-1);else this.value=[...this.value,...Q.map((Z)=>Z.value)];this.value=Array.from(new Set(this.value))}else{let $=this.value.includes(z.value);this.value=$?this.value.filter((Q)=>Q!==z.value):[...this.value,z.value]}}constructor(z){super(z,!1);let{options:$}=z;this.#z=z.selectableGroups!==!1,this.options=Object.entries($).flatMap(([Q,Z])=>[{value:Q,group:!0,label:Q},...Z.map((Y)=>({...Y,group:Q}))]),this.value=[...z.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:Q})=>Q===z.cursorAt),this.#z?0:1),this.on("cursor",(Q)=>{switch(Q){case"left":case"up":{this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;let Z=this.options[this.cursor]?.group===!0;if(!this.#z&&Z)this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break}case"down":case"right":{this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;let Z=this.options[this.cursor]?.group===!0;if(!this.#z&&Z)this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}case"space":this.toggleValue();break}})}}var Q4=jz();var b=(z,$)=>Q4?z:$,k4=b("◆","*"),h4=b("■","x"),_4=b("▲","x"),g4=b("◇","o"),f4=b("┌","T"),Z4=b("│","|"),m4=b("└","—"),d4=b("●",">"),u4=b("○"," "),c4=b("◻","[•]"),i4=b("◼","[+]"),l4=b("◻","[ ]"),n4=b("▪","•"),p4=b("─","-"),r4=b("╮","+"),a4=b("├","+"),s4=b("╯","+"),t4=b("●","•"),o4=b("◆","*"),e4=b("▲","!"),z0=b("■","x");var $0={light:b("─","-"),heavy:b("━","="),block:b("█","#")};function Y4(){return`${c.gray(Z4)} `}var Q0=Y4();var P6="0.11.
|
|
40
|
+
`)),this._prevFrame=z;return}this.output.write(o.down())}if(this.output.write(z),this.state==="initial")this.state="active";this._prevFrame=z}}function tz(z,$){if(z===void 0)return 0;if($.length===0)return 0;let Z=$.findIndex((Y)=>Y.value===z);return Z!==-1?Z:0}function oz(z,$){return($.label??String($.value)).toLowerCase().includes(z.toLowerCase())}function ez(z,$){if(!$)return;if(z)return $;return $[0]}class z4 extends Y6{filteredOptions;multiple;isNavigating=!1;selectedValues=[];focusedValue;#z=0;#Q="";#Z;#$;get cursor(){return this.#z}get userInputWithCursor(){if(!this.userInput)return c.inverse(c.hidden("_"));if(this._cursor>=this.userInput.length)return`${this.userInput}█`;let z=this.userInput.slice(0,this._cursor),[$,...Q]=this.userInput.slice(this._cursor);return`${z}${c.inverse($)}${Q.join("")}`}get options(){if(typeof this.#$==="function")return this.#$();return this.#$}constructor(z){super(z);this.#$=z.options;let $=this.options;this.filteredOptions=[...$],this.multiple=z.multiple===!0,this.#Z=z.filter??oz;let Q;if(z.initialValue&&Array.isArray(z.initialValue))if(this.multiple)Q=z.initialValue;else Q=z.initialValue.slice(0,1);else if(!this.multiple&&this.options.length>0)Q=[this.options[0].value];if(Q)for(let Z of Q){let Y=$.findIndex((q)=>q.value===Z);if(Y!==-1)this.toggleSelected(Z),this.#z=Y}this.focusedValue=this.options[this.#z]?.value,this.on("key",(Z,Y)=>this.#Y(Z,Y)),this.on("userInput",(Z)=>this.#q(Z))}_isActionKey(z,$){return z==="\t"||this.multiple&&this.isNavigating&&$.name==="space"&&z!==void 0&&z!==""}#Y(z,$){let Q=$.name==="up",Z=$.name==="down",Y=$.name==="return";if(Q||Z){if(this.#z=Math.max(0,Math.min(this.#z+(Q?-1:1),this.filteredOptions.length-1)),this.focusedValue=this.filteredOptions[this.#z]?.value,!this.multiple)this.selectedValues=[this.focusedValue];this.isNavigating=!0}else if(Y)this.value=ez(this.multiple,this.selectedValues);else if(this.multiple)if(this.focusedValue!==void 0&&($.name==="tab"||this.isNavigating&&$.name==="space"))this.toggleSelected(this.focusedValue);else this.isNavigating=!1;else{if(this.focusedValue)this.selectedValues=[this.focusedValue];this.isNavigating=!1}}deselectAll(){this.selectedValues=[]}toggleSelected(z){if(this.filteredOptions.length===0)return;if(this.multiple)if(this.selectedValues.includes(z))this.selectedValues=this.selectedValues.filter(($)=>$!==z);else this.selectedValues=[...this.selectedValues,z];else this.selectedValues=[z]}#q(z){if(z!==this.#Q){this.#Q=z;let $=this.options;if(z)this.filteredOptions=$.filter((Q)=>this.#Z(z,Q));else this.filteredOptions=[...$];if(this.#z=tz(this.focusedValue,this.filteredOptions),this.focusedValue=this.filteredOptions[this.#z]?.value,!this.multiple)if(this.focusedValue!==void 0)this.toggleSelected(this.focusedValue);else this.deselectAll()}}}class $4 extends Y6{options;cursor=0;#z;getGroupItems(z){return this.options.filter(($)=>$.group===z)}isGroupSelected(z){let $=this.getGroupItems(z),Q=this.value;if(Q===void 0)return!1;return $.every((Z)=>Q.includes(Z.value))}toggleValue(){let z=this.options[this.cursor];if(this.value===void 0)this.value=[];if(z.group===!0){let $=String(z.value),Q=this.getGroupItems($);if(this.isGroupSelected($))this.value=this.value.filter((Z)=>Q.findIndex((Y)=>Y.value===Z)===-1);else this.value=[...this.value,...Q.map((Z)=>Z.value)];this.value=Array.from(new Set(this.value))}else{let $=this.value.includes(z.value);this.value=$?this.value.filter((Q)=>Q!==z.value):[...this.value,z.value]}}constructor(z){super(z,!1);let{options:$}=z;this.#z=z.selectableGroups!==!1,this.options=Object.entries($).flatMap(([Q,Z])=>[{value:Q,group:!0,label:Q},...Z.map((Y)=>({...Y,group:Q}))]),this.value=[...z.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:Q})=>Q===z.cursorAt),this.#z?0:1),this.on("cursor",(Q)=>{switch(Q){case"left":case"up":{this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;let Z=this.options[this.cursor]?.group===!0;if(!this.#z&&Z)this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break}case"down":case"right":{this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;let Z=this.options[this.cursor]?.group===!0;if(!this.#z&&Z)this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}case"space":this.toggleValue();break}})}}var Q4=jz();var b=(z,$)=>Q4?z:$,k4=b("◆","*"),h4=b("■","x"),_4=b("▲","x"),g4=b("◇","o"),f4=b("┌","T"),Z4=b("│","|"),m4=b("└","—"),d4=b("●",">"),u4=b("○"," "),c4=b("◻","[•]"),i4=b("◼","[+]"),l4=b("◻","[ ]"),n4=b("▪","•"),p4=b("─","-"),r4=b("╮","+"),a4=b("├","+"),s4=b("╯","+"),t4=b("●","•"),o4=b("◆","*"),e4=b("▲","!"),z0=b("■","x");var $0={light:b("─","-"),heavy:b("━","="),block:b("█","#")};function Y4(){return`${c.gray(Z4)} `}var Q0=Y4();var P6="0.11.38";J4();async function X4(z="src/pantry"){if(!H.existsSync(z))throw Error(`Pantry directory not found: ${z}. Please run 'bun ./bin/cli.ts update-pantry' first.`);let $=[];function Q(Z,Y=""){let q=H.readdirSync(Z,{withFileTypes:!0}),X=w.join(Z,"package.yml");if(Y&&H.existsSync(X))$.push(Y);for(let U of q)if(U.isDirectory()&&!U.name.startsWith(".")){let J=Y?`${Y}/${U.name}`:U.name,G=w.join(Z,U.name);Q(G,J)}}return Q(z),console.log(`\uD83D\uDCE6 Found ${$.length} packages in local pantry`),$.sort()}async function U4(z=!1){async function $(X){let U=new URL("https://s3.amazonaws.com/dist.tea.xyz/");if(U.searchParams.set("list-type","2"),U.searchParams.set("prefix",""),U.searchParams.set("max-keys","1000"),X)U.searchParams.set("continuation-token",X);let J=await fetch(U.toString());if(!J.ok)throw Error(`Failed to fetch S3 listing: ${J.status}`);let G=await J.text(),V=[],W=G.match(/<Key>([^<]+)<\/Key>/g);if(W)for(let E of W){let x=E.replace(/<Key>([^<]+)<\/Key>/,"$1");V.push({Key:x})}let K=G.includes("<IsTruncated>true</IsTruncated>"),F=G.match(/<NextContinuationToken>([^<]+)<\/NextContinuationToken>/),L=F?F[1]:void 0;return{IsTruncated:K,NextContinuationToken:L,Contents:V}}console.log("Scraping packages from S3 registry...");let Q=new Set,Z;do{let X=await $(Z);for(let U of X.Contents){let J=U.Key,G=J.split("/");if(G.length===0)continue;if(G[0].startsWith(".")||G[0].includes(" ")||J.match(/\.(md|txt|yml|yaml|json)$/i))continue;let V=["darwin","linux","windows"],W=-1;for(let K=1;K<G.length;K++)if(V.includes(G[K])){W=K;break}if(W>0){let K=G.slice(0,W).join("/");if(K.includes("."))Q.add(K)}else if(G.length>=2&&G[0].includes(".")&&!G[1].startsWith("v")&&!G[1].match(/^\d/)){let K=`${G[0]}/${G[1]}`;Q.add(K)}else if(G.length>=1&&G[0].includes("."))Q.add(G[0])}Z=X.NextContinuationToken,console.log(`Found ${Q.size} packages so far...`)}while(Z);let Y=Array.from(Q).sort(),q=[];for(let X of Y){if(!X.includes(".")||X.match(/^[a-z0-9.-]+\.[a-z]{2,}(\/[\w.-]+){0,20}$/i)===null)continue;if(X.endsWith("/README.rst")||X.endsWith("/README")||X.includes("/docs/"))continue;if(X.endsWith("/.pkgroot"))continue;if(["amazon.com/aws","charm.sh","code.videolan.org","crates.io"].includes(X))continue;q.push(X)}return console.log(`\uD83D\uDCE6 Found ${q.length} valid packages in registry`),q}async function G4(z,$){let Z=`/**
|
|
41
41
|
* Constants used throughout the ts-pantry package
|
|
42
42
|
* This file is auto-generated from ${$}. Do not edit manually.
|
|
43
43
|
* Generated on ${new Date().toISOString()}
|
|
@@ -100,7 +100,7 @@ ${Y.join(`
|
|
|
100
100
|
Conflicts found:`),K.conflicts.forEach((L)=>{console.log(` ${L.package}: ${L.versions.join(", ")}`)});if(console.log(`
|
|
101
101
|
\uD83D\uDCCB All unique packages to install:`),K.uniquePackages.forEach((L,E)=>{let x=K.allDependencies.find((N)=>N.name===L),M=x&&x.version&&x.version!=="latest"?` (${x.version})`:"";console.log(` ${E+1}. ${L}${M}`)}),G)console.log(`
|
|
102
102
|
\uD83D\uDE80 Install command:`),console.log(`pantry install ${K.uniquePackages.join(" ")}`);if(Object.values(K.osSpecificDeps).reduce((L,E)=>L+E.length,0)>0)console.log(`
|
|
103
|
-
\uD83D\uDDA5️ OS-specific dependencies:`),Object.entries(K.osSpecificDeps).forEach(([L,E])=>{if(E.length>0)console.log(` ${L}: ${E.map((x)=>x.name).join(", ")}`)})}j.exit(0)}catch(Q){if($.json){let Z={success:!1,error:String(Q),timestamp:new Date().toISOString()};console.log(JSON.stringify(Z))}else console.error("Error resolving dependencies:",Q);j.exit(1)}});D.command("get-php-versions","Get PHP versions suitable for CI/CD workflows").option("--format <type>","Output format: json (default), yaml, or csv",{default:"json"}).option("--branches <branches>","Comma-separated list of PHP branches to include (e.g., 8.4,8.3,8.2)").option("--fallback <versions>","Comma-separated list of fallback versions if detection fails").action(async(z)=>{try{let{getPhpVersionsForWorkflow:$}=await import("../chunk-
|
|
103
|
+
\uD83D\uDDA5️ OS-specific dependencies:`),Object.entries(K.osSpecificDeps).forEach(([L,E])=>{if(E.length>0)console.log(` ${L}: ${E.map((x)=>x.name).join(", ")}`)})}j.exit(0)}catch(Q){if($.json){let Z={success:!1,error:String(Q),timestamp:new Date().toISOString()};console.log(JSON.stringify(Z))}else console.error("Error resolving dependencies:",Q);j.exit(1)}});D.command("get-php-versions","Get PHP versions suitable for CI/CD workflows").option("--format <type>","Output format: json (default), yaml, or csv",{default:"json"}).option("--branches <branches>","Comma-separated list of PHP branches to include (e.g., 8.4,8.3,8.2)").option("--fallback <versions>","Comma-separated list of fallback versions if detection fails").action(async(z)=>{try{let{getPhpVersionsForWorkflow:$}=await import("../chunk-rq61h9w2.js"),Q={};if(z.branches)Q.supportedBranches=z.branches.split(",").map((Y)=>Y.trim());if(z.fallback)Q.fallbackVersions=z.fallback.split(",").map((Y)=>Y.trim());let Z=$(Q);switch(z.format.toLowerCase()){case"yaml":console.log(`php_versions:
|
|
104
104
|
${Z.map((Y)=>` - "${Y}"`).join(`
|
|
105
105
|
`)}`);break;case"csv":console.log(Z.join(","));break;case"json":default:console.log(JSON.stringify(Z));break}j.exit(0)}catch($){console.error("Error getting PHP versions:",$),j.exit(1)}});D.command("generate-zig","Generate Zig package definitions from TypeScript packages").option("--packages-dir <dir>","Directory containing TypeScript package files",{default:"src/packages"}).option("--output <file>","Output Zig file path",{default:"packages.zig"}).option("--aliases","Also generate aliases file").option("--aliases-output <file>","Output file for Zig aliases",{default:"aliases.zig"}).action(async(z)=>{try{let{generateZigDefinitions:$,generateZigAliases:Q}=await import("../chunk-aa72n836.js"),{packagesDir:Z="src/packages",output:Y="packages.zig",aliases:q=!1,aliasesOutput:X="aliases.zig"}=z;if(console.log("\uD83D\uDE80 Generating Zig package definitions..."),await $(Z,Y),q)console.log(`
|
|
106
106
|
\uD83D\uDE80 Generating Zig package aliases...`),await Q(Z,X);console.log(`
|