Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/workflow-vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"dependencies": {
"just-bash": "file:../..",
"nitro": "3.0.1-alpha.2",
"workflow": "https://workflow-docs-14qh5q5oq.vercel.sh/workflow.tgz"
"workflow": "https://workflow-docs-g13ix0s4m.vercel.sh/workflow.tgz"
},
"devDependencies": {
"typescript": "^5.9.3",
Expand Down
1,861 changes: 1,410 additions & 451 deletions examples/workflow-vite/pnpm-lock.yaml

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions examples/workflow-vite/pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
overrides:
workflow: link:../../../../vercel/workflow/packages/workflow
Comment on lines +1 to +2
Copy link

Copilot AI Jan 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pnpm-workspace.yaml file contains an override that links to a local path ../../../../vercel/workflow/packages/workflow, which is specific to a local development environment. This will break for other developers and in CI/CD. The override should either be removed or documented as a local development-only configuration that should not be committed.

Suggested change
overrides:
workflow: link:../../../../vercel/workflow/packages/workflow
# Local development-only override.
# Do not commit this as an active override, since the path is specific to a
# local monorepo layout and will break for other developers and in CI/CD.
# Uncomment and adjust the path as needed for local testing:
# overrides:
# workflow: link:../../../../vercel/workflow/packages/workflow

Copilot uses AI. Check for mistakes.
7 changes: 7 additions & 0 deletions examples/workflow-vite/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,12 @@ export default defineConfig({
plugins: [nitro(), workflow()],
nitro: {
serverDir: "./",
// Externalize native modules that can't be bundled
rollupConfig: {
external: [
"@mongodb-js/zstd",
"node-liblzma",
],
},
},
});
7 changes: 7 additions & 0 deletions examples/workflow-vite/workflows/bash-workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
*
* Demonstrates using just-bash with Workflow DevKit's serialization.
* The Bash instance is serialized between steps, preserving filesystem state.
*
* When this file is processed during workflow discovery, the bundler uses
* the "workflow" export condition which provides an opaque Bash handle.
* When step functions run, they use the real Bash implementation.
*/

import { Bash } from "just-bash";
Expand All @@ -12,6 +16,7 @@ export async function serialBashWorkflow() {

// Step 1: Create bash instance and initialize
let bash = await createBash();
console.log(bash);
Copy link

Copilot AI Jan 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debug console.log statements have been left in the workflow example code. These should be removed before merging as they add unnecessary noise to production workflows.

Copilot uses AI. Check for mistakes.

// Steps 2-4: Serial steps that modify filesystem
bash = await appendToLog(bash, "step2");
Expand All @@ -24,6 +29,8 @@ export async function serialBashWorkflow() {

async function createBash() {
"use step";
console.log(Bash);
console.log((Bash as any).classId);
Copy link

Copilot AI Jan 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debug console.log statements accessing internal classId property should be removed before merging. These appear to be development debugging code.

Suggested change
console.log((Bash as any).classId);

Copilot uses AI. Check for mistakes.
const bash = new Bash();
await bash.exec("mkdir -p /data");
await bash.exec('echo "created" > /data/log.txt');
Expand Down
7 changes: 6 additions & 1 deletion knip.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
{
"$schema": "https://unpkg.com/knip@5/schema.json",
"entry": ["src/cli/just-bash.ts"],
"entry": [
"src/cli/just-bash.ts",
"src/index.ts",
"src/workflow.ts",
"src/browser.ts"
],
"project": ["src/**/*.ts"],
"ignore": ["src/**/*.test.ts", "src/spec-tests/**"],
"ignoreBinaries": ["tsx", "dev"],
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"exports": {
".": {
"types": "./dist/index.d.ts",
"workflow": "./dist/bundle/workflow.js",
"browser": "./dist/bundle/browser.js",
"import": "./dist/bundle/index.js"
},
Expand Down Expand Up @@ -50,7 +51,7 @@
"build": "rm -rf dist && tsc && pnpm build:lib && pnpm build:browser && pnpm build:cli && pnpm build:shell && pnpm build:worker && pnpm build:clean && sed '1,/^-->/d' AGENTS.npm.md > dist/AGENTS.md",
"build:clean": "find dist -name '*.test.js' -delete && find dist -name '*.test.d.ts' -delete",
"build:worker": "esbuild src/commands/python3/worker.ts --bundle --platform=node --format=esm --outfile=src/commands/python3/worker.js --external:pyodide && 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",
"build:lib": "esbuild dist/index.js --bundle --splitting --platform=node --format=esm --minify-syntax --minify-whitespace --keep-names --outdir=dist/bundle --chunk-names=chunks/[name]-[hash] --external:diff --external:minimatch --external:sprintf-js --external:turndown --external:sql.js --external:pyodide --external:@mongodb-js/zstd --external:node-liblzma --external:compressjs && echo 'var _Bash=Bash,_InMemoryFs=InMemoryFs;' >> dist/bundle/index.js",
"build:lib": "esbuild dist/index.js dist/workflow.js --bundle --splitting --platform=node --format=esm --keep-names --outdir=dist/bundle --chunk-names=chunks/[name]-[hash] --external:diff --external:minimatch --external:sprintf-js --external:turndown --external:sql.js --external:pyodide --external:@mongodb-js/zstd --external:node-liblzma --external:compressjs",
Copy link

Copilot AI Jan 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The build script has been modified to remove the minification flags --minify-syntax and --minify-whitespace, and also removes a line that was appended to the output. These changes mean the bundled code will be larger and potentially expose internal implementation details. If this is intentional for debugging workflow issues, it should be documented. Otherwise, minification should be restored for production builds.

Suggested change
"build:lib": "esbuild dist/index.js dist/workflow.js --bundle --splitting --platform=node --format=esm --keep-names --outdir=dist/bundle --chunk-names=chunks/[name]-[hash] --external:diff --external:minimatch --external:sprintf-js --external:turndown --external:sql.js --external:pyodide --external:@mongodb-js/zstd --external:node-liblzma --external:compressjs",
"build:lib": "esbuild dist/index.js dist/workflow.js --bundle --splitting --platform=node --format=esm --minify-syntax --minify-whitespace --keep-names --outdir=dist/bundle --chunk-names=chunks/[name]-[hash] --external:diff --external:minimatch --external:sprintf-js --external:turndown --external:sql.js --external:pyodide --external:@mongodb-js/zstd --external:node-liblzma --external:compressjs",

Copilot uses AI. Check for mistakes.
"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:* --external:@mongodb-js/zstd --external:node-liblzma --external:compressjs --define:__BROWSER__=true",
"build:cli": "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:pyodide --external:@mongodb-js/zstd --external:node-liblzma --external:compressjs",
"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:pyodide --external:@mongodb-js/zstd --external:node-liblzma --external:compressjs",
Expand Down Expand Up @@ -109,5 +110,5 @@
"optionalDependencies": {
"node-liblzma": "^2.0.3"
},
"packageManager": "pnpm@8.15.9+sha512.499434c9d8fdd1a2794ebf4552b3b25c0a633abcee5bb15e7b5de90f32f47b513aca98cd5cfd001c31f0db454bc3804edccd578501e4ca293a6816166bbd9f81"
"packageManager": "pnpm@10.28.2"
}
Loading
Loading