33 [switch ]$Install ,
44 [switch ]$NoBrowser ,
55 [switch ]$SmokeTest ,
6+ [switch ]$AllowLan ,
67 [ValidateRange (1 , 65535 )]
78 [int ]$ApiPort = 8000 ,
89 [ValidateRange (1 , 65535 )]
@@ -26,9 +27,40 @@ function Invoke-PythonChecked {
2627 }
2728}
2829
30+ function Get-PrivateIPv4Addresses {
31+ $addresses = foreach ($networkInterface in [System.Net.NetworkInformation.NetworkInterface ]::GetAllNetworkInterfaces()) {
32+ if (
33+ $networkInterface.OperationalStatus -ne [System.Net.NetworkInformation.OperationalStatus ]::Up -or
34+ $networkInterface.NetworkInterfaceType -eq [System.Net.NetworkInformation.NetworkInterfaceType ]::Loopback
35+ ) {
36+ continue
37+ }
38+ foreach ($unicastAddress in $networkInterface.GetIPProperties ().UnicastAddresses) {
39+ $address = $unicastAddress.Address
40+ if ($address.AddressFamily -ne [System.Net.Sockets.AddressFamily ]::InterNetwork) {
41+ continue
42+ }
43+ $bytes = $address.GetAddressBytes ()
44+ $isPrivate = (
45+ $bytes [0 ] -eq 10 -or
46+ ($bytes [0 ] -eq 172 -and $bytes [1 ] -ge 16 -and $bytes [1 ] -le 31 ) -or
47+ ($bytes [0 ] -eq 192 -and $bytes [1 ] -eq 168 )
48+ )
49+ if ($isPrivate ) {
50+ $address.ToString ()
51+ }
52+ }
53+ }
54+ return @ ($addresses | Sort-Object - Unique)
55+ }
56+
2957try {
3058 Set-Location - LiteralPath $projectRoot
3159
60+ if ($AllowLan -and $SmokeTest ) {
61+ throw " -AllowLan cannot be combined with -SmokeTest. Use the default loopback smoke test."
62+ }
63+
3264 if ($Install ) {
3365 Write-Host " Installing SkillPulse API and UI dependencies..."
3466 Invoke-PythonChecked - Arguments @ (" -m" , " pip" , " install" , " -e" , " .[api,ui]" )
@@ -76,15 +108,29 @@ try {
76108 }
77109
78110 $env: SKILLPULSE_API_URL = $apiUrl
79- $headlessValue = if ($NoBrowser -or $SmokeTest ) { " true" } else { " false" }
111+ $headlessValue = if ($NoBrowser -or $SmokeTest -or $AllowLan ) { " true" } else { " false" }
112+ $uiBindAddress = if ($AllowLan ) { " 0.0.0.0" } else { " 127.0.0.1" }
80113 $uiUrl = " http://127.0.0.1:$UiPort "
81114 Write-Host " SkillPulse API: $apiUrl /docs"
82- Write-Host " SkillPulse UI: $uiUrl "
115+ Write-Host " SkillPulse UI (this computer): $uiUrl "
116+ if ($AllowLan ) {
117+ Write-Warning " LAN review mode exposes the Streamlit UI without TLS or authentication."
118+ Write-Warning " Use only a trusted private network and synthetic/redacted inputs; stop immediately after review."
119+ $lanAddresses = @ (Get-PrivateIPv4Addresses )
120+ if ($lanAddresses.Count -eq 0 ) {
121+ Write-Warning " No private LAN IPv4 address was found. Do not use port forwarding or a public tunnel."
122+ }
123+ else {
124+ foreach ($lanAddress in $lanAddresses ) {
125+ Write-Host " SkillPulse UI (physical device): http://${lanAddress} :$UiPort "
126+ }
127+ }
128+ }
83129 Write-Host " Press Ctrl+C to stop the demo and its API process."
84130
85131 $uiArguments = @ (
86132 " -m" , " streamlit" , " run" , " src/skillpulse/ui/app.py" ,
87- " --server.address" , " 127.0.0.1 " ,
133+ " --server.address" , $uiBindAddress ,
88134 " --server.port" , $UiPort.ToString (),
89135 " --server.headless" , $headlessValue ,
90136 " --browser.gatherUsageStats" , " false"
0 commit comments