#!/usr/bin/env bash # CLAUDE.md forbids comments in C#, TS/TSX and CSS. Grep-based, so it is a fast trip-wire # against re-drift rather than a full parser: it can be fooled by a genuinely commented-out # URL or a `//` inside a string, but in practice those are rare enough that a false positive # is worth fixing (rename or delete) rather than allowing every `//` in a string literal. set -euo pipefail cd "$(dirname "${BASH_SOURCE[0]}")/../.." && source ./scripts/ci/lib.sh exclude_args=( -path '*/node_modules/*' -o -path '*/dist/*' -o -path '*/bin/*' -o -path '*/obj/*' -o -path '*/Data/Migrations/*' -o -path '*/Novelly.ServiceDefaults/Extensions.cs' -o -path '*/vite-env.d.ts' ) files=$(find . \( "${exclude_args[@]}" \) -prune -o \ \( -name '*.cs' -o -name '*.ts' -o -name '*.tsx' -o -name '*.css' \) -type f -print) violations=$(grep -nE '(^|[[:space:]])(//|/\*)' $files 2>/dev/null | grep -vE 'https?://' || true) if [[ -n "$violations" ]]; then echo "$violations" fail "Comments found in C#/TS/TSX/CSS. CLAUDE.md forbids them — rename or extract instead of explaining." fi