Skip to content

CLI Commands

MediaMoth binaries use Cobra subcommands. Use this page to choose a command, then run <binary> --help and <binary> <command> --help against the exact build you deploy; the Core commands below reflect mediamoth-core/v1.0.0.

Service processes

BinaryCommandsNotes
mediamoth-coreserve, migrate, ctlHosts the workflow, media, job, and search APIs and their background workers in one process.
video-conversion-serviceserve, worker, dualThe executable's Cobra name is video-conversion-service.
chapter-inserterserve, worker, dualdual runs server and worker.
vhs-serviceserve <service>, worker <service>, hybrid <service>Valid service tokens are tbc-decode and vhs-decode.

Run Core

Start every core module and its event consumers:

bash
mediamoth-core serve

The command listens for gRPC on port 50051. It applies the combined Core database migrations before starting the server.

serve accepts these optional adapters:

FlagDefaultMeaning
--mcpfalseStart one MCP SSE server for the core API families.
--mcp-addr:8080MCP SSE listen address.
--mqttfalseEnable the job module's MQTT/Mosquitto listener.

Run core migrations

Apply every pending migration before running another command against the database:

bash
mediamoth-core migrate up

Use a positive step count to limit an up or down operation:

bash
mediamoth-core migrate up 2
mediamoth-core migrate down 1

migrate down without a step count rolls back one migration. Core uses one migration ledger in the database's public schema and creates the module-owned schemas from the same migration set.

WARNING

Rolling migrations down changes persistent state. Back up the Core database and inspect the exact migration files in your deployed version before using migrate down.

Rebuild projections

Projection rebuilds are grouped by core module:

bash
mediamoth-core ctl <module> rebuildProjection <handler> (--all | --aggregate-id <id>) [flags]
ModuleHandlers
jobJob
mediaHistory, Media
searchJobs, Media, Pipelines, Services
workflowPipeline, Service, ServiceInfo

Useful flags:

FlagShortDefaultMeaning
--all-AfalseRebuild every aggregate.
--aggregate-id-aRebuild one aggregate.
--dry-run-dfalseResolve configuration and show the mode without replaying.
--yes-yfalseSkip the confirmation prompt.
--db-uriconfigured DBOverride the event-store URI.
--batch-size-b1000Events per batch; maximum 10,000.
--count-timeout30Seconds allowed to count events.

WARNING

Rebuilding a projection replays stored events through its handler and can create significant database and downstream load. Start with --dry-run; omit --yes until you have reviewed the selected handler and scope.

Run module-scoped commands such as:

bash
mediamoth-core ctl job rebuildProjection Job --all --dry-run
mediamoth-core ctl media rebuildProjection Media --aggregate-id media-123
mediamoth-core ctl search rebuildProjection Jobs --all --yes
mediamoth-core ctl workflow rebuildProjection Pipeline --aggregate-id pipeline-123

Select a VHS process

Exactly one VHS module runs per process:

bash
vhs-service serve vhs-decode
vhs-service worker vhs-decode
vhs-service hybrid tbc-decode

The command token selects the matching section under services: in vhs-service/config.yaml.

Repository tasks

For source development, prefer mise tasks over invoking binaries manually:

bash
mise tasks
mise run dev:mediamoth-core
mise run test:mediamoth-core
mise run lint:mediamoth-core

See Getting Started for setup.

Released under the MIT License.