Skip to content

Commit a6df127

Browse files
authored
docs: improve Rstack CLI migration skill (#287)
1 parent 2719f29 commit a6df127

5 files changed

Lines changed: 15 additions & 10 deletions

File tree

.agents/skills/migrate-to-rstack-cli/SKILL.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ Read every matching reference before editing. Load only the tools present in the
2424

2525
1. Inspect manifests, workspace catalogs, lock files, scripts, standalone configs, ignore files, Git hooks, TypeScript `types`, and source imports.
2626
2. Read the matching references and inventory behavior that must survive: config functions, CLI arguments, plugins, presets, adapters, custom config paths, and chained commands.
27-
3. Check the latest `rstack` version and inspect its Node.js engine and underlying tool versions. Resolve plugin and adapter peer ranges first; upgrade incompatible extensions or stop when no compatible version exists. Add `rstack` using the repository's existing package manager and version convention, usually as a development dependency.
27+
3. Check the latest `rstack` release, Node.js engine, underlying tool versions, and relevant peer ranges. Upgrade incompatible plugins or adapters; stop if no compatible version exists. Ensure development and CI use supported Node.js versions, but do not narrow a published package's runtime `engines` solely to satisfy Rstack. Add `rstack` as a development dependency with the existing package manager.
2828
4. If a matching reference uses a `define.*` registration, create `rstack.config.ts` and move the standalone configuration into it.
2929
5. Rewrite commands and imports as directed by the references.
30-
6. Search again for old direct imports, binaries, config paths, manifest entries, and type references. Remove only entries with no remaining direct or runtime use and no unresolved peer compatibility requirement.
30+
6. Search again for old imports, binaries, config paths, manifest entries, package-manager metadata, and type references. Remove an item only after ruling out direct or runtime use and unresolved peer constraints.
3131
7. Delete a standalone config only after its behavior is represented in `rstack.config.*`.
3232
8. Refresh the lockfile with the repository's package manager. Confirm the expected tool version changes and resolve peer dependency warnings.
33-
9. Run the repository's existing migrated scripts and required checks. Compare generated artifacts or runtime behavior where relevant.
33+
9. Run migrated scripts and required repository checks. Compare generated artifacts or runtime behavior where relevant. After any follow-up changes, rerun the relevant checks against the final code.
3434

35-
The underlying Rsbuild, Rslib, Rstest, Rslint, and Prettier packages remain transitive dependencies of `rstack`. Do not require their names to disappear from the lockfile; require obsolete direct manifest entries and imports to disappear.
35+
Rsbuild, Rslib, Rstest, Rslint, and Prettier remain transitive `rstack` dependencies. Remove obsolete direct dependencies and imports from the migrated scope; do not expect their names to disappear from the lockfile.
3636

3737
## Configuration Rules
3838

.agents/skills/migrate-to-rstack-cli/references/git-hooks.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ Migrate [Husky](https://typicode.github.io/husky/) or [simple-git-hooks](https:/
1010
4. Ensure the `prepare` script in the root `package.json` runs `rs setup`, adding it if necessary. Remove the old installer invocation from any lifecycle script while preserving other commands. Use `--hooks-dir` consistently when choosing a custom directory.
1111
5. Run the updated lifecycle script, exercise the migrated hooks, and remove the old dependency and configuration only after behavior matches.
1212

13+
`rs setup` creates `.rstack/hooks/_/.gitignore`. Do not list `.rstack/hooks/_` in the root `.gitignore`.
14+
1315
## Husky
1416

1517
1. Locate the source hooks:
@@ -42,7 +44,7 @@ pnpm test
4244
3. Replace the simple-git-hooks lifecycle command with `rs setup`, preserving other chained commands.
4345
4. Replace `SKIP_INSTALL_SIMPLE_GIT_HOOKS=1` and `SKIP_SIMPLE_GIT_HOOKS=1` usage with `RSTACK_HOOKS=0`. Move required commands from the file referenced by `SIMPLE_GIT_HOOKS_RC` to the Rstack user initialization file, with user permission.
4446
5. Do not run the simple-git-hooks uninstall script after `rs setup`; it follows the current `core.hooksPath` and can delete Rstack's generated hook shims.
45-
6. After validation, remove the simple-git-hooks dependency, configuration, and installer command. Remove old generated hook files only after confirming their ownership and exact paths.
47+
6. After validation, remove the simple-git-hooks dependency, config, installer, and stale package-manager metadata such as pnpm `allowBuilds`. Remove old generated hook files only after confirming their ownership and paths.
4648

4749
For example, migrate:
4850

.agents/skills/migrate-to-rstack-cli/references/lint-staged.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,18 @@ If staged tasks invoke Prettier, also read [prettier.md](prettier.md).
1010

1111
1. Replace staged-file script invocations with `rs staged`.
1212
2. Move the staged-file config into `define.staged` in `rstack.config.*`.
13-
3. Remove the old manifest key or config file.
14-
4. Remove the direct staged-file dependency only when no script, config, or programmatic API still uses it.
13+
3. Preserve previous behavior. Separate code tasks that lint and format from format-only tasks.
14+
4. Remove the old manifest key or config file.
15+
5. Remove the direct staged-file dependency only when no script, config, or programmatic API still uses it.
1516

1617
## Config Pattern
1718

1819
```ts
1920
import { define } from 'rstack';
2021

2122
define.staged({
22-
'*.{ts,tsx,js,jsx}': ['rs lint --fix', 'rs fmt'],
23-
'*.{json,md}': 'rs fmt',
23+
'*.{js,jsx,ts,tsx,mjs,cjs}': ['rs lint', 'rs fmt'],
24+
'*.{json,jsonc,md,mdx,css,html,yml,yaml}': 'rs fmt',
2425
});
2526
```
2627

.agents/skills/migrate-to-rstack-cli/references/prettier.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ Read this reference when the project uses the `prettier` CLI or API, `package.js
1717

1818
`rs fmt` ignores `package-lock.json` and `pnpm-lock.yaml` by default. Drop redundant ignore entries during migration, but keep intentional negations.
1919

20+
Rstack creates `.rstack/cache/.gitignore` by default. Do not list `.rstack/cache` in the root `.gitignore`; add explicit rules only for custom cache paths.
21+
2022
`rs fmt` does not read Prettier configuration files, `.prettierignore`, or `.editorconfig`.
2123

2224
Keep `.editorconfig` when editors or other tools use it. Keep Prettier when application code uses APIs such as `prettier.format()`; `rs fmt` is not a drop-in replacement for the programmatic API.

.agents/skills/migrate-to-rstack-cli/references/rslint.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ If a script also runs Prettier, migrate its formatting command as described in [
3636

3737
## Validate
3838

39-
Run the non-writing lint script.
39+
Run lint without writes. If Rstack upgrades Rslint, preserve the pre-migration lint baseline: disable newly enabled rules instead of changing source code, unless code changes are requested.

0 commit comments

Comments
 (0)