ts-pantry 0.10.12 → 0.10.14
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-858cxz72.js → chunk-ax2wz06f.js} +44 -44
- package/dist/chunk-c7csvans.js +2 -0
- package/dist/{chunk-ep3zp05s.js → chunk-hk7ns20y.js} +1 -1
- package/dist/chunk-sa2nn9dg.js +1 -0
- package/dist/{chunk-h23sa5s2.js → chunk-tbgzzd68.js} +1 -1
- package/dist/{chunk-0cc7ytd6.js → chunk-wzw3xbn2.js} +1 -1
- package/dist/packages/anthropic.com/claude-code.d.ts +1 -1
- package/dist/packages/apps/cursorcom.d.ts +1 -1
- package/dist/packages/apps/discordcom.d.ts +1 -1
- package/dist/packages/apps/raycastcom.d.ts +1 -1
- package/dist/packages/apps/rectangleapp.d.ts +1 -1
- package/dist/packages/apps/zeddev.d.ts +1 -1
- package/dist/packages/aux4io.d.ts +1 -1
- package/dist/packages/certbotefforg.d.ts +1 -1
- package/dist/packages/cnqueryio.d.ts +1 -1
- package/dist/packages/denoland.d.ts +1 -1
- package/dist/packages/depotdev.d.ts +1 -1
- package/dist/packages/dozzledev.d.ts +1 -1
- package/dist/packages/github.com/ggerganov/llama.cpp.d.ts +1 -1
- package/dist/packages/github.com/shaka-project/shaka-packager.d.ts +1 -1
- package/dist/packages/materializecom.d.ts +1 -1
- package/dist/packages/misejdxdev.d.ts +1 -1
- package/dist/packages/nginxorg.d.ts +1 -1
- package/dist/packages/ohmyposhdev.d.ts +1 -1
- package/dist/packages/opencodeai.d.ts +1 -1
- package/dist/packages/openshiftcom.d.ts +1 -1
- package/dist/packages/pnpmio.d.ts +1 -1
- package/dist/packages/prefixdev.d.ts +1 -1
- package/dist/packages/projenio.d.ts +1 -1
- package/dist/packages/rucio.cern.ch/rucio-client.d.ts +1 -1
- package/dist/packages/traefikio.d.ts +1 -1
- package/dist/packages/tursotech.d.ts +1 -1
- package/dist/packages/ziglangorg.d.ts +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/testing/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-jypchrvb.js +0 -2
- package/dist/chunk-tzzpsd63.js +0 -1
package/dist/bin/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{Da as c6,Ea as n6,Ga as l6,Ja as p6,L as C6,La as r6,M as S6,N as v6,P as y6,V as k6,W as h6,X as _6,Y as g6,Z as f6,ba as G6,ca as u6,da as i6}from"../chunk-
|
|
2
|
+
import{Da as c6,Ea as n6,Ga as l6,Ja as p6,L as C6,La as r6,M as S6,N as v6,P as y6,V as k6,W as h6,X as _6,Y as g6,Z as f6,ba as G6,ca as u6,da as i6}from"../chunk-ax2wz06f.js";import"../chunk-c0pn1x0j.js";import"../chunk-sa2nn9dg.js";import{kb as p,lb as m6,nb as X6,ob as r,tb as d6,xb as U6}from"../chunk-4qa9dfjs.js";import"../chunk-jkfbbcs7.js";import"../chunk-qyfapvcb.js";import{Pb as l,Qb as q6,Rb as J6}from"../chunk-py3ymxjf.js";import"../chunk-wzw3xbn2.js";import"../chunk-c7csvans.js";import{jc as P6,kc as Q4}from"../chunk-dnw4x7bh.js";import{oc as h}from"../chunk-ghzc37v7.js";import V from"node:fs";import B from"node:path";import H from"node:process";import{existsSync as t6}from"node:fs";import a from"node:fs/promises";import K6 from"node:os";import s from"node:path";import k from"node:process";import{EventEmitter as o6}from"node:events";import v from"node:process";import V6 from"node:process";import z6 from"node:process";import u from"node:process";import f from"node:process";import L6 from"node:tty";import fz,{stdin as E4,stdout as x4}from"node:process";import M6,{stdin as uz,stdout as iz}from"node:process";import cz from"node:readline";class B6{configPath;config=null;events=[];retryCount=0;maxRetries=3;retryDelayMs=1000;constructor(){let z=K6.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:K6.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(t6(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 V4=new B6;function e6(z,$={}){let Q={_:[]},Z=$.alias||{},Y=new Set($.boolean||[]),q={};for(let U of Object.keys(Z))for(let X of Z[U])q[X]=U;for(let U of Y)if(Z[U])for(let X of Z[U])Y.add(X);function J(U,X){let G=q[U]||U;if(Q[G]=X,Z[G])for(let K of Z[G])Q[K]=X;if(q[U]&&Z[q[U]])for(let K of Z[q[U]])Q[K]=X;Q[U]=X}for(let U=0;U<z.length;U++){let X=z[U];if(X==="--"){Q._.push(...z.slice(U+1));break}if(X.startsWith("--")){let G=X.indexOf("=");if(G!==-1){let K=X.slice(2,G),W=X.slice(G+1);J(K,W)}else{let K=X.slice(2);if(K.startsWith("no-")){let j=K.slice(3);J(j,!1);continue}let W=q[K]||K;if(Y.has(W)||Y.has(K))J(K,!0);else{let j=z[U+1];if(j!==void 0&&!j.startsWith("-"))J(K,j),U++;else J(K,!0)}}}else if(X.startsWith("-")&&X.length>1){let G=X.slice(1);for(let K=0;K<G.length;K++){let W=G[K],j=q[W]||W;if(K===G.length-1&&!Y.has(j)&&!Y.has(W)){let F=z[U+1];if(F!==void 0&&!F.startsWith("-"))J(W,F),U++;else J(W,!0)}else J(W,!0)}}else Q._.push(X)}return Q}function e(z){return z.replace(/[<[].+/,"").trim()}function zz(z){let $=/<([^>]+)>/g,Q=/\[([^\]]+)\]/g,Z=[],Y=(U)=>{let X=!1,G=U[1];if(G.startsWith("..."))G=G.slice(3),X=!0;return{required:U[0].startsWith("<"),value:G,variadic:X}},q;while(q=$.exec(z))Z.push(Y(q));let J;while(J=Q.exec(z))Z.push(Y(J));return Z}function $z(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,J)=>{return J!==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 F6(z){return z.reduce(($,Q)=>$.length>=Q.length?$:Q,"")}function t(z,$){return z.length>=$?z:`${z}${" ".repeat($-z.length)}`}function Qz(z){return z.replace(/([a-z])-([a-z])/g,($,Q,Z)=>{return Q+Z.toUpperCase()})}function Zz(z,$,Q){let Z=0,Y=$.length,q=z,J;for(;Z<Y;++Z)J=q[$[Z]],q=q[$[Z]]=Z===Y-1?Q:J!=null?J:!!~$[Z+1].indexOf(".")||!(+$[Z+1]>-1)?{}:[]}function Yz(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 qz(z){let $=/([^\\/]+)$/.exec(z);return $?$[1]:""}function N6(z){return z.split(".").map(($,Q)=>{return Q===0?Qz($):$}).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}=V6,{TERM:$,TERM_PROGRAM:Q}=z;if(V6.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 n="\x1B",x=`${n}[`;var S={to(z,$){if(!$)return`${x}${z+1}G`;return`${x}${$+1};${z+1}H`},move(z,$){let Q="";if(z<0)Q+=`${x}${-z}D`;else if(z>0)Q+=`${x}${z}C`;if($<0)Q+=`${x}${-$}A`;else if($>0)Q+=`${x}${$}B`;return Q},up:(z=1)=>`${x}${z}A`,down:(z=1)=>`${x}${z}B`,forward:(z=1)=>`${x}${z}C`,backward:(z=1)=>`${x}${z}D`,nextLine:(z=1)=>`${x}E`.repeat(z),prevLine:(z=1)=>`${x}F`.repeat(z),left:`${x}G`,hide:`${x}?25l`,show:`${x}?25h`,save:`${n}7`,restore:`${n}8`};var o={screen:`${x}2J`,up:(z=1)=>`${x}1J`.repeat(z),down:(z=1)=>`${x}J`.repeat(z),line:`${x}2K`,lineEnd:`${x}K`,lineStart:`${x}1K`,lines(z){let $="";for(let Q=0;Q<z;Q++)$+=this.line+(Q<z-1?S.up():"");if(z)$+=S.left;return $}},w4={screen:`${n}c`};function Xz(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 b6(z,$,Q=2,Z=3){return $.map((Y)=>({cmd:Y,distance:Xz(z,Y)})).filter(({distance:Y})=>Y<=Q).sort((Y,q)=>Y.distance-q.distance).slice(0,Z).map(({cmd:Y})=>Y)}class D6{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 N6(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 O4=z6.argv,Uz=`${z6.platform}-${z6.arch} bun-v${typeof Bun<"u"?Bun.version:"unknown"}`,W6=u.argv,Gz=`${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=zz(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 D6(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 X=F6($.map((F)=>F.rawName)),G=new Map,K=[];for(let F of $)if(F.namespace){if(!G.has(F.namespace))G.set(F.namespace,[]);G.get(F.namespace).push(F)}else K.push(F);let W="";if(K.length>0)W+=K.map((F)=>{return` ${t(F.rawName,X.length)} ${F.description}`}).join(`
|
|
@@ -37,7 +37,7 @@ Run \`${this.name??"cli"} --help\` for usage.`;v.stderr.write(`${q}${Y}${J}
|
|
|
37
37
|
`).length-1;this.output.write(S.move(-999,z*-1))}render(){let z=O6(this._render(this)??"",M6.stdout.columns,{hard:!0,trim:!1});if(z===this._prevFrame)return;if(this.state==="initial")this.output.write(S.hide);else{let $=dz(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 pz(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 rz(z,$){return($.label??String($.value)).toLowerCase().includes(z.toLowerCase())}function az(z,$){if(!$)return;if(z)return $;return $[0]}class sz extends Y6{filteredOptions;multiple;isNavigating=!1;selectedValues=[];focusedValue;#z=0;#Q="";#Z;#$;get cursor(){return this.#z}get userInputWithCursor(){if(!this.userInput)return i.inverse(i.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}${i.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??rz;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=az(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=pz(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 tz 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 oz=Jz();var b=(z,$)=>oz?z:$,P4=b("◆","*"),C4=b("■","x"),S4=b("▲","x"),v4=b("◇","o"),y4=b("┌","T"),ez=b("│","|"),k4=b("└","—"),h4=b("●",">"),_4=b("○"," "),g4=b("◻","[•]"),f4=b("◼","[+]"),m4=b("◻","[ ]"),d4=b("▪","•"),u4=b("─","-"),i4=b("╮","+"),c4=b("├","+"),n4=b("╯","+"),l4=b("●","•"),p4=b("◆","*"),r4=b("▲","!"),a4=b("■","x");var s4={light:b("─","-"),heavy:b("━","="),block:b("█","#")};function z4(){return`${i.gray(ez)} `}var t4=z4();var I6="0.10.
|
|
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 pz(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 rz(z,$){return($.label??String($.value)).toLowerCase().includes(z.toLowerCase())}function az(z,$){if(!$)return;if(z)return $;return $[0]}class sz extends Y6{filteredOptions;multiple;isNavigating=!1;selectedValues=[];focusedValue;#z=0;#Q="";#Z;#$;get cursor(){return this.#z}get userInputWithCursor(){if(!this.userInput)return i.inverse(i.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}${i.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??rz;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=az(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=pz(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 tz 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 oz=Jz();var b=(z,$)=>oz?z:$,P4=b("◆","*"),C4=b("■","x"),S4=b("▲","x"),v4=b("◇","o"),y4=b("┌","T"),ez=b("│","|"),k4=b("└","—"),h4=b("●",">"),_4=b("○"," "),g4=b("◻","[•]"),f4=b("◼","[+]"),m4=b("◻","[ ]"),d4=b("▪","•"),u4=b("─","-"),i4=b("╮","+"),c4=b("├","+"),n4=b("╯","+"),l4=b("●","•"),p4=b("◆","*"),r4=b("▲","!"),a4=b("■","x");var s4={light:b("─","-"),heavy:b("━","="),block:b("█","#")};function z4(){return`${i.gray(ez)} `}var t4=z4();var I6="0.10.14";Q4();async function Z4(z="src/pantry"){if(!V.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=V.readdirSync(Z,{withFileTypes:!0}),J=B.join(Z,"package.yml");if(Y&&V.existsSync(J))$.push(Y);for(let U of q)if(U.isDirectory()&&!U.name.startsWith(".")){let X=Y?`${Y}/${U.name}`:U.name,G=B.join(Z,U.name);Q(G,X)}}return Q(z),console.log(`\uD83D\uDCE6 Found ${$.length} packages in local pantry`),$.sort()}async function Y4(z=!1){async function $(J){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"),J)U.searchParams.set("continuation-token",J);let X=await fetch(U.toString());if(!X.ok)throw Error(`Failed to fetch S3 listing: ${X.status}`);let G=await X.text(),K=[],W=G.match(/<Key>([^<]+)<\/Key>/g);if(W)for(let T of W){let E=T.replace(/<Key>([^<]+)<\/Key>/,"$1");K.push({Key:E})}let j=G.includes("<IsTruncated>true</IsTruncated>"),F=G.match(/<NextContinuationToken>([^<]+)<\/NextContinuationToken>/),L=F?F[1]:void 0;return{IsTruncated:j,NextContinuationToken:L,Contents:K}}console.log("Scraping packages from S3 registry...");let Q=new Set,Z;do{let J=await $(Z);for(let U of J.Contents){let X=U.Key,G=X.split("/");if(G.length===0)continue;if(G[0].startsWith(".")||G[0].includes(" ")||X.match(/\.(md|txt|yml|yaml|json)$/i))continue;let K=["darwin","linux","windows"],W=-1;for(let j=1;j<G.length;j++)if(K.includes(G[j])){W=j;break}if(W>0){let j=G.slice(0,W).join("/");if(j.includes("."))Q.add(j)}else if(G.length>=2&&G[0].includes(".")&&!G[1].startsWith("v")&&!G[1].match(/^\d/)){let j=`${G[0]}/${G[1]}`;Q.add(j)}else if(G.length>=1&&G[0].includes("."))Q.add(G[0])}Z=J.NextContinuationToken,console.log(`Found ${Q.size} packages so far...`)}while(Z);let Y=Array.from(Q).sort(),q=[];for(let J of Y){if(!J.includes(".")||J.match(/^[a-z0-9.-]+\.[a-z]{2,}(\/[\w.-]+){0,20}$/i)===null)continue;if(J.endsWith("/README.rst")||J.endsWith("/README")||J.includes("/docs/"))continue;if(J.endsWith("/.pkgroot"))continue;if(["amazon.com/aws","charm.sh","code.videolan.org","crates.io"].includes(J))continue;q.push(J)}return console.log(`\uD83D\uDCE6 Found ${q.length} valid packages in registry`),q}async function q4(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:`),j.conflicts.forEach((L)=>{console.log(` ${L.package}: ${L.versions.join(", ")}`)});if(console.log(`
|
|
101
101
|
\uD83D\uDCCB All unique packages to install:`),j.uniquePackages.forEach((L,T)=>{let E=j.allDependencies.find((N)=>N.name===L),w=E&&E.version&&E.version!=="latest"?` (${E.version})`:"";console.log(` ${T+1}. ${L}${w}`)}),G)console.log(`
|
|
102
102
|
\uD83D\uDE80 Install command:`),console.log(`pantry install ${j.uniquePackages.join(" ")}`);if(Object.values(j.osSpecificDeps).reduce((L,T)=>L+T.length,0)>0)console.log(`
|
|
103
|
-
\uD83D\uDDA5️ OS-specific dependencies:`),Object.entries(j.osSpecificDeps).forEach(([L,T])=>{if(T.length>0)console.log(` ${L}: ${T.map((E)=>E.name).join(", ")}`)})}H.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);H.exit(1)}});I.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(j.osSpecificDeps).forEach(([L,T])=>{if(T.length>0)console.log(` ${L}: ${T.map((E)=>E.name).join(", ")}`)})}H.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);H.exit(1)}});I.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-hk7ns20y.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}H.exit(0)}catch($){console.error("Error getting PHP versions:",$),H.exit(1)}});I.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-wavfc3dt.js"),{packagesDir:Z="src/packages",output:Y="packages.zig",aliases:q=!1,aliasesOutput:J="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,J);console.log(`
|