Skip to content

Generator must emit IPC mixins, health checks, memory pressure, and ts-rs bindings for every module #355

Closed

Description

@joelteply

Problem

Creating a new Rust ServiceModule currently requires manual creation of:

  • TypeScript IPC mixin (bindings/modules/*.ts) with snake_case→camelCase conversion
  • TypeScript command scaffold (commands/*/server/*ServerCommand.ts, browser, shared types)
  • ts-rs #[derive(TS)] annotations on wire types
  • Health check integration (every module should report health)
  • Memory pressure reporting (GPU-backed modules need pressure awareness)
  • Generated barrel exports (shared/generated/*/index.ts)

This is error-prone boilerplate that should be generated. The grid module required hand-writing 130 lines of IPC mixin and 3 TS command files just to get grid/status working end-to-end.

What the generator should emit

Per Rust module:

  • bindings/modules/{name}.ts — IPC mixin with typed methods for each command
  • commands/{name}/* — TS command scaffold (shared types, server, browser)
  • Health check method (standardized {name}/health command)
  • Memory/resource pressure reporting where applicable

Per wire type:

  • #[derive(TS)] with correct export_to path
  • Barrel export in shared/generated/{name}/index.ts
  • TypeScript type re-exports in the mixin file

Standardized patterns:

  • Every module gets a health endpoint automatically
  • GPU-backed modules get pressure reporting
  • All IPC methods follow the same error handling pattern
  • snake_case→camelCase conversion codified in generator

Why

  • Grid module took manual effort that was 100% mechanical
  • Every new module will need the same boilerplate
  • Manual creation leads to inconsistencies (some modules have health, some don't)
  • ts-rs bindings are easy to forget → types diverge between Rust and TS

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions