@innovatorved/code-lab 0.3.1 → 0.4.0

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.
Files changed (171) hide show
  1. package/ARCHITECTURE.md +8 -4
  2. package/CHANGELOG.md +45 -0
  3. package/README.md +70 -158
  4. package/dist/apps/web/src/index.d.ts +34 -0
  5. package/dist/code-lab-sql.css +482 -0
  6. package/dist/code-lab-sql.d.ts +179 -0
  7. package/dist/code-lab-sql.esm.js +542 -0
  8. package/dist/code-lab-sql.umd.js +531 -0
  9. package/dist/code-lab.css +298 -2
  10. package/dist/code-lab.d.ts +110 -15
  11. package/dist/code-lab.esm.js +35284 -18253
  12. package/dist/code-lab.js +40434 -23431
  13. package/dist/code-lab.umd.js +65502 -0
  14. package/dist/diagnostics.d.ts +5 -0
  15. package/dist/extensions/cpp.esm.js +19532 -3772
  16. package/dist/extensions/cpp.js +19529 -3769
  17. package/dist/extensions/guided-lab.esm.js +19401 -3725
  18. package/dist/extensions/guided-lab.js +19400 -3724
  19. package/dist/extensions/python.d.ts +1 -0
  20. package/dist/extensions/python.esm.js +19666 -3843
  21. package/dist/extensions/python.js +19668 -3845
  22. package/dist/extensions/umbrella.d.ts +5 -0
  23. package/dist/index.d.ts +1 -1
  24. package/dist/modular-kernel.d.ts +11 -0
  25. package/dist/packages/commands/src/index.d.ts +96 -0
  26. package/dist/packages/core/src/di.d.ts +36 -0
  27. package/dist/packages/core/src/disposable.d.ts +27 -0
  28. package/dist/packages/core/src/errors.d.ts +69 -0
  29. package/dist/packages/core/src/events.d.ts +38 -0
  30. package/dist/packages/core/src/index.d.ts +6 -0
  31. package/dist/packages/core/src/path.d.ts +14 -0
  32. package/dist/packages/core/src/registry.d.ts +23 -0
  33. package/dist/packages/editor/src/index.d.ts +118 -0
  34. package/dist/packages/fs/src/backends.d.ts +37 -0
  35. package/dist/packages/fs/src/index.d.ts +3 -0
  36. package/dist/packages/fs/src/types.d.ts +40 -0
  37. package/dist/packages/fs/src/vfs-service.d.ts +33 -0
  38. package/dist/packages/preview/src/index.d.ts +34 -0
  39. package/dist/packages/runtime/src/index.d.ts +47 -0
  40. package/dist/packages/settings/src/builtin-schemas.d.ts +15 -0
  41. package/dist/packages/settings/src/configuration-service.d.ts +100 -0
  42. package/dist/packages/settings/src/index.d.ts +4 -0
  43. package/dist/packages/settings/src/jsonc.d.ts +20 -0
  44. package/dist/packages/settings/src/schema.d.ts +28 -0
  45. package/dist/packages/sql/src/completions.d.ts +8 -0
  46. package/dist/packages/sql/src/diagnostics.d.ts +2 -0
  47. package/dist/packages/sql/src/formatter.d.ts +2 -0
  48. package/dist/packages/sql/src/index.d.ts +7 -0
  49. package/dist/packages/sql/src/sql-editor.d.ts +2 -0
  50. package/dist/packages/sql/src/styles.d.ts +2 -0
  51. package/dist/packages/sql/src/tokenizer.d.ts +13 -0
  52. package/dist/packages/sql/src/types.d.ts +130 -0
  53. package/dist/packages/terminal/src/index.d.ts +54 -0
  54. package/dist/packages/ui/src/index.d.ts +4 -0
  55. package/dist/packages/ui/src/observability.d.ts +22 -0
  56. package/dist/packages/ui/src/plugin-registry.d.ts +89 -0
  57. package/dist/packages/ui/src/settings-dialog.d.ts +25 -0
  58. package/dist/packages/ui/src/themes.d.ts +35 -0
  59. package/dist/preview-sw.js +82 -24
  60. package/dist/runtime.d.ts +3 -3
  61. package/dist/runtime.esm.js +503 -73
  62. package/dist/runtime.js +501 -73
  63. package/dist/schemas.d.ts +234 -814
  64. package/dist/schemas.esm.js +19401 -3725
  65. package/dist/schemas.js +19404 -3728
  66. package/dist/scm.d.ts +13 -2
  67. package/dist/search.d.ts +5 -1
  68. package/dist/shell.d.ts +1 -1
  69. package/dist/shell.esm.js +435 -54
  70. package/dist/shell.js +435 -54
  71. package/dist/terminal.esm.js +242 -54
  72. package/dist/terminal.js +242 -54
  73. package/dist/workbench/diff-editor.d.ts +1 -0
  74. package/dist/workbench/index.d.ts +1 -1
  75. package/dist/workbench/styles.d.ts +1 -1
  76. package/dist/zip.d.ts +4 -3
  77. package/package.json +37 -8
  78. package/packages/commands/README.md +7 -0
  79. package/packages/commands/package.json +16 -0
  80. package/packages/commands/src/index.ts +467 -0
  81. package/packages/commands/tsconfig.json +22 -0
  82. package/packages/core/README.md +12 -0
  83. package/packages/core/package.json +13 -0
  84. package/packages/core/src/di.ts +147 -0
  85. package/packages/core/src/disposable.ts +112 -0
  86. package/packages/core/src/errors.ts +205 -0
  87. package/packages/core/src/events.ts +157 -0
  88. package/packages/core/src/index.ts +49 -0
  89. package/packages/core/src/path.ts +118 -0
  90. package/packages/core/src/registry.ts +61 -0
  91. package/packages/core/tsconfig.json +19 -0
  92. package/packages/editor/README.md +9 -0
  93. package/packages/editor/package.json +18 -0
  94. package/packages/editor/src/index.ts +344 -0
  95. package/packages/editor/tsconfig.json +24 -0
  96. package/packages/fs/README.md +7 -0
  97. package/packages/fs/package.json +16 -0
  98. package/packages/fs/src/backends.ts +301 -0
  99. package/packages/fs/src/index.ts +18 -0
  100. package/packages/fs/src/types.ts +44 -0
  101. package/packages/fs/src/vfs-service.ts +257 -0
  102. package/packages/fs/tsconfig.json +22 -0
  103. package/packages/preview/README.md +3 -0
  104. package/packages/preview/package.json +16 -0
  105. package/packages/preview/src/index.ts +125 -0
  106. package/packages/preview/tsconfig.json +22 -0
  107. package/packages/runtime/README.md +3 -0
  108. package/packages/runtime/package.json +17 -0
  109. package/packages/runtime/src/index.ts +134 -0
  110. package/packages/runtime/tsconfig.json +23 -0
  111. package/packages/settings/README.md +7 -0
  112. package/packages/settings/package.json +16 -0
  113. package/packages/settings/src/builtin-schemas.ts +235 -0
  114. package/packages/settings/src/configuration-service.ts +543 -0
  115. package/packages/settings/src/index.ts +37 -0
  116. package/packages/settings/src/jsonc.ts +189 -0
  117. package/packages/settings/src/schema.ts +164 -0
  118. package/packages/settings/tsconfig.json +22 -0
  119. package/packages/sql/README.md +12 -0
  120. package/packages/sql/package.json +13 -0
  121. package/packages/sql/src/completions.ts +359 -0
  122. package/packages/sql/src/diagnostics.ts +200 -0
  123. package/packages/sql/src/formatter.ts +271 -0
  124. package/packages/sql/src/index.ts +54 -0
  125. package/packages/sql/src/sql-editor.ts +802 -0
  126. package/packages/sql/src/styles.ts +501 -0
  127. package/packages/sql/src/tokenizer.ts +457 -0
  128. package/packages/sql/src/types.ts +148 -0
  129. package/packages/sql/tsconfig.json +19 -0
  130. package/packages/terminal/README.md +3 -0
  131. package/packages/terminal/package.json +16 -0
  132. package/packages/terminal/src/index.ts +183 -0
  133. package/packages/terminal/tsconfig.json +22 -0
  134. package/packages/ui/README.md +8 -0
  135. package/packages/ui/package.json +18 -0
  136. package/packages/ui/src/index.ts +36 -0
  137. package/packages/ui/src/observability.ts +175 -0
  138. package/packages/ui/src/plugin-registry.ts +274 -0
  139. package/packages/ui/src/settings-dialog.ts +293 -0
  140. package/packages/ui/src/themes.ts +174 -0
  141. package/packages/ui/tsconfig.json +24 -0
  142. package/src/code-lab.css +298 -2
  143. package/src/csp.ts +7 -10
  144. package/src/diagnostics.ts +42 -3
  145. package/src/extensions/cpp.ts +105 -24
  146. package/src/extensions/python.ts +260 -116
  147. package/src/extensions/umbrella.ts +5 -0
  148. package/src/index.ts +1 -1
  149. package/src/modular-kernel.ts +11 -0
  150. package/src/preview-sw.js +73 -12
  151. package/src/runtime.ts +501 -74
  152. package/src/schemas.ts +62 -62
  153. package/src/scm.ts +106 -19
  154. package/src/search.ts +71 -27
  155. package/src/shell.ts +433 -53
  156. package/src/terminal.ts +239 -52
  157. package/src/workbench/diff-editor.ts +106 -18
  158. package/src/workbench/drawer.ts +17 -4
  159. package/src/workbench/guided-pane.ts +12 -2
  160. package/src/workbench/icons.ts +5 -2
  161. package/src/workbench/share.ts +37 -8
  162. package/src/workbench/styles.ts +2 -1
  163. package/src/workbench/toolbar.ts +15 -4
  164. package/src/workbench.ts +2877 -284
  165. package/src/zip.ts +29 -7
  166. package/dist/runtime/index.d.ts +0 -4
  167. package/dist/shell/coreutils/compilers-cli.d.ts +0 -24
  168. package/dist/shell/index.d.ts +0 -4
  169. package/src/runtime/index.ts +0 -5
  170. package/src/shell/coreutils/compilers-cli.ts +0 -103
  171. package/src/shell/index.ts +0 -5
