typebulb 0.58.2 → 0.59.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -21,7 +21,7 @@ This document is dedicated to the typebulb CLI. At its core, it compiles and ser
21
21
  - **Env files** — `.env` / `.env.local` load from cwd, `.env.local` overriding `.env` (an exported shell var wins over both). `--mode <name>` adds `.env.<name>` to switch environments (local/staging/prod); a startup line reports which keys loaded from where.
22
22
  - **Server mode** — `--server` runs only the `**server.ts**` section in Node, skipping the web server. Bulbs with only `**server.ts**` (no `**code.tsx**`) use this mode automatically.
23
23
  - **Type-check without running** — `typebulb check <file>` runs `tsc --noEmit` against the bulb: non-zero exit with diagnostics on errors, a one-line all-clear on stderr on success.
24
- - **Filesystem access** — `tb.fs.read()` (UTF-8 text), `tb.fs.readBytes()` (raw `Uint8Array`), and `tb.fs.write()` (text or bytes); relative paths land in the bulb's own folder (`--batch <name>` scopes a run to `batches/<name>` inside it), and `../` reaches a sibling bulb's; anything outside the project throws. Requires `--trust`.
24
+ - **Filesystem access** — `tb.fs.read()` (UTF-8 text), `tb.fs.readBytes()` (raw `Uint8Array`), `tb.fs.write()` (text or bytes), `tb.fs.list()` (a folder's immediate children as `{ name, dir, mtime }`), and `tb.fs.remove()` (a file, or a folder and its contents); relative paths land in the bulb's own folder, and nothing reaches outside it (`../` throws). Requires `--trust`.
25
25
  - **Hot reload** — Recompiles on save and refreshes the browser (on by default; disable with `--no-watch`)
26
26
  - **Package resolution** — Client dependencies are automatically resolved by generating import maps (same resolver as typebulb.com). Server dependencies are automatically installed via npm.
27
27
  - **Replace dependency** — `--replace <name>=<path>` replaces a declared dependency with a local *built* package folder (browser-ready ESM, no external bare imports) instead of a CDN, for testing an unpublished build. Supplies both runtime bytes and types; applies to `run` and `check`. Under `--watch` the folder is watched and the browser reloads on rebuild (`--no-watch` freezes it). Dev-only; nothing is written to the bulb.
@@ -69,7 +69,6 @@ typebulb untrust <file> Forget a bulb's trust (back to Restricted)
69
69
  typebulb --no-watch <file> Disable hot reload
70
70
  typebulb --no-open <file> Open nothing at launch, not even inside VS Code
71
71
  typebulb --mode <name> <file> Also load .env.<name> on top of .env / .env.local
72
- typebulb --batch <name> <file> Scope tb.dir + relative tb.fs paths to <bulb-folder>/batches/<name> (batch runs)
73
72
  typebulb --trust <file> Grant filesystem + AI + server.ts for this run (default: Restricted)
74
73
  typebulb --no-trust <file> Force Restricted even if the bulb is remembered-trusted
75
74
  typebulb --server <file> Run server.ts only, no web server (needs --trust)
@@ -203,7 +202,7 @@ everywhere.
203
202
  | `tb.aiAccess()` | What backs `tb.ai` — `'own' \| 'courtesy' \| 'none'` | |
204
203
  | `tb.log(...)` | Print to the CLI's stdout (read back with `typebulb logs`); falls back to the browser console when no CLI serves the page | |
205
204
  | `tb.onMessage(cb)` | Receive a value pushed in from the terminal by `typebulb send`; a non-`undefined` return becomes the reply `send --wait` prints — inert when inline (no sender) | |
206
- | `tb.fs.read/readBytes/write` | Read and write local files | yes |
205
+ | `tb.fs.read/readBytes/write/list/remove` | Read, write, list, and remove local files | yes |
207
206
  | `tb.dir` | The bulb's folder (absolute path), where relative `tb.fs` paths land | |
208
207
  | `tb.server.<name>(...)` | Call a function exported from the `server.ts` block | yes |
209
208
  | `tb.ai({ messages, … })` | General-purpose AI call (chat, agents) | yes |
@@ -320,8 +319,7 @@ The host owns light/dark; you style for both.
320
319
  ## Tips for Agents
321
320
 
322
321
  - **A bulb's working files land beside it automatically** — relative `tb.fs` paths resolve to the bulb's folder, in `code.tsx` and `server.ts` alike: `tb.fs.write('run.json')`, no path prefix, no mkdir.
323
- - **Images & media: an `assets/` subfolder of the bulb's folder** (`birds.bulb.md` → `birds/assets/robin.png`) — `<img src="assets/robin.png">` just works (always that relative form, never `/assets/…`), every tier except inline.
324
- - **Batch runs: scope with `--batch`, don't hand-roll plumbing** — `--batch pilot` on a run or `call` lands `tb.dir` and relative `tb.fs` paths in `<bulb-folder>/batches/pilot/`; the bulb's code stays batch-unaware, an unscoped run sees `batches/` as an ordinary subfolder, and the agent mirror lists a bulb's batches on its launcher row (play opens the newest).
322
+ - **Images & media: an `assets/` subfolder of the bulb's folder** (`birds.bulb.md` → `birds/assets/robin.png`) — `<img src="assets/robin.png">` just works (always that relative form, never `/assets/…`), every tier except inline. It holds what the bulb ships in order to run (e.g. images), never results.
325
323
  - **See what's already running** — `typebulb logs` with no argument lists every running bulb and mirror; check it before launching anything.
326
324
  - **Self-testing a local bulb** — To confirm a bulb works, run it, instrument with `tb.log(...)`, and read it back with `typebulb logs`. That's the loop to verify behaviour without asking the user to copy-paste console output. `tb.fs.write(...)` is handy for dumping large outputs.
327
325
  - **Self-testing client code** — gate checks behind `tb.onMessage(m => { if (m === 'selftest') return run() })`, trigger with `typebulb send <file> selftest --wait`, and assert on the JSON reply — see [Interrogating the live page](#interrogating-the-live-page).
package/SKILL.md CHANGED
@@ -1,10 +1,10 @@
1
1
  ---
2
2
  name: typebulb
3
3
  description: "Author and run Typebulb bulbs — single-file markdown apps (TypeScript/TSX) that run locally via `npx typebulb` (full power: filesystem, database, `server.ts`, `tb.ai`) or render live inline in your coding agent's session through Typebulb's agent mirror (sandboxed, client-only). A bulb can be a visual widget (chart, simulation, diagram, calculator, UI), a full-stack tool with a Node backend, or an AI app that calls models at runtime. Covers the bulb format, the `tb.*` API, trust, and the local run/inline workflow. Use when the user wants a bulb, a quick local tool (visual, backend-backed, or AI-powered), or something visual rendered inline in the conversation."
4
- version: 0.58.2
4
+ version: 0.59.1
5
5
  ---
6
6
 
7
- > Generated from typebulb v0.58.2. `npx typebulb agent` prints the running version alongside the path to its packaged SKILL.md: if that version is newer than this one, replace this file with that one.
7
+ > Generated from typebulb v0.59.1. `npx typebulb agent` prints the running version alongside the path to its packaged SKILL.md: if that version is newer than this one, replace this file with that one.
8
8
 
9
9
  # typebulb
10
10
 
@@ -29,7 +29,7 @@ This document is dedicated to the typebulb CLI. At its core, it compiles and ser
29
29
  - **Env files** — `.env` / `.env.local` load from cwd, `.env.local` overriding `.env` (an exported shell var wins over both). `--mode <name>` adds `.env.<name>` to switch environments (local/staging/prod); a startup line reports which keys loaded from where.
30
30
  - **Server mode** — `--server` runs only the `**server.ts**` section in Node, skipping the web server. Bulbs with only `**server.ts**` (no `**code.tsx**`) use this mode automatically.
31
31
  - **Type-check without running** — `typebulb check <file>` runs `tsc --noEmit` against the bulb: non-zero exit with diagnostics on errors, a one-line all-clear on stderr on success.
32
- - **Filesystem access** — `tb.fs.read()` (UTF-8 text), `tb.fs.readBytes()` (raw `Uint8Array`), and `tb.fs.write()` (text or bytes); relative paths land in the bulb's own folder (`--batch <name>` scopes a run to `batches/<name>` inside it), and `../` reaches a sibling bulb's; anything outside the project throws. Requires `--trust`.
32
+ - **Filesystem access** — `tb.fs.read()` (UTF-8 text), `tb.fs.readBytes()` (raw `Uint8Array`), `tb.fs.write()` (text or bytes), `tb.fs.list()` (a folder's immediate children as `{ name, dir, mtime }`), and `tb.fs.remove()` (a file, or a folder and its contents); relative paths land in the bulb's own folder, and nothing reaches outside it (`../` throws). Requires `--trust`.
33
33
  - **Hot reload** — Recompiles on save and refreshes the browser (on by default; disable with `--no-watch`)
34
34
  - **Package resolution** — Client dependencies are automatically resolved by generating import maps (same resolver as typebulb.com). Server dependencies are automatically installed via npm.
35
35
  - **Replace dependency** — `--replace <name>=<path>` replaces a declared dependency with a local *built* package folder (browser-ready ESM, no external bare imports) instead of a CDN, for testing an unpublished build. Supplies both runtime bytes and types; applies to `run` and `check`. Under `--watch` the folder is watched and the browser reloads on rebuild (`--no-watch` freezes it). Dev-only; nothing is written to the bulb.
@@ -77,7 +77,6 @@ typebulb untrust <file> Forget a bulb's trust (back to Restricted)
77
77
  typebulb --no-watch <file> Disable hot reload
78
78
  typebulb --no-open <file> Open nothing at launch, not even inside VS Code
79
79
  typebulb --mode <name> <file> Also load .env.<name> on top of .env / .env.local
80
- typebulb --batch <name> <file> Scope tb.dir + relative tb.fs paths to <bulb-folder>/batches/<name> (batch runs)
81
80
  typebulb --trust <file> Grant filesystem + AI + server.ts for this run (default: Restricted)
82
81
  typebulb --no-trust <file> Force Restricted even if the bulb is remembered-trusted
83
82
  typebulb --server <file> Run server.ts only, no web server (needs --trust)
@@ -211,7 +210,7 @@ everywhere.
211
210
  | `tb.aiAccess()` | What backs `tb.ai` — `'own' \| 'courtesy' \| 'none'` | |
212
211
  | `tb.log(...)` | Print to the CLI's stdout (read back with `typebulb logs`); falls back to the browser console when no CLI serves the page | |
213
212
  | `tb.onMessage(cb)` | Receive a value pushed in from the terminal by `typebulb send`; a non-`undefined` return becomes the reply `send --wait` prints — inert when inline (no sender) | |
214
- | `tb.fs.read/readBytes/write` | Read and write local files | yes |
213
+ | `tb.fs.read/readBytes/write/list/remove` | Read, write, list, and remove local files | yes |
215
214
  | `tb.dir` | The bulb's folder (absolute path), where relative `tb.fs` paths land | |
216
215
  | `tb.server.<name>(...)` | Call a function exported from the `server.ts` block | yes |
217
216
  | `tb.ai({ messages, … })` | General-purpose AI call (chat, agents) | yes |
@@ -328,8 +327,7 @@ The host owns light/dark; you style for both.
328
327
  ## Tips for Agents
329
328
 
330
329
  - **A bulb's working files land beside it automatically** — relative `tb.fs` paths resolve to the bulb's folder, in `code.tsx` and `server.ts` alike: `tb.fs.write('run.json')`, no path prefix, no mkdir.
331
- - **Images & media: an `assets/` subfolder of the bulb's folder** (`birds.bulb.md` → `birds/assets/robin.png`) — `<img src="assets/robin.png">` just works (always that relative form, never `/assets/…`), every tier except inline.
332
- - **Batch runs: scope with `--batch`, don't hand-roll plumbing** — `--batch pilot` on a run or `call` lands `tb.dir` and relative `tb.fs` paths in `<bulb-folder>/batches/pilot/`; the bulb's code stays batch-unaware, an unscoped run sees `batches/` as an ordinary subfolder, and the agent mirror lists a bulb's batches on its launcher row (play opens the newest).
330
+ - **Images & media: an `assets/` subfolder of the bulb's folder** (`birds.bulb.md` → `birds/assets/robin.png`) — `<img src="assets/robin.png">` just works (always that relative form, never `/assets/…`), every tier except inline. It holds what the bulb ships in order to run (e.g. images), never results.
333
331
  - **See what's already running** — `typebulb logs` with no argument lists every running bulb and mirror; check it before launching anything.
334
332
  - **Self-testing a local bulb** — To confirm a bulb works, run it, instrument with `tb.log(...)`, and read it back with `typebulb logs`. That's the loop to verify behaviour without asking the user to copy-paste console output. `tb.fs.write(...)` is handy for dumping large outputs.
335
333
  - **Self-testing client code** — gate checks behind `tb.onMessage(m => { if (m === 'selftest') return run() })`, trigger with `typebulb send <file> selftest --wait`, and assert on the JSON reply — see [Interrogating the live page](#interrogating-the-live-page).