From 676f5793ffa74ea9ff0222642c68bdc40a300715 Mon Sep 17 00:00:00 2001 From: Zhongwei Li Date: Sun, 30 Nov 2025 08:30:50 +0800 Subject: [PATCH] Initial commit --- .claude-plugin/plugin.json | 11 +++++++++ README.md | 3 +++ hooks/force-uv.sh | 46 +++++++++++++++++++++++++++++++++++ hooks/hooks.json | 15 ++++++++++++ plugin.lock.json | 49 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 124 insertions(+) create mode 100644 .claude-plugin/plugin.json create mode 100644 README.md create mode 100755 hooks/force-uv.sh create mode 100644 hooks/hooks.json create mode 100644 plugin.lock.json diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json new file mode 100644 index 0000000..8a4c1fb --- /dev/null +++ b/.claude-plugin/plugin.json @@ -0,0 +1,11 @@ +{ + "name": "force-uv", + "description": "Suggests using UV instead of pip/pipx/venv commands in Bash tool calls", + "version": "0.2.0", + "author": { + "name": "kawaz" + }, + "hooks": [ + "./hooks" + ] +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..9f46189 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# force-uv + +Suggests using UV instead of pip/pipx/venv commands in Bash tool calls diff --git a/hooks/force-uv.sh b/hooks/force-uv.sh new file mode 100755 index 0000000..d2e3fe3 --- /dev/null +++ b/hooks/force-uv.sh @@ -0,0 +1,46 @@ +#!/bin/bash +set -euo pipefail + +suggest_deny() { + local reason="$1" + jq -cn \ + --arg reason "$reason" \ + '{ + "hookSpecificOutput": { + "hookEventName": "PreToolUse", + "permissionDecision": "deny", + "permissionDecisionReason": $reason + } + }' + exit 1 +} + +# 標準入力から JSON を読み取り +input=$(