#!/usr/bin/env bash
set -euo pipefail

MAX_LINES="${MAX_LINES:-500}"

find Backend frontend/src \
  -type f \( -name '*.cs' -o -name '*.ts' -o -name '*.vue' \) \
  -not -path '*/bin/*' \
  -not -path '*/obj/*' \
  -not -path 'Backend/Migrations/*' \
  -print0 \
  | xargs -0 wc -l \
  | awk -v max="$MAX_LINES" '
      $2 != "total" && $1 > max { printf "%6d %s\n", $1, $2; found = 1 }
      END { exit found ? 1 : 0 }
    '
