just-bash 2.11.15 → 2.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Bash.d.ts +11 -0
- package/dist/bin/chunks/awk2-ZE5HJBNV.js +2 -0
- package/dist/bin/{shell/chunks/bash-WB6O736J.js → chunks/bash-6ZHZ6BX7.js} +1 -1
- package/dist/bin/chunks/chunk-253LRF5J.js +11 -0
- package/dist/bin/chunks/chunk-2BC3N3L2.js +16 -0
- package/dist/bin/chunks/{chunk-D2VMRCQU.js → chunk-35JD7YEM.js} +12 -12
- package/dist/bin/chunks/{chunk-XB2MDT3B.js → chunk-3NVWSLHI.js} +1 -1
- package/dist/bin/chunks/{chunk-ISOXAKGQ.js → chunk-45MJQ2LX.js} +4 -4
- package/dist/bin/chunks/{chunk-JXC25GVQ.js → chunk-47HZU3SY.js} +1 -1
- package/dist/bin/chunks/chunk-4OALHZXB.js +2 -0
- package/dist/bin/{shell/chunks/chunk-K5IXNHO5.js → chunks/chunk-6KZRLMG3.js} +3 -3
- package/dist/bin/chunks/{chunk-AHMZLMTU.js → chunk-6L4K3UGO.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-V4CRXAQO.js → chunks/chunk-7SWOLTCR.js} +1 -1
- package/dist/bin/chunks/chunk-C7TH4MVZ.js +14 -0
- package/dist/bin/{shell/chunks/chunk-BWWPUUC5.js → chunks/chunk-EPIOK4SY.js} +1 -1
- package/dist/bin/chunks/chunk-F37UEO7A.js +10 -0
- package/dist/bin/chunks/chunk-GO6FXSC4.js +6 -0
- package/dist/bin/chunks/{chunk-PDVXLMUU.js → chunk-H7Y3TH22.js} +17 -17
- package/dist/bin/chunks/chunk-JWVOLGWZ.js +12 -0
- package/dist/bin/chunks/chunk-KTFEQPO7.js +4 -0
- package/dist/bin/chunks/chunk-N4EU64Y4.js +9 -0
- package/dist/bin/chunks/{chunk-LW7FS3EH.js → chunk-ND23BJUM.js} +1 -1
- package/dist/bin/chunks/chunk-QC46PWBQ.js +63 -0
- package/dist/bin/{shell/chunks/chunk-XORPAMNK.js → chunks/chunk-RYXW3SZQ.js} +1 -1
- package/dist/bin/{shell/chunks/chunk-K7XSYP4L.js → chunks/chunk-VZKEP45B.js} +13 -13
- package/dist/bin/chunks/chunk-WIWKAGK6.js +2 -0
- package/dist/bin/chunks/env-HOVBNLUR.js +2 -0
- package/dist/bin/chunks/{expansion-AMH5BAVV.js → expansion-QVHAYGVZ.js} +1 -1
- package/dist/bin/chunks/find-4YAO7JQS.js +2 -0
- package/dist/bin/chunks/flag-coverage-F4EAJUHL.js +2 -0
- package/dist/bin/chunks/help-4H52JYYC.js +2 -0
- package/dist/bin/chunks/{jq-TIHNHMOR.js → jq-CXSPO2J5.js} +1 -1
- package/dist/bin/chunks/printf-P3QVL4IO.js +2 -0
- package/dist/bin/chunks/python3-XRP5IZRL.js +16 -0
- package/dist/bin/chunks/rg-34GE6REQ.js +2 -0
- package/dist/bin/chunks/sed-DNLJZZXZ.js +2 -0
- package/dist/bin/chunks/sleep-RA6DYTJX.js +2 -0
- package/dist/bin/chunks/sqlite3-ZUGDKEIT.js +2 -0
- package/dist/bin/chunks/tar-GP2CCB47.js +2 -0
- package/dist/bin/chunks/time-E5YULACD.js +2 -0
- package/dist/bin/chunks/timeout-TCIINQNA.js +2 -0
- package/dist/bin/chunks/worker.js +57 -22
- package/dist/bin/chunks/{xan-3IA4WP2G.js → xan-7NIVZ3HP.js} +1 -1
- package/dist/bin/{shell/chunks/xargs-YWPEV2QC.js → chunks/xargs-GBL6PZ2K.js} +1 -1
- package/dist/bin/chunks/yq-L5ZSGLLO.js +2 -0
- package/dist/bin/just-bash.js +286 -286
- package/dist/bin/shell/chunks/awk2-ZE5HJBNV.js +2 -0
- package/dist/bin/{chunks/bash-WB6O736J.js → shell/chunks/bash-6ZHZ6BX7.js} +1 -1
- package/dist/bin/shell/chunks/chunk-253LRF5J.js +11 -0
- package/dist/bin/shell/chunks/chunk-2BC3N3L2.js +16 -0
- package/dist/bin/shell/chunks/{chunk-D2VMRCQU.js → chunk-35JD7YEM.js} +12 -12
- package/dist/bin/shell/chunks/{chunk-XB2MDT3B.js → chunk-3NVWSLHI.js} +1 -1
- package/dist/bin/shell/chunks/{chunk-ISOXAKGQ.js → chunk-45MJQ2LX.js} +4 -4
- package/dist/bin/shell/chunks/{chunk-JXC25GVQ.js → chunk-47HZU3SY.js} +1 -1
- package/dist/bin/shell/chunks/chunk-4OALHZXB.js +2 -0
- package/dist/bin/{chunks/chunk-K5IXNHO5.js → shell/chunks/chunk-6KZRLMG3.js} +3 -3
- package/dist/bin/shell/chunks/{chunk-AHMZLMTU.js → chunk-6L4K3UGO.js} +1 -1
- package/dist/bin/{chunks/chunk-V4CRXAQO.js → shell/chunks/chunk-7SWOLTCR.js} +1 -1
- package/dist/bin/shell/chunks/chunk-C7TH4MVZ.js +14 -0
- package/dist/bin/{chunks/chunk-BWWPUUC5.js → shell/chunks/chunk-EPIOK4SY.js} +1 -1
- package/dist/bin/shell/chunks/chunk-F37UEO7A.js +10 -0
- package/dist/bin/shell/chunks/chunk-GO6FXSC4.js +6 -0
- package/dist/bin/shell/chunks/{chunk-PDVXLMUU.js → chunk-H7Y3TH22.js} +17 -17
- package/dist/bin/shell/chunks/chunk-JWVOLGWZ.js +12 -0
- package/dist/bin/shell/chunks/chunk-KTFEQPO7.js +4 -0
- package/dist/bin/shell/chunks/chunk-N4EU64Y4.js +9 -0
- package/dist/bin/shell/chunks/{chunk-LW7FS3EH.js → chunk-ND23BJUM.js} +1 -1
- package/dist/bin/shell/chunks/chunk-QC46PWBQ.js +63 -0
- package/dist/bin/{chunks/chunk-XORPAMNK.js → shell/chunks/chunk-RYXW3SZQ.js} +1 -1
- package/dist/bin/{chunks/chunk-K7XSYP4L.js → shell/chunks/chunk-VZKEP45B.js} +13 -13
- package/dist/bin/shell/chunks/chunk-WIWKAGK6.js +2 -0
- package/dist/bin/shell/chunks/env-HOVBNLUR.js +2 -0
- package/dist/bin/shell/chunks/{expansion-AMH5BAVV.js → expansion-QVHAYGVZ.js} +1 -1
- package/dist/bin/shell/chunks/find-4YAO7JQS.js +2 -0
- package/dist/bin/shell/chunks/flag-coverage-F4EAJUHL.js +2 -0
- package/dist/bin/shell/chunks/help-4H52JYYC.js +2 -0
- package/dist/bin/shell/chunks/{jq-TIHNHMOR.js → jq-CXSPO2J5.js} +1 -1
- package/dist/bin/shell/chunks/printf-P3QVL4IO.js +2 -0
- package/dist/bin/shell/chunks/python3-XRP5IZRL.js +16 -0
- package/dist/bin/shell/chunks/rg-34GE6REQ.js +2 -0
- package/dist/bin/shell/chunks/sed-DNLJZZXZ.js +2 -0
- package/dist/bin/shell/chunks/sleep-RA6DYTJX.js +2 -0
- package/dist/bin/shell/chunks/sqlite3-ZUGDKEIT.js +2 -0
- package/dist/bin/shell/chunks/tar-GP2CCB47.js +2 -0
- package/dist/bin/shell/chunks/time-E5YULACD.js +2 -0
- package/dist/bin/shell/chunks/timeout-TCIINQNA.js +2 -0
- package/dist/bin/shell/chunks/{xan-3IA4WP2G.js → xan-7NIVZ3HP.js} +1 -1
- package/dist/bin/{chunks/xargs-YWPEV2QC.js → shell/chunks/xargs-GBL6PZ2K.js} +1 -1
- package/dist/bin/shell/chunks/yq-L5ZSGLLO.js +2 -0
- package/dist/bin/shell/shell.js +288 -288
- package/dist/bundle/browser.js +619 -617
- package/dist/bundle/chunks/awk2-T6LHPVZE.js +1 -0
- package/dist/bundle/chunks/{bash-DYXMG247.js → bash-IJWYRKFO.js} +1 -1
- package/dist/bundle/chunks/chunk-2GOYXRRP.js +15 -0
- package/dist/bundle/chunks/chunk-3RA5L262.js +8 -0
- package/dist/bundle/chunks/{chunk-IBG6HR7V.js → chunk-AOFQVUAD.js} +1 -1
- package/dist/bundle/chunks/{chunk-3KWUDRIP.js → chunk-BAAVD5NO.js} +13 -13
- package/dist/bundle/chunks/{chunk-HDZ4QEVJ.js → chunk-BNVESM72.js} +17 -17
- package/dist/bundle/chunks/{chunk-U5TNQJ3C.js → chunk-C6ZZC5FL.js} +1 -1
- package/dist/bundle/chunks/chunk-D6CWQ5DW.js +5 -0
- package/dist/bundle/chunks/chunk-DKOIE53N.js +11 -0
- package/dist/bundle/chunks/chunk-FPGA7RT4.js +62 -0
- package/dist/bundle/chunks/{chunk-PSW6BMXW.js → chunk-GFQRA5P5.js} +3 -3
- package/dist/bundle/chunks/{chunk-FJNVFD75.js → chunk-HBB2R24Y.js} +12 -12
- package/dist/bundle/chunks/chunk-IPJHKYVM.js +1 -0
- package/dist/bundle/chunks/chunk-JOVMV4XV.js +13 -0
- package/dist/bundle/chunks/{chunk-FWYCF7NE.js → chunk-KPFCTJEX.js} +1 -1
- package/dist/bundle/chunks/chunk-LEOLL6PF.js +1 -0
- package/dist/bundle/chunks/{chunk-3JDQKHMS.js → chunk-LN5KAJOV.js} +1 -1
- package/dist/bundle/chunks/chunk-R7KYILVY.js +3 -0
- package/dist/bundle/chunks/{chunk-M2LI252W.js → chunk-T56QNPHK.js} +1 -1
- package/dist/bundle/chunks/chunk-VFBZTF5G.js +9 -0
- package/dist/bundle/chunks/{chunk-V4CDPGZH.js → chunk-WCVBECE6.js} +4 -4
- package/dist/bundle/chunks/{chunk-OAOCWUTE.js → chunk-XULIVM35.js} +1 -1
- package/dist/bundle/chunks/chunk-YCABLDKV.js +10 -0
- package/dist/bundle/chunks/{chunk-SXR3EI72.js → chunk-ZSJYNBAF.js} +1 -1
- package/dist/bundle/chunks/env-XZY4LKEO.js +1 -0
- package/dist/bundle/chunks/{expansion-5HXXJ2SG.js → expansion-NCEBD7KB.js} +1 -1
- package/dist/bundle/chunks/find-DQFMWHAC.js +1 -0
- package/dist/bundle/chunks/flag-coverage-U322DJFL.js +1 -0
- package/dist/bundle/chunks/help-IA5CMGR4.js +1 -0
- package/dist/bundle/chunks/{jq-YDGLHC7M.js → jq-MYSLFARY.js} +1 -1
- package/dist/bundle/chunks/printf-CX64KX2P.js +1 -0
- package/dist/bundle/chunks/python3-E7VF6UYO.js +15 -0
- package/dist/bundle/chunks/rg-DMOXE47H.js +1 -0
- package/dist/bundle/chunks/sed-3ZCNFRHI.js +1 -0
- package/dist/bundle/chunks/sleep-RKLUWJ7F.js +1 -0
- package/dist/bundle/chunks/sqlite3-ZGX3YFJB.js +1 -0
- package/dist/bundle/chunks/tar-H6XTXOAP.js +1 -0
- package/dist/bundle/chunks/time-ZEEYNXNZ.js +1 -0
- package/dist/bundle/chunks/timeout-LYYTWG45.js +1 -0
- package/dist/bundle/chunks/worker.js +57 -22
- package/dist/bundle/chunks/{xan-Y62IEVU4.js → xan-VTO4FP3H.js} +1 -1
- package/dist/bundle/chunks/{xargs-OGI2NN6J.js → xargs-2BBAQDTC.js} +1 -1
- package/dist/bundle/chunks/yq-JRZFRYSK.js +1 -0
- package/dist/bundle/index.cjs +774 -772
- package/dist/bundle/index.js +243 -243
- package/dist/commands/python3/protocol.d.ts +0 -1
- package/dist/commands/python3/python3.d.ts +2 -0
- package/dist/commands/sqlite3/sqlite3.d.ts +6 -0
- package/dist/commands/tar/archive.d.ts +20 -6
- package/dist/interpreter/errors.d.ts +10 -2
- package/dist/interpreter/helpers/result.d.ts +1 -1
- package/dist/interpreter/interpreter.d.ts +2 -0
- package/dist/interpreter/types.d.ts +7 -0
- package/dist/limits.d.ts +4 -0
- package/dist/network/allow-list.d.ts +5 -0
- package/dist/network/types.d.ts +6 -0
- package/dist/sandbox/Sandbox.d.ts +6 -0
- package/dist/timers.d.ts +15 -0
- package/dist/types.d.ts +17 -0
- package/dist/vitest-setup.d.ts +1 -0
- package/package.json +2 -2
- package/dist/bin/chunks/awk2-PWEGD656.js +0 -2
- package/dist/bin/chunks/chunk-5UH3Q7QT.js +0 -11
- package/dist/bin/chunks/chunk-5UHJVSR5.js +0 -10
- package/dist/bin/chunks/chunk-EFX3F2HZ.js +0 -63
- package/dist/bin/chunks/chunk-KLMOJKL4.js +0 -16
- package/dist/bin/chunks/chunk-N73TVRMN.js +0 -14
- package/dist/bin/chunks/chunk-P7UCWJ33.js +0 -12
- package/dist/bin/chunks/chunk-RDZMRK5M.js +0 -6
- package/dist/bin/chunks/chunk-W2FKF3MM.js +0 -9
- package/dist/bin/chunks/env-EVLPSWFF.js +0 -2
- package/dist/bin/chunks/find-PHHSZYDL.js +0 -2
- package/dist/bin/chunks/flag-coverage-KFNWHFPU.js +0 -2
- package/dist/bin/chunks/help-JF5TTAKQ.js +0 -2
- package/dist/bin/chunks/printf-4NJFGX3O.js +0 -2
- package/dist/bin/chunks/python3-YJ7YGEW7.js +0 -16
- package/dist/bin/chunks/rg-EJJ3ILD5.js +0 -2
- package/dist/bin/chunks/sed-3DO5EXEU.js +0 -2
- package/dist/bin/chunks/sleep-3QRDZXBH.js +0 -2
- package/dist/bin/chunks/sqlite3-4SEIR46P.js +0 -2
- package/dist/bin/chunks/tar-7B5KH3QG.js +0 -2
- package/dist/bin/chunks/time-4C3A4THJ.js +0 -2
- package/dist/bin/chunks/timeout-RS7REDYT.js +0 -2
- package/dist/bin/chunks/yq-OUNV2BWM.js +0 -2
- package/dist/bin/shell/chunks/awk2-PWEGD656.js +0 -2
- package/dist/bin/shell/chunks/chunk-5UH3Q7QT.js +0 -11
- package/dist/bin/shell/chunks/chunk-5UHJVSR5.js +0 -10
- package/dist/bin/shell/chunks/chunk-EFX3F2HZ.js +0 -63
- package/dist/bin/shell/chunks/chunk-KLMOJKL4.js +0 -16
- package/dist/bin/shell/chunks/chunk-N73TVRMN.js +0 -14
- package/dist/bin/shell/chunks/chunk-P7UCWJ33.js +0 -12
- package/dist/bin/shell/chunks/chunk-RDZMRK5M.js +0 -6
- package/dist/bin/shell/chunks/chunk-W2FKF3MM.js +0 -9
- package/dist/bin/shell/chunks/env-EVLPSWFF.js +0 -2
- package/dist/bin/shell/chunks/find-PHHSZYDL.js +0 -2
- package/dist/bin/shell/chunks/flag-coverage-KFNWHFPU.js +0 -2
- package/dist/bin/shell/chunks/help-JF5TTAKQ.js +0 -2
- package/dist/bin/shell/chunks/printf-4NJFGX3O.js +0 -2
- package/dist/bin/shell/chunks/python3-YJ7YGEW7.js +0 -16
- package/dist/bin/shell/chunks/rg-EJJ3ILD5.js +0 -2
- package/dist/bin/shell/chunks/sed-3DO5EXEU.js +0 -2
- package/dist/bin/shell/chunks/sleep-3QRDZXBH.js +0 -2
- package/dist/bin/shell/chunks/sqlite3-4SEIR46P.js +0 -2
- package/dist/bin/shell/chunks/tar-7B5KH3QG.js +0 -2
- package/dist/bin/shell/chunks/time-4C3A4THJ.js +0 -2
- package/dist/bin/shell/chunks/timeout-RS7REDYT.js +0 -2
- package/dist/bin/shell/chunks/yq-OUNV2BWM.js +0 -2
- package/dist/bundle/chunks/awk2-BDPR2JPZ.js +0 -1
- package/dist/bundle/chunks/chunk-73RYQHTW.js +0 -10
- package/dist/bundle/chunks/chunk-7WX4V2UH.js +0 -9
- package/dist/bundle/chunks/chunk-CSBFBYLD.js +0 -13
- package/dist/bundle/chunks/chunk-JP44OYZS.js +0 -5
- package/dist/bundle/chunks/chunk-OGDTSM2Q.js +0 -8
- package/dist/bundle/chunks/chunk-VZWXH2PZ.js +0 -62
- package/dist/bundle/chunks/chunk-XNL7YAHW.js +0 -11
- package/dist/bundle/chunks/chunk-ZKLK6C7H.js +0 -15
- package/dist/bundle/chunks/env-S547XMN7.js +0 -1
- package/dist/bundle/chunks/find-6U6YYAEP.js +0 -1
- package/dist/bundle/chunks/flag-coverage-ZCNVOYRY.js +0 -1
- package/dist/bundle/chunks/help-T2NGLTSG.js +0 -1
- package/dist/bundle/chunks/printf-IO3EBW5H.js +0 -1
- package/dist/bundle/chunks/python3-6Y4Z63NZ.js +0 -15
- package/dist/bundle/chunks/rg-4YNHHQAE.js +0 -1
- package/dist/bundle/chunks/sed-2K6ULZ6P.js +0 -1
- package/dist/bundle/chunks/sleep-U2ORRQJB.js +0 -1
- package/dist/bundle/chunks/sqlite3-Z2IGWYCE.js +0 -1
- package/dist/bundle/chunks/tar-K7K7BL55.js +0 -1
- package/dist/bundle/chunks/time-BPT76IHZ.js +0 -1
- package/dist/bundle/chunks/timeout-5UJUQXOE.js +0 -1
- package/dist/bundle/chunks/yq-CESEW5B3.js +0 -1
package/dist/Bash.d.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* This class provides the shell environment (filesystem, commands, variables)
|
|
8
8
|
* and delegates execution to the Interpreter.
|
|
9
9
|
*/
|
|
10
|
+
import "./timers.js";
|
|
10
11
|
import { type CommandName } from "./commands/registry.js";
|
|
11
12
|
import { type CustomCommand } from "./custom-commands.js";
|
|
12
13
|
import type { IFileSystem, InitialFiles } from "./fs/interface.js";
|
|
@@ -158,6 +159,11 @@ export interface ExecOptions {
|
|
|
158
159
|
* These are merged with the current environment and restored after execution.
|
|
159
160
|
*/
|
|
160
161
|
env?: Record<string, string>;
|
|
162
|
+
/**
|
|
163
|
+
* If true, start execution with an empty environment and then apply `env`.
|
|
164
|
+
* If false/omitted, `env` is merged into the current environment.
|
|
165
|
+
*/
|
|
166
|
+
replaceEnv?: boolean;
|
|
161
167
|
/**
|
|
162
168
|
* Working directory for this execution only.
|
|
163
169
|
* Restored to original after execution.
|
|
@@ -174,6 +180,11 @@ export interface ExecOptions {
|
|
|
174
180
|
* This will be available to commands via stdin (e.g., for `bash -c 'cat'`).
|
|
175
181
|
*/
|
|
176
182
|
stdin?: string;
|
|
183
|
+
/**
|
|
184
|
+
* Abort signal for cooperative cancellation.
|
|
185
|
+
* When aborted, the interpreter stops executing at the next statement boundary.
|
|
186
|
+
*/
|
|
187
|
+
signal?: AbortSignal;
|
|
177
188
|
}
|
|
178
189
|
export declare class Bash {
|
|
179
190
|
readonly fs: IFileSystem;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a,b,c,d}from"./chunk-
|
|
2
|
+
import{a,b,c,d}from"./chunk-GO6FXSC4.js";import"./chunk-4PRVMER6.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{a as bashCommand,c as flagsForFuzzing,b as shCommand,d as shFlagsForFuzzing};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{a as Y}from"./chunk-GIFF636B.js";import{a as ne}from"./chunk-4OALHZXB.js";import{a as te}from"./chunk-SE4C7FJY.js";import{a as oe,b as pe,c as ce}from"./chunk-D5WP4CKS.js";import{a as ie,b as le}from"./chunk-GTNBSMZR.js";function N(e,t){switch(e.type){case"name":{let n=e.pattern,r=n.match(/^\*(\.[a-zA-Z0-9]+)$/);if(r){let s=r[1],o=t.name;if(e.ignoreCase){if(!o.toLowerCase().endsWith(s.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!o.endsWith(s))return{matches:!1,pruned:!1,printed:!1};return{matches:!0,pruned:!1,printed:!1}}return{matches:Y(t.name,n,e.ignoreCase),pruned:!1,printed:!1}}case"path":{let n=e.pattern,r=t.relativePath,s=n.split("/");for(let i=0;i<s.length-1;i++){let a=s[i];if(a&&a!=="."&&a!==".."&&!a.includes("*")&&!a.includes("?")&&!a.includes("[")){let p=`/${a}/`;if(e.ignoreCase){if(!r.toLowerCase().includes(p.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!r.includes(p))return{matches:!1,pruned:!1,printed:!1}}}let o=n.match(/\*(\.[a-zA-Z0-9]+)$/);if(o){let i=o[1];if(e.ignoreCase){if(!r.toLowerCase().endsWith(i.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!r.endsWith(i))return{matches:!1,pruned:!1,printed:!1}}return{matches:Y(r,n,e.ignoreCase),pruned:!1,printed:!1}}case"regex":try{let n=e.ignoreCase?"i":"";return{matches:te(e.pattern,n).test(t.relativePath),pruned:!1,printed:!1}}catch{return{matches:!1,pruned:!1,printed:!1}}case"type":return e.fileType==="f"?{matches:t.isFile,pruned:!1,printed:!1}:e.fileType==="d"?{matches:t.isDirectory,pruned:!1,printed:!1}:{matches:!1,pruned:!1,printed:!1};case"empty":return{matches:t.isEmpty,pruned:!1,printed:!1};case"mtime":{let r=(Date.now()-t.mtime)/(1e3*60*60*24),s;return e.comparison==="more"?s=r>e.days:e.comparison==="less"?s=r<e.days:s=Math.floor(r)===e.days,{matches:s,pruned:!1,printed:!1}}case"newer":{let n=t.newerRefTimes.get(e.refPath);return n===void 0?{matches:!1,pruned:!1,printed:!1}:{matches:t.mtime>n,pruned:!1,printed:!1}}case"size":{let n=e.value;switch(e.unit){case"c":n=e.value;break;case"k":n=e.value*1024;break;case"M":n=e.value*1024*1024;break;case"G":n=e.value*1024*1024*1024;break;case"b":n=e.value*512;break}let r;return e.comparison==="more"?r=t.size>n:e.comparison==="less"?r=t.size<n:e.unit==="b"?r=Math.ceil(t.size/512)===e.value:r=t.size===n,{matches:r,pruned:!1,printed:!1}}case"perm":{let n=t.mode&511,r=e.mode&511,s;return e.matchType==="exact"?s=n===r:e.matchType==="all"?s=(n&r)===r:s=(n&r)!==0,{matches:s,pruned:!1,printed:!1}}case"prune":return{matches:!0,pruned:!0,printed:!1};case"print":return{matches:!0,pruned:!1,printed:!0};case"not":{let n=N(e.expr,t);return{matches:!n.matches,pruned:n.pruned,printed:!1}}case"and":{let n=N(e.left,t);if(!n.matches)return{matches:!1,pruned:n.pruned,printed:!1};let r=N(e.right,t);return{matches:r.matches,pruned:n.pruned||r.pruned,printed:n.printed||r.printed}}case"or":{let n=N(e.left,t);if(n.matches)return n;let r=N(e.right,t);return{matches:r.matches,pruned:n.pruned||r.pruned,printed:r.printed}}}}function _(e){if(!e)return!1;switch(e.type){case"name":case"path":case"regex":case"type":case"prune":case"print":return!1;case"empty":case"mtime":case"newer":case"size":case"perm":return!0;case"not":return _(e.expr);case"and":case"or":return _(e.left)||_(e.right)}}function j(e){if(!e)return!1;switch(e.type){case"empty":return!0;case"not":return j(e.expr);case"and":case"or":return j(e.left)||j(e.right);default:return!1}}function fe(e){let t={terminalDirName:null,requiredExtension:null};if(!e)return t;let n=ve(e);if(Ee(e)&&n.length===1){let o=n[0].split("/").filter(i=>i.length>0);if(o.length>=2)for(let i=o.length-2;i>=0;i--){let a=o[i];if(!a.includes("*")&&!a.includes("?")&&!a.includes("[")&&a!=="."&&a!==".."){let p=o[i+1];if(p&&(p.includes("*")||p.includes("?"))){t.terminalDirName=a;let l=p.match(/^\*(\.[a-zA-Z0-9]+)$/);l&&(t.requiredExtension=l[1])}break}}}return t}function ve(e){let t=[],n=r=>{r.type==="path"?t.push(r.pattern):r.type==="not"?n(r.expr):(r.type==="and"||r.type==="or")&&(n(r.left),n(r.right))};return n(e),t}function Ee(e){let t=n=>n.type==="type"&&n.fileType==="f"?!0:n.type==="not"?t(n.expr):n.type==="and"||n.type==="or"?t(n.left)||t(n.right):!1;return t(e)}function ue(e){let t=[],n=r=>{r&&(r.type==="newer"?t.push(r.refPath):r.type==="not"?n(r.expr):(r.type==="and"||r.type==="or")&&(n(r.left),n(r.right)))};return n(e),t}function J(e){if(!e)return!0;switch(e.type){case"name":case"path":case"regex":case"type":case"prune":case"print":return!0;case"empty":case"mtime":case"newer":case"size":case"perm":return!1;case"not":return J(e.expr);case"and":case"or":return J(e.left)&&J(e.right)}}function H(e,t,n,r,s){switch(e.type){case"name":{let o=e.pattern,i=o.match(/^\*(\.[a-zA-Z0-9]+)$/);if(i){let a=i[1];if(e.ignoreCase){if(!t.toLowerCase().endsWith(a.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!t.endsWith(a))return{matches:!1,pruned:!1,printed:!1};return{matches:!0,pruned:!1,printed:!1}}return{matches:Y(t,o,e.ignoreCase),pruned:!1,printed:!1}}case"path":{let o=e.pattern,i=o.split("/");for(let p=0;p<i.length-1;p++){let l=i[p];if(l&&l!=="."&&l!==".."&&!l.includes("*")&&!l.includes("?")&&!l.includes("[")){let d=`/${l}/`;if(e.ignoreCase){if(!n.toLowerCase().includes(d.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!n.includes(d))return{matches:!1,pruned:!1,printed:!1}}}let a=o.match(/\*(\.[a-zA-Z0-9]+)$/);if(a){let p=a[1];if(e.ignoreCase){if(!n.toLowerCase().endsWith(p.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!n.endsWith(p))return{matches:!1,pruned:!1,printed:!1}}return{matches:Y(n,o,e.ignoreCase),pruned:!1,printed:!1}}case"regex":try{let o=e.ignoreCase?"i":"";return{matches:te(e.pattern,o).test(n),pruned:!1,printed:!1}}catch{return{matches:!1,pruned:!1,printed:!1}}case"type":return e.fileType==="f"?{matches:r,pruned:!1,printed:!1}:e.fileType==="d"?{matches:s,pruned:!1,printed:!1}:{matches:!1,pruned:!1,printed:!1};case"prune":return{matches:!0,pruned:!0,printed:!1};case"print":return{matches:!0,pruned:!1,printed:!0};case"not":{let o=H(e.expr,t,n,r,s);return{matches:!o.matches,pruned:o.pruned,printed:!1}}case"and":{let o=H(e.left,t,n,r,s);if(!o.matches)return{matches:!1,pruned:o.pruned,printed:!1};let i=H(e.right,t,n,r,s);return{matches:i.matches,pruned:o.pruned||i.pruned,printed:o.printed||i.printed}}case"or":{let o=H(e.left,t,n,r,s);if(o.matches)return o;let i=H(e.right,t,n,r,s);return{matches:i.matches,pruned:o.pruned||i.pruned,printed:i.printed}}default:return{matches:!1,pruned:!1,printed:!1}}}function V(e){if(!e)return!1;switch(e.type){case"prune":return!0;case"not":return V(e.expr);case"and":case"or":return V(e.left)||V(e.right);default:return!1}}function W(e){switch(e.type){case"name":case"path":case"regex":case"type":case"prune":case"print":return!0;case"empty":case"mtime":case"newer":case"size":case"perm":return!1;case"not":return W(e.expr);case"and":case"or":return W(e.left)&&W(e.right)}}function he(e,t){if(!e||!t.isDirectory)return{shouldPrune:!1};if(!W(e))return se(e,t);let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};return{shouldPrune:N(e,n).pruned}}function se(e,t){switch(e.type){case"or":{if(W(e.left)){let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};if(N(e.left,n).pruned)return{shouldPrune:!0}}return se(e.right,t)}case"and":{if(W(e.left)&&W(e.right)){let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};return{shouldPrune:N(e,n).pruned}}if(W(e.left)){let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};return N(e.left,n).matches?se(e.right,t):{shouldPrune:!1}}return{shouldPrune:!1}}case"not":return{shouldPrune:!1};default:return{shouldPrune:!1}}}function de(e,t){let n=[],r=[],s=t;for(;s<e.length;){let i=e[s];if(i==="("||i==="\\("){n.push({type:"lparen"}),s++;continue}if(i===")"||i==="\\)"){n.push({type:"rparen"}),s++;continue}if(i==="-name"&&s+1<e.length)n.push({type:"expr",expr:{type:"name",pattern:e[++s]}});else if(i==="-iname"&&s+1<e.length)n.push({type:"expr",expr:{type:"name",pattern:e[++s],ignoreCase:!0}});else if(i==="-path"&&s+1<e.length)n.push({type:"expr",expr:{type:"path",pattern:e[++s]}});else if(i==="-ipath"&&s+1<e.length)n.push({type:"expr",expr:{type:"path",pattern:e[++s],ignoreCase:!0}});else if(i==="-regex"&&s+1<e.length)n.push({type:"expr",expr:{type:"regex",pattern:e[++s]}});else if(i==="-iregex"&&s+1<e.length)n.push({type:"expr",expr:{type:"regex",pattern:e[++s],ignoreCase:!0}});else if(i==="-type"&&s+1<e.length){let a=e[++s];if(a==="f"||a==="d")n.push({type:"expr",expr:{type:"type",fileType:a}});else return{expr:null,pathIndex:s,error:`find: Unknown argument to -type: ${a}
|
|
3
|
+
`,actions:[]}}else if(i==="-empty")n.push({type:"expr",expr:{type:"empty"}});else if(i==="-mtime"&&s+1<e.length){let a=e[++s],p="exact",l=a;a.startsWith("+")?(p="more",l=a.slice(1)):a.startsWith("-")&&(p="less",l=a.slice(1));let d=parseInt(l,10);Number.isNaN(d)||n.push({type:"expr",expr:{type:"mtime",days:d,comparison:p}})}else if(i==="-newer"&&s+1<e.length){let a=e[++s];n.push({type:"expr",expr:{type:"newer",refPath:a}})}else if(i==="-size"&&s+1<e.length){let a=e[++s],p="exact",l=a;a.startsWith("+")?(p="more",l=a.slice(1)):a.startsWith("-")&&(p="less",l=a.slice(1));let d=l.match(/^(\d+)([ckMGb])?$/);if(d){let B=parseInt(d[1],10),I=d[2]||"b";n.push({type:"expr",expr:{type:"size",value:B,unit:I,comparison:p}})}}else if(i==="-perm"&&s+1<e.length){let a=e[++s],p="exact",l=a;a.startsWith("-")?(p="all",l=a.slice(1)):a.startsWith("/")&&(p="any",l=a.slice(1));let d=parseInt(l,8);Number.isNaN(d)||n.push({type:"expr",expr:{type:"perm",mode:d,matchType:p}})}else if(i==="-prune")n.push({type:"expr",expr:{type:"prune"}});else if(i==="-not"||i==="!")n.push({type:"not"});else if(i==="-o"||i==="-or")n.push({type:"op",op:"or"});else if(i==="-a"||i==="-and")n.push({type:"op",op:"and"});else if(i==="-maxdepth"||i==="-mindepth")s++;else if(i!=="-depth")if(i==="-exec"){let a=[];for(s++;s<e.length&&e[s]!==";"&&e[s]!=="+";)a.push(e[s]),s++;if(s>=e.length)return{expr:null,pathIndex:s,error:"find: missing argument to `-exec'\n",actions:[]};let p=e[s]==="+";r.push({type:"exec",command:a,batchMode:p})}else if(i==="-print")n.push({type:"expr",expr:{type:"print"}}),r.push({type:"print"});else if(i==="-print0")r.push({type:"print0"});else if(i==="-printf"&&s+1<e.length){let a=e[++s];r.push({type:"printf",format:a})}else if(i==="-delete")r.push({type:"delete"});else{if(i.startsWith("-"))return{expr:null,pathIndex:s,error:`find: unknown predicate '${i}'
|
|
4
|
+
`,actions:[]};if(n.length===0){s++;continue}break}s++}if(n.length===0)return{expr:null,pathIndex:s,actions:r};let o=Me(n);return o.error?{expr:null,pathIndex:s,error:o.error,actions:r}:{expr:o.expr,pathIndex:s,actions:r}}function Me(e){let t=0;function n(){let a=r();if(!a)return null;for(;t<e.length;){let p=e[t];if(p.type==="op"&&p.op==="or"){t++;let l=r();if(!l)return a;a={type:"or",left:a,right:l}}else break}return a}function r(){let a=s();if(!a)return null;for(;t<e.length;){let p=e[t];if(p.type==="op"&&p.op==="and"){t++;let l=s();if(!l)return a;a={type:"and",left:a,right:l}}else if(p.type==="expr"||p.type==="not"||p.type==="lparen"){let l=s();if(!l)return a;a={type:"and",left:a,right:l}}else break}return a}function s(){if(t<e.length&&e[t].type==="not"){t++;let a=s();return a?{type:"not",expr:a}:null}return o()}function o(){if(t>=e.length)return null;let a=e[t];if(a.type==="lparen"){t++;let p=n();return t<e.length&&e[t].type==="rparen"&&t++,p}return a.type==="expr"?(t++,a.expr):(a.type==="rparen",null)}return{expr:n()}}var me=500;function xe(){return{readdirCalls:0,readdirTime:0,statCalls:0,statTime:0,evalCalls:0,evalTime:0,nodeCount:0,batchCount:0,batchTime:0,earlyPrunes:0}}function Fe(e,t,n){e({category:"find",name:"summary",durationMs:n,details:{readdirCalls:t.readdirCalls,readdirTimeMs:t.readdirTime,statCalls:t.statCalls,statTimeMs:t.statTime,evalCalls:t.evalCalls,evalTimeMs:t.evalTime,nodeCount:t.nodeCount,batchCount:t.batchCount,batchTimeMs:t.batchTime,earlyPrunes:t.earlyPrunes,otherTimeMs:n-t.readdirTime-t.statTime-t.evalTime-t.batchTime}})}var Ie={name:"find",summary:"search for files in a directory hierarchy",usage:"find [path...] [expression]",options:["-name PATTERN file name matches shell pattern PATTERN","-iname PATTERN like -name but case insensitive","-path PATTERN file path matches shell pattern PATTERN","-ipath PATTERN like -path but case insensitive","-regex PATTERN file path matches regular expression PATTERN","-iregex PATTERN like -regex but case insensitive","-type TYPE file is of type: f (regular file), d (directory)","-empty file is empty or directory is empty","-mtime N file's data was modified N*24 hours ago","-newer FILE file was modified more recently than FILE","-size N[ckMGb] file uses N units of space (c=bytes, k=KB, M=MB, G=GB, b=512B blocks)","-perm MODE file's permission bits are exactly MODE (octal)","-perm -MODE all permission bits MODE are set","-perm /MODE any permission bits MODE are set","-maxdepth LEVELS descend at most LEVELS directories","-mindepth LEVELS do not apply tests at levels less than LEVELS","-depth process directory contents before directory itself","-prune do not descend into this directory","-not, ! negate the following expression","-a, -and logical AND (default)","-o, -or logical OR","-exec CMD {} ; execute CMD on each file ({} is replaced by filename)","-exec CMD {} + execute CMD with multiple files at once","-print print the full file name (default action)","-print0 print the full file name followed by a null character","-printf FORMAT print FORMAT with directives: %f %h %p %P %s %d %m %M %t","-delete delete found files/directories"," --help display this help and exit"]},$e=new Set(["-name","-iname","-path","-ipath","-regex","-iregex","-type","-maxdepth","-mindepth","-mtime","-newer","-size","-perm"]),_e={name:"find",async execute(e,t){if(le(e))return ie(Ie);let n=[],r=null,s=null,o=!1,i=!1;for(let c=0;c<e.length;c++){let f=e[c];if(f==="-maxdepth"&&c+1<e.length)i=!0,r=parseInt(e[++c],10);else if(f==="-mindepth"&&c+1<e.length)i=!0,s=parseInt(e[++c],10);else if(f==="-depth")i=!0,o=!0;else if(f==="-exec")for(i=!0,c++;c<e.length&&e[c]!==";"&&e[c]!=="+";)c++;else!f.startsWith("-")&&f!==";"&&f!=="+"&&f!=="("&&f!==")"&&f!=="\\("&&f!=="\\)"&&f!=="!"?i||n.push(f):$e.has(f)?(i=!0,c++):(f.startsWith("-")||f==="("||f==="\\("||f==="!")&&(i=!0)}n.length===0&&n.push(".");let{expr:a,error:p,actions:l}=de(e,0);if(p)return{stdout:"",stderr:p,exitCode:1};let d=l.some(c=>c.type==="print"),B=l.length===0,I=[],ye=l.some(c=>c.type==="printf"),re=[],q="",G=0,ge=ue(a),U=new Map;for(let c of ge){let f=t.fs.resolvePath(t.cwd,c);try{let h=await t.fs.stat(f);U.set(c,h.mtime?.getTime()??Date.now())}catch{}}let we=l.some(c=>{if(c.type!=="printf")return!1;let f=c.format.replace(/%%/g,"");return/%[-+]?[0-9]*\.?[0-9]*(s|m|M|t|T)/.test(f)}),De=_(a)||we,Te=j(a),K=fe(a),ae=V(a),Ce=J(a),Pe=typeof t.fs.readdirWithFileTypes=="function";for(let c of n){let z=function(u){let R=s===null||u.depth>=s,P=!1;if(R&&a!==null){let S=Date.now(),y;if(Ce)y=H(a,u.name,u.relativePath,u.isFile,u.isDirectory);else{let m={name:u.name,relativePath:u.relativePath,isFile:u.isFile,isDirectory:u.isDirectory,isEmpty:u.isEmpty,mtime:u.stat?.mtime?.getTime()??Date.now(),size:u.stat?.size??0,mode:u.stat?.mode??420,newerRefTimes:U};y=N(a,m)}R=y.matches,P=d?y.printed:R,h.evalCalls++,h.evalTime+=Date.now()-S}else R&&(P=!0);return P?{print:!0,printfData:ye?{path:u.relativePath,name:u.name,size:u.stat?.size??0,mtime:u.stat?.mtime?.getTime()??Date.now(),mode:u.stat?.mode??420,isDirectory:u.isDirectory,depth:u.depth,startingPoint:c}:null}:{print:!1,printfData:null}};var We=z;c.length>1&&c.endsWith("/")&&(c=c.slice(0,-1));let f=t.fs.resolvePath(t.cwd,c);try{await t.fs.stat(f)}catch{q+=`find: ${c}: No such file or directory
|
|
5
|
+
`,G=1;continue}let h=xe(),$=Date.now();async function v(u){let{path:b,depth:R,typeInfo:P}=u;if(h.nodeCount++,R>(r??256))return null;let E,S,y;if(P&&!De)E=P.isFile,S=P.isDirectory;else{try{let L=Date.now();y=await t.fs.stat(b),h.statCalls++,h.statTime+=Date.now()-L}catch{return null}if(!y)return null;E=y.isFile,S=y.isDirectory}let m;b===f?m=c.split("/").pop()||c:m=b.split("/").pop()||"";let g=b===f?c:c==="."?`./${b.slice(f==="/"?f.length:f.length+1)}`:c+b.slice(f.length),T=[],C=null,w=null,D=!1;S&&ae&&!o&&(D=he(a,{name:m,relativePath:g,isFile:E,isDirectory:S}).shouldPrune,D&&h.earlyPrunes++);let x=R>=(r??256),F=K.terminalDirName!==null&&m===K.terminalDirName,Z=!x&&!F&&!D;if(S&&((Z||Te||F)&&!D)){let L=Date.now();if(Pe&&t.fs.readdirWithFileTypes){if(C=await t.fs.readdirWithFileTypes(b),w=C.map(M=>M.name),h.readdirCalls++,h.readdirTime+=Date.now()-L,Z)T=C.map((M,k)=>({path:b==="/"?`/${M.name}`:`${b}/${M.name}`,depth:R+1,typeInfo:{isFile:M.isFile,isDirectory:M.isDirectory},resultIndex:k}));else if(F){let M=K.requiredExtension;T=C.filter(k=>k.isFile&&(!M||k.name.endsWith(M))).map((k,be)=>({path:b==="/"?`/${k.name}`:`${b}/${k.name}`,depth:R+1,typeInfo:{isFile:k.isFile,isDirectory:k.isDirectory},resultIndex:be}))}}else w=await t.fs.readdir(b),h.readdirCalls++,h.readdirTime+=Date.now()-L,Z&&(T=w.map((M,k)=>({path:b==="/"?`/${M}`:`${b}/${M}`,depth:R+1,resultIndex:k})))}let Q=E?(y?.size??0)===0:w!==null&&w.length===0,O=D;if(!o&&a!==null&&!D&&ae){let L=Date.now(),M={name:m,relativePath:g,isFile:E,isDirectory:S,isEmpty:Q,mtime:y?.mtime?.getTime()??Date.now(),size:y?.size??0,mode:y?.mode??420,newerRefTimes:U};O=N(a,M).pruned,h.evalCalls++,h.evalTime+=Date.now()-L}return{relativePath:g,name:m,isFile:E,isDirectory:S,isEmpty:Q,stat:y,depth:R,children:O?[]:T,pruned:O}}async function Se(){let u={paths:[],printfData:[]};if(o){let y=function(m){let g={paths:[],printfData:[]},T=P[m];if(!T)return g;for(let D of T.childIndices){let x=y(D);g.paths.push(...x.paths),g.printfData.push(...x.printfData)}let{print:C,printfData:w}=z(T.node);return C&&(g.paths.push(T.node.relativePath),w&&g.printfData.push(w)),g};var b=y;let P=[],E=[{item:{path:f,depth:0,resultIndex:0},parentIndex:-1,childOrderInParent:0}],S=new Map;for(;E.length>0;){let m=Date.now(),g=E.splice(0,me),T=await Promise.all(g.map(C=>v(C.item)));h.batchCount++,h.batchTime+=Date.now()-m;for(let C=0;C<g.length;C++){let w=T[C],D=g[C];if(!w)continue;let x=P.length;if(D.parentIndex>=0){let F=S.get(D.parentIndex)||[];F.push(x),S.set(D.parentIndex,F)}P.push({node:w,parentIndex:D.parentIndex,childIndices:[]});for(let F=0;F<w.children.length;F++)E.push({item:w.children[F],parentIndex:x,childOrderInParent:F})}}for(let[m,g]of S)m>=0&&m<P.length&&(P[m].childIndices=g);if(P.length>0){let m=y(0);u.paths.push(...m.paths),u.printfData.push(...m.printfData)}}else{let m=function(g){let T=P.get(g);T&&(u.paths.push(T.path),T.printfData&&u.printfData.push(T.printfData));let C=y.get(g);if(C)for(let w of C)m(w)};var R=m;let P=new Map,E=0,S=[{item:{path:f,depth:0,resultIndex:0},orderIndex:E++}],y=new Map;for(;S.length>0;){let g=Date.now(),T=S.splice(0,me),C=await Promise.all(T.map(async({item:w,orderIndex:D})=>{let x=await v(w);return x?{node:x,orderIndex:D}:null}));h.batchCount++,h.batchTime+=Date.now()-g;for(let w of C){if(!w)continue;let{node:D,orderIndex:x}=w,{print:F,printfData:Z}=z(D);if(F&&P.set(x,{path:D.relativePath,printfData:Z}),D.children.length>0){let ee=[];for(let Q of D.children){let O=E++;ee.push(O),S.push({item:Q,orderIndex:O})}y.set(x,ee)}}}m(0)}return u}let X=await Se();if(I.push(...X.paths),re.push(...X.printfData),t.trace){let u=Date.now()-$;Fe(t.trace,h,u),t.trace({category:"find",name:"searchPath",durationMs:u,details:{path:c,resultsFound:X.paths.length}})}}let A="";if(l.length>0)for(let c of l)switch(c.type){case"print":A+=I.length>0?`${I.join(`
|
|
6
|
+
`)}
|
|
7
|
+
`:"";break;case"print0":A+=I.length>0?`${I.join("\0")}\0`:"";break;case"delete":{let f=[...I].sort((h,$)=>$.length-h.length);for(let h of f){let $=t.fs.resolvePath(t.cwd,h);try{await t.fs.rm($,{recursive:!1})}catch(v){let z=v instanceof Error?v.message:String(v);q+=`find: cannot delete '${h}': ${z}
|
|
8
|
+
`,G=1}}break}case"printf":for(let f of re)A+=Re(c.format,f);break;case"exec":if(!t.exec)return{stdout:"",stderr:`find: -exec not supported in this context
|
|
9
|
+
`,exitCode:1};if(c.batchMode){let f=[];for(let v of c.command)v==="{}"?f.push(...I):f.push(v);let h=ne(f),$=await t.exec(h,{cwd:t.cwd,signal:t.signal});A+=$.stdout,q+=$.stderr,$.exitCode!==0&&(G=$.exitCode)}else for(let f of I){let h=c.command.map(z=>z==="{}"?f:z),$=ne(h),v=await t.exec($,{cwd:t.cwd,signal:t.signal});A+=v.stdout,q+=v.stderr,v.exitCode!==0&&(G=v.exitCode)}break}else B&&(A=I.length>0?`${I.join(`
|
|
10
|
+
`)}
|
|
11
|
+
`:"");return{stdout:A,stderr:q,exitCode:G}}};function Re(e,t){let n=ce(e),r="",s=0;for(;s<n.length;)if(n[s]==="%"&&s+1<n.length){if(s++,n[s]==="%"){r+="%",s++;continue}let[o,i,a]=pe(n,s);if(s+=a,s>=n.length){r+="%";break}let p=n[s],l;switch(p){case"f":l=t.name,s++;break;case"h":{let d=t.path.lastIndexOf("/");l=d>0?t.path.slice(0,d):".",s++;break}case"p":l=t.path,s++;break;case"P":{let d=t.startingPoint;t.path===d?l="":t.path.startsWith(`${d}/`)?l=t.path.slice(d.length+1):d==="."&&t.path.startsWith("./")?l=t.path.slice(2):l=t.path,s++;break}case"s":l=String(t.size),s++;break;case"d":l=String(t.depth),s++;break;case"m":l=(t.mode&511).toString(8),s++;break;case"M":l=ke(t.mode,t.isDirectory),s++;break;case"t":{let d=new Date(t.mtime);l=Ne(d),s++;break}case"T":{if(s+1<n.length){let d=n[s+1],B=new Date(t.mtime);l=ze(B,d),s+=2}else l="%T",s++;break}default:r+=`%${o!==0||i!==-1?`${o}.${i}`:""}${p}`,s++;continue}r+=oe(l,o,i)}else r+=n[s],s++;return r}function ke(e,t){let n=e&511,r=t?"d":"-";return r+=n&256?"r":"-",r+=n&128?"w":"-",r+=n&64?"x":"-",r+=n&32?"r":"-",r+=n&16?"w":"-",r+=n&8?"x":"-",r+=n&4?"r":"-",r+=n&2?"w":"-",r+=n&1?"x":"-",r}function Ne(e){let t=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],n=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],r=t[e.getDay()],s=n[e.getMonth()],o=String(e.getDate()).padStart(2," "),i=String(e.getHours()).padStart(2,"0"),a=String(e.getMinutes()).padStart(2,"0"),p=String(e.getSeconds()).padStart(2,"0"),l=e.getFullYear();return`${r} ${s} ${o} ${i}:${a}:${p} ${l}`}function ze(e,t){switch(t){case"@":return String(e.getTime()/1e3);case"Y":return String(e.getFullYear());case"m":return String(e.getMonth()+1).padStart(2,"0");case"d":return String(e.getDate()).padStart(2,"0");case"H":return String(e.getHours()).padStart(2,"0");case"M":return String(e.getMinutes()).padStart(2,"0");case"S":return String(e.getSeconds()).padStart(2,"0");case"T":return`${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}:${String(e.getSeconds()).padStart(2,"0")}`;case"F":return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`;default:return`%T${t}`}}var je={name:"find",flags:[{flag:"-name",type:"value",valueHint:"pattern"},{flag:"-iname",type:"value",valueHint:"pattern"},{flag:"-type",type:"value",valueHint:"string"},{flag:"-maxdepth",type:"value",valueHint:"number"},{flag:"-mindepth",type:"value",valueHint:"number"},{flag:"-empty",type:"boolean"},{flag:"-print",type:"boolean"},{flag:"-print0",type:"boolean"}],needsFiles:!0};export{_e as a,je as b};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{a as l}from"./chunk-4OALHZXB.js";var c=new Map([["File operations",["ls","cat","head","tail","wc","touch","mkdir","rm","cp","mv","ln","chmod","stat","readlink"]],["Text processing",["grep","sed","awk","sort","uniq","cut","tr","tee","diff"]],["Search",["find"]],["Navigation & paths",["pwd","basename","dirname","tree","du"]],["Environment & shell",["echo","printf","env","printenv","export","alias","unalias","history","clear","true","false","bash","sh"]],["Data processing",["xargs","jq","base64","date"]],["Network",["curl","html-to-markdown"]]]);function d(n){let e=[],s=new Set(n);e.push(`Available commands:
|
|
3
|
+
`);let t=[];for(let[o,r]of c){let a=r.filter(i=>s.has(i));if(a.length>0){e.push(` ${o}:`),e.push(` ${a.join(", ")}
|
|
4
|
+
`);for(let i of a)s.delete(i)}}for(let o of s)t.push(o);return t.length>0&&(e.push(" Other:"),e.push(` ${t.sort().join(", ")}
|
|
5
|
+
`)),e.push("Use '<command> --help' for details on a specific command."),`${e.join(`
|
|
6
|
+
`)}
|
|
7
|
+
`}var h={name:"help",async execute(n,e){if(n.includes("--help")||n.includes("-h"))return{stdout:`help - display available commands
|
|
8
|
+
|
|
9
|
+
Usage: help [command]
|
|
10
|
+
|
|
11
|
+
Options:
|
|
12
|
+
-h, --help Show this help message
|
|
13
|
+
|
|
14
|
+
If a command name is provided, shows help for that command.
|
|
15
|
+
Otherwise, lists all available commands.
|
|
16
|
+
`,stderr:"",exitCode:0};if(n.length>0&&e.exec){let t=n[0];return e.exec(l([t,"--help"]),{cwd:e.cwd,signal:e.signal})}let s=e.getRegisteredCommands?.()??[];return{stdout:d(s),stderr:"",exitCode:0}}},p={name:"help",flags:[]};export{h as a,p as b};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as z,b as B,c as E}from"./chunk-G43H2WGH.js";import{a as $}from"./chunk-SE4C7FJY.js";import{a as
|
|
2
|
+
import{a as G}from"./chunk-4OALHZXB.js";import{a as z,b as B,c as E}from"./chunk-G43H2WGH.js";import{a as $}from"./chunk-SE4C7FJY.js";import{a as R,b as _,c as D}from"./chunk-GTNBSMZR.js";var U={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",".mdx",".markdown",".mdown",".mkd"],globs:[]},markdown:{extensions:[".md",".mdx",".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:[]}},M=class{types;constructor(){this.types=new Map(Object.entries(U).map(([t,n])=>[t,{extensions:[...n.extensions],globs:[...n.globs]}]))}addType(t){let n=t.indexOf(":");if(n===-1)return;let s=t.slice(0,n),r=t.slice(n+1);if(r.startsWith("include:")){let l=r.slice(8),i=this.types.get(l);if(i){let o=this.types.get(s)||{extensions:[],globs:[]};o.extensions.push(...i.extensions),o.globs.push(...i.globs),this.types.set(s,o)}}else{let l=this.types.get(s)||{extensions:[],globs:[]};if(r.startsWith("*.")&&!r.slice(2).includes("*")){let i=r.slice(1);l.extensions.includes(i)||l.extensions.push(i)}else l.globs.includes(r)||l.globs.push(r);this.types.set(s,l)}}clearType(t){let n=this.types.get(t);n&&(n.extensions=[],n.globs=[])}getType(t){return this.types.get(t)}getAllTypes(){return this.types}matchesType(t,n){let s=t.toLowerCase();for(let r of n){if(r==="all"){if(this.matchesAnyType(t))return!0;continue}let l=this.types.get(r);if(l){for(let i of l.extensions)if(s.endsWith(i))return!0;for(let i of l.globs)if(i.includes("*")){let o=i.replace(/\./g,"\\.").replace(/\*/g,".*");if($(`^${o}$`,"i").test(t))return!0}else if(s===i.toLowerCase())return!0}}return!1}matchesAnyType(t){let n=t.toLowerCase();for(let s of this.types.values()){for(let r of s.extensions)if(n.endsWith(r))return!0;for(let r of s.globs)if(r.includes("*")){let l=r.replace(/\./g,"\\.").replace(/\*/g,".*");if($(`^${l}$`,"i").test(t))return!0}else if(n===r.toLowerCase())return!0}return!1}};function q(){let e=[];for(let[t,n]of Object.entries(U).sort()){let s=[];for(let r of n.extensions)s.push(`*${r}`);for(let r of n.globs)s.push(r);e.push(`${t}: ${s.join(", ")}`)}return`${e.join(`
|
|
3
3
|
`)}
|
|
4
|
-
`}function
|
|
5
|
-
`,exitCode:1}}function
|
|
6
|
-
`,exitCode:1}};if(f.length===1){let b=
|
|
7
|
-
`);for(let s of n){let r=s.replace(/\s+$/,"");if(!r||r.startsWith("#"))continue;let l=!1;r.startsWith("!")&&(l=!0,r=r.slice(1));let i=!1;r.endsWith("/")&&(i=!0,r=r.slice(0,-1));let o=!1;r.startsWith("/")?(o=!0,r=r.slice(1)):r.includes("/")&&!r.startsWith("**/")&&(o=!0);let c=this.patternToRegex(r,o);this.patterns.push({pattern:s,regex:c,negated:l,directoryOnly:i,rooted:o})}}patternToRegex(t,n){let s="";n?s="^":s="(?:^|/)";let r=0;for(;r<t.length;){let l=t[r];if(l==="*")t[r+1]==="*"?t[r+2]==="/"?(s+="(?:.*/)?",r+=3):(r+2>=t.length,s+=".*",r+=2):(s+="[^/]*",r++);else if(l==="?")s+="[^/]",r++;else if(l==="["){let i=r+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 o=t.slice(r,i+1);o.startsWith("[!")&&(o=`[^${o.slice(2)}`),s+=o,r=i+1}else s+="\\[",r++}else l==="/"?(s+="/",r++):(s+=l.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r++)}return s+="(?:/.*)?$",$(s)}matches(t,n){let s=t.replace(/^\.\//,"");s=s.replace(/^\//,"");let r=!1;for(let l of this.patterns)l.directoryOnly&&!n||l.regex.test(s)&&(r=!l.negated);return r}isWhitelisted(t,n){let s=t.replace(/^\.\//,"");s=s.replace(/^\//,"");for(let r of this.patterns)if(!(r.directoryOnly&&!n)&&r.negated&&r.regex.test(s))return!0;return!1}getBasePath(){return this.basePath}},k=class{parsers=[];fs;skipDotIgnore;skipVcsIgnore;loadedDirs=new Set;constructor(t,n,s=!1,r=!1){this.fs=t,this.skipDotIgnore=s,this.skipVcsIgnore=r}async load(t){let n=[],s=t;for(;;){n.unshift(s);let l=this.fs.resolvePath(s,"..");if(l===s)break;s=l}let r=[];this.skipVcsIgnore||r.push(".gitignore"),this.skipDotIgnore||r.push(".rgignore",".ignore");for(let l of n){this.loadedDirs.add(l);for(let i of r){let o=this.fs.resolvePath(l,i);try{let c=await this.fs.readFile(o),a=new T(l);a.parse(c),this.parsers.push(a)}catch{}}}}async loadForDirectory(t){if(this.loadedDirs.has(t))return;this.loadedDirs.add(t);let n=[];this.skipVcsIgnore||n.push(".gitignore"),this.skipDotIgnore||n.push(".rgignore",".ignore");for(let s of n){let r=this.fs.resolvePath(t,s);try{let l=await this.fs.readFile(r),i=new T(t);i.parse(l),this.parsers.push(i)}catch{}}}addPatternsFromContent(t,n){let s=new T(n);s.parse(t),this.parsers.push(s)}matches(t,n){for(let s of this.parsers){let r=s.getBasePath();if(!t.startsWith(r))continue;let l=t.slice(r.length).replace(/^\//,"");if(s.matches(l,n))return!0}return!1}isWhitelisted(t,n){for(let s of this.parsers){let r=s.getBasePath();if(!t.startsWith(r))continue;let l=t.slice(r.length).replace(/^\//,"");if(s.isWhitelisted(l,n))return!0}return!1}static isCommonIgnored(t){return new Set(["node_modules",".git",".svn",".hg","__pycache__",".pytest_cache",".mypy_cache","venv",".venv",".next",".nuxt",".cargo"]).has(t)}};async function
|
|
8
|
-
`,exitCode:1}}if(n.files){let f=[...n.patterns,...s];return
|
|
4
|
+
`}function H(){return{ignoreCase:!1,caseSensitive:!1,smartCase:!0,fixedStrings:!1,wordRegexp:!1,lineRegexp:!1,invertMatch:!1,multiline:!1,multilineDotall:!1,patterns:[],patternFiles:[],count:!1,countMatches:!1,files:!1,filesWithMatches:!1,filesWithoutMatch:!1,stats:!1,onlyMatching:!1,maxCount:0,lineNumber:!0,noFilename:!1,withFilename:!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:[],iglobs:[],globCaseInsensitive:!1,types:[],typesNot:[],typeAdd:[],typeClear:[],hidden:!1,noIgnore:!1,noIgnoreDot:!1,noIgnoreVcs:!1,ignoreFiles:[],maxDepth:256,maxFilesize:0,followSymlinks:!1,searchZip:!1,searchBinary:!1,preprocessor:null,preprocessorGlobs:[]}}function ee(e){let t=e.match(/^(\d+)([KMG])?$/i);if(!t)return 0;let n=parseInt(t[1],10);switch((t[2]||"").toUpperCase()){case"K":return n*1024;case"M":return n*1024*1024;case"G":return n*1024*1024*1024;default:return n}}function te(e){return/^\d+[KMG]?$/i.test(e)?null:{stdout:"",stderr:`rg: invalid --max-filesize value: ${e}
|
|
5
|
+
`,exitCode:1}}function V(e){return null}var Z=[{short:"g",long:"glob",target:"globs",multi:!0},{long:"iglob",target:"iglobs",multi:!0},{short:"t",long:"type",target:"types",multi:!0,validate:V},{short:"T",long:"type-not",target:"typesNot",multi:!0,validate:V},{long:"type-add",target:"typeAdd",multi:!0},{long:"type-clear",target:"typeClear",multi:!0},{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"},{short:"d",long:"max-depth",target:"maxDepth",parse:parseInt},{long:"max-filesize",target:"maxFilesize",parse:ee,validate:te},{long:"context-separator",target:"contextSeparator"},{short:"j",long:"threads",target:"maxDepth",parse:()=>1/0},{long:"ignore-file",target:"ignoreFiles",multi:!0},{long:"pre",target:"preprocessor"},{long:"pre-glob",target:"preprocessorGlobs",multi:!0}],se=new Map([["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}],["--multiline-dotall",e=>{e.multilineDotall=!0,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",e=>{e.files=!0}],["--files-with-matches",e=>{e.filesWithMatches=!0}],["--files-without-match",e=>{e.filesWithoutMatch=!0}],["--stats",e=>{e.stats=!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}],["H",e=>{e.withFilename=!0}],["--with-filename",e=>{e.withFilename=!0}],["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}],["--no-column",e=>{e.column=!1}],["--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}],["--no-ignore-dot",e=>{e.noIgnoreDot=!0}],["--no-ignore-vcs",e=>{e.noIgnoreVcs=!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}],["--glob-case-insensitive",e=>{e.globCaseInsensitive=!0}]]),ne=new Set(["n","--line-number"]);function re(e){e.hidden?e.searchBinary=!0:e.noIgnore?e.hidden=!0:e.noIgnore=!0}function ie(e,t,n){let s=e[t];for(let r of Z){if(s.startsWith(`--${r.long}=`)){let l=s.slice(`--${r.long}=`.length),i=O(n,r,l);return i?{newIndex:t,error:i}:{newIndex:t}}if(r.short&&s.startsWith(`-${r.short}`)&&s.length>2){let l=s.slice(2),i=O(n,r,l);return i?{newIndex:t,error:i}:{newIndex:t}}if(r.short&&s===`-${r.short}`||s===`--${r.long}`){if(t+1>=e.length)return null;let l=e[t+1],i=O(n,r,l);return i?{newIndex:t+1,error:i}:{newIndex:t+1}}}return null}function le(e){return Z.find(t=>t.short===e)}function O(e,t,n){if(t.validate){let r=t.validate(n);if(r)return r}let s=t.parse?t.parse(n):n;t.multi?e[t.target].push(s):e[t.target]=s}function oe(e,t){let n=e[t];if(n==="--sort"&&t+1<e.length){let s=e[t+1];if(s==="path"||s==="none")return{value:s,newIndex:t+1}}if(n.startsWith("--sort=")){let s=n.slice(7);if(s==="path"||s==="none")return{value:s,newIndex:t}}return null}function ae(e,t){let n=e[t],s=n.match(/^-([ABC])(\d+)$/);return s?{flag:s[1],value:parseInt(s[2],10),newIndex:t}:(n==="-A"||n==="-B"||n==="-C")&&t+1<e.length?{flag:n[1],value:parseInt(e[t+1],10),newIndex:t+1}:null}function ce(e){let t=e.match(/^-m(\d+)$/);return t?parseInt(t[1],10):null}function J(e){let t=H(),n=null,s=[],r=-1,l=-1,i=-1,o=!1;for(let c=0;c<e.length;c++){let a=e[c];if(a.startsWith("-")&&a!=="-"){let u=ae(e,c);if(u){let{flag:f,value:x,newIndex:b}=u;f==="A"?r=Math.max(r,x):f==="B"?l=Math.max(l,x):i=x,c=b;continue}let d=ce(a);if(d!==null){t.maxCount=d;continue}let p=ie(e,c,t);if(p){if(p.error)return{success:!1,error:p.error};c=p.newIndex;continue}let g=oe(e,c);if(g){t.sort=g.value,c=g.newIndex;continue}let w=a.startsWith("--")?[a]:a.slice(1).split(""),m=!1;for(let f of w){if(ne.has(f)){t.lineNumber=!0,o=!0;continue}if(f==="u"||f==="--unrestricted"){re(t);continue}if(f==="P"||f==="--pcre2")return{success:!1,error:{stdout:"",stderr:`rg: PCRE2 is not supported. Use standard regex syntax instead.
|
|
6
|
+
`,exitCode:1}};if(f.length===1){let b=le(f);if(b){if(c+1>=e.length)return{success:!1,error:D("rg",`-${f}`)};let h=O(t,b,e[c+1]);if(h)return{success:!1,error:h};c++,m=!0;continue}}let x=se.get(f);if(x){x(t);continue}if(f.startsWith("--"))return{success:!1,error:D("rg",f)};if(f.length===1)return{success:!1,error:D("rg",`-${f}`)}}}else n===null&&t.patterns.length===0&&t.patternFiles.length===0?n=a:s.push(a)}return(r>=0||i>=0)&&(t.afterContext=Math.max(r>=0?r:0,i>=0?i:0)),(l>=0||i>=0)&&(t.beforeContext=Math.max(l>=0?l:0,i>=0?i:0)),n!==null&&t.patterns.push(n),(t.column||t.vimgrep)&&(o=!0),{success:!0,options:t,paths:s,explicitLineNumbers:o}}import{gunzipSync as fe}from"node:zlib";var T=class{patterns=[];basePath;constructor(t="/"){this.basePath=t}parse(t){let n=t.split(`
|
|
7
|
+
`);for(let s of n){let r=s.replace(/\s+$/,"");if(!r||r.startsWith("#"))continue;let l=!1;r.startsWith("!")&&(l=!0,r=r.slice(1));let i=!1;r.endsWith("/")&&(i=!0,r=r.slice(0,-1));let o=!1;r.startsWith("/")?(o=!0,r=r.slice(1)):r.includes("/")&&!r.startsWith("**/")&&(o=!0);let c=this.patternToRegex(r,o);this.patterns.push({pattern:s,regex:c,negated:l,directoryOnly:i,rooted:o})}}patternToRegex(t,n){let s="";n?s="^":s="(?:^|/)";let r=0;for(;r<t.length;){let l=t[r];if(l==="*")t[r+1]==="*"?t[r+2]==="/"?(s+="(?:.*/)?",r+=3):(r+2>=t.length,s+=".*",r+=2):(s+="[^/]*",r++);else if(l==="?")s+="[^/]",r++;else if(l==="["){let i=r+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 o=t.slice(r,i+1);o.startsWith("[!")&&(o=`[^${o.slice(2)}`),s+=o,r=i+1}else s+="\\[",r++}else l==="/"?(s+="/",r++):(s+=l.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r++)}return s+="(?:/.*)?$",$(s)}matches(t,n){let s=t.replace(/^\.\//,"");s=s.replace(/^\//,"");let r=!1;for(let l of this.patterns)l.directoryOnly&&!n||l.regex.test(s)&&(r=!l.negated);return r}isWhitelisted(t,n){let s=t.replace(/^\.\//,"");s=s.replace(/^\//,"");for(let r of this.patterns)if(!(r.directoryOnly&&!n)&&r.negated&&r.regex.test(s))return!0;return!1}getBasePath(){return this.basePath}},k=class{parsers=[];fs;skipDotIgnore;skipVcsIgnore;loadedDirs=new Set;constructor(t,n,s=!1,r=!1){this.fs=t,this.skipDotIgnore=s,this.skipVcsIgnore=r}async load(t){let n=[],s=t;for(;;){n.unshift(s);let l=this.fs.resolvePath(s,"..");if(l===s)break;s=l}let r=[];this.skipVcsIgnore||r.push(".gitignore"),this.skipDotIgnore||r.push(".rgignore",".ignore");for(let l of n){this.loadedDirs.add(l);for(let i of r){let o=this.fs.resolvePath(l,i);try{let c=await this.fs.readFile(o),a=new T(l);a.parse(c),this.parsers.push(a)}catch{}}}}async loadForDirectory(t){if(this.loadedDirs.has(t))return;this.loadedDirs.add(t);let n=[];this.skipVcsIgnore||n.push(".gitignore"),this.skipDotIgnore||n.push(".rgignore",".ignore");for(let s of n){let r=this.fs.resolvePath(t,s);try{let l=await this.fs.readFile(r),i=new T(t);i.parse(l),this.parsers.push(i)}catch{}}}addPatternsFromContent(t,n){let s=new T(n);s.parse(t),this.parsers.push(s)}matches(t,n){for(let s of this.parsers){let r=s.getBasePath();if(!t.startsWith(r))continue;let l=t.slice(r.length).replace(/^\//,"");if(s.matches(l,n))return!0}return!1}isWhitelisted(t,n){for(let s of this.parsers){let r=s.getBasePath();if(!t.startsWith(r))continue;let l=t.slice(r.length).replace(/^\//,"");if(s.isWhitelisted(l,n))return!0}return!1}static isCommonIgnored(t){return new Set(["node_modules",".git",".svn",".hg","__pycache__",".pytest_cache",".mypy_cache","venv",".venv",".next",".nuxt",".cargo"]).has(t)}};async function A(e,t,n=!1,s=!1,r=[]){let l=new k(e,t,n,s);await l.load(t);for(let i of r)try{let o=e.resolvePath(t,i),c=await e.readFile(o);l.addPatternsFromContent(c,t)}catch{}return l}function ue(e){return e.length>=2&&e[0]===31&&e[1]===139}function he(e){let t=!1;for(let n=0;n<e.length;n++){let s=e[n];s==="["&&!t?t=!0:s==="]"&&t&&(t=!1)}return t?`rg: glob '${e}' has an unclosed character class`:null}async function Y(e){let{ctx:t,options:n,paths:s,explicitLineNumbers:r}=e;for(let f of n.globs){let x=f.startsWith("!")?f.slice(1):f,b=he(x);if(b)return{stdout:"",stderr:`${b}
|
|
8
|
+
`,exitCode:1}}if(n.files){let f=[...n.patterns,...s];return me(t,f,n)}let l=[...n.patterns];for(let f of n.patternFiles)try{let x;if(f==="-")x=t.stdin;else{let h=t.fs.resolvePath(t.cwd,f);x=await t.fs.readFile(h)}let b=x.split(`
|
|
9
9
|
`).filter(h=>h.length>0);l.push(...b)}catch{return{stdout:"",stderr:`rg: ${f}: No such file or directory
|
|
10
10
|
`,exitCode:2}}if(l.length===0)return n.patternFiles.length>0?{stdout:"",stderr:"",exitCode:1}:{stdout:"",stderr:`rg: no pattern given
|
|
11
|
-
`,exitCode:2};let i=s.length===0?["."]:s,o=
|
|
12
|
-
`,exitCode:2}}let u=null;n.noIgnore||(u=await
|
|
13
|
-
`;return{stdout:i.map(a=>a+o).join(""),stderr:"",exitCode:0}}function
|
|
14
|
-
`);n.lastIndex=0;let W=0;for(let S=0;S<N.length;S++){let j=N[S];n.lastIndex=0;let P=[];for(let I=n.exec(j);I!==null;I=n.exec(j)){let
|
|
11
|
+
`,exitCode:2};let i=s.length===0?["."]:s,o=ge(n,l),c,a;try{let f=pe(l,n,o);c=f.regex,a=f.kResetGroup}catch{return{stdout:"",stderr:`rg: invalid regex: ${l.join(", ")}
|
|
12
|
+
`,exitCode:2}}let u=null;n.noIgnore||(u=await A(t.fs,t.cwd,n.noIgnoreDot,n.noIgnoreVcs,n.ignoreFiles));let d=new M;for(let f of n.typeClear)d.clearType(f);for(let f of n.typeAdd)d.addType(f);let{files:p,singleExplicitFile:g}=await K(t,i,n,u,d);if(p.length===0)return{stdout:"",stderr:"",exitCode:1};let w=!n.noFilename&&(n.withFilename||!g||p.length>1),m=n.lineNumber;return r||(g&&p.length===1&&(m=!1),n.onlyMatching&&(m=!1)),ye(t,p,c,n,w,m,a)}function ge(e,t){return e.caseSensitive?!1:e.ignoreCase?!0:e.smartCase?!t.some(n=>/[A-Z]/.test(n)):!1}function pe(e,t,n){let s;return e.length===1?s=e[0]:s=e.map(r=>t.fixedStrings?r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"):`(?:${r})`).join("|"),B(s,{mode:t.fixedStrings&&e.length===1?"fixed":"perl",ignoreCase:n,wholeWord:t.wordRegexp,lineRegexp:t.lineRegexp,multiline:t.multiline,multilineDotall:t.multilineDotall})}async function K(e,t,n,s,r){let l=[],i=0,o=0;for(let a of t){let u=e.fs.resolvePath(e.cwd,a);try{let d=await e.fs.stat(u);if(d.isFile){if(i++,n.maxFilesize>0&&d.size>n.maxFilesize)continue;Q(a,n,s,u,r)&&l.push(a)}else d.isDirectory&&(o++,await X(e,a,u,0,n,s,r,l))}catch{}}return{files:n.sort==="path"?l.sort():l,singleExplicitFile:i===1&&o===0}}async function X(e,t,n,s,r,l,i,o){if(!(s>=r.maxDepth)){l&&await l.loadForDirectory(n);try{let c=e.fs.readdirWithFileTypes?await e.fs.readdirWithFileTypes(n):(await e.fs.readdir(n)).map(a=>({name:a,isFile:void 0}));for(let a of c){let u=a.name;if(!r.noIgnore&&k.isCommonIgnored(u))continue;let d=u.startsWith("."),p=t==="."?u:t==="./"?`./${u}`:t.endsWith("/")?`${t}${u}`:`${t}/${u}`,g=e.fs.resolvePath(n,u),w,m,f=!1;if(a.isFile!==void 0&&"isDirectory"in a){let h=a;if(f=h.isSymbolicLink===!0,f&&!r.followSymlinks)continue;if(f&&r.followSymlinks)try{let y=await e.fs.stat(g);w=y.isFile,m=y.isDirectory}catch{continue}else w=h.isFile,m=h.isDirectory}else try{let h=e.fs.lstat?await e.fs.lstat(g):await e.fs.stat(g);if(f=h.isSymbolicLink===!0,f&&!r.followSymlinks)continue;let y=f&&r.followSymlinks?await e.fs.stat(g):h;w=y.isFile,m=y.isDirectory}catch{continue}if(!l?.matches(g,m)&&!(d&&!r.hidden&&!l?.isWhitelisted(g,m))){if(m)await X(e,p,g,s+1,r,l,i,o);else if(w){if(r.maxFilesize>0)try{if((await e.fs.stat(g)).size>r.maxFilesize)continue}catch{continue}Q(p,r,l,g,i)&&o.push(p)}}}}catch{}}}function Q(e,t,n,s,r){let l=e.split("/").pop()||e;if(n?.matches(s,!1)||t.types.length>0&&!r.matchesType(l,t.types)||t.typesNot.length>0&&r.matchesType(l,t.typesNot))return!1;if(t.globs.length>0){let i=t.globCaseInsensitive,o=t.globs.filter(a=>!a.startsWith("!")),c=t.globs.filter(a=>a.startsWith("!")).map(a=>a.slice(1));if(o.length>0){let a=!1;for(let u of o)if(v(l,u,i)||v(e,u,i)){a=!0;break}if(!a)return!1}for(let a of c)if(a.startsWith("/")){let u=a.slice(1);if(v(e,u,i))return!1}else if(v(l,a,i)||v(e,a,i))return!1}if(t.iglobs.length>0){let i=t.iglobs.filter(c=>!c.startsWith("!")),o=t.iglobs.filter(c=>c.startsWith("!")).map(c=>c.slice(1));if(i.length>0){let c=!1;for(let a of i)if(v(l,a,!0)||v(e,a,!0)){c=!0;break}if(!c)return!1}for(let c of o)if(c.startsWith("/")){let a=c.slice(1);if(v(e,a,!0))return!1}else if(v(l,c,!0)||v(e,c,!0))return!1}return!0}function v(e,t,n=!1){let s="^";for(let r=0;r<t.length;r++){let l=t[r];if(l==="*")t[r+1]==="*"?(s+=".*",r++):s+="[^/]*";else if(l==="?")s+="[^/]";else if(l==="["){let i=r+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 o=t.slice(r,i+1);o.startsWith("[!")&&(o=`[^${o.slice(2)}`),s+=o,r=i}else s+="\\["}else s+=l.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}return s+="$",$(s,n?"i":"").test(e)}async function me(e,t,n){let s=null;n.noIgnore||(s=await A(e.fs,e.cwd,n.noIgnoreDot,n.noIgnoreVcs,n.ignoreFiles));let r=new M;for(let a of n.typeClear)r.clearType(a);for(let a of n.typeAdd)r.addType(a);let l=t.length===0?["."]:t,{files:i}=await K(e,l,n,s,r);if(i.length===0)return{stdout:"",stderr:"",exitCode:1};if(n.quiet)return{stdout:"",stderr:"",exitCode:0};let o=n.nullSeparator?"\0":`
|
|
13
|
+
`;return{stdout:i.map(a=>a+o).join(""),stderr:"",exitCode:0}}function de(e,t){if(t.length===0)return!0;for(let n of t)if(v(e,n,!1))return!0;return!1}async function xe(e,t,n,s){try{if(s.preprocessor&&e.exec){let i=n.split("/").pop()||n;if(de(i,s.preprocessorGlobs)){let o=await e.exec(G([s.preprocessor,t]),{cwd:e.cwd,signal:e.signal});if(o.exitCode===0&&o.stdout){let c=o.stdout.slice(0,8192);return{content:o.stdout,isBinary:c.includes("\0")}}}}if(s.searchZip&&n.endsWith(".gz")){let i=await e.fs.readFileBuffer(t);if(ue(i))try{let o=fe(i),c=new TextDecoder().decode(o),a=c.slice(0,8192);return{content:c,isBinary:a.includes("\0")}}catch{return null}}let r=await e.fs.readFile(t),l=r.slice(0,8192);return{content:r,isBinary:l.includes("\0")}}catch{return null}}async function ye(e,t,n,s,r,l,i){let o="",c=!1,a=[],u=0,d=0,p=0,g=50;e:for(let f=0;f<t.length;f+=g){let x=t.slice(f,f+g),b=await Promise.all(x.map(async h=>{let y=e.fs.resolvePath(e.cwd,h),F=await xe(e,y,h,s);if(!F)return null;let{content:C,isBinary:N}=F;if(p+=C.length,N&&!s.searchBinary)return null;let W=r&&!s.heading?h:"",S=z(C,n,{invertMatch:s.invertMatch,showLineNumbers:l,countOnly:s.count,countMatches:s.countMatches,filename:W,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!==null?E(s.replace):null,passthru:s.passthru,multiline:s.multiline,kResetGroup:i});return s.json&&S.matched?{file:h,result:S,content:C,isBinary:!1}:{file:h,result:S}}));for(let h of b){if(!h)continue;let{file:y,result:F}=h;if(F.matched){if(c=!0,d++,u+=F.matchCount,s.quiet&&!s.json)break e;if(s.json&&!s.quiet){let C=h.content||"";a.push(JSON.stringify({type:"begin",data:{path:{text:y}}}));let N=C.split(`
|
|
14
|
+
`);n.lastIndex=0;let W=0;for(let S=0;S<N.length;S++){let j=N[S];n.lastIndex=0;let P=[];for(let I=n.exec(j);I!==null;I=n.exec(j)){let L={match:{text:I[0]},start:I.index,end:I.index+I[0].length};s.replace!==null&&(L.replacement={text:s.replace}),P.push(L),I[0].length===0&&n.lastIndex++}if(P.length>0){let I={type:"match",data:{path:{text:y},lines:{text:`${j}
|
|
15
15
|
`},line_number:S+1,absolute_offset:W,submatches:P}};a.push(JSON.stringify(I))}W+=j.length+1}a.push(JSON.stringify({type:"end",data:{path:{text:y},binary_offset:null,stats:{elapsed:{secs:0,nanos:0,human:"0s"},searches:1,searches_with_match:1,bytes_searched:C.length,bytes_printed:0,matched_lines:F.matchCount,matches:F.matchCount}}}))}else if(s.filesWithMatches){let C=s.nullSeparator?"\0":`
|
|
16
16
|
`;o+=`${y}${C}`}else s.filesWithoutMatch||(s.heading&&!s.noFilename&&(o+=`${y}
|
|
17
17
|
`),o+=F.output)}else if(s.filesWithoutMatch){let C=s.nullSeparator?"\0":`
|
|
@@ -19,7 +19,7 @@ import{a as z,b as B,c as E}from"./chunk-G43H2WGH.js";import{a as $}from"./chunk
|
|
|
19
19
|
`)}
|
|
20
20
|
`);let w=s.quiet&&!s.json?"":o;if(s.stats&&!s.json){let f=["",`${u} matches`,`${u} matched lines`,`${d} files contained matches`,`${t.length} files searched`,`${p} bytes searched`].join(`
|
|
21
21
|
`);w+=`${f}
|
|
22
|
-
`}let m;return s.filesWithoutMatch?m=o.length>0?0:1:m=c?0:1,{stdout:w,stderr:"",exitCode:m}}var
|
|
22
|
+
`}let m;return s.filesWithoutMatch?m=o.length>0?0:1:m=c?0:1,{stdout:w,stderr:"",exitCode:m}}var be={name:"rg",summary:"recursively search for a pattern",usage:"rg [OPTIONS] PATTERN [PATH ...]",description:`rg (ripgrep) recursively searches directories for a regex pattern.
|
|
23
23
|
Unlike grep, rg is recursive by default and respects .gitignore files.
|
|
24
24
|
|
|
25
25
|
EXAMPLES:
|
|
@@ -30,4 +30,4 @@ EXAMPLES:
|
|
|
30
30
|
rg -t js foo Search only JavaScript files
|
|
31
31
|
rg -g '*.ts' foo Search files matching glob
|
|
32
32
|
rg --hidden foo Include hidden files
|
|
33
|
-
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"," --files list files that would be searched","-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"," --stats print search statistics","-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","-d, --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"]},
|
|
33
|
+
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"," --files list files that would be searched","-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"," --stats print search statistics","-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","-d, --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"]},_e={name:"rg",async execute(e,t){if(_(e))return R(be);if(e.includes("--type-list"))return{stdout:q(),stderr:"",exitCode:0};let n=J(e);return n.success?Y({ctx:t,options:n.options,paths:n.paths,explicitLineNumbers:n.explicitLineNumbers}):n.error}},ze={name:"rg",flags:[{flag:"-i",type:"boolean"},{flag:"-s",type:"boolean"},{flag:"-S",type:"boolean"},{flag:"-F",type:"boolean"},{flag:"-w",type:"boolean"},{flag:"-x",type:"boolean"},{flag:"-v",type:"boolean"},{flag:"-c",type:"boolean"},{flag:"-l",type:"boolean"},{flag:"-o",type:"boolean"},{flag:"-n",type:"boolean"},{flag:"-N",type:"boolean"},{flag:"--hidden",type:"boolean"},{flag:"--no-ignore",type:"boolean"},{flag:"-m",type:"value",valueHint:"number"},{flag:"-A",type:"value",valueHint:"number"},{flag:"-B",type:"value",valueHint:"number"},{flag:"-C",type:"value",valueHint:"number"},{flag:"-g",type:"value",valueHint:"pattern"},{flag:"-t",type:"value",valueHint:"string"},{flag:"-T",type:"value",valueHint:"string"}],needsArgs:!0};export{_e as a,ze as b};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as Ja}from"./chunk-QSDVMMYI.js";import{a as Le,b as Oi}from"./chunk-
|
|
2
|
+
import{a as Ja}from"./chunk-QSDVMMYI.js";import{a as Le,b as Oi}from"./chunk-EPIOK4SY.js";import{k as Ts}from"./chunk-6KZRLMG3.js";import{a as Ai,b as Ti,c as ae}from"./chunk-GTNBSMZR.js";import{a as bt,c as b,e as As}from"./chunk-KGOUQS5A.js";var Yi=b((rp,Ri)=>{var{hasOwnProperty:Ps}=Object.prototype,Ms=(s,e={})=>{typeof e=="string"&&(e={section:e}),e.align=e.align===!0,e.newline=e.newline===!0,e.sort=e.sort===!0,e.whitespace=e.whitespace===!0||e.align===!0,e.platform=e.platform||typeof process<"u"&&process.platform,e.bracketedArray=e.bracketedArray!==!1;let t=e.platform==="win32"?`\r
|
|
3
3
|
`:`
|
|
4
4
|
`,n=e.whitespace?" = ":"=",i=[],r=e.sort?Object.keys(s).sort():Object.keys(s),o=0;e.align&&(o=G(r.filter(c=>s[c]===null||Array.isArray(s[c])||typeof s[c]!="object").map(c=>Array.isArray(s[c])?`${c}[]`:c).concat([""]).reduce((c,u)=>G(c).length>=G(u).length?c:u)).length);let a="",l=e.bracketedArray?"[]":"";for(let c of r){let u=s[c];if(u&&Array.isArray(u))for(let f of u)a+=G(`${c}${l}`).padEnd(o," ")+n+G(f)+t;else u&&typeof u=="object"?i.push(c):a+=G(c).padEnd(o," ")+n+G(u)+t}e.section&&a.length&&(a="["+G(e.section)+"]"+(e.newline?t+t:t)+a);for(let c of i){let u=Vi(c,".").join("\\."),f=(e.section?e.section+".":"")+u,d=Ms(s[c],{...e,section:f});a.length&&d.length&&(a+=t),a+=d}return a};function Vi(s,e){var t=0,n=0,i=0,r=[];do if(i=s.indexOf(e,t),i!==-1){if(t=i+e.length,i>0&&s[i-1]==="\\")continue;r.push(s.slice(n,i)),n=i+e.length}while(i!==-1);return r.push(s.slice(n)),r}var ji=(s,e={})=>{e.bracketedArray=e.bracketedArray!==!1;let t=Object.create(null),n=t,i=null,r=/^\[([^\]]*)\]\s*$|^([^=]+)(=(.*))?$/i,o=s.split(/[\r\n]+/g),a={};for(let c of o){if(!c||c.match(/^\s*[;#]/)||c.match(/^\s*$/))continue;let u=c.match(r);if(!u)continue;if(u[1]!==void 0){if(i=Nt(u[1]),i==="__proto__"){n=Object.create(null);continue}n=t[i]=t[i]||Object.create(null);continue}let f=Nt(u[2]),d;e.bracketedArray?d=f.length>2&&f.slice(-2)==="[]":(a[f]=(a?.[f]||0)+1,d=a[f]>1);let p=d&&f.endsWith("[]")?f.slice(0,-2):f;if(p==="__proto__")continue;let g=u[3]?Nt(u[4]):!0,h=g==="true"||g==="false"||g==="null"?JSON.parse(g):g;d&&(Ps.call(n,p)?Array.isArray(n[p])||(n[p]=[n[p]]):n[p]=[]),Array.isArray(n[p])?n[p].push(h):n[p]=h}let l=[];for(let c of Object.keys(t)){if(!Ps.call(t,c)||typeof t[c]!="object"||Array.isArray(t[c]))continue;let u=Vi(c,".");n=t;let f=u.pop(),d=f.replace(/\\\./g,".");for(let p of u)p!=="__proto__"&&((!Ps.call(n,p)||typeof n[p]!="object")&&(n[p]=Object.create(null)),n=n[p]);n===t&&d===f||(n[d]=t[c],l.push(c))}for(let c of l)delete t[c];return t},Ki=s=>s.startsWith('"')&&s.endsWith('"')||s.startsWith("'")&&s.endsWith("'"),G=s=>typeof s!="string"||s.match(/[=\r\n]/)||s.match(/^\[/)||s.length>1&&Ki(s)||s!==s.trim()?JSON.stringify(s):s.split(";").join("\\;").split("#").join("\\#"),Nt=s=>{if(s=(s||"").trim(),Ki(s)){s.charAt(0)==="'"&&(s=s.slice(1,-1));try{s=JSON.parse(s)}catch{}}else{let e=!1,t="";for(let n=0,i=s.length;n<i;n++){let r=s.charAt(n);if(e)"\\;#".indexOf(r)!==-1?t+=r:t+="\\"+r,e=!1;else{if(";#".indexOf(r)!==-1)break;r==="\\"?e=!0:t+=r}}return e&&(t+="\\"),t.trim()}return s};Ri.exports={parse:ji,decode:ji,stringify:Ms,encode:Ms,safe:G,unsafe:Nt}});var O=b($=>{"use strict";var Fs=Symbol.for("yaml.alias"),Di=Symbol.for("yaml.document"),kt=Symbol.for("yaml.map"),zi=Symbol.for("yaml.pair"),js=Symbol.for("yaml.scalar"),It=Symbol.for("yaml.seq"),X=Symbol.for("yaml.node.type"),Xl=s=>!!s&&typeof s=="object"&&s[X]===Fs,Ql=s=>!!s&&typeof s=="object"&&s[X]===Di,Hl=s=>!!s&&typeof s=="object"&&s[X]===kt,Dl=s=>!!s&&typeof s=="object"&&s[X]===zi,Zi=s=>!!s&&typeof s=="object"&&s[X]===js,zl=s=>!!s&&typeof s=="object"&&s[X]===It;function er(s){if(s&&typeof s=="object")switch(s[X]){case kt:case It:return!0}return!1}function Zl(s){if(s&&typeof s=="object")switch(s[X]){case Fs:case kt:case js:case It:return!0}return!1}var ec=s=>(Zi(s)||er(s))&&!!s.anchor;$.ALIAS=Fs;$.DOC=Di;$.MAP=kt;$.NODE_TYPE=X;$.PAIR=zi;$.SCALAR=js;$.SEQ=It;$.hasAnchor=ec;$.isAlias=Xl;$.isCollection=er;$.isDocument=Ql;$.isMap=Hl;$.isNode=Zl;$.isPair=Dl;$.isScalar=Zi;$.isSeq=zl});var Ve=b(Vs=>{"use strict";var M=O(),F=Symbol("break visit"),tr=Symbol("skip children"),J=Symbol("remove node");function qt(s,e){let t=sr(e);M.isDocument(s)?Se(null,s.contents,t,Object.freeze([s]))===J&&(s.contents=null):Se(null,s,t,Object.freeze([]))}qt.BREAK=F;qt.SKIP=tr;qt.REMOVE=J;function Se(s,e,t,n){let i=nr(s,e,t,n);if(M.isNode(i)||M.isPair(i))return ir(s,n,i),Se(s,i,t,n);if(typeof i!="symbol"){if(M.isCollection(e)){n=Object.freeze(n.concat(e));for(let r=0;r<e.items.length;++r){let o=Se(r,e.items[r],t,n);if(typeof o=="number")r=o-1;else{if(o===F)return F;o===J&&(e.items.splice(r,1),r-=1)}}}else if(M.isPair(e)){n=Object.freeze(n.concat(e));let r=Se("key",e.key,t,n);if(r===F)return F;r===J&&(e.key=null);let o=Se("value",e.value,t,n);if(o===F)return F;o===J&&(e.value=null)}}return i}async function Ct(s,e){let t=sr(e);M.isDocument(s)?await Ne(null,s.contents,t,Object.freeze([s]))===J&&(s.contents=null):await Ne(null,s,t,Object.freeze([]))}Ct.BREAK=F;Ct.SKIP=tr;Ct.REMOVE=J;async function Ne(s,e,t,n){let i=await nr(s,e,t,n);if(M.isNode(i)||M.isPair(i))return ir(s,n,i),Ne(s,i,t,n);if(typeof i!="symbol"){if(M.isCollection(e)){n=Object.freeze(n.concat(e));for(let r=0;r<e.items.length;++r){let o=await Ne(r,e.items[r],t,n);if(typeof o=="number")r=o-1;else{if(o===F)return F;o===J&&(e.items.splice(r,1),r-=1)}}}else if(M.isPair(e)){n=Object.freeze(n.concat(e));let r=await Ne("key",e.key,t,n);if(r===F)return F;r===J&&(e.key=null);let o=await Ne("value",e.value,t,n);if(o===F)return F;o===J&&(e.value=null)}}return i}function sr(s){return typeof s=="object"&&(s.Collection||s.Node||s.Value)?Object.assign({Alias:s.Node,Map:s.Node,Scalar:s.Node,Seq:s.Node},s.Value&&{Map:s.Value,Scalar:s.Value,Seq:s.Value},s.Collection&&{Map:s.Collection,Seq:s.Collection},s):s}function nr(s,e,t,n){if(typeof t=="function")return t(s,e,n);if(M.isMap(e))return t.Map?.(s,e,n);if(M.isSeq(e))return t.Seq?.(s,e,n);if(M.isPair(e))return t.Pair?.(s,e,n);if(M.isScalar(e))return t.Scalar?.(s,e,n);if(M.isAlias(e))return t.Alias?.(s,e,n)}function ir(s,e,t){let n=e[e.length-1];if(M.isCollection(n))n.items[s]=t;else if(M.isPair(n))s==="key"?n.key=t:n.value=t;else if(M.isDocument(n))n.contents=t;else{let i=M.isAlias(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}Vs.visit=qt;Vs.visitAsync=Ct});var Ks=b(or=>{"use strict";var rr=O(),tc=Ve(),sc={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},nc=s=>s.replace(/[!,[\]{}]/g,e=>sc[e]),Ke=class s{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},s.defaultYaml,e),this.tags=Object.assign({},s.defaultTags,t)}clone(){let e=new s(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new s(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:s.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},s.defaultTags);break}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:s.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},s.defaultTags),this.atNextDocument=!1);let n=e.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(t(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[r,o]=n;return this.tags[r]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;let[r]=n;if(r==="1.1"||r==="1.2")return this.yaml.version=r,!0;{let o=/^\d+\.\d+$/.test(r);return t(6,`Unsupported YAML version ${r}`,o),!1}}default:return t(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);return o==="!"||o==="!!"?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&t("Verbatim tags must end with a >"),o)}let[,n,i]=e.match(/^(.*!)([^!]*)$/s);i||t(`The ${e} tag has no suffix`);let r=this.tags[n];if(r)try{return r+decodeURIComponent(i)}catch(o){return t(String(o)),null}return n==="!"?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+nc(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),i;if(e&&n.length>0&&rr.isNode(e.contents)){let r={};tc.visit(e.contents,(o,a)=>{rr.isNode(a)&&a.tag&&(r[a.tag]=!0)}),i=Object.keys(r)}else i=[];for(let[r,o]of n)r==="!!"&&o==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(o)))&&t.push(`%TAG ${r} ${o}`);return t.join(`
|
|
5
5
|
`)}};Ke.defaultYaml={explicit:!1,version:"1.2"};Ke.defaultTags={"!!":"tag:yaml.org,2002:"};or.Directives=Ke});var Lt=b(Re=>{"use strict";var ar=O(),ic=Ve();function rc(s){if(/[\x00-\x19\s,[\]{}]/.test(s)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(s)}`;throw new Error(t)}return!0}function lr(s){let e=new Set;return ic.visit(s,{Value(t,n){n.anchor&&e.add(n.anchor)}}),e}function cr(s,e){for(let t=1;;++t){let n=`${s}${t}`;if(!e.has(n))return n}}function oc(s,e){let t=[],n=new Map,i=null;return{onAnchor:r=>{t.push(r),i??(i=lr(s));let o=cr(e,i);return i.add(o),o},setAnchors:()=>{for(let r of t){let o=n.get(r);if(typeof o=="object"&&o.anchor&&(ar.isScalar(o.node)||ar.isCollection(o.node)))o.node.anchor=o.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=r,a}}},sourceObjects:n}}Re.anchorIsValid=rc;Re.anchorNames=lr;Re.createNodeAnchors=oc;Re.findNewAnchor=cr});var Rs=b(fr=>{"use strict";function Ye(s,e,t,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,r=n.length;i<r;++i){let o=n[i],a=Ye(s,n,String(i),o);a===void 0?delete n[i]:a!==o&&(n[i]=a)}else if(n instanceof Map)for(let i of Array.from(n.keys())){let r=n.get(i),o=Ye(s,n,i,r);o===void 0?n.delete(i):o!==r&&n.set(i,o)}else if(n instanceof Set)for(let i of Array.from(n)){let r=Ye(s,n,i,i);r===void 0?n.delete(i):r!==i&&(n.delete(i),n.add(r))}else for(let[i,r]of Object.entries(n)){let o=Ye(s,n,i,r);o===void 0?delete n[i]:o!==r&&(n[i]=o)}return s.call(e,t,n)}fr.applyReviver=Ye});var D=b(dr=>{"use strict";var ac=O();function ur(s,e,t){if(Array.isArray(s))return s.map((n,i)=>ur(n,String(i),t));if(s&&typeof s.toJSON=="function"){if(!t||!ac.hasAnchor(s))return s.toJSON(e,t);let n={aliasCount:0,count:1,res:void 0};t.anchors.set(s,n),t.onCreate=r=>{n.res=r,delete t.onCreate};let i=s.toJSON(e,t);return t.onCreate&&t.onCreate(i),i}return typeof s=="bigint"&&!t?.keep?Number(s):s}dr.toJS=ur});var Pt=b(pr=>{"use strict";var lc=Rs(),hr=O(),cc=D(),Ys=class{constructor(e){Object.defineProperty(this,hr.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:i,reviver:r}={}){if(!hr.isDocument(e))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},a=cc.toJS(this,"",o);if(typeof i=="function")for(let{count:l,res:c}of o.anchors.values())i(c,l);return typeof r=="function"?lc.applyReviver(r,{"":a},"",a):a}};pr.NodeBase=Ys});var Ue=b(mr=>{"use strict";var fc=Lt(),uc=Ve(),Ee=O(),dc=Pt(),hc=D(),Us=class extends dc.NodeBase{constructor(e){super(Ee.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,t){let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],uc.visit(e,{Node:(r,o)=>{(Ee.isAlias(o)||Ee.hasAnchor(o))&&n.push(o)}}),t&&(t.aliasResolveCache=n));let i;for(let r of n){if(r===this)break;r.anchor===this.source&&(i=r)}return i}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:i,maxAliasCount:r}=t,o=this.resolve(i,t);if(!o){let l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let a=n.get(o);if(a||(hc.toJS(o,null,t),a=n.get(o)),a?.res===void 0){let l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(r>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=Mt(i,o,n)),a.count*a.aliasCount>r)){let l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return a.res}toString(e,t,n){let i=`*${this.source}`;if(e){if(fc.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let r=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(r)}if(e.implicitKey)return`${i} `}return i}};function Mt(s,e,t){if(Ee.isAlias(e)){let n=e.resolve(s),i=t&&n&&t.get(n);return i?i.count*i.aliasCount:0}else if(Ee.isCollection(e)){let n=0;for(let i of e.items){let r=Mt(s,i,t);r>n&&(n=r)}return n}else if(Ee.isPair(e)){let n=Mt(s,e.key,t),i=Mt(s,e.value,t);return Math.max(n,i)}return 1}mr.Alias=Us});var C=b(Js=>{"use strict";var pc=O(),mc=Pt(),gc=D(),yc=s=>!s||typeof s!="function"&&typeof s!="object",z=class extends mc.NodeBase{constructor(e){super(pc.SCALAR),this.value=e}toJSON(e,t){return t?.keep?this.value:gc.toJS(this.value,e,t)}toString(){return String(this.value)}};z.BLOCK_FOLDED="BLOCK_FOLDED";z.BLOCK_LITERAL="BLOCK_LITERAL";z.PLAIN="PLAIN";z.QUOTE_DOUBLE="QUOTE_DOUBLE";z.QUOTE_SINGLE="QUOTE_SINGLE";Js.Scalar=z;Js.isScalarValue=yc});var Je=b(yr=>{"use strict";var bc=Ue(),fe=O(),gr=C(),wc="tag:yaml.org,2002:";function Sc(s,e,t){if(e){let n=t.filter(r=>r.tag===e),i=n.find(r=>!r.format)??n[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return t.find(n=>n.identify?.(s)&&!n.format)}function Nc(s,e,t){if(fe.isDocument(s)&&(s=s.contents),fe.isNode(s))return s;if(fe.isPair(s)){let f=t.schema[fe.MAP].createNode?.(t.schema,null,t);return f.items.push(s),f}(s instanceof String||s instanceof Number||s instanceof Boolean||typeof BigInt<"u"&&s instanceof BigInt)&&(s=s.valueOf());let{aliasDuplicateObjects:n,onAnchor:i,onTagObj:r,schema:o,sourceObjects:a}=t,l;if(n&&s&&typeof s=="object"){if(l=a.get(s),l)return l.anchor??(l.anchor=i(s)),new bc.Alias(l.anchor);l={anchor:null,node:null},a.set(s,l)}e?.startsWith("!!")&&(e=wc+e.slice(2));let c=Sc(s,e,o.tags);if(!c){if(s&&typeof s.toJSON=="function"&&(s=s.toJSON()),!s||typeof s!="object"){let f=new gr.Scalar(s);return l&&(l.node=f),f}c=s instanceof Map?o[fe.MAP]:Symbol.iterator in Object(s)?o[fe.SEQ]:o[fe.MAP]}r&&(r(c),delete t.onTagObj);let u=c?.createNode?c.createNode(t.schema,s,t):typeof c?.nodeClass?.from=="function"?c.nodeClass.from(t.schema,s,t):new gr.Scalar(s);return e?u.tag=e:c.default||(u.tag=c.tag),l&&(l.node=u),u}yr.createNode=Nc});var _t=b($t=>{"use strict";var Ec=Je(),W=O(),vc=Pt();function Ws(s,e,t){let n=t;for(let i=e.length-1;i>=0;--i){let r=e[i];if(typeof r=="number"&&Number.isInteger(r)&&r>=0){let o=[];o[r]=n,n=o}else n=new Map([[r,n]])}return Ec.createNode(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:s,sourceObjects:new Map})}var br=s=>s==null||typeof s=="object"&&!!s[Symbol.iterator]().next().done,Gs=class extends vc.NodeBase{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(n=>W.isNode(n)||W.isPair(n)?n.clone(e):n),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(br(e))this.add(t);else{let[n,...i]=e,r=this.get(n,!0);if(W.isCollection(r))r.addIn(i,t);else if(r===void 0&&this.schema)this.set(n,Ws(this.schema,i,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let i=this.get(t,!0);if(W.isCollection(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...i]=e,r=this.get(n,!0);return i.length===0?!t&&W.isScalar(r)?r.value:r:W.isCollection(r)?r.getIn(i,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!W.isPair(t))return!1;let n=t.value;return n==null||e&&W.isScalar(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let i=this.get(t,!0);return W.isCollection(i)?i.hasIn(n):!1}setIn(e,t){let[n,...i]=e;if(i.length===0)this.set(n,t);else{let r=this.get(n,!0);if(W.isCollection(r))r.setIn(i,t);else if(r===void 0&&this.schema)this.set(n,Ws(this.schema,i,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};$t.Collection=Gs;$t.collectionFromPath=Ws;$t.isEmptyPath=br});var We=b(xt=>{"use strict";var Ac=s=>s.replace(/^(?!$)(?: $)?/gm,"#");function Xs(s,e){return/^\n+$/.test(s)?s.substring(1):e?s.replace(/^(?! *$)/gm,e):s}var Tc=(s,e,t)=>s.endsWith(`
|