fix(init): allow --hook-only for local project hook installation#1097
Open
myx0m0p wants to merge 1 commit intortk-ai:developfrom
Open
fix(init): allow --hook-only for local project hook installation#1097myx0m0p wants to merge 1 commit intortk-ai:developfrom
myx0m0p wants to merge 1 commit intortk-ai:developfrom
Conversation
4 tasks
…tion Previously `rtk init --hook-only` rejected non-global mode with a warning. Now it installs the hook to `.claude/hooks/rtk-rewrite.sh` and patches `.claude/settings.json` with the PreToolUse hook entry, enabling project-level RTK setup without modifying CLAUDE.md. Closes rtk-ai#1069 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
e70058f to
62f2c4c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
rtk init --hook-onlynow works for local (project-scoped) installations, installing the hook to.claude/hooks/rtk-rewrite.shand patching.claude/settings.jsonwith the PreToolUse hook entryprepare_hook_paths,patch_settings_json, andprint_manual_instructionsto accept aclaude_dirparameter, enabling both global (~/.claude/) and local (.claude/) hook installation paths--hook-onlywithout--globalprinted a warning and exited without doing anythingTest plan
cargo test --all— 1350 tests passcargo clippy --all-targets— no new warningsrtk init --hook-onlyin a project directory, verify.claude/hooks/rtk-rewrite.shand.claude/settings.jsonare created correctlyrtk init --hook-onlyagain, verify idempotency (no duplicate hooks)Closes #1069
🤖 Generated with Claude Code