package/ARCHITECTURE.md CHANGED
@@ -1,6 +1,8 @@
1
- # `@innovatorved/code-lab` Architecture (v0.3.1)
1
+ # `@innovatorved/code-lab` Architecture (v0.4.0)
2
2
 
3
- `@innovatorved/code-lab` is an embeddable, browser-native Node.js v22 + Bun v1.1 + WASI C++20 + Python 3.12 IDE, POSIX shell, PTY terminal, and virtual execution sandbox with self-contained browser bundles (zero runtime dependencies in `dist/*`; Zod schemas available under `@innovatorved/code-lab/schemas`; modular extensions under `@innovatorved/code-lab/extensions/{guided-lab,javascript,typescript,cpp,python}`).
3
+ `@innovatorved/code-lab` is an embeddable, browser-native Node.js v22 + Bun v1.1 + WASI C++20 + Python 3.12 IDE, first-class SQL playground (`@innovatorved/code-lab/sql`), POSIX shell, PTY terminal, and virtual execution sandbox with self-contained browser bundles (zero runtime dependencies in `dist/*`; Zod schemas available under `@innovatorved/code-lab/schemas`; modular extensions under `@innovatorved/code-lab/extensions/{guided-lab,javascript,typescript,cpp,python}`).
4
+
5
+ > **Deep-Dive Monorepo Guide**: See [`docs/ARCHITECTURE.md`](./docs/ARCHITECTURE.md) for the 4-layer workspace DAG (`@code-lab/core` → `@code-lab/{fs,settings,commands}` → `@code-lab/{sql,editor,runtime,terminal,preview}` → `@code-lab/ui` → `apps/web`), DI container, `.codelab/*` configuration cascade, and [`docs/PLUGINS.md`](./docs/PLUGINS.md) for the declarative plugin system.
4
6
 
5
7
  It is designed around two strictly decoupled layers that can be used together (`dist/code-lab.js`) or independently (`dist/runtime.js`, `dist/shell.js`, `dist/terminal.js` for headless or modular execution):
6
8
 
