#!/usr/bin/env bash
# Launch Consortium Code against the local dev server.
# Usage: cons-dev [args...]
#
# This runs the consortium-cli which creates a session and then spawns
# the patched opencode fork (via the consortium-code wrapper in PATH).
# The session shows up in the Consortium web/mobile UI.

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
CLI_DIR="$(cd "$SCRIPT_DIR/../Documents/vibeathon/consortium/packages/consortium-cli" && pwd)"

export CONSORTIUM_SERVER_URL="http://localhost:3005"
export CONSORTIUM_WEBAPP_URL="http://localhost:8081"
export CONSORTIUM_HOME_DIR="$HOME/.consortium-dev"
export NODE_NO_WARNINGS=1
export DEBUG=1

cd "$CLI_DIR"
exec npx tsx src/index.ts code "$@"
