just-bash-nx 3.0.2 → 3.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin/default-init.sh
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
export JUST_BASH=1
|
|
5
5
|
|
|
6
|
+
|
|
6
7
|
# Reusable host-command mocks for npx just-bash-nx verification.
|
|
7
8
|
# Source this file inside the same shell process as the script under test.
|
|
8
9
|
|
|
@@ -13,7 +14,7 @@ _mock_now_ms() {
|
|
|
13
14
|
|
|
14
15
|
_mock_escape_json() {
|
|
15
16
|
# Minimal JSON string escaper for test data.
|
|
16
|
-
printf '%s' "$1" |
|
|
17
|
+
printf '%s' "$1" | awk 'BEGIN { RS=""; ORS="" } { gsub(/\\/, "\\\\"); gsub(/"/, "\\\""); gsub(/\t/, "\\t"); gsub(/\r/, "\\r"); gsub(/\n/, "\\n"); printf "%s", $0 }'
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
# Parse repeatable flags as lines into stdout.
|
|
@@ -29,6 +30,7 @@ _mock_collect_flag_values() {
|
|
|
29
30
|
fi
|
|
30
31
|
shift
|
|
31
32
|
done
|
|
33
|
+
return 0
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
_mock_find_next() {
|
|
@@ -44,12 +46,26 @@ _mock_find_next() {
|
|
|
44
46
|
return 1
|
|
45
47
|
}
|
|
46
48
|
|
|
49
|
+
_mock_has_flag() {
|
|
50
|
+
flag="$1"
|
|
51
|
+
shift
|
|
52
|
+
while [ "$#" -gt 0 ]; do
|
|
53
|
+
if [ "$1" = "$flag" ]; then
|
|
54
|
+
return 0
|
|
55
|
+
fi
|
|
56
|
+
shift
|
|
57
|
+
done
|
|
58
|
+
return 1
|
|
59
|
+
}
|
|
60
|
+
|
|
47
61
|
# ---------- command mocks ----------
|
|
48
62
|
|
|
49
63
|
fetch-messages() {
|
|
50
64
|
thread_ts="$(_mock_find_next --thread-timestamp "$@" || true)"
|
|
51
65
|
days="$(_mock_find_next --days "$@" || true)"
|
|
52
|
-
[ -z "$days" ]
|
|
66
|
+
if [ -z "$days" ]; then
|
|
67
|
+
days=2
|
|
68
|
+
fi
|
|
53
69
|
|
|
54
70
|
ts="$(_mock_now_ms)"
|
|
55
71
|
msg_text="mock message"
|
|
@@ -96,7 +112,9 @@ send-chat() {
|
|
|
96
112
|
sid="$(_mock_find_next --session-id "$@" || true)"
|
|
97
113
|
content="$(_mock_find_next --content "$@" || true)"
|
|
98
114
|
thread_ts="$(_mock_find_next --thread-timestamp "$@" || true)"
|
|
99
|
-
[ -z "$sid" ]
|
|
115
|
+
if [ -z "$sid" ]; then
|
|
116
|
+
sid="mock-session"
|
|
117
|
+
fi
|
|
100
118
|
|
|
101
119
|
cat <<JSON
|
|
102
120
|
{"messageId":"msg-$(_mock_now_ms)","sessionId":"$(_mock_escape_json "$sid")","echo":{"content":"$(_mock_escape_json "${content:-}")","threadTimestamp":"$(_mock_escape_json "${thread_ts:-}")"}}
|
|
@@ -107,8 +125,12 @@ edit-chat() {
|
|
|
107
125
|
sid="$(_mock_find_next --session-id "$@" || true)"
|
|
108
126
|
mid="$(_mock_find_next --message-id "$@" || true)"
|
|
109
127
|
content="$(_mock_find_next --content "$@" || true)"
|
|
110
|
-
[ -z "$sid" ]
|
|
111
|
-
|
|
128
|
+
if [ -z "$sid" ]; then
|
|
129
|
+
sid="mock-session"
|
|
130
|
+
fi
|
|
131
|
+
if [ -z "$mid" ]; then
|
|
132
|
+
mid="mock-message-id"
|
|
133
|
+
fi
|
|
112
134
|
|
|
113
135
|
cat <<JSON
|
|
114
136
|
{"ok":true,"sessionId":"$(_mock_escape_json "$sid")","messageId":"$(_mock_escape_json "$mid")","updatedContent":"$(_mock_escape_json "${content:-}")"}
|
|
@@ -117,14 +139,20 @@ JSON
|
|
|
117
139
|
|
|
118
140
|
add-members() {
|
|
119
141
|
sid="$(_mock_find_next --session-id "$@" || true)"
|
|
120
|
-
[ -z "$sid" ]
|
|
142
|
+
if [ -z "$sid" ]; then
|
|
143
|
+
sid="mock-session"
|
|
144
|
+
fi
|
|
121
145
|
|
|
122
146
|
jids="$(_mock_collect_flag_values --jid "$@")"
|
|
123
147
|
emails="$(_mock_collect_flag_values --email "$@")"
|
|
124
148
|
|
|
125
149
|
invited=0
|
|
126
|
-
[ -n "$jids" ]
|
|
127
|
-
|
|
150
|
+
if [ -n "$jids" ]; then
|
|
151
|
+
invited=$((invited + $(printf '%s\n' "$jids" | sed '/^$/d' | wc -l | tr -d ' ')))
|
|
152
|
+
fi
|
|
153
|
+
if [ -n "$emails" ]; then
|
|
154
|
+
invited=$((invited + $(printf '%s\n' "$emails" | sed '/^$/d' | wc -l | tr -d ' ')))
|
|
155
|
+
fi
|
|
128
156
|
|
|
129
157
|
first_jid=""
|
|
130
158
|
if [ -n "$jids" ]; then
|
|
@@ -148,10 +176,16 @@ add-mention-group() {
|
|
|
148
176
|
name="$(_mock_find_next --name "$@" || true)"
|
|
149
177
|
desc="$(_mock_find_next --description "$@" || true)"
|
|
150
178
|
members="$(_mock_collect_flag_values --member "$@")"
|
|
151
|
-
[ -z "$sid" ]
|
|
152
|
-
|
|
179
|
+
if [ -z "$sid" ]; then
|
|
180
|
+
sid="mock-session"
|
|
181
|
+
fi
|
|
182
|
+
if [ -z "$name" ]; then
|
|
183
|
+
name="@mock"
|
|
184
|
+
fi
|
|
153
185
|
member_count=0
|
|
154
|
-
[ -n "$members" ]
|
|
186
|
+
if [ -n "$members" ]; then
|
|
187
|
+
member_count="$(printf '%s\n' "$members" | sed '/^$/d' | wc -l | tr -d ' ')"
|
|
188
|
+
fi
|
|
155
189
|
|
|
156
190
|
cat <<JSON
|
|
157
191
|
{"ok":true,"channelId":"$(_mock_escape_json "$sid")","name":"$(_mock_escape_json "$name")","description":"$(_mock_escape_json "${desc:-}")","memberCount":$member_count}
|
|
@@ -160,9 +194,11 @@ JSON
|
|
|
160
194
|
|
|
161
195
|
get-members() {
|
|
162
196
|
sid="$(_mock_find_next --session-id "$@" || true)"
|
|
163
|
-
[ -z "$sid" ]
|
|
197
|
+
if [ -z "$sid" ]; then
|
|
198
|
+
sid="mock-session"
|
|
199
|
+
fi
|
|
164
200
|
force="false"
|
|
165
|
-
if
|
|
201
|
+
if _mock_has_flag --force-update "$@"; then
|
|
166
202
|
force="true"
|
|
167
203
|
fi
|
|
168
204
|
|
|
@@ -173,9 +209,11 @@ JSON
|
|
|
173
209
|
|
|
174
210
|
create-channel() {
|
|
175
211
|
name="$(_mock_find_next --name "$@" || true)"
|
|
176
|
-
[ -z "$name" ]
|
|
212
|
+
if [ -z "$name" ]; then
|
|
213
|
+
name="~mock"
|
|
214
|
+
fi
|
|
177
215
|
public=false
|
|
178
|
-
if
|
|
216
|
+
if _mock_has_flag --public "$@"; then
|
|
179
217
|
public=true
|
|
180
218
|
fi
|
|
181
219
|
jids="$(_mock_collect_flag_values --jid "$@")"
|
|
@@ -187,7 +225,9 @@ JSON
|
|
|
187
225
|
|
|
188
226
|
get-channel() {
|
|
189
227
|
name="$(_mock_find_next --name "$@" || true)"
|
|
190
|
-
[ -z "$name" ]
|
|
228
|
+
if [ -z "$name" ]; then
|
|
229
|
+
name="~mock"
|
|
230
|
+
fi
|
|
191
231
|
if [ "$name" = "~missing" ]; then
|
|
192
232
|
echo '{"found":false,"subject":"~missing","reason":"not_found","message":"Channel \"~missing\" was not found."}'
|
|
193
233
|
return 0
|
|
@@ -200,7 +240,9 @@ JSON
|
|
|
200
240
|
|
|
201
241
|
open-session() {
|
|
202
242
|
sid="$(_mock_find_next --session-id "$@" || true)"
|
|
203
|
-
[ -z "$sid" ]
|
|
243
|
+
if [ -z "$sid" ]; then
|
|
244
|
+
sid="mock-session"
|
|
245
|
+
fi
|
|
204
246
|
|
|
205
247
|
cat <<JSON
|
|
206
248
|
{"ok":true,"sessionId":"$(_mock_escape_json "$sid")","deeplink":"zoommtg://chat?sid=$(_mock_escape_json "$sid")"}
|
package/dist/bin/just-bash.js
CHANGED
|
@@ -714,6 +714,7 @@ Options:
|
|
|
714
714
|
-c <script> Execute the script from command line argument
|
|
715
715
|
-e, --errexit Exit immediately if a command exits with non-zero status
|
|
716
716
|
--no-init Disable built-in init script preloading
|
|
717
|
+
--init <file> Load init script file (higher priority than JUST_BASH_INIT)
|
|
717
718
|
--root <path> Root directory for OverlayFS (default: current directory)
|
|
718
719
|
--cwd <path> Working directory within the sandbox (default: project mount point)
|
|
719
720
|
--allow-write Allow write operations (default: read-only)
|
|
@@ -743,6 +744,9 @@ Examples:
|
|
|
743
744
|
# Pipe script from stdin
|
|
744
745
|
echo 'find . -name "*.ts" | head -5' | just-bash-nx
|
|
745
746
|
|
|
747
|
+
# Use a custom init script file
|
|
748
|
+
just-bash-nx -c 'echo ready' --init ./.just-bash-init.sh
|
|
749
|
+
|
|
746
750
|
# Execute a script file
|
|
747
751
|
just-bash-nx ./scripts/build.sh
|
|
748
752
|
|
|
@@ -751,6 +755,6 @@ Examples:
|
|
|
751
755
|
|
|
752
756
|
# Allow write operations (writes stay in memory)
|
|
753
757
|
just-bash-nx -c 'echo test > /tmp/file.txt && cat /tmp/file.txt' --allow-write
|
|
754
|
-
`)}function fl(){console.log("just-bash-nx 1.0.0")}function dl(e){let t={root:process.cwd(),cwd:"/",cwdOverridden:!1,errexit:!1,allowWrite:!1,python:!1,javascript:!1,noInit:!1,json:!1,help:!1,version:!1},s=0;for(;s<e.length;){let n=e[s];if(n==="-h"||n==="--help")t.help=!0,s++;else if(n==="-v"||n==="--version")t.version=!0,s++;else if(n==="-c")s+1>=e.length&&(console.error("Error: -c requires a script argument"),process.exit(1)),t.script=e[s+1],s+=2;else if(n==="-e"||n==="--errexit")t.errexit=!0,s++;else if(n==="--root")s+1>=e.length&&(console.error("Error: --root requires a path argument"),process.exit(1)),t.root=kn(e[s+1]),s+=2;else if(n==="--cwd")s+1>=e.length&&(console.error("Error: --cwd requires a path argument"),process.exit(1)),t.cwd=e[s+1],t.cwdOverridden=!0,s+=2;else if(n==="--json")t.json=!0,s++;else if(n==="--allow-write")t.allowWrite=!0,s++;else if(n==="--python")t.python=!0,s++;else if(n==="--javascript")t.javascript=!0,s++;else if(n==="--no-init")t.noInit=!0,s++;else if(n.startsWith("-"))if(n.length>2&&!n.startsWith("--")){let r=n.slice(1);for(let i of r)if(i==="e")t.errexit=!0;else if(i==="h")t.help=!0;else if(i==="v")t.version=!0;else if(i==="c"){s+1>=e.length&&(console.error("Error: -c requires a script argument"),process.exit(1)),t.script=e[s+1],s++;break}else console.error(`Error: Unknown option: -${i}`),process.exit(1);s++}else console.error(`Error: Unknown option: ${n}`),process.exit(1);else!t.scriptFile&&!t.script?t.scriptFile=n:t.scriptFile&&t.root===process.cwd()&&(t.root=kn(n)),s++}return t}function hl(e){if(!e||e==="/")return"/";let t=e.endsWith("/")&&e!=="/"?e.slice(0,-1):e;t.startsWith("/")||(t=`/${t}`);let s=t.split("/").filter(r=>r&&r!=="."),n=[];for(let r of s)r===".."?n.pop():n.push(r);return`/${n.join("/")}`||"/"}async function pl(){let e=[];for await(let t of process.stdin)e.push(t);return Buffer.concat(e).toString("utf-8")}async function ml(){let e=cl(ul(import.meta.url)),t=kn(e,"./default-init.sh");return ll(t,"utf-8")}async function yl(){let e=process.argv.slice(2),t=dl(e);t.help&&(Hi(),process.exit(0)),t.version&&(fl(),process.exit(0));let s;if(t.script)s=t.script;else if(t.scriptFile){let l=new ht({root:t.root}),c=l.getMountPoint();try{let u=t.scriptFile.startsWith("/")?t.scriptFile:`${c}/${t.scriptFile}`;s=await l.readFile(u,"utf-8")}catch(u){console.error(`Error: Cannot read script file: ${t.scriptFile}`),console.error(ce(u instanceof Error?u.message:String(u))),process.exit(1)}}else process.stdin.isTTY?(Hi(),process.exit(1)):s=await pl();s.trim()||(t.json&&console.log(JSON.stringify({stdout:"",stderr:"",exitCode:0})),process.exit(0));let n=new ht({root:t.root,readOnly:!t.allowWrite}),r=n.getMountPoint(),i=t.cwdOverridden?hl(t.cwd):r,o=new ps({fs:n,cwd:i,python:t.python,javascript:t.javascript}),a=s;if(!t.noInit)try{a=`${await ml()}
|
|
755
|
-
${a}`}catch(l){let c=ce(l instanceof Error?l.message:String(l));t.json?console.log(JSON.stringify({stdout:"",stderr:`Failed to load
|
|
756
|
-
${a}`);try{let l=await o.exec(a);t.json?console.log(JSON.stringify({stdout:l.stdout,stderr:l.stderr,exitCode:l.exitCode})):(l.stdout&&process.stdout.write(l.stdout),l.stderr&&process.stderr.write(l.stderr)),process.exit(l.exitCode)}catch(l){let c=ce(l instanceof Error?l.message:String(l));t.json?console.log(JSON.stringify({stdout:"",stderr:c,exitCode:1})):console.error(c),process.exit(1)}}
|
|
758
|
+
`)}function fl(){console.log("just-bash-nx 1.0.0")}function dl(e){let t={root:process.cwd(),cwd:"/",cwdOverridden:!1,errexit:!1,allowWrite:!1,python:!1,javascript:!1,noInit:!1,json:!1,help:!1,version:!1},s=0;for(;s<e.length;){let n=e[s];if(n==="-h"||n==="--help")t.help=!0,s++;else if(n==="-v"||n==="--version")t.version=!0,s++;else if(n==="-c")s+1>=e.length&&(console.error("Error: -c requires a script argument"),process.exit(1)),t.script=e[s+1],s+=2;else if(n==="-e"||n==="--errexit")t.errexit=!0,s++;else if(n==="--root")s+1>=e.length&&(console.error("Error: --root requires a path argument"),process.exit(1)),t.root=kn(e[s+1]),s+=2;else if(n==="--cwd")s+1>=e.length&&(console.error("Error: --cwd requires a path argument"),process.exit(1)),t.cwd=e[s+1],t.cwdOverridden=!0,s+=2;else if(n==="--json")t.json=!0,s++;else if(n==="--init")s+1>=e.length&&(console.error("Error: --init requires a file path argument"),process.exit(1)),t.initScriptFile=e[s+1],s+=2;else if(n==="--allow-write")t.allowWrite=!0,s++;else if(n==="--python")t.python=!0,s++;else if(n==="--javascript")t.javascript=!0,s++;else if(n==="--no-init")t.noInit=!0,s++;else if(n.startsWith("-"))if(n.length>2&&!n.startsWith("--")){let r=n.slice(1);for(let i of r)if(i==="e")t.errexit=!0;else if(i==="h")t.help=!0;else if(i==="v")t.version=!0;else if(i==="c"){s+1>=e.length&&(console.error("Error: -c requires a script argument"),process.exit(1)),t.script=e[s+1],s++;break}else console.error(`Error: Unknown option: -${i}`),process.exit(1);s++}else console.error(`Error: Unknown option: ${n}`),process.exit(1);else!t.scriptFile&&!t.script?t.scriptFile=n:t.scriptFile&&t.root===process.cwd()&&(t.root=kn(n)),s++}return t}function hl(e){if(!e||e==="/")return"/";let t=e.endsWith("/")&&e!=="/"?e.slice(0,-1):e;t.startsWith("/")||(t=`/${t}`);let s=t.split("/").filter(r=>r&&r!=="."),n=[];for(let r of s)r===".."?n.pop():n.push(r);return`/${n.join("/")}`||"/"}async function pl(){let e=[];for await(let t of process.stdin)e.push(t);return Buffer.concat(e).toString("utf-8")}async function ml(){let e=cl(ul(import.meta.url)),t=kn(e,"./default-init.sh");return ll(t,"utf-8")}async function yl(e,t){let s=e.getMountPoint(),n=t.startsWith("/")?t:`${s}/${t}`;return e.readFile(n,"utf-8")}async function gl(){let e=process.argv.slice(2),t=dl(e);t.help&&(Hi(),process.exit(0)),t.version&&(fl(),process.exit(0));let s;if(t.script)s=t.script;else if(t.scriptFile){let l=new ht({root:t.root}),c=l.getMountPoint();try{let u=t.scriptFile.startsWith("/")?t.scriptFile:`${c}/${t.scriptFile}`;s=await l.readFile(u,"utf-8")}catch(u){console.error(`Error: Cannot read script file: ${t.scriptFile}`),console.error(ce(u instanceof Error?u.message:String(u))),process.exit(1)}}else process.stdin.isTTY?(Hi(),process.exit(1)):s=await pl();s.trim()||(t.json&&console.log(JSON.stringify({stdout:"",stderr:"",exitCode:0})),process.exit(0));let n=new ht({root:t.root,readOnly:!t.allowWrite}),r=n.getMountPoint(),i=t.cwdOverridden?hl(t.cwd):r,o=new ps({fs:n,cwd:i,python:t.python,javascript:t.javascript}),a=s;if(!t.noInit)try{let l=process.env.JUST_BASH_INIT,c=t.initScriptFile??l;a=`${c?await yl(n,c):await ml()}
|
|
759
|
+
${a}`}catch(l){let c=ce(l instanceof Error?l.message:String(l));t.json?console.log(JSON.stringify({stdout:"",stderr:`Failed to load init script: ${c}`,exitCode:1})):console.error(`Failed to load init script: ${c}`),process.exit(1)}t.errexit&&(a=`set -e
|
|
760
|
+
${a}`);try{let l=await o.exec(a);t.json?console.log(JSON.stringify({stdout:l.stdout,stderr:l.stderr,exitCode:l.exitCode})):(l.stdout&&process.stdout.write(l.stdout),l.stderr&&process.stderr.write(l.stderr)),process.exit(l.exitCode)}catch(l){let c=ce(l instanceof Error?l.message:String(l));t.json?console.log(JSON.stringify({stdout:"",stderr:c,exitCode:1})):console.error(c),process.exit(1)}}gl().catch(e=>{console.error("Fatal error:",ce(e instanceof Error?e.message:String(e))),process.exit(1)});
|
package/dist/bin/shell/shell.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "just-bash-nx",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.4",
|
|
4
4
|
"description": "A simulated bash environment with virtual filesystem",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -56,37 +56,6 @@
|
|
|
56
56
|
"publishConfig": {
|
|
57
57
|
"access": "public"
|
|
58
58
|
},
|
|
59
|
-
"scripts": {
|
|
60
|
-
"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",
|
|
61
|
-
"build:clean": "find dist -name '*.test.js' -delete && find dist -name '*.test.d.ts' -delete",
|
|
62
|
-
"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",
|
|
63
|
-
"build:lib": "esbuild dist/index.js --bundle --splitting --platform=node --format=esm --minify --outdir=dist/bundle --chunk-names=chunks/[name]-[hash] --external:diff --external:minimatch --external:sprintf-js --external:turndown --external:sql.js --external:quickjs-emscripten --external:@mongodb-js/zstd --external:node-liblzma --external:seek-bzip",
|
|
64
|
-
"build:lib:cjs": "esbuild dist/index.js --bundle --platform=node --format=cjs --minify --outfile=dist/bundle/index.cjs --external:diff --external:minimatch --external:sprintf-js --external:turndown --external:sql.js --external:quickjs-emscripten --external:@mongodb-js/zstd --external:node-liblzma --external:seek-bzip",
|
|
65
|
-
"build:browser": "esbuild dist/browser.js --bundle --platform=browser --format=esm --minify --outfile=dist/bundle/browser.js --external:diff --external:minimatch --external:sprintf-js --external:turndown --external:node:zlib --external:@mongodb-js/zstd --external:node-liblzma --external:seek-bzip --define:__BROWSER__=true --alias:node:dns=./src/shims/browser-unsupported.js",
|
|
66
|
-
"build:cli": "mkdir -p dist/cli dist/bin && cp src/cli/default-init.sh dist/cli/default-init.sh && cp src/cli/default-init.sh dist/bin/default-init.sh && 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' --external:sql.js --external:quickjs-emscripten --external:@mongodb-js/zstd --external:node-liblzma --external:seek-bzip",
|
|
67
|
-
"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' --external:sql.js --external:quickjs-emscripten --external:@mongodb-js/zstd --external:node-liblzma --external:seek-bzip",
|
|
68
|
-
"prepublishOnly": "pnpm test:dist",
|
|
69
|
-
"validate": "pnpm lint && pnpm knip && pnpm typecheck && pnpm build && pnpm check:worker-sync && pnpm test:run && pnpm test:wasm && pnpm test:dist",
|
|
70
|
-
"typecheck": "tsc --noEmit",
|
|
71
|
-
"lint": "pnpm lint:banned",
|
|
72
|
-
"check:worker-sync": "node scripts/check-worker-sync.js",
|
|
73
|
-
"lint:banned": "node scripts/check-banned-patterns.js",
|
|
74
|
-
"lint:fix": "pnpm --workspace-root lint:fix",
|
|
75
|
-
"knip": "knip",
|
|
76
|
-
"test": "vitest",
|
|
77
|
-
"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",
|
|
78
|
-
"test:dist": "vitest run src/cli/just-bash.bundle.test.ts",
|
|
79
|
-
"test:unit": "vitest run --config vitest.unit.config.ts",
|
|
80
|
-
"test:wasm": "vitest run --config vitest.wasm.config.ts",
|
|
81
|
-
"test:comparison": "vitest run --config vitest.comparison.config.ts",
|
|
82
|
-
"test:comparison:record": "RECORD_FIXTURES=1 vitest run --config vitest.comparison.config.ts",
|
|
83
|
-
"test:coverage": "vitest run --coverage",
|
|
84
|
-
"test:coverage:unit": "vitest run --config vitest.unit.config.ts --coverage",
|
|
85
|
-
"test:fuzz": "vitest run src/security/fuzzing/",
|
|
86
|
-
"test:fuzz:long": "FUZZ_RUNS=10000 vitest run src/security/fuzzing/",
|
|
87
|
-
"shell": "npx tsx src/cli/shell.ts",
|
|
88
|
-
"dev:exec": "npx tsx src/cli/exec.ts"
|
|
89
|
-
},
|
|
90
59
|
"keywords": [],
|
|
91
60
|
"author": "Malte and Claude",
|
|
92
61
|
"license": "Apache-2.0",
|
|
@@ -124,5 +93,35 @@
|
|
|
124
93
|
"optionalDependencies": {
|
|
125
94
|
"@mongodb-js/zstd": "^7.0.0",
|
|
126
95
|
"node-liblzma": "^2.0.3"
|
|
96
|
+
},
|
|
97
|
+
"scripts": {
|
|
98
|
+
"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",
|
|
99
|
+
"build:clean": "find dist -name '*.test.js' -delete && find dist -name '*.test.d.ts' -delete",
|
|
100
|
+
"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",
|
|
101
|
+
"build:lib": "esbuild dist/index.js --bundle --splitting --platform=node --format=esm --minify --outdir=dist/bundle --chunk-names=chunks/[name]-[hash] --external:diff --external:minimatch --external:sprintf-js --external:turndown --external:sql.js --external:quickjs-emscripten --external:@mongodb-js/zstd --external:node-liblzma --external:seek-bzip",
|
|
102
|
+
"build:lib:cjs": "esbuild dist/index.js --bundle --platform=node --format=cjs --minify --outfile=dist/bundle/index.cjs --external:diff --external:minimatch --external:sprintf-js --external:turndown --external:sql.js --external:quickjs-emscripten --external:@mongodb-js/zstd --external:node-liblzma --external:seek-bzip",
|
|
103
|
+
"build:browser": "esbuild dist/browser.js --bundle --platform=browser --format=esm --minify --outfile=dist/bundle/browser.js --external:diff --external:minimatch --external:sprintf-js --external:turndown --external:node:zlib --external:@mongodb-js/zstd --external:node-liblzma --external:seek-bzip --define:__BROWSER__=true --alias:node:dns=./src/shims/browser-unsupported.js",
|
|
104
|
+
"build:cli": "mkdir -p dist/cli dist/bin && cp src/cli/default-init.sh dist/cli/default-init.sh && cp src/cli/default-init.sh dist/bin/default-init.sh && 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' --external:sql.js --external:quickjs-emscripten --external:@mongodb-js/zstd --external:node-liblzma --external:seek-bzip",
|
|
105
|
+
"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' --external:sql.js --external:quickjs-emscripten --external:@mongodb-js/zstd --external:node-liblzma --external:seek-bzip",
|
|
106
|
+
"validate": "pnpm lint && pnpm knip && pnpm typecheck && pnpm build && pnpm check:worker-sync && pnpm test:run && pnpm test:wasm && pnpm test:dist",
|
|
107
|
+
"typecheck": "tsc --noEmit",
|
|
108
|
+
"lint": "pnpm lint:banned",
|
|
109
|
+
"check:worker-sync": "node scripts/check-worker-sync.js",
|
|
110
|
+
"lint:banned": "node scripts/check-banned-patterns.js",
|
|
111
|
+
"lint:fix": "pnpm --workspace-root lint:fix",
|
|
112
|
+
"knip": "knip",
|
|
113
|
+
"test": "vitest",
|
|
114
|
+
"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",
|
|
115
|
+
"test:dist": "vitest run src/cli/just-bash.bundle.test.ts",
|
|
116
|
+
"test:unit": "vitest run --config vitest.unit.config.ts",
|
|
117
|
+
"test:wasm": "vitest run --config vitest.wasm.config.ts",
|
|
118
|
+
"test:comparison": "vitest run --config vitest.comparison.config.ts",
|
|
119
|
+
"test:comparison:record": "RECORD_FIXTURES=1 vitest run --config vitest.comparison.config.ts",
|
|
120
|
+
"test:coverage": "vitest run --coverage",
|
|
121
|
+
"test:coverage:unit": "vitest run --config vitest.unit.config.ts --coverage",
|
|
122
|
+
"test:fuzz": "vitest run src/security/fuzzing/",
|
|
123
|
+
"test:fuzz:long": "FUZZ_RUNS=10000 vitest run src/security/fuzzing/",
|
|
124
|
+
"shell": "npx tsx src/cli/shell.ts",
|
|
125
|
+
"dev:exec": "npx tsx src/cli/exec.ts"
|
|
127
126
|
}
|
|
128
|
-
}
|
|
127
|
+
}
|
|
File without changes
|