master
John Lauer rust: Phase 0 (contract fixtures, ab asks, workspace) + Phase 1 skeleton (core, host, host-win, host-mac stubs, cdp, br… 00c8f86 2mo ago
#!/usr/bin/env bash
# The host boundary of the Rust port (docs/PLAN-rust-port.md section 4): only rust/host-win may
# name Win32; only rust/host-mac may name macOS APIs. Everything else goes through pup-host traits
# or ab's verbs. Runs in tools/ship.sh; a leak fails the ship.
set -u
cd "$(dirname "$0")/../rust" || exit 2
fail=0
win_pat='windows_sys|windows-sys|winapi|SetWindowPos|HWND_BOTTOM|SHGetPropertyStore|powershell|HKCU|user32|shell32|GetForegroundWindow|EnumWindows'
mac_pat='osascript|NSWindow|NSApp|CGWindowList|AXUIElement|cocoa'
for d in core host cdp browser session identity vault wiki annotate record verbs dashboard bridge; do
  hits=$(grep -rnE "$win_pat" "$d" --include='*.rs' --include='Cargo.toml' 2>/dev/null | grep -vE '^\S+:\s*//' | grep -v 'check-borders' | grep -v 'todo!(')
  # bridge/main.rs may select the impl by target, nothing more
  if [ "$d" = "bridge" ]; then hits=$(echo "$hits" | grep -vE 'pup_host_win::WinHost|pup-host-win|cfg\(windows\)|cfg\(not\(any\(windows' ); fi
  if [ -n "$hits" ]; then echo "WIN32 LEAK outside host-win in $d:"; echo "$hits" | head -5; fail=1; fi
done
for d in core host cdp browser session identity vault wiki annotate record verbs dashboard bridge host-win; do
  hits=$(grep -rnE "$mac_pat" "$d" --include='*.rs' 2>/dev/null | grep -vE '^\S+:\s*//' | grep -v 'todo!(')
  if [ -n "$hits" ]; then echo "MAC API LEAK outside host-mac in $d:"; echo "$hits" | head -5; fail=1; fi
done
[ $fail -eq 0 ] && echo "borders OK: Win32 only in host-win, macOS only in host-mac"
exit $fail