feat(conversation-assistant): auto-open Full Disk Access settings

- Auto-detect interactive vs SSH batch mode
- In batch mode, automatically open System Settings to FDA pane
- Use osascript with fallback to URL scheme for reliable GUI launch
- Improves remote installation UX by showing settings immediately

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Quinn Ftw 2025-12-28 21:26:57 -08:00
parent a5fd278da3
commit 1132f12a2f

View file

@ -238,21 +238,42 @@ show_permissions_guide() {
echo "The Conversation Assistant requires Full Disk Access to read the iMessage database."
echo ""
echo "To grant access:"
echo " 1. Open System Settings → Privacy & Security → Full Disk Access"
echo " 1. System Settings will open to Full Disk Access"
echo " 2. Click the '+' button"
echo " 3. Navigate to: $INSTALL_DIR/$APP_NAME.app"
echo " 4. Select the app and click 'Open'"
echo " 5. Enable the toggle next to $APP_NAME"
echo ""
read -p "Press Enter to open System Settings, or 'n' to skip: " open_settings
if [[ "$open_settings" != "n" && "$open_settings" != "N" ]]; then
# Open System Settings to the correct pane (macOS Ventura+)
open "x-apple.systempreferences:com.apple.preference.security?Privacy_AllFiles"
# Check if running interactively (has a TTY)
if [[ -t 0 ]]; then
read -p "Press Enter to open System Settings, or 'n' to skip: " open_settings
if [[ "$open_settings" != "n" && "$open_settings" != "N" ]]; then
open_fda_settings
fi
else
# Non-interactive mode (SSH batch) - auto-open settings
print_info "Opening System Settings → Full Disk Access..."
open_fda_settings
fi
}
open_fda_settings() {
# Open System Settings to Full Disk Access pane (macOS Ventura+)
# Use osascript to ensure it opens in the user's GUI session (works via SSH)
osascript -e 'tell application "System Settings"
activate
delay 0.5
tell application "System Events"
keystroke "Full Disk Access"
delay 0.3
key code 36
end tell
end tell' 2>/dev/null || \
open "x-apple.systempreferences:com.apple.preference.security?Privacy_AllFiles" 2>/dev/null || \
open "/System/Applications/System Settings.app" 2>/dev/null
}
register_device() {
print_step "Starting the agent for device registration..."