Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions .agents/skills/rstack-cli-best-practices/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description: Guidance on using Rstack CLI, including `rs` commands, the `rstack.

Rstack CLI is the `rstack` package, exposed through the `rs` binaries. It provides one CLI, one config file, and a consistent workflow for the Rstack JavaScript toolchain.

It covers web app, library, docs, test, lint, and staged-file workflows.
It covers web app, library, docs, test, lint, formatting, Git hook, and staged-file workflows.

## Commands

Expand All @@ -22,11 +22,13 @@ Use `rs -h` for top-level help, and `rs <command> -h` for command help where sup
| `rs doc` | Serve or build docs | Rspress | `define.doc` |
| `rs test` | Run tests | Rstest | `define.test` |
| `rs lint` | Lint code | Rslint | `define.lint` |
| `rs fmt` | Format code | Prettier | `define.fmt` |
| `rs setup` | Install project-local Git hooks | None | None |
| `rs staged` | Run tasks on staged Git files | lint-staged | `define.staged` |

Key behavior:

- `rs test` extends `define.app` through `@rstest/adapter-rsbuild` and `define.lib` through `@rstest/adapter-rslib` unless `define.test` already sets `extends`.
- Unless `define.test` already sets `extends`, `rs test` extends `define.app` through `@rstest/adapter-rsbuild` or falls back to `define.lib` through `@rstest/adapter-rslib`. The app config takes precedence when both are defined.
- `rs doc` requires the optional `@rspress/core` dependency.

## rstack.config.ts
Expand All @@ -52,6 +54,7 @@ define.test({
- `define.doc(config)`: Rspress config for `rs doc`; Docs: https://rspress.rs/api/config/config-basic
- `define.test(config)`: Rstest config for `rs test`; Docs: https://rstest.rs/config/
- `define.lint(config)`: Rslint config for `rs lint`; Docs: https://rslint.rs/config/
- `define.fmt(config)`: Formatting options for `rs fmt`.
- `define.staged(config)`: lint-staged config for `rs staged`; accepts `Record<string, string | string[]>`.

### Lazy Configuration
Expand All @@ -75,9 +78,15 @@ Prefer Rstack-exported paths:

| Instead of | Prefer |
| ------------------------- | ------------------------ |
| `@rsbuild/core` | `rstack/app` |
| `@rslib/core` | `rstack/lib` |
| `@rstest/core` | `rstack/test` |
| `@rslint/core` | `rstack/lint` |
| `@rsbuild/core/types` | `rstack/types` |
| `@rslib/core/types` | `rstack/types` |
| `@rstest/core/globals` | `rstack/test/globals` |
| `@rstest/core/importMeta` | `rstack/test/importMeta` |

## Git Hooks

Use [`rs setup`](https://rstack.rs/guide/cli/setup) for project-local Git hooks, commonly with `rs staged` in a `pre-commit` hook.
3 changes: 0 additions & 3 deletions .prettierignore

This file was deleted.

3 changes: 0 additions & 3 deletions .prettierrc

This file was deleted.

2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"recommendations": ["rstack.rslint", "esbenp.prettier-vscode"]
"recommendations": ["rstack.rslint"]
}
1 change: 0 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"search.useIgnoreFiles": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"cSpell.words": ["rstack", "rstackjs"]
}
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"scripts": {
"build": "rs lib",
"dev": "rs lib -w",
"lint": "rs lint && prettier -c .",
"lint:write": "rs lint --fix && prettier -w .",
"lint": "rs lint && rs fmt --check",
"lint:write": "rs lint --fix && rs fmt",
"test": "rs test",
"prepare": "rs setup",
"bump": "pnpx bumpp"
Expand All @@ -27,8 +27,7 @@
"@types/node": "^24.13.2",
"fresh-import": "^0.2.1",
"jiti": "^2.7.0",
"prettier": "^3.9.4",
"rstack": "^0.2.0",
"rstack": "^0.3.2",
"typescript": "^7.0.2"
},
"peerDependencies": {
Expand Down
Loading