Skip to content

Runtime plugins: frontends & backends without writing Swift #14

Open

Description

@clintecker

Let people extend MermaidKit with new input/output formats at runtime, in any language, or by handing a spec to a coding agent. Full design: docs/notes/plugin-extensibility.md.

Core idea: the seam is the IR, not the code. Serialize the IR (frontends) and the already-Codable DiagramScene (backends) to a versioned JSON contract; a plugin is any program that reads/writes that JSON.

Phases

  • Codable IRs + frozen JSON shape (Flowchart/ERDiagram/GitGraph gain Codable; version as mermaidkit.ir/v1). The real leverage; small.
  • Subprocess frontend-plugin loader — ~/.mermaidkit/plugins/ + manifest (name, kind, file-match/sniff, invoke). Prove it by reimplementing the Dippin front-end as an external Python plugin (same output, zero Swift).
  • LLM authoring kit — JSON Schema per IR + a conformance harness + a paste-ready agent prompt, so a plugin can be built and self-verified with no knowledge of internals.
  • WASM tier (WasmKit) — sandboxed, portable, on-device (iOS/visionOS) plugins.

Constraints (see memo)

Version the contract; apply the same maxTextSize/maxEdges/raster caps to plugin output; degrade to nil like a native front-end (no crash/hang); native parsers win discovery ties.

Note the platform reality: subprocess is the easy CLI/server path but can't run on iOS; WASM is the only portable, sandboxed on-device answer.

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