just-bash 1.2.0 → 1.2.2
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/chunks/awk2-4DKPX43H.js +20 -0
- package/dist/bin/chunks/bash-5IWSVGHN.js +7 -0
- package/dist/bin/chunks/chunk-NWWB2XRE.js +6 -0
- package/dist/bin/chunks/env-AKGX6HSG.js +9 -0
- package/dist/bin/chunks/find-WJV3FM6L.js +11 -0
- package/dist/bin/chunks/help-YQGNAT2T.js +16 -0
- package/dist/bin/chunks/sed-LTCVBSRV.js +80 -0
- package/dist/bin/chunks/timeout-RP2AJGMV.js +12 -0
- package/dist/bin/chunks/xargs-DKUAYNEK.js +4 -0
- package/dist/bin/just-bash.js +72 -72
- package/dist/bin/shell/chunks/awk2-4DKPX43H.js +20 -0
- package/dist/bin/shell/chunks/bash-5IWSVGHN.js +7 -0
- package/dist/bin/shell/chunks/chunk-NWWB2XRE.js +6 -0
- package/dist/bin/shell/chunks/env-AKGX6HSG.js +9 -0
- package/dist/bin/shell/chunks/find-WJV3FM6L.js +11 -0
- package/dist/bin/shell/chunks/help-YQGNAT2T.js +16 -0
- package/dist/bin/shell/chunks/sed-LTCVBSRV.js +80 -0
- package/dist/bin/shell/chunks/timeout-RP2AJGMV.js +12 -0
- package/dist/bin/shell/chunks/xargs-DKUAYNEK.js +4 -0
- package/dist/bin/shell/shell.js +97 -97
- package/dist/bundle/ai/index.js +305 -305
- package/dist/bundle/chunks/awk2-4YCQ6UCB.js +19 -0
- package/dist/bundle/chunks/bash-5WG5RD6L.js +6 -0
- package/dist/bundle/chunks/chunk-CG2HXOFG.js +5 -0
- package/dist/bundle/chunks/env-2F2VHNYS.js +8 -0
- package/dist/bundle/chunks/find-K7D4PKHS.js +10 -0
- package/dist/bundle/chunks/help-XHGUXTV3.js +15 -0
- package/dist/bundle/chunks/sed-IGVS3UIY.js +79 -0
- package/dist/bundle/chunks/timeout-VG2N46UR.js +11 -0
- package/dist/bundle/chunks/xargs-752VENJT.js +3 -0
- package/dist/bundle/index.js +111 -111
- package/dist/interpreter/errors.d.ts +8 -0
- package/dist/interpreter/types.d.ts +2 -0
- package/dist/types.d.ts +11 -4
- package/package.json +2 -1
|
@@ -99,6 +99,14 @@ export declare class ExecutionLimitError extends ControlFlowError {
|
|
|
99
99
|
static readonly EXIT_CODE = 126;
|
|
100
100
|
constructor(message: string, limitType: "recursion" | "commands" | "iterations", stdout?: string, stderr?: string);
|
|
101
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* Error thrown when break/continue is called in a subshell that was
|
|
104
|
+
* spawned from within a loop context. Causes the subshell to exit cleanly.
|
|
105
|
+
*/
|
|
106
|
+
export declare class SubshellExitError extends ControlFlowError {
|
|
107
|
+
readonly name = "SubshellExitError";
|
|
108
|
+
constructor(stdout?: string, stderr?: string);
|
|
109
|
+
}
|
|
102
110
|
/**
|
|
103
111
|
* Type guard for errors that exit the current scope (return, break, continue).
|
|
104
112
|
* These need special handling vs errexit/nounset which terminate execution.
|
|
@@ -37,6 +37,8 @@ export interface InterpreterState {
|
|
|
37
37
|
inCondition: boolean;
|
|
38
38
|
/** Current loop nesting depth (for break/continue) */
|
|
39
39
|
loopDepth: number;
|
|
40
|
+
/** True if this subshell was spawned from within a loop context (for break/continue to exit subshell) */
|
|
41
|
+
parentHasLoopContext?: boolean;
|
|
40
42
|
/** Stdin available for commands in compound commands (groups, subshells, while loops with piped input) */
|
|
41
43
|
groupStdin?: string;
|
|
42
44
|
/** Set of variable names that are readonly */
|
package/dist/types.d.ts
CHANGED
|
@@ -12,12 +12,16 @@ export interface ExecResult {
|
|
|
12
12
|
export interface BashExecResult extends ExecResult {
|
|
13
13
|
env: Record<string, string>;
|
|
14
14
|
}
|
|
15
|
-
/** Options for exec calls within commands */
|
|
15
|
+
/** Options for exec calls within commands (internal API) */
|
|
16
16
|
export interface CommandExecOptions {
|
|
17
17
|
/** Environment variables to merge into the exec state */
|
|
18
18
|
env?: Record<string, string>;
|
|
19
|
-
/**
|
|
20
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Working directory for the exec.
|
|
21
|
+
* Required to prevent bugs where subcommands run in the wrong directory.
|
|
22
|
+
* Always pass `ctx.cwd` from the calling command's context.
|
|
23
|
+
*/
|
|
24
|
+
cwd: string;
|
|
21
25
|
}
|
|
22
26
|
/**
|
|
23
27
|
* Context provided to commands during execution.
|
|
@@ -52,8 +56,11 @@ export interface CommandContext {
|
|
|
52
56
|
/**
|
|
53
57
|
* Execute a subcommand (e.g., for `xargs`, `bash -c`).
|
|
54
58
|
* Available when running commands via BashEnv interpreter.
|
|
59
|
+
*
|
|
60
|
+
* @param command - The command string to execute
|
|
61
|
+
* @param options - Required options including `cwd` to prevent directory bugs
|
|
55
62
|
*/
|
|
56
|
-
exec?: (command: string, options
|
|
63
|
+
exec?: (command: string, options: CommandExecOptions) => Promise<ExecResult>;
|
|
57
64
|
/**
|
|
58
65
|
* Secure fetch function for network requests (e.g., for `curl`).
|
|
59
66
|
* Only available when `network` option is configured in BashEnv.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "just-bash",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"description": "A simulated bash environment with virtual filesystem",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -97,6 +97,7 @@
|
|
|
97
97
|
"test:dist": "vitest run src/cli/just-bash.bundle.test.ts",
|
|
98
98
|
"test:unit": "vitest run --config vitest.unit.config.ts",
|
|
99
99
|
"test:comparison": "vitest run --config vitest.comparison.config.ts",
|
|
100
|
+
"test:comparison:record": "RECORD_FIXTURES=1 vitest run --config vitest.comparison.config.ts",
|
|
100
101
|
"shell": "npx tsx src/cli/shell.ts",
|
|
101
102
|
"dev:exec": "npx tsx src/cli/exec.ts"
|
|
102
103
|
}
|