How attilamihaly/morphir-elm works
Morphir-Elm turns Elm business logic into technology-neutral Morphir IR, then supports code generation, IR browsing and project tooling. The main documented flow is project author → make → IR JSON → gen; develop consumes that IR for a web UI. The repository also exposes TypeScript IR/SDK APIs, an embeddable frontend, MCP tools, and editor decorations. Several CLI and generator implementations were not sampled, so those capability links rely on README statements rather than inspected call paths.
Main entry points: cli.ts Morphir commands · cli.js Elm translation · dict.ts Dictionary operations · morphir-mcp.ts MCP server
Components 20
CLI workflows
- Morphir commands
cli2/cli.ts - Elm CLI
cli/cli.js - MCP server
cli2/morphir-mcp.ts
IR processing
- Elm translation
cli/cli.js - IR dependencies
cli2/dependencies.ts - Morphir IR
- Code generation
cli2/morphir-scala-gen.ts - TypeScript generation
cli2/morphir-typescript-gen.ts
IR visualization
- Develop server
cli/morphir-elm-develop.js - IR tree view
cli/treeview/src/index.ts - IR insight UI
server/web/insight.js
SDK and APIs
- Cadl frontend
cadl-Frontend/src/morphir.ts - IR TypeScript API
morphir-ts/src/exports/ir.ts - TypeScript SDK
morphir-ts/src/sdk/maybe.ts - List operations
morphir-ts/src/sdk/list.ts - Dictionary operations
morphir-ts/src/sdk/dict.ts
Project editing
- Editor decorations
morphir-decoration-extension/src/decoration-manager.ts - Editor integration
morphir-decoration-extension/src/editor.ts
Other components
- Project author
- Elm project
Connections 24
- Project author → Elm project: writes logic
- Project author → Morphir commands: runs commands
- Morphir commands → Elm translation: invokes make
- Elm CLI → Elm translation: translates sources
cli/cli.js - Elm project → Elm translation: reads sources
cli/cli.js - Elm translation → Morphir IR: produces IR
- Morphir commands → Code generation: runs gen
- Morphir IR → Code generation: generates target code
- Morphir commands → TypeScript generation: runs generation
- Morphir commands → IR dependencies: loads dependencies
cli2/cli.ts - IR dependencies → Morphir IR: resolves IR inputs
cli2/dependencies.ts - Morphir commands → Develop server: starts develop
- Develop server → Morphir IR: browses IR
- Morphir IR → IR tree view: fetches IR
cli/treeview/src/index.ts - Project author → MCP server: connects client
- MCP server → Elm project: edits project
- Morphir IR → IR insight UI: visualizes IR
- Editor integration → Editor decorations: loads decorations
morphir-decoration-extension/src/editor.ts - Editor decorations → Elm project: reads config and IR
morphir-decoration-extension/src/decoration-manager.ts - Project author → Cadl frontend: embeds frontend
- Project author → IR TypeScript API: uses IR API
- Project author → TypeScript SDK: uses SDK
- Dictionary operations → List operations: uses list operations
morphir-ts/src/sdk/dict.ts - Dictionary operations → TypeScript SDK: uses backing structure