Contents

Command Line Interface (CLI)

Run, build, package, and manage your project with the MōBrowser CLI.

Commands 

To see the list of available commands, run the following command in your project directory:

npm run mobrowser -- --help

This will display the help message with the list of available commands and their descriptions.

The MōBrowser command line tool

Usage:
  mobrowser [flags]
  mobrowser [command]

Available Commands:
  add         Add a feature to an existing project
  build       Build and pack application for production
  dev         Build and run application in development mode
  gen         Generate TypeScript and C++ code from Protobuf definitions
  help        Help about any command
  icon        Generate the application icon
  pack        Create the installer from already-built application
  sbom        Generate the application CycloneDX SBOM
  test:e2e    Run the end-to-end tests against the application

Flags:
  -h, --help      help for mobrowser
      --version   print version

Use "mobrowser [command] --help" for more information about a command.

add 

npm run mobrowser add

This command adds a feature to an existing project. Features are normally chosen when the project is generated, but requirements change.

Run it without a feature name to pick one interactively.

Add a feature to an existing project.

Usage:
  mobrowser add [flags]
  mobrowser add [command]

Available Commands:
  github-actions Add the GitHub Actions workflows
  native         Add a native C++ or Rust module
  testing        Add end-to-end testing

Flags:
  -h, --help      help for add
      --verbose   enable verbose mode, providing additional details during execution

Use "mobrowser add [command] --help" for more information about a command.

The native feature adds a C++ module by default. To add a Rust module, pass --lang rust:

npm run mobrowser -- add native --lang rust

build 

npm run mobrowser build

This command builds the application and packages it into a native executable for the current platform. On macOS, pass --x64 to build for Intel instead of the host architecture. See Intel and Apple Silicon.

Build and pack application for production

Usage:
  mobrowser build [flags]

Flags:
  -h, --help      help for build
      --verbose   enable verbose mode, providing additional details during execution
      --x64       build for Intel (x64) macOS

dev 

npm run mobrowser dev

This command will build and run the application in development mode. In the development mode, the application frontend is running on the localhost server with Hot Module Replacement (HMR) using Vite.

It allows you to modify the frontend code and see the changes immediately in the running application without rebuilding the application.

On macOS and Windows, development mode also shows a toolbar beside each window with Annotation Mode and Developer Tools. See Annotation Mode.

Build and run application in development mode

Usage:
  mobrowser dev [flags]

Flags:
  -h, --help                        help for dev
      --inspect int                 the port for debugging the main process
      --remote-debugging-port int   the port for debugging the renderer process
      --verbose                     enable verbose mode, providing additional details during execution

gen 

npm run mobrowser gen

This command will generate TypeScript and C++ code from Protobuf definitions. The command makes sense only if you have a native module in your project. For a native Rust module, it generates only the TypeScript code: the Rust code is generated on every build.

Generate TypeScript and C++ code from Protobuf definitions

Usage:
  mobrowser gen [flags]

Flags:
  -h, --help      help for gen
      --verbose   enable verbose mode, providing additional details during execution

icon 

npm run mobrowser icon -- --source <path-to-directory> --out app.ico

This command will generate the application icon.

Generate the application icon

Usage:
  mobrowser icon [flags]

Flags:
  -h, --help             help for icon
      --output string    the path to the output icon file (default "assets/app.ico")
      --sources string   the directory with the source PNG files to generate the icon from

pack 

npm run mobrowser pack

This command creates an installer and update packages from an application that has already been built. It keeps packages from earlier versions in the output directory so they can be used to generate delta updates. On macOS, pass --x64 to pack an Intel build.

Create the installer from already-built application

Usage:
  mobrowser pack [flags]

Flags:
      --force             replace the artifacts this pack run produces if they already exist
  -h, --help              help for pack
      --releases string   absolute path to a directory with previous releases
      --verbose           enable verbose mode
      --x64               pack for Intel (x64) macOS

The generated project’s pack script provides the shorter form used in packaging workflows:

npm run pack

Use npm run pack -- --force to recreate the current version’s artifacts. Packages for other versions are preserved.

sbom 

npm run sbom

This command generates a target-specific CycloneDX 1.7 SBOM for the application and its runtime components. It writes the JSON document and a SHA-256 checksum to build/dist/<target>/sbom/. For a native Rust module, the SBOM also lists the crates linked into the module, taken from its Cargo.lock. Crates that only run during the build, such as build dependencies and procedural macros, are not listed.

Generate the application CycloneDX SBOM

Usage:
  mobrowser sbom [flags]

Flags:
  -h, --help      help for sbom
      --verbose   enable verbose mode

Projects created with an earlier MōBrowser version might not have the sbom script. In those projects, run:

npm run mobrowser sbom

test:e2e 

npm run test:e2e

This command builds the application and runs its end-to-end tests. See Testing.

Run the end-to-end tests against the application.

Builds the app (dev:build) and runs the Playwright tests from test/e2e/; every test starts the app with the window hidden and a throwaway profile. Keeps the artifacts of each failed test, including the app's output (app.log), in build/test-results/e2e/. Exits non-zero when a test fails.

Arguments other than the flags below go to Playwright, for example -g <pattern> to run matching tests only; arguments after -- go to the app.

Usage:
  mobrowser test:e2e [flags] [playwright-args...] [-- app-args...]

Flags:
  -h, --help          help for test:e2e
      --show-window   show the app window while the tests run
      --verbose       enable verbose mode, providing additional details during execution

Projects created with an earlier MōBrowser version might not have the test and test:e2e scripts. To add them, run npm run mobrowser add testing.