@@ -81,8 +83,10 @@ It is designed around two strictly decoupled layers that can be used together (`
81
83
  ## 3. PTY Terminal Engine (`src/terminal.ts`)
82
84
 
83
85
  `PTYTerminalEngine` provides an interactive terminal UI and ANSI/VT100 escape sequence parser:
86
+ - **Foreground Command Execution Lock**: Tracks `isBusy` / `isCommandRunning()` across synchronous and asynchronous `onCommand` promises plus external `isRunning()` callbacks. While a foreground command is running, the active prompt line (`#cl-pty-active-line`) is hidden (`data-busy="true"`), the submitted command is echoed immediately before output streams, and new keystrokes/submissions are blocked until completion (while `Ctrl+C` remains active to dispatch `SIGINT`).
87
+ - **Background Job Isolation (`&`)**: Background jobs spawned via `cmd &` in `PosixShell` receive an independent per-job `AbortController` linked to the job table (`jobs`, `fg`, `bg`, `kill %1`), ensuring foreground `Ctrl+C` interrupts only the foreground pipeline without killing background servers or jobs.
84
88
  - Supports SGR 16-color, 256-color (`38;5;n`), and 24-bit TrueColor (`38;2;r;g;b`) foreground/background attributes, bold, dim, italic, underline, and partial SGR resets (`22`, `23`, `24`, `39`, `49`).
85
- - Supports readline shortcuts (`Ctrl+A`, `Ctrl+E`, `Ctrl+U`, `Ctrl+K`, `Ctrl+L`, `Ctrl+C`, `Ctrl+D`, `Ctrl+R` reverse-i-search), command history (`ArrowUp`/`ArrowDown`), interactive `readLine()` stdin prompts, and context-aware `Tab` autocompletion for commands and VFS file paths.
89
+ - Supports readline shortcuts (`Ctrl+A`, `Ctrl+E`, `Ctrl+U`, `Ctrl+K`, `Ctrl+L`, `Ctrl+C`, `Ctrl+D`, `Ctrl+R` reverse-i-search), cursor movement (`ArrowLeft`, `ArrowRight`, `Home`, `End`), command history (`ArrowUp`/`ArrowDown`), interactive `readLine()` stdin prompts, and context-aware `Tab` autocompletion for commands and VFS file paths.
86
90
 
87
91
  ---
88
92
 
@@ -133,6 +137,6 @@ Running `bun run build` (`bun run tools/bundle.js`) produces:
133
137
  | **Visual Source Control (SCM)** | Staging, unstaging, diffing, and commit history | `src/scm.ts` (`createGitState`, `computeGitStatus`, `stageFile`, `unstageFile`, `commitChanges`, `computeShortCommitHash`) — Pure TypeScript SCM state machine synced with the POSIX shell `git` command |
134
138
  | **Live Preview & Error Overlay** | Hot/debounced reload, console bridge, runtime error overlay | `src/csp.ts` (`buildPreviewShims`) + `src/workbench.ts` — 300ms debounced VFS-synced auto-reload, `codelab:preview-console` forwarding to terminal logs, and `codelab:preview-error` in-frame overlay |
135
139
 
136
- All 43 test suites (`bun run test:all` and `node tests/run-all.js`) and the Playwright Chromium E2E suite (`bun run test:browser`) verify these modules and end-to-end workbench flows against the built `dist/*` artifacts.
140
+ All 45 test suites (`bun run test:all` and `node tests/run-all.js`) and the Playwright Chromium E2E suite (`bun run test:browser`) verify these modules and end-to-end workbench flows against the built `dist/*` artifacts.
137
141
 
138
142
 
package/CHANGELOG.md CHANGED
@@ -4,6 +4,51 @@ All notable changes to `@innovatorved/code-lab` are documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [0.4.0] - 2026-11-13
8
+
9
+ ### Added
10
+ - **4-Layer Modular Workspace Monorepo (`packages/*`, `apps/web`, `tools/check-boundaries.js`)**:
11
+ - Split core capabilities into 11 strict-TypeScript Bun workspaces: `@code-lab/core` (DI `ServiceContainer` with cycle detection, `DisposableStore`, `Emitter`, typed `CodeLabError`, structured `Logger`), `@code-lab/fs` (pluggable `MemoryBackend`, `IndexedDbBackend`, `OpfsBackend`), `@code-lab/settings` (JSONC parser, JSON Schema validator, 4-scope `ConfigurationService`), `@code-lab/commands` (`ContextKeyService` `when`-expression evaluator, `CommandRegistry`, `KeybindingService` with `-command` unbinding), `@code-lab/sql`, `@code-lab/editor`, `@code-lab/runtime`, `@code-lab/terminal`, `@code-lab/preview`, `@code-lab/ui`, and `apps/web` (`createCodeLabKernel`).
12
+ - Added `tools/check-boundaries.js` (`bun run check:boundaries`) enforcing one-way layer imports, public `src/index.ts` encapsulation, zero circular dependencies (Tarjan SCC), and zero DOM globals in `@code-lab/core`.
13
+ - **First-Class SQL Playground & Inline Editor (`@innovatorved/code-lab/sql`)**:
14
+ - New lightweight standalone entrypoint (`dist/code-lab-sql.{umd.js,esm.js,css,d.ts}`) at **`~16.5 KB` gzipped** (JS + CSS combined, `< 35 KB` budget enforced by `bun run check:size`) with zero WASM boot of its own.
15
+ - Full `PostgreSQL 18` (`::type`, `$1`, `$$` dollar strings, `ILIKE`, `LATERAL`, `RETURNING`, `FILTER (WHERE ...)`, JSONB `->`/`->>`/`@>`) and `SQLite 3` (`PRAGMA`, `WITHOUT ROWID`, `ON CONFLICT DO UPDATE`, `GLOB`, backtick/`[bracket]` identifiers) tokenizer and syntax highlighter.
16
+ - Zero-dependency SQL formatter (`formatSql`), schema-aware table-alias & CTE autocomplete (`completeSql`, resolving `SELECT o.` to `orders` columns with `PK`/`FK` badges), engine error parser (`parseSqlEngineError`), WCAG 2.1 AA keyboard escape (`Esc` → `Tab`), and 3 mount modes (`inline`, `playground`, and Guided Lab `workbench` with pluggable `sqlRunner` + built-in SQLite fallback).
17
+ - **VS Code-Style Settings UI, `.codelab/*` Workspace Protocol, Themes & Plugins (`src/workbench.ts`, `@code-lab/ui`)**:
18
+ - Searchable native `<dialog closedby="any">` Settings modal (`openSettings()` / `Cmd+,`) with category navigation, Reset to Default, Profile Export/Import, URL `?settings=` sharing, and live bidirectional sync with `.codelab/{settings,keybindings,tasks,extensions}.json`.
19
+ - Built-in Dark, Light, and High-Contrast themes plus custom JSON theme registration (`ThemeService`).
20
+ - Declarative `PluginRegistry` (`CodeLab.use(manifest)`, `workbench.registerPlugin(manifest)`) supporting lazy `activationEvents` and `contributes.{commands,settings,keybindings,themes,panels,languages}`, plus a live **Observability** drawer tab and `WorkbenchErrorBoundary`.
21
+
22
+ ### Fixed
23
+ - **All 26 Phase 1 Self-Audit Findings (`6 P0`, `14 P1`, `6 P2`)**:
24
+ - Patched all root and `examples/cloud-ide` dependency CVEs (`zod@4.6.7`, `esbuild@0.28.2`, `astro@7.4.11` — `bun audit` 0 vulnerabilities).
25
+ - Hardened `preview-sw.js` CSP/nosniff/302-navigate isolation, removed `allow-same-origin` from HTTP client response previews, fixed Worker VFS binary sync & timeout stream preservation, fixed inline Explorer create/rename (`F2`), and added comprehensive unit, regression, and Playwright Chromium E2E suites (47 Node/Bun suites + 30 Playwright Chromium tests).
26
+
27
+ ## [0.3.2] - 2026-10-26
28
+
29
+ ### Added
30
+ - **Terminal Foreground Command Locking & Background Job Isolation (`src/terminal.ts`, `src/workbench.ts`, `src/shell.ts`)**:
31
+ - `PTYTerminalEngine` and `CodeLabWorkbench._handleReplCommand()` now lock the terminal while a foreground command is running (`isBusy` / `isCommandRunning()`), immediately echoing the command, hiding the active prompt line and blinking cursor (`data-busy="true"`), and blocking concurrent command submission until the active command completes or is interrupted via `Ctrl+C`.
32
+ - Background shell jobs (`cmd &`) now run with an independent per-job `AbortController` registered in the shell job table, surviving foreground `Ctrl+C` (`SIGINT`) interrupts while remaining controllable via `jobs`, `fg`, `bg`, and `kill %1`.
33
+ - **Interactive Modals & Multi-Session Terminal Switcher (`src/workbench.ts`, `src/code-lab.css`)**:
34
+ - **Workspace Search & Replace Modal**: Added live search-as-you-type, a **Replace All** button wired to `replaceInWorkspace()`, dark-theme input styling, and 1-click jump to matched `file:line:column`.
35
+ - **Interactive Git Source Control Modal**: Added **Stage**, **Unstage**, **Stage All**, and **Commit** controls (`stageGitFile`, `unstageGitFile`, `stageAllGitFiles`, `commitGitChanges`) plus click-to-open file navigation.
36
+ - **Multi-Session Terminal Bar**: Added a session switcher pill bar (`bash-1`, `+`, `×`) in the terminal drawer header and fixed terminal clearing (`Ctrl+L`, `clear`, Clear button) so session log arrays remain bound across session switches.
37
+
38
+ ### Fixed
39
+ - **UI & Workbench Polish**:
40
+ - Fixed Split-Run dropdown menu (`#cl-split-run-menu`) not opening on click due to `.open` vs `.active` CSS class mismatch.
41
+ - Fixed terminal visual cursor synchronization on `ArrowLeft`, `ArrowRight`, `Home`, `End`, and mouse click.
42
+ - Fixed uncaught `ReferenceError: testTab is not defined` in `_refreshDrawerTabs()` when dynamically inserting the `stdin` drawer tab.
43
+ - Fixed `showProblemsModal()` and `problems` drawer tab click/keyboard navigation and column attribute normalization.
44
+ - Fixed `#cl-diff-apply-btn` and `#cl-diff-revert-btn` in `src/workbench/diff-editor.ts` to properly apply reference solutions and starter files.
45
+ - **Security, Runtime & Infrastructure Hardening**:
46
+ - Enforced origin and controlled-client (`self.clients.get`) verification in `src/preview-sw.js` and decoded binary (`Uint8Array` / `ArrayBuffer`) HTML bodies before CSP injection.
47
+ - Sanitized custom CSP policies against newline/`"`/`<`/`>` injection in `src/csp.ts`.
48
+ - Added 5 MB decompression stream limit for `#codelab=` URL snapshots, 100 MB / 10,000-entry ZIP bomb caps in `src/zip.ts`, and prototype-pollution path filtering across `src/zip.ts`, `src/search.ts`, `src/scm.ts`, and `src/workbench.ts`.
49
+ - Hardened Python (`src/extensions/python.ts`) and C++ (`src/extensions/cpp.ts`) extensions with singleton Pyodide loading locks, `json.dumps` safe path injection, `sys.stdin` restoration in `finally`, bounded AST regex checks, and `IndexedDB` connection closing on transaction completion.
50
+ - Added `src/workbench/*.ts` modular controllers to `tsconfig.strict.json` (12 strict TypeScript modules).
51
+
7
52
  ## [0.3.1] - 2026-10-26
8
53
 
9
54
  ### Added
package/README.md CHANGED
@@ -1,41 +1,18 @@
1
1
  # @innovatorved/code-lab
2
2
 
3
- > **Note:** This project is in active development. APIs and sandbox internals are stable for production use.
3
+ Modular browser-native IDE workbench (`v0.4.0`), Web Worker runtime for Node.js, Bun, TypeScript, C++20 WebAssembly, and Python 3.12 WebAssembly, POSIX shell with 71 UNIX coreutils, and lightweight SQL playground built with strict TypeScript and Zod schemas — zero backend servers or cross-origin isolation headers required.
4
4
 
5
- Browser-native code IDE workbench, modular guided challenge engine (`@innovatorved/code-lab/extensions/guided-lab`), modular language extensions (`javascript`, `typescript`, real WebAssembly `cpp`, and WebAssembly `python`), POSIX shell with 71 UNIX coreutils, public GitHub repository cloner (`git clone`), and Web Worker execution runtime for **Node.js**, **Bun** (JavaScript & TypeScript), **C++20 (Clang/LLVM + WASI)**, and **Python 3.12 (CPython WASI)** with Zod type safety and zero backend server dependencies.
6
-
7
- - **Live Cloud IDE & GitHub Repo Explorer**: **[https://code-lab-3dr.pages.dev](https://code-lab-3dr.pages.dev)** — Enter any public GitHub repository (`owner/repo` or URL) to clone and run it directly in your browser.
8
- - **Built for**: [System Design In Depth](https://system-design-in-depth.vedgupta.in) & Data Structures & Algorithms (DSA) In Depth
5
+ **Live Cloud IDE:** [code-lab-3dr.pages.dev](https://code-lab-3dr.pages.dev) · **Documentation Wiki:** [github.com/innovatorved/code-lab/wiki](https://github.com/innovatorved/code-lab/wiki)
9
6
 
10
7
  ---
11
8
 
12
- ## Features
13
-
14
- - **Modular Architecture (`v0.3.1`)**: Pure, general-purpose browser IDE (`code-lab`) by default with File Explorer, Monaco Editor, PTY Terminal, and zero-dependency **JavaScript + Node.js/Bun** execution out of the box. Additional languages (`@innovatorved/code-lab/extensions/typescript`, `@innovatorved/code-lab/extensions/cpp`, and `@innovatorved/code-lab/extensions/python`) and curriculum features (`@innovatorved/code-lab/extensions/guided-lab`) are opt-in modular extensions.
15
- - **Real C++20 in WebAssembly (`@innovatorved/code-lab/extensions/cpp`)**: Compile and run real C++17/C++20/C++23 code natively in the browser via a WebAssembly Clang/LLVM + LLD (`wasm-ld`) + WASI `libc++` sysroot toolchain (~35 MB downloaded on demand only when the C++ extension is used and cached in `IndexedDB`). Features rich VS Code-style Monaco IntelliSense with auto-completions, header hovers, debounced static AST linting (`analyzeCppSource`), and live Clang compiler stderr error-squiggles (`applyClangStderrDiagnostics`). Includes `<bits/stdc++.h>`, `<codelab/dsa.hpp>` (`ListNode`, `TreeNode`, `buildLinkedList`, `buildBinaryTree`), and `<codelab/test.hpp>` (`DESCRIBE`, `TEST`, `ASSERT_EQ`) wired directly into the Test Suite drawer and Guided Lab step verification.
16
- - **Python 3.12 WebAssembly Extension (`@innovatorved/code-lab/extensions/python`)**: Run pure CPython 3.12 WebAssembly via Pyodide with lazy-loaded CDN binaries and IndexedDB caching. Features bidirectional VFS sync, pre-seeded `/usr/lib/python/` standard DSA helpers (`codelab_dsa.py` with `ListNode`, `TreeNode`, `MinHeap`, `MaxHeap`) and structured test framework (`codelab_test.py` with `describe`, `it`, `assert_equal`), Monaco completion/hover intelligence, traceback-to-squiggle mapping (`applyPythonTracebackDiagnostics`), static linting (`analyzePythonSource`), and formatting (`formatPythonSource`).
17
- - **Contextual Execution UI & Smooth Workbench**: Guided Challenge mode features a prominent primary `[✓ Verify Step (⌘↵)]` button with the `Test Suite` drawer tab visible by default. Normal/Sandbox mode provides a clean VS Code-style split button `[▶ Run Code (⌘↵) | ▾]` with dropdown options (`Run Entry`, `Run Active File`, `Run Tests`, `Configure Stdin`), with the drawer defaulting to `Terminal & REPL`. The topbar `Web Preview` globe button and bottom `Web Preview` drawer tab are contextual and stay neatly hidden unless the project contains web files or an active HTTP server.
18
- - **High-Impact IDE Power Features**:
19
- - **Problems Drawer Tab**: Dedicated `⚠ Problems (N)` tab aggregating JS/TS, C++, and Python diagnostics with live counter badge and 1-click cursor jump to line and column.
20
- - **Execution Time & Peak Memory HUD Badge**: High-resolution performance telemetry pill (`⏱ 12.4 ms · 🧠 1.8 MB`) displayed in the drawer header and status bar across Node, Bun, WASI C++, and Pyodide.
21
- - **Collapsible Stdin / Custom Input Panel**: Monospace textarea in the drawer for passing competitive-programming / DSA input directly into `std::cin`, `sys.stdin`, and `process.stdin`.
22
- - **Native Monaco Side-by-Side Diff Editor**: Compare `Starter ↔ Current` and `Current ↔ Solution` with 1-click "Revert" and "Apply Solution" actions directly in Monaco.
23
- - **Visible Command Palette Pill & Format Document**: Clickable topbar `🔍 Command Palette (⇧⌘P)` pill trigger + `Format Document` (`⇧⌥F`) across all languages.
24
- - **Zero-Backend URL Workspace Snapshot**: URL hash snapshot compression (`#codelab=<base64url>`) powered by `CompressionStream('deflate-raw')` for instant zero-server workspace sharing.
25
- - **End-to-End TypeScript & Zod Type Safety**: Written in TypeScript with strict runtime schemas and inferred types (`z.infer<typeof ...>`) for workbench options, guided labs, C++ toolchain options, runtime execution, and git cloning.
26
- - **Public GitHub Repository Cloning (`git clone`)**: Clone any public GitHub repository (`git clone https://github.com/owner/repo` or `git clone owner/repo --branch main` in the terminal, or `await lab.cloneRepo('owner/repo')` via the SDK) directly into `/workspace` with zero authentication required (automatic GitHub Trees API + jsDelivr unlimited fallback). Clone progress (`remote: Enumerating objects…`, `Receiving objects: n%…`) streams into the terminal in real time as it downloads.
27
- - **Interactive IDE Workbench**: Multi-file Monaco editor, collapsible hierarchical file tree with drag-and-drop, a workspace **folder switcher** (breadcrumb dropdown that scopes the explorer to any subfolder), decoupled editor tabs, Command Palette (`Cmd+Shift+P`), Quick Open (`Cmd+P`), breadcrumbs, and line-by-line solution diff viewer.
28
- - **Interactive PTY Terminal**: Inline prompt (`codelab:/workspace$ `), cursor navigation, history (`Up`/`Down`), `Ctrl+R` reverse-i-search, `Tab` auto-completion, `Ctrl+C` interrupt, `Ctrl+L` clear, and 256-color / TrueColor ANSI support.
29
- - **POSIX Shell & 71 Coreutils**: Full pure-JS AST interpreter supporting pipelines (`|`), redirects (`>`, `>>`, `<`, `2>&1`, `<<<`, `<<EOF`), control flow (`if`/`for`/`while`/`case`), functions, arithmetic `$((...))`, brace expansion `{1..5}`, and 71 UNIX commands (`g++`, `clang++`, `c++`, `python`, `python3`, `pytest`, `pip`, `git`, `ls`, `cat`, `grep`, `find`, `sed`, `awk`, `jq`, `tar`, `curl`, `hey`, `ab`, `wrk`, `chaos`, `sqlite3`, `redis-cli`, `nc`, `lsof`, `tsc`, etc.) plus direct `./a.out` WASI binary execution.
30
- - **Dual Runtime Engines (Node.js v22 & Bun v1.1)**:
31
- - **Node.js**: 50 built-in modules (`fs`, `fs/promises`, `http`, `https`, `net`, `stream`, `events`, `crypto`, `zlib`, `vm`, `worker_threads`, `readline`, `module`, `node:test`, `assert`, etc.) with full Node.js built-ins support.
32
- - **Bun**: Native `.ts` transpilation, `Bun.serve()`, `Bun.file()`, `Bun.write()`, `Bun.spawn()`, `Bun.password`, `Bun.hash()`, `bun:test`, and VFS-backed `bun:sqlite`.
33
- - **Persistent HTTP/TCP Servers & Dual Web Preview**: Start background servers (`node server.js &` or `bun run server.ts &`), query them with `curl http://localhost:3000` or global `fetch()`, and view live responses in the Ports table, an embedded **Web Preview** tab (URL bar, back/forward, device frames), or a popped-out browser tab backed by a virtual-loopback Service Worker (`/__preview/:port/*`). Public URLs (e.g. `https://example.com`) entered in the preview URL bar open in a real browser tab instead of the virtual frame.
34
- - **Built-in Preview Server (`serve`) & Toolbar *Run & Preview***: Render a real app in the browser with no bundler — `serve [dir] [--port]`, the toolbar globe button, or `npm run dev` all start a static server that transpiles `.ts` / `.tsx` / `.jsx` to browser-native ESM, resolves extensionless relative imports, and injects a jsDelivr `+esm` **import map** for bare specifiers (`react`, `react-dom/client`, `@angular/core`, …). Vite/`ng`/Astro/Next scripts that need native binaries transparently fall back to it.
35
- - **GitHub-Flavored Markdown Engine**: Zero-dependency GFM renderer (tables with column alignment, `[!NOTE]` / `[!TIP]` / `[!IMPORTANT]` / `[!WARNING]` / `[!CAUTION]` callout alerts, task-list checkboxes, and syntax-highlighted code blocks with one-click copy) powering the Guide tab, hints, and `.md` file previews.
36
- - **NPM, pnpm & Bun Package Management**: `npm i <pkg>` / `pnpm add <pkg>` / `bun add <pkg>` / `bun install` fetch the real package (and its transitive dependencies, honouring `exports` maps, subpaths and peer deps) from the jsDelivr CDN into virtual `/workspace/node_modules/<pkg>` and update `package.json` (`-D` / `--save-dev` writes to `devDependencies`); packages stay `require()`-able from `node`/`bun run`, with a bundled offline fallback for common demo packages. Framework JSX/TSX (`React.createElement`, custom `@jsx` pragmas) and ESM (including minified bundles) are handled by the runtime transpiler.
37
- - **Guided Step-by-Step Challenges**: TutorialKit / Codedamn-style curriculum extension with targeted instructions, hints, automated test verification per step, and reference solutions.
38
- - **Headless Runtime**: Programmatic execution engine (`@innovatorved/code-lab/runtime`) for grading, testing, or automated evaluation with zero UI.
9
+ ## Highlights
10
+
11
+ - **Layered Modular Core**: Four-layer workspace architecture with dependency injection, workspace settings and custom keybindings, a visual Settings dialog, Dark, Light, and High-Contrast themes, and lazy-loaded plugins.
12
+ - **SQL Editor & Playground (~16.5 KB gzipped)**: Standalone PostgreSQL 18 and SQLite 3 editor supporting inline lesson blocks, split-pane query studios, SQL formatting, schema-aware alias autocomplete, inline wavy diagnostics, and accessible keyboard navigation.
13
+ - **Node.js, Bun & WebAssembly Toolchains**: Built-in JavaScript and JSX runtime with 50 built-in modules (50 Node.js built-ins) and native Bun APIs, plus opt-in TypeScript, Clang/LLVM C++20 WebAssembly, and Pyodide Python 3.12 extensions.
14
+ - **POSIX Shell & 71 Coreutils**: Multi-session terminal with pipelines, stream redirection, background servers, public GitHub repository cloning, package installation, HTTP load testing, and 71 UNIX commands.
15
+ - **Guided Labs & Headless Grading**: Step-by-step coding and SQL challenges with progressive hints, side-by-side solution diffs, and zero-UI headless worker execution.
39
16
 
40
17
  ---
41
18
 
@@ -47,169 +24,104 @@ bun add @innovatorved/code-lab
47
24
  npm install @innovatorved/code-lab
48
25
  ```
49
26
 
50
- Or load from a static script tag via CDN:
27
+ Or load via CDN with zero build tools:
51
28
 
52
29
  ```html
30
+ <!-- Full IDE Workbench -->
53
31
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@innovatorved/code-lab/dist/code-lab.css" />
54
32
  <script src="https://cdn.jsdelivr.net/npm/@innovatorved/code-lab/dist/code-lab.js"></script>
33
+
34
+ <!-- Standalone SQL Pack (~16.5 KB gzipped JS + CSS) -->
35
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@innovatorved/code-lab/dist/code-lab-sql.css" />
36
+ <script src="https://cdn.jsdelivr.net/npm/@innovatorved/code-lab/dist/code-lab-sql.umd.js"></script>
55
37
  ```
56
38
 
57
39
  ---
58
40
 
59
- ## Usage
41
+ ## Quick Start
60
42
 
61
- ### 1. Mount Workbench in DOM
43
+ ### Browser IDE Workbench
62
44
 
63
- ```js
45
+ ```ts
64
46
  import CodeLab from '@innovatorved/code-lab';
65
47
  import '@innovatorved/code-lab/code-lab.css';
66
48
 
67
49
  const lab = CodeLab.mount('#editor', {
68
- id: 'rate-limiter',
69
- title: 'Token Bucket Rate Limiter',
70
- mode: 'guided',
71
- language: 'js',
72
- entry: 'demo.js',
73
- testEntry: 'test.js',
74
- starterFiles: {
75
- 'limiter.js': 'class TokenBucket {\n allow() { return false; }\n}\nmodule.exports = { TokenBucket };\n',
76
- 'demo.js': 'const { TokenBucket } = require("./limiter");\nconsole.log(new TokenBucket().allow());\n',
77
- 'test.js': 'const { test } = require("node:test");\nconst assert = require("node:assert/strict");\nconst { TokenBucket } = require("./limiter");\n\ntest("allows request", () => {\n assert.equal(new TokenBucket().allow(), true);\n});\n'
78
- },
79
- steps: [
80
- {
81
- id: 'step-1',
82
- title: 'Allow requests within capacity',
83
- targetFile: 'limiter.js',
84
- targetSymbol: 'allow',
85
- instructions: 'Return `true` when tokens are available.',
86
- testNames: ['allows request']
87
- }
88
- ]
50
+ id: 'http-demo',
51
+ title: 'Bun HTTP Server',
52
+ entry: 'server.ts',
53
+ files: {
54
+ 'server.ts': 'Bun.serve({ port: 3000, fetch: () => Response.json({ ok: true }) });\n'
55
+ }
89
56
  });
90
57
  ```
91
58
 
92
- ### 2. `<code-lab>` Custom Element
59
+ ### Lightweight SQL Inline Editor & Playground
93
60
 
94
- ```html
95
- <code-lab mode="sandbox" language="ts" style="height: 600px;">
96
- <script type="application/json">
97
- {
98
- "id": "demo-lab",
99
- "title": "Bun HTTP Demo",
100
- "entry": "server.ts",
101
- "files": {
102
- "server.ts": "Bun.serve({ port: 3000, fetch: () => Response.json({ ok: true }) }); console.log('Listening on :3000');"
103
- }
104
- }
105
- </script>
106
- </code-lab>
107
- ```
108
-
109
- ### 3. Headless Runtime (No UI)
110
-
111
- ```js
112
- import { executeInWorker } from '@innovatorved/code-lab/runtime';
61
+ ```ts
62
+ import { createSqlEditor } from '@innovatorved/code-lab/sql';
63
+ import '@innovatorved/code-lab/sql.css';
113
64
 
114
- const res = await executeInWorker({
115
- mode: 'test',
116
- entry: 'test.js',
117
- files: {
118
- 'math.js': 'module.exports = { add: (a, b) => a + b };',
119
- 'test.js': 'const { test } = require("node:test");\nconst assert = require("node:assert/strict");\nconst { add } = require("./math");\ntest("adds numbers", () => assert.equal(add(2, 3), 5));'
65
+ const sql = createSqlEditor(document.getElementById('sql')!, {
66
+ mode: 'inline',
67
+ dialect: 'postgres',
68
+ value: 'SELECT id, email FROM customers ORDER BY id LIMIT 10;',
69
+ async onRun({ effectiveSql }) {
70
+ console.log('Execute SQL:', effectiveSql);
120
71
  }
121
72
  });
122
-
123
- console.log(res.ok, res.testResults);
124
73
  ```
125
74
 
126
- ### 4. Modular Language Extensions (TypeScript & Real C++20 in WebAssembly)
127
-
128
- JavaScript (`node` and `bun` zero-dependency browser runtime) is enabled out of the box. You can opt into TypeScript (`@innovatorved/code-lab/extensions/typescript`) and/or Real C++20 in WebAssembly (`@innovatorved/code-lab/extensions/cpp`):
129
-
130
- ```js
131
- import CodeLab from '@innovatorved/code-lab';
132
- import { typescriptExtension } from '@innovatorved/code-lab/extensions/typescript';
133
- import { cppExtension } from '@innovatorved/code-lab/extensions/cpp';
134
- import { guidedLabExtension } from '@innovatorved/code-lab/extensions/guided-lab';
75
+ ---
135
76
 
136
- const lab = CodeLab.mount('#editor', {
137
- id: 'dsa-binary-search',
138
- title: 'Binary Search (JS / TS / C++20)',
139
- language: 'cpp'
140
- })
141
- .use(typescriptExtension)
142
- .use((wb) => cppExtension(wb, { std: 'c++20', cacheInIndexedDB: true }))
143
- .use((wb) =>
144
- guidedLabExtension(wb, {
145
- starterFiles: { 'src/solution.js': 'module.exports = { search: () => -1 };\n' },
146
- tsStarterFiles: { 'src/solution.ts': 'export const search = (nums: number[], target: number): number => -1;\n' },
147
- cppStarterFiles: {
148
- 'src/solution.hpp': '#pragma once\n#include <bits/stdc++.h>\nint search(const std::vector<int>& nums, int target) { return -1; }\n',
149
- 'src/test.cpp': '#include <codelab/test.hpp>\n#include "solution.hpp"\nint main() {\n DESCRIBE("Binary Search", {\n TEST("finds target", {\n ASSERT_EQ(search({-1, 0, 3, 5, 9, 12}, 9), 4);\n });\n });\n return CODELAB_TEST_EXIT_CODE();\n}\n'
150
- },
151
- steps: [
152
- {
153
- id: 'step-1',
154
- title: 'Implement O(log N) binary search',
155
- targetFile: 'src/solution.hpp',
156
- instructions: 'Return the index of `target` in `nums`, or `-1` if not found.',
157
- testNames: ['finds target']
158
- }
159
- ]
160
- })
161
- );
162
- ```
77
+ ## Package Entrypoints
78
+
79
+ | Import Path | Purpose |
80
+ | :--- | :--- |
81
+ | `@innovatorved/code-lab` | Full multi-file IDE workbench, POSIX terminal, Settings UI, plugins, and Web Preview |
82
+ | `@innovatorved/code-lab/code-lab.css` | Main workbench stylesheet |
83
+ | `@innovatorved/code-lab/sql` | Zero-dependency PostgreSQL 18 and SQLite 3 inline and playground editor (~16.5 KB gzipped) |
84
+ | `@innovatorved/code-lab/sql.css` | Standalone SQL editor stylesheet |
85
+ | `@innovatorved/code-lab/runtime` | Headless Web Worker runtime for programmatic code and test execution |
86
+ | `@innovatorved/code-lab/shell` | Pure-JavaScript POSIX shell interpreter and 71 UNIX utilities |
87
+ | `@innovatorved/code-lab/terminal` | 256-color PTY terminal emulator engine |
88
+ | `@innovatorved/code-lab/schemas` | Zod runtime validation schemas and TypeScript types |
89
+ | `@innovatorved/code-lab/extensions/*` | Opt-in extensions for Guided Labs, TypeScript, C++20 WebAssembly, and Python 3.12 WebAssembly |
90
+ | `@innovatorved/code-lab/preview-sw.js` | Virtual loopback Service Worker for standalone browser preview tabs |
163
91
 
164
92
  ---
165
93
 
166
- ## Documentation
94
+ ## Documentation (GitHub Wiki)
167
95
 
168
- Complete documentation is published on the [GitHub Wiki](https://github.com/innovatorved/code-lab/wiki):
96
+ Full guides and API references live on the **[GitHub Wiki](https://github.com/innovatorved/code-lab/wiki)**:
169
97
 
170
- - **[Quick Start](https://github.com/innovatorved/code-lab/wiki/Quick-Start)**: Setup, CDN, and quick examples.
171
- - **[Integration Guide](https://github.com/innovatorved/code-lab/wiki/Integration-Guide)**: Embedding in React, Next.js, Vite, and HTML.
172
- - **[Workbench Configuration](https://github.com/innovatorved/code-lab/wiki/Workbench-Configuration)**: Complete reference of options, methods, events, and shortcuts.
173
- - **[POSIX Shell & Coreutils](https://github.com/innovatorved/code-lab/wiki/POSIX-Shell-and-Coreutils)**: Pipelines, redirects, background jobs, and 71 UNIX commands.
174
- - **[Runtime APIs (Node & Bun)](https://github.com/innovatorved/code-lab/wiki/Runtime-APIs)**: 50 Node.js built-ins, Bun APIs, `bun:test`, `bun:sqlite`, and npm install.
175
- - **[HTTP Servers & Networking](https://github.com/innovatorved/code-lab/wiki/HTTP-Servers-and-Networking)**: Virtual port table, background servers, `curl`, and Port Preview.
176
- - **[Headless Runtime](https://github.com/innovatorved/code-lab/wiki/Headless-Runtime)**: Run code and tests programmatically with zero UI.
177
- - **[Authoring Guided Labs](https://github.com/innovatorved/code-lab/wiki/Authoring-Guided-Labs)**: Schema and invariants for creating interactive coding challenges.
178
- - **[Plugin System & Custom Extensions](https://github.com/innovatorved/code-lab/wiki/Plugin-System)**: Extend CodeLab with `.use(plugin)` and `.on()` event hooks.
98
+ - **[Home](https://github.com/innovatorved/code-lab/wiki)** — Overview and architecture diagram
99
+ - **[Quick Start](https://github.com/innovatorved/code-lab/wiki/Quick-Start)** — Package installation, custom HTML element, and CDN setup
100
+ - **[SQL Playground & Inline Editor](https://github.com/innovatorved/code-lab/wiki/SQL-Playground-and-Inline-Editor)** — Inline blocks, playgrounds, PostgreSQL and SQLite dialects, and autocomplete
101
+ - **[Integration Guide](https://github.com/innovatorved/code-lab/wiki/Integration-Guide)** — React, Next.js App Router, and Vite integration recipes
102
+ - **[Workbench Configuration](https://github.com/innovatorved/code-lab/wiki/Workbench-Configuration)** — Mount options, workspace settings, methods, and keyboard shortcuts
103
+ - **[Runtime APIs](https://github.com/innovatorved/code-lab/wiki/Runtime-APIs)** — Node.js v22, Bun v1.1, C++20 WebAssembly, and Python 3.12 WebAssembly
104
+ - **[POSIX Shell & Coreutils](https://github.com/innovatorved/code-lab/wiki/POSIX-Shell-and-Coreutils)** — Shell syntax and all 71 built-in UNIX commands
105
+ - **[HTTP Servers & Networking](https://github.com/innovatorved/code-lab/wiki/HTTP-Servers-and-Networking)** — Loopback port table, background servers, load testing, and Web Preview
106
+ - **[Headless Runtime](https://github.com/innovatorved/code-lab/wiki/Headless-Runtime)** — Zero-UI grading and programmatic test execution
107
+ - **[Authoring Guided Labs](https://github.com/innovatorved/code-lab/wiki/Authoring-Guided-Labs)** — Step-by-step challenges across JavaScript, TypeScript, C++20, Python 3.12, and SQL
108
+ - **[Plugin System](https://github.com/innovatorved/code-lab/wiki/Plugin-System)** — Declarative plugins, language packs, and lifecycle hooks
109
+ - **[Architecture & Monorepo](https://github.com/innovatorved/code-lab/wiki/Architecture-and-Monorepo)** — Workspace layers, dependency injection, and virtual filesystem backends
179
110
 
180
111
  ---
181
112
 
182
- ## Local Development & Testing
113
+ ## Development
183
114
 
184
115
  ```bash
185
- # Install dependencies with Bun
186
116
  bun install
187
-
188
- # Rebuild all distribution bundles
189
- bun run build
190
-
191
- # Run the complete test suite
192
- bun run test:all
193
- bun run tests/test-all-builds.js # 15/15 builds & 226 unit tests
194
- bun run tests/test-runtime-advanced.js # Advanced runtime, VFS, HTTP/TCP
195
- bun run tests/test-option1-shell-bun-http.js # Shell AST, Bun runtime, curl, ports, npm/pnpm
196
- bun run tests/test-frameworks.js # React/Preact/Vue/Angular support + browser preview server
197
- bun run tests/test-coreutils-adversarial.js # Adversarial stress tests on 71 coreutils
198
- bun run tests/test-stress-shell.js # Deep pipelines, redirections, large stdout
199
- bun run tests/test-workbench-ui.js # Workbench tabs, explorer, shortcuts
200
- bun run tests/test-cpp-extension.js # Real C++20 WASI runtime, g++, and language extensions
201
- bun run tests/test-python-extension.js # Python 3.12 WebAssembly runtime, pytest, and language service
202
- ```
203
-
204
- Individual suites also run under Node 20, 22 and 24 — CI exercises all three:
205
-
206
- ```bash
207
- bun run build && node tests/run-all.js # same 43 suites, Node runtime
117
+ bun run build # Build all ESM, CJS, UMD bundles and TypeScript declarations
118
+ bun run check:boundaries # Verify 4-layer package boundaries and zero circular imports
119
+ bun run check:size # Enforce gzip bundle size budgets
120
+ bun run test:all # Run all 47 suites plus Playwright browser tests
121
+ node tests/run-all.js # Run the same 47 suites under Node 20, 22, and 24
208
122
  ```
209
123
 
210
- Suites load the built bundles from `dist/` (never raw TypeScript from `src/`), so
211
- `dist/` must exist and be newer than `src/`. `tests/run-all.js` exits with code 2
212
- and a "dist/ is stale" message otherwise; run `bun run build` first.
124
+ See [CONTRIBUTING.md](./CONTRIBUTING.md) for contribution guidelines.
213
125
 
214
126
  ---
215
127
 
@@ -0,0 +1,34 @@
1
+ import { type ICommandRegistry, type IContextKeyService, type IKeybindingService } from '@code-lab/commands';
2
+ import { ServiceContainer, type EventTraceRecord, type IDisposable, type ILogger } from '@code-lab/core';
3
+ import { type IEditorService } from '@code-lab/editor';
4
+ import { type IFsBackend, type IFileSystemService } from '@code-lab/fs';
5
+ import { type IPreviewService } from '@code-lab/preview';
6
+ import { type IRuntimeService, type RuntimeExecutorDelegate } from '@code-lab/runtime';
7
+ import { type IConfigurationService } from '@code-lab/settings';
8
+ import { type ITerminalService } from '@code-lab/terminal';
9
+ import { type IPluginRegistry, type IThemeService } from '@code-lab/ui';
10
+ export interface CodeLabKernelOptions {
11
+ readonly instanceId?: string;
12
+ readonly fsBackend?: 'memory' | 'indexeddb' | 'opfs' | IFsBackend;
13
+ readonly initialFiles?: Readonly<Record<string, string>>;
14
+ readonly runtimeDelegate?: RuntimeExecutorDelegate;
15
+ readonly logLevel?: 'debug' | 'info' | 'warn' | 'error' | 'silent';
16
+ }
17
+ export interface CodeLabKernel extends IDisposable {
18
+ readonly instanceId: string;
19
+ readonly container: ServiceContainer;
20
+ readonly logger: ILogger;
21
+ readonly fs: IFileSystemService;
22
+ readonly configuration: IConfigurationService;
23
+ readonly contextKeys: IContextKeyService;
24
+ readonly commands: ICommandRegistry;
25
+ readonly keybindings: IKeybindingService;
26
+ readonly editor: IEditorService;
27
+ readonly runtime: IRuntimeService;
28
+ readonly terminal: ITerminalService;
29
+ readonly preview: IPreviewService;
30
+ readonly themes: IThemeService;
31
+ readonly plugins: IPluginRegistry;
32
+ getRecentEvents(): readonly EventTraceRecord[];
33
+ }
34
+ export declare function createCodeLabKernel(options?: CodeLabKernelOptions): CodeLabKernel;