forked from cjpais/Handy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdev.sh
More file actions
executable file
·156 lines (134 loc) · 5.07 KB
/
dev.sh
File metadata and controls
executable file
·156 lines (134 loc) · 5.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
#!/bin/bash
# Dev script for Handy - sets up environment and runs tauri dev
# Usage: ./dev.sh [--clean]
# --clean: Clear app data to test onboarding flow
# Tauri uses the identifier for app data directory, not productName
APP_IDENTIFIER="com.kbve.speechcoach"
DEV_PORT=1420
# Kill any existing instances to ensure a fresh start
echo "Cleaning up any existing dev instances..."
# Kill processes using the dev ports
if command -v lsof &> /dev/null; then
for port in 1420 1421; do
PORT_PIDS=$(lsof -ti:$port 2>/dev/null)
if [ -n "$PORT_PIDS" ]; then
echo "$PORT_PIDS" | xargs kill -9 2>/dev/null || true
fi
done
fi
# Kill any existing Tauri/Vite dev processes
pkill -9 -f "tauri" 2>/dev/null || true
pkill -9 -f "vite" 2>/dev/null || true
# Kill any running debug binaries (these survive cargo clean)
pkill -9 -f "target/debug/kbve" 2>/dev/null || true
pkill -9 -f "target/debug" 2>/dev/null || true
# Kill any existing app instances (macOS)
if [[ "$OSTYPE" == "darwin"* ]]; then
pkill -9 -f "kbve-app" 2>/dev/null || true
pkill -9 -f "KBVE" 2>/dev/null || true
pkill -9 -f "kbve" 2>/dev/null || true
pkill -9 -f "Handy" 2>/dev/null || true
pkill -9 -f "handy" 2>/dev/null || true
fi
# Kill any lingering sidecar processes
pkill -f "llm-sidecar" 2>/dev/null || true
pkill -f "tts-sidecar" 2>/dev/null || true
pkill -f "discord-sidecar" 2>/dev/null || true
echo "Cleanup complete."
echo ""
# Fix for cmake policy warning on newer macOS
export CMAKE_POLICY_VERSION_MINIMUM=3.5
# Parse arguments
CLEAN_DATA=false
for arg in "$@"; do
case $arg in
--clean)
CLEAN_DATA=true
shift
;;
esac
done
# Check if running on macOS
if [[ "$OSTYPE" == "darwin"* ]]; then
APP_DATA_DIR="$HOME/Library/Application Support/$APP_IDENTIFIER"
# Clean app data if requested
if [ "$CLEAN_DATA" = true ]; then
if [ -d "$APP_DATA_DIR" ]; then
echo "Clearing app data at: $APP_DATA_DIR"
rm -rf "$APP_DATA_DIR"
echo "App data cleared. Onboarding will show on next launch."
else
echo "No app data found at: $APP_DATA_DIR"
fi
echo ""
fi
# Check if the terminal has accessibility permissions
echo "Note: This app requires Accessibility permissions to simulate keyboard input."
echo "If the app crashes with 'permission to simulate input' error:"
echo " 1. Open System Settings > Privacy & Security > Accessibility"
echo " 2. Add and enable your terminal app (Terminal, iTerm, VS Code, etc.)"
echo ""
echo "Opening Accessibility settings (you can close it if already configured)..."
open "x-apple.systempreferences:com.apple.preference.security?Privacy_Accessibility" 2>/dev/null || true
echo ""
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
APP_DATA_DIR="$HOME/.local/share/$APP_IDENTIFIER"
if [ "$CLEAN_DATA" = true ]; then
if [ -d "$APP_DATA_DIR" ]; then
echo "Clearing app data at: $APP_DATA_DIR"
rm -rf "$APP_DATA_DIR"
echo "App data cleared. Onboarding will show on next launch."
else
echo "No app data found at: $APP_DATA_DIR"
fi
echo ""
fi
elif [[ "$OSTYPE" == "msys" || "$OSTYPE" == "win32" ]]; then
APP_DATA_DIR="$APPDATA/$APP_IDENTIFIER"
if [ "$CLEAN_DATA" = true ]; then
if [ -d "$APP_DATA_DIR" ]; then
echo "Clearing app data at: $APP_DATA_DIR"
rm -rf "$APP_DATA_DIR"
echo "App data cleared. Onboarding will show on next launch."
else
echo "No app data found at: $APP_DATA_DIR"
fi
echo ""
fi
fi
# Determine platform target triple
if [[ "$OSTYPE" == "darwin"* ]]; then
ARCH=$(uname -m)
if [[ "$ARCH" == "arm64" ]]; then
TARGET_TRIPLE="aarch64-apple-darwin"
else
TARGET_TRIPLE="x86_64-apple-darwin"
fi
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
ARCH=$(uname -m)
if [[ "$ARCH" == "aarch64" ]]; then
TARGET_TRIPLE="aarch64-unknown-linux-gnu"
else
TARGET_TRIPLE="x86_64-unknown-linux-gnu"
fi
elif [[ "$OSTYPE" == "msys" || "$OSTYPE" == "win32" ]]; then
TARGET_TRIPLE="x86_64-pc-windows-msvc"
fi
# Build sidecars first
echo "Building LLM sidecar..."
(cd src-tauri/llm-sidecar && cargo build --release)
echo "Building TTS sidecar..."
(cd src-tauri/tts-sidecar && cargo build --release)
echo "Building Discord sidecar..."
(cd src-tauri/discord-sidecar && cargo build --release)
# Copy sidecars with platform-specific names for Tauri externalBin
# Tauri expects: <name>-<target_triple>[.exe]
echo "Copying sidecars with platform-specific names..."
cp src-tauri/llm-sidecar/target/release/llm-sidecar "src-tauri/llm-sidecar/llm-sidecar-${TARGET_TRIPLE}"
cp src-tauri/tts-sidecar/target/release/tts-sidecar "src-tauri/tts-sidecar/tts-sidecar-${TARGET_TRIPLE}"
cp src-tauri/discord-sidecar/target/release/discord-sidecar "src-tauri/discord-sidecar/discord-sidecar-${TARGET_TRIPLE}"
echo "Sidecars built and ready."
echo ""
# Run tauri dev
echo "Starting Tauri development server..."
bun run tauri dev