From dc5b4984c10a1d9ddd840817c47aa1c78659ffd2 Mon Sep 17 00:00:00 2001 From: Matt Carey Date: Wed, 14 Oct 2026 20:27:13 +0200 Subject: [PATCH 1/2] computer: Make just-bash an optional peer and stop installing acorn Every consumer of @cloudflare/computer installed just-bash and acorn, even when it only used the filesystem, git, or the container backend. just-bash alone is about 21 MB unpacked, and pulls in more on top. just-bash is imported only by the worker-shell backend, and the published bundle keeps it as an external import. It is now an optional peer dependency. A Worker that imports the worker-shell backend without it fails at build time with "Could not resolve just-bash", which names the package to install. acorn is imported only by the worker-javascript backend, and rolldown already inlines it into that entry point, so nothing resolves it at install or bundle time. It moves to devDependencies with no change for consumers. The examples that import the worker-shell backend now list just-bash themselves, and the README and worker backend doc say to install it. Fixes #220. --- .changeset/optional-just-bash-acorn.md | 5 ++++ docs/12_worker_backend.md | 7 +++++ examples/artifacts/package.json | 3 ++- examples/egress/package.json | 3 ++- examples/mcp/package.json | 1 + examples/pi-ai/package.json | 1 + examples/tanstack-ai/package.json | 1 + examples/think-compare-runtimes/package.json | 1 + examples/think/package.json | 1 + examples/vite-bundle/package.json | 3 ++- examples/worker-shell/package.json | 3 ++- package-lock.json | 27 +++++++++++++++----- packages/computer/README.md | 5 ++-- packages/computer/package.json | 12 ++++++--- 14 files changed, 56 insertions(+), 17 deletions(-) create mode 100644 .changeset/optional-just-bash-acorn.md diff --git a/.changeset/optional-just-bash-acorn.md b/.changeset/optional-just-bash-acorn.md new file mode 100644 index 00000000..4dc5c6ac --- /dev/null +++ b/.changeset/optional-just-bash-acorn.md @@ -0,0 +1,5 @@ +--- +"@cloudflare/computer": minor +--- + +`just-bash` is now an optional peer dependency, so install it yourself if you use `@cloudflare/computer/backends/worker-shell`. `acorn` is no longer installed with the package, because the JavaScript backend already bundles it. diff --git a/docs/12_worker_backend.md b/docs/12_worker_backend.md index 1bba49b5..d4b3ef6b 100644 --- a/docs/12_worker_backend.md +++ b/docs/12_worker_backend.md @@ -13,6 +13,13 @@ the host workspace over Workers RPC, so there is no second store and no sync round trip; the host Durable Object's SQLite is the only authoritative state. +just-bash is an optional peer dependency of `@cloudflare/computer`. +Install it alongside the package when you use this backend: + +```sh +npm install @cloudflare/computer just-bash +``` + Import via the sub-path so the bundled just-bash payload tree-shakes out of consumers that don't use it: diff --git a/examples/artifacts/package.json b/examples/artifacts/package.json index 0569846c..6c4c6a8f 100644 --- a/examples/artifacts/package.json +++ b/examples/artifacts/package.json @@ -11,7 +11,8 @@ "build:types": "wrangler types" }, "dependencies": { - "@cloudflare/computer": "*" + "@cloudflare/computer": "*", + "just-bash": "^3.0.1" }, "devDependencies": { "typescript": "^6.0.3", diff --git a/examples/egress/package.json b/examples/egress/package.json index 43a2e981..df713899 100644 --- a/examples/egress/package.json +++ b/examples/egress/package.json @@ -12,7 +12,8 @@ "build:types": "wrangler types" }, "dependencies": { - "@cloudflare/computer": "*" + "@cloudflare/computer": "*", + "just-bash": "^3.0.1" }, "devDependencies": { "typescript": "^6.0.3", diff --git a/examples/mcp/package.json b/examples/mcp/package.json index 00ad3d07..82311eae 100644 --- a/examples/mcp/package.json +++ b/examples/mcp/package.json @@ -18,6 +18,7 @@ "@modelcontextprotocol/sdk": "1.31.0", "@platformatic/vfs": "^0.4.0", "ai": "^7.0.0", + "just-bash": "^3.0.1", "zod": "^4.4.3" }, "devDependencies": { diff --git a/examples/pi-ai/package.json b/examples/pi-ai/package.json index 08a596f3..98461449 100644 --- a/examples/pi-ai/package.json +++ b/examples/pi-ai/package.json @@ -14,6 +14,7 @@ "dependencies": { "@cloudflare/computer": "*", "@earendil-works/pi-ai": "^0.99.2", + "just-bash": "^3.0.1", "zod": "^4.4.3" }, "devDependencies": { diff --git a/examples/tanstack-ai/package.json b/examples/tanstack-ai/package.json index 8fe6d782..bceac9d9 100644 --- a/examples/tanstack-ai/package.json +++ b/examples/tanstack-ai/package.json @@ -15,6 +15,7 @@ "@cloudflare/computer": "*", "@tanstack/ai": "^0.63.0", "@tanstack/ai-cloudflare": "^0.2.1", + "just-bash": "^3.0.1", "zod": "^4.4.3" }, "devDependencies": { diff --git a/examples/think-compare-runtimes/package.json b/examples/think-compare-runtimes/package.json index 0cb9362c..0bad402d 100644 --- a/examples/think-compare-runtimes/package.json +++ b/examples/think-compare-runtimes/package.json @@ -29,6 +29,7 @@ "@shikijs/themes": "^4.2.0", "agents": "^0.20.0", "ai": "^7.0.0", + "just-bash": "^3.0.1", "partyserver": "^0.5.6", "partysocket": "^1.1.19", "react": "^19.2.7", diff --git a/examples/think/package.json b/examples/think/package.json index d0ed8177..d4902739 100644 --- a/examples/think/package.json +++ b/examples/think/package.json @@ -26,6 +26,7 @@ "agents": "^0.20.0", "ai": "^7.0.0", "isomorphic-git": "^1.38.3", + "just-bash": "^3.0.1", "workers-ai-provider": "^4.0.0", "zod": "^4.4.3" }, diff --git a/examples/vite-bundle/package.json b/examples/vite-bundle/package.json index b863ec49..42c31a94 100644 --- a/examples/vite-bundle/package.json +++ b/examples/vite-bundle/package.json @@ -13,7 +13,8 @@ "build:types": "wrangler types" }, "dependencies": { - "@cloudflare/computer": "*" + "@cloudflare/computer": "*", + "just-bash": "^3.0.1" }, "devDependencies": { "@cloudflare/vite-plugin": "^1.63.0", diff --git a/examples/worker-shell/package.json b/examples/worker-shell/package.json index 8108a362..afef852a 100644 --- a/examples/worker-shell/package.json +++ b/examples/worker-shell/package.json @@ -13,7 +13,8 @@ "build:types": "wrangler types" }, "dependencies": { - "@cloudflare/computer": "*" + "@cloudflare/computer": "*", + "just-bash": "^3.0.1" }, "devDependencies": { "typescript": "^6.0.3", diff --git a/package-lock.json b/package-lock.json index 7c13ad42..fa9b4507 100644 --- a/package-lock.json +++ b/package-lock.json @@ -31,7 +31,8 @@ "name": "@example/computer-artifacts", "version": "0.0.0", "dependencies": { - "@cloudflare/computer": "*" + "@cloudflare/computer": "*", + "just-bash": "^3.0.1" }, "devDependencies": { "typescript": "^6.0.3", @@ -96,7 +97,8 @@ "name": "@example/computer-egress", "version": "0.0.0", "dependencies": { - "@cloudflare/computer": "*" + "@cloudflare/computer": "*", + "just-bash": "^3.0.1" }, "devDependencies": { "typescript": "^6.0.3", @@ -114,6 +116,7 @@ "@modelcontextprotocol/sdk": "1.31.0", "@platformatic/vfs": "^0.4.0", "ai": "^7.0.0", + "just-bash": "^3.0.1", "zod": "^4.4.3" }, "devDependencies": { @@ -129,6 +132,7 @@ "dependencies": { "@cloudflare/computer": "*", "@earendil-works/pi-ai": "^0.99.2", + "just-bash": "^3.0.1", "zod": "^4.4.3" }, "devDependencies": { @@ -169,6 +173,7 @@ "@cloudflare/computer": "*", "@tanstack/ai": "^0.63.0", "@tanstack/ai-cloudflare": "^0.2.1", + "just-bash": "^3.0.1", "zod": "^4.4.3" }, "devDependencies": { @@ -192,6 +197,7 @@ "agents": "^0.20.0", "ai": "^7.0.0", "isomorphic-git": "^1.38.3", + "just-bash": "^3.0.1", "workers-ai-provider": "^4.0.0", "zod": "^4.4.3" }, @@ -220,6 +226,7 @@ "@shikijs/themes": "^4.2.0", "agents": "^0.20.0", "ai": "^7.0.0", + "just-bash": "^3.0.1", "partyserver": "^0.5.6", "partysocket": "^1.1.19", "react": "^19.2.7", @@ -328,7 +335,8 @@ "name": "@example/computer-vite-bundle", "version": "0.0.0", "dependencies": { - "@cloudflare/computer": "*" + "@cloudflare/computer": "*", + "just-bash": "^3.0.1" }, "devDependencies": { "@cloudflare/vite-plugin": "^1.63.0", @@ -352,7 +360,8 @@ "name": "@example/computer-worker-shell", "version": "0.0.0", "dependencies": { - "@cloudflare/computer": "*" + "@cloudflare/computer": "*", + "just-bash": "^3.0.1" }, "devDependencies": { "typescript": "^6.0.3", @@ -15986,9 +15995,7 @@ "version": "0.5.1", "license": "MIT", "dependencies": { - "acorn": "^8.17.0", - "capnweb": "^0.10.0", - "just-bash": "^3.0.1" + "capnweb": "^0.10.0" }, "devDependencies": { "@cloudflare/computer-rpc": "*", @@ -15999,10 +16006,12 @@ "@earendil-works/pi-ai": "^0.99.2", "@platformatic/vfs": "^0.4.0", "@tanstack/ai": "^0.63.0", + "acorn": "^8.17.0", "ai": "^7.0.0", "diff": "^9.0.0", "esbuild": "^0.28.1", "isomorphic-git": "^1.38.3", + "just-bash": "^3.0.1", "memfs": "^4.57.6", "rolldown": "^1.0.2", "rolldown-plugin-dts": "^0.25.2", @@ -16016,6 +16025,7 @@ "@cloudflare/workers-types": "^4.20260616.1 || ^5.20260921.1", "@platformatic/vfs": "*", "ai": "^6.0.196 || ^7.0.0", + "just-bash": "^3.0.1", "vite": "^6.0.0 || ^7.0.0 || ^8.0.0", "zod": "^4.4.3" }, @@ -16029,6 +16039,9 @@ "ai": { "optional": true }, + "just-bash": { + "optional": true + }, "vite": { "optional": true }, diff --git a/packages/computer/README.md b/packages/computer/README.md index 81799049..fdb7e82c 100644 --- a/packages/computer/README.md +++ b/packages/computer/README.md @@ -50,7 +50,8 @@ worker-shell and worker-javascript backends additionally need the own binding requirements — see [Choosing a backend](#choosing-a-backend). Optional peer dependencies, installed only if you use the matching -feature: `zod` for every tools entry point, `ai` for +feature: `just-bash` for `@cloudflare/computer/backends/worker-shell`, +`zod` for every tools entry point, `ai` for `@cloudflare/computer/tools` and `@cloudflare/computer/tools/ai-sdk`, and `@platformatic/vfs` for the Node-side VFS provider. The pi and TanStack AI entry points need nothing beyond `zod`; your agent brings its own @@ -278,7 +279,7 @@ Alongside `exec`, the runtime exposes `getExec`, `killExec`, and | --- | --- | --- | --- | | **Container** | `@cloudflare/computer/backends/container` | Shell commands in full Linux userland (real binaries, `npm`, `node`, network) | A Cloudflare Container running `computerd`, scheduled by the durable object (`scheduling_policy: "durable_object"`) | | **Container (legacy)** | `@cloudflare/computer/backends/container-legacy` | The same | A Cloudflare Container the platform schedules and sizes from the `containers` block | -| **Worker shell** | `@cloudflare/computer/backends/worker-shell` | Shell commands via [just-bash](https://github.com/vercel-labs/just-bash) in a Dynamic Worker | A Worker Loader binding; `experimental` flag | +| **Worker shell** | `@cloudflare/computer/backends/worker-shell` | Shell commands via [just-bash](https://github.com/vercel-labs/just-bash) in a Dynamic Worker | A Worker Loader binding; `experimental` flag; the `just-bash` package | | **Worker JavaScript** | `@cloudflare/computer/backends/worker-javascript` | ECMAScript modules in a fresh Dynamic Worker | A Worker Loader binding; `experimental` flag | - **Container** cold-starts more slowly but gives you a real Linux diff --git a/packages/computer/package.json b/packages/computer/package.json index 45d57cf8..43e4b509 100644 --- a/packages/computer/package.json +++ b/packages/computer/package.json @@ -1,7 +1,7 @@ { "name": "@cloudflare/computer", "version": "0.5.1", - "description": "Cloudflare Computer — a SQLite-backed virtual filesystem with sync to a container-side daemon (computerd).", + "description": "Cloudflare Computer \u2014 a SQLite-backed virtual filesystem with sync to a container-side daemon (computerd).", "license": "MIT", "repository": { "directory": "packages/computer", @@ -164,14 +164,13 @@ "prepublishOnly": "npm run build && npm test" }, "dependencies": { - "acorn": "^8.17.0", - "capnweb": "^0.10.0", - "just-bash": "^3.0.1" + "capnweb": "^0.10.0" }, "peerDependencies": { "@cloudflare/workers-types": "^4.20260616.1 || ^5.20260921.1", "@platformatic/vfs": "*", "ai": "^6.0.196 || ^7.0.0", + "just-bash": "^3.0.1", "vite": "^6.0.0 || ^7.0.0 || ^8.0.0", "zod": "^4.4.3" }, @@ -185,6 +184,9 @@ "ai": { "optional": true }, + "just-bash": { + "optional": true + }, "vite": { "optional": true }, @@ -201,10 +203,12 @@ "@earendil-works/pi-ai": "^0.99.2", "@platformatic/vfs": "^0.4.0", "@tanstack/ai": "^0.63.0", + "acorn": "^8.17.0", "ai": "^7.0.0", "diff": "^9.0.0", "esbuild": "^0.28.1", "isomorphic-git": "^1.38.3", + "just-bash": "^3.0.1", "memfs": "^4.57.6", "rolldown": "^1.0.2", "rolldown-plugin-dts": "^0.25.2", From b3bda2b151db102f3b2ffe477c706fa3cd250601 Mon Sep 17 00:00:00 2001 From: Aron <263346377+aron-cf@users.noreply.github.com> Date: Thu, 15 Oct 2026 14:56:32 +0100 Subject: [PATCH 2/2] Update optional-just-bash-acorn.md --- .changeset/optional-just-bash-acorn.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/optional-just-bash-acorn.md b/.changeset/optional-just-bash-acorn.md index 4dc5c6ac..4bf91216 100644 --- a/.changeset/optional-just-bash-acorn.md +++ b/.changeset/optional-just-bash-acorn.md @@ -2,4 +2,4 @@ "@cloudflare/computer": minor --- -`just-bash` is now an optional peer dependency, so install it yourself if you use `@cloudflare/computer/backends/worker-shell`. `acorn` is no longer installed with the package, because the JavaScript backend already bundles it. +`just-bash` is now an optional peer dependency and should be installed manually when using `@cloudflare/computer/backends/worker-shell`.