| id | title | sidebar_label |
|---|---|---|
whats-new |
What's New in CLI Preview |
What's New |
This page highlights the major new features in the Morphir CLI Preview.
The CLI Preview introduces full support for WIT, the interface definition language for WebAssembly components. This enables Morphir to serve as a bridge between WIT and other ecosystems.
WebAssembly Interface Types (WIT) is becoming the standard for defining component interfaces in the WebAssembly ecosystem. By supporting WIT, Morphir can:
- Import WIT contracts and validate them against Morphir models
- Export Morphir types to WIT for WebAssembly component generation
- Round-trip validate conversions between WIT and Morphir IR
┌─────────────┐ ┌──────────────┐ ┌─────────────┐
│ WIT File │──make──▶│ Morphir IR │──gen───▶│ WIT File │
└─────────────┘ └──────────────┘ └─────────────┘
│
▼
┌──────────────┐
│ Other │
│ Backends │
└──────────────┘
The pipeline follows Morphir's established patterns:
- make: Frontend compilation (WIT → IR)
- gen: Backend generation (IR → WIT)
- build: Full pipeline with validation
// api.wit
package mycompany:api;
interface user-service {
record user {
id: u64,
name: string,
email: string,
}
get-user: func(id: u64) -> option<user>;
create-user: func(name: string, email: string) -> user;
}morphir wit make api.wit -o api.ir.jsonThe IR captures:
- Package namespace (
mycompany) and name (api) - Record types with fields
- Function signatures
The CLI Preview adds JSONL (JSON Lines) support for efficient batch processing and streaming workflows.
JSONL is ideal for:
- CI/CD pipelines - Each result is a separate JSON object
- Streaming - Process results as they arrive
- Parallel processing - Split input across workers
- Error isolation - One failure doesn't affect others
morphir wit make -s "package a:b; interface foo { x: func(); }" --jsonlOutput:
{"success":true,"typeCount":0,"valueCount":1,"module":{"values":[{"name":"X"}],"sourcePackage":{"namespace":"a","name":"b"}}}Create an input file with one JSON object per line:
{"name": "user-api", "source": "package app:users; interface users { get-user: func(id: u64) -> string; }"}
{"name": "order-api", "source": "package app:orders; interface orders { create-order: func() -> u64; }"}
{"name": "inventory", "file": "./wit/inventory.wit"}Process all at once:
morphir wit make --jsonl-input apis.jsonl --jsonlOutput (one line per input):
{"name":"user-api","success":true,"typeCount":0,"valueCount":1,"module":{...}}
{"name":"order-api","success":true,"typeCount":0,"valueCount":1,"module":{...}}
{"name":"inventory","success":true,"typeCount":2,"valueCount":3,"module":{...}}JSONL output includes the full IR module structure:
{
"name": "api",
"success": true,
"typeCount": 1,
"valueCount": 2,
"module": {
"types": [{"name": "User"}],
"values": [{"name": "GetUser"}, {"name": "CreateUser"}],
"sourcePackage": {
"namespace": "mycompany",
"name": "api"
}
}
}The WIT pipeline emits structured diagnostics for type conversion issues.
| Code | Description |
|---|---|
WIT001 |
Integer precision lost (e.g., u8 → Int) |
WIT002 |
Float precision lost (f32 → Float) |
WIT003 |
Unsupported type: flags |
WIT004 |
Unsupported type: resource |
WIT005 |
Round-trip validation mismatch |
# Verbose output shows all diagnostics
morphir wit make api.wit -v
# JSON output includes diagnostics array
morphir wit make api.wit --json{
"success": true,
"typeCount": 1,
"valueCount": 2,
"diagnostics": [
{"severity": "warn", "code": "WIT001", "message": "lossy mapping: u64 → Int"}
]
}Treat warnings as errors for CI enforcement:
# Fail on any warnings
morphir wit make api.wit --warnings-as-errors
# Fail on unsupported constructs
morphir wit make api.wit --strictThe build command validates that WIT → IR → WIT conversions are semantically correct:
morphir wit build api.wit -o regenerated.witSUCCESS Compiled WIT to Morphir IR
Types: 1, Values: 2
VALID Round-trip validation passed
If the round-trip produces different WIT (due to lossy conversions):
WARN Round-trip produced different output (lossy conversion)
Future CLI Preview releases will include:
- Full IR JSON parsing for
morphir wit gen - Additional WIT types - flags, resources
- IR emission strategies - configurable JSON output formats
- More backends - Scala, TypeScript, Go generation from WIT
Stay tuned to the Release Notes for updates.