#!/bin/sh
# TalkToAi Code launcher (Debian package)
APP_DIR="/usr/share/talktoai-code"
# The app writes a few small files beside its binary (config, self-test report,
# preview capture). /usr/share is read-only for users, so redirect its HOME to
# the same writable per-user state dir it already uses for tasks/settings.
STATE_DIR="${XDG_STATE_HOME:-$HOME/.local/state}/TalkToAiCode"
mkdir -p "$STATE_DIR" 2>/dev/null || true
export TALKTOAI_CODE_HOME="$STATE_DIR"
cd "$APP_DIR"
exec "$APP_DIR/TalkToAiCode" "$@"
