You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 64dc095
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: .agents/skills/migrate-to-rstack-cli/SKILL.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
name: migrate-to-rstack-cli
3
-
description: Use when migrating projects from standalone Rsbuild, Rslib, Rstest, Rslint, Rspress, Prettier, sort-package-json, lint-staged, husky, or simple-git-hooks tooling to the unified `rstack` package, `rs` commands, and `rstack.config.*`.
3
+
description: Use when migrating projects from standalone Rsbuild, Rslib, Rstest, Rslint, Rspress, Prettier, sort-package-json, lint-staged, husky, lefthook, or simple-git-hooks tooling to the unified `rstack` package, `rs` commands, and `rstack.config.*`.
4
4
---
5
5
6
6
# Migrate to Rstack CLI
@@ -18,7 +18,7 @@ Read every matching reference before editing. Load only the tools present in the
Copy file name to clipboardExpand all lines: .agents/skills/migrate-to-rstack-cli/references/git-hooks.md
+9-1Lines changed: 9 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Git Hook Migration
2
2
3
-
Migrate [Husky](https://typicode.github.io/husky/)or [simple-git-hooks](https://github.com/toplenboren/simple-git-hooks#readme) to [`rs hooks`](https://rstack.rs/guide/cli/hooks). If a hook calls lint-staged or nano-staged, also read [lint-staged.md](lint-staged.md).
3
+
Migrate [Husky](https://typicode.github.io/husky/), [Lefthook](https://lefthook.dev/), or [simple-git-hooks](https://github.com/toplenboren/simple-git-hooks#readme) to [`rs hooks`](https://rstack.rs/guide/cli/hooks). If a hook works with staged files, also read [lint-staged.md](lint-staged.md).
4
4
5
5
## Shared Steps
6
6
@@ -38,6 +38,14 @@ to:
38
38
pnpm test
39
39
```
40
40
41
+
## Lefthook
42
+
43
+
1. Resolve the merged configuration, including main and local files, `LEFTHOOK_CONFIG`, `extends` or remote configs, lifecycle scripts, and direct `lefthook run` calls. Treat ignored local configs as user-owned.
44
+
2. Create one Rstack file per Git hook. Rstack runs it with POSIX `sh -e` and forwards arguments and standard input. Replace templates such as `{1}` with `"$1"`; move custom Lefthook groups to project scripts.
45
+
3. Move `pre-commit` tasks using `{staged_files}`, `stage_fixed`, `glob`, or `exclude` to `define.staged`, and run `rs staged` from `.rstack/hooks/pre-commit`; it passes matched files and stages successful fixes. Recreate the intended file set instead of copying globs: Lefthook's default `**` semantics differ from lint-staged. Preserve exclusions such as unsupported symlinks.
46
+
4. For `{push_files}`, `{all_files}`, custom `{files}`, or orchestration such as `parallel` and `piped`, call a project helper from the hook. It should consume all `pre-push` ref updates, apply the original conditions, preserve concurrency or ordering, and aggregate failures. For a configuration like Rstest's, run the format/spell check always, skip type checking only for Markdown-only pushes, and run the dependency check only for pushed package manifests. Do not substitute a fixed `HEAD^` diff.
47
+
5. Replace `lefthook install` with `rs hooks` and `LEFTHOOK=0` with `RSTACK_HOOKS=0`. After validation, remove Lefthook configs, dependencies, generated hooks, and pnpm build metadata such as `allowBuilds`, `onlyBuiltDependencies`, or `ignoredBuiltDependencies`. Remove local-config ignore rules only when no longer needed.
48
+
41
49
## simple-git-hooks
42
50
43
51
1. Load the active configuration from `package.json#simple-git-hooks`, a `.simple-git-hooks.{js,cjs,mjs,json}` or `simple-git-hooks.{js,cjs,mjs,json}` file, or the custom path passed to its CLI. Use the configuration values instead of copying generated files from the Git hooks directory.
0 commit comments