Repository navigation
Home
A pure-Swift, sandboxed bash interpreter that drops into any Mac or
iOS binary. No Process, no fork, no exec — every command is a
registered Swift type, every byte streams through async channels, and
every host-touching axis (filesystem, network, processes, identity)
is virtualised by default.
The goal: be the local code interpreter for an LLM agent. Hand the agent a workspace folder, hand it the network endpoints it's allowed to call, and let it write and run bash scripts that manipulate files, parse data, and fetch documents — all without ever touching anything outside its sandbox. Same shell runs equally well on a server, a Mac CLI tool, an iOS App Sandbox extension, or a Swift Playground.
import BashInterpreter
import BashCommandKit
let shell = Shell() // sandbox-by-default identity
shell.registerStandardCommands() // ls, cat, grep, sed, find, …
try await shell.run("""
for f in *.txt; do
echo "$(basename "$f" .txt): $(wc -l < "$f") lines"
done | sort -k2 -n
""")Docs
- BashCommandKit — The catalog of "system" commands a real script expects — ls, cat, grep, sed, find, tar, curl, jq, ….
- BashInterpreter — The execution layer that walks a BashSyntax AST and runs it.
- BashSyntax — A modern Swift implementation of a bash syntax parser.
- BashVersionConformance — SwiftBash targets bash 4.x semantics for every feature it implements, not the bash 3.2 (2007) that ships as /bin/bash on macOS.
- CLI — The package ships a command-line front-end built on swift-argument-parser.
- InterpreterArchitecture — A field report on how SwiftBash is structured, what worked, and what to keep / change when building a new interpreter (e.g.
- Networking — SwiftBash's curl is the single network entry point.
- Sandboxing — SwiftBash exists to be embedded inside a host app — including sandboxed Mac and iOS apps — and run untrusted scripts (often LLM-generated) safely.
- SwiftJS — A Node-style JavaScript executor built on Apple's JavaScriptCore.
- SwiftScript — BashSwiftScript is the library that wires SwiftScript — a Swift tree-walking interpreter — into a SwiftBash Shell so a script with #!/usr/bin/env swift-script (or just #!/usr/bin/env swift) runs in…
- TypeCheckingApproach — A follow-on to InterpreterArchitecture.md.
- VirtualBin — A SwiftBash script never executes real on-disk binaries — every command is dispatched in-process through Shell.commands.
Generated by MissionControl from README.md and Docs/. Edit those, not this page.