Skip to content
CLI referenceOptions and exit status

Options and exit status

The options every command shares, and what an exit code means.

Shape of a command

The command comes first and its options follow it:

shell
npx mokly build --config tools/mokly.config.ts

A value option also accepts the assigned form --name=value, which is how you pass a value beginning with -, such as --token=-TOKEN or --config=-catalogue.config.ts. Empty values are rejected, and a boolean flag takes no value. There are no silent positional arguments.

Options

Option Commands Meaning
--config <path> every command Use an explicit mokly.config file
--debug-timings every command Report phase timings and catalogue counts on standard error
--port <port> serve Starting port; advances if occupied, 0 selects any free port
--watch serve, build Watch inputs; default for Serve
--no-watch serve Serve one deterministic snapshot
--build serve Write mokly-generated/ after successful compilation
--open serve Open the catalogue in your default browser
--base <ref> serve, export, publish Git base ref used to find the branch point
--out <path> export, publish Config-relative output directory
--endpoint <url> publish The service’s plan URL, or MOKLY_ENDPOINT
--token <token> publish Bearer token, or MOKLY_TOKEN
--repository <host>/<owner>/<name> publish Override the detected repository identity
--no-changes publish Publish with no comparison baseline
--upload-concurrency <n> publish Upload 1 to 32 missing files at once; defaults to 8
--strict build, check, export, publish Fail when the build reports warnings
--help every command Show the commands and their options
-h every command Short form of --help
--version every command Print the installed version
-v every command Short form of --version

An option given to a command that does not take it is refused by name rather than ignored. --out is required by export, and --no-changes cannot be combined with --base.

Exit status

Code Meaning
0 The command succeeded
1 The command failed

A command that finishes with build warnings still exits 0. --strict, which build, check, export and publish accept, prints the warnings and then exits 1 under the build-invalid category. Its error is 1 build warning with --strict for one warning and <n> build warnings with --strict for any other count.

Errors

A failure prints a message on standard error that begins with its category, so you can tell a configuration problem from an upload problem without reading a stack trace:

text
[mokly/config-missing] no mokly.config file was found
Category Raised when
cli-invalid An argument is unknown, misplaced or missing its value
config-missing No configuration file was found
config-invalid The configuration is not valid
build-invalid The catalogue could not be built or validated
build-stale Committed generated files do not match the publish build
manifest-invalid A manifest could not be read or does not match
review-invalid A comparison could not be produced from the inputs
export-invalid An export destination or artifact was refused
server-failed The local server could not start or continue
git-failed A Git command failed
git-uncommitted Publish found uncommitted files or missing output ignore rules
baseline-history-unavailable The branch point is not in the checkout
baseline-incompatible-earlier The comparison base was built by an earlier Mokly
baseline-extraction-failed The historical checkout could not be extracted
baseline-command-failed A baseline build command failed
baseline-output-invalid A baseline build produced no valid catalogue
baseline-interrupted Baseline preparation was interrupted
baseline-lock-timeout The baseline cache stayed locked
upload-unauthorized The service refused the token or the repository
upload-invalid-bundle The upload was rejected as malformed
upload-too-large An upload limit was exceeded
upload-unsupported-version The service does not support this upload version
upload-failed The upload failed for any other reason

baseline-incompatible-earlier is a typed internal availability outcome, not a command failure. Serve stays available, and export or publish exits 0 without Changes; those commands print the product line defined by the baseline compatibility protocol instead of an error prefix.

Cancelling publish keeps upload-failed but prints Publication was cancelled. Run mokly publish again when you are ready. An exhausted request prints The catalogue upload did not complete. Check the endpoint and connection, then retry.

git-uncommitted says The checkout has uncommitted changes. Its hint says Commit, stash or ignore these files, then publish again. build-stale says The committed generated files are out of date. Its hint says Run mokly build, commit the result and publish again. Both show at most 20 paths, then the number of other paths, in plain and rich output. Changes found after export say that they appeared during the export.