@jerryan/just-bash 3.5.0 → 3.6.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.
@@ -9,6 +9,7 @@
9
9
  * live in path-utils.ts (no node:fs dependency, browser-safe) and are
10
10
  * re-exported here for convenience.
11
11
  */
12
+ import * as fs from "node:fs";
12
13
  export { isSameOrDescendantPath, normalizePath, validatePath, } from "./path-utils.js";
13
14
  /**
14
15
  * Check whether `resolved` is equal to, or a child of, `canonicalRoot`.
@@ -88,3 +89,17 @@ export declare function sanitizeSymlinkTarget(rawTarget: string, canonicalRoot:
88
89
  * a generic `"CODE: operation 'virtualPath'"` message.
89
90
  */
90
91
  export declare function sanitizeFsError(e: unknown, virtualPath: string, operation: string, passthroughPatterns: readonly string[]): never;
92
+ /**
93
+ * lstat a validated real path, normalizing Windows mode fiction: libuv
94
+ * reports no execute bits on Windows, so directories stat as 0o40666.
95
+ * Nothing inside the sandbox enforces mode bits, but real POSIX runtimes
96
+ * behind the fs bridge do — the python worker's Emscripten VFS masks
97
+ * `mode & 0o777`, making a 0o666 directory untraversable (chdir, listdir,
98
+ * open all EACCES). Report POSIX-conventional 0o755 for directories,
99
+ * matching DEFAULT_DIR_MODE so lower and upper dirs present uniformly.
100
+ * File modes are left as reported (executable-bit fiction for .exe etc.
101
+ * is a separate question). No-op on other platforms.
102
+ */
103
+ export declare function lstatReal(path: string): Promise<fs.Stats>;
104
+ /** Synchronous counterpart of {@link lstatReal}. */
105
+ export declare function lstatRealSync(path: string): fs.Stats;
package/package.json CHANGED
@@ -1,136 +1,136 @@
1
- {
2
- "name": "@jerryan/just-bash",
3
- "version": "3.5.0",
4
- "description": "A simulated bash environment with virtual filesystem",
5
- "repository": {
6
- "type": "git",
7
- "url": "git+https://github.com/JerryAZR/just-bash.git"
8
- },
9
- "homepage": "https://github.com/JerryAZR/just-bash#readme",
10
- "bugs": {
11
- "url": "https://github.com/JerryAZR/just-bash/issues"
12
- },
13
- "type": "module",
14
- "engines": {
15
- "node": ">=20.19"
16
- },
17
- "main": "dist/bundle/index.js",
18
- "types": "dist/index.d.ts",
19
- "exports": {
20
- ".": {
21
- "browser": "./dist/bundle/browser.js",
22
- "require": {
23
- "types": "./dist/index.d.cts",
24
- "default": "./dist/bundle/index.cjs"
25
- },
26
- "import": {
27
- "types": "./dist/index.d.ts",
28
- "default": "./dist/bundle/index.js"
29
- }
30
- },
31
- "./browser": {
32
- "types": "./dist/browser.d.ts",
33
- "import": "./dist/bundle/browser.js"
34
- }
35
- },
36
- "files": [
37
- "dist/bundle/",
38
- "dist/bin/",
39
- "dist/*.d.ts",
40
- "dist/*.d.cts",
41
- "dist/ast/*.d.ts",
42
- "dist/commands/**/*.d.ts",
43
- "dist/commands/sqlite3/worker.js",
44
- "dist/fs/**/*.d.ts",
45
- "dist/interpreter/**/*.d.ts",
46
- "dist/network/**/*.d.ts",
47
- "dist/parser/*.d.ts",
48
- "dist/sandbox/*.d.ts",
49
- "dist/security/*.d.ts",
50
- "dist/transform/**/*.d.ts",
51
- "dist/utils/*.d.ts",
52
- "vendor/cpython-emscripten/",
53
- "README.md",
54
- "CHANGELOG.md",
55
- "dist/AGENTS.md"
56
- ],
57
- "bin": {
58
- "just-bash": "./dist/bin/just-bash.js",
59
- "just-bash-shell": "./dist/bin/shell/shell.js"
60
- },
61
- "publishConfig": {
62
- "access": "public",
63
- "registry": "https://registry.npmjs.org/"
64
- },
65
- "scripts": {
66
- "build": "rm -rf dist && tsc && pnpm build:lib && pnpm build:lib:cjs && pnpm build:browser && pnpm build:cli && pnpm build:shell && pnpm build:worker && pnpm build:clean && cp dist/index.d.ts dist/index.d.cts && sed '1,/^-->/d' AGENTS.npm.md > dist/AGENTS.md",
67
- "build:clean": "find dist -name '*.test.js' -delete && find dist -name '*.test.d.ts' -delete",
68
- "build:worker": "esbuild src/commands/python3/worker.ts --bundle --platform=node --format=esm --outfile=src/commands/python3/worker.js --external:../../../vendor/cpython-emscripten/* && cp src/commands/python3/worker.js dist/commands/python3/worker.js && mkdir -p dist/bin/chunks && cp src/commands/python3/worker.js dist/bin/chunks/worker.js && mkdir -p dist/bundle/chunks && cp src/commands/python3/worker.js dist/bundle/chunks/worker.js && esbuild src/commands/js-exec/js-exec-worker.ts --bundle --platform=node --format=esm --outfile=src/commands/js-exec/js-exec-worker.js --external:quickjs-emscripten && cp src/commands/js-exec/js-exec-worker.js dist/commands/js-exec/js-exec-worker.js && cp src/commands/js-exec/js-exec-worker.js dist/bin/chunks/js-exec-worker.js && cp src/commands/js-exec/js-exec-worker.js dist/bundle/chunks/js-exec-worker.js && esbuild src/commands/sqlite3/worker.ts --bundle --platform=node --format=esm --outfile=src/commands/sqlite3/worker.js --external:sql.js && mkdir -p dist/commands/sqlite3 && cp src/commands/sqlite3/worker.js dist/commands/sqlite3/worker.js && cp src/commands/sqlite3/worker.js dist/bin/chunks/sqlite3-worker.js && cp src/commands/sqlite3/worker.js dist/bundle/chunks/sqlite3-worker.js",
69
- "build:lib": "esbuild dist/index.js --bundle --splitting --platform=node --format=esm --minify --outdir=dist/bundle --chunk-names=chunks/[name]-[hash] --banner:js='import{createRequire} from\"node:module\";const require=createRequire(import.meta.url);' --external:diff --external:sprintf-js --external:turndown --external:sql.js --external:quickjs-emscripten --external:@mongodb-js/zstd --external:node-liblzma --external:seek-bzip --external:guarded-fetch",
70
- "build:lib:cjs": "esbuild dist/index.js --bundle --platform=node --format=cjs --minify --outfile=dist/bundle/index.cjs --external:diff --external:sprintf-js --external:turndown --external:sql.js --external:quickjs-emscripten --external:@mongodb-js/zstd --external:node-liblzma --external:seek-bzip --external:guarded-fetch",
71
- "build:browser": "esbuild dist/browser.js --bundle --platform=browser --format=esm --minify --outfile=dist/bundle/browser.js --external:diff --external:sprintf-js --external:turndown --external:undici --external:guarded-fetch --external:node:zlib --external:@mongodb-js/zstd --external:node-liblzma --external:seek-bzip --define:__BROWSER__=true --alias:node:async_hooks=./src/shims/browser-unsupported.js --alias:node:dns=./src/shims/browser-unsupported.js --alias:node:module=./src/shims/browser-unsupported.js",
72
- "build:cli": "esbuild dist/cli/just-bash.js --bundle --splitting --platform=node --format=esm --minify --outdir=dist/bin --entry-names=[name] --chunk-names=chunks/[name]-[hash] --banner:js='#!/usr/bin/env node\nimport{createRequire} from\"node:module\";const require=createRequire(import.meta.url);' --external:sql.js --external:quickjs-emscripten --external:@mongodb-js/zstd --external:node-liblzma --external:seek-bzip",
73
- "build:shell": "esbuild dist/cli/shell.js --bundle --splitting --platform=node --format=esm --minify --outdir=dist/bin/shell --entry-names=[name] --chunk-names=chunks/[name]-[hash] --banner:js='#!/usr/bin/env node\nimport{createRequire} from\"node:module\";const require=createRequire(import.meta.url);' --external:sql.js --external:quickjs-emscripten --external:@mongodb-js/zstd --external:node-liblzma --external:seek-bzip",
74
- "prepublishOnly": "pnpm test:dist",
75
- "validate": "pnpm lint && pnpm knip && pnpm typecheck && pnpm build && pnpm check:worker-sync && pnpm test:run && pnpm test:wasm && pnpm test:dist",
76
- "typecheck": "tsc --noEmit",
77
- "lint": "pnpm lint:banned",
78
- "check:worker-sync": "node scripts/check-worker-sync.js",
79
- "lint:banned": "node scripts/check-banned-patterns.js",
80
- "lint:fix": "pnpm --workspace-root lint:fix",
81
- "knip": "knip",
82
- "test": "vitest",
83
- "test:run": "vitest run --exclude src/security/fuzzing/ --exclude src/commands/python3/ --exclude src/commands/sqlite3/ --exclude src/commands/js-exec/ --exclude src/agent-examples/python-scripting.test.ts",
84
- "test:dist": "vitest run src/cli/just-bash.bundle.test.ts src/package-contents.test.ts",
85
- "test:unit": "vitest run --config vitest.unit.config.ts",
86
- "test:wasm": "vitest run --config vitest.wasm.config.ts",
87
- "test:comparison": "vitest run --config vitest.comparison.config.ts",
88
- "test:comparison:record": "RECORD_FIXTURES=1 vitest run --config vitest.comparison.config.ts",
89
- "test:coverage": "vitest run --coverage",
90
- "test:coverage:unit": "vitest run --config vitest.unit.config.ts --coverage",
91
- "test:fuzz": "vitest run src/security/fuzzing/",
92
- "test:fuzz:long": "FUZZ_RUNS=10000 vitest run src/security/fuzzing/",
93
- "shell": "tsx src/cli/shell.ts",
94
- "dev:exec": "tsx src/cli/exec.ts"
95
- },
96
- "keywords": [],
97
- "author": "Malte and Claude",
98
- "license": "Apache-2.0",
99
- "devDependencies": {
100
- "@types/ini": "^4.1.1",
101
- "@types/node": "^25.9.5",
102
- "@types/papaparse": "^5.5.2",
103
- "@types/sprintf-js": "^1.1.4",
104
- "@types/sql.js": "^1.4.11",
105
- "@types/turndown": "^5.0.6",
106
- "@vitest/coverage-v8": "^4.1.10",
107
- "esbuild": "^0.27.7",
108
- "fast-check": "^3.23.2",
109
- "knip": "^5.88.1",
110
- "tsx": "^4.23.12",
111
- "typescript": "^5.9.3",
112
- "vitest": "^4.1.10"
113
- },
114
- "dependencies": {
115
- "diff": "^8.0.4",
116
- "fast-xml-parser": "^5.10.1",
117
- "file-type": "^21.3.4",
118
- "guarded-fetch": "0.1.3",
119
- "ini": "^6.0.0",
120
- "modern-tar": "^0.7.7",
121
- "papaparse": "^5.6.0",
122
- "quickjs-emscripten": "^0.32.0",
123
- "re2js": "^1.3.3",
124
- "seek-bzip": "^2.0.0",
125
- "smol-toml": "^1.8.0",
126
- "sprintf-js": "^1.1.3",
127
- "sql.js": "^1.14.1",
128
- "turndown": "^7.2.4",
129
- "undici": "^7.29.0",
130
- "yaml": "^2.9.0"
131
- },
132
- "optionalDependencies": {
133
- "@mongodb-js/zstd": "^7.0.0",
134
- "node-liblzma": "^2.2.0"
135
- }
136
- }
1
+ {
2
+ "name": "@jerryan/just-bash",
3
+ "version": "3.6.0",
4
+ "description": "A simulated bash environment with virtual filesystem",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/JerryAZR/just-bash.git"
8
+ },
9
+ "homepage": "https://github.com/JerryAZR/just-bash#readme",
10
+ "bugs": {
11
+ "url": "https://github.com/JerryAZR/just-bash/issues"
12
+ },
13
+ "type": "module",
14
+ "engines": {
15
+ "node": ">=20.19"
16
+ },
17
+ "main": "dist/bundle/index.js",
18
+ "types": "dist/index.d.ts",
19
+ "exports": {
20
+ ".": {
21
+ "browser": "./dist/bundle/browser.js",
22
+ "require": {
23
+ "types": "./dist/index.d.cts",
24
+ "default": "./dist/bundle/index.cjs"
25
+ },
26
+ "import": {
27
+ "types": "./dist/index.d.ts",
28
+ "default": "./dist/bundle/index.js"
29
+ }
30
+ },
31
+ "./browser": {
32
+ "types": "./dist/browser.d.ts",
33
+ "import": "./dist/bundle/browser.js"
34
+ }
35
+ },
36
+ "files": [
37
+ "dist/bundle/",
38
+ "dist/bin/",
39
+ "dist/*.d.ts",
40
+ "dist/*.d.cts",
41
+ "dist/ast/*.d.ts",
42
+ "dist/commands/**/*.d.ts",
43
+ "dist/commands/sqlite3/worker.js",
44
+ "dist/fs/**/*.d.ts",
45
+ "dist/interpreter/**/*.d.ts",
46
+ "dist/network/**/*.d.ts",
47
+ "dist/parser/*.d.ts",
48
+ "dist/sandbox/*.d.ts",
49
+ "dist/security/*.d.ts",
50
+ "dist/transform/**/*.d.ts",
51
+ "dist/utils/*.d.ts",
52
+ "vendor/cpython-emscripten/",
53
+ "README.md",
54
+ "CHANGELOG.md",
55
+ "dist/AGENTS.md"
56
+ ],
57
+ "bin": {
58
+ "just-bash": "./dist/bin/just-bash.js",
59
+ "just-bash-shell": "./dist/bin/shell/shell.js"
60
+ },
61
+ "publishConfig": {
62
+ "access": "public",
63
+ "registry": "https://registry.npmjs.org/"
64
+ },
65
+ "scripts": {
66
+ "build": "rm -rf dist && tsc && pnpm build:lib && pnpm build:lib:cjs && pnpm build:browser && pnpm build:cli && pnpm build:shell && pnpm build:worker && pnpm build:clean && cp dist/index.d.ts dist/index.d.cts && sed '1,/^-->/d' AGENTS.npm.md > dist/AGENTS.md",
67
+ "build:clean": "find dist -name '*.test.js' -delete && find dist -name '*.test.d.ts' -delete",
68
+ "build:worker": "esbuild src/commands/python3/worker.ts --bundle --platform=node --format=esm --outfile=src/commands/python3/worker.js --external:../../../vendor/cpython-emscripten/* && cp src/commands/python3/worker.js dist/commands/python3/worker.js && mkdir -p dist/bin/chunks && cp src/commands/python3/worker.js dist/bin/chunks/worker.js && mkdir -p dist/bundle/chunks && cp src/commands/python3/worker.js dist/bundle/chunks/worker.js && esbuild src/commands/js-exec/js-exec-worker.ts --bundle --platform=node --format=esm --outfile=src/commands/js-exec/js-exec-worker.js --external:quickjs-emscripten && cp src/commands/js-exec/js-exec-worker.js dist/commands/js-exec/js-exec-worker.js && cp src/commands/js-exec/js-exec-worker.js dist/bin/chunks/js-exec-worker.js && cp src/commands/js-exec/js-exec-worker.js dist/bundle/chunks/js-exec-worker.js && esbuild src/commands/sqlite3/worker.ts --bundle --platform=node --format=esm --outfile=src/commands/sqlite3/worker.js --external:sql.js && mkdir -p dist/commands/sqlite3 && cp src/commands/sqlite3/worker.js dist/commands/sqlite3/worker.js && cp src/commands/sqlite3/worker.js dist/bin/chunks/sqlite3-worker.js && cp src/commands/sqlite3/worker.js dist/bundle/chunks/sqlite3-worker.js",
69
+ "build:lib": "esbuild dist/index.js --bundle --splitting --platform=node --format=esm --minify --outdir=dist/bundle --chunk-names=chunks/[name]-[hash] --banner:js='import{createRequire} from\"node:module\";const require=createRequire(import.meta.url);' --external:diff --external:sprintf-js --external:turndown --external:sql.js --external:quickjs-emscripten --external:@mongodb-js/zstd --external:node-liblzma --external:seek-bzip --external:guarded-fetch",
70
+ "build:lib:cjs": "esbuild dist/index.js --bundle --platform=node --format=cjs --minify --outfile=dist/bundle/index.cjs --external:diff --external:sprintf-js --external:turndown --external:sql.js --external:quickjs-emscripten --external:@mongodb-js/zstd --external:node-liblzma --external:seek-bzip --external:guarded-fetch",
71
+ "build:browser": "esbuild dist/browser.js --bundle --platform=browser --format=esm --minify --outfile=dist/bundle/browser.js --external:diff --external:sprintf-js --external:turndown --external:undici --external:guarded-fetch --external:node:zlib --external:@mongodb-js/zstd --external:node-liblzma --external:seek-bzip --define:__BROWSER__=true --alias:node:async_hooks=./src/shims/browser-unsupported.js --alias:node:dns=./src/shims/browser-unsupported.js --alias:node:module=./src/shims/browser-unsupported.js",
72
+ "build:cli": "esbuild dist/cli/just-bash.js --bundle --splitting --platform=node --format=esm --minify --outdir=dist/bin --entry-names=[name] --chunk-names=chunks/[name]-[hash] --banner:js='#!/usr/bin/env node\nimport{createRequire} from\"node:module\";const require=createRequire(import.meta.url);' --external:sql.js --external:quickjs-emscripten --external:@mongodb-js/zstd --external:node-liblzma --external:seek-bzip",
73
+ "build:shell": "esbuild dist/cli/shell.js --bundle --splitting --platform=node --format=esm --minify --outdir=dist/bin/shell --entry-names=[name] --chunk-names=chunks/[name]-[hash] --banner:js='#!/usr/bin/env node\nimport{createRequire} from\"node:module\";const require=createRequire(import.meta.url);' --external:sql.js --external:quickjs-emscripten --external:@mongodb-js/zstd --external:node-liblzma --external:seek-bzip",
74
+ "prepublishOnly": "pnpm test:dist",
75
+ "validate": "pnpm lint && pnpm knip && pnpm typecheck && pnpm build && pnpm check:worker-sync && pnpm test:run && pnpm test:wasm && pnpm test:dist",
76
+ "typecheck": "tsc --noEmit",
77
+ "lint": "pnpm lint:banned",
78
+ "check:worker-sync": "node scripts/check-worker-sync.js",
79
+ "lint:banned": "node scripts/check-banned-patterns.js",
80
+ "lint:fix": "pnpm --workspace-root lint:fix",
81
+ "knip": "knip",
82
+ "test": "vitest",
83
+ "test:run": "vitest run --exclude src/security/fuzzing/ --exclude src/commands/python3/ --exclude src/commands/sqlite3/ --exclude src/commands/js-exec/ --exclude src/agent-examples/python-scripting.test.ts",
84
+ "test:dist": "vitest run src/cli/just-bash.bundle.test.ts src/package-contents.test.ts",
85
+ "test:unit": "vitest run --config vitest.unit.config.ts",
86
+ "test:wasm": "vitest run --config vitest.wasm.config.ts",
87
+ "test:comparison": "vitest run --config vitest.comparison.config.ts",
88
+ "test:comparison:record": "RECORD_FIXTURES=1 vitest run --config vitest.comparison.config.ts",
89
+ "test:coverage": "vitest run --coverage",
90
+ "test:coverage:unit": "vitest run --config vitest.unit.config.ts --coverage",
91
+ "test:fuzz": "vitest run src/security/fuzzing/",
92
+ "test:fuzz:long": "FUZZ_RUNS=10000 vitest run src/security/fuzzing/",
93
+ "shell": "tsx src/cli/shell.ts",
94
+ "dev:exec": "tsx src/cli/exec.ts"
95
+ },
96
+ "keywords": [],
97
+ "author": "Malte and Claude",
98
+ "license": "Apache-2.0",
99
+ "devDependencies": {
100
+ "@types/ini": "^4.1.1",
101
+ "@types/node": "^25.9.5",
102
+ "@types/papaparse": "^5.5.2",
103
+ "@types/sprintf-js": "^1.1.4",
104
+ "@types/sql.js": "^1.4.11",
105
+ "@types/turndown": "^5.0.6",
106
+ "@vitest/coverage-v8": "^4.1.10",
107
+ "esbuild": "^0.27.7",
108
+ "fast-check": "^3.23.2",
109
+ "knip": "^5.88.1",
110
+ "tsx": "^4.23.12",
111
+ "typescript": "^5.9.3",
112
+ "vitest": "^4.1.10"
113
+ },
114
+ "dependencies": {
115
+ "diff": "^8.0.4",
116
+ "fast-xml-parser": "^5.10.1",
117
+ "file-type": "^21.3.4",
118
+ "guarded-fetch": "0.1.3",
119
+ "ini": "^6.0.0",
120
+ "modern-tar": "^0.7.7",
121
+ "papaparse": "^5.6.0",
122
+ "quickjs-emscripten": "^0.32.0",
123
+ "re2js": "^1.3.3",
124
+ "seek-bzip": "^2.0.0",
125
+ "smol-toml": "^1.8.0",
126
+ "sprintf-js": "^1.1.3",
127
+ "sql.js": "^1.14.1",
128
+ "turndown": "^7.2.4",
129
+ "undici": "^7.29.0",
130
+ "yaml": "^2.9.0"
131
+ },
132
+ "optionalDependencies": {
133
+ "@mongodb-js/zstd": "^7.0.0",
134
+ "node-liblzma": "^2.2.0"
135
+ }
136
+ }
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env node
2
- import{createRequire} from"node:module";const require=createRequire(import.meta.url);
3
- import{a as p}from"./chunk-PBOVSFTJ.js";import{a as m}from"./chunk-NE4R2FVV.js";import{a as u}from"./chunk-I4IRHQDW.js";var v={recursive:{short:"r",long:"recursive",type:"boolean"},recursiveUpper:{short:"R",type:"boolean"},force:{short:"f",long:"force",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"}},E={name:"rm",async execute(g,s){let e=m("rm",g,v);if(!e.ok)return e.error;let i=e.result.flags.recursive||e.result.flags.recursiveUpper,a=e.result.flags.force,d=e.result.flags.verbose,c=e.result.positional;if(c.length===0)return a?{stdout:"",stderr:"",exitCode:0}:{stdout:"",stderr:`rm: missing operand
4
- `,exitCode:1};let f="",t="",l=0;for(let r of c)try{let n=s.fs.resolvePath(s.cwd,r);if((await s.fs.stat(n)).isDirectory&&!i){t+=`rm: cannot remove '${r}': Is a directory
5
- `,l=1;continue}await s.fs.rm(n,{recursive:i,force:a}),d&&(f+=`removed '${r}'
6
- `)}catch(n){if(!a){let o=u(n);o.includes("ENOENT")||o.includes("no such file")?t+=`rm: cannot remove '${r}': No such file or directory
7
- `:o.includes("ENOTEMPTY")||o.includes("not empty")?t+=`rm: cannot remove '${r}': Directory not empty
8
- `:t+=`rm: cannot remove '${r}': ${p(o)}
9
- `,l=1}}return{stdout:f,stderr:t,exitCode:l}}},$={name:"rm",flags:[{flag:"-r",type:"boolean"},{flag:"-R",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0};export{E as a,$ as b};
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env node
2
- import{createRequire} from"node:module";const require=createRequire(import.meta.url);
3
- import{a as p}from"./chunk-PBOVSFTJ.js";import{a as m}from"./chunk-NE4R2FVV.js";import{a as u}from"./chunk-I4IRHQDW.js";var v={recursive:{short:"r",long:"recursive",type:"boolean"},recursiveUpper:{short:"R",type:"boolean"},force:{short:"f",long:"force",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"}},E={name:"rm",async execute(g,s){let e=m("rm",g,v);if(!e.ok)return e.error;let i=e.result.flags.recursive||e.result.flags.recursiveUpper,a=e.result.flags.force,d=e.result.flags.verbose,c=e.result.positional;if(c.length===0)return a?{stdout:"",stderr:"",exitCode:0}:{stdout:"",stderr:`rm: missing operand
4
- `,exitCode:1};let f="",t="",l=0;for(let r of c)try{let n=s.fs.resolvePath(s.cwd,r);if((await s.fs.stat(n)).isDirectory&&!i){t+=`rm: cannot remove '${r}': Is a directory
5
- `,l=1;continue}await s.fs.rm(n,{recursive:i,force:a}),d&&(f+=`removed '${r}'
6
- `)}catch(n){if(!a){let o=u(n);o.includes("ENOENT")||o.includes("no such file")?t+=`rm: cannot remove '${r}': No such file or directory
7
- `:o.includes("ENOTEMPTY")||o.includes("not empty")?t+=`rm: cannot remove '${r}': Directory not empty
8
- `:t+=`rm: cannot remove '${r}': ${p(o)}
9
- `,l=1}}return{stdout:f,stderr:t,exitCode:l}}},$={name:"rm",flags:[{flag:"-r",type:"boolean"},{flag:"-R",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0};export{E as a,$ as b};
@@ -1,8 +0,0 @@
1
- import{createRequire} from"node:module";const require=createRequire(import.meta.url);
2
- import{a as p}from"./chunk-FOCWZZDE.js";import{a as m}from"./chunk-QIQMJJZ4.js";import{a as u}from"./chunk-W5DWRFSU.js";var v={recursive:{short:"r",long:"recursive",type:"boolean"},recursiveUpper:{short:"R",type:"boolean"},force:{short:"f",long:"force",type:"boolean"},verbose:{short:"v",long:"verbose",type:"boolean"}},E={name:"rm",async execute(g,s){let e=m("rm",g,v);if(!e.ok)return e.error;let i=e.result.flags.recursive||e.result.flags.recursiveUpper,a=e.result.flags.force,d=e.result.flags.verbose,c=e.result.positional;if(c.length===0)return a?{stdout:"",stderr:"",exitCode:0}:{stdout:"",stderr:`rm: missing operand
3
- `,exitCode:1};let f="",t="",l=0;for(let r of c)try{let n=s.fs.resolvePath(s.cwd,r);if((await s.fs.stat(n)).isDirectory&&!i){t+=`rm: cannot remove '${r}': Is a directory
4
- `,l=1;continue}await s.fs.rm(n,{recursive:i,force:a}),d&&(f+=`removed '${r}'
5
- `)}catch(n){if(!a){let o=u(n);o.includes("ENOENT")||o.includes("no such file")?t+=`rm: cannot remove '${r}': No such file or directory
6
- `:o.includes("ENOTEMPTY")||o.includes("not empty")?t+=`rm: cannot remove '${r}': Directory not empty
7
- `:t+=`rm: cannot remove '${r}': ${p(o)}
8
- `,l=1}}return{stdout:f,stderr:t,exitCode:l}}},$={name:"rm",flags:[{flag:"-r",type:"boolean"},{flag:"-R",type:"boolean"},{flag:"-f",type:"boolean"},{flag:"-v",type:"boolean"}],needsArgs:!0};export{E as a,$ as b};