--- url: /guide/quick-start.md --- > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /guide/quick-start.md. # Quick start Rstack CLI brings the Rstack toolchain together with one CLI and one configuration file. This guide adds Rstack to an existing project and introduces the available workflows. ## Environment preparation Rstack supports using [Node.js](https://nodejs.org/), [Deno](https://deno.com/), or [Bun](https://bun.sh/) as the JavaScript runtime. Use one of the following installation guides to set up a runtime: - [Install Node.js](https://nodejs.org/en/download) - [Install Bun](https://bun.com/docs/installation) - [Install Deno](https://docs.deno.com/runtime/getting_started/installation/) :::tip Version requirements Rstack requires Node.js 22.12.0 or higher when using Node.js as the runtime. ::: ## Install Rstack Install [`rstack`](https://www.npmjs.com/package/rstack) as a development dependency in a project that has a `package.json`: ```sh [npm] npm install -D rstack ``` ```sh [yarn] yarn add -D rstack ``` ```sh [pnpm] pnpm add -D rstack ``` ```sh [bun] bun add -d rstack ``` ## CLI commands Add the commands your project needs to the `scripts` field in `package.json`. For example: ```json title="package.json" { "scripts": { "dev": "rs dev", "build": "rs build", "preview": "rs preview", "test": "rs test", "lint": "rs lint", "format": "rs fmt" } } ``` Package scripts use the project-local `rs` binary, so Rstack does not need to be installed globally. The following commands are available: - [`rs dev`](/guide/cli/dev.md): Start the application development server. - [`rs build`](/guide/cli/build.md): Build the application for production. - [`rs preview`](/guide/cli/preview.md): Preview the application's production build locally. - [`rs lib`](/guide/cli/lib.md): Build a library with Rslib. - [`rs doc`](/guide/cli/doc.md): Develop, build, or preview a documentation site with Rspress. - [`rs test`](/guide/cli/test.md): Run tests with Rstest. - [`rs lint`](/guide/cli/lint.md): Lint source code with Rslint. - [`rs fmt`](/guide/cli/fmt.md): Format code. - [`rs setup`](/guide/cli/setup.md): Install repository-level Git hooks. - [`rs staged`](/guide/cli/staged.md): Run tasks against files staged in Git with lint-staged. ## Configure Rstack Create `rstack.config.ts` in the project root and register the configurations your project needs. The following is a minimal example for an application with testing and linting: ```ts title="rstack.config.ts" // Rstack configuration guide: https://rstack.rs/config import { define } from 'rstack'; define.app({ // Rsbuild configuration }); define.test({ // Rstest configuration }); define.lint({ // Rslint configuration }); ``` See [Configuration](/guide/configuration.md) for all available configuration APIs. ## AI To learn how to use Rstack CLI with coding agents, see the [AI guide](/guide/ai.md). --- url: /guide/configuration.md --- > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /guide/configuration.md. # Configuration Rstack centralizes the configuration for your project's tools in a single file. Define only the configurations your project needs with the `define.*()` APIs. ## Configuration file Create `rstack.config.ts` in the project root and call the relevant `define.*()` APIs: ```ts title="rstack.config.ts" // Rstack configuration guide: https://rstack.rs/config import { define } from 'rstack'; define.app({ // Rsbuild configuration }); define.test({ // Rstest configuration }); define.lint({ // Rslint configuration }); define.fmt({ // Formatting configuration }); ``` The configuration file does not require a default export. Each `define.*()` API can be called at most once; defining the same configuration type more than once throws an error. By default, Rstack looks for a file with one of the following names: - `rstack.config.ts` - `rstack.config.js` - `rstack.config.mts` - `rstack.config.mjs` All `rs` commands accept the global `-c, --config` option for loading a file with a different name or location: ```bash rs build --config ./configs/rstack.config.ts ``` ## Loading dependencies on demand Every `rs` command loads and executes the Rstack configuration file, then resolves only the configuration functions needed by that command. When a configuration needs to import plugins or other tool-specific dependencies, use an async configuration function and load those dependencies with dynamic `import()` inside it. This ensures that they are loaded only when the configuration is resolved. ```ts title="rstack.config.ts" import { define } from 'rstack'; define.app(async () => { const { pluginReact } = await import('@rsbuild/plugin-react'); return { plugins: [pluginReact()], }; }); ``` ## Configuration APIs Configuration options follow the formats of the underlying tools. When using APIs and helpers that Rstack re-exports, prefer the `rstack/app`, `rstack/lib`, `rstack/test`, and `rstack/lint` entry points. | API | Tool | Commands | | ----------------------------------- | ----------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | | [`define.app()`](#define-app) | [Rsbuild](https://rsbuild.rs/config/) | [`rs dev`](/guide/cli/dev.md), [`rs build`](/guide/cli/build.md), [`rs preview`](/guide/cli/preview.md) | | [`define.lib()`](#define-lib) | [Rslib](https://rslib.rs/config/) | [`rs lib`](/guide/cli/lib.md) | | [`define.doc()`](#define-doc) | [Rspress](https://rspress.rs/api/config/config-basic) | [`rs doc`](/guide/cli/doc.md) | | [`define.test()`](#define-test) | [Rstest](https://rstest.rs/config/) | [`rs test`](/guide/cli/test.md) | | [`define.lint()`](#define-lint) | [Rslint](https://rslint.rs/config/) | [`rs lint`](/guide/cli/lint.md) | | [`define.fmt()`](#define-fmt) | [Prettier](https://prettier.io/docs/options) | [`rs fmt`](/guide/cli/fmt.md) | | [`define.staged()`](#define-staged) | [lint-staged](https://github.com/lint-staged/lint-staged#configuration) | [`rs staged`](/guide/cli/staged.md) | ### `define.app()` \{#define-app} Defines the [Rsbuild configuration](https://rsbuild.rs/config/) for an application. It accepts a configuration object or a configuration function. The function receives the standard Rsbuild configuration parameters. ```ts title="rstack.config.ts" import { define } from 'rstack'; define.app({ html: { title: 'My App', }, output: { distPath: { root: 'dist', }, }, }); ``` ### `define.lib()` \{#define-lib} Defines the [Rslib configuration](https://rslib.rs/config/) for a library. It accepts a configuration object or a configuration function. The function receives the standard Rslib configuration parameters. ```ts title="rstack.config.ts" import { define } from 'rstack'; define.lib({ dts: true, format: 'esm', }); ``` ### `define.doc()` \{#define-doc} Defines the [Rspress configuration](https://rspress.rs/api/config/config-basic) for a documentation site. It accepts a configuration object or an async configuration function. ```ts title="rstack.config.ts" import { define } from 'rstack'; define.doc({ root: 'docs', title: 'My Site', }); ``` `@rspress/core` is an optional dependency of Rstack. Install it in every project that uses the `rs doc` command: ```sh [npm] npm install -D @rspress/core ``` ```sh [yarn] yarn add -D @rspress/core ``` ```sh [pnpm] pnpm add -D @rspress/core ``` ```sh [bun] bun add -D @rspress/core ``` ```sh [deno] deno add -D npm:@rspress/core ``` ### `define.test()` \{#define-test} Defines the [Rstest configuration](https://rstest.rs/config/). It accepts a configuration object or a configuration function. ```ts title="rstack.config.ts" import { define } from 'rstack'; define.app({ // Shared application configuration }); define.test({ setupFiles: ['./tests/rstest.setup.ts'], testEnvironment: 'happy-dom', }); ``` When `extends` is omitted, Rstack automatically connects the test configuration to `define.app()` through the Rsbuild adapter. If no application configuration is defined, it falls back to `define.lib()` through the Rslib adapter. The application configuration takes precedence when both are defined. Set `extends` explicitly to opt out of this automatic inheritance. If the root test configuration does not define `extends` and contains `projects`, Rstack applies automatic inheritance to each inline project that omits its own `extends`. A function-based application or library configuration is resolved once and shared by those projects. String project entries are passed to Rstest unchanged; they load their external configurations independently and do not inherit the current application or library configuration. > For more guidance on testing, see [Testing](/guide/testing.md). ### `define.lint()` \{#define-lint} Defines the [Rslint configuration](https://rslint.rs/config/). Pass the configuration directly, or use an async function to load presets and plugins from `rstack/lint` on demand. ```ts title="rstack.config.ts" import { define } from 'rstack'; define.lint(async () => { const { js, ts } = await import('rstack/lint'); return [js.configs.recommended, ts.configs.recommended]; }); ``` ### `define.fmt()` \{#define-fmt} Defines formatting settings for [`rs fmt`](/guide/cli/fmt.md). Pass a configuration object directly, or use a synchronous or asynchronous function that returns one. ```ts title="rstack.config.ts" import { define } from 'rstack'; define.fmt({ printWidth: 100, singleQuote: true, }); ``` For detailed usage, see [Formatting](/guide/formatting.md). ### `define.staged()` \{#define-staged} Defines the [lint-staged configuration](https://github.com/lint-staged/lint-staged#configuration) used to run tasks on staged Git files. It accepts either an object that maps glob patterns to tasks or a task-generator function. Tasks can be commands, command arrays, or functions supported by lint-staged. ```ts title="rstack.config.ts" import { define } from 'rstack'; define.staged({ '*.{js,jsx,ts,tsx}': ['rs lint', 'rs fmt'], '*.{json,jsonc,md,mdx,css,html,yml,yaml}': 'rs fmt', }); ``` Unlike the other commands, `rs staged` requires a `define.staged()` configuration and reports an error when it is missing. --- url: /guide/ai.md --- > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /guide/ai.md. # AI To help coding agents understand Rstack CLI commands, configuration, and best practices, Rstack CLI provides the following resources: - [AGENTS.md](#agentsmd) - [Agent Skills](#agent-skills) - [llms.txt](#llmstxt) - [Markdown docs](#markdown-docs) ## AGENTS.md Projects created with [create-rstack](https://www.npmjs.com/package/create-rstack) include an [`AGENTS.md`](https://agents.md/) file that gives coding agents the key context for working with Rstack CLI. You can also copy the following content into your own `AGENTS.md`: ```markdown wrapCode title="AGENTS.md" This project uses Rstack CLI as its JavaScript toolchain. - Before working with `rs` commands, `rstack.config.*` files, or imports from `rstack`, start with `node_modules/rstack/docs/llms.txt`, then read only the linked pages relevant to the task. - For command details, use `rs -h` or `rs -h`. - If the local documentation is unavailable, use https://rstack.rs/llms.txt and `rs -h`. ``` This content serves a similar purpose to the [rstack-cli-best-practices](#rstack-cli-best-practices) Skill, helping coding agents use Rstack CLI and find relevant documentation. Add it to `AGENTS.md` or install the Skill; either is sufficient. ## Agent Skills Rstack CLI provides domain-specific Agent Skills that help coding agents give more accurate guidance and perform relevant tasks. ### rstack-cli-best-practices The [rstack-cli-best-practices](https://github.com/rstackjs/rstack-cli/tree/main/.agents/skills/rstack-cli-best-practices) Skill provides guidance and best practices for using Rstack CLI. Install it with the [skills](https://www.npmjs.com/package/skills) package: ```sh [npx] npx skills add rstackjs/rstack-cli --skill rstack-cli-best-practices ``` ```sh [yarn] yarn dlx skills add rstackjs/rstack-cli --skill rstack-cli-best-practices ``` ```sh [pnpm] pnpm dlx skills add rstackjs/rstack-cli --skill rstack-cli-best-practices ``` ```sh [bunx] bunx skills add rstackjs/rstack-cli --skill rstack-cli-best-practices ``` ```sh [deno] deno run -A npm:skills add rstackjs/rstack-cli --skill rstack-cli-best-practices ``` ### migrate-to-rstack-cli The [migrate-to-rstack-cli](https://github.com/rstackjs/rstack-cli/tree/main/.agents/skills/migrate-to-rstack-cli) Skill migrates projects from standalone Rstack tools and related development tools to Rstack CLI. To migrate an existing project, install the Skill: ```sh [npx] npx skills add rstackjs/rstack-cli --skill migrate-to-rstack-cli ``` ```sh [yarn] yarn dlx skills add rstackjs/rstack-cli --skill migrate-to-rstack-cli ``` ```sh [pnpm] pnpm dlx skills add rstackjs/rstack-cli --skill migrate-to-rstack-cli ``` ```sh [bunx] bunx skills add rstackjs/rstack-cli --skill migrate-to-rstack-cli ``` ```sh [deno] deno run -A npm:skills add rstackjs/rstack-cli --skill migrate-to-rstack-cli ``` For supported tools and migration instructions, see [Migrate to Rstack CLI](/guide/migration.md). ## llms.txt [llms.txt](https://llmstxt.org/) is a standard that helps LLMs discover and use project documentation. The Rstack CLI documentation site provides the following files: - [llms.txt](https://rstack.rs/llms.txt): A structured index containing the title, link, and description of each documentation page. ```text https://rstack.rs/llms.txt ``` - [llms-full.txt](https://rstack.rs/llms-full.txt): A single file containing the full content of all documentation pages. ```text https://rstack.rs/llms-full.txt ``` Use `llms.txt` when the agent can follow links and load only the pages relevant to a task. Use `llms-full.txt` when the agent needs the complete documentation in one context and the larger token cost is acceptable. ## Markdown docs Every Rstack CLI documentation page has a corresponding `.md` plain-text version that can be provided directly to an agent. On any documentation page, use “Copy Markdown” or “Copy Markdown Link” under the title to copy its content or URL. ```text https://rstack.rs/guide/quick-start.md ``` --- url: /guide/api-reference.md --- > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /guide/api-reference.md. # API reference Rstack provides a unified configuration API and re-exports the public APIs of Rsbuild, Rslib, Rstest, and Rslint through dedicated subpaths. Prefer these subpaths to direct imports from each tool's core package so that dependency entry points and tool versions remain aligned with Rstack. ## Import paths | Import path | Contents | Use case | | ------------------------ | ------------------------------------------------- | --------------------------------------- | | `rstack` | Rstack configuration API | Register tool configurations | | `rstack/app` | Public APIs from `@rsbuild/core` | Build applications and extend Rsbuild | | `rstack/lib` | Public APIs from `@rslib/core` | Build libraries and extend Rslib | | `rstack/test` | Public APIs from `@rstest/core` | Write tests and configure test projects | | `rstack/lint` | Public APIs from `@rslint/core` | Use Rslint presets and plugins | | `rstack/types` | Project types shared by Rsbuild and Rslib | Type application and library sources | | `rstack/test/globals` | Global Rstest API declarations | Enable global test API types | | `rstack/test/importMeta` | `ImportMeta` declaration for `import.meta.rstest` | Type in-source tests | ## Main entry point ### `define` Import `define` from `rstack` to register tool configurations in `rstack.config.ts`; see [Configuration APIs](/guide/configuration.md#configuration-apis) for details. ## Re-exports The tool-specific subpaths below re-export the public APIs from their corresponding core packages. Using these Rstack entry points keeps dependency entry points and tool versions aligned with the toolchain integrated by Rstack. ### `rstack/app` `rstack/app` re-exports all public APIs from `@rsbuild/core`, including APIs for creating and controlling Rsbuild instances. ```ts import { createRsbuild, mergeRsbuildConfig } from 'rstack/app'; ``` For details, see the [Rsbuild core APIs](https://rsbuild.rs/api/javascript-api/core). ### `rstack/lib` `rstack/lib` re-exports all public APIs from `@rslib/core`, including APIs for creating Rslib instances and merging Rslib configurations. ```ts import { createRslib, mergeRslibConfig } from 'rstack/lib'; ``` For details, see the [Rslib core APIs](https://rslib.rs/api/javascript-api/core). ### `rstack/test` `rstack/test` re-exports all public APIs from `@rstest/core`, including APIs for defining tests, writing assertions, mocking modules, and merging test configurations. ```ts import { describe, expect, test } from 'rstack/test'; ``` See the [Rstest runtime API](https://rstest.rs/api/runtime-api/) for test APIs and the [Rstest core APIs](https://rstest.rs/api/javascript-api/rstest-core) for configuration helpers. > For more guidance on testing, see [Testing](/guide/testing.md). ### `rstack/lint` `rstack/lint` re-exports all public APIs from `@rslint/core`, including JavaScript and TypeScript presets and framework plugins. ```ts import { js, reactPlugin, ts } from 'rstack/lint'; ``` For details about the available presets and plugins, see [Rslint rules and presets](https://rslint.rs/config/rules-and-presets). ## TypeScript types These type-only entry points add ambient declarations to a TypeScript project. Add only the entries your project needs to [`compilerOptions.types`](https://www.typescriptlang.org/tsconfig/#types) in `tsconfig.json`. ### `rstack/types` `rstack/types` provides project-level declarations shared by Rsbuild and Rslib, including types for `import.meta.env` and static asset imports. Use it in place of `@rsbuild/core/types` or `@rslib/core/types`. ```json title="tsconfig.json" { "compilerOptions": { "types": ["rstack/types", "node"] } } ``` ### `rstack/test/globals` `rstack/test/globals` declares Rstest APIs such as `test`, `expect`, and lifecycle hooks as globals. Add it when Rstest's [`globals`](https://rstest.rs/config/test/globals) option is enabled and tests use these APIs without explicit imports. ```json title="tsconfig.json" { "compilerOptions": { "types": ["rstack/test/globals", "node"] } } ``` ### `rstack/test/importMeta` `rstack/test/importMeta` augments `ImportMeta` with the optional `rstest` property, providing type support for `import.meta.rstest` in in-source tests. ```json title="tsconfig.json" { "compilerOptions": { "types": ["rstack/test/importMeta", "node"] } } ``` --- url: /guide/migration.md --- > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /guide/migration.md. # Migrate to Rstack CLI To migrate an existing project, we recommend using the `migrate-to-rstack-cli` Skill. It inspects the project and automatically migrates supported tools used in the repository—including Rstack tools, Prettier, and Husky—to Rstack CLI. ## Use the migration skill First, install the Skill: ```bash npx skills add rstackjs/rstack-cli --skill migrate-to-rstack-cli ``` Then ask your coding agent to perform the migration with this prompt: ```text Use the migrate-to-rstack-cli Skill to migrate this project to Rstack CLI. ``` ## Supported tools The Skill can directly migrate the following standalone tools: - **Rstack toolchain:** [Rsbuild](https://rsbuild.rs/), [Rslib](https://rslib.rs/), [Rstest](https://rstest.rs/), [Rslint](https://rslint.rs/), and [Rspress](https://rspress.rs/) - **Code formatting:** [Prettier](https://github.com/prettier/prettier) - **Staged-file tasks:** [lint-staged](https://github.com/lint-staged/lint-staged) and [nano-staged](https://github.com/usmanyunusov/nano-staged) - **Git hooks:** [Husky](https://github.com/typicode/husky) and [simple-git-hooks](https://github.com/toplenboren/simple-git-hooks) ## Unsupported tools The Skill does not directly migrate tools outside the list above. If your project uses any of the following tools, migrate it to the corresponding Rstack tool first, then run the `migrate-to-rstack-cli` Skill: - **Application builds:** Follow the Rsbuild [webpack migration guide](https://rsbuild.rs/guide/migration/webpack), [Vite migration guide](https://rsbuild.rs/guide/migration/vite), [Create React App migration guide](https://rsbuild.rs/guide/migration/cra), or [Vue CLI migration guide](https://rsbuild.rs/guide/migration/vue-cli) to migrate the project to Rsbuild. - **Library builds:** Follow the Rslib [tsup migration guide](https://rslib.rs/guide/migration/tsup) or [tsc migration guide](https://rslib.rs/guide/migration/tsc) to migrate the library to Rslib. - **Testing:** Follow the Rstest [Jest migration guide](https://rstest.rs/guide/migration/jest) or [Vitest migration guide](https://rstest.rs/guide/migration/vitest) to migrate the project to Rstest. - **Linting:** Follow the [Rslint getting started guide](https://rslint.rs/guide/) to migrate ESLint or other linters to Rslint. --- url: /guide/testing.md --- > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /guide/testing.md. # Testing Rstack uses [Rstest](https://rstest.rs/) to run tests. ```bash rs test ``` For command-line options and subcommands, see [`rs test`](/guide/cli/test.md). ## Configure tests Register an Rstest configuration with [`define.test()`](/guide/configuration.md#define-test). It accepts the same configuration as Rstest's `defineConfig()`: ```ts title="rstack.config.ts" import { define } from 'rstack'; define.test({ testEnvironment: 'node', }); ``` ## Test APIs Import test APIs and configuration helpers from [`rstack/test`](/guide/api-reference.md#rstacktest): ```ts import { defineInlineProject, expect, test } from 'rstack/test'; ``` ## Single project For a single test project, pass the Rstest options directly to `define.test()`: ```ts title="rstack.config.ts" import { define } from 'rstack'; define.app({ // Shared application configuration }); define.test({ testEnvironment: 'happy-dom', }); ``` When `extends` is omitted, Rstack uses the Rsbuild adapter to extend the test configuration from `define.app()`. If no application configuration is defined, it uses the Rslib adapter with `define.lib()` instead. `define.app()` takes precedence when both are defined. ## Multiple projects Set Rstest's [`projects`](https://rstest.rs/config/test/projects) option to run multiple test configurations together. Entries can be inline projects or strings that Rstest resolves as external projects. ### Inline projects Use inline projects when different test environments should share the current application or library configuration: ```ts title="rstack.config.ts" import { define } from 'rstack'; import { defineInlineProject } from 'rstack/test'; define.app({ // Shared by both inline projects }); define.test({ projects: [ defineInlineProject({ name: 'node', include: ['./tests/node/**/*.test.ts'], testEnvironment: 'node', }), defineInlineProject({ name: 'dom', include: ['./tests/dom/**/*.test.tsx'], testEnvironment: 'happy-dom', }), ], }); ``` Rstack applies the corresponding adapter to each inline project that omits `extends`. A function-based `define.app()` or `define.lib()` configuration is resolved once, then shared by those inline projects. Run one project by name: ```bash rs test --project dom ``` See [`examples/rstest-inline-projects`](https://github.com/rstackjs/rstack-cli/tree/main/examples/rstest-inline-projects) for a complete React SSR example using Node.js and happy-dom. ### External projects Use a string entry for an externally configured project: ```ts title="rstack.config.ts" import { define } from 'rstack'; define.test({ projects: ['./legacy/rstest.config.ts'], }); ``` Rstack passes string entries to Rstest unchanged. External projects load their own configuration and do not inherit the current `define.app()` or `define.lib()` configuration. Use external projects when each project manages its configuration independently. ## Customize inheritance Set Rstest's [`extends`](https://rstest.rs/config/test/extends) option explicitly when a project should not inherit the current application or library configuration: ```ts title="rstack.config.ts" import { define } from 'rstack'; import { defineInlineProject } from 'rstack/test'; define.test({ projects: [ defineInlineProject({ name: 'standalone', extends: { testEnvironment: 'node', }, }), ], }); ``` Setting `extends` on an inline project disables automatic inheritance only for that project. Setting it on the root `define.test()` configuration disables automatic inheritance for the entire test configuration. --- url: /guide/formatting.md --- > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /guide/formatting.md. # Formatting Rstack CLI includes a formatter built on [Prettier](https://prettier.io/). Compared with running Prettier directly, `rs fmt` offers better performance in two ways: - **Parallel formatting**: Files are formatted concurrently in a worker pool. - **Yuku parser**: The high-performance [Yuku](https://yuku.fyi/) parser is used by default for JavaScript, JSX, and TypeScript files. - **Persistent cache**: Content-based results let later runs skip formatting unchanged files. `rs fmt` supports Prettier options and plugins and adds built-in capabilities such as [sorting package.json fields](#sort-package-json). ## Basic usage Run `rs fmt` without file arguments to format files in the current directory and save the changes: ```bash rs fmt ``` Use `--check` to verify formatting without changing files: ```bash rs fmt --check ``` See the [`rs fmt` CLI reference](/guide/cli/fmt.md) for more command-line options. ## Configuration Use [`define.fmt()`](/guide/configuration.md#define-fmt) in `rstack.config.ts` to set formatting rules. It supports all [Prettier options](https://prettier.io/docs/options): ```ts title="rstack.config.ts" import { define } from 'rstack'; define.fmt({ printWidth: 100, singleQuote: true, }); ``` In addition to Prettier options and `overrides`, Rstack provides two options: - [`ignorePatterns`](#ignore-files): exclude files with Gitignore-compatible patterns. - [`sortPackageJson`](#sort-package-json): sort fields in `package.json` files. The default value is `false`. :::warning Prettier configuration files `rs fmt` does not automatically load Prettier configuration files, `.prettierignore`, or `.editorconfig`. Keep formatting options and additional ignore rules in `define.fmt()`. To load an ignore file explicitly, use [`--ignore-path`](/guide/cli/fmt.md#--ignore-path-path). ::: ## Formatting scope `rs fmt` determines the formatting scope from the paths passed on the command line. You can combine the following inputs: - **Files**: format only the specified files. - **Directories**: scan directories recursively and format supported files. - **Glob patterns**: match multiple paths, and prefix a pattern with `!` to exclude matches. When no paths are provided, `rs fmt` formats the current directory. All glob patterns are resolved from the current working directory. Quote them so that `rs fmt`, rather than the shell, expands them: ```bash # Format a directory and a file rs fmt src package.json # Format JavaScript and TypeScript files, excluding generated files rs fmt "src/**/*.{js,ts}" "!src/generated/**" ``` When scanning directories or globs, `rs fmt` follows `.gitignore` rules, skips binary files, and does not traverse version-control directories or `node_modules`. It also skips files for which Prettier cannot infer a parser. `.gitignore` applies only when scanning directories and globs. It does not exclude files passed explicitly on the command line. To always exclude a file, use [`ignorePatterns`](#ignore-files). ## Ignore files Use `ignorePatterns` to exclude files from formatting: ```ts title="rstack.config.ts" import { define } from 'rstack'; define.fmt({ ignorePatterns: ['dist/**', 'coverage/**', '**/generated/**'], }); ``` Patterns follow Gitignore syntax and are resolved relative to the directory containing the Rstack configuration file. Because they are applied after the files are selected, they also exclude files passed explicitly on the command line. ### Lock files By default, `rs fmt` ignores common lock files, including `package-lock.json` and `pnpm-lock.yaml`. To format these files, use a negated pattern to explicitly include them: ```ts title="rstack.config.ts" import { define } from 'rstack'; define.fmt({ ignorePatterns: ['!pnpm-lock.yaml'], }); ``` ### Ignore order `rs fmt` uses the following three steps to decide which paths to format: 1. **Process command-line arguments and `.gitignore`**: It first processes the files, directories, and glob patterns passed on the command line. A glob that starts with `!` excludes matching paths. Directory and glob scans follow `.gitignore`, while files passed directly do not. Paths excluded in this step cannot be re-included later. 2. **Apply default ignore rules and `ignorePatterns`**: By default, the command ignores [lock files](#lock-files), then applies `ignorePatterns`. These rules are evaluated in order, with later rules taking precedence. For example, `!pnpm-lock.yaml` re-includes the otherwise ignored file. 3. **Apply files specified with [`--ignore-path`](/guide/cli/fmt.md#--ignore-path-path)**: Each ignore file is evaluated separately, and later rules take precedence within that file. Exclusions from different files and `ignorePatterns` are combined: if any source ignores a path, that path remains excluded, even if another source re-includes it. > Even when a file is passed directly on the command line, the default ignore rules, `ignorePatterns`, and rules from `--ignore-path` still apply. The same is true for paths specified with [`--stdin-filepath`](/guide/cli/fmt.md#--stdin-filepath-path). ## Sort package.json fields \{#sort-package-json} Enable `sortPackageJson` to sort fields in each selected `package.json` with [`sort-package-json`](https://github.com/keithamus/sort-package-json): ```ts title="rstack.config.ts" import { define } from 'rstack'; define.fmt({ sortPackageJson: true, }); ``` ## Overrides Use the `overrides` field to set options for specific files. Each override supports these fields: - `files`: files or glob patterns to match. - `options`: formatting options applied to matching files. - `excludeFiles`: optional files or glob patterns to exclude. ```ts title="rstack.config.ts" import { define } from 'rstack'; define.fmt({ overrides: [ { files: 'docs/**/*.md', excludeFiles: 'docs/generated/**', options: { proseWrap: 'always', }, }, ], }); ``` ### Pattern matching The `files` and `excludeFiles` patterns are resolved relative to the directory containing the Rstack configuration file. In `files`, a pattern without `/` matches file names at any depth, while a pattern containing `/` matches relative paths. In this example, `*.md` matches Markdown files in any directory, while `scripts/**/*.js` matches paths relative to the configuration directory: ```ts define.fmt({ overrides: [ { files: '*.md', options: { proseWrap: 'always' } }, { files: 'scripts/**/*.js', options: { singleQuote: true } }, ], }); ``` ### Merge order When multiple overrides match, they are applied in declaration order, so later values take precedence. Here, `README.md` matches both overrides, so the final `printWidth` is `80`: ```ts define.fmt({ overrides: [ { files: '*.md', options: { printWidth: 100 } }, { files: 'README.md', options: { printWidth: 80 } }, ], }); ``` ## Cache `rs fmt` uses a persistent cache by default for file-based `--write`, `--check`, and `--list-different` runs. Formatting results use file content and final formatting options, so changing either causes the file to be formatted again. Unsupported parser lookups normally use the file path and final options. For filenames without an extension, they also use file content because Prettier may infer a parser from the shebang. Installed Prettier plugins are identified by their package name, version, and entry point; local, linked, or unversioned plugins bypass the cache. The default cache directory is `.rstack/cache/fmt` under the Rstack configuration root. When a command runs from a subdirectory, it continues to use the cache next to the resolved `rstack.config.*` file. Stdin formatting does not use this cache. Use [`--cache-location `](/guide/cli/fmt.md#--cache-location-path) to store the cache in a different directory. Relative paths are resolved from the current working directory. Custom directories are excluded from file discovery but are not automatically ignored by Git. Use [`--no-cache`](/guide/cli/fmt.md#--no-cache) to run without reading, creating, or updating the cache: ```bash rs fmt --no-cache ``` You can safely delete `.rstack/cache` to clear cached results. Do not treat the entire `.rstack` directory as disposable because it may also contain user-maintained Git hook scripts. ## Prettier plugins To add formatting capabilities that are not built into Rstack, install the corresponding [Prettier plugin](https://prettier.io/docs/plugins) and add it to `plugins`. Plugins can be referenced by package name, file path, or URL. Package names and relative paths are resolved from the directory containing the Rstack configuration file. Because `rs fmt` loads plugins in workers, plugin objects cannot be passed directly. Reference each plugin by package name, path, or URL instead. For example, install and enable [`prettier-plugin-tailwindcss`](https://github.com/tailwindlabs/prettier-plugin-tailwindcss): ```sh [npm] npm install -D prettier-plugin-tailwindcss ``` ```sh [yarn] yarn add -D prettier-plugin-tailwindcss ``` ```sh [pnpm] pnpm add -D prettier-plugin-tailwindcss ``` ```sh [bun] bun add -D prettier-plugin-tailwindcss ``` ```sh [deno] deno add -D npm:prettier-plugin-tailwindcss ``` ```ts title="rstack.config.ts" import { define } from 'rstack'; define.fmt({ plugins: ['prettier-plugin-tailwindcss'], }); ``` To enable a plugin only for specific files, add `plugins` to the `options` of an [`overrides`](#overrides) entry. --- url: /guide/monorepo.md --- > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /guide/monorepo.md. # Monorepo This guide explains how to use Rstack CLI in a monorepo, including how it works with task orchestrators such as [Turborepo](https://turborepo.com/docs) and [Nx](https://nx.dev/docs/getting-started/intro). It covers managing Rstack dependencies, configuring lint, formatting, and staged-file tasks at the root, and defining separate configurations for web applications and libraries. ## Project structure The recommended setup has two levels: - The root manages the shared Rstack version, lint and formatting rules, and staged-file tasks. - Each application or library has its own [Rstack configuration](/guide/configuration.md) for build, test, or documentation configuration. ```text . ├── package.json ├── rstack.config.ts ├── apps/ │ └── web/ │ ├── package.json │ └── rstack.config.ts └── packages/ └── utils/ ├── package.json └── rstack.config.ts ``` This structure keeps the Rstack version in one place while keeping build and test configuration close to the project that uses it. ## Rstack dependency management Declare Rstack in the root `package.json` so projects use one version by default. See [Quick start](/guide/quick-start.md#install-rstack) for installation instructions. If a project needs a different Rstack version from the root, declare that version as a dependency of the project. Project-specific dependencies, such as Rsbuild plugins and testing libraries, should be declared in the projects that use them. ## Root configuration Use [`define.lint()`](/guide/configuration.md#define-lint), [`define.fmt()`](/guide/configuration.md#define-fmt), and [`define.staged()`](/guide/configuration.md#define-staged) in the root `rstack.config.ts` for checks and formatting that apply to the entire repository: ```ts title="rstack.config.ts" import { define } from 'rstack'; define.lint(async () => { const { js, ts } = await import('rstack/lint'); return [js.configs.recommended, ts.configs.recommended]; }); define.fmt({ singleQuote: true, ignorePatterns: ['**/dist/**'], }); define.staged({ '*.{js,jsx,ts,tsx,mjs,cjs}': ['rs lint', 'rs fmt'], '*.{json,md,mdx,css,html,yml,yaml}': 'rs fmt', }); ``` Expose these tasks through scripts in the root `package.json`: ```json title="package.json" { "private": true, "scripts": { "lint": "rs lint", "format": "rs fmt", "check:format": "rs fmt --check", "staged": "rs staged" } } ``` Unless the root is itself a buildable project, you do not need to add application or library build configuration to the root config. ### Project-specific lint rules If some projects need different lint rules, use [`files`](https://rslint.rs/config/#files) patterns to match the relevant files. These paths are resolved from the repository root: ```ts title="rstack.config.ts" import { define } from 'rstack'; define.lint(async () => { const { js, ts } = await import('rstack/lint'); return [ js.configs.recommended, ts.configs.recommended, { files: ['apps/web/**/*.{ts,tsx}'], rules: { '@typescript-eslint/no-explicit-any': 'off', }, }, ]; }); ``` ## Project configuration For each project that uses [Rstack commands](/guide/quick-start.md#cli-commands), create a [`rstack.config.ts`](/guide/configuration.md#configuration-file) and register only the configuration that project needs. Rstack loads the configuration from the current working directory. It does not merge a project's configuration with the root configuration. ### Web application A web application usually needs application build configuration and optional test configuration: ```ts title="apps/web/rstack.config.ts" import { define } from 'rstack'; define.app(async () => { const { pluginReact } = await import('@rsbuild/plugin-react'); return { plugins: [pluginReact()], }; }); define.test({ globals: true, }); ``` Add scripts to the application's `package.json`, for example: ```json title="apps/web/package.json" { "name": "@example/web", "scripts": { "dev": "rs dev", "build": "rs build", "preview": "rs preview", "test": "rs test" } } ``` ### Library project A library can define its build, test, and documentation configuration in one file: ```ts title="packages/utils/rstack.config.ts" import { define } from 'rstack'; define.lib({ dts: true, format: 'esm', }); define.test({ testEnvironment: 'node', }); // Configure this only when the library needs a documentation site. define.doc({ root: 'docs', title: 'Utils', }); ``` Add scripts to the library's `package.json`, for example: ```json title="packages/utils/package.json" { "name": "@example/utils", "scripts": { "build": "rs lib", "dev": "rs lib -w", "test": "rs test", "doc": "rs doc" } } ``` --- url: /guide/cli/dev.md --- > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /guide/cli/dev.md. # dev The `rs dev` command starts the [Rsbuild development server](https://rsbuild.rs/guide/basic/server) for an application. It compiles the source code in development mode, watches for changes, and applies hot module replacement (HMR) or reloads the page as needed. ## Usage ```bash rs dev [options] ``` The command loads the application configuration registered with [`define.app()`](/guide/configuration.md#define-app). ## Options `rs dev` supports the same development server options as Rsbuild. See the [Rsbuild CLI documentation](https://rsbuild.rs/guide/basic/cli#rsbuild) for details. Examples: ```bash # Start the server and open the page in the browser rs dev --open # Use port 8080 and fail if it is already in use rs dev --port 8080 --strict-port # Make the server available on the local network rs dev --host ``` ## Configuration Configure the development server through [`define.app()`](/guide/configuration.md#define-app) in the [Rstack configuration file](/guide/configuration.md#configuration-file). It accepts the standard [Rsbuild configuration](https://rsbuild.rs/config/): ```ts title="rstack.config.ts" import { define } from 'rstack'; define.app({ server: { open: true, port: 8080, }, }); ``` --- url: /guide/cli/build.md --- > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /guide/cli/build.md. # build The `rs build` command uses [Rsbuild](https://rsbuild.rs/guide/basic/cli#rsbuild-build) to build an application for production. ## Usage ```bash rs build [options] ``` The command loads the application configuration registered with [`define.app()`](/guide/configuration.md#define-app). ## Options `rs build` supports the same build options as Rsbuild. See the [Rsbuild CLI documentation](https://rsbuild.rs/guide/basic/cli#rsbuild-build) for details. Examples: ```bash # Write output files to the output directory rs build --dist-path output # Generate source maps for the output files rs build --source-map # Rebuild when files change rs build --watch ``` ## Configuration Configure the production build through [`define.app()`](/guide/configuration.md#define-app) in the [Rstack configuration file](/guide/configuration.md#configuration-file). It accepts the standard [Rsbuild configuration](https://rsbuild.rs/config/): ```ts title="rstack.config.ts" import { define } from 'rstack'; define.app({ output: { distPath: { root: 'output', }, sourceMap: true, }, }); ``` --- url: /guide/cli/preview.md --- > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /guide/cli/preview.md. # preview The `rs preview` command uses [Rsbuild](https://rsbuild.rs/guide/basic/cli#rsbuild-preview) to preview an application's production build locally. ## Usage ```bash rs preview [options] ``` The command loads the application configuration registered with [`define.app()`](/guide/configuration.md#define-app). Run [`rs build`](/guide/cli/build.md) before starting the preview server to generate the production output: ```bash rs build rs preview ``` `rs preview` is intended for local preview only. Do not use it as a production server. ## Options `rs preview` supports the same preview server options as Rsbuild. See the [Rsbuild CLI documentation](https://rsbuild.rs/guide/basic/cli#rsbuild-preview) for details. Examples: ```bash # Start the preview server and open the page in the browser rs preview --open # Use port 8080 and fail if it is already in use rs preview --port 8080 --strict-port # Make the preview server available on the local network rs preview --host ``` ## Configuration Configure the preview server through [`define.app()`](/guide/configuration.md#define-app) in the [Rstack configuration file](/guide/configuration.md#configuration-file). It accepts the standard [Rsbuild configuration](https://rsbuild.rs/config/): ```ts title="rstack.config.ts" import { define } from 'rstack'; define.app({ server: { open: true, port: 8080, }, }); ``` --- url: /guide/cli/lib.md --- > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /guide/cli/lib.md. # lib The `rs lib` command uses [Rslib](https://rslib.rs/guide/basic/cli#rslib) to build library outputs. ## Usage ```bash rs lib [command] [options] ``` The command loads the library configuration registered with [`define.lib()`](/guide/configuration.md#define-lib). When no subcommand is provided, it builds the library. ## Options `rs lib` supports the same library build options as Rslib. See the [Rslib CLI documentation](https://rslib.rs/guide/basic/cli#rslib) for details. Examples: ```bash # Build and generate declaration files rs lib --dts # Rebuild when files change rs lib --watch ``` ## Subcommands ### build [`rs lib build`](https://rslib.rs/guide/basic/cli#rslib) builds library outputs for production. It is equivalent to running `rs lib` without a subcommand. ```bash rs lib build ``` ### inspect [`rs lib inspect`](https://rslib.rs/guide/basic/cli#rslib-inspect) generates the normalized Rslib configuration and the corresponding Rsbuild and Rspack configurations for inspection. ```bash rs lib inspect ``` ### mf-dev [`rs lib mf-dev`](https://rslib.rs/guide/basic/cli#rslib-mf-dev) starts an Rsbuild development server for a library output that uses the Module Federation (`mf`) format. Use it to develop and debug the module in a host application. ```bash rs lib mf-dev ``` ## Configuration Configure library builds through [`define.lib()`](/guide/configuration.md#define-lib) in the [Rstack configuration file](/guide/configuration.md#configuration-file). It accepts the standard [Rslib configuration](https://rslib.rs/config/): ```ts title="rstack.config.ts" import { define } from 'rstack'; define.lib({ dts: true, format: 'esm', }); ``` --- url: /guide/cli/doc.md --- > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /guide/cli/doc.md. # doc The `rs doc` command uses [Rspress](https://rspress.rs/guide/start/introduction) to develop, build, and preview a documentation site. Install [`@rspress/core`](https://www.npmjs.com/package/@rspress/core) before using the command: ```sh [npm] npm install -D @rspress/core ``` ```sh [yarn] yarn add -D @rspress/core ``` ```sh [pnpm] pnpm add -D @rspress/core ``` ```sh [bun] bun add -D @rspress/core ``` ```sh [deno] deno add -D npm:@rspress/core ``` ## Usage ```bash rs doc [command] [root] [options] ``` The command loads the documentation configuration registered with [`define.doc()`](/guide/configuration.md#define-doc). When no subcommand is provided, it starts the [Rspress development server](https://rspress.rs/api/commands#rspress-dev). The optional `root` argument overrides the configured documentation root directory. ## Options `rs doc` supports the same options as the corresponding Rspress commands. See the [Rspress CLI documentation](https://rspress.rs/api/commands) for details. Examples: ```bash # Start the development server rs doc # Use a custom documentation root directory rs doc ./documentation # Start the development server on port 8080 rs doc --port 8080 ``` ## Subcommands ### build [`rs doc build`](https://rspress.rs/api/commands#rspress-build) builds the documentation site for production. ```bash rs doc build ``` ### preview [`rs doc preview`](https://rspress.rs/api/commands#rspress-preview) previews the output generated by `rs doc build` locally. ```bash rs doc build rs doc preview ``` ### eject [`rs doc eject`](https://rspress.rs/api/commands#rspress-eject) copies a built-in Rspress theme component into the project for customization. Run it without a component name to list all ejectable components. ```bash rs doc eject ``` ## Configuration Configure the documentation site through [`define.doc()`](/guide/configuration.md#define-doc) in the [Rstack configuration file](/guide/configuration.md#configuration-file). It accepts the standard [Rspress configuration](https://rspress.rs/api/config/config-basic): ```ts title="rstack.config.ts" import { define } from 'rstack'; define.doc({ root: 'docs', title: 'My Site', }); ``` --- url: /guide/cli/test.md --- > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /guide/cli/test.md. # test The `rs test` command uses [Rstest](https://rstest.rs/guide/basic/cli) to run tests. For more guidance on testing, see [Testing](/guide/testing.md). ## Usage ```bash rs test [command] [...filters] [options] ``` The command loads the test configuration registered with [`define.test()`](/guide/configuration.md#define-test). ## Options `rs test` supports the same test runtime options and filters as Rstest. See the [Rstest CLI documentation](https://rstest.rs/guide/basic/cli#cli-options) and [Filtering tests](https://rstest.rs/guide/basic/test-filter) for details. Examples: ```bash # Run a specific test file rs test tests/foo.test.ts # Run tests with names containing "login" rs test -t login # Collect code coverage rs test --coverage ``` ## Subcommands ### run [`rs test run`](https://rstest.rs/guide/basic/cli#rstest-run) runs matching tests once without watch mode. It is suitable for CI environments. ```bash rs test run ``` ### watch [`rs test watch`](https://rstest.rs/guide/basic/cli#rstest-watch) reruns related tests when a test file or its dependencies change. ```bash rs test watch ``` ### list [`rs test list`](https://rstest.rs/guide/basic/cli#rstest-list) lists matching tests without running them. ```bash rs test list ``` ### merge-reports [`rs test merge-reports`](https://rstest.rs/guide/basic/cli#rstest-merge-reports) merges blob reports generated by multiple test shards. ```bash rs test merge-reports ``` ### init [`rs test init`](https://rstest.rs/guide/basic/cli#rstest-init) initializes an Rstest configuration for a supported project type. ```bash rs test init browser ``` ## Configuration Configure tests through [`define.test()`](/guide/configuration.md#define-test) in the [Rstack configuration file](/guide/configuration.md#configuration-file). It accepts the standard [Rstest configuration](https://rstest.rs/config/): ```ts title="rstack.config.ts" import { define } from 'rstack'; define.app({ // Shared application configuration }); define.test({ setupFiles: ['./tests/rstest.setup.ts'], testEnvironment: 'happy-dom', }); ``` --- url: /guide/cli/lint.md --- > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /guide/cli/lint.md. # lint The `rs lint` command uses [Rslint](https://rslint.rs/guide/) to lint source code. ## Usage ```bash rs lint [options] [files...] ``` The command loads the lint configuration registered with [`define.lint()`](/guide/configuration.md#define-lint). ## Options `rs lint` supports the same command-line options as Rslint. See the [Rslint CLI documentation](https://rslint.rs/guide/cli) for details. Examples: ```bash # Lint a specific directory rs lint src # Automatically fix problems rs lint --fix # Lint and run TypeScript type checking rs lint --type-check ``` ## Configuration Configure linting through [`define.lint()`](/guide/configuration.md#define-lint) in the [Rstack configuration file](/guide/configuration.md#configuration-file). It accepts the standard [Rslint configuration](https://rslint.rs/config/). Presets and plugins can be imported from `rstack/lint` on demand: ```ts title="rstack.config.ts" import { define } from 'rstack'; define.lint(async () => { const { js, ts } = await import('rstack/lint'); return [js.configs.recommended, ts.configs.recommended]; }); ``` --- url: /guide/cli/fmt.md --- > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /guide/cli/fmt.md. # fmt The `rs fmt` command formats files or checks whether they are formatted. For detailed usage, see [Formatting](/guide/formatting.md). ## Usage ```bash rs fmt [options] [files/globs...] ``` Pass files, directories, or glob patterns to choose what to format. When no paths are provided, `rs fmt` formats the current directory. See [Formatting scope](/guide/formatting.md#formatting-scope) for path resolution and ignore rules. Examples: ```bash # Format files in the current directory rs fmt # Format specific files and directories rs fmt src package.json # Check formatting in CI rs fmt --check ``` `rs format` is an alias for `rs fmt`: ```bash rs format ``` ## Options ### `--check` Check whether files are formatted without changing them. The output lists files with formatting issues and includes a human-friendly summary, making this option useful in CI: ```bash rs fmt --check ``` `--check` cannot be combined with `--write` or `--list-different`. The command uses the following exit codes: | Code | Meaning | | ---- | -------------------------------------------------- | | `0` | The command completed successfully. | | `1` | One or more files have formatting issues. | | `2` | The command could not run or encountered an error. | ### `-h, --help` Display usage and option information without formatting files: ```bash rs fmt --help ``` ### `--ignore-path ` Use `--ignore-path` to load additional Gitignore-compatible rules from a file. Relative ignore-file paths are resolved from the current working directory. Rules inside a file are resolved from the directory containing that file. For example, run the following command from the project root: ```bash rs fmt --ignore-path config/format.ignore ``` If `config/format.ignore` contains this rule: ```text title="config/format.ignore" generated/** ``` Here, `config/format.ignore` is located relative to the project root. The `generated/**` rule is relative to `config/`. It therefore ignores `config/generated/**` instead of `generated/**` in the project root. Loaded rules apply to scanned paths, explicitly passed files, and `--stdin-filepath`. To load multiple ignore files, repeat the option: ```bash rs fmt --ignore-path .prettierignore --ignore-path config/format.ignore ``` Each file acts as a separate ignore source. See [Ignore order](/guide/formatting.md#ignore-order) for how these sources combine with `.gitignore`, default ignore rules, and `ignorePatterns`. ### `--ignore-unknown` Ignore matched files when no parser can be inferred. This allows the command to exit successfully even when every matched file has an unknown type: ```bash rs fmt --ignore-unknown ``` The short option `-u` is an alias for `--ignore-unknown`. ```bash rs fmt -u ``` This option does not suppress errors for unmatched paths or globs. Combine it with [`--no-error-on-unmatched-pattern`](#--no-error-on-unmatched-pattern) when an integration needs to tolerate both cases. When used with `--stdin-filepath`, unsupported input is skipped without writing output. ### `--list-different` Print the paths of unformatted files without the summary produced by `--check`. This is useful when another command needs to consume the output: ```bash rs fmt --list-different ``` The short option `-l` is an alias for `--list-different`: ```bash rs fmt -l ``` The option uses the same exit codes as `--check` and cannot be combined with `--write` or `--check`. ### `--no-cache` Disable the persistent formatting cache for the current invocation: ```bash rs fmt --no-cache ``` Without this option, `rs fmt` stores cache data in `.rstack/cache/fmt` under the Rstack configuration root. `--no-cache` prevents the command from reading, creating, or updating that cache. Stdin formatting never uses the persistent cache. See [Cache](/guide/formatting.md#cache) for cache behavior and cleanup guidance. ### `--cache-location ` Store the persistent cache in a custom directory: ```bash rs fmt --cache-location .cache/rs-fmt ``` Relative paths are resolved from the current working directory, while absolute paths are used as-is. The directory is created as needed and excluded from file discovery. Unlike the default cache location, a custom directory does not receive an automatic `.gitignore`; exclude it from version control or manage it through your CI cache configuration. When both options are provided, `--no-cache` takes precedence and the custom directory is not excluded from file discovery. ### `--no-error-on-unmatched-pattern` Exit successfully without diagnostics when no files match the provided paths or globs, including when all matching files are ignored: ```bash rs fmt --no-error-on-unmatched-pattern 'src/**/*.ts' ``` For example, a pre-commit script may always run `rs fmt`, even when the staged changes contain no supported files. This option lets the command exit successfully in that case instead of blocking the commit. > [`rs staged`](/guide/cli/staged.md) enables this behavior automatically for its `rs fmt` tasks. ### `--parallel-workers ` Set the maximum number of formatting workers to a positive integer: ```bash rs fmt --parallel-workers 4 ``` When this option is omitted, `rs fmt` automatically chooses up to eight workers based on the available CPU parallelism and the number of matched files. Set a lower value to limit CPU or memory usage in constrained environments. ### `--stdin-filepath ` Format content received from stdin as if it were saved at ``, for example when integrating with an editor. The path determines the parser and matching [configuration overrides](/guide/formatting.md#overrides), but it does not need to exist on disk: ```bash cat src/index.ts | rs fmt --stdin-filepath src/index.ts ``` Formatted output is written to stdout and diagnostics to stderr. If the input path is ignored, `rs fmt` skips formatting and writes the input unchanged. If it cannot infer a parser from the path or parse the content, it reports an error and exits with code `2`. > `--stdin-filepath` cannot be combined with file arguments or with `--write`, `--check`, or `--list-different`. ### `--with-node-modules` Process files inside `node_modules`, which `rs fmt` excludes by default: ```bash rs fmt --with-node-modules node_modules/example/index.js ``` This option only disables the built-in `node_modules` exclusion. Directory and glob scans still follow `.gitignore`, while `ignorePatterns` and `--ignore-path` continue to apply to every input. ### `--write` Write formatted files in place. This is the default mode, so specifying `--write` is optional: ```bash rs fmt src --write ``` The short option `-w` is an alias for `--write`: ```bash rs fmt -w src ``` `--write` cannot be combined with `--check` or `--list-different`. --- url: /guide/cli/setup.md --- > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /guide/cli/setup.md. # setup The `rs setup` command installs repository-level [Git hooks](https://git-scm.com/docs/githooks) and runs them in the project that invokes the command. ## Usage ```bash rs setup [options] ``` By default, hook scripts are stored in `.rstack/hooks`, relative to the Git repository root. If the current directory is not inside a Git repository, the command skips installation. Add `rs setup` to the `prepare` script of the project that should manage the repository hooks: ```json title="package.json" { "scripts": { "prepare": "rs setup" } } ``` Run the script once to generate the hook files: ```sh [npm] npm run prepare ``` ```sh [yarn] yarn run prepare ``` ```sh [pnpm] pnpm run prepare ``` ```sh [bun] bun run prepare ``` For example, create a `pre-commit` hook that runs [`rs staged`](/guide/cli/staged.md): ```sh title=".rstack/hooks/pre-commit" rs staged ``` :::warning Existing Git hook managers `rs setup` updates the repository's [`core.hooksPath`](https://git-scm.com/docs/git-config#Documentation/git-config.txt-corehooksPath). It skips installation when another hooks path or existing Git hook is detected. Migrate the required hooks and remove the existing hooks configuration before running the command. ::: ## Options ### `--hooks-dir` Sets the directory for hook scripts, relative to the Git repository root. ```bash rs setup --hooks-dir config/git-hooks # Quote paths that contain spaces rs setup --hooks-dir "config/git hooks" ``` When using a custom directory, add the full command to the `prepare` script of the project that manages hooks: ```json title="package.json" { "scripts": { "prepare": "rs setup --hooks-dir config/git-hooks" } } ``` > To prevent Git hook files from being created or overwritten outside the repository through parent directory paths, the path must not contain `..`. ### `--help` `--help` (or `-h`) displays the command's usage and options. ```bash rs setup --help ``` ## Hook files The default directory structure is: ```text .rstack/ └── hooks/ ├── pre-commit # Repository hook script: edit and commit └── _/ # Generated by rs setup; ignored by Git ├── .gitignore ├── .owner ├── runner ├── pre-commit ├── commit-msg └── ... ``` Files next to `_` are repository hook scripts. The `_` directory contains generated files and is ignored by Git. `rs setup` points `core.hooksPath` to `.rstack/hooks/_`; rerun it after cloning the repository or when generated files are missing. ## Supported hooks Rstack supports these client-side Git hooks: - `pre-commit` - `pre-merge-commit` - `prepare-commit-msg` - `commit-msg` - `post-commit` - `applypatch-msg` - `pre-applypatch` - `post-applypatch` - `pre-rebase` - `post-rewrite` - `post-checkout` - `post-merge` - `pre-push` - `pre-auto-gc` Create a file with the matching name next to the `_` directory. ## Hook runtime Rstack runs hook scripts with POSIX `sh -e`, forwards Git's arguments and standard input, and returns the hook's exit code. Before running a hook, it changes to the project that installed the hooks and prepends that project's `node_modules/.bin` to `PATH`. ### Disable and debug Set `RSTACK_HOOKS=0` to skip installation or hook execution: ```bash RSTACK_HOOKS=0 git commit -m "Skip hooks" ``` Set `RSTACK_HOOKS=2` to trace Rstack's hook runtime, including how it invokes the hook script and handles its exit code; to trace commands inside the hook script, add `set -x` to the script: ```bash RSTACK_HOOKS=2 git commit -m "Trace hooks" ``` ### Configure the hook environment Before running a hook script, Rstack loads this optional POSIX shell file: ```text ${XDG_CONFIG_HOME:-$HOME/.config}/rstack/hooks-init.sh ``` Use it to initialize a Node.js version manager, update `PATH`, or set `RSTACK_HOOKS=0` for the current user. ## Monorepo In a monorepo, the project that provides Rstack may be located in a subdirectory such as `frontend/`. Running `rs setup` from that directory still installs hooks at the Git repository root: ```text repo/.rstack/hooks/ repo/.rstack/hooks/_/ core.hooksPath=.rstack/hooks/_ ``` Rstack records `frontend` as the project that owns the hooks. Hook scripts remain at the repository root, but run from `frontend`, so they can use its configuration and dependencies without an explicit `cd`: ```sh title=".rstack/hooks/pre-commit" rs staged ``` A Git repository has one hooks owner. Only that project should include `rs setup` in its `prepare` script. Calls from another project are skipped with a warning. To change the owner, remove `rs setup` from the previous project's `prepare` script, delete the generated `_` directory, and then run `rs setup` from the new project. ## Remove hooks To remove Rstack-managed hooks: 1. Remove `rs setup` from the `prepare` script. 2. Unset the repository's hooks path: ```bash git config --local --unset core.hooksPath ``` 3. Delete `.rstack/hooks/`, or the directory passed to `--hooks-dir`. ## Troubleshooting ### Hook does not run - Check that the hook script has a [supported name](#supported-hooks) and is next to the `_` directory. - Run `git config --local --get core.hooksPath` and verify the configured path. - Rerun `rs setup` to restore generated files and executable permissions. - Check that `RSTACK_HOOKS` is not set to `0` in the environment or initialization file. - If another hooks setup is reported, migrate or remove the conflicting setup before rerunning the command. - If another Rstack owner is reported, follow the ownership transfer steps in [Monorepo](#monorepo). Hook scripts do not need to be executable because Rstack runs them with `sh`. ### Command not found For exit code 127, Rstack prints the effective `PATH`. If a GUI Git client cannot find Node.js or the package manager, initialize them in `hooks-init.sh`. ### Windows and Yarn On Windows, hooks run in the POSIX shell included with [Git for Windows](https://gitforwindows.org/). Use LF line endings and `/` path separators in hooks. [Yarn PnP](https://yarnpkg.com/features/pnp) does not provide `node_modules/.bin`. Run tools through a Yarn script, such as `yarn run test`, and make Node.js and Yarn available through `hooks-init.sh` when needed. --- url: /guide/cli/staged.md --- > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /guide/cli/staged.md. # staged The `rs staged` command uses [lint-staged](https://github.com/lint-staged/lint-staged) to run tasks against files staged in Git. `rs staged` can run linters, formatters, or other checks on staged files before committing code. A common pattern is to pair `rs staged` with [`rs setup`](/guide/cli/setup.md) and run staged-file tasks from a `pre-commit` hook. ## Usage ```bash rs staged [options] ``` The command loads the staged-file tasks registered with [`define.staged()`](/guide/configuration.md#define-staged). ## Options ### `--allow-empty` `--allow-empty` allows an empty commit when tasks revert all staged changes. ```bash rs staged --allow-empty ``` ### `--concurrent` `--concurrent` (or `-p`) sets how many tasks run concurrently; use `false` to run them serially. ```bash rs staged --concurrent false ``` ### `--cwd` `--cwd` sets the working directory used to run all tasks. ```bash rs staged --cwd packages/app ``` ### `--debug` `--debug` (or `-d`) prints additional debug information. ```bash rs staged --debug ``` ### `--no-stash` `--no-stash` disables the backup stash and automatic reversion when a task fails. ```bash rs staged --no-stash ``` ### `--quiet` `--quiet` (or `-q`) disables lint-staged's own console output. ```bash rs staged --quiet ``` ### `--relative` `--relative` (or `-r`) passes file paths relative to the working directory to tasks. ```bash rs staged --relative ``` ### `--verbose` `--verbose` (or `-v`) shows task output even when tasks succeed; by default, only output from failed tasks is displayed. ```bash rs staged --verbose ``` ### `--help` `--help` (or `-h`) displays the command's usage and options. ```bash rs staged --help ``` ## Configuration Configure staged-file tasks through [`define.staged()`](/guide/configuration.md#define-staged) in the [Rstack configuration file](/guide/configuration.md#configuration-file). It accepts the standard [lint-staged configuration](https://github.com/lint-staged/lint-staged#configuration): ```ts title="rstack.config.ts" import { define } from 'rstack'; define.staged({ '*.{js,jsx,ts,tsx}': ['rs lint', 'rs fmt'], '*.{json,md,mdx,css,html}': 'rs fmt', }); ``` --- url: /index.md --- > For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /index.md. ![background](https://assets.rspack.rs/rspack/assets/landingpage-background-compressed.png) ![logo](https://assets.rspack.rs/rspack/rspack-logo.svg) # Rstack CLI The Unified JavaScript Toolchain One CLI, one configuration, one consistent workflow Quick start[GitHubGitHub](https://github.com/rstackjs/rstack-cli) [![One CLI](/static/svg/Speedometer.e6ce5b2c32.svg)### One CLI Develop, build, test, lint, format code, build libraries, and serve docs with the rs command. ](/guide/quick-start#cli-commands) [![One Configuration](/static/svg/Lightning.7b8c41ecd3.svg)### One Configuration Configure the whole toolchain from a single rstack.config.ts file. ](/guide/configuration) [![Rstack Powered](/static/svg/FrameCheck.ccc904a9ef.svg)### Rstack Powered Built on Rspack, Rsbuild, Rslib, Rstest, Rslint, and Rspress. ](/guide/configuration) [![Workflow Friendly](data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgMTI4IDEyOCIgd2lkdGg9IjQyNCIKICBoZWlnaHQ9IjQyNCIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIKICBzdHlsZT0id2lkdGg6IDEwMCU7IGhlaWdodDogMTAwJTsgdHJhbnNmb3JtOiB0cmFuc2xhdGUzZCgwcHgsIDBweCwgMHB4KTsgY29udGVudC12aXNpYmlsaXR5OiB2aXNpYmxlOyBiYWNrZ3JvdW5kLWNvbG9yOiB0cmFuc3BhcmVudDsiPgogIDxkZWZzPgogICAgPGNsaXBQYXRoIGlkPSJfX2xvdHRpZV9lbGVtZW50XzMzIj4KICAgICAgPHJlY3Qgd2lkdGg9IjEyOCIgaGVpZ2h0PSIxMjgiIHg9IjAiIHk9IjAiIC8+CiAgICA8L2NsaXBQYXRoPgogIDwvZGVmcz4KICA8ZyBjbGlwLXBhdGg9InVybCgjX19sb3R0aWVfZWxlbWVudF8zMykiPgogICAgPGcgdHJhbnNmb3JtPSJtYXRyaXgoMC43NDAwMDAwMDk1MzY3NDMyLDAsMCwwLjc0MDAwMDAwOTUzNjc0MzIsMjMuMjk5OTk5MjM3MDYwNTQ3LDM4Ljg0MDAwMDE1MjU4Nzg5KSIgb3BhY2l0eT0iMSIKICAgICAgc3R5bGU9ImRpc3BsYXk6IGJsb2NrOyI+CiAgICAgIDxnIG9wYWNpdHk9IjEiIHRyYW5zZm9ybT0ibWF0cml4KDEsMCwwLDEsMjcsMzQpIj4KICAgICAgICA8cGF0aCBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0ibWl0ZXIiIGZpbGwtb3BhY2l0eT0iMCIgc3Ryb2tlLW1pdGVybGltaXQ9IjQiCiAgICAgICAgICBzdHJva2U9InJnYigyNTUsMTM4LDApIiBzdHJva2Utb3BhY2l0eT0iMSIgc3Ryb2tlLXdpZHRoPSI1IgogICAgICAgICAgZD0iIE0xMCwtMjcgQzEwLC0yNyAxNCwtMjcgMTQsLTI3IEMxNi44Mjc5OTkxMTQ5OTAyMzQsLTI3IDE4LjI0MzAwMDAzMDUxNzU3OCwtMjcgMTkuMTIxMDAwMjg5OTE2OTkyLC0yNi4xMjEwMDAyODk5MTY5OTIgQzIwLC0yNS4yNDMwMDAwMzA1MTc1NzggMjAsLTIzLjgyNzk5OTExNDk5MDIzNCAyMCwtMjEgQzIwLC0yMSAyMCwtMTMuNSAyMCwtMTMuNSBNLTEwLC0yNyBDLTEwLC0yNyAtMTQsLTI3IC0xNCwtMjcgQy0xNi44Mjc5OTkxMTQ5OTAyMzQsLTI3IC0xOC4yNDMwMDAwMzA1MTc1NzgsLTI3IC0xOS4xMjEwMDAyODk5MTY5OTIsLTI2LjEyMTAwMDI4OTkxNjk5MiBDLTIwLC0yNS4yNDMwMDAwMzA1MTc1NzggLTIwLC0yMy44Mjc5OTkxMTQ5OTAyMzQgLTIwLC0yMSBDLTIwLC0yMSAtMjAsLTEzLjUgLTIwLC0xMy41IE0tMjAsMTMuNSBDLTIwLDEzLjUgLTIwLDIxIC0yMCwyMSBDLTIwLDIzLjgyNzk5OTExNDk5MDIzNCAtMjAsMjUuMjQzMDAwMDMwNTE3NTc4IC0xOS4xMjEwMDAyODk5MTY5OTIsMjYuMTIxMDAwMjg5OTE2OTkyIEMtMTguMjQzMDAwMDMwNTE3NTc4LDI3IC0xNi44Mjc5OTkxMTQ5OTAyMzQsMjcgLTE0LDI3IEMtMTQsMjcgLTEwLDI3IC0xMCwyNyBNMTAsMjcgQzEwLDI3IDE0LDI3IDE0LDI3IEMxNi44Mjc5OTkxMTQ5OTAyMzQsMjcgMTguMjQzMDAwMDMwNTE3NTc4LDI3IDE5LjEyMTAwMDI4OTkxNjk5MiwyNi4xMjEwMDAyODk5MTY5OTIgQzIwLDI1LjI0MzAwMDAzMDUxNzU3OCAyMCwyMy44Mjc5OTkxMTQ5OTAyMzQgMjAsMjEgQzIwLDIxIDIwLDEzLjUgMjAsMTMuNSIgLz4KICAgICAgPC9nPgogICAgPC9nPgogICAgPGcgdHJhbnNmb3JtPSJtYXRyaXgoMC43NDAwMDAwMDk1MzY3NDMyLDAsMCwwLjc0MDAwMDAwOTUzNjc0MzIsNjQuNzM5OTk3ODYzNzY5NTMsMzguODQwMDAwMTUyNTg3ODkpIiBvcGFjaXR5PSIxIgogICAgICBzdHlsZT0iZGlzcGxheTogYmxvY2s7Ij4KICAgICAgPGcgb3BhY2l0eT0iMSIgdHJhbnNmb3JtPSJtYXRyaXgoMSwwLDAsMSwyNywzNCkiPgogICAgICAgIDxwYXRoIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJtaXRlciIgZmlsbC1vcGFjaXR5PSIwIiBzdHJva2UtbWl0ZXJsaW1pdD0iNCIKICAgICAgICAgIHN0cm9rZT0icmdiKDI1NSwxMzgsMCkiIHN0cm9rZS1vcGFjaXR5PSIxIiBzdHJva2Utd2lkdGg9IjUiCiAgICAgICAgICBkPSIgTS0yMCwtMTMuNSBDLTIwLC0xMy41IC0yMCwtMjEgLTIwLC0yMSBDLTIwLC0yMy44Mjc5OTkxMTQ5OTAyMzQgLTIwLC0yNS4yNDMwMDAwMzA1MTc1NzggLTE5LjEyMTAwMDI4OTkxNjk5MiwtMjYuMTIxMDAwMjg5OTE2OTkyIEMtMTguMjQzMDAwMDMwNTE3NTc4LC0yNyAtMTYuODI3OTk5MTE0OTkwMjM0LC0yNyAtMTQsLTI3IEMtMTQsLTI3IDE0LC0yNyAxNCwtMjcgQzE2LjgyNzk5OTExNDk5MDIzNCwtMjcgMTguMjQzMDAwMDMwNTE3NTc4LC0yNyAxOS4xMjEwMDAyODk5MTY5OTIsLTI2LjEyMTAwMDI4OTkxNjk5MiBDMjAsLTI1LjI0MzAwMDAzMDUxNzU3OCAyMCwtMjMuODI3OTk5MTE0OTkwMjM0IDIwLC0yMSBDMjAsLTIxIDIwLDIxIDIwLDIxIEMyMCwyMy44Mjc5OTkxMTQ5OTAyMzQgMjAsMjUuMjQzMDAwMDMwNTE3NTc4IDE5LjEyMTAwMDI4OTkxNjk5MiwyNi4xMjEwMDAyODk5MTY5OTIgQzE4LjI0MzAwMDAzMDUxNzU3OCwyNyAxNi44Mjc5OTkxMTQ5OTAyMzQsMjcgMTQsMjcgQzE0LDI3IC0xNCwyNyAtMTQsMjcgQy0xNi44Mjc5OTkxMTQ5OTAyMzQsMjcgLTE4LjI0MzAwMDAzMDUxNzU3OCwyNyAtMTkuMTIxMDAwMjg5OTE2OTkyLDI2LjEyMTAwMDI4OTkxNjk5MiBDLTIwLDI1LjI0MzAwMDAzMDUxNzU3OCAtMjAsMjMuODI3OTk5MTE0OTkwMjM0IC0yMCwyMSBDLTIwLDIxIC0yMCwxMy41IC0yMCwxMy41IiAvPgogICAgICA8L2c+CiAgICA8L2c+CiAgICA8ZyB0cmFuc2Zvcm09Im1hdHJpeCgwLjc0MDAwMDAwOTUzNjc0MzIsMCwwLDAuNzQwMDAwMDA5NTM2NzQzMiw0MC42ODk5OTg2MjY3MDg5ODQsNTIuOTAwMDAxNTI1ODc4OTA2KSIgb3BhY2l0eT0iMSIKICAgICAgc3R5bGU9ImRpc3BsYXk6IGJsb2NrOyI+CiAgICAgIDxnIG9wYWNpdHk9IjEiIHRyYW5zZm9ybT0ibWF0cml4KDEsMCwwLDEsNTguNSwxNSkiPgogICAgICAgIDxwYXRoIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgZmlsbC1vcGFjaXR5PSIwIiBzdHJva2U9InJnYigyNDksNTcsMzIpIiBzdHJva2Utb3BhY2l0eT0iMSIKICAgICAgICAgIHN0cm9rZS13aWR0aD0iNiIgZD0iIE0tNCw4IEMtNCw4IDQsMCA0LDAgQzQsMCAtNCwtOCAtNCwtOCIgLz4KICAgICAgPC9nPgogICAgICA8ZyBvcGFjaXR5PSIxIiB0cmFuc2Zvcm09Im1hdHJpeCgxLDAsMCwxLDAsMCkiPgogICAgICAgIDxwYXRoIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJtaXRlciIgZmlsbC1vcGFjaXR5PSIwIiBzdHJva2UtbWl0ZXJsaW1pdD0iNCIKICAgICAgICAgIHN0cm9rZT0icmdiKDI0OSw1NywzMikiIHN0cm9rZS1vcGFjaXR5PSIxIiBzdHJva2Utd2lkdGg9IjYiIGQ9IiBNMy41LDE1IEMzLjUsMTUgNjIuNSwxNSA2Mi41LDE1IiAvPgogICAgICA8L2c+CiAgICA8L2c+CiAgPC9nPgo8L3N2Zz4=)### Workflow Friendly Keep using your preferred runtime, package manager, and task runner. ](/guide/quick-start) # Rstack The fast, unified JavaScript toolchain for developers and agents [![Rspack](https://assets.rspack.rs/rspack/rspack-logo.svg)RspackA fast Rust-based bundler for the web, with a modernized webpack API rspack.rs](https://rspack.rs)[![Rsbuild](https://assets.rspack.rs/rsbuild/rsbuild-logo.svg)RsbuildA fast, extensible build tool for modern web development, powered by Rspack rsbuild.rs](https://rsbuild.rs)[![Rslib](https://assets.rspack.rs/rslib/rslib-logo.svg)RslibAn Rsbuild-based library development tool for creating libraries and UI components rslib.rs](https://rslib.rs)[![Rspress](https://assets.rspack.rs/rspress/rspress-logo-480x480.png)RspressAn Rsbuild-based static site generator for creating documentation sites rspress.rs](https://rspress.rs)[![Rsdoctor](https://assets.rspack.rs/rsdoctor/rsdoctor-logo-480x480.png)RsdoctorAn AI-friendly build analyzer that makes the build process transparent rsdoctor.rs](https://rsdoctor.rs)[![Rstest](https://assets.rspack.rs/rstest/rstest-logo.svg)RstestA JavaScript testing framework powered by Rspack, with a Jest-compatible API rstest.rs](https://rstest.rs/)[![Rslint](https://assets.rspack.rs/rslint/rslint-logo.svg)RslintA high-performance, ESLint-compatible linter for JavaScript and TypeScript rslint.rs](https://rslint.rs/) ## Guide - [Quick start](/guide/quick-start) - [Configuration](/guide/configuration) ## Commands - [rs build](/guide/cli/build) - [rs lib](/guide/cli/lib) - [rs test](/guide/cli/test) - [rs lint](/guide/cli/lint) - [rs doc](/guide/cli/doc) ## Ecosystem - [Rsbuild](https://rsbuild.rs/) - [Rslib](https://rslib.rs/) - [Rstest](https://rstest.rs/) - [Rslint](https://rslint.rs/) - [Rspress](https://rspress.rs/) ## Community - [GitHub](https://github.com/rstackjs/rstack-cli) - [npm](https://www.npmjs.com/package/rstack) - [Discord](https://discord.gg/XsaKEEk4mW) Rstack CLI is free and open source software released under the MIT license. © 2026 Rstack contributors.