Monorepo for Aesthetic.Computer
aesthetic.computer
1#!/bin/bash
2# Setup VS Code to always launch with remote debugging enabled on Mac
3# Run this script on your Mac (not in the container)
4
5ARGV_FILE="$HOME/Library/Application Support/Code/User/argv.json"
6
7echo "🩸 Setting up VS Code remote debugging on port 9222..."
8
9# Create the directory if it doesn't exist
10mkdir -p "$(dirname "$ARGV_FILE")"
11
12# Check if file exists and has content
13if [ -f "$ARGV_FILE" ] && [ -s "$ARGV_FILE" ]; then
14 # File exists - check if it already has the setting
15 if grep -q "remote-debugging-port" "$ARGV_FILE"; then
16 echo "✅ remote-debugging-port already configured in argv.json"
17 cat "$ARGV_FILE"
18 exit 0
19 fi
20
21 # Add the setting to existing file (insert before last closing brace)
22 # Backup first
23 cp "$ARGV_FILE" "$ARGV_FILE.backup"
24 echo "📦 Backed up existing argv.json to argv.json.backup"
25
26 # Use Python for reliable JSON manipulation
27 python3 << 'PYTHON'
28import json
29import os
30
31argv_file = os.path.expanduser("~/Library/Application Support/Code/User/argv.json")
32
33with open(argv_file, 'r') as f:
34 content = f.read()
35 # Handle comments in JSON (VS Code allows them)
36 lines = content.split('\n')
37 clean_lines = [l for l in lines if not l.strip().startswith('//')]
38 clean_content = '\n'.join(clean_lines)
39
40try:
41 data = json.loads(clean_content)
42except:
43 data = {}
44
45data['remote-debugging-port'] = 9222
46
47with open(argv_file, 'w') as f:
48 json.dump(data, f, indent=2)
49 f.write('\n')
50
51print("Updated argv.json")
52PYTHON
53
54else
55 # Create new file
56 cat > "$ARGV_FILE" << 'JSON'
57{
58 "remote-debugging-port": 9222
59}
60JSON
61 echo "📝 Created new argv.json"
62fi
63
64echo ""
65echo "✅ Done! Your argv.json now contains:"
66cat "$ARGV_FILE"
67echo ""
68echo "🔄 Please restart VS Code for changes to take effect."
69echo ""
70echo "To verify it's working after restart, run in your container:"
71echo " curl -s http://host.docker.internal:9222/json | head -5"