Skip to content

refactor: replace external hook scripts with native 'rtk hook claude' command#785

Draft
romansl wants to merge 4 commits intortk-ai:developfrom
romansl:feat/native_windows_support
Draft

refactor: replace external hook scripts with native 'rtk hook claude' command#785
romansl wants to merge 4 commits intortk-ai:developfrom
romansl:feat/native_windows_support

Conversation

@romansl
Copy link

@romansl romansl commented Mar 23, 2026

BREAKING CHANGE: External hook scripts (hooks/rtk-rewrite.sh) are no longer installed or used. Existing hook files can be safely deleted.

  • Add native 'rtk hook claude' command that reads/writes JSON directly
  • Remove hooks/rtk-rewrite.sh embedded script (no longer needed)
  • Update init.rs: install hook via 'rtk hook claude' instead of script files
  • Update hook_check.rs: native hook is always available (no file checks)
  • Remove dead code: prepare_hook_paths(), ensure_hook_installed()
  • Add cross-platform support (works identically on Windows, macOS, Linux)

Benefits:

  • No external dependencies (bash, jq)
  • Faster: no fork/exec subprocess overhead
  • Simpler installation: just 'rtk init -g', no script files

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

… command

  BREAKING CHANGE: External hook scripts (hooks/rtk-rewrite.{sh,py}) are no
  longer installed or used. Existing hook files can be safely deleted.

  - Add native 'rtk hook claude' command that reads/writes JSON directly
  - Remove hooks/rtk-rewrite.sh embedded script (no longer needed)
  - Update init.rs: install hook via 'rtk hook claude' instead of script files
  - Update hook_check.rs: native hook is always available (no file checks)
  - Remove dead code: prepare_hook_paths(), ensure_hook_installed()
  - Add cross-platform support (works identically on Windows, macOS, Linux)

  Benefits:
  - No external dependencies (Python, bash, jq)
  - Faster: no fork/exec subprocess overhead
  - Simpler installation: just 'rtk init -g', no script files

  Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@CLAassistant
Copy link

CLAassistant commented Mar 23, 2026

CLA assistant check
All committers have signed the CLA.

@romansl romansl changed the base branch from master to develop March 23, 2026 06:25
- Remove external hook script checks (.sh/.py) from show_claude_config
- Remove integrity checks for deprecated hook scripts
- Check native hook via settings.json with "rtk hook claude" command
- Update hook_check test to reflect native hook behavior (always Ok)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@romansl romansl marked this pull request as draft March 23, 2026 06:50
romansl and others added 2 commits March 23, 2026 09:58
Remove functions and tests that were checking for legacy .sh/.py hook files,
which are no longer used after switching to native 'rtk hook claude' command.

- Remove hook_installed_path() (checked for .sh/.py files)
- Remove parse_hook_version() (parsed version from hook scripts)
- Remove CURRENT_HOOK_VERSION constant
- Remove 6 tests for parse_hook_version()

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Python hooks were only in local development branch, not in upstream.
Remove .py extension logic, keep only .sh for legacy cleanup.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@pszymkowiak pszymkowiak added effort-medium 1-2 jours, quelques fichiers enhancement New feature or request labels Mar 23, 2026
@pszymkowiak
Copy link
Collaborator

[w] wshm · Automated triage by AI

📊 Automated PR Analysis

♻️ Type refactor
🟡 Risk medium

Summary

Replaces the external bash hook script (hooks/rtk-rewrite.sh) with a native 'rtk hook claude' command built into the Rust binary. This eliminates dependencies on bash and jq, removes file-based hook installation/version checking, and simplifies the setup to just 'rtk init -g' across all platforms.

Review Checklist

  • Tests present
  • Breaking change
  • Docs updated

Analyzed automatically by wshm · This is an automated analysis, not a human review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort-medium 1-2 jours, quelques fichiers enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants