feat: add @cloudflare/shell#1103
Merged
Merged
Conversation
Initial release of `@cloudflare/shell` — a runtime-agnostic bash interpreter forked from [just-bash](https://github.com/vercel-labs/just-bash) (Apache-2.0, Vercel Labs). - 80+ built-in commands: I/O, filesystem, text processing, data, archives, network (`curl`), and control flow - In-memory POSIX-like filesystem with symlinks, permissions, `/proc`, `/dev/null`, `/dev/urandom` - Full bash subset: pipes, redirects, variables, arithmetic, arrays, globbing, brace expansion, functions, heredocs, `set -euo pipefail` - Pluggable interfaces for SQL (`SqlExecutor`), code execution (`CodeExecutor`), and HTML-to-Markdown conversion (`MarkdownConverter`) - Configurable execution limits to prevent resource exhaustion in multi-tenant environments - RE2-based regex engine via [re2js](https://github.com/le0pard/re2js) for ReDoS-safe `grep`, `sed`, and `awk` - Network access disabled by default with URL allow-list and optional SSRF protection (`denyPrivateRanges`) - Workers adapters (`@cloudflare/shell/workers`): `DOSqlExecutor` (Durable Object SqlStorage), `D1SqlExecutor` (Cloudflare D1), `DynamicIsolateExecutor` (Worker Loader), `WorkersAIMarkdownConverter` - Node.js adapters (`@cloudflare/shell/node`): `BetterSqlite3Executor`, `ChildProcessExecutor`, `TurndownConverter` - Embedded adapters (`@cloudflare/shell/embedded`): `EmbeddedExecutor` with QuickJS and Pyodide WASM
🦋 Changeset detectedLatest commit: 1915d77 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
agents
@cloudflare/ai-chat
@cloudflare/codemode
hono-agents
@cloudflare/shell
@cloudflare/voice
@cloudflare/worker-bundler
commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Introduces — a runtime-agnostic bash interpreter with an in-memory filesystem, 80+ built-in commands, and pluggable backends for SQL, code execution, and HTML-to-Markdown conversion. Forked from just-bash (Apache-2.0, Vercel Labs) and substantially extended.
Also migrates
@cloudflare/thinkfromjust-bashto@cloudflare/shell.What's in the package
Core interpreter
set -euo pipefail/proc,/dev/null,/dev/urandom, lazy file loadingdefineCommand()API for registering custom TypeScript commandsdenyPrivateRanges)Pluggable interface architecture
The core has zero WASM/native dependencies. Three small interfaces externalize heavyweight capabilities:
SqlExecutorsqlite3commandCodeExecutorjs-exec,node,python3,pythoncommandsMarkdownConverterhtml-to-markdowncommandEntry points and adapters
@cloudflare/shell— core shell, filesystem, interfaces, types@cloudflare/shell/workers—DOSqlExecutor(Durable Object SqlStorage),D1SqlExecutor(Cloudflare D1),DynamicIsolateExecutor(Worker Loader API for isolated V8 code execution),WorkersAIMarkdownConverter@cloudflare/shell/node—BetterSqlite3Executor,ChildProcessExecutor,TurndownConverter@cloudflare/shell/embedded—EmbeddedExecutorwith QuickJS (~500KB WASM) and Pyodide (~10MB WASM)Testing
set -e/-u/-o pipefail, command substitution, process substitution, brace/glob expansionDifferences from just-bash
RegExpdenyPrivateRangesxanandyqnot ported (niche/overlapping withjq)@cloudflare/think migration
just-bashpeer/dev dep with@cloudflare/shell