SPB Git

Repository Public License

lint.sh 2.1 KB 39 lines shellscript

1#!/usr/bin/env bash2# Repository-specific checks (ADR 0001). SwiftLint is not installed; these catch what matters most here.3set -euo pipefail4cd "$(dirname "$0")/.."5fail=06say() { echo "lint: $1"; fail=1; }78# 1. No secrets in the repository.9if grep -RIn --exclude-dir=.build --exclude-dir=build --exclude-dir=.git -E 'sk-ant-(api|admin)[0-9]{2}-[A-Za-z0-9_-]{40,}' . >/dev/null; then say "something that looks like a real Anthropic key is in the tree"; fi1011# 2. No placeholder controls or unfinished markers in shipped sources.12if grep -RIn -E 'TODO|FIXME|fatalError\(|not implemented yet|Coming soon' packages/*/Sources apps 2>/dev/null | grep -v 'tool.unimplemented' ; then say "unfinished markers in sources (see above)"; fi1314# 3. No raw shell execution: processes are started with argument arrays only.15if grep -RIn -E '"/bin/(sh|bash|zsh)"|"-c",|(^|[^.a-zA-Z])system\(' packages/*/Sources apps 2>/dev/null; then say "shell invocation found (see above)"; fi1617# 4. No unauthenticated local servers (ADR 0007).18if grep -RIn -E 'NWListener|bind\(|listen\(|HTTPServer' packages/*/Sources apps 2>/dev/null; then say "a listening socket was introduced (see above)"; fi1920# 4b. No AppKit-backed split views: they abort the app when children change their size limits (0.1.0 crash).21if grep -RIn -E '\b(HSplitView|VSplitView)\b' packages/*/Sources apps 2>/dev/null | grep -v 'ResizableSplit.swift'; then say "HSplitView/VSplitView used; use ResizableSplit (see above)"; fi2223# 5. View and source files stay reviewable.24while IFS= read -r f; do25  n=$(wc -l < "$f")26  [ "$n" -le 900 ] || say "$f has $n lines (limit 900)"27done < <(find packages apps -name '*.swift' -not -path '*/Tests/*')2829# 6. The catalog lock matches the manifests.30tmp="$(mktemp)"; swift run -q prism-cli catalog-lock > "$tmp" 2>/dev/null31cmp -s "$tmp" packages/prism-component-catalog/Sources/CatalogLock.swift || say "CatalogLock.swift is stale; run scripts/update-catalog-lock.sh"32rm -f "$tmp"3334# 7. The hand-written template validates.35swift run -q prism-cli validate templates/expense-tracker/blueprint.json >/dev/null || say "templates/expense-tracker does not validate"3637[ "$fail" -eq 0 ] && echo "lint: ok"38exit "$fail"39
Files main
Menu

Theme