Appearance
CLI and Runtime Internals
This page explains how the public mere.run command tree maps to the package internals.
Top-level flow
Sources/MereRunCLI/MereRunCLI.swiftdefines the public modality-first tree- each command in
Sources/MereRunCLI/Commandsparses arguments and performs small amounts of orchestration - shared CLI helpers in
Sources/MereRunCLI/Supportbootstrap the model store, expose the managed model registry, and provide output helpers - runtime code in
MereRunCore,AudioSTT, andAudioTTSdoes the actual work
The package is intentionally organized so public command concerns do not live in the deep model code.
Model resolution path
Almost every command eventually passes through the same model-resolution layer:
MereRunModelPaths.swiftMereRunModelManifest.swiftModelResolver.swift
That shared path is what keeps the command surface coherent across image, text, speech, vision, music, and video.
CLI design conventions
The public surface follows three rules:
1. Modality-first commands
Commands are grouped by user intent:
- image
- text
- speech
- vision
- music
- video
- model
- status
- api
2. Canonical public model IDs
The runtime uses explicit public IDs such as:
image-klein-maxtext-chat-gemma4text-chat-q35text-agent-deepseek-v4-flashspeech-tts-qwen3-nano
Docs, tests, and examples should use the canonical IDs reported by mere.run model list.
3. Quiet default output
Normal success-path runs should emit only intended user-facing output. Internal bring-up logging belongs behind the shared debug helper, not in default stdout.
Runtime family pattern
The runtime families now follow a consistent reading pattern:
- root file owns the public type and high-level orchestration
- companion files own loading, generation, decoding, support, or diagnostics
That pattern is used heavily in:
Qwen3TTSGeneratorLightOnOCRGeneratorZImageTurboGeneratorQwenImageEditGeneratorACEStepPipelineImageValidateCommand
When to start in the CLI vs the runtime
Start in the CLI when
- you are changing flags, help text, or output shape
- you are changing which runtime family a command dispatches to
- you are debugging how user input becomes a runtime request
Start in the runtime when
- you are changing inference behavior
- you are debugging loading, decoding, or generation internals
- you are working inside one modality family already
Recommended reading sequence for contributors
- Repository Tour
- Architecture Reading Map
- one command file in
Sources/MereRunCLI/Commands - the matching runtime family entrypoint
- the related tests in
Tests/