Reference
CLI reference
One command line drives every project type. It reads the same Blueprint your app does, so the commands available reflect the adapters you stacked, not a fixed list.
#Commands
| Command | Alias | What it does |
|---|---|---|
| stone serve [target] | dev | Start the development server with hot reload. Name a target when the project stacks several, e.g. `stone dev native`. |
| stone build [target] | prod | Produce the production build. The target is deduced from what the app enabled, or named as a positional argument. |
| stone preview | p | Serve the production build locally. |
| stone export | e | Emit the static output (SSG) to disk. |
| stone test | t | Run the test suite (Vitest), configured from stone.config.mjs. |
| stone list | ls | List the routes and commands the Blueprint resolves. |
| stone init | i | Scaffold a new project into the current directory. |
| stone typings | ty | Generate the .stone/ type declarations (add --watch). |
| stone cache-clear | cc | Clear the build cache. |
| stone <custom> | · | Run a handler exposed as a CLI command (node-cli-adapter). |
Names and aliases are interchangeable: stone dev is stone serve, stone prod is stone build. The list is not fixed. It grows with the adapters you stack, because each command is itself a handler the CLI adapter resolves from the Blueprint.
#Flags
| Flag | On | What it does |
|---|---|---|
--ssg | build, export | Force static generation, regardless of the configured rendering mode. |
--rendering, -r | serve, build | Pick the rendering mode for this run: csr, ssr or ssg. |
--lazy | build | Build lazily: emit only what the entry actually reaches. |
--imperative, -i | serve | Run against the imperative entry instead of the decorated one. |
--language, -lang | serve, build | Target language for the build (ts or js). |
--target, -t | preview | Which built target to preview. |
--platform | build (native) | Which platform to bundle for: ios or android. Omit it and Expo decides. |
--watch, -w | test | Re-run tests when files change. |
--coverage, -c | test | Collect coverage for the run. |
--starter | init | Scaffold this starter id, e.g. basic-react-declarative. Skips the starter question. |
--starters, -s | init | Comma-separated packages that declare starters (npm, git or local), e.g. @stone-js/blog-starters. Adds to the built-in official pack. |
--yes, -y / --force, -f | init | Skip prompts / overwrite an existing directory. |
--watch, -w | typings | Regenerate declarations on change. |
A flag is a shortcut over the Blueprint: --ssg is the same decision as stone.builder.rendering = 'ssg', taken for one run instead of written into config.
#Typical flow
npm create @stone-js@latest my-app # scaffold
cd my-app
npm run dev # stone dev
npm run build # stone build
npm run preview # stone preview#The codegen directory
The CLI generates a .stone/ directory during a build: the entry that discovers your modules, and the wiring for the chosen target. It is derived output, safe to delete, and regenerated on the next build. Do not edit it or commit it.