just-bash-nx 3.0.5 → 3.0.6

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.
@@ -4,8 +4,9 @@
4
4
  export JUST_BASH=1
5
5
 
6
6
 
7
- # Reusable host-command mocks for npx just-bash-nx verification.
8
- # Source this file inside the same shell process as the script under test.
7
+ # Host-command mocks synced from
8
+ # ~/.codex/skills/chat-assist-skill-creator/scripts/just-bash-command-mocks.sh.
9
+ # Keep this section aligned with that source file.
9
10
 
10
11
  # ---------- helpers ----------
11
12
  _mock_now_ms() {
@@ -23,10 +24,12 @@ _mock_collect_flag_values() {
23
24
  flag="$1"
24
25
  shift
25
26
  while [ "$#" -gt 0 ]; do
26
- if [ "$1" = "$flag" ] && [ "$#" -ge 2 ]; then
27
- printf '%s\n' "$2"
28
- shift 2
29
- continue
27
+ if [ "$1" = "$flag" ]; then
28
+ if [ "$#" -ge 2 ]; then
29
+ printf '%s\n' "$2"
30
+ shift 2
31
+ continue
32
+ fi
30
33
  fi
31
34
  shift
32
35
  done
@@ -37,9 +40,11 @@ _mock_find_next() {
37
40
  flag="$1"
38
41
  shift
39
42
  while [ "$#" -gt 0 ]; do
40
- if [ "$1" = "$flag" ] && [ "$#" -ge 2 ]; then
41
- printf '%s' "$2"
42
- return 0
43
+ if [ "$1" = "$flag" ]; then
44
+ if [ "$#" -ge 2 ]; then
45
+ printf '%s' "$2"
46
+ return 0
47
+ fi
43
48
  fi
44
49
  shift
45
50
  done
@@ -121,6 +126,58 @@ send-chat() {
121
126
  JSON
122
127
  }
123
128
 
129
+ forward-thread() {
130
+ to_sid="$(_mock_find_next --to-session-id "$@" || true)"
131
+ from_sid="$(_mock_find_next --from-session-id "$@" || true)"
132
+ thread_ts="$(_mock_find_next --thread-timestamp "$@" || true)"
133
+ if [ -z "$to_sid" ]; then
134
+ to_sid="mock-destination-session"
135
+ fi
136
+ if [ -z "$from_sid" ]; then
137
+ from_sid="mock-source-session"
138
+ fi
139
+ if [ -z "$thread_ts" ]; then
140
+ thread_ts="$(_mock_now_ms)"
141
+ fi
142
+
143
+ cat <<JSON
144
+ {"messageId":"forward-thread-$(_mock_now_ms)","echo":{"toSessionId":"$(_mock_escape_json "$to_sid")","fromSessionId":"$(_mock_escape_json "$from_sid")","threadTimestamp":"$(_mock_escape_json "$thread_ts")"}}
145
+ JSON
146
+ }
147
+
148
+ forward-messages() {
149
+ to_sid="$(_mock_find_next --to-session-id "$@" || true)"
150
+ from_sid="$(_mock_find_next --from-session-id "$@" || true)"
151
+ message_ids="$(_mock_find_next --message-ids "$@" || true)"
152
+ if [ -z "$to_sid" ]; then
153
+ to_sid="mock-destination-session"
154
+ fi
155
+ if [ -z "$from_sid" ]; then
156
+ from_sid="mock-source-session"
157
+ fi
158
+ if [ -z "$message_ids" ]; then
159
+ message_ids="msg-1"
160
+ fi
161
+
162
+ message_ids_json='['
163
+ first_id=1
164
+ for message_id in $(printf '%s' "$message_ids" | tr ',' ' '); do
165
+ if [ -z "$message_id" ]; then
166
+ continue
167
+ fi
168
+ if [ "$first_id" -eq 0 ]; then
169
+ message_ids_json="${message_ids_json},"
170
+ fi
171
+ message_ids_json="${message_ids_json}\"$(_mock_escape_json "$message_id")\""
172
+ first_id=0
173
+ done
174
+ message_ids_json="${message_ids_json}]"
175
+
176
+ cat <<JSON
177
+ {"messageId":"forward-messages-$(_mock_now_ms)","echo":{"toSessionId":"$(_mock_escape_json "$to_sid")","fromSessionId":"$(_mock_escape_json "$from_sid")","messageIds":"$(_mock_escape_json "$message_ids")"},"messageIds":$message_ids_json}
178
+ JSON
179
+ }
180
+
124
181
  edit-chat() {
125
182
  sid="$(_mock_find_next --session-id "$@" || true)"
126
183
  mid="$(_mock_find_next --message-id "$@" || true)"
@@ -159,11 +216,13 @@ add-members() {
159
216
  first_jid="$(printf '%s\n' "$jids" | sed -n '1p')"
160
217
  fi
161
218
 
162
- if [ -n "$first_jid" ] && [ "${MOCK_ADD_MEMBERS_DENY_FIRST:-0}" = "1" ]; then
163
- cat <<JSON
219
+ if [ -n "$first_jid" ]; then
220
+ if [ "${MOCK_ADD_MEMBERS_DENY_FIRST:-0}" = "1" ]; then
221
+ cat <<JSON
164
222
  {"sessionId":"$(_mock_escape_json "$sid")","invitedCount":$((invited-1)),"notAllowedList":[{"jid":"$(_mock_escape_json "$first_jid")","reason":"mock_denied"}],"echo":{"jids":"$(_mock_escape_json "$jids")","emails":"$(_mock_escape_json "$emails")"}}
165
223
  JSON
166
- return 0
224
+ return 0
225
+ fi
167
226
  fi
168
227
 
169
228
  cat <<JSON
File without changes
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "just-bash-nx",
3
- "version": "3.0.5",
3
+ "version": "3.0.6",
4
4
  "description": "A simulated bash environment with virtual filesystem",
5
5
  "repository": {
6
6
  "type": "git",
@@ -56,6 +56,37 @@
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
+ },
59
90
  "keywords": [],
60
91
  "author": "Malte and Claude",
61
92
  "license": "Apache-2.0",
@@ -93,35 +124,5 @@
93
124
  "optionalDependencies": {
94
125
  "@mongodb-js/zstd": "^7.0.0",
95
126
  "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"
126
127
  }
127
- }
128
+ }
File without changes