Global flags: morph --version prints the CLI version; morph -h / morph --help lists all commands.
Translate a .ts or .js file to C++ or Rust instantly:
morph app.ts # → app.cpp (default target: C++)
morph app.ts --to cpp # → app.cpp (intent-based codegen)
morph app.ts --to rust # → app.rs (experimental)
morph app.ts --to cpp --type strict # respect TS annotations (default: --type infer).ts / .js files allowed (.tsx/.jsx/.mx rejected — use morph build for projects)<basename>.cpp or <basename>.rs with trailing newline--type infer (default) ignores annotations and picks the cheapest native type from usage; --type strict keeps number/string/boolean/any as Js* wrappers (see Native C++ Types)morph::str, morph::dev_log); runtime headers use absolute global paths so the file compiles from any directoryint main() (async entry when top-level await is present); side-effectful static auto x = f() initializers move into main to preserve execution ordermorph new — Scaffold a New Projectmorph new [name]| Option | Description |
|---|---|
name |
Project name (use . for current directory) |
--width |
Window width (default: 800) |
--height |
Window height (default: 600) |
--title |
Window title (default: project name) |
--entry |
Entry file (default: src/App.mx) |
--ext |
Source extension: mx | tsx (default: mx) |
-y, --yes |
Skip interactive wizard, use defaults |
# Interactive
morph new my-app
# Non-interactive
morph new my-app --width 1024 --height 768 --title "My App" -y
# Into current directory
morph new . --ext tsxmorph install — Download Runtime Sourcesmorph installDownloads the C++ runtime (matching morph.config.json runtime.version) from GitHub Releases into the global cache ~/.morph/cache/runtimes/cpp/vX.Y.Z/ and symlinks it into .morph/runtime/. Creates/updates morph.lock.
Run this once after morph new or when switching runtime versions manually.
morph update — Update Runtime or morphmorph update # show current versions + available updates
morph update --runtime # update runtime to latest compatible version
morph update --self # update morph binary (downloads release tarball)--runtime: reads versions/runtime/cpp.json from GitHub, rewrites morph.config.json + morph.lock, re-links runtime--self: downloads morph-{os}-{arch}.tar.gz from the latest GitHub release and replaces the current binarymorph dev — Start Dev Mode with Hot Reloadmorph dev [--entry src/App.mx]src/ + entry dir (100ms debounce)logic.<hash>.so → pushes IR over loopback TCP to morph_devrt127.0.0.1:39573 (ephemeral fallback on collision)morph build — Compile Production Binarymorph build [--entry src/App.mx] [--output bin/] [--static] [--upx true|false] [--no-upx]| Option | Description |
|---|---|
--entry |
Override entry file |
--output |
Output directory (default: config output, .morph/output) |
--static |
Statically link GLFW/FreeType/HarfBuzz (needs .a archives) |
--upx / --no-upx |
Override UPX compression (default: config build.upx) |
.mx/.tsx/.ts → lightningcss → IR → CppEmitter (Tera templates) → app.cppmorph.config.json + entry + runtime hash unchanged → "Up to date — nothing to compile"-std=c++20 -O2 -ffunction-sections -fdata-sections -Wl,--gc-sectionsmorph run — Build and Runmorph run [binary] [--entry src/App.mx] [--output bin/] [--static]If binary given, runs it directly. Otherwise builds first, then launches.
morph check — Lint Source Filesmorph check [PATH] [--entry src/App.mx] [--migrate]PATH: file or directory to check (overrides config entry)--migrate: auto-fix deprecated patterns (stub)src/ for .mx/.tsx/.ts, runs morph-parser::linter::checkLintError (severity, code, message, suggestion, file, line, col)0 = clean, 1 = errors — CI-friendlymorph doctor — Verify System Dependenciesmorph doctor [-v/--verbose] [-y/--yes]Checks: g++, cmake, make, pkg-config (required; clang++ reported when present), plus mandatory GLFW, OpenGL/X11 (Linux), FreeType, HarfBuzz — detected via pkg-config with header fallbacks. Exit code 1 when anything mandatory is missing. -y auto-installs via the native package manager (apt/dnf/pacman/zypper/apk/brew/winget/choco); without -y, doctor prompts first.
morph cache — Manage Fetched CSS Cachemorph cacheShows size of .morph/cache/ and prompts to clear. Global cache ~/.morph/cache/ is read-only hint.
Two independent versions:
v0.3.0)v0.2.0)// versions/runtime/cpp.json
{
"version": "0.3.0",
"changelog": "Added signal() support, improved render performance",
"breaking": false
}Edit the file, push to main, GitHub Actions builds automatically. No manual trigger needed.
morph v0.3.0 + runtime v0.2.0 → ✓ Works
morph v0.3.0 + runtime v0.1.0 → ⚠ Deprecated (update recommended)
morph v0.3.0 + runtime v0.4.0 → ✗ Incompatible (update morph)morph.lockGenerated on first install/dev/build:
{
"runtime": { "type": "cpp", "version": "0.1.0", "sha256": "...", "downloaded_at": "..." },
"generated_by": "morph 0.3.0",
"generated_at": "..."
}Commit this file for reproducible builds.