-
Notifications
You must be signed in to change notification settings - Fork 85
Description
Summary
Runme currently isolates each JavaScript block in its own process, which prevents variables or state from being shared across blocks. The only available mechanism is to pass data through environment variables (always as strings), which requires manual serialization/deserialization and makes even simple workflows unnecessarily complex.
💡 Problem
Runme is designed to break workflows into small, readable blocks — which is great.
However, this design becomes restrictive when we need to exchange structured data (arrays, objects) between JS blocks.
Example:
// Block 1
const stores = [1, 2, 3];
There is no way to access stores from a second JS block without:
- Writing the value to stdout
- Naming the block in ALL CAPS so it becomes an env var
- Reading it back with process.env.XYZ
- Calling JSON.parse manually
const stores = JSON.parse(process.env.STORES);
This is confusing, error-prone, and breaks the nice development ergonomics that Runme otherwise provides.
❗ Why This Is a Problem
- Environment variables only support strings, so structured data is always lost unless manually serialized.
- The name: "VAR" mechanism feels like a hack rather than a proper API.
- It forces users to write extra boilerplate for something that should feel natural in a notebook-style environment.
- For JS workflows, this is a significant productivity penalty.
Runme helps simplify workflows — but passing data between blocks becomes more difficult, not easier.
🎯 Requested Feature: Shared State or Global Context
I would like Runme to support one of the following:
Option A — A shared JS runtime
Similar to how Jupyter notebooks keep a persistent kernel.
JS blocks would share variable scope or at least a global context.
Option B — Built-in serialization for env variables
If a block output is valid JSON, Runme should automatically expose the parsed value to JS blocks, not only the raw string.
Example:
```json {"name": "STORES"}
[1, 2, 3]
Then in a JS block:
```js
console.log(STORES); // → [1, 2, 3], already parsed
Option C — A Runme API
Something like:
runme.set("stores", [1, 2, 3]);
const stores = runme.get("stores");
This would avoid abusing env variables and would feel natural for notebook-style development.
🙏 Why This Matters
Runme is a great tool for orchestrating step-by-step workflows, but lack of shared state between JS blocks makes certain workflows unnecessarily painful:
- data pipelines
- DevOps automation scripts
- API testing
- multi-step generation of objects
- combining shell and JS in the same document
Having a clean, native way to share structured data would drastically improve developer experience.
✔️ Expected Benefits
- Cleaner notebooks
- Less boilerplate
- More intuitive mental model
- Better parity with notebooks like Jupyter
- More adoptable for JS/TS-heavy teams