Skip to content

Commit e028ce3

Browse files
authored
fix(overlay): pass env vars through temp file for tmux/kitty/wezterm popups (#17)
* fix(overlay): pass env vars through temp file for tmux/kitty/wezterm popups * fix(overlay): env passthrough, arrow-key dialog, remove mode auto-allow shortcut
1 parent 3771662 commit e028ce3

6 files changed

Lines changed: 350 additions & 197 deletions

File tree

.claude-plugin/marketplace.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "passthru",
3-
"version": "0.5.0",
3+
"version": "0.5.1",
44
"description": "Regex-based permission rules for Claude Code via hooks",
55
"owner": {
66
"name": "nnemirovsky"

.claude-plugin/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "passthru",
3-
"version": "0.5.0",
3+
"version": "0.5.1",
44
"description": "Regex-based permission rules for Claude Code via hooks",
55
"license": "MIT"
66
}

hooks/handlers/pre-tool-use.sh

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
set -euo pipefail
3535

36+
3637
# ---------------------------------------------------------------------------
3738
# Locate and source common.sh
3839
# ---------------------------------------------------------------------------
@@ -481,22 +482,27 @@ if [ "$ORDERED_COUNT" -gt 0 ]; then
481482
done
482483
fi
483484

484-
# --- 7. Mode-based auto-allow shortcut -------------------------------------
485-
# Only consult the permission-mode fast path if no ask[] rule matched. An
486-
# ask-rule always wins over mode-based auto-allow because the user declared
487-
# an explicit "prompt me on this" intent.
485+
# --- 7. Internal tool pass-through -----------------------------------------
486+
# Some tools are Claude Code internals (schema loading, task management, etc.)
487+
# that should never trigger the overlay. Pass them through unconditionally.
488488
if [ "$MATCHED" != "ask" ]; then
489-
if permission_mode_auto_allows "$PERMISSION_MODE" "$TOOL_NAME" "$TOOL_INPUT" "$CC_CWD" 2>/dev/null; then
490-
# CC itself would auto-allow this call. Emit passthrough and record
491-
# the decision under source="passthru-mode" so the audit log can
492-
# distinguish mode-driven allow from rule-driven allow.
493-
audit_write_line "passthrough" "$TOOL_NAME" "mode:${PERMISSION_MODE:-default}" "" "" "$TOOL_USE_ID" "passthru-mode"
494-
emit_passthrough
495-
exit 0
496-
fi
489+
case "$TOOL_NAME" in
490+
ToolSearch|TaskCreate|TaskUpdate|TaskGet|TaskList|TaskOutput|TaskStop|\
491+
AskUserQuestion|SendMessage|EnterPlanMode|ExitPlanMode|ScheduleWakeup|\
492+
CronCreate|CronDelete|CronList|Monitor|LSP|RemoteTrigger|\
493+
EnterWorktree|ExitWorktree|TeamCreate|TeamDelete)
494+
emit_passthrough
495+
exit 0
496+
;;
497+
esac
497498
fi
498499

499500
# --- 8. Overlay path -------------------------------------------------------
501+
# Passthru handles ALL non-internal tool calls. There is no mode-based
502+
# auto-allow shortcut. Every unmatched call goes to the overlay so the user
503+
# always sees a prompt. CC's native dialog only fires as a fallback when the
504+
# user explicitly cancels the overlay (Esc) or the overlay is unavailable.
505+
#
500506
# Reached when either:
501507
# * an ask[] rule matched, or
502508
# * no rule matched AND mode did NOT auto-allow.

0 commit comments

Comments
 (0)