Skip to content

Commit 7342b2b

Browse files
authored
docs(skills): update Git hook migration guidance (#401)
1 parent bccf6b4 commit 7342b2b

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ Migrate [Husky](https://typicode.github.io/husky/) or [simple-git-hooks](https:/
44

55
## Shared Steps
66

7-
1. Inspect the hook manager configuration, hook scripts, lifecycle scripts, custom paths, environment overrides, and `git config --local --get core.hooksPath`.
7+
1. Inspect the hook manager configuration, hook scripts, lifecycle scripts, custom paths, environment overrides, and `git config --show-scope --get core.hooksPath`.
88
2. Inventory every active hook before editing. Confirm each hook is [supported by `rs setup`](https://rstack.rs/guide/cli/setup#supported-hooks); stop or design an explicit alternative for unsupported hooks.
99
3. Create each migrated hook in the selected hooks directory, `.rstack/hooks` by default, before running `rs setup`, because the command changes the repository's `core.hooksPath`. Preserve commands and any explicit directory changes.
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.
11-
5. Run the updated lifecycle script, exercise the migrated hooks, and remove the old dependency and configuration only after behavior matches.
11+
5. If the previous manager's hooks or `core.hooksPath` block installation, run `rs setup --force` once after migrating every required hook. The command preserves the previous files but makes them inactive. Do not add `--force` to the lifecycle script.
12+
6. Exercise the migrated hooks, then remove the old dependency, configuration, and generated hook files only after behavior matches and their ownership and paths are confirmed.
1213

1314
`rs setup` creates `.rstack/hooks/_/.gitignore`. Do not list `.rstack/hooks/_` in the root `.gitignore`.
1415

@@ -44,7 +45,7 @@ pnpm test
4445
3. Replace the simple-git-hooks lifecycle command with `rs setup`, preserving other chained commands.
4546
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.
4647
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.
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.
48+
6. After validation, remove the simple-git-hooks dependency, config, installer, old generated hook files, and stale package-manager metadata such as pnpm `allowBuilds`. Confirm the generated files' ownership and paths before removing them.
4849

4950
For example, migrate:
5051

@@ -72,6 +73,7 @@ pnpm test
7273

7374
## Validate
7475

75-
- Confirm `git config --local --get core.hooksPath` points to the expected Rstack-generated directory.
76+
- Confirm `git config --show-scope --get core.hooksPath` reports the expected Rstack-generated directory and whether it is configured in the local or worktree scope.
7677
- Test each migrated hook and confirm that its commands run as expected.
78+
- Remove previous generated hooks after validation so they cannot become active again if `core.hooksPath` is later unset or changed.
7779
- Search for old manager commands, configuration, environment variables, and user instructions before removing dependencies.

0 commit comments

Comments
 (0)