#!/bin/bash
# Demo: run config-audit scanners on the example projects
# Usage: bash examples/run-demo.sh (from plugin root)
#    or: cd examples && bash run-demo.sh

SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
if [ -d "$SCRIPT_DIR/../scanners" ]; then
  SCANNER_DIR="$(cd "$SCRIPT_DIR/../scanners" && pwd)"
else
  SCANNER_DIR=""
fi

if [ -z "$SCANNER_DIR" ] || [ ! -f "$SCANNER_DIR/posture.mjs" ]; then
  echo "Error: Cannot find scanners/posture.mjs"
  echo "Run from plugin root: bash examples/run-demo.sh"
  exit 1
fi

echo "=== Minimal Setup (expect low score) ==="
echo ""
node "$SCANNER_DIR/posture.mjs" "$SCRIPT_DIR/minimal-setup/"

echo ""
echo ""
echo "=== Optimal Setup (expect high score) ==="
echo ""
node "$SCANNER_DIR/posture.mjs" "$SCRIPT_DIR/optimal-setup/"
