Skip to content

fix(init): allow --hook-only for local project hook installation#1097

Open
myx0m0p wants to merge 1 commit intortk-ai:developfrom
myx0m0p:fix/local-hook-only-init
Open

fix(init): allow --hook-only for local project hook installation#1097
myx0m0p wants to merge 1 commit intortk-ai:developfrom
myx0m0p:fix/local-hook-only-init

Conversation

@myx0m0p
Copy link
Copy Markdown

@myx0m0p myx0m0p commented Apr 9, 2026

Summary

  • rtk init --hook-only now works for local (project-scoped) installations, installing the hook to .claude/hooks/rtk-rewrite.sh and patching .claude/settings.json with the PreToolUse hook entry
  • Refactored prepare_hook_paths, patch_settings_json, and print_manual_instructions to accept a claude_dir parameter, enabling both global (~/.claude/) and local (.claude/) hook installation paths
  • Previously, --hook-only without --global printed a warning and exited without doing anything

Test plan

  • cargo test --all — 1350 tests pass
  • cargo clippy --all-targets — no new warnings
  • Manual: run rtk init --hook-only in a project directory, verify .claude/hooks/rtk-rewrite.sh and .claude/settings.json are created correctly
  • Manual: run rtk init --hook-only again, verify idempotency (no duplicate hooks)

Closes #1069

🤖 Generated with Claude Code

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 9, 2026

CLA assistant check
All committers have signed the CLA.

@myx0m0p myx0m0p changed the base branch from master to develop April 9, 2026 11:51
…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>
@myx0m0p myx0m0p force-pushed the fix/local-hook-only-init branch from e70058f to 62f2c4c Compare April 9, 2026 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rtk init --hook-only does not work

2 participants