rtk-ai / rtk-ai/rtk

`rtk init --hook-only` does not work

Open
#1,069 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area:cli bug effort-small good first issue priority:low
Dominant language
Rust
Stars
81k
Forks
5.1k
Avg merge
4d 21h
Merged PRs (30d)
35

Description

Description

It is possible to have project level hooks configured in claude code. These are written to .claude/hooks and are referenced in .claude/settings.json. It is desirable to limit special tools to specific projects to evaluate them. When installing the rtk system for a project the only modification is the creation of a large CLAUDE.md file, instructing the agent in the use of rtk, and no hooks are configured. Given that the hooks do not require explicit instruction I was expecting them to be configured instead.

Steps to Reproduce

➜ rtk init --hook-only
[warn] Warning: --hook-only only makes sense with --global
    For local projects, use default mode or --claude-md

Expected Results

The .claude/settings.json file should be created or updated with the following content:

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "command",
            "command": "$CLAUDE_PROJECT_DIR/rtk/hooks/claude/rtk-rewrite.sh"
          }
        ]
      }
    ]
  }
}

(I had to expand $CLAUDE_PROJECT_DIR to the absolute path)

The .claude/hooks folder should contain at least rtk-rewrite.sh

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the rtk init --hook-only CLI entry point and reproduce the warning shown in the issue. Compare the expected .claude/settings.json hooks configuration with the .claude/hooks/rtk-rewrite.sh files created by local initialization. Done means local hook-only initialization creates or updates both the settings entry and the hook script without requiring --global.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, shell
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.