experiments in a post-browser web
1#!/bin/bash
2# Debug packaged app - runs the installed app with DEBUG output
3# Usage: ./scripts/debug-packaged.sh [--visible] [--profile NAME] [duration_seconds]
4# Example: ./scripts/debug-packaged.sh # 10 seconds, default profile
5# Example: ./scripts/debug-packaged.sh --visible # 10 seconds, show UI
6# Example: ./scripts/debug-packaged.sh --profile test # fresh test profile
7# Example: ./scripts/debug-packaged.sh --visible --profile test 20
8
9VISIBLE=0
10PROFILE=""
11
12while [[ "$1" == --* ]]; do
13 case "$1" in
14 --visible)
15 VISIBLE=1
16 shift
17 ;;
18 --profile)
19 PROFILE="$2"
20 shift 2
21 ;;
22 *)
23 echo "Unknown option: $1"
24 exit 1
25 ;;
26 esac
27done
28
29DURATION=${1:-10}
30LOGFILE="/tmp/peek-packaged-debug.log"
31
32cleanup() {
33 pkill -f "/Applications/Peek.app" 2>/dev/null || true
34}
35
36trap cleanup EXIT
37
38# Kill any existing instances first
39pkill -f "/Applications/Peek.app" 2>/dev/null || true
40sleep 1
41
42if [ -n "$PROFILE" ]; then
43 echo "Running packaged Peek.app with DEBUG for ${DURATION}s (profile: $PROFILE)..."
44else
45 echo "Running packaged Peek.app with DEBUG for ${DURATION}s (default profile)..."
46fi
47echo "Log file: $LOGFILE"
48echo ""
49
50if [ -n "$PROFILE" ]; then
51 PROFILE="$PROFILE" DEBUG=1 /Applications/Peek.app/Contents/MacOS/Peek > "$LOGFILE" 2>&1 &
52else
53 DEBUG=1 /Applications/Peek.app/Contents/MacOS/Peek > "$LOGFILE" 2>&1 &
54fi
55PID=$!
56
57sleep "$DURATION"
58
59echo "=== Extension manifest loading ==="
60grep -E "\[ext:win\].*Creating window" "$LOGFILE" || echo "(no extension window creation found)"
61echo ""
62
63echo "=== Manifest details ==="
64grep -E "manifest:" "$LOGFILE" | head -20 || echo "(no manifest details found)"
65echo ""
66
67echo "=== Errors ==="
68grep -iE "error|failed|cannot" "$LOGFILE" | head -20 || echo "(no errors found)"
69echo ""
70
71echo "=== Full log available at: $LOGFILE ==="
72echo "View with: cat $LOGFILE"