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 VQuant Next TEST backend (5058) with a development session (in-memory stores: no Keychain, no real cache), optionally capturing its window.5#6# Usage: Scripts/run-dev.sh [--shot file.png [seconds]] [--keep] [-- -VQSection charting -VQSymbol MSFT -VQTheme dark]7# --shot captures the window of THIS launch (found by process id, so several development copies can run at once),8# then quits the copy unless --keep is given.9# Launch arguments (DEBUG builds only; see LaunchOptions in App/AppEnvironment.swift):10# -VQSection <research|studio|overview|markets|watchlists|charting|statements|quant|portfolio|data|risk|jobs|agent|documents>11# -VQSymbol S -VQTheme light|dark -VQTab <name> -VQJob <id> -VQConversation <id> -VQProject <id> -VQPortfolio <id>12# -VQTool <engine> -VQWorkspace <id> -VQPalette [-VQPaletteQuery text] -VQSettings <pane> -VQAsk "question" -VQX<Name> <value>13set -euo pipefail14cd "$(dirname "$0")/.."15DD="${VQ_DERIVED:-$HOME/Library/Developer/VQuant/DerivedData}"; APP="$DD/Build/Products/Debug/VQuant.app"; BIN="$APP/Contents/MacOS/VQuant"16SHOT=""; DELAY=7; KEEP=017if [[ "${1:-}" == "--shot" ]]; then SHOT="$2"; shift 2; if [[ "${1:-}" =~ ^[0-9]+$ ]]; then DELAY="$1"; shift; fi; fi18if [[ "${1:-}" == "--keep" ]]; then KEEP=1; shift; fi19[[ "${1:-}" == "--" ]] && shift20eval "$(Scripts/dev-session.sh)"21# only this development copy is stopped (by the process ids of its build path), never an installed VQuant nor another copy22pids() { pgrep -f "^$BIN( |$)" || true; }23for p in $(pids); do kill "$p" 2>/dev/null || true; done; sleep 124open -n "$APP" --env VQ_SERVER="$VQ_SERVER" --env VQ_DEV_TOKEN="$VQ_DEV_TOKEN" --args -VQInMemory -ApplePersistenceIgnoreState YES "$@"25if [[ -n "$SHOT" ]]; then26 sleep "$DELAY"; PID="$(pids | head -1)"27 [[ -n "$PID" ]] || { echo "the development copy is not running" >&2; exit 1; }28 mkdir -p "$(dirname "$SHOT")"29 swift Scripts/window-shot.swift --pid "$PID" "$SHOT" | tail -130 [[ "$KEEP" == 1 ]] || kill "$PID" 2>/dev/null || true31fi32