diff --git a/home/.claude/hooks/.rtk-hook.sha256 b/home/.claude/hooks/.rtk-hook.sha256 deleted file mode 100644 index 79741f9..0000000 --- a/home/.claude/hooks/.rtk-hook.sha256 +++ /dev/null @@ -1 +0,0 @@ -ef0d630994fd7ef5f2b84fb66cd6249c493bb8736bcacd4734d7c798125018fb rtk-rewrite.sh diff --git a/home/.claude/hooks/rtk-rewrite.sh b/home/.claude/hooks/rtk-rewrite.sh deleted file mode 100755 index f7a42b5..0000000 --- a/home/.claude/hooks/rtk-rewrite.sh +++ /dev/null @@ -1,98 +0,0 @@ -#!/usr/bin/env bash -# rtk-hook-version: 3 -# RTK Claude Code hook — rewrites commands to use rtk for token savings. -# Requires: rtk >= 0.23.0, jq -# -# This is a thin delegating hook: all rewrite logic lives in `rtk rewrite`, -# which is the single source of truth (src/discover/registry.rs). -# To add or change rewrite rules, edit the Rust registry — not this file. -# -# Exit code protocol for `rtk rewrite`: -# 0 + stdout Rewrite found, no deny/ask rule matched → auto-allow -# 1 No RTK equivalent → pass through unchanged -# 2 Deny rule matched → pass through (Claude Code native deny handles it) -# 3 + stdout Ask rule matched → rewrite but let Claude Code prompt the user - -if ! command -v jq &>/dev/null; then - echo "[rtk] WARNING: jq is not installed. Hook cannot rewrite commands. Install jq: https://jqlang.github.io/jq/download/" >&2 - exit 0 -fi - -if ! command -v rtk &>/dev/null; then - echo "[rtk] WARNING: rtk is not installed or not in PATH. Hook cannot rewrite commands. Install: https://github.com/rtk-ai/rtk#installation" >&2 - exit 0 -fi - -# Version guard: rtk rewrite was added in 0.23.0. -# Older binaries: warn once and exit cleanly (no silent failure). -RTK_VERSION=$(rtk --version 2>/dev/null | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1) -if [ -n "$RTK_VERSION" ]; then - MAJOR=$(echo "$RTK_VERSION" | cut -d. -f1) - MINOR=$(echo "$RTK_VERSION" | cut -d. -f2) - # Require >= 0.23.0 - if [ "$MAJOR" -eq 0 ] && [ "$MINOR" -lt 23 ]; then - echo "[rtk] WARNING: rtk $RTK_VERSION is too old (need >= 0.23.0). Upgrade: cargo install rtk" >&2 - exit 0 - fi -fi - -INPUT=$(cat) -CMD=$(echo "$INPUT" | jq -r '.tool_input.command // empty') - -if [ -z "$CMD" ]; then - exit 0 -fi - -# Delegate all rewrite + permission logic to the Rust binary. -REWRITTEN=$(rtk rewrite "$CMD" 2>/dev/null) -EXIT_CODE=$? - -case $EXIT_CODE in - 0) - # Rewrite found, no permission rules matched — safe to auto-allow. - # If the output is identical, the command was already using RTK. - [ "$CMD" = "$REWRITTEN" ] && exit 0 - ;; - 1) - # No RTK equivalent — pass through unchanged. - exit 0 - ;; - 2) - # Deny rule matched — let Claude Code's native deny rule handle it. - exit 0 - ;; - 3) - # Ask rule matched — rewrite the command but do NOT auto-allow so that - # Claude Code prompts the user for confirmation. - ;; - *) - exit 0 - ;; -esac - -ORIGINAL_INPUT=$(echo "$INPUT" | jq -c '.tool_input') -UPDATED_INPUT=$(echo "$ORIGINAL_INPUT" | jq --arg cmd "$REWRITTEN" '.command = $cmd') - -if [ "$EXIT_CODE" -eq 3 ]; then - # Ask: rewrite the command, omit permissionDecision so Claude Code prompts. - jq -n \ - --argjson updated "$UPDATED_INPUT" \ - '{ - "hookSpecificOutput": { - "hookEventName": "PreToolUse", - "updatedInput": $updated - } - }' -else - # Allow: rewrite the command and auto-allow. - jq -n \ - --argjson updated "$UPDATED_INPUT" \ - '{ - "hookSpecificOutput": { - "hookEventName": "PreToolUse", - "permissionDecision": "allow", - "permissionDecisionReason": "RTK auto-rewrite", - "updatedInput": $updated - } - }' -fi diff --git a/home/.claude/settings.json b/home/.claude/settings.json index a7fe78f..629c489 100644 --- a/home/.claude/settings.json +++ b/home/.claude/settings.json @@ -31,12 +31,17 @@ "Read(~/.claude/plugins/cache)", "Read(~/.claude/projects)" ], + "deny": [ + "Bash(*git* clean *-f*)", + "Bash(*git* clean *--force*)", + "Bash(*git* reset *--hard*)" + ], "additionalDirectories": [ "~/.claude/plugins/cache", "~/.claude/projects" ] }, - "model": "us.anthropic.claude-opus-4-6-v1", + "model": "opus", "hooks": { "Notification": [ { @@ -84,7 +89,7 @@ "hooks": [ { "type": "command", - "command": "/Users/cemmer/.claude/hooks/rtk-rewrite.sh" + "command": "rtk hook claude" } ] } diff --git a/install.sh b/install.sh index bbedfd1..a389531 100755 --- a/install.sh +++ b/install.sh @@ -35,6 +35,9 @@ function link() { if [[ ! -e "${link}" ]]; then echo -e "\033[91mDeleting broken symlink:\033[0m ${link}" rm -f "${link}" + elif [[ -d "${link}" && ! -z "$(find "${link}" -mindepth 1 -print -quit)" ]]; then + echo -e "\033[91mDeleting symlink to empty directory:\033[0m ${link}" + rm -f "${link}" else echo -e "\033[33mIgnoring:\033[0m ${link}" continue diff --git a/packages.sh b/packages.sh index 3360e0b..2e9f7ed 100755 --- a/packages.sh +++ b/packages.sh @@ -41,7 +41,7 @@ if [[ "${OSTYPE:-}" == "darwin"* ]]; then fi command -v jq > /dev/null || brew install jq command -v rename > /dev/null || brew install rename - command -v rtk > /dev/null || brew install rtk + command -v rtk > /dev/null || brew install rtk command -v terminal-notifier > /dev/null || brew install terminal-notifier command -v tree > /dev/null || brew install tree command -v watch > /dev/null || brew install watch @@ -58,7 +58,6 @@ if [[ "${OSTYPE:-}" == "darwin"* ]]; then #echo "discord" echo "disk-expert" echo "docker-desktop" - echo "feedflow" echo "firefox" echo "github" echo "hiddenbar" @@ -99,6 +98,7 @@ if [[ "${OSTYPE:-}" == "darwin"* ]]; then echo -e "\033[33mWARN:\033[0m you may be asked for your password to run 'brew uninstall --cask'" fi for cask in $( + echo "feedflow" echo "messenger" ); do printf "Checking for cask '${cask}' ... " @@ -124,10 +124,9 @@ if [[ "${OSTYPE:-}" == "darwin"* ]]; then mas upgrade mas_list=$(mas list) for app_id in $( - # ----- Developer Tools ----- - # Xcode - # echo "497799835" # ----- Applications ----- + # Amphetamine + echo "937984704" # Kindle echo "302584613" # Menu World Time