Skip to content

Instantly share code, notes, and snippets.

@AlexanderMakarov
Created February 4, 2026 09:10
Show Gist options
  • Select an option

  • Save AlexanderMakarov/39a4da8bcc797be4dc70fcd19be5150b to your computer and use it in GitHub Desktop.

Select an option

Save AlexanderMakarov/39a4da8bcc797be4dc70fcd19be5150b to your computer and use it in GitHub Desktop.
Update Claude code "Allowlist" from Cursor settings.
#!/bin/bash
set -euo pipefail
CURSOR_DB="${HOME}/.config/Cursor/User/globalStorage/state.vscdb"
CLAUDE_SETTINGS="${HOME}/.claude/settings.json"
KEY="src.vs.platform.reactivestorage.browser.reactiveStorageServiceImpl.persistentStorage.applicationUser"
ALLOWLIST_PATH="\$.composerState.yoloCommandAllowlist"
if [ ! -f "$CURSOR_DB" ]; then
echo "Error: Cursor database not found at $CURSOR_DB" >&2
exit 1
fi
if ! command -v sqlite3 &> /dev/null; then
echo "Error: sqlite3 is not installed. Please install it first." >&2
exit 1
fi
if ! command -v jq &> /dev/null; then
echo "Error: jq is not installed. Please install it first:" >&2
echo " sudo apt-get install jq" >&2
exit 1
fi
ALLOWLIST=$(sqlite3 "$CURSOR_DB" "SELECT json_extract(value, '$ALLOWLIST_PATH') FROM ItemTable WHERE key = '$KEY';" 2>/dev/null)
if [ -z "$ALLOWLIST" ] || [ "$ALLOWLIST" = "null" ]; then
echo "No allowed commands found in the database." >&2
echo "This might mean:" >&2
echo " - YOLO mode is disabled" >&2
echo " - No commands have been added to the allowlist yet" >&2
exit 0
fi
COMMANDS=$(echo "$ALLOWLIST" | sed 's/\[//g; s/\]//g; s/"//g; s/,/\n/g' | sed 's/^[[:space:]]*//; s/[[:space:]]*$//' | grep -v '^$')
echo "Allowed commands to run in Cursor chat (without user permission):"
echo "=================================================================="
echo "$COMMANDS" | nl -w2 -s'. '
echo ""
echo "Total: $(echo "$COMMANDS" | wc -l) commands"
BACKUP_FILE="${CLAUDE_SETTINGS}.backup"
cp "$CLAUDE_SETTINGS" "$BACKUP_FILE"
echo "Backed up existing Claude Code settings to: $BACKUP_FILE"
CLAUDE_ALLOW_ARRAY=$(echo "$COMMANDS" | while read -r cmd; do
if [ -n "$cmd" ]; then
echo "\"Bash($cmd)\""
fi
done | jq -s '.')
UPDATED_JSON=$(jq --argjson allow "$CLAUDE_ALLOW_ARRAY" '.permissions.allow = $allow' "$CLAUDE_SETTINGS")
echo "$UPDATED_JSON" > "$CLAUDE_SETTINGS"
echo "Successfully copied Cursor allowed commands to Claude Code configuration file: $CLAUDE_SETTINGS"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment