--- title: 'CLI reference' slug: cli description: 'The mochi-framework command-line tool — build, generate-key, and update-skill.' --- Installing `mochi-framework` puts a `mochi-framework` binary on your `PATH`. Inside a project it's available to `package.json` scripts directly; anywhere else, run it with `bunx`: ```sh bunx mochi-framework [options] ``` ```sh bunx mochi-framework --help # list every command ``` ```sh bunx mochi-framework --version # print the installed version ``` `-h`/`--help` and `-v`/`--version` work as shorthands. ## build Produces a production bundle by reading config straight from your entry's `Mochi.serve()` call, so the prebuilt manifest stays single-sourced with the runtime. This is the command behind your `build` script: ```json { "scripts": { "build": "mochi-framework build" } } ``` | Option | Default | Description | | ----------------------- | ---------------- | --------------------------------------------------------------------------------------- | | `--entry ` | `./src/index.ts` | Runtime entry whose `Mochi.serve()` call supplies `routes`, `markdown`, and `optimize`. | | `--out-dir ` | `./.mochi` | Build output directory. | | `--public-dir ` | `./public` | Static assets directory. | | `--asset-prefix ` | `/_mochi` | URL prefix for framework client assets. | | `--dev` | off | Build with `development: true`. | See [Deployment](/docs/deployment-options) for how the output is served. ## generate-key Generates a `MOCHI_KEY` (a base64url-encoded 32-byte secret — the format [server-island](/docs/server-islands) prop signing expects) and writes it to `.env` in the current directory: ```sh bunx mochi-framework generate-key ``` It creates `.env` if missing, appends `MOCHI_KEY` if absent, and prompts before overwriting an existing key. | Option | Description | | --------------- | ---------------------------------------------------- | | `-f`, `--force` | Overwrite an existing `MOCHI_KEY` without prompting. | We recommend setting `MOCHI_KEY` for any deployment that runs more than one process or survives restarts — see [Server islands](/docs/server-islands#signing-key) for why. ## update-skill Fetches the latest `SKILL.md` — agent guidance for coding assistants — and writes it into your project for the given agent (default: `claude-code`): ```sh bunx mochi-framework update-skill [agent] ``` Run it again whenever you upgrade the framework to keep the guidance in sync. The optional `agent` argument controls the destination; see [Docs for LLMs](/docs/docs-for-llms#agent-skill-recommended) for the full list of supported agents.