just-bash 2.4.3 → 2.5.0

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 (86) hide show
  1. package/README.md +42 -4
  2. package/dist/AGENTS.md +2 -2
  3. package/dist/bin/chunks/base64-O7TCK5TL.js +6 -0
  4. package/dist/bin/{shell/chunks/cat-ZEMMQGY5.js → chunks/cat-AJXZOSPN.js} +1 -1
  5. package/dist/bin/chunks/{chunk-45SNFRCY.js → chunk-5WFYIUU2.js} +2 -2
  6. package/dist/bin/chunks/chunk-X4WRNADE.js +17 -0
  7. package/dist/bin/{shell/chunks/chunk-GX4MPCG6.js → chunks/chunk-Y5QKO4KO.js} +5 -5
  8. package/dist/bin/chunks/{cut-WWPJ2PYT.js → cut-IHF6BEOO.js} +1 -1
  9. package/dist/bin/chunks/grep-WDHYDUUD.js +9 -0
  10. package/dist/bin/{shell/chunks/gzip-MNCJB6OR.js → chunks/gzip-YXK3WZQL.js} +22 -22
  11. package/dist/bin/{shell/chunks/jq-XH2PXRWE.js → chunks/jq-XXZPU5CA.js} +1 -1
  12. package/dist/bin/chunks/{md5sum-VGXAOUBA.js → md5sum-2VAAFCTS.js} +1 -1
  13. package/dist/bin/chunks/rg-ALK3CYAN.js +29 -0
  14. package/dist/bin/chunks/{sha1sum-BIUH233Z.js → sha1sum-67P4ME4N.js} +1 -1
  15. package/dist/bin/{shell/chunks/sha256sum-SUIK2MT2.js → chunks/sha256sum-MV3WQ4QF.js} +1 -1
  16. package/dist/bin/{shell/chunks/sort-C3F6LCNY.js → chunks/sort-KUHOCH5S.js} +1 -1
  17. package/dist/bin/chunks/sqlite3-THMDBIGF.js +36 -0
  18. package/dist/bin/chunks/tar-C27YYUAS.js +63 -0
  19. package/dist/bin/{shell/chunks/uniq-DKS7RIAE.js → chunks/uniq-IXHB2FVS.js} +1 -1
  20. package/dist/bin/chunks/{wc-4LMTC3QD.js → wc-QSBRKIF5.js} +1 -1
  21. package/dist/bin/chunks/{xan-WNN2ZOAX.js → xan-6K2NGTHM.js} +1 -1
  22. package/dist/bin/just-bash.js +78 -78
  23. package/dist/bin/shell/chunks/base64-O7TCK5TL.js +6 -0
  24. package/dist/bin/{chunks/cat-ZEMMQGY5.js → shell/chunks/cat-AJXZOSPN.js} +1 -1
  25. package/dist/bin/shell/chunks/{chunk-45SNFRCY.js → chunk-5WFYIUU2.js} +2 -2
  26. package/dist/bin/shell/chunks/chunk-X4WRNADE.js +17 -0
  27. package/dist/bin/{chunks/chunk-GX4MPCG6.js → shell/chunks/chunk-Y5QKO4KO.js} +5 -5
  28. package/dist/bin/shell/chunks/{cut-WWPJ2PYT.js → cut-IHF6BEOO.js} +1 -1
  29. package/dist/bin/shell/chunks/grep-WDHYDUUD.js +9 -0
  30. package/dist/bin/{chunks/gzip-MNCJB6OR.js → shell/chunks/gzip-YXK3WZQL.js} +22 -22
  31. package/dist/bin/{chunks/jq-XH2PXRWE.js → shell/chunks/jq-XXZPU5CA.js} +1 -1
  32. package/dist/bin/shell/chunks/{md5sum-VGXAOUBA.js → md5sum-2VAAFCTS.js} +1 -1
  33. package/dist/bin/shell/chunks/rg-ALK3CYAN.js +29 -0
  34. package/dist/bin/shell/chunks/{sha1sum-BIUH233Z.js → sha1sum-67P4ME4N.js} +1 -1
  35. package/dist/bin/{chunks/sha256sum-SUIK2MT2.js → shell/chunks/sha256sum-MV3WQ4QF.js} +1 -1
  36. package/dist/bin/{chunks/sort-C3F6LCNY.js → shell/chunks/sort-KUHOCH5S.js} +1 -1
  37. package/dist/bin/shell/chunks/sqlite3-THMDBIGF.js +36 -0
  38. package/dist/bin/shell/chunks/tar-C27YYUAS.js +63 -0
  39. package/dist/bin/{chunks/uniq-DKS7RIAE.js → shell/chunks/uniq-IXHB2FVS.js} +1 -1
  40. package/dist/bin/shell/chunks/{wc-4LMTC3QD.js → wc-QSBRKIF5.js} +1 -1
  41. package/dist/bin/shell/chunks/{xan-WNN2ZOAX.js → xan-6K2NGTHM.js} +1 -1
  42. package/dist/bin/shell/shell.js +100 -100
  43. package/dist/bundle/browser.js +542 -506
  44. package/dist/bundle/chunks/base64-3BME25ON.js +5 -0
  45. package/dist/bundle/chunks/{cat-W5XITXDC.js → cat-MV4K6AUA.js} +1 -1
  46. package/dist/bundle/chunks/{chunk-4ACWXGKW.js → chunk-7L36YK2X.js} +2 -2
  47. package/dist/bundle/chunks/chunk-7VH6U2UX.js +16 -0
  48. package/dist/bundle/chunks/{chunk-46TSKXFW.js → chunk-GFLIVSUW.js} +5 -5
  49. package/dist/bundle/chunks/{cut-KKAAQJVD.js → cut-NVKWEAZF.js} +1 -1
  50. package/dist/bundle/chunks/grep-QVR5G7SC.js +8 -0
  51. package/dist/bundle/chunks/{gzip-7QAS5P2Y.js → gzip-L3NDJG3F.js} +22 -22
  52. package/dist/bundle/chunks/{jq-AAWVUTC4.js → jq-3YU5HRKE.js} +1 -1
  53. package/dist/bundle/chunks/{md5sum-LJHKXLVT.js → md5sum-KLHZSRUA.js} +1 -1
  54. package/dist/bundle/chunks/rg-43HLKW4V.js +28 -0
  55. package/dist/bundle/chunks/{sha1sum-NRUZZ4Q6.js → sha1sum-WKWTIZGQ.js} +1 -1
  56. package/dist/bundle/chunks/{sha256sum-5ZGJ4NJL.js → sha256sum-IUVNMBTA.js} +1 -1
  57. package/dist/bundle/chunks/{sort-JHO22QVO.js → sort-EJUT5LXD.js} +1 -1
  58. package/dist/bundle/chunks/sqlite3-5QVZOGER.js +35 -0
  59. package/dist/bundle/chunks/tar-QWBXMF7K.js +62 -0
  60. package/dist/bundle/chunks/{uniq-SEKCFR7B.js → uniq-47QVBRNC.js} +1 -1
  61. package/dist/bundle/chunks/{wc-52FZ4QGS.js → wc-DFQKWSIZ.js} +1 -1
  62. package/dist/bundle/chunks/{xan-ZHXYF6B4.js → xan-2R2APJJ4.js} +1 -1
  63. package/dist/bundle/index.js +119 -119
  64. package/dist/commands/registry.d.ts +1 -1
  65. package/dist/commands/rg/file-types.d.ts +23 -0
  66. package/dist/commands/rg/gitignore.d.ts +69 -0
  67. package/dist/commands/rg/rg-options.d.ts +47 -0
  68. package/dist/commands/rg/rg-parser.d.ts +20 -0
  69. package/dist/commands/rg/rg-search.d.ts +15 -0
  70. package/dist/commands/rg/rg.d.ts +12 -0
  71. package/dist/commands/search-engine/index.d.ts +10 -0
  72. package/dist/commands/search-engine/matcher.d.ts +57 -0
  73. package/dist/commands/search-engine/regex.d.ts +17 -0
  74. package/dist/commands/tar/archive.d.ts +107 -0
  75. package/dist/commands/tar/tar.d.ts +8 -0
  76. package/dist/index.d.ts +1 -0
  77. package/package.json +11 -5
  78. package/dist/bin/chunks/base64-RJX7MYGG.js +0 -6
  79. package/dist/bin/chunks/grep-U2RCKOEG.js +0 -15
  80. package/dist/bin/chunks/sqlite3-PZRKN3TT.js +0 -37
  81. package/dist/bin/shell/chunks/base64-RJX7MYGG.js +0 -6
  82. package/dist/bin/shell/chunks/grep-U2RCKOEG.js +0 -15
  83. package/dist/bin/shell/chunks/sqlite3-PZRKN3TT.js +0 -37
  84. package/dist/bundle/chunks/base64-F5R4G5EG.js +0 -5
  85. package/dist/bundle/chunks/grep-CTJRP2G3.js +0 -14
  86. package/dist/bundle/chunks/sqlite3-CX5D36A5.js +0 -36
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ import{a as f}from"./chunk-TA7RUHGQ.js";import{a as l,b as u}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var g={name:"base64",summary:"base64 encode/decode data and print to standard output",usage:"base64 [OPTION]... [FILE]",options:["-d, --decode decode data","-w, --wrap=COLS wrap encoded lines after COLS character (default 76, 0 to disable)"," --help display this help and exit"]},b={decode:{short:"d",long:"decode",type:"boolean"},wrap:{short:"w",long:"wrap",type:"number",default:76}};async function p(r,o,a){if(o.length===0||o.length===1&&o[0]==="-")return{ok:!0,data:Uint8Array.from(r.stdin,e=>e.charCodeAt(0))};let s=[];for(let e of o){if(e==="-"){s.push(Uint8Array.from(r.stdin,t=>t.charCodeAt(0)));continue}try{let t=r.fs.resolvePath(r.cwd,e),n=await r.fs.readFileBuffer(t);s.push(n)}catch{return{ok:!1,error:{stdout:"",stderr:`${a}: ${e}: No such file or directory
3
+ `,exitCode:1}}}}let c=s.reduce((e,t)=>e+t.length,0),i=new Uint8Array(c),d=0;for(let e of s)i.set(e,d),d+=e.length;return{ok:!0,data:i}}var y={name:"base64",async execute(r,o){if(u(r))return l(g);let a=f("base64",r,b);if(!a.ok)return a.error;let s=a.result.flags.decode,c=a.result.flags.wrap,i=a.result.positional;try{if(s){let t=await p(o,i,"base64");if(!t.ok)return t.error;let h=String.fromCharCode(...t.data).replace(/\s/g,"");return{stdout:atob(h),stderr:"",exitCode:0}}let d=await p(o,i,"base64");if(!d.ok)return d.error;let e=btoa(String.fromCharCode(...d.data));if(c>0){let t=[];for(let n=0;n<e.length;n+=c)t.push(e.slice(n,n+c));e=t.join(`
4
+ `)+(e.length>0?`
5
+ `:"")}return{stdout:e,stderr:"",exitCode:0}}catch{return{stdout:"",stderr:`base64: invalid input
6
+ `,exitCode:1}}}};export{y as base64Command};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{a as p}from"./chunk-45SNFRCY.js";import"./chunk-OBH7XN5N.js";import{a as d}from"./chunk-TA7RUHGQ.js";import{a as c,b as m}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var f={name:"cat",summary:"concatenate files and print on the standard output",usage:"cat [OPTION]... [FILE]...",options:["-n, --number number all output lines"," --help display this help and exit"]},b={number:{short:"n",long:"number",type:"boolean"}},w={name:"cat",async execute(t,r){if(m(t))return c(f);let e=d("cat",t,b);if(!e.ok)return e.error;let s=e.result.flags.number,o=e.result.positional,a=await p(r,o,{cmdName:"cat",allowStdinMarker:!0,stopOnError:!1}),n="",i=1;for(let{content:l}of a.files)if(s){let u=h(l,i);n+=u.content,i=u.nextLineNumber}else n+=l;return{stdout:n,stderr:a.stderr,exitCode:a.exitCode}}};function h(t,r){let e=t.split(`
2
+ import{a as p}from"./chunk-5WFYIUU2.js";import"./chunk-OBH7XN5N.js";import{a as d}from"./chunk-TA7RUHGQ.js";import{a as c,b as m}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var f={name:"cat",summary:"concatenate files and print on the standard output",usage:"cat [OPTION]... [FILE]...",options:["-n, --number number all output lines"," --help display this help and exit"]},b={number:{short:"n",long:"number",type:"boolean"}},w={name:"cat",async execute(t,r){if(m(t))return c(f);let e=d("cat",t,b);if(!e.ok)return e.error;let s=e.result.flags.number,o=e.result.positional,a=await p(r,o,{cmdName:"cat",allowStdinMarker:!0,stopOnError:!1}),n="",i=1;for(let{content:l}of a.files)if(s){let u=h(l,i);n+=u.content,i=u.nextLineNumber}else n+=l;return{stdout:n,stderr:a.stderr,exitCode:a.exitCode}}};function h(t,r){let e=t.split(`
3
3
  `),s=t.endsWith(`
4
4
  `),o=s?e.slice(0,-1):e;return{content:o.map((n,i)=>`${String(r+i).padStart(6," ")} ${n}`).join(`
5
5
  `)+(s?`
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- async function w(t,n,s){let{cmdName:r,allowStdinMarker:f=!0,stopOnError:a=!1,batchSize:u=100}=s;if(n.length===0)return{files:[{filename:"",content:t.stdin}],stderr:"",exitCode:0};let i=[],c="",l=0;for(let o=0;o<n.length;o+=u){let d=n.slice(o,o+u),m=await Promise.all(d.map(async e=>{if(f&&e==="-")return{filename:"-",content:t.stdin,error:null};try{let h=t.fs.resolvePath(t.cwd,e),p=await t.fs.readFile(h);return{filename:e,content:p,error:null}}catch{return{filename:e,content:"",error:`${r}: ${e}: No such file or directory
3
- `}}}));for(let e of m)if(e.error){if(c+=e.error,l=1,a)return{files:i,stderr:c,exitCode:l}}else i.push({filename:e.filename,content:e.content})}return{files:i,stderr:c,exitCode:l}}async function E(t,n,s){let r=await w(t,n,{...s,stopOnError:!0});return r.exitCode!==0?{ok:!1,error:{stdout:"",stderr:r.stderr,exitCode:r.exitCode}}:{ok:!0,content:r.files.map(a=>a.content).join("")}}export{w as a,E as b};
2
+ async function y(t,n,s){let{cmdName:r,allowStdinMarker:f=!0,stopOnError:a=!1,batchSize:u=100}=s;if(n.length===0)return{files:[{filename:"",content:t.stdin}],stderr:"",exitCode:0};let i=[],c="",l=0;for(let o=0;o<n.length;o+=u){let d=n.slice(o,o+u),m=await Promise.all(d.map(async e=>{if(f&&e==="-")return{filename:"-",content:t.stdin,error:null};try{let h=t.fs.resolvePath(t.cwd,e),p=await t.fs.readFile(h,"binary");return{filename:e,content:p,error:null}}catch{return{filename:e,content:"",error:`${r}: ${e}: No such file or directory
3
+ `}}}));for(let e of m)if(e.error){if(c+=e.error,l=1,a)return{files:i,stderr:c,exitCode:l}}else i.push({filename:e.filename,content:e.content})}return{files:i,stderr:c,exitCode:l}}async function b(t,n,s){let r=await y(t,n,{...s,stopOnError:!0});return r.exitCode!==0?{ok:!1,error:{stdout:"",stderr:r.stderr,exitCode:r.exitCode}}:{ok:!0,content:r.files.map(a=>a.content).join("")}}export{y as a,b};
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env node
2
+ function A(r,l,u={}){let{invertMatch:f=!1,showLineNumbers:c=!1,countOnly:B=!1,countMatches:j=!1,filename:a="",onlyMatching:T=!1,beforeContext:N=0,afterContext:v=0,maxCount:w=0,contextSeparator:P="--",showColumn:M=!1,vimgrep:z=!1,showByteOffset:b=!1,replace:p=null,passthru:g=!1,multiline:R=!1}=u;if(R)return D(r,l,{invertMatch:f,showLineNumbers:c,countOnly:B,countMatches:j,filename:a,onlyMatching:T,beforeContext:N,afterContext:v,maxCount:w,contextSeparator:P,showColumn:M,showByteOffset:b,replace:p});let d=r.split(`
3
+ `),S=d.length,y=S>0&&d[S-1]===""?S-1:S;if(B||j){let i=0;for(let e=0;e<y;e++)if(l.lastIndex=0,j)for(let t=l.exec(d[e]);t!==null;t=l.exec(d[e]))f||i++,t[0].length===0&&l.lastIndex++;else l.test(d[e])!==f&&i++;return{output:`${a?`${a}:${i}`:String(i)}
4
+ `,matched:i>0,matchCount:i}}if(N===0&&v===0&&!g){let i=[],o=!1,e=0,t=0;for(let s=0;s<y&&!(w>0&&e>=w);s++){let L=d[s];if(l.lastIndex=0,l.test(L)!==f)if(o=!0,e++,T){l.lastIndex=0;for(let h=l.exec(L);h!==null;h=l.exec(L)){let I=p!==null?p:h[0],k=a?`${a}:`:"";b&&(k+=`${t+h.index}:`),c&&(k+=`${s+1}:`),M&&(k+=`${h.index+1}:`),i.push(k+I),h[0].length===0&&l.lastIndex++}}else if(z){l.lastIndex=0;for(let h=l.exec(L);h!==null;h=l.exec(L)){let I=a?`${a}:`:"";b&&(I+=`${t+h.index}:`),c&&(I+=`${s+1}:`),M&&(I+=`${h.index+1}:`),i.push(I+L),h[0].length===0&&l.lastIndex++}}else{l.lastIndex=0;let h=l.exec(L),I=h?h.index+1:1,k=L;p!==null&&(l.lastIndex=0,k=L.replace(l,p));let E=a?`${a}:`:"";b&&(E+=`${t+(h?h.index:0)}:`),c&&(E+=`${s+1}:`),M&&(E+=`${I}:`),i.push(E+k)}t+=L.length+1}return{output:i.length>0?`${i.join(`
5
+ `)}
6
+ `:"",matched:o,matchCount:e}}if(g){let i=[],o=!1,e=0;for(let t=0;t<y;t++){let s=d[t];l.lastIndex=0;let O=l.test(s)!==f;O&&(o=!0,e++);let h=O?":":"-",I=a?`${a}${h}`:"";c&&(I+=`${t+1}${h}`),i.push(I+s)}return{output:i.length>0?`${i.join(`
7
+ `)}
8
+ `:"",matched:o,matchCount:e}}let $=[],C=0,m=new Set,x=-1,n=[];for(let i=0;i<y&&!(w>0&&C>=w);i++)l.lastIndex=0,l.test(d[i])!==f&&(n.push(i),C++);for(let i of n){let o=Math.max(0,i-N);x>=0&&o>x+1&&$.push(P);for(let t=o;t<i;t++)if(!m.has(t)){m.add(t),x=t;let s=d[t];c&&(s=`${t+1}-${s}`),a&&(s=`${a}-${s}`),$.push(s)}if(!m.has(i)){m.add(i),x=i;let t=d[i];if(T){l.lastIndex=0;for(let s=l.exec(t);s!==null;s=l.exec(t)){let L=p!==null?p:s[0],O=a?`${a}:`:"";c&&(O+=`${i+1}:`),M&&(O+=`${s.index+1}:`),$.push(O+L),s[0].length===0&&l.lastIndex++}}else{let s=t;c&&(s=`${i+1}:${s}`),a&&(s=`${a}:${s}`),$.push(s)}}let e=Math.min(y-1,i+v);for(let t=i+1;t<=e;t++)if(!m.has(t)){m.add(t),x=t;let s=d[t];c&&(s=`${t+1}-${s}`),a&&(s=`${a}-${s}`),$.push(s)}}return{output:$.length>0?`${$.join(`
9
+ `)}
10
+ `:"",matched:C>0,matchCount:C}}function D(r,l,u){let{invertMatch:f,showLineNumbers:c,countOnly:B,countMatches:j,filename:a,onlyMatching:T,beforeContext:N,afterContext:v,maxCount:w,contextSeparator:P,showColumn:M,showByteOffset:z,replace:b}=u,p=r.split(`
11
+ `),g=p.length,R=g>0&&p[g-1]===""?g-1:g,d=[0];for(let n=0;n<r.length;n++)r[n]===`
12
+ `&&d.push(n+1);let S=n=>{let i=0;for(let o=0;o<d.length&&!(d[o]>n);o++)i=o;return i},y=n=>{let i=S(n);return n-d[i]+1},$=[];l.lastIndex=0;for(let n=l.exec(r);n!==null&&!(w>0&&$.length>=w);n=l.exec(r)){let i=S(n.index),o=S(n.index+Math.max(0,n[0].length-1));$.push({startLine:i,endLine:o,byteOffset:n.index,column:y(n.index),matchText:n[0]}),n[0].length===0&&l.lastIndex++}if(B||j){let n;if(j)n=f?0:$.length;else{let o=new Set;for(let e of $)for(let t=e.startLine;t<=e.endLine;t++)o.add(t);n=f?R-o.size:o.size}return{output:`${a?`${a}:${n}`:String(n)}
13
+ `,matched:n>0,matchCount:n}}if(f){let n=new Set;for(let o of $)for(let e=o.startLine;e<=o.endLine;e++)n.add(e);let i=[];for(let o=0;o<R;o++)if(!n.has(o)){let e=p[o];c&&(e=`${o+1}:${e}`),a&&(e=`${a}:${e}`),i.push(e)}return{output:i.length>0?`${i.join(`
14
+ `)}
15
+ `:"",matched:i.length>0,matchCount:i.length}}if($.length===0)return{output:"",matched:!1,matchCount:0};let C=new Set,m=-1,x=[];for(let n of $){let i=Math.max(0,n.startLine-N),o=Math.min(R-1,n.endLine+v);m>=0&&i>m+1&&x.push(P);for(let e=i;e<n.startLine;e++)if(!C.has(e)){C.add(e),m=e;let t=p[e];c&&(t=`${e+1}-${t}`),a&&(t=`${a}-${t}`),x.push(t)}if(T){let e=b!==null?b:n.matchText,t=a?`${a}:`:"";z&&(t+=`${n.byteOffset}:`),c&&(t+=`${n.startLine+1}:`),M&&(t+=`${n.column}:`),x.push(t+e);for(let s=n.startLine;s<=n.endLine;s++)C.add(s),m=s}else for(let e=n.startLine;e<=n.endLine&&e<R;e++)if(!C.has(e)){C.add(e),m=e;let t=p[e];b!==null&&e===n.startLine&&(l.lastIndex=0,t=t.replace(l,b));let s=a?`${a}:`:"";z&&e===n.startLine&&(s+=`${n.byteOffset}:`),c&&(s+=`${e+1}:`),M&&e===n.startLine&&(s+=`${n.column}:`),x.push(s+t)}for(let e=n.endLine+1;e<=o;e++)if(!C.has(e)){C.add(e),m=e;let t=p[e];c&&(t=`${e+1}-${t}`),a&&(t=`${a}-${t}`),x.push(t)}}return{output:x.length>0?`${x.join(`
16
+ `)}
17
+ `:"",matched:!0,matchCount:$.length}}function F(r,l){let u;switch(l.mode){case"fixed":u=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");break;case"extended":case"perl":u=r;break;default:u=G(r);break}l.wholeWord&&(u=`(?<![\\w])(?:${u})(?![\\w])`),l.lineRegexp&&(u=`^${u}$`);let f=`g${l.ignoreCase?"i":""}${l.multilineDotall?"s":""}`;return new RegExp(u,f)}function G(r){let l="",u=0;for(;u<r.length;){let f=r[u];if(f==="\\"&&u+1<r.length){let c=r[u+1];if(c==="|"||c==="("||c===")"){l+=c,u+=2;continue}else if(c==="{"||c==="}"){l+=`\\${c}`,u+=2;continue}}f==="+"||f==="?"||f==="|"||f==="("||f===")"||f==="{"||f==="}"?l+=`\\${f}`:l+=f,u++}return l}export{A as a,F as b};
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
- import{a as U,b as m,c as F}from"./chunk-GTNBSMZR.js";var C={sha1:"SHA-1",sha256:"SHA-256"};function L(n){function h(a,u){return a<<u|a>>>32-u}let p=new Uint32Array([3614090360,3905402710,606105819,3250441966,4118548399,1200080426,2821735955,4249261313,1770035416,2336552879,4294925233,2304563134,1804603682,4254626195,2792965006,1236535329,4129170786,3225465664,643717713,3921069994,3593408605,38016083,3634488961,3889429448,568446438,3275163606,4107603335,1163531501,2850285829,4243563512,1735328473,2368359562,4294588738,2272392833,1839030562,4259657740,2763975236,1272893353,4139469664,3200236656,681279174,3936430074,3572445317,76029189,3654602809,3873151461,530742520,3299628645,4096336452,1126891415,2878612391,4237533241,1700485571,2399980690,4293915773,2240044497,1873313359,4264355552,2734768916,1309151649,4149444226,3174756917,718787259,3951481745]),g=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],A=n.length*8,o=(n.length%64<56?56:120)-n.length%64,s=new Uint8Array(n.length+o+8);s.set(n),s[n.length]=128;let d=new DataView(s.buffer);d.setUint32(s.length-8,A>>>0,!0),d.setUint32(s.length-4,Math.floor(A/4294967296),!0);let b=1732584193,l=4023233417,w=2562383102,e=271733878;for(let a=0;a<s.length;a+=64){let u=new Uint32Array(16);for(let t=0;t<16;t++)u[t]=d.getUint32(a+t*4,!0);let $=b,r=l,x=w,c=e;for(let t=0;t<64;t++){let i,y;t<16?(i=r&x|~r&c,y=t):t<32?(i=c&r|~c&x,y=(5*t+1)%16):t<48?(i=r^x^c,y=(3*t+5)%16):(i=x^(r|~c),y=7*t%16),i=i+$+p[t]+u[y]>>>0,$=c,c=x,x=r,r=r+h(i,g[t])>>>0}b=b+$>>>0,l=l+r>>>0,w=w+x>>>0,e=e+c>>>0}let f=new Uint8Array(16);return new DataView(f.buffer).setUint32(0,b,!0),new DataView(f.buffer).setUint32(4,l,!0),new DataView(f.buffer).setUint32(8,w,!0),new DataView(f.buffer).setUint32(12,e,!0),Array.from(f).map(a=>a.toString(16).padStart(2,"0")).join("")}async function k(n,h){if(n==="md5")return L(h);let p=await globalThis.crypto.subtle.digest(C[n],new Uint8Array(h).buffer);return Array.from(new Uint8Array(p)).map(g=>g.toString(16).padStart(2,"0")).join("")}function S(n,h,p){let g={name:n,summary:p,usage:`${n} [OPTION]... [FILE]...`,options:["-c, --check read checksums from FILEs and check them"," --help display this help and exit"]};return{name:n,async execute(A,o){if(m(A))return U(g);let s=!1,d=[];for(let e of A)if(e==="-c"||e==="--check")s=!0;else if(!(e==="-b"||e==="-t"||e==="--binary"||e==="--text")){if(e.startsWith("-")&&e!=="-")return F(n,e);d.push(e)}d.length===0&&d.push("-");let b=async e=>{if(e==="-")return new TextEncoder().encode(o.stdin);try{return await o.fs.readFileBuffer(o.fs.resolvePath(o.cwd,e))}catch{return null}};if(s){let e=0,f="";for(let a of d){let u=a==="-"?o.stdin:await o.fs.readFile(o.fs.resolvePath(o.cwd,a)).catch(()=>null);if(u===null)return{stdout:"",stderr:`${n}: ${a}: No such file or directory
3
- `,exitCode:1};for(let $ of u.split(`
4
- `)){let r=$.match(/^([a-fA-F0-9]+)\s+[* ]?(.+)$/);if(!r)continue;let[,x,c]=r,t=await b(c);if(t===null){f+=`${c}: FAILED open or read
5
- `,e++;continue}let i=await k(h,t)===x.toLowerCase();f+=`${c}: ${i?"OK":"FAILED"}
2
+ import{a as $,b as m,c as C}from"./chunk-GTNBSMZR.js";var k={sha1:"SHA-1",sha256:"SHA-256"};function L(n){function h(a,u){return a<<u|a>>>32-u}let p=new Uint32Array([3614090360,3905402710,606105819,3250441966,4118548399,1200080426,2821735955,4249261313,1770035416,2336552879,4294925233,2304563134,1804603682,4254626195,2792965006,1236535329,4129170786,3225465664,643717713,3921069994,3593408605,38016083,3634488961,3889429448,568446438,3275163606,4107603335,1163531501,2850285829,4243563512,1735328473,2368359562,4294588738,2272392833,1839030562,4259657740,2763975236,1272893353,4139469664,3200236656,681279174,3936430074,3572445317,76029189,3654602809,3873151461,530742520,3299628645,4096336452,1126891415,2878612391,4237533241,1700485571,2399980690,4293915773,2240044497,1873313359,4264355552,2734768916,1309151649,4149444226,3174756917,718787259,3951481745]),A=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],g=n.length*8,o=(n.length%64<56?56:120)-n.length%64,s=new Uint8Array(n.length+o+8);s.set(n),s[n.length]=128;let d=new DataView(s.buffer);d.setUint32(s.length-8,g>>>0,!0),d.setUint32(s.length-4,Math.floor(g/4294967296),!0);let b=1732584193,l=4023233417,w=2562383102,e=271733878;for(let a=0;a<s.length;a+=64){let u=new Uint32Array(16);for(let t=0;t<16;t++)u[t]=d.getUint32(a+t*4,!0);let y=b,r=l,x=w,c=e;for(let t=0;t<64;t++){let i,U;t<16?(i=r&x|~r&c,U=t):t<32?(i=c&r|~c&x,U=(5*t+1)%16):t<48?(i=r^x^c,U=(3*t+5)%16):(i=x^(r|~c),U=7*t%16),i=i+y+p[t]+u[U]>>>0,y=c,c=x,x=r,r=r+h(i,A[t])>>>0}b=b+y>>>0,l=l+r>>>0,w=w+x>>>0,e=e+c>>>0}let f=new Uint8Array(16);return new DataView(f.buffer).setUint32(0,b,!0),new DataView(f.buffer).setUint32(4,l,!0),new DataView(f.buffer).setUint32(8,w,!0),new DataView(f.buffer).setUint32(12,e,!0),Array.from(f).map(a=>a.toString(16).padStart(2,"0")).join("")}async function F(n,h){if(n==="md5")return L(h);let p=await globalThis.crypto.subtle.digest(k[n],new Uint8Array(h).buffer);return Array.from(new Uint8Array(p)).map(A=>A.toString(16).padStart(2,"0")).join("")}function S(n,h,p){let A={name:n,summary:p,usage:`${n} [OPTION]... [FILE]...`,options:["-c, --check read checksums from FILEs and check them"," --help display this help and exit"]};return{name:n,async execute(g,o){if(m(g))return $(A);let s=!1,d=[];for(let e of g)if(e==="-c"||e==="--check")s=!0;else if(!(e==="-b"||e==="-t"||e==="--binary"||e==="--text")){if(e.startsWith("-")&&e!=="-")return C(n,e);d.push(e)}d.length===0&&d.push("-");let b=async e=>{if(e==="-")return Uint8Array.from(o.stdin,f=>f.charCodeAt(0));try{return await o.fs.readFileBuffer(o.fs.resolvePath(o.cwd,e))}catch{return null}};if(s){let e=0,f="";for(let a of d){let u=a==="-"?o.stdin:await o.fs.readFile(o.fs.resolvePath(o.cwd,a)).catch(()=>null);if(u===null)return{stdout:"",stderr:`${n}: ${a}: No such file or directory
3
+ `,exitCode:1};for(let y of u.split(`
4
+ `)){let r=y.match(/^([a-fA-F0-9]+)\s+[* ]?(.+)$/);if(!r)continue;let[,x,c]=r,t=await b(c);if(t===null){f+=`${c}: FAILED open or read
5
+ `,e++;continue}let i=await F(h,t)===x.toLowerCase();f+=`${c}: ${i?"OK":"FAILED"}
6
6
  `,i||e++}}return e>0&&(f+=`${n}: WARNING: ${e} computed checksum${e>1?"s":""} did NOT match
7
7
  `),{stdout:f,stderr:"",exitCode:e>0?1:0}}let l="",w=0;for(let e of d){let f=await b(e);if(f===null){l+=`${n}: ${e}: No such file or directory
8
- `,w=1;continue}l+=`${await k(h,f)} ${e}
8
+ `,w=1;continue}l+=`${await F(h,f)} ${e}
9
9
  `}return{stdout:l,stderr:"",exitCode:w}}}}export{S as a};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{b as x}from"./chunk-45SNFRCY.js";import"./chunk-OBH7XN5N.js";import{a as y,b as I,c as m}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var W={name:"cut",summary:"remove sections from each line of files",usage:"cut [OPTION]... [FILE]...",options:["-c LIST select only these characters","-d DELIM use DELIM instead of TAB for field delimiter","-f LIST select only these fields","-s, --only-delimited do not print lines without delimiters"," --help display this help and exit"]};function k(t){let c=[],l=t.split(",");for(let n of l)if(n.includes("-")){let[s,r]=n.split("-");c.push({start:s?parseInt(s,10):1,end:r?parseInt(r,10):null})}else{let s=parseInt(n,10);c.push({start:s,end:s})}return c}function C(t,c){let l=[];for(let n of c){let s=n.start-1,r=n.end===null?t.length:n.end;for(let i=s;i<r&&i<t.length;i++)i>=0&&!l.includes(t[i])&&l.push(t[i])}return l}var E={name:"cut",async execute(t,c){if(I(t))return y(W);let l=" ",n=null,s=null,r=!1,i=[];for(let o=0;o<t.length;o++){let e=t[o];if(e==="-d")l=t[++o]||" ";else if(e.startsWith("-d"))l=e.slice(2);else if(e==="-f")n=t[++o];else if(e.startsWith("-f"))n=e.slice(2);else if(e==="-c")s=t[++o];else if(e.startsWith("-c"))s=e.slice(2);else if(e==="-s"||e==="--only-delimited")r=!0;else{if(e.startsWith("--"))return m("cut",e);if(e.startsWith("-")){let f=!1;for(let u of e.slice(1))if(u==="s")r=!0;else if(!"dfc".includes(u)){f=!0;break}if(f)return m("cut",e)}else i.push(e)}}if(!n&&!s)return{stdout:"",stderr:`cut: you must specify a list of bytes, characters, or fields
2
+ import{b as x}from"./chunk-5WFYIUU2.js";import"./chunk-OBH7XN5N.js";import{a as y,b as I,c as m}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var W={name:"cut",summary:"remove sections from each line of files",usage:"cut [OPTION]... [FILE]...",options:["-c LIST select only these characters","-d DELIM use DELIM instead of TAB for field delimiter","-f LIST select only these fields","-s, --only-delimited do not print lines without delimiters"," --help display this help and exit"]};function k(t){let c=[],l=t.split(",");for(let n of l)if(n.includes("-")){let[s,r]=n.split("-");c.push({start:s?parseInt(s,10):1,end:r?parseInt(r,10):null})}else{let s=parseInt(n,10);c.push({start:s,end:s})}return c}function C(t,c){let l=[];for(let n of c){let s=n.start-1,r=n.end===null?t.length:n.end;for(let i=s;i<r&&i<t.length;i++)i>=0&&!l.includes(t[i])&&l.push(t[i])}return l}var E={name:"cut",async execute(t,c){if(I(t))return y(W);let l=" ",n=null,s=null,r=!1,i=[];for(let o=0;o<t.length;o++){let e=t[o];if(e==="-d")l=t[++o]||" ";else if(e.startsWith("-d"))l=e.slice(2);else if(e==="-f")n=t[++o];else if(e.startsWith("-f"))n=e.slice(2);else if(e==="-c")s=t[++o];else if(e.startsWith("-c"))s=e.slice(2);else if(e==="-s"||e==="--only-delimited")r=!0;else{if(e.startsWith("--"))return m("cut",e);if(e.startsWith("-")){let f=!1;for(let u of e.slice(1))if(u==="s")r=!0;else if(!"dfc".includes(u)){f=!0;break}if(f)return m("cut",e)}else i.push(e)}}if(!n&&!s)return{stdout:"",stderr:`cut: you must specify a list of bytes, characters, or fields
3
3
  `,exitCode:1};let p=await x(c,i,{cmdName:"cut"});if(!p.ok)return p.error;let a=p.content.split(`
4
4
  `);a.length>0&&a[a.length-1]===""&&a.pop();let g=k(n||s||"1"),h="";for(let o of a)if(s){let e=o.split(""),f=[];for(let u of g){let w=u.start-1,L=u.end===null?e.length:u.end;for(let d=w;d<L&&d<e.length;d++)d>=0&&f.push(e[d])}h+=`${f.join("")}
5
5
  `}else{if(r&&!o.includes(l))continue;let e=o.split(l),f=C(e,g);h+=`${f.join(l)}
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env node
2
+ import{a as y}from"./chunk-26Q3PZQ6.js";import{a as S,b as j}from"./chunk-X4WRNADE.js";import{a as Z,b as _,c as L}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var ee={name:"grep",summary:"print lines that match patterns",usage:"grep [OPTION]... PATTERN [FILE]...",options:["-E, --extended-regexp PATTERN is an extended regular expression","-P, --perl-regexp PATTERN is a Perl regular expression","-F, --fixed-strings PATTERN is a set of newline-separated strings","-i, --ignore-case ignore case distinctions","-v, --invert-match select non-matching lines","-w, --word-regexp match only whole words","-x, --line-regexp match only whole lines","-c, --count print only a count of matching lines","-l, --files-with-matches print only names of files with matches","-L, --files-without-match print names of files with no matches","-m NUM, --max-count=NUM stop after NUM matches","-n, --line-number print line number with output lines","-h, --no-filename suppress the file name prefix on output","-o, --only-matching show only nonempty parts of lines that match","-q, --quiet, --silent suppress all normal output","-r, -R, --recursive search directories recursively","-A NUM print NUM lines of trailing context","-B NUM print NUM lines of leading context","-C NUM print NUM lines of context","-e PATTERN use PATTERN for matching"," --include=GLOB search only files matching GLOB"," --exclude=GLOB skip files matching GLOB"," --exclude-dir=DIR skip directories matching DIR"," --help display this help and exit"]},z={name:"grep",async execute(t,s){if(_(t))return Z(ee);let o=!1,f=!1,c=!1,p=!1,m=!1,l=!1,i=!1,d=!1,w=!1,u=!1,h=!1,T=!1,x=!1,q=!1,B=!1,W=0,F=0,N=0,R=[],A=[],Q=[],$=null,I=[];for(let r=0;r<t.length;r++){let n=t[r];if(n.startsWith("-")&&n!=="-"){if(n==="-e"&&r+1<t.length){$=t[++r];continue}if(n.startsWith("--include=")){R.push(n.slice(10));continue}if(n.startsWith("--exclude=")){A.push(n.slice(10));continue}if(n.startsWith("--exclude-dir=")){Q.push(n.slice(14));continue}if(n.startsWith("--max-count=")){W=parseInt(n.slice(12),10);continue}let C=n.match(/^-m(\d+)$/);if(C){W=parseInt(C[1],10);continue}if(n==="-m"&&r+1<t.length){W=parseInt(t[++r],10);continue}let a=n.match(/^-([ABC])(\d+)$/);if(a){let e=parseInt(a[2],10);a[1]==="A"?N=e:a[1]==="B"?F=e:a[1]==="C"&&(F=e,N=e);continue}if((n==="-A"||n==="-B"||n==="-C")&&r+1<t.length){let e=parseInt(t[++r],10);n==="-A"?N=e:n==="-B"?F=e:(F=e,N=e);continue}let g=n.startsWith("--")?[n]:n.slice(1).split("");for(let e of g)if(e==="i"||e==="--ignore-case")o=!0;else if(e==="n"||e==="--line-number")f=!0;else if(e==="v"||e==="--invert-match")c=!0;else if(e==="c"||e==="--count")p=!0;else if(e==="l"||e==="--files-with-matches")m=!0;else if(e==="L"||e==="--files-without-match")l=!0;else if(e==="r"||e==="R"||e==="--recursive")i=!0;else if(e==="w"||e==="--word-regexp")d=!0;else if(e==="x"||e==="--line-regexp")w=!0;else if(e==="E"||e==="--extended-regexp")u=!0;else if(e==="P"||e==="--perl-regexp")h=!0;else if(e==="F"||e==="--fixed-strings")T=!0;else if(e==="o"||e==="--only-matching")x=!0;else if(e==="h"||e==="--no-filename")q=!0;else if(e==="q"||e==="--quiet"||e==="--silent")B=!0;else{if(e.startsWith("--"))return L("grep",e);if(e.length===1)return L("grep",`-${e}`)}}else $===null?$=n:I.push(n)}if($===null)return{stdout:"",stderr:`grep: missing pattern
3
+ `,exitCode:2};let K=T?"fixed":u?"extended":h?"perl":"basic",U;try{U=j($,{mode:K,ignoreCase:o,wholeWord:d,lineRegexp:w})}catch{return{stdout:"",stderr:`grep: invalid regular expression: ${$}
4
+ `,exitCode:2}}if(I.length===0&&s.stdin){let r=S(s.stdin,U,{invertMatch:c,showLineNumbers:f,countOnly:p,filename:"",onlyMatching:x,beforeContext:F,afterContext:N,maxCount:W});return B?{stdout:"",stderr:"",exitCode:r.matched?0:1}:{stdout:r.output,stderr:"",exitCode:r.matched?0:1}}if(I.length===0)return{stdout:"",stderr:`grep: no input files
5
+ `,exitCode:2};let v="",D="",G=!1,H=!1,P=[];for(let r of I)if(r.includes("*")||r.includes("?")||r.includes("[")){let n=await te(r,s);if(i)for(let C of n){let a=await O(C.path,s,R,A,Q,C.isFile);P.push(...a)}else P.push(...n)}else if(i){let n=await O(r,s,R,A,Q);P.push(...n)}else P.push({path:r});let V=(P.length>1||i)&&!q,k=50;for(let r=0;r<P.length;r+=k){let n=P.slice(r,r+k),C=await Promise.all(n.map(async a=>{let g=a.path,e=g.split("/").pop()||g;if(A.length>0&&!i&&A.some(M=>y(e,M,{stripQuotes:!0}))||R.length>0&&!i&&!R.some(M=>y(e,M,{stripQuotes:!0})))return null;try{let M=s.fs.resolvePath(s.cwd,g),b=!1;if(a.isFile===void 0?b=(await s.fs.stat(M)).isDirectory:b=!a.isFile,b)return i?null:{error:`grep: ${g}: Is a directory
6
+ `};let X=await s.fs.readFile(M),Y=S(X,U,{invertMatch:c,showLineNumbers:f,countOnly:p,filename:V?g:"",onlyMatching:x,beforeContext:F,afterContext:N,maxCount:W});return{file:g,result:Y}}catch{return{error:`grep: ${g}: No such file or directory
7
+ `}}}));for(let a of C){if(a===null)continue;if("error"in a&&a.error){D+=a.error,a.error.includes("Is a directory")||(H=!0);continue}if(!("file"in a)||!a.result)continue;let{file:g,result:e}=a;if(e.matched){if(G=!0,B)return{stdout:"",stderr:"",exitCode:0};m?v+=`${g}
8
+ `:l||(v+=e.output)}else l?v+=`${g}
9
+ `:p&&!m&&(v+=e.output)}}let E;return H?E=2:l?E=v.length>0?0:1:E=G?0:1,B?{stdout:"",stderr:"",exitCode:E}:{stdout:v,stderr:D,exitCode:E}}};async function J(t,s,o,f){let c=o.fs.resolvePath(o.cwd,t);try{if(!(await o.fs.stat(c)).isDirectory){let l=t.split("/").pop()||"";if(s){let i=s.replace(/^\//,"");y(l,i,{stripQuotes:!0})&&f.push(t)}return}let m=await o.fs.readdir(c);for(let l of m){let i=t==="."?l:`${t}/${l}`,d=o.fs.resolvePath(o.cwd,i);if((await o.fs.stat(d)).isDirectory)await J(i,s,o,f);else if(s){let u=s.replace(/^\//,"");y(l,u,{stripQuotes:!0})&&f.push(i)}}}catch{}}async function te(t,s){let o=[],f=t.lastIndexOf("/"),c,p;if(f===-1?(c=s.cwd,p=t):(c=t.slice(0,f)||"/",p=t.slice(f+1)),t.includes("**")){let l=[],i=t.split("**"),d=i[0].replace(/\/$/,"")||".",w=i[1]||"";return await J(d,w,s,l),l.map(u=>({path:u}))}let m=s.fs.resolvePath(s.cwd,c);try{if(s.fs.readdirWithFileTypes){let l=await s.fs.readdirWithFileTypes(m);for(let i of l)if(y(i.name,p,{stripQuotes:!0})){let d=f===-1?i.name:`${c}/${i.name}`;o.push({path:d,isFile:i.isFile})}}else{let l=await s.fs.readdir(m);for(let i of l)if(y(i,p,{stripQuotes:!0})){let d=f===-1?i:`${c}/${i}`;o.push({path:d})}}}catch{}return o.sort((l,i)=>l.path.localeCompare(i.path))}async function O(t,s,o=[],f=[],c=[],p){let m=s.fs.resolvePath(s.cwd,t),l=[];try{let i,d;if(p!==void 0)i=p,d=!p;else{let u=await s.fs.stat(m);i=u.isFile,d=u.isDirectory}if(i){let u=t.split("/").pop()||t;return f.length>0&&f.some(h=>y(u,h,{stripQuotes:!0}))?[]:o.length>0&&!o.some(h=>y(u,h,{stripQuotes:!0}))?[]:[{path:t,isFile:!0}]}if(!d)return[];let w=t.split("/").pop()||t;if(c.length>0&&c.some(u=>y(w,u,{stripQuotes:!0})))return[];if(s.fs.readdirWithFileTypes){let u=await s.fs.readdirWithFileTypes(m);for(let h of u){if(h.name.startsWith("."))continue;let T=t==="."?h.name:`${t}/${h.name}`,x=await O(T,s,o,f,c,h.isFile);l.push(...x)}}else{let u=await s.fs.readdir(m);for(let h of u){if(h.startsWith("."))continue;let T=t==="."?h:`${t}/${h}`,x=await O(T,s,o,f,c);l.push(...x)}}}catch{}return l}var le={name:"fgrep",async execute(t,s){return z.execute(["-F",...t],s)}},oe={name:"egrep",async execute(t,s){return z.execute(["-E",...t],s)}};export{oe as egrepCommand,le as fgrepCommand,z as grepCommand};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{a as z}from"./chunk-TA7RUHGQ.js";import{a as w,b as $}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";import{constants as x,gunzipSync as C,gzipSync as b}from"node:zlib";var I={name:"gzip",summary:"compress or expand files",usage:"gzip [OPTION]... [FILE]...",description:`Compress FILEs (by default, in-place).
2
+ import{a as z}from"./chunk-TA7RUHGQ.js";import{a as $,b as w}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";import{constants as C,gunzipSync as x,gzipSync as b}from"node:zlib";var I={name:"gzip",summary:"compress or expand files",usage:"gzip [OPTION]... [FILE]...",description:`Compress FILEs (by default, in-place).
3
3
 
4
4
  When no FILE is given, or when FILE is -, read from standard input.
5
5
 
@@ -7,26 +7,26 @@ With -d, decompress instead.`,options:["-c, --stdout write to standard outp
7
7
 
8
8
  When no FILE is given, or when FILE is -, read from standard input.`,options:["-c, --stdout write to standard output, keep original files","-f, --force force overwrite of output file","-k, --keep keep (don't delete) input files","-l, --list list compressed file contents","-n, --no-name do not restore the original name and timestamp","-N, --name restore the original file name and timestamp","-q, --quiet suppress all warnings","-r, --recursive operate recursively on directories","-S, --suffix=SUF use suffix SUF on compressed files (default: .gz)","-t, --test test compressed file integrity","-v, --verbose verbose mode"," --help display this help and exit"]},P={name:"zcat",summary:"decompress files to stdout",usage:"zcat [OPTION]... [FILE]...",description:`Decompress FILEs to standard output.
9
9
 
10
- When no FILE is given, or when FILE is -, read from standard input.`,options:["-f, --force force; read compressed data even from a terminal","-l, --list list compressed file contents","-q, --quiet suppress all warnings","-S, --suffix=SUF use suffix SUF on compressed files (default: .gz)","-t, --test test compressed file integrity","-v, --verbose verbose mode"," --help display this help and exit"]},D={stdout:{short:"c",long:"stdout",type:"boolean"},toStdout:{long:"to-stdout",type:"boolean"},decompress:{short:"d",long:"decompress",type:"boolean"},uncompress:{long:"uncompress",type:"boolean"},force:{short:"f",long:"force",type:"boolean"},keep:{short:"k",long:"keep",type:"boolean"},list:{short:"l",long:"list",type:"boolean"},noName:{short:"n",long:"no-name",type:"boolean"},name:{short:"N",long:"name",type:"boolean"},quiet:{short:"q",long:"quiet",type:"boolean"},recursive:{short:"r",long:"recursive",type:"boolean"},suffix:{short:"S",long:"suffix",type:"string",default:".gz"},test:{short:"t",long:"test",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"},fast:{short:"1",long:"fast",type:"boolean"},level2:{short:"2",type:"boolean"},level3:{short:"3",type:"boolean"},level4:{short:"4",type:"boolean"},level5:{short:"5",type:"boolean"},level6:{short:"6",type:"boolean"},level7:{short:"7",type:"boolean"},level8:{short:"8",type:"boolean"},best:{short:"9",long:"best",type:"boolean"}};function F(e){return e.best?x.Z_BEST_COMPRESSION:e.level8?8:e.level7?7:e.level6?6:e.level5?5:e.level4?4:e.level3?3:e.level2?2:e.fast?x.Z_BEST_SPEED:x.Z_DEFAULT_COMPRESSION}function S(e){if(e.length<10)return{originalName:null,mtime:null,headerSize:0};if(e[0]!==31||e[1]!==139)return{originalName:null,mtime:null,headerSize:0};let t=e[3],o=e[4]|e[5]<<8|e[6]<<16|e[7]<<24,r=10;if(t&4){if(r+2>e.length)return{originalName:null,mtime:null,headerSize:0};let n=e[r]|e[r+1]<<8;r+=2+n}let s=null;if(t&8){let n=r;for(;r<e.length&&e[r]!==0;)r++;r<e.length&&(s=new TextDecoder().decode(e.slice(n,r)),r++)}if(t&16){for(;r<e.length&&e[r]!==0;)r++;r++}return t&2&&(r+=2),{originalName:s,mtime:o>0?new Date(o*1e3):null,headerSize:r}}function L(e){if(e.length<4)return 0;let t=e.length;return e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24}function y(e){return e.length>=2&&e[0]===31&&e[1]===139}async function E(e,t,o,r,s,n){let u=o.suffix,c,p,d;if(t==="-"||t==="")if(d=new TextEncoder().encode(e.stdin),s){if(!y(d))return o.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: stdin: not in gzip format
11
- `,exitCode:1};try{let l=C(d);return{stdout:new TextDecoder().decode(l),stderr:"",exitCode:0}}catch(l){let i=l instanceof Error?l.message:"unknown error";return{stdout:"",stderr:`${r}: stdin: ${i}
12
- `,exitCode:1}}}else{let l=F(o),i=b(d,{level:l});return{stdout:String.fromCharCode(...i),stderr:"",exitCode:0}}c=e.fs.resolvePath(e.cwd,t);try{if((await e.fs.stat(c)).isDirectory)return o.recursive?await k(e,c,o,r,s,n):o.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: ${t}: is a directory -- ignored
10
+ When no FILE is given, or when FILE is -, read from standard input.`,options:["-f, --force force; read compressed data even from a terminal","-l, --list list compressed file contents","-q, --quiet suppress all warnings","-S, --suffix=SUF use suffix SUF on compressed files (default: .gz)","-t, --test test compressed file integrity","-v, --verbose verbose mode"," --help display this help and exit"]},L={stdout:{short:"c",long:"stdout",type:"boolean"},toStdout:{long:"to-stdout",type:"boolean"},decompress:{short:"d",long:"decompress",type:"boolean"},uncompress:{long:"uncompress",type:"boolean"},force:{short:"f",long:"force",type:"boolean"},keep:{short:"k",long:"keep",type:"boolean"},list:{short:"l",long:"list",type:"boolean"},noName:{short:"n",long:"no-name",type:"boolean"},name:{short:"N",long:"name",type:"boolean"},quiet:{short:"q",long:"quiet",type:"boolean"},recursive:{short:"r",long:"recursive",type:"boolean"},suffix:{short:"S",long:"suffix",type:"string",default:".gz"},test:{short:"t",long:"test",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"},fast:{short:"1",long:"fast",type:"boolean"},level2:{short:"2",type:"boolean"},level3:{short:"3",type:"boolean"},level4:{short:"4",type:"boolean"},level5:{short:"5",type:"boolean"},level6:{short:"6",type:"boolean"},level7:{short:"7",type:"boolean"},level8:{short:"8",type:"boolean"},best:{short:"9",long:"best",type:"boolean"}};function F(e){return e.best?C.Z_BEST_COMPRESSION:e.level8?8:e.level7?7:e.level6?6:e.level5?5:e.level4?4:e.level3?3:e.level2?2:e.fast?C.Z_BEST_SPEED:C.Z_DEFAULT_COMPRESSION}function S(e){if(e.length<10)return{originalName:null,mtime:null,headerSize:0};if(e[0]!==31||e[1]!==139)return{originalName:null,mtime:null,headerSize:0};let t=e[3],o=e[4]|e[5]<<8|e[6]<<16|e[7]<<24,r=10;if(t&4){if(r+2>e.length)return{originalName:null,mtime:null,headerSize:0};let s=e[r]|e[r+1]<<8;r+=2+s}let n=null;if(t&8){let s=r;for(;r<e.length&&e[r]!==0;)r++;r<e.length&&(n=new TextDecoder().decode(e.slice(s,r)),r++)}if(t&16){for(;r<e.length&&e[r]!==0;)r++;r++}return t&2&&(r+=2),{originalName:n,mtime:o>0?new Date(o*1e3):null,headerSize:r}}function D(e){if(e.length<4)return 0;let t=e.length;return e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24}function y(e){return e.length>=2&&e[0]===31&&e[1]===139}async function E(e,t,o,r,n,s){let u=o.suffix,f,p,l;if(t==="-"||t==="")if(l=Uint8Array.from(e.stdin,d=>d.charCodeAt(0)),n){if(!y(l))return o.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: stdin: not in gzip format
11
+ `,exitCode:1};try{let d=x(l);return{stdout:String.fromCharCode(...d),stderr:"",exitCode:0}}catch(d){let i=d instanceof Error?d.message:"unknown error";return{stdout:"",stderr:`${r}: stdin: ${i}
12
+ `,exitCode:1}}}else{let d=F(o),i=b(l,{level:d});return{stdout:String.fromCharCode(...i),stderr:"",exitCode:0}}f=e.fs.resolvePath(e.cwd,t);try{if((await e.fs.stat(f)).isDirectory)return o.recursive?await k(e,f,o,r,n,s):o.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: ${t}: is a directory -- ignored
13
13
  `,exitCode:1}}catch{return{stdout:"",stderr:`${r}: ${t}: No such file or directory
14
- `,exitCode:1}}try{d=await e.fs.readFileBuffer(c)}catch{return{stdout:"",stderr:`${r}: ${t}: No such file or directory
15
- `,exitCode:1}}if(s){if(!t.endsWith(u))return o.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: ${t}: unknown suffix -- ignored
16
- `,exitCode:1};if(!y(d))return o.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: ${t}: not in gzip format
17
- `,exitCode:1};let l;try{l=C(d)}catch(i){let f=i instanceof Error?i.message:"unknown error";return{stdout:"",stderr:`${r}: ${t}: ${f}
18
- `,exitCode:1}}if(n)return{stdout:new TextDecoder().decode(l),stderr:"",exitCode:0};if(o.name){let i=S(d);i.originalName?p=e.fs.resolvePath(e.cwd,i.originalName):p=c.slice(0,-u.length)}else p=c.slice(0,-u.length);if(!o.force)try{return await e.fs.stat(p),{stdout:"",stderr:`${r}: ${p} already exists; not overwritten
19
- `,exitCode:1}}catch{}if(await e.fs.writeFile(p,l),!o.keep&&!n&&await e.fs.rm(c),o.verbose){let i=d.length>0?((1-d.length/l.length)*100).toFixed(1):"0.0";return{stdout:"",stderr:`${t}: ${i}% -- replaced with ${p.split("/").pop()}
14
+ `,exitCode:1}}try{l=await e.fs.readFileBuffer(f)}catch{return{stdout:"",stderr:`${r}: ${t}: No such file or directory
15
+ `,exitCode:1}}if(n){if(!t.endsWith(u))return o.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: ${t}: unknown suffix -- ignored
16
+ `,exitCode:1};if(!y(l))return o.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: ${t}: not in gzip format
17
+ `,exitCode:1};let d;try{d=x(l)}catch(i){let c=i instanceof Error?i.message:"unknown error";return{stdout:"",stderr:`${r}: ${t}: ${c}
18
+ `,exitCode:1}}if(s)return{stdout:String.fromCharCode(...d),stderr:"",exitCode:0};if(o.name){let i=S(l);i.originalName?p=e.fs.resolvePath(e.cwd,i.originalName):p=f.slice(0,-u.length)}else p=f.slice(0,-u.length);if(!o.force)try{return await e.fs.stat(p),{stdout:"",stderr:`${r}: ${p} already exists; not overwritten
19
+ `,exitCode:1}}catch{}if(await e.fs.writeFile(p,d),!o.keep&&!s&&await e.fs.rm(f),o.verbose){let i=l.length>0?((1-l.length/d.length)*100).toFixed(1):"0.0";return{stdout:"",stderr:`${t}: ${i}% -- replaced with ${p.split("/").pop()}
20
20
  `,exitCode:0}}return{stdout:"",stderr:"",exitCode:0}}else{if(t.endsWith(u))return o.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: ${t} already has ${u} suffix -- unchanged
21
- `,exitCode:1};let l=F(o),i;try{i=b(d,{level:l})}catch(f){let a=f instanceof Error?f.message:"unknown error";return{stdout:"",stderr:`${r}: ${t}: ${a}
22
- `,exitCode:1}}if(n)return{stdout:String.fromCharCode(...i),stderr:"",exitCode:0};if(p=c+u,!o.force)try{return await e.fs.stat(p),{stdout:"",stderr:`${r}: ${p} already exists; not overwritten
23
- `,exitCode:1}}catch{}if(await e.fs.writeFile(p,i),!o.keep&&!n&&await e.fs.rm(c),o.verbose){let f=d.length>0?((1-i.length/d.length)*100).toFixed(1):"0.0";return{stdout:"",stderr:`${t}: ${f}% -- replaced with ${p.split("/").pop()}
24
- `,exitCode:0}}return{stdout:"",stderr:"",exitCode:0}}}async function k(e,t,o,r,s,n){let u=await e.fs.readdir(t),c="",p="",d=0;for(let l of u){let i=e.fs.resolvePath(t,l),f=await e.fs.stat(i);if(f.isDirectory){let a=await k(e,i,o,r,s,n);c+=a.stdout,p+=a.stderr,a.exitCode!==0&&(d=a.exitCode)}else if(f.isFile){let a=o.suffix;if(s&&!l.endsWith(a)||!s&&l.endsWith(a))continue;let m=i.startsWith(`${e.cwd}/`)?i.slice(e.cwd.length+1):i,g=await E(e,m,o,r,s,n);c+=g.stdout,p+=g.stderr,g.exitCode!==0&&(d=g.exitCode)}}return{stdout:c,stderr:p,exitCode:d}}async function T(e,t,o,r){let s;if(t==="-"||t==="")s=new TextEncoder().encode(e.stdin);else{let i=e.fs.resolvePath(e.cwd,t);try{s=await e.fs.readFileBuffer(i)}catch{return{stdout:"",stderr:`${r}: ${t}: No such file or directory
25
- `,exitCode:1}}}if(!y(s))return o.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: ${t}: not in gzip format
26
- `,exitCode:1};let n=s.length,u=L(s),c=u>0?((1-n/u)*100).toFixed(1):"0.0",d=S(s).originalName||(t==="-"?"":t.replace(/\.gz$/,""));return{stdout:`${n.toString().padStart(10)} ${u.toString().padStart(10)} ${c.padStart(5)}% ${d}
27
- `,stderr:"",exitCode:0}}async function O(e,t,o,r){let s;if(t==="-"||t==="")s=new TextEncoder().encode(e.stdin);else{let n=e.fs.resolvePath(e.cwd,t);try{s=await e.fs.readFileBuffer(n)}catch{return{stdout:"",stderr:`${r}: ${t}: No such file or directory
28
- `,exitCode:1}}}if(!y(s))return o.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: ${t}: not in gzip format
29
- `,exitCode:1};try{return C(s),o.verbose?{stdout:"",stderr:`${t}: OK
30
- `,exitCode:0}:{stdout:"",stderr:"",exitCode:0}}catch(n){let u=n instanceof Error?n.message:"invalid";return{stdout:"",stderr:`${r}: ${t}: ${u}
31
- `,exitCode:1}}}async function v(e,t,o){let r=o==="zcat"?P:o==="gunzip"?q:I;if($(e))return w(r);let s=z(o,e,D);if(!s.ok)return s.error.stderr.includes("unrecognized option"),s.error;let n=s.result.flags,u=s.result.positional,c=o==="gunzip"||o==="zcat"||n.decompress||n.uncompress,p=o==="zcat"||n.stdout||n.toStdout;if(n.list){u.length===0&&(u=["-"]);let f=` compressed uncompressed ratio uncompressed_name
32
- `,a="",m=0;for(let g of u){let h=await T(t,g,n,o);f+=h.stdout,a+=h.stderr,h.exitCode!==0&&(m=h.exitCode)}return{stdout:f,stderr:a,exitCode:m}}if(n.test){u.length===0&&(u=["-"]);let f="",a="",m=0;for(let g of u){let h=await O(t,g,n,o);f+=h.stdout,a+=h.stderr,h.exitCode!==0&&(m=h.exitCode)}return{stdout:f,stderr:a,exitCode:m}}u.length===0&&(u=["-"]);let d="",l="",i=0;for(let f of u){let a=await E(t,f,n,o,c,p);d+=a.stdout,l+=a.stderr,a.exitCode!==0&&(i=a.exitCode)}return{stdout:d,stderr:l,exitCode:i}}var H={name:"gzip",async execute(e,t){return v(e,t,"gzip")}},B={name:"gunzip",async execute(e,t){return v(e,t,"gunzip")}},G={name:"zcat",async execute(e,t){return v(e,t,"zcat")}};export{B as gunzipCommand,H as gzipCommand,G as zcatCommand};
21
+ `,exitCode:1};let d=F(o),i;try{i=b(l,{level:d})}catch(c){let a=c instanceof Error?c.message:"unknown error";return{stdout:"",stderr:`${r}: ${t}: ${a}
22
+ `,exitCode:1}}if(s)return{stdout:String.fromCharCode(...i),stderr:"",exitCode:0};if(p=f+u,!o.force)try{return await e.fs.stat(p),{stdout:"",stderr:`${r}: ${p} already exists; not overwritten
23
+ `,exitCode:1}}catch{}if(await e.fs.writeFile(p,i),!o.keep&&!s&&await e.fs.rm(f),o.verbose){let c=l.length>0?((1-i.length/l.length)*100).toFixed(1):"0.0";return{stdout:"",stderr:`${t}: ${c}% -- replaced with ${p.split("/").pop()}
24
+ `,exitCode:0}}return{stdout:"",stderr:"",exitCode:0}}}async function k(e,t,o,r,n,s){let u=await e.fs.readdir(t),f="",p="",l=0;for(let d of u){let i=e.fs.resolvePath(t,d),c=await e.fs.stat(i);if(c.isDirectory){let a=await k(e,i,o,r,n,s);f+=a.stdout,p+=a.stderr,a.exitCode!==0&&(l=a.exitCode)}else if(c.isFile){let a=o.suffix;if(n&&!d.endsWith(a)||!n&&d.endsWith(a))continue;let m=i.startsWith(`${e.cwd}/`)?i.slice(e.cwd.length+1):i,g=await E(e,m,o,r,n,s);f+=g.stdout,p+=g.stderr,g.exitCode!==0&&(l=g.exitCode)}}return{stdout:f,stderr:p,exitCode:l}}async function O(e,t,o,r){let n;if(t==="-"||t==="")n=Uint8Array.from(e.stdin,i=>i.charCodeAt(0));else{let i=e.fs.resolvePath(e.cwd,t);try{n=await e.fs.readFileBuffer(i)}catch{return{stdout:"",stderr:`${r}: ${t}: No such file or directory
25
+ `,exitCode:1}}}if(!y(n))return o.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: ${t}: not in gzip format
26
+ `,exitCode:1};let s=n.length,u=D(n),f=u>0?((1-s/u)*100).toFixed(1):"0.0",l=S(n).originalName||(t==="-"?"":t.replace(/\.gz$/,""));return{stdout:`${s.toString().padStart(10)} ${u.toString().padStart(10)} ${f.padStart(5)}% ${l}
27
+ `,stderr:"",exitCode:0}}async function U(e,t,o,r){let n;if(t==="-"||t==="")n=Uint8Array.from(e.stdin,s=>s.charCodeAt(0));else{let s=e.fs.resolvePath(e.cwd,t);try{n=await e.fs.readFileBuffer(s)}catch{return{stdout:"",stderr:`${r}: ${t}: No such file or directory
28
+ `,exitCode:1}}}if(!y(n))return o.quiet?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`${r}: ${t}: not in gzip format
29
+ `,exitCode:1};try{return x(n),o.verbose?{stdout:"",stderr:`${t}: OK
30
+ `,exitCode:0}:{stdout:"",stderr:"",exitCode:0}}catch(s){let u=s instanceof Error?s.message:"invalid";return{stdout:"",stderr:`${r}: ${t}: ${u}
31
+ `,exitCode:1}}}async function v(e,t,o){let r=o==="zcat"?P:o==="gunzip"?q:I;if(w(e))return $(r);let n=z(o,e,L);if(!n.ok)return n.error.stderr.includes("unrecognized option"),n.error;let s=n.result.flags,u=n.result.positional,f=o==="gunzip"||o==="zcat"||s.decompress||s.uncompress,p=o==="zcat"||s.stdout||s.toStdout;if(s.list){u.length===0&&(u=["-"]);let c=` compressed uncompressed ratio uncompressed_name
32
+ `,a="",m=0;for(let g of u){let h=await O(t,g,s,o);c+=h.stdout,a+=h.stderr,h.exitCode!==0&&(m=h.exitCode)}return{stdout:c,stderr:a,exitCode:m}}if(s.test){u.length===0&&(u=["-"]);let c="",a="",m=0;for(let g of u){let h=await U(t,g,s,o);c+=h.stdout,a+=h.stderr,h.exitCode!==0&&(m=h.exitCode)}return{stdout:c,stderr:a,exitCode:m}}u.length===0&&(u=["-"]);let l="",d="",i=0;for(let c of u){let a=await E(t,c,s,o,f,p);l+=a.stdout,d+=a.stderr,a.exitCode!==0&&(i=a.exitCode)}return{stdout:l,stderr:d,exitCode:i}}var _={name:"gzip",async execute(e,t){return v(e,t,"gzip")}},H={name:"gunzip",async execute(e,t){return v(e,t,"gunzip")}},B={name:"zcat",async execute(e,t){return v(e,t,"zcat")}};export{H as gunzipCommand,_ as gzipCommand,B as zcatCommand};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{a as w,b as J}from"./chunk-ACRTDIBO.js";import{i as q}from"./chunk-NWWB2XRE.js";import{a as N}from"./chunk-45SNFRCY.js";import"./chunk-OBH7XN5N.js";import{a as C,b as E,c as x}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";function I(s){let i=[],t=0,o=s.length;for(;t<o;){for(;t<o&&/\s/.test(s[t]);)t++;if(t>=o)break;let a=t,r=s[t];if(r==="{"||r==="["){let n=r,l=r==="{"?"}":"]",c=1,p=!1,d=!1;for(t++;t<o&&c>0;){let h=s[t];d?d=!1:h==="\\"?d=!0:h==='"'?p=!p:p||(h===n?c++:h===l&&c--),t++}if(c!==0)throw new Error(`Unexpected end of JSON input at position ${t} (unclosed ${n})`);i.push(JSON.parse(s.slice(a,t)))}else if(r==='"'){let n=!1;for(t++;t<o;){let l=s[t];if(n)n=!1;else if(l==="\\")n=!0;else if(l==='"'){t++;break}t++}i.push(JSON.parse(s.slice(a,t)))}else if(r==="-"||r>="0"&&r<="9"){for(;t<o&&/[\d.eE+-]/.test(s[t]);)t++;i.push(JSON.parse(s.slice(a,t)))}else if(s.slice(t,t+4)==="true")i.push(!0),t+=4;else if(s.slice(t,t+5)==="false")i.push(!1),t+=5;else if(s.slice(t,t+4)==="null")i.push(null),t+=4;else{let n=s.slice(t,t+10);throw new Error(`Invalid JSON at position ${a}: unexpected '${n.split(/\s/)[0]}'`)}}return i}var H={name:"jq",summary:"command-line JSON processor",usage:"jq [OPTIONS] FILTER [FILE]",options:["-r, --raw-output output strings without quotes","-c, --compact compact output (no pretty printing)","-e, --exit-status set exit status based on output","-s, --slurp read entire input into array","-n, --null-input don't read any input","-j, --join-output don't print newlines after each output","-a, --ascii force ASCII output","-S, --sort-keys sort object keys","-C, --color colorize output (ignored)","-M, --monochrome monochrome output (ignored)"," --tab use tabs for indentation"," --help display this help and exit"]};function g(s,i,t,o,a,r=0){if(s===null||s===void 0)return"null";if(typeof s=="boolean")return String(s);if(typeof s=="number")return Number.isFinite(s)?String(s):"null";if(typeof s=="string")return t?s:JSON.stringify(s);let n=a?" ":" ";if(Array.isArray(s))return s.length===0?"[]":i?`[${s.map(c=>g(c,!0,!1,o,a)).join(",")}]`:`[
2
+ import{a as w,b as J}from"./chunk-ACRTDIBO.js";import{i as q}from"./chunk-NWWB2XRE.js";import{a as N}from"./chunk-5WFYIUU2.js";import"./chunk-OBH7XN5N.js";import{a as C,b as E,c as x}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";function I(s){let i=[],t=0,o=s.length;for(;t<o;){for(;t<o&&/\s/.test(s[t]);)t++;if(t>=o)break;let a=t,r=s[t];if(r==="{"||r==="["){let n=r,l=r==="{"?"}":"]",c=1,p=!1,d=!1;for(t++;t<o&&c>0;){let h=s[t];d?d=!1:h==="\\"?d=!0:h==='"'?p=!p:p||(h===n?c++:h===l&&c--),t++}if(c!==0)throw new Error(`Unexpected end of JSON input at position ${t} (unclosed ${n})`);i.push(JSON.parse(s.slice(a,t)))}else if(r==='"'){let n=!1;for(t++;t<o;){let l=s[t];if(n)n=!1;else if(l==="\\")n=!0;else if(l==='"'){t++;break}t++}i.push(JSON.parse(s.slice(a,t)))}else if(r==="-"||r>="0"&&r<="9"){for(;t<o&&/[\d.eE+-]/.test(s[t]);)t++;i.push(JSON.parse(s.slice(a,t)))}else if(s.slice(t,t+4)==="true")i.push(!0),t+=4;else if(s.slice(t,t+5)==="false")i.push(!1),t+=5;else if(s.slice(t,t+4)==="null")i.push(null),t+=4;else{let n=s.slice(t,t+10);throw new Error(`Invalid JSON at position ${a}: unexpected '${n.split(/\s/)[0]}'`)}}return i}var H={name:"jq",summary:"command-line JSON processor",usage:"jq [OPTIONS] FILTER [FILE]",options:["-r, --raw-output output strings without quotes","-c, --compact compact output (no pretty printing)","-e, --exit-status set exit status based on output","-s, --slurp read entire input into array","-n, --null-input don't read any input","-j, --join-output don't print newlines after each output","-a, --ascii force ASCII output","-S, --sort-keys sort object keys","-C, --color colorize output (ignored)","-M, --monochrome monochrome output (ignored)"," --tab use tabs for indentation"," --help display this help and exit"]};function g(s,i,t,o,a,r=0){if(s===null||s===void 0)return"null";if(typeof s=="boolean")return String(s);if(typeof s=="number")return Number.isFinite(s)?String(s):"null";if(typeof s=="string")return t?s:JSON.stringify(s);let n=a?" ":" ";if(Array.isArray(s))return s.length===0?"[]":i?`[${s.map(c=>g(c,!0,!1,o,a)).join(",")}]`:`[
3
3
  ${s.map(c=>n.repeat(r+1)+g(c,!1,!1,o,a,r+1)).join(`,
4
4
  `)}
5
5
  ${n.repeat(r)}]`;if(typeof s=="object"){let l=Object.keys(s);return o&&(l=l.sort()),l.length===0?"{}":i?`{${l.map(p=>`${JSON.stringify(p)}:${g(s[p],!0,!1,o,a)}`).join(",")}}`:`{
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{a as m}from"./chunk-GX4MPCG6.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var o=m("md5sum","md5","compute MD5 message digest");export{o as md5sumCommand};
2
+ import{a as m}from"./chunk-Y5QKO4KO.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var o=m("md5sum","md5","compute MD5 message digest");export{o as md5sumCommand};
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env node
2
+ import{a as O,b as R}from"./chunk-X4WRNADE.js";import{a as E,b as _,c as k}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var j={js:{extensions:[".js",".mjs",".cjs",".jsx"],globs:[]},ts:{extensions:[".ts",".tsx",".mts",".cts"],globs:[]},html:{extensions:[".html",".htm",".xhtml"],globs:[]},css:{extensions:[".css",".scss",".sass",".less"],globs:[]},json:{extensions:[".json",".jsonc",".json5"],globs:[]},xml:{extensions:[".xml",".xsl",".xslt"],globs:[]},c:{extensions:[".c",".h"],globs:[]},cpp:{extensions:[".cpp",".cc",".cxx",".hpp",".hh",".hxx",".h"],globs:[]},rust:{extensions:[".rs"],globs:[]},go:{extensions:[".go"],globs:[]},zig:{extensions:[".zig"],globs:[]},java:{extensions:[".java"],globs:[]},kotlin:{extensions:[".kt",".kts"],globs:[]},scala:{extensions:[".scala",".sc"],globs:[]},clojure:{extensions:[".clj",".cljc",".cljs",".edn"],globs:[]},py:{extensions:[".py",".pyi",".pyw"],globs:[]},rb:{extensions:[".rb",".rake",".gemspec"],globs:["Rakefile","Gemfile"]},php:{extensions:[".php",".phtml",".php3",".php4",".php5"],globs:[]},perl:{extensions:[".pl",".pm",".pod",".t"],globs:[]},lua:{extensions:[".lua"],globs:[]},sh:{extensions:[".sh",".bash",".zsh",".fish"],globs:[".bashrc",".zshrc",".profile"]},bat:{extensions:[".bat",".cmd"],globs:[]},ps:{extensions:[".ps1",".psm1",".psd1"],globs:[]},yaml:{extensions:[".yaml",".yml"],globs:[]},toml:{extensions:[".toml"],globs:["Cargo.toml","pyproject.toml"]},ini:{extensions:[".ini",".cfg",".conf"],globs:[]},csv:{extensions:[".csv",".tsv"],globs:[]},md:{extensions:[".md",".markdown",".mdown",".mkd"],globs:[]},rst:{extensions:[".rst"],globs:[]},txt:{extensions:[".txt",".text"],globs:[]},tex:{extensions:[".tex",".ltx",".sty",".cls"],globs:[]},sql:{extensions:[".sql"],globs:[]},graphql:{extensions:[".graphql",".gql"],globs:[]},proto:{extensions:[".proto"],globs:[]},make:{extensions:[".mk",".mak"],globs:["Makefile","GNUmakefile","makefile"]},docker:{extensions:[],globs:["Dockerfile","Dockerfile.*","*.dockerfile"]},tf:{extensions:[".tf",".tfvars"],globs:[]}};function P(e,t){let r=e.toLowerCase();for(let s of t){let n=j[s];if(n){for(let i of n.extensions)if(r.endsWith(i))return!0;for(let i of n.globs)if(i.includes("*")){let l=i.replace(/\./g,"\\.").replace(/\*/g,".*");if(new RegExp(`^${l}$`,"i").test(e))return!0}else if(r===i.toLowerCase())return!0}}return!1}function B(){let e=[];for(let[t,r]of Object.entries(j).sort()){let s=[];for(let n of r.extensions)s.push(`*${n}`);for(let n of r.globs)s.push(n);e.push(`${t}: ${s.join(", ")}`)}return`${e.join(`
3
+ `)}
4
+ `}function A(){return{ignoreCase:!1,caseSensitive:!1,smartCase:!0,fixedStrings:!1,wordRegexp:!1,lineRegexp:!1,invertMatch:!1,multiline:!1,patterns:[],patternFiles:[],count:!1,countMatches:!1,filesWithMatches:!1,filesWithoutMatch:!1,onlyMatching:!1,maxCount:0,lineNumber:!0,noFilename:!1,nullSeparator:!1,byteOffset:!1,column:!1,vimgrep:!1,replace:null,afterContext:0,beforeContext:0,contextSeparator:"--",quiet:!1,heading:!1,passthru:!1,includeZero:!1,sort:"path",json:!1,globs:[],types:[],typesNot:[],hidden:!1,noIgnore:!1,maxDepth:1/0,followSymlinks:!1,searchZip:!1,searchBinary:!1}}function U(e){return j[e]?null:{stdout:"",stderr:`rg: unknown type: ${e}
5
+ Use --type-list to see available types.
6
+ `,exitCode:1}}var J=[{short:"g",long:"glob",target:"globs",multi:!0},{short:"t",long:"type",target:"types",multi:!0,validate:U},{short:"T",long:"type-not",target:"typesNot",multi:!0,validate:U},{short:"m",long:"max-count",target:"maxCount",parse:parseInt},{short:"e",long:"regexp",target:"patterns",multi:!0},{short:"f",long:"file",target:"patternFiles",multi:!0},{short:"r",long:"replace",target:"replace"},{long:"max-depth",target:"maxDepth",parse:parseInt},{long:"context-separator",target:"contextSeparator"}],H={i:e=>{e.ignoreCase=!0,e.caseSensitive=!1,e.smartCase=!1},"--ignore-case":e=>{e.ignoreCase=!0,e.caseSensitive=!1,e.smartCase=!1},s:e=>{e.caseSensitive=!0,e.ignoreCase=!1,e.smartCase=!1},"--case-sensitive":e=>{e.caseSensitive=!0,e.ignoreCase=!1,e.smartCase=!1},S:e=>{e.smartCase=!0,e.ignoreCase=!1,e.caseSensitive=!1},"--smart-case":e=>{e.smartCase=!0,e.ignoreCase=!1,e.caseSensitive=!1},F:e=>{e.fixedStrings=!0},"--fixed-strings":e=>{e.fixedStrings=!0},w:e=>{e.wordRegexp=!0},"--word-regexp":e=>{e.wordRegexp=!0},x:e=>{e.lineRegexp=!0},"--line-regexp":e=>{e.lineRegexp=!0},v:e=>{e.invertMatch=!0},"--invert-match":e=>{e.invertMatch=!0},U:e=>{e.multiline=!0},"--multiline":e=>{e.multiline=!0},c:e=>{e.count=!0},"--count":e=>{e.count=!0},"--count-matches":e=>{e.countMatches=!0},l:e=>{e.filesWithMatches=!0},"--files-with-matches":e=>{e.filesWithMatches=!0},"--files-without-match":e=>{e.filesWithoutMatch=!0},o:e=>{e.onlyMatching=!0},"--only-matching":e=>{e.onlyMatching=!0},q:e=>{e.quiet=!0},"--quiet":e=>{e.quiet=!0},N:e=>{e.lineNumber=!1},"--no-line-number":e=>{e.lineNumber=!1},I:e=>{e.noFilename=!0},"--no-filename":e=>{e.noFilename=!0},0:e=>{e.nullSeparator=!0},"--null":e=>{e.nullSeparator=!0},b:e=>{e.byteOffset=!0},"--byte-offset":e=>{e.byteOffset=!0},"--column":e=>{e.column=!0,e.lineNumber=!0},"--vimgrep":e=>{e.vimgrep=!0,e.column=!0,e.lineNumber=!0},"--json":e=>{e.json=!0},"--hidden":e=>{e.hidden=!0},"--no-ignore":e=>{e.noIgnore=!0},L:e=>{e.followSymlinks=!0},"--follow":e=>{e.followSymlinks=!0},z:e=>{e.searchZip=!0},"--search-zip":e=>{e.searchZip=!0},a:e=>{e.searchBinary=!0},"--text":e=>{e.searchBinary=!0},"--heading":e=>{e.heading=!0},"--passthru":e=>{e.passthru=!0},"--include-zero":e=>{e.includeZero=!0}},V=new Set(["n","--line-number"]);function X(e){e.hidden?e.searchBinary=!0:e.noIgnore?e.hidden=!0:e.noIgnore=!0}function K(e,t,r){let s=e[t];for(let n of J){if(s.startsWith(`--${n.long}=`)){let i=s.slice(`--${n.long}=`.length),l=D(r,n,i);return l?{newIndex:t,error:l}:{newIndex:t}}if(n.short&&s===`-${n.short}`||s===`--${n.long}`){if(t+1>=e.length)return null;let i=e[t+1],l=D(r,n,i);return l?{newIndex:t+1,error:l}:{newIndex:t+1}}}return null}function D(e,t,r){if(t.validate){let n=t.validate(r);if(n)return n}let s=t.parse?t.parse(r):r;t.multi?e[t.target].push(s):e[t.target]=s}function Q(e,t){let r=e[t];if(r==="--sort"&&t+1<e.length){let s=e[t+1];if(s==="path"||s==="none")return{value:s,newIndex:t+1}}if(r.startsWith("--sort=")){let s=r.slice(7);if(s==="path"||s==="none")return{value:s,newIndex:t}}return null}function ee(e,t){let r=e[t],s=r.match(/^-([ABC])(\d+)$/);return s?{flag:s[1],value:parseInt(s[2],10),newIndex:t}:(r==="-A"||r==="-B"||r==="-C")&&t+1<e.length?{flag:r[1],value:parseInt(e[t+1],10),newIndex:t+1}:null}function te(e){let t=e.match(/^-m(\d+)$/);return t?parseInt(t[1],10):null}function q(e){let t=A(),r=null,s=[],n=-1,i=-1,l=-1,o=!1;for(let a=0;a<e.length;a++){let c=e[a];if(c.startsWith("-")&&c!=="-"){let u=ee(e,a);if(u){let{flag:f,value:m,newIndex:x}=u;f==="A"?n=Math.max(n,m):f==="B"?i=Math.max(i,m):l=m,a=x;continue}let h=te(c);if(h!==null){t.maxCount=h;continue}let d=K(e,a,t);if(d){if(d.error)return{success:!1,error:d.error};a=d.newIndex;continue}let g=Q(e,a);if(g){t.sort=g.value,a=g.newIndex;continue}let p=c.startsWith("--")?[c]:c.slice(1).split("");for(let f of p){if(V.has(f)){t.lineNumber=!0,o=!0;continue}if(f==="u"||f==="--unrestricted"){X(t);continue}let m=H[f];if(m){m(t);continue}if(f.startsWith("--"))return{success:!1,error:k("rg",f)};if(f.length===1)return{success:!1,error:k("rg",`-${f}`)}}}else r===null?r=c:s.push(c)}return(n>=0||l>=0)&&(t.afterContext=Math.max(n>=0?n:0,l>=0?l:0)),(i>=0||l>=0)&&(t.beforeContext=Math.max(i>=0?i:0,l>=0?l:0)),r!==null&&t.patterns.push(r),(t.column||t.vimgrep)&&(o=!0),{success:!0,options:t,paths:s,explicitLineNumbers:o}}import{gunzipSync as se}from"node:zlib";var W=class{patterns=[];basePath;constructor(t="/"){this.basePath=t}parse(t){let r=t.split(`
7
+ `);for(let s of r){let n=s.replace(/\s+$/,"");if(!n||n.startsWith("#"))continue;let i=!1;n.startsWith("!")&&(i=!0,n=n.slice(1));let l=!1;n.endsWith("/")&&(l=!0,n=n.slice(0,-1));let o=!1;n.startsWith("/")?(o=!0,n=n.slice(1)):n.includes("/")&&!n.startsWith("**/")&&(o=!0);let a=this.patternToRegex(n,o);this.patterns.push({pattern:s,regex:a,negated:i,directoryOnly:l,rooted:o})}}patternToRegex(t,r){let s="";r?s="^":s="(?:^|/)";let n=0;for(;n<t.length;){let i=t[n];if(i==="*")t[n+1]==="*"?t[n+2]==="/"?(s+="(?:.*/)?",n+=3):(n+2>=t.length,s+=".*",n+=2):(s+="[^/]*",n++);else if(i==="?")s+="[^/]",n++;else if(i==="["){let l=n+1;for(l<t.length&&t[l]==="!"&&l++,l<t.length&&t[l]==="]"&&l++;l<t.length&&t[l]!=="]";)l++;if(l<t.length){let o=t.slice(n,l+1);o.startsWith("[!")&&(o=`[^${o.slice(2)}`),s+=o,n=l+1}else s+="\\[",n++}else i==="/"?(s+="/",n++):(s+=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n++)}return s+="(?:/.*)?$",new RegExp(s)}matches(t,r){let s=t.replace(/^\.\//,"");s=s.replace(/^\//,"");let n=!1;for(let i of this.patterns)i.directoryOnly&&!r||i.regex.test(s)&&(n=!i.negated);return n}getBasePath(){return this.basePath}},M=class{parsers=[];fs;rootPath;constructor(t,r){this.fs=t,this.rootPath=r}async load(t){let r=[],s=t;for(;s.startsWith(this.rootPath)||s===this.rootPath;){r.unshift(s);let n=this.fs.resolvePath(s,"..");if(n===s)break;s=n}for(let n of r)for(let i of[".gitignore",".ignore"]){let l=this.fs.resolvePath(n,i);try{let o=await this.fs.readFile(l),a=new W(n);a.parse(o),this.parsers.push(a)}catch{}}}matches(t,r){for(let s of this.parsers){let n=s.getBasePath();if(!t.startsWith(n))continue;let i=t.slice(n.length).replace(/^\//,"");if(s.matches(i,r))return!0}return!1}static isCommonIgnored(t){return new Set(["node_modules",".git",".svn",".hg","__pycache__",".pytest_cache",".mypy_cache","venv",".venv","dist","build",".next",".nuxt","target",".cargo"]).has(t)}};async function z(e,t){let r=new M(e,t);return await r.load(t),r}function ne(e){return e.length>=2&&e[0]===31&&e[1]===139}async function G(e){let{ctx:t,options:r,paths:s,explicitLineNumbers:n}=e,i=[...r.patterns];for(let p of r.patternFiles)try{let f=t.fs.resolvePath(t.cwd,p),x=(await t.fs.readFile(f)).split(`
8
+ `).filter(y=>y.length>0);i.push(...x)}catch{return{stdout:"",stderr:`rg: ${p}: No such file or directory
9
+ `,exitCode:2}}if(i.length===0)return{stdout:"",stderr:`rg: no pattern given
10
+ `,exitCode:2};let l=s.length===0?["."]:s,o=re(r,i),a;try{a=ie(i,r,o)}catch{return{stdout:"",stderr:`rg: invalid regex: ${i.join(", ")}
11
+ `,exitCode:2}}let c=null;r.noIgnore||(c=await z(t.fs,t.cwd));let{files:u,singleExplicitFile:h}=await le(t,l,r,c);if(u.length===0)return{stdout:"",stderr:"",exitCode:1};let d=!r.noFilename&&(!h||u.length>1),g=r.lineNumber;return n||(h&&u.length===1&&(g=!1),r.onlyMatching&&(g=!1)),oe(t,u,a,r,d,g)}function re(e,t){return e.caseSensitive?!1:e.ignoreCase?!0:e.smartCase?!t.some(r=>/[A-Z]/.test(r)):!1}function ie(e,t,r){let s;return e.length===1?s=e[0]:s=e.map(n=>t.fixedStrings?n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"):`(?:${n})`).join("|"),R(s,{mode:t.fixedStrings&&e.length===1?"fixed":"perl",ignoreCase:r,wholeWord:t.wordRegexp,lineRegexp:t.lineRegexp,multiline:t.multiline})}async function le(e,t,r,s){let n=[],i=0,l=0;for(let a of t){let c=e.fs.resolvePath(e.cwd,a);try{let u=await e.fs.stat(c);u.isFile?(i++,Y(a,r,s,c)&&n.push(a)):u.isDirectory&&(l++,await Z(e,a,c,0,r,s,n))}catch{}}return{files:r.sort==="path"?n.sort():n,singleExplicitFile:i===1&&l===0}}async function Z(e,t,r,s,n,i,l){if(!(s>=n.maxDepth))try{let o=e.fs.readdirWithFileTypes?await e.fs.readdirWithFileTypes(r):(await e.fs.readdir(r)).map(a=>({name:a,isFile:void 0}));for(let a of o){let c=a.name;if(!n.hidden&&c.startsWith(".")||!n.noIgnore&&M.isCommonIgnored(c))continue;let u=t==="."?c:`${t}/${c}`,h=e.fs.resolvePath(r,c),d,g,p=!1;if(a.isFile!==void 0&&"isDirectory"in a){let m=a;if(p=m.isSymbolicLink===!0,p&&!n.followSymlinks)continue;if(p&&n.followSymlinks)try{let x=await e.fs.stat(h);d=x.isFile,g=x.isDirectory}catch{continue}else d=m.isFile,g=m.isDirectory}else try{let m=e.fs.lstat?await e.fs.lstat(h):await e.fs.stat(h);if(p=m.isSymbolicLink===!0,p&&!n.followSymlinks)continue;let x=p&&n.followSymlinks?await e.fs.stat(h):m;d=x.isFile,g=x.isDirectory}catch{continue}i?.matches(h,g)||(g?await Z(e,u,h,s+1,n,i,l):d&&Y(u,n,i,h)&&l.push(u))}}catch{}}function Y(e,t,r,s){let n=e.split("/").pop()||e;if(r?.matches(s,!1)||t.types.length>0&&!P(n,t.types)||t.typesNot.length>0&&P(n,t.typesNot))return!1;if(t.globs.length>0){let i=t.globs.filter(o=>!o.startsWith("!")),l=t.globs.filter(o=>o.startsWith("!")).map(o=>o.slice(1));if(i.length>0){let o=!1;for(let a of i)if(I(n,a)||I(e,a)){o=!0;break}if(!o)return!1}for(let o of l)if(o.startsWith("/")){let a=o.slice(1);if(I(e,a))return!1}else if(I(n,o)||I(e,o))return!1}return!0}function I(e,t){let r="^";for(let s=0;s<t.length;s++){let n=t[s];if(n==="*")t[s+1]==="*"?(r+=".*",s++):r+="[^/]*";else if(n==="?")r+="[^/]";else if(n==="["){let i=s+1;for(i<t.length&&t[i]==="!"&&i++,i<t.length&&t[i]==="]"&&i++;i<t.length&&t[i]!=="]";)i++;if(i<t.length){let l=t.slice(s,i+1);l.startsWith("[!")&&(l=`[^${l.slice(2)}`),r+=l,s=i}else r+="\\["}else r+=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}return r+="$",new RegExp(r).test(e)}async function ae(e,t,r,s){try{if(s.searchZip&&r.endsWith(".gz")){let l=await e.fs.readFileBuffer(t);if(ne(l))try{let o=se(l),a=new TextDecoder().decode(o),c=a.slice(0,8192);return{content:a,isBinary:c.includes("\0")}}catch{return null}}let n=await e.fs.readFile(t),i=n.slice(0,8192);return{content:n,isBinary:i.includes("\0")}}catch{return null}}async function oe(e,t,r,s,n,i){let l="",o=!1,a=[],c=0,u=0,h=0,d=50;e:for(let f=0;f<t.length;f+=d){let m=t.slice(f,f+d),x=await Promise.all(m.map(async y=>{let S=e.fs.resolvePath(e.cwd,y),w=await ae(e,S,y,s);if(!w)return null;let{content:b,isBinary:N}=w;if(h+=b.length,N&&!s.searchBinary)return null;let F=n&&!s.heading?y:"",C=O(b,r,{invertMatch:s.invertMatch,showLineNumbers:i,countOnly:s.count,countMatches:s.countMatches,filename:F,onlyMatching:s.onlyMatching,beforeContext:s.beforeContext,afterContext:s.afterContext,maxCount:s.maxCount,contextSeparator:s.contextSeparator,showColumn:s.column,vimgrep:s.vimgrep,showByteOffset:s.byteOffset,replace:s.replace,passthru:s.passthru,multiline:s.multiline});return s.json&&C.matched?{file:y,result:C,content:b,isBinary:!1}:{file:y,result:C}}));for(let y of x){if(!y)continue;let{file:S,result:w}=y;if(w.matched){if(o=!0,u++,c+=w.matchCount,s.quiet&&!s.json)break e;if(s.json&&!s.quiet){let b=y.content||"";a.push(JSON.stringify({type:"begin",data:{path:{text:S}}}));let N=b.split(`
12
+ `);r.lastIndex=0;let F=0;for(let C=0;C<N.length;C++){let $=N[C];r.lastIndex=0;let T=[];for(let v=r.exec($);v!==null;v=r.exec($)){let L={match:{text:v[0]},start:v.index,end:v.index+v[0].length};s.replace!==null&&(L.replacement={text:s.replace}),T.push(L),v[0].length===0&&r.lastIndex++}if(T.length>0){let v={type:"match",data:{path:{text:S},lines:{text:`${$}
13
+ `},line_number:C+1,absolute_offset:F,submatches:T}};a.push(JSON.stringify(v))}F+=$.length+1}a.push(JSON.stringify({type:"end",data:{path:{text:S},binary_offset:null,stats:{elapsed:{secs:0,nanos:0,human:"0s"},searches:1,searches_with_match:1,bytes_searched:b.length,bytes_printed:0,matched_lines:w.matchCount,matches:w.matchCount}}}))}else if(s.filesWithMatches){let b=s.nullSeparator?"\0":`
14
+ `;l+=`${S}${b}`}else s.filesWithoutMatch||(s.heading&&n&&(l+=`${S}
15
+ `),l+=w.output)}else if(s.filesWithoutMatch){let b=s.nullSeparator?"\0":`
16
+ `;l+=`${S}${b}`}else s.includeZero&&(s.count||s.countMatches)&&(l+=w.output)}}s.json&&(a.push(JSON.stringify({type:"summary",data:{elapsed_total:{secs:0,nanos:0,human:"0s"},stats:{elapsed:{secs:0,nanos:0,human:"0s"},searches:t.length,searches_with_match:u,bytes_searched:h,bytes_printed:0,matched_lines:c,matches:c}}})),l=`${a.join(`
17
+ `)}
18
+ `);let g=s.quiet&&!s.json?"":l,p;return s.filesWithoutMatch?p=l.length>0?0:1:p=o?0:1,{stdout:g,stderr:"",exitCode:p}}var ce={name:"rg",summary:"recursively search for a pattern",usage:"rg [OPTIONS] PATTERN [PATH ...]",description:`rg (ripgrep) recursively searches directories for a regex pattern.
19
+ Unlike grep, rg is recursive by default and respects .gitignore files.
20
+
21
+ EXAMPLES:
22
+ rg foo Search for 'foo' in current directory
23
+ rg foo src/ Search in src/ directory
24
+ rg -i foo Case-insensitive search
25
+ rg -w foo Match whole words only
26
+ rg -t js foo Search only JavaScript files
27
+ rg -g '*.ts' foo Search files matching glob
28
+ rg --hidden foo Include hidden files
29
+ rg -l foo List files with matches only`,options:["-e, --regexp PATTERN search for PATTERN (can be used multiple times)","-f, --file FILE read patterns from FILE, one per line","-i, --ignore-case case-insensitive search","-s, --case-sensitive case-sensitive search (overrides smart-case)","-S, --smart-case smart case (default: case-insensitive unless pattern has uppercase)","-F, --fixed-strings treat pattern as literal string","-w, --word-regexp match whole words only","-x, --line-regexp match whole lines only","-v, --invert-match select non-matching lines","-r, --replace TEXT replace matches with TEXT","-c, --count print count of matching lines per file"," --count-matches print count of individual matches per file","-l, --files-with-matches print only file names with matches"," --files-without-match print file names without matches","-o, --only-matching print only matching parts","-m, --max-count NUM stop after NUM matches per file","-q, --quiet suppress output, exit 0 on match","-n, --line-number print line numbers (default: on)","-N, --no-line-number do not print line numbers","-I, --no-filename suppress the prefixing of file names","-0, --null use NUL as filename separator","-b, --byte-offset show byte offset of each match"," --column show column number of first match"," --vimgrep show results in vimgrep format"," --json show results in JSON Lines format","-A NUM print NUM lines after each match","-B NUM print NUM lines before each match","-C NUM print NUM lines before and after each match"," --context-separator SEP separator for context groups (default: --)","-U, --multiline match patterns across lines","-z, --search-zip search in compressed files (gzip only)","-g, --glob GLOB include files matching GLOB","-t, --type TYPE only search files of TYPE (e.g., js, py, ts)","-T, --type-not TYPE exclude files of TYPE","-L, --follow follow symbolic links","-u, --unrestricted reduce filtering (-u: no ignore, -uu: +hidden, -uuu: +binary)","-a, --text search binary files as text"," --hidden search hidden files and directories"," --no-ignore don't respect .gitignore/.ignore files"," --max-depth NUM maximum search depth"," --sort TYPE sort files (path, none)"," --heading show file path above matches"," --passthru print all lines (non-matches use - separator)"," --include-zero include files with 0 matches in count output"," --type-list list all available file types"," --help display this help and exit"]},Ne={name:"rg",async execute(e,t){if(_(e))return E(ce);if(e.includes("--type-list"))return{stdout:B(),stderr:"",exitCode:0};let r=q(e);return r.success?G({ctx:t,options:r.options,paths:r.paths,explicitLineNumbers:r.explicitLineNumbers}):r.error}};export{Ne as rgCommand};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{a as m}from"./chunk-GX4MPCG6.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var e=m("sha1sum","sha1","compute SHA1 message digest");export{e as sha1sumCommand};
2
+ import{a as m}from"./chunk-Y5QKO4KO.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var e=m("sha1sum","sha1","compute SHA1 message digest");export{e as sha1sumCommand};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{a as m}from"./chunk-GX4MPCG6.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var e=m("sha256sum","sha256","compute SHA256 message digest");export{e as sha256sumCommand};
2
+ import{a as m}from"./chunk-Y5QKO4KO.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var e=m("sha256sum","sha256","compute SHA256 message digest");export{e as sha256sumCommand};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{b as O}from"./chunk-45SNFRCY.js";import"./chunk-OBH7XN5N.js";import{a as F,b as N,c as k}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var P={"":1,k:1024,m:1048576,g:1073741824,t:1099511627776,p:0x4000000000000,e:1152921504606847e3},V={jan:1,feb:2,mar:3,apr:4,may:5,jun:6,jul:7,aug:8,sep:9,oct:10,nov:11,dec:12};function w(u){let r=u.trim(),e=r.match(/^([+-]?\d*\.?\d+)\s*([kmgtpeKMGTPE])?[iI]?[bB]?$/);if(!e){let n=parseFloat(r);return Number.isNaN(n)?0:n}let l=parseFloat(e[1]),s=(e[2]||"").toLowerCase(),i=P[s]||1;return l*i}function L(u){let r=u.trim().toLowerCase().slice(0,3);return V[r]||0}function D(u,r){let e=u.split(/(\d+)/),l=r.split(/(\d+)/),s=Math.max(e.length,l.length);for(let i=0;i<s;i++){let n=e[i]||"",d=l[i]||"",o=/^\d+$/.test(n)?parseInt(n,10):null,c=/^\d+$/.test(d)?parseInt(d,10):null;if(o!==null&&c!==null){if(o!==c)return o-c}else if(n!==d)return n.localeCompare(d)}return 0}function x(u){return u.replace(/[^a-zA-Z0-9\s]/g,"")}function v(u,r,e){let l=e!==null?e:/\s+/,s=u.split(l),i=r.startField-1;if(i>=s.length)return"";if(r.endField===void 0){let o=s[i]||"";return r.startChar!==void 0&&(o=o.slice(r.startChar-1)),r.ignoreLeading&&(o=o.trimStart()),o}let n=Math.min(r.endField-1,s.length-1),d="";for(let o=i;o<=n&&o<s.length;o++){let c=s[o]||"";if(o===i&&r.startChar!==void 0&&(c=c.slice(r.startChar-1)),o===n&&r.endChar!==void 0){let t=o===i&&r.startChar!==void 0?r.endChar-r.startChar+1:r.endChar;c=c.slice(0,t)}o>i&&(d+=e||" "),d+=c}return r.ignoreLeading&&(d=d.trimStart()),d}function I(u,r,e){let l=u,s=r;if(e.dictionaryOrder&&(l=x(l),s=x(s)),e.ignoreCase&&(l=l.toLowerCase(),s=s.toLowerCase()),e.monthSort){let i=L(l),n=L(s);return i-n}if(e.humanNumeric){let i=w(l),n=w(s);return i-n}if(e.versionSort)return D(l,s);if(e.numeric){let i=parseFloat(l)||0,n=parseFloat(s)||0;return i-n}return l.localeCompare(s)}function M(u){let{keys:r,fieldDelimiter:e,numeric:l,ignoreCase:s,reverse:i,humanNumeric:n,versionSort:d,dictionaryOrder:o,monthSort:c,ignoreLeadingBlanks:t,stable:a}=u;return(f,S)=>{let g=f,b=S;if(t&&(g=g.trimStart(),b=b.trimStart()),r.length===0){let h=I(g,b,{numeric:l,ignoreCase:s,humanNumeric:n,versionSort:d,dictionaryOrder:o,monthSort:c});if(h!==0)return i?-h:h;if(!a){let p=f.localeCompare(S);return i?-p:p}return 0}for(let m of r){let h=v(g,m,e),p=v(b,m,e);m.ignoreLeading&&(h=h.trimStart(),p=p.trimStart());let B={numeric:m.numeric??l,ignoreCase:m.ignoreCase??s,humanNumeric:m.humanNumeric??n,versionSort:m.versionSort??d,dictionaryOrder:m.dictionaryOrder??o,monthSort:m.monthSort??c},A=m.reverse??i,y=I(h,p,B);if(y!==0)return A?-y:y}if(!a){let m=f.localeCompare(S);return i?-m:m}return 0}}function E(u,r){if(r.keys.length===0){if(r.ignoreCase){let s=new Set;return u.filter(i=>{let n=i.toLowerCase();return s.has(n)?!1:(s.add(n),!0)})}return[...new Set(u)]}let e=r.keys[0],l=new Set;return u.filter(s=>{let i=v(s,e,r.fieldDelimiter);return(e.ignoreCase??r.ignoreCase)&&(i=i.toLowerCase()),l.has(i)?!1:(l.add(i),!0)})}function C(u){let r={startField:1},e="",l=u,s=l.match(/([bdfhMnrV]+)$/);s&&(e=s[1],l=l.slice(0,-e.length)),e.includes("n")&&(r.numeric=!0),e.includes("r")&&(r.reverse=!0),e.includes("f")&&(r.ignoreCase=!0),e.includes("b")&&(r.ignoreLeading=!0),e.includes("h")&&(r.humanNumeric=!0),e.includes("V")&&(r.versionSort=!0),e.includes("d")&&(r.dictionaryOrder=!0),e.includes("M")&&(r.monthSort=!0);let i=l.split(",");if(i.length===0||i[0]==="")return null;let n=i[0].split("."),d=parseInt(n[0],10);if(Number.isNaN(d)||d<1)return null;if(r.startField=d,n.length>1&&n[1]){let o=parseInt(n[1],10);!Number.isNaN(o)&&o>=1&&(r.startChar=o)}if(i.length>1&&i[1]){let o=i[1],c=o.match(/([bdfhMnrV]+)$/);if(c){let a=c[1];a.includes("n")&&(r.numeric=!0),a.includes("r")&&(r.reverse=!0),a.includes("f")&&(r.ignoreCase=!0),a.includes("b")&&(r.ignoreLeading=!0),a.includes("h")&&(r.humanNumeric=!0),a.includes("V")&&(r.versionSort=!0),a.includes("d")&&(r.dictionaryOrder=!0),a.includes("M")&&(r.monthSort=!0),o=o.slice(0,-a.length)}let t=o.split(".");if(t[0]){let a=parseInt(t[0],10);if(!Number.isNaN(a)&&a>=1&&(r.endField=a),t.length>1&&t[1]){let f=parseInt(t[1],10);!Number.isNaN(f)&&f>=1&&(r.endChar=f)}}}return r}var q={name:"sort",summary:"sort lines of text files",usage:"sort [OPTION]... [FILE]...",options:["-b, --ignore-leading-blanks ignore leading blanks","-d, --dictionary-order consider only blanks and alphanumeric characters","-f, --ignore-case fold lower case to upper case characters","-h, --human-numeric-sort compare human readable numbers (e.g., 2K 1G)","-M, --month-sort compare (unknown) < 'JAN' < ... < 'DEC'","-n, --numeric-sort compare according to string numerical value","-r, --reverse reverse the result of comparisons","-V, --version-sort natural sort of (version) numbers within text","-c, --check check for sorted input; do not sort","-o, --output=FILE write result to FILE instead of stdout","-s, --stable stabilize sort by disabling last-resort comparison","-u, --unique output only unique lines","-k, --key=KEYDEF sort via a key; KEYDEF gives location and type","-t, --field-separator=SEP use SEP as field separator"," --help display this help and exit"],description:`KEYDEF is F[.C][OPTS][,F[.C][OPTS]]
2
+ import{b as O}from"./chunk-5WFYIUU2.js";import"./chunk-OBH7XN5N.js";import{a as F,b as N,c as k}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var P={"":1,k:1024,m:1048576,g:1073741824,t:1099511627776,p:0x4000000000000,e:1152921504606847e3},V={jan:1,feb:2,mar:3,apr:4,may:5,jun:6,jul:7,aug:8,sep:9,oct:10,nov:11,dec:12};function w(u){let r=u.trim(),e=r.match(/^([+-]?\d*\.?\d+)\s*([kmgtpeKMGTPE])?[iI]?[bB]?$/);if(!e){let n=parseFloat(r);return Number.isNaN(n)?0:n}let l=parseFloat(e[1]),s=(e[2]||"").toLowerCase(),i=P[s]||1;return l*i}function L(u){let r=u.trim().toLowerCase().slice(0,3);return V[r]||0}function D(u,r){let e=u.split(/(\d+)/),l=r.split(/(\d+)/),s=Math.max(e.length,l.length);for(let i=0;i<s;i++){let n=e[i]||"",d=l[i]||"",o=/^\d+$/.test(n)?parseInt(n,10):null,c=/^\d+$/.test(d)?parseInt(d,10):null;if(o!==null&&c!==null){if(o!==c)return o-c}else if(n!==d)return n.localeCompare(d)}return 0}function x(u){return u.replace(/[^a-zA-Z0-9\s]/g,"")}function v(u,r,e){let l=e!==null?e:/\s+/,s=u.split(l),i=r.startField-1;if(i>=s.length)return"";if(r.endField===void 0){let o=s[i]||"";return r.startChar!==void 0&&(o=o.slice(r.startChar-1)),r.ignoreLeading&&(o=o.trimStart()),o}let n=Math.min(r.endField-1,s.length-1),d="";for(let o=i;o<=n&&o<s.length;o++){let c=s[o]||"";if(o===i&&r.startChar!==void 0&&(c=c.slice(r.startChar-1)),o===n&&r.endChar!==void 0){let t=o===i&&r.startChar!==void 0?r.endChar-r.startChar+1:r.endChar;c=c.slice(0,t)}o>i&&(d+=e||" "),d+=c}return r.ignoreLeading&&(d=d.trimStart()),d}function I(u,r,e){let l=u,s=r;if(e.dictionaryOrder&&(l=x(l),s=x(s)),e.ignoreCase&&(l=l.toLowerCase(),s=s.toLowerCase()),e.monthSort){let i=L(l),n=L(s);return i-n}if(e.humanNumeric){let i=w(l),n=w(s);return i-n}if(e.versionSort)return D(l,s);if(e.numeric){let i=parseFloat(l)||0,n=parseFloat(s)||0;return i-n}return l.localeCompare(s)}function M(u){let{keys:r,fieldDelimiter:e,numeric:l,ignoreCase:s,reverse:i,humanNumeric:n,versionSort:d,dictionaryOrder:o,monthSort:c,ignoreLeadingBlanks:t,stable:a}=u;return(f,S)=>{let g=f,b=S;if(t&&(g=g.trimStart(),b=b.trimStart()),r.length===0){let h=I(g,b,{numeric:l,ignoreCase:s,humanNumeric:n,versionSort:d,dictionaryOrder:o,monthSort:c});if(h!==0)return i?-h:h;if(!a){let p=f.localeCompare(S);return i?-p:p}return 0}for(let m of r){let h=v(g,m,e),p=v(b,m,e);m.ignoreLeading&&(h=h.trimStart(),p=p.trimStart());let B={numeric:m.numeric??l,ignoreCase:m.ignoreCase??s,humanNumeric:m.humanNumeric??n,versionSort:m.versionSort??d,dictionaryOrder:m.dictionaryOrder??o,monthSort:m.monthSort??c},A=m.reverse??i,y=I(h,p,B);if(y!==0)return A?-y:y}if(!a){let m=f.localeCompare(S);return i?-m:m}return 0}}function E(u,r){if(r.keys.length===0){if(r.ignoreCase){let s=new Set;return u.filter(i=>{let n=i.toLowerCase();return s.has(n)?!1:(s.add(n),!0)})}return[...new Set(u)]}let e=r.keys[0],l=new Set;return u.filter(s=>{let i=v(s,e,r.fieldDelimiter);return(e.ignoreCase??r.ignoreCase)&&(i=i.toLowerCase()),l.has(i)?!1:(l.add(i),!0)})}function C(u){let r={startField:1},e="",l=u,s=l.match(/([bdfhMnrV]+)$/);s&&(e=s[1],l=l.slice(0,-e.length)),e.includes("n")&&(r.numeric=!0),e.includes("r")&&(r.reverse=!0),e.includes("f")&&(r.ignoreCase=!0),e.includes("b")&&(r.ignoreLeading=!0),e.includes("h")&&(r.humanNumeric=!0),e.includes("V")&&(r.versionSort=!0),e.includes("d")&&(r.dictionaryOrder=!0),e.includes("M")&&(r.monthSort=!0);let i=l.split(",");if(i.length===0||i[0]==="")return null;let n=i[0].split("."),d=parseInt(n[0],10);if(Number.isNaN(d)||d<1)return null;if(r.startField=d,n.length>1&&n[1]){let o=parseInt(n[1],10);!Number.isNaN(o)&&o>=1&&(r.startChar=o)}if(i.length>1&&i[1]){let o=i[1],c=o.match(/([bdfhMnrV]+)$/);if(c){let a=c[1];a.includes("n")&&(r.numeric=!0),a.includes("r")&&(r.reverse=!0),a.includes("f")&&(r.ignoreCase=!0),a.includes("b")&&(r.ignoreLeading=!0),a.includes("h")&&(r.humanNumeric=!0),a.includes("V")&&(r.versionSort=!0),a.includes("d")&&(r.dictionaryOrder=!0),a.includes("M")&&(r.monthSort=!0),o=o.slice(0,-a.length)}let t=o.split(".");if(t[0]){let a=parseInt(t[0],10);if(!Number.isNaN(a)&&a>=1&&(r.endField=a),t.length>1&&t[1]){let f=parseInt(t[1],10);!Number.isNaN(f)&&f>=1&&(r.endChar=f)}}}return r}var q={name:"sort",summary:"sort lines of text files",usage:"sort [OPTION]... [FILE]...",options:["-b, --ignore-leading-blanks ignore leading blanks","-d, --dictionary-order consider only blanks and alphanumeric characters","-f, --ignore-case fold lower case to upper case characters","-h, --human-numeric-sort compare human readable numbers (e.g., 2K 1G)","-M, --month-sort compare (unknown) < 'JAN' < ... < 'DEC'","-n, --numeric-sort compare according to string numerical value","-r, --reverse reverse the result of comparisons","-V, --version-sort natural sort of (version) numbers within text","-c, --check check for sorted input; do not sort","-o, --output=FILE write result to FILE instead of stdout","-s, --stable stabilize sort by disabling last-resort comparison","-u, --unique output only unique lines","-k, --key=KEYDEF sort via a key; KEYDEF gives location and type","-t, --field-separator=SEP use SEP as field separator"," --help display this help and exit"],description:`KEYDEF is F[.C][OPTS][,F[.C][OPTS]]
3
3
  F is a field number (1-indexed)
4
4
  C is a character position within the field (1-indexed)
5
5
  OPTS can be: b d f h M n r V (per-key modifiers)
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env node
2
+ import{a as g,b}from"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";import{fileURLToPath as P}from"node:url";import{Worker as W}from"node:worker_threads";import E from"sql.js";function $(e,t,o){switch(o.mode){case"list":return x(e,t,o);case"csv":return q(e,t,o);case"json":return V(e,t);case"line":return k(e,t,o);case"column":return A(e,t,o);case"table":return O(e,t,o);case"markdown":return R(e,t,o);case"tabs":return N(e,t,o);case"box":return M(e,t,o);case"quote":return I(e,t,o);case"html":return U(e,t,o);case"ascii":return B(e,t,o)}}function f(e,t){return e==null?t:e instanceof Uint8Array||Buffer.isBuffer(e)?Buffer.from(e).toString("utf8"):typeof e=="number"&&!Number.isInteger(e)?e.toPrecision(17).replace(/\.?0+$/,""):String(e)}function x(e,t,o){let r=[];o.header&&e.length>0&&r.push(e.join(o.separator));for(let a of t)r.push(a.map(s=>f(s,o.nullValue)).join(o.separator));return r.length>0?`${r.join(o.newline)}${o.newline}`:""}function q(e,t,o){let r=[];o.header&&e.length>0&&r.push(e.map(w).join(","));for(let a of t)r.push(a.map(s=>w(f(s,o.nullValue))).join(","));return r.length>0?`${r.join(`
3
+ `)}
4
+ `:""}function w(e){return e.includes(",")||e.includes('"')||e.includes("'")||e.includes(`
5
+ `)?`"${e.replace(/"/g,'""')}"`:e}function j(e){return e.toPrecision(17).replace(/\.?0+$/,"")}function L(e){return e===null?"null":typeof e=="number"?Number.isInteger(e)?String(e):j(e):JSON.stringify(e)}function V(e,t){return t.length===0?"":`[${t.map(r=>`{${e.map((s,i)=>`${JSON.stringify(s)}:${L(r[i])}`).join(",")}}`).join(`,
6
+ `)}]
7
+ `}function k(e,t,o){if(e.length===0||t.length===0)return"";let r=Math.max(5,...e.map(s=>s.length)),a=[];for(let s of t)for(let i=0;i<e.length;i++){let n=e[i].padStart(r);a.push(`${n} = ${f(s[i],o.nullValue)}`)}return`${a.join(`
8
+ `)}
9
+ `}function A(e,t,o){if(e.length===0)return"";let r=e.map(s=>s.length);for(let s of t)for(let i=0;i<s.length;i++){let n=f(s[i],o.nullValue).length;n>r[i]&&(r[i]=n)}let a=[];o.header&&(a.push(e.map((s,i)=>s.padEnd(r[i])).join(" ")),a.push(r.map(s=>"-".repeat(s)).join(" ")));for(let s of t)a.push(s.map((i,n)=>f(i,o.nullValue).padEnd(r[n])).join(" "));return a.length>0?`${a.join(`
10
+ `)}
11
+ `:""}function O(e,t,o){if(e.length===0)return"";let r=e.map(i=>i.length);for(let i of t)for(let n=0;n<i.length;n++){let l=f(i[n],o.nullValue).length;l>r[n]&&(r[n]=l)}let a=[],s=`+${r.map(i=>"-".repeat(i+2)).join("+")}+`;a.push(s),o.header&&(a.push(`| ${e.map((i,n)=>i.padEnd(r[n])).join(" | ")} |`),a.push(s));for(let i of t)a.push(`| ${i.map((n,l)=>f(n,o.nullValue).padEnd(r[l])).join(" | ")} |`);return a.push(s),`${a.join(`
12
+ `)}
13
+ `}function R(e,t,o){if(e.length===0)return"";let r=[];o.header&&(r.push(`| ${e.join(" | ")} |`),r.push(`|${e.map(()=>"---").join("|")}|`));for(let a of t)r.push(`| ${a.map(s=>f(s,o.nullValue)).join(" | ")} |`);return r.length>0?`${r.join(`
14
+ `)}
15
+ `:""}function N(e,t,o){let r=[];o.header&&e.length>0&&r.push(e.join(" "));for(let a of t)r.push(a.map(s=>f(s,o.nullValue)).join(" "));return r.length>0?`${r.join(o.newline)}${o.newline}`:""}function M(e,t,o){if(e.length===0)return"";let r=e.map(s=>s.length);for(let s of t)for(let i=0;i<s.length;i++){let n=f(s[i],o.nullValue).length;n>r[i]&&(r[i]=n)}let a=[];a.push(`\u250C${r.map(s=>"\u2500".repeat(s+2)).join("\u252C")}\u2510`),a.push(`\u2502 ${e.map((s,i)=>s.padEnd(r[i])).join(" \u2502 ")} \u2502`),a.push(`\u251C${r.map(s=>"\u2500".repeat(s+2)).join("\u253C")}\u2524`);for(let s of t)a.push(`\u2502 ${s.map((i,n)=>f(i,o.nullValue).padEnd(r[n])).join(" \u2502 ")} \u2502`);return a.push(`\u2514${r.map(s=>"\u2500".repeat(s+2)).join("\u2534")}\u2518`),`${a.join(`
16
+ `)}
17
+ `}function I(e,t,o){let r=[];o.header&&e.length>0&&r.push(e.map(a=>`'${a}'`).join(","));for(let a of t)r.push(a.map(s=>s==null?"NULL":typeof s=="number"?Number.isInteger(s)?String(s):j(s):`'${String(s)}'`).join(","));return r.length>0?`${r.join(o.newline)}${o.newline}`:""}function U(e,t,o){let r=[];o.header&&e.length>0&&(r.push(`<TR>${e.map(a=>`<TH>${S(a)}</TH>`).join("")}`),r.push("</TR>"));for(let a of t)r.push(`<TR>${a.map(s=>`<TD>${S(f(s,o.nullValue))}</TD>`).join("")}`),r.push("</TR>");return r.length>0?`${r.join(`
18
+ `)}
19
+ `:""}function S(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function B(e,t,o){let s=[];o.header&&e.length>0&&s.push(e.join(""));for(let i of t)s.push(i.map(n=>f(n,o.nullValue)).join(""));return s.length>0?s.join("")+"":""}var D=5e3,Q={name:"sqlite3",summary:"SQLite database CLI",usage:"sqlite3 [OPTIONS] DATABASE [SQL]",options:["-list output in list mode (default)","-csv output in CSV mode","-json output in JSON mode","-line output in line mode","-column output in column mode","-table output as ASCII table","-markdown output as markdown table","-tabs output in tab-separated mode","-box output in Unicode box mode","-quote output in SQL quote mode","-html output as HTML table","-ascii output in ASCII mode (control chars)","-header show column headers","-noheader hide column headers","-separator SEP field separator for list mode (default: |)","-newline SEP row separator (default: \\n)","-nullvalue TEXT text for NULL values (default: empty)","-readonly open database read-only (no writeback)","-bail stop on first error","-echo print SQL before execution","-cmd COMMAND run SQL command before main SQL","-version show SQLite version","-- end of options","--help show this help"],examples:['sqlite3 :memory: "CREATE TABLE t(x); INSERT INTO t VALUES(1); SELECT * FROM t"','sqlite3 -json data.db "SELECT * FROM users"','sqlite3 -csv -header data.db "SELECT id, name FROM products"','sqlite3 -box data.db "SELECT * FROM users"']};function F(e){let t={mode:"list",header:!1,separator:"|",newline:`
20
+ `,nullValue:"",readonly:!1,bail:!1,echo:!1,cmd:null},o=null,r=null,a=!1,s=!1;for(let i=0;i<e.length;i++){let n=e[i];if(s){o===null?o=n:r===null&&(r=n);continue}if(n==="--")s=!0;else if(n==="-version")a=!0;else if(n==="-list")t.mode="list";else if(n==="-csv")t.mode="csv";else if(n==="-json")t.mode="json";else if(n==="-line")t.mode="line";else if(n==="-column")t.mode="column";else if(n==="-table")t.mode="table";else if(n==="-markdown")t.mode="markdown";else if(n==="-tabs")t.mode="tabs";else if(n==="-box")t.mode="box";else if(n==="-quote")t.mode="quote";else if(n==="-html")t.mode="html";else if(n==="-ascii")t.mode="ascii";else if(n==="-header")t.header=!0;else if(n==="-noheader")t.header=!1;else if(n==="-readonly")t.readonly=!0;else if(n==="-bail")t.bail=!0;else if(n==="-echo")t.echo=!0;else if(n==="-separator"){if(i+1>=e.length)return{stdout:"",stderr:`sqlite3: Error: missing argument to -separator
21
+ `,exitCode:1};t.separator=e[++i]}else if(n==="-newline"){if(i+1>=e.length)return{stdout:"",stderr:`sqlite3: Error: missing argument to -newline
22
+ `,exitCode:1};t.newline=e[++i]}else if(n==="-nullvalue"){if(i+1>=e.length)return{stdout:"",stderr:`sqlite3: Error: missing argument to -nullvalue
23
+ `,exitCode:1};t.nullValue=e[++i]}else if(n==="-cmd"){if(i+1>=e.length)return{stdout:"",stderr:`sqlite3: Error: missing argument to -cmd
24
+ `,exitCode:1};t.cmd=e[++i]}else{if(n.startsWith("-"))return{stdout:"",stderr:`sqlite3: Error: unknown option: ${n.startsWith("--")?n.slice(1):n}
25
+ Use -help for a list of options.
26
+ `,exitCode:1};o===null?o=n:r===null&&(r=n)}}return{options:t,database:o,sql:r,showVersion:a}}async function H(){let e=await E(),t=new e.Database;try{let o=t.exec("SELECT sqlite_version()");return o.length>0&&o[0].values.length>0?String(o[0].values[0][0]):"unknown"}finally{t.close()}}function J(e){let t=e.trim().toUpperCase();return t.startsWith("INSERT")||t.startsWith("UPDATE")||t.startsWith("DELETE")||t.startsWith("CREATE")||t.startsWith("DROP")||t.startsWith("ALTER")||t.startsWith("REPLACE")||t.startsWith("VACUUM")}function _(e){let t=[],o="",r=!1,a="";for(let i=0;i<e.length;i++){let n=e[i];if(r)o+=n,n===a&&(e[i+1]===a?o+=e[++i]:r=!1);else if(n==="'"||n==='"')o+=n,r=!0,a=n;else if(n===";"){let l=o.trim();l&&t.push(l),o=""}else o+=n}let s=o.trim();return s&&t.push(s),t}async function X(e){let t;try{let a=await E();e.dbBuffer?t=new a.Database(e.dbBuffer):t=new a.Database}catch(a){return{success:!1,error:a.message}}let o=[],r=!1;try{let a=_(e.sql);for(let i of a)try{if(J(i))t.run(i),r=!0,o.push({type:"data",columns:[],rows:[]});else{let n=t.prepare(i),l=n.getColumnNames(),d=[];for(;n.step();)d.push(n.get());n.free(),o.push({type:"data",columns:l,rows:d})}}catch(n){let l=n.message;if(o.push({type:"error",error:l}),e.options.bail)break}let s=null;return r&&(s=t.export()),t.close(),{success:!0,results:o,hasModifications:r,dbBuffer:s}}catch(a){return t.close(),{success:!1,error:a.message}}}async function Y(e,t){try{let o=P(new URL("./worker.js",import.meta.url));return await new Promise((r,a)=>{let s=new W(o,{workerData:e}),i=setTimeout(()=>{s.terminate(),r({success:!1,error:`Query timeout: execution exceeded ${t}ms limit`})},t);s.on("message",n=>{clearTimeout(i),r(n)}),s.on("error",n=>{clearTimeout(i),a(n)}),s.on("exit",n=>{clearTimeout(i),n!==0&&r({success:!1,error:`Worker exited with code ${n}`})})})}catch{return X(e)}}var te={name:"sqlite3",async execute(e,t){if(b(e)||e.includes("-help"))return g(Q);let o=F(e);if("exitCode"in o)return o;let{options:r,database:a,sql:s,showVersion:i}=o;if(i)return{stdout:`${await H()}
27
+ `,stderr:"",exitCode:0};if(!a)return{stdout:"",stderr:`sqlite3: missing database argument
28
+ `,exitCode:1};let n=s||t.stdin.trim();if(r.cmd&&(n=r.cmd+(n?`; ${n}`:"")),!n)return{stdout:"",stderr:`sqlite3: no SQL provided
29
+ `,exitCode:1};let l=a===":memory:",d="",m=null;try{l||(d=t.fs.resolvePath(t.cwd,a),await t.fs.exists(d)&&(m=await t.fs.readFileBuffer(d)))}catch(u){return{stdout:"",stderr:`sqlite3: unable to open database "${a}": ${u.message}
30
+ `,exitCode:1}}let C=t.limits?.maxSqliteTimeoutMs??D,T={dbBuffer:m,sql:n,options:{bail:r.bail,echo:r.echo}},c;try{c=await Y(T,C)}catch(u){return{stdout:"",stderr:`sqlite3: worker error: ${u.message}
31
+ `,exitCode:1}}if(!c.success)return{stdout:"",stderr:`sqlite3: ${c.error}
32
+ `,exitCode:1};let y={mode:r.mode,header:r.header,separator:r.separator,newline:r.newline,nullValue:r.nullValue},h="";r.echo&&(h+=`${n}
33
+ `);let p=!1;for(let u of c.results)if(u.type==="error"){if(r.bail)return{stdout:h,stderr:`Error: ${u.error}
34
+ `,exitCode:1};h+=`Error: ${u.error}
35
+ `,p=!0}else u.columns&&u.rows&&(u.rows.length>0||r.header)&&(h+=$(u.columns,u.rows,y));if(c.hasModifications&&!r.readonly&&!l&&d&&c.dbBuffer)try{await t.fs.writeFile(d,c.dbBuffer)}catch(u){return{stdout:h,stderr:`sqlite3: failed to write database: ${u.message}
36
+ `,exitCode:1}}return{stdout:h,stderr:"",exitCode:p&&r.bail?1:0}}};export{te as sqlite3Command};