#!/bin/bash
# Thin wrapper that delegates to @quantiya/codevibe-codex-plugin

SOURCE="${BASH_SOURCE[0]}"
while [ -L "$SOURCE" ]; do
  DIR="$(cd "$(dirname "$SOURCE")" && pwd)"
  SOURCE="$(readlink "$SOURCE")"
  [[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE"
done
SCRIPT_DIR="$(cd "$(dirname "$SOURCE")" && pwd)"

DELEGATE="$SCRIPT_DIR/../node_modules/@quantiya/codevibe-codex-plugin/bin/codevibe-codex"

if [ ! -f "$DELEGATE" ]; then
  echo "Error: @quantiya/codevibe-codex-plugin not found. Try reinstalling: npm install -g @quantiya/codevibe" >&2
  exit 1
fi

exec "$DELEGATE" "$@"
