- Add explicit root route (/) in server.py to guarantee Showcase UI is served by default, routing /admin to the Admin Debug Console - Enhance dynamic Angular dist detection across multiple standard output paths - Add automated Node.js/npm detection and installation fallbacks to start scripts and installers across macOS, Linux, and Windows - Automatically build Showcase UI when launching via start.sh, start.bat/start.ps1, or artemis ui if frontend artifacts are missing - Add Node.js / npm and Showcase UI status inspection rows to artemis doctor - Support artemis mcp --install for one-click IDE integration and add make build-ui target
141 lines
5.8 KiB
PowerShell
141 lines
5.8 KiB
PowerShell
# Copyright 2026 Google LLC
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
[CmdletBinding()]
|
|
param(
|
|
[int]$Port = 8000,
|
|
[switch]$NoOpen = $false
|
|
)
|
|
|
|
$ErrorActionPreference = "Continue"
|
|
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
|
|
|
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Definition
|
|
$RootDir = Split-Path -Parent $ScriptDir
|
|
Set-Location $RootDir
|
|
|
|
Write-Host "======================================================" -ForegroundColor Cyan
|
|
Write-Host " β¨ Artemis Autonomous Mobile Agent UI " -ForegroundColor Cyan
|
|
Write-Host "======================================================" -ForegroundColor Cyan
|
|
Write-Host ""
|
|
|
|
function Update-EnvironmentPath {
|
|
$standardDirs = @(
|
|
"$env:LOCALAPPDATA\Microsoft\WinGet\Links",
|
|
"$env:LOCALAPPDATA\Android\Sdk\platform-tools",
|
|
"$env:ProgramFiles\Android\platform-tools",
|
|
"$env:ProgramFiles\nodejs",
|
|
"${env:ProgramFiles(x86)}\nodejs",
|
|
"$env:APPDATA\npm",
|
|
"C:\ProgramData\chocolatey\bin",
|
|
"$env:USERPROFILE\scoop\shims",
|
|
"$env:USERPROFILE\.local\bin",
|
|
"$env:USERPROFILE\.cargo\bin"
|
|
)
|
|
$regPath = [Environment]::GetEnvironmentVariable("Path", "User") + ";" + [Environment]::GetEnvironmentVariable("Path", "Machine")
|
|
$currentPaths = ($env:PATH -split ";") + ($regPath -split ";") + $standardDirs | Where-Object { [string]::IsNullOrWhiteSpace($_) -eq $false -and (Test-Path $_) } | Select-Object -Unique
|
|
$env:PATH = $currentPaths -join ";"
|
|
}
|
|
|
|
function Test-CommandExists {
|
|
param([string]$Command)
|
|
$res = Get-Command $Command -ErrorAction SilentlyContinue
|
|
return ($null -ne $res)
|
|
}
|
|
|
|
# 1. Refresh PATH with standard toolchain paths
|
|
Update-EnvironmentPath
|
|
|
|
# 2. Check or install uv
|
|
if (-not (Test-CommandExists "uv")) {
|
|
Write-Host "β‘ uv not found. Installing Astral uv..." -ForegroundColor Yellow
|
|
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
|
|
Update-EnvironmentPath
|
|
}
|
|
|
|
# 3. Check and try installing missing system toolchains (ADB, FFmpeg, scrcpy)
|
|
$missingCore = @()
|
|
if (-not (Test-CommandExists "adb")) { $missingCore += "adb" }
|
|
if (-not (Test-CommandExists "ffmpeg")) { $missingCore += "ffmpeg" }
|
|
if (-not (Test-CommandExists "scrcpy")) { $missingCore += "scrcpy" }
|
|
|
|
if ($missingCore.Count -gt 0) {
|
|
if (Test-CommandExists "winget") {
|
|
Write-Host "β‘ Auto-installing missing components ($($missingCore -join ', '))..." -ForegroundColor DarkYellow
|
|
if ($missingCore -contains "adb") {
|
|
winget install --id Google.PlatformTools -e --accept-source-agreements --accept-package-agreements --silent 2>$null | Out-Null
|
|
}
|
|
if ($missingCore -contains "ffmpeg") {
|
|
winget install --id Gyan.FFmpeg -e --accept-source-agreements --accept-package-agreements --silent 2>$null | Out-Null
|
|
}
|
|
if ($missingCore -contains "scrcpy") {
|
|
winget install --id Genymobile.scrcpy -e --accept-source-agreements --accept-package-agreements --silent 2>$null | Out-Null
|
|
}
|
|
Update-EnvironmentPath
|
|
}
|
|
}
|
|
|
|
# 4. Check or initialize .env
|
|
if (-not (Test-Path ".env")) {
|
|
if (Test-Path ".env.example") {
|
|
Copy-Item ".env.example" ".env"
|
|
Write-Host " β Initialized .env configuration file." -ForegroundColor Green
|
|
} else {
|
|
New-Item -ItemType File -Path ".env" | Out-Null
|
|
}
|
|
}
|
|
|
|
# 5. Synchronize dependencies
|
|
Write-Host " π¦ Synchronizing Python runtime and project dependencies..." -ForegroundColor Cyan
|
|
uv sync --quiet
|
|
|
|
# 6. Check and build Showcase UI if not already compiled
|
|
$ShowcaseIndex = "$RootDir\apps\showcase_ui\dist\frontend\browser\index.html"
|
|
$ShowcaseIndexAlt1 = "$RootDir\apps\showcase_ui\dist\browser\index.html"
|
|
$ShowcaseIndexAlt2 = "$RootDir\apps\showcase_ui\dist\index.html"
|
|
if ((-not (Test-Path $ShowcaseIndex)) -and (-not (Test-Path $ShowcaseIndexAlt1)) -and (-not (Test-Path $ShowcaseIndexAlt2))) {
|
|
if (-not (Test-CommandExists "npm")) {
|
|
if (Test-CommandExists "winget") {
|
|
Write-Host " β‘ Node.js/npm not found. Installing Node.js LTS via WinGet..." -ForegroundColor Yellow
|
|
winget install --id OpenJS.NodeJS.LTS -e --accept-source-agreements --accept-package-agreements --silent 2>$null | Out-Null
|
|
Update-EnvironmentPath
|
|
}
|
|
}
|
|
|
|
if (Test-CommandExists "npm") {
|
|
Write-Host " π¨ Showcase UI build not found. Compiling Angular Showcase UI..." -ForegroundColor Yellow
|
|
Push-Location "$RootDir\apps\showcase_ui"
|
|
try {
|
|
npm install --silent
|
|
npm run build
|
|
Write-Host " β Showcase UI compiled successfully." -ForegroundColor Green
|
|
} catch {
|
|
Write-Host " β Failed to build Showcase UI: $_" -ForegroundColor DarkYellow
|
|
} finally {
|
|
Pop-Location
|
|
}
|
|
} else {
|
|
Write-Host " β Node.js/npm not found. Please install Node.js (>= 18) to compile Showcase UI." -ForegroundColor DarkYellow
|
|
}
|
|
}
|
|
|
|
# 7. Launch unified Showcase UI & open browser
|
|
Write-Host " π Launching Artemis Showcase UI & Admin Console..." -ForegroundColor Green
|
|
Write-Host " π‘ Tip: Connect to Antigravity / Claude Desktop anytime: artemis mcp --install all" -ForegroundColor Cyan
|
|
if ($NoOpen) {
|
|
uv run artemis ui --port $Port --no-open
|
|
} else {
|
|
uv run artemis ui --port $Port --open
|
|
}
|