From 4b125e7feecae7aadfbb2e39be8b6f1fac34d4d4 Mon Sep 17 00:00:00 2001 From: Zhongwei Li Date: Sun, 30 Nov 2025 08:30:45 +0800 Subject: [PATCH] Initial commit --- .claude-plugin/plugin.json | 11 +++++++++ README.md | 3 +++ hooks/force-bun.sh | 44 ++++++++++++++++++++++++++++++++++ hooks/hooks.json | 15 ++++++++++++ plugin.lock.json | 49 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 122 insertions(+) create mode 100644 .claude-plugin/plugin.json create mode 100644 README.md create mode 100755 hooks/force-bun.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..85c4f09 --- /dev/null +++ b/.claude-plugin/plugin.json @@ -0,0 +1,11 @@ +{ + "name": "force-bun", + "description": "Suggests using Bun instead of npm/npx 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..836cd88 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# force-bun + +Suggests using Bun instead of npm/npx commands in Bash tool calls diff --git a/hooks/force-bun.sh b/hooks/force-bun.sh new file mode 100755 index 0000000..25eec4b --- /dev/null +++ b/hooks/force-bun.sh @@ -0,0 +1,44 @@ +#!/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=$(