@studiomopoke/crosschat 1.8.1 → 1.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hub/hub-server.js +1 -1
- package/hooks/permission-hook.sh +47 -0
- package/package.json +1 -1
package/dist/hub/hub-server.js
CHANGED
|
@@ -1320,7 +1320,7 @@ export async function startHub() {
|
|
|
1320
1320
|
const agentName = `agent-${instance.id.slice(0, 8)}`;
|
|
1321
1321
|
const script = `tell application "Terminal"
|
|
1322
1322
|
activate
|
|
1323
|
-
do script "cd \\"${escapedPath}\\" && CROSSCHAT_AGENT_NAME=${agentName} claude"
|
|
1323
|
+
do script "cd \\"${escapedPath}\\" && CROSSCHAT_AGENT_NAME=${agentName} claude crosschat"
|
|
1324
1324
|
end tell`;
|
|
1325
1325
|
spawn('osascript', ['-e', script], { detached: true, stdio: 'ignore' }).unref();
|
|
1326
1326
|
log(`Launched Claude Code in: ${instance.path}`);
|
package/hooks/permission-hook.sh
CHANGED
|
@@ -67,6 +67,53 @@ fi
|
|
|
67
67
|
TOOL_INPUT=$(echo "$INPUT" | jq -c '.tool_input // {}')
|
|
68
68
|
DESCRIPTION=$(echo "$INPUT" | jq -r '.tool_input.description // empty')
|
|
69
69
|
|
|
70
|
+
# ── Check existing Claude Code permissions ────────────────────────
|
|
71
|
+
# Skip the dashboard for tools already allowed in settings files.
|
|
72
|
+
|
|
73
|
+
get_tool_input_value() {
|
|
74
|
+
case "$TOOL_NAME" in
|
|
75
|
+
Bash) echo "$TOOL_INPUT" | jq -r '.command // empty' ;;
|
|
76
|
+
Read|Write|Edit) echo "$TOOL_INPUT" | jq -r '.file_path // empty' ;;
|
|
77
|
+
Glob) echo "$TOOL_INPUT" | jq -r '.pattern // empty' ;;
|
|
78
|
+
Grep) echo "$TOOL_INPUT" | jq -r '.pattern // empty' ;;
|
|
79
|
+
*) echo "" ;;
|
|
80
|
+
esac
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
is_allowed_by() {
|
|
84
|
+
local settings_file="$1"
|
|
85
|
+
[ -f "$settings_file" ] || return 1
|
|
86
|
+
|
|
87
|
+
local rules
|
|
88
|
+
rules=$(jq -r '(.permissions.allow // [])[]' "$settings_file" 2>/dev/null) || return 1
|
|
89
|
+
[ -z "$rules" ] && return 1
|
|
90
|
+
|
|
91
|
+
local input_value
|
|
92
|
+
input_value=$(get_tool_input_value)
|
|
93
|
+
|
|
94
|
+
while IFS= read -r rule; do
|
|
95
|
+
[ -z "$rule" ] && continue
|
|
96
|
+
|
|
97
|
+
if [[ "$rule" =~ ^([A-Za-z_:]+)\((.+)\)$ ]]; then
|
|
98
|
+
# Pattern rule: ToolName(glob-pattern)
|
|
99
|
+
if [ "${BASH_REMATCH[1]}" = "$TOOL_NAME" ] && [ -n "$input_value" ] && [[ "$input_value" == ${BASH_REMATCH[2]} ]]; then
|
|
100
|
+
return 0
|
|
101
|
+
fi
|
|
102
|
+
elif [ "$rule" = "$TOOL_NAME" ]; then
|
|
103
|
+
# Bare tool name — allow all uses
|
|
104
|
+
return 0
|
|
105
|
+
fi
|
|
106
|
+
done <<< "$rules"
|
|
107
|
+
|
|
108
|
+
return 1
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if is_allowed_by "$HOME/.claude/settings.json" || \
|
|
112
|
+
is_allowed_by ".claude/settings.json" || \
|
|
113
|
+
is_allowed_by ".claude/settings.local.json"; then
|
|
114
|
+
exit 0 # Already permitted — fall through to normal flow
|
|
115
|
+
fi
|
|
116
|
+
|
|
70
117
|
# ── POST permission request to hub ────────────────────────────────
|
|
71
118
|
|
|
72
119
|
RESPONSE=$(curl -s -X POST "${HUB_URL}/api/permissions" \
|