Repository Public
1#!/usr/bin/env bash2# Author: Simon-Pierre Boucher — contact@spboucher.ai3# File: Scripts/run-dev.sh4# Description: Launches the Debug build against the DEVELOPMENT backend with a minted development session (no Touch ID needed), in the background and without taking the keyboard; optional screenshot.5#6# Usage: Scripts/run-dev.sh [--local] [--shot out.png [delay-seconds]] [app arguments…]7# --local no server session: the app runs in local-only mode8set -euo pipefail9cd "$(dirname "$0")/.."10LOCAL=0; SHOT=""; DELAY=511if [[ "${1:-}" == "--local" ]]; then LOCAL=1; shift; fi12if [[ "${1:-}" == "--shot" ]]; then SHOT="$2"; shift 2; if [[ "${1:-}" =~ ^[0-9]+$ ]]; then DELAY="$1"; shift; fi; fi13APP="${APP:-${SPNOTES_DD:-$HOME/Library/Developer/SPNotes/DerivedData}/Build/Products/Debug/SP Notes.app}"14# stop an earlier Debug instance only (by PID, after checking its executable path): never the installed application15for pid in $(pgrep -x "SP Notes" 2>/dev/null || true); do16 case "$(ps -o command= -p "$pid" 2>/dev/null)" in *"/Products/Debug/SP Notes.app/Contents/MacOS/"*) kill "$pid" 2>/dev/null || true ;; esac17done; sleep 118if [[ $LOCAL == 1 ]]; then open -g -n "$APP" --args -SPNotesNoActivate "$@"19else eval "$(Scripts/dev-session.sh)"; open -g -n "$APP" --env SPNOTES_SERVER="$SPNOTES_SERVER" --env SPNOTES_SESSION_TOKEN="$SPNOTES_SESSION_TOKEN" --args -SPNotesNoActivate "$@"; fi20if [[ -n "$SHOT" ]]; then sleep "$DELAY"; Scripts/shot.sh "$SHOT"; fi21