Skip to content

feat(runtime): add Buerli (ClassCAD) WASM kernel plugin#173

Draft
rifont wants to merge 4 commits into
mainfrom
cursor/add-buerli-kernel-58fa
Draft

feat(runtime): add Buerli (ClassCAD) WASM kernel plugin#173
rifont wants to merge 4 commits into
mainfrom
cursor/add-buerli-kernel-58fa

Conversation

@rifont
Copy link
Copy Markdown
Contributor

@rifont rifont commented Apr 9, 2026

Summary

Adds the Buerli (ClassCAD) kernel as a first-party plugin to @taucad/runtime, using the WASM-only variant with no WebSocket connections. Users import from @buerli.io/classcad to access the Solid, Part, Assembly, Sketch, and Curve APIs powered by the ClassCAD engine running entirely in-browser via WebAssembly.

Changes

Kernel Implementation

  • packages/runtime/src/kernels/buerli/buerli.kernel.ts — Full defineKernel implementation with WASM-only ClassCAD client initialization, module registration, bundler integration, geometry conversion to glTF, and export support
  • packages/runtime/src/kernels/buerli/buerli.plugin.ts — Plugin factory with createKernelPlugin, detect pattern for @buerli.io/classcad imports

System Wiring

  • Plugin factories (kernel-factories.ts), kernel exports (kernels-entry.ts), presets (presets.ts)
  • package.json exports + publishConfig for ./kernels/buerli subpath
  • tsdown.config.ts build entry, smoke ESM import test

Catalog & UI

  • libs/types/src/constants/kernel.constants.ts — Added buerli to KernelBackend union and kernelConfigurations array
  • apps/ui/app/constants/kernel-worker.constants.ts — Added buerli() to default kernel options
  • apps/ui/app/environment.config.ts — Added optional CLASSCAD_WASM_KEY env var

AI Chat Prompts

  • buerli.prompt.config.ts + buerli.prompt.example.ts — Prompt configuration and canonical example

Monaco IntelliSense

  • libs/api-extractor/src/extract-buerli-types.ts — Self-contained type extraction script
  • Registered in @taucad/api-extractor kernelTypeMaps array

Research & Documentation

  • docs/research/buerli-classcad-kernel-integration.md — Research doc covering API surface, WASM runtime constraints, and test strategy
  • Updated docs/policy/runtime-architecture-policy.md
  • Tracked buerli-examples and buerligons repos via repos.yaml

Tests (40 passing)

Tests modeled after real buerli-examples patterns (Solid API, Part API, Sketch API):

Category Count What it validates
Kernel metadata & schema 2 Name, version, optional classcadKey
getDependencies 1 Bundler delegation
exportGeometry 4 GLB/GLTF export, unsupported format, no-geometry
getParameters (unit) 2 Bundle/execute failure propagation
createGeometry (unit) 3 Empty return, bundle failure, runtime error
getParameters (integration) 5 Solid/Part/Lego/Flange params via real bundler
Solid API patterns 5 Box, cylinder, subtraction, multi-solid, union
Part API patterns 3 CreatePart, MechanicalPart, Flange
Three.js toJSON conversion 2 Single + multi-geometry BufferGeometry
Parametric geometry 2 Default params, parameter override
Multi-file projects 2 Local imports, barrel exports
ArrayBuffer passthrough 1 Raw GLB binary
Empty geometry 2 Undefined return, empty array
Error handling 3 Syntax, runtime, type errors
Export pipeline 1 GLB output validation
Module resolution 2 Named + default imports

WASM Runtime Constraint

ClassCAD WASM uses Comlink + browser Web Workers and cannot run in Node.js/Vitest (ReferenceError: Worker is not defined). Tests validate the full kernel pipeline (module registration → bundling → execution → geometry conversion → GLB) using realistic geometry data structures matching what createBufferGeometry() returns in the browser.

See: docs/research/buerli-classcad-kernel-integration.md

Testing

  • pnpm nx test runtime ./src/kernels/buerli/buerli.kernel.test.ts --watch=false — 40/40 pass
  • pnpm nx test runtime ./src/testing/smoke-esm.test.ts --watch=false — 7/7 pass
  • pnpm nx lint runtime --files='src/kernels/buerli/buerli.kernel.ts src/kernels/buerli/buerli.plugin.ts'
  • pnpm nx lint runtime --files='src/kernels/buerli/buerli.kernel.test.ts'
  • pnpm nx lint api --files='...', pnpm nx lint ui --files='...', pnpm nx lint types --files='...'
  • pnpm nx typecheck types
  • ⚠️ pnpm nx typecheck runtime — pre-existing opencascade WASM module errors only
Open in Web Open in Cursor 

- Implement buerli kernel with WASM-only client (no WebSocket)
- Require classcadKey as config for API license validation
- Register @buerli.io/classcad as built-in module
- Wire into plugin factories, exports, presets, build entries
- Add kernel catalog metadata and UI defaults
- Add prompt config for AI chat system
- Extract and register Monaco IntelliSense types
- Update architecture policy documentation
- Add comprehensive unit tests
- Fix naming convention violations (initFn → initFunction, WASMClient)
- Fix max-depth nesting by extracting geometry helpers
- Fix unnecessary type assertions and optional chains
- Use dynamic gltfCore import to avoid naming convention errors
- Make classcadKey optional for zero-config preset compatibility
- Use computed property for @buerli.io/classcad module path
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 9, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0f832c55-f090-4c97-a41b-5a1bd4eef132

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cursor/add-buerli-kernel-58fa

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

- Replace synthetic array tests with API-pattern-driven integration tests
- Add tests modeled after real buerli-examples (Solid/Part/Sketch APIs)
- Test full pipeline: module registration → bundling → execute → GLB
- Validate geometry conversion: position arrays, indexed geometry, toJSON
- Test parametric models, multi-file projects, barrel exports
- Test module resolution (named + default imports from @buerli.io/classcad)
- Test error handling: syntax errors, runtime errors, type errors
- Add research doc documenting WASM runtime constraints and test strategy
- Track buerli-examples and buerligons repos via repos.yaml
- 40 passing tests covering all kernel operations
@cursor cursor Bot temporarily deployed to review-ui April 9, 2026 12:15 Inactive
@cursor cursor Bot temporarily deployed to review-api April 9, 2026 12:15 Inactive
- Discovered classCadWorkerApi in CDN worker script has zero Worker dependency
- Mapped full command protocol: facade → callSafeApiV → executeRequest → WASM execute
- Found ClassCADWasm.js is compiled with ENVIRONMENT_IS_WEB=true (no Node.js support)
- Documented Emscripten module init, FS setup, and command format
- Architecture blueprint for NodeWASMClient bypassing Comlink
- Confirmed WASM module hangs in Node.js due to browser-only async read paths
- Tracked buerli-examples and buerligons repos via repos.yaml
@cursor cursor Bot temporarily deployed to review-api April 9, 2026 12:56 Inactive
@cursor cursor Bot temporarily deployed to review-ui April 9, 2026 12:56 Inactive
Base automatically changed from observability-v1 to payments-v1 April 19, 2026 09:55
Base automatically changed from payments-v1 to main April 19, 2026 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants