mg is Mercury’s Go command-line tool. This short course starts with a command you can run safely, then uses the example generator and its read-only check. Each chapter gives you a result to look for and a way forward when a command refuses to run.
Choose the tool
Use mx to install Mercury dependencies, serve an application, build it and run its tests. Use mg for the source-generation workflow described here. They have separate executables and help screens. Installing mx does not establish that mg is installed.
| You want to… | Start here |
|---|---|
| Open, build or test an application | The mx course |
| Learn which commands your mg supports | mg help |
| Refresh the design explorer’s generated examples | mg gen examples |
| Check generated files without writing them | mg gen examples --check |
| Consume a result in automation | --json, optionally with --agent |
Start from source
This course uses a jonnify checkout and Go 1.26.0 or later on PATH. From the checkout root:
scripts/mg help
alias mg="$PWD/scripts/mg"
mg version
The launcher builds bin/mg and runs it in your current directory. Go may need to download module dependencies on the first build. The built program needs no Node, Python or cgo. The first chapter explains the launcher, the macOS name collision and completion.
The chapters
- First steps: run the right executable, read help, identify a build and enable completion.
- Generate examples: turn authored UI stories into the design explorer’s catalog, inspect changes and check for drift.
- Automation and recovery: use JSON and agent guidance, distinguish failures and preserve the exit status.
What this course covers
The source launcher is the setup path taught here; this course does not supply a published mg archive or npm installer. The generator lesson requires a build whose mg help gen examples lists --check and --root. If your checkout only lists help, version and completion, finish the first and third chapters; the generator requires the corresponding source update.
Scaffolding and rewriting are outside the command surface taught here. Use the current executable’s help to decide what is available. A successful generation check establishes that the expected generated files match the sources; browser behavior is checked separately.