#!/usr/bin/env bash
# Mythos CLI — global launcher, works from ANY directory.
# Typing "mythos" starts the chat interface (like "claude" starts Claude Code).
# Subcommands: mythos chat, mythos web, mythos scan, mythos status, mythos update, etc.
set -e

MYTHOS_ROOT="/home/anonymous0304/Open-Mythos-2"
VENV_PYTHON="$MYTHOS_ROOT/venv/bin/python3"

if [ ! -x "$VENV_PYTHON" ]; then
  echo "Mythos venv not found at $MYTHOS_ROOT/venv" >&2
  echo "Run the setup script first: $MYTHOS_ROOT/setup.sh" >&2
  exit 1
fi

# Ensure MYTHOS_PROJECT_ROOT is set so the CLI knows where the project lives
export MYTHOS_PROJECT_ROOT="$MYTHOS_ROOT"

# If no arguments, default to chat (like claude does)
if [ $# -eq 0 ]; then
  exec "$VENV_PYTHON" -m mythos_cli.main chat
else
  exec "$VENV_PYTHON" -m mythos_cli.main "$@"
fi
