rtk-ai/rtk

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

Open

#1.069 geöffnet am 7. Apr. 2026

Auf GitHub ansehen
 (1 Kommentar) (0 Reaktionen) (0 zugewiesene Personen)Rust (2.914 Forks)batch import
area:clibugeffort-smallgood first issuepriority:lowresolved-pending-close

Repository-Metriken

Stars
 (48.085 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 11T 1h) (45 gemergte PRs in 30 T)

Beschreibung

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