- install.sh: detects shell profile (zsh/bash/profile), adds PATH entry if missing - install.ps1: adds to User PATH via SetEnvironmentVariable if missing - Both are idempotent — show "already in PATH ✓" on re-run - mosaic/mosaic.ps1: accept "help" and "version" as bare subcommands Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
91 lines
3.1 KiB
PowerShell
91 lines
3.1 KiB
PowerShell
# Mosaic Bootstrap — Windows Installer
|
|
# PowerShell equivalent of install.sh
|
|
#
|
|
# Usage:
|
|
# powershell -ExecutionPolicy Bypass -File install.ps1
|
|
#
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
$SourceDir = $PSScriptRoot
|
|
$TargetDir = if ($env:MOSAIC_HOME) { $env:MOSAIC_HOME } else { Join-Path $env:USERPROFILE ".config\mosaic" }
|
|
|
|
if (-not (Test-Path $TargetDir)) { New-Item -ItemType Directory -Path $TargetDir -Force | Out-Null }
|
|
|
|
# Sync files: remove old content, copy new
|
|
Write-Host "[mosaic-install] Copying framework to $TargetDir..."
|
|
Get-ChildItem $TargetDir -Exclude ".git" | Remove-Item -Recurse -Force
|
|
Get-ChildItem $SourceDir -Exclude ".git" | ForEach-Object {
|
|
$dest = Join-Path $TargetDir $_.Name
|
|
if ($_.PSIsContainer) {
|
|
Copy-Item $_.FullName $dest -Recurse -Force
|
|
}
|
|
else {
|
|
Copy-Item $_.FullName $dest -Force
|
|
}
|
|
}
|
|
|
|
Write-Host "[mosaic-install] Installed framework to $TargetDir"
|
|
|
|
# Run post-install scripts (PowerShell versions)
|
|
$binDir = Join-Path $TargetDir "bin"
|
|
|
|
Write-Host "[mosaic-install] Linking runtime compatibility assets"
|
|
try {
|
|
& "$binDir\mosaic-link-runtime-assets.ps1"
|
|
}
|
|
catch {
|
|
Write-Host "[mosaic-install] WARNING: runtime asset linking failed (framework install still complete)" -ForegroundColor Yellow
|
|
}
|
|
|
|
Write-Host "[mosaic-install] Syncing universal skills"
|
|
if ($env:MOSAIC_SKIP_SKILLS_SYNC -eq "1") {
|
|
Write-Host "[mosaic-install] Skipping skills sync (MOSAIC_SKIP_SKILLS_SYNC=1)"
|
|
}
|
|
else {
|
|
try {
|
|
& "$binDir\mosaic-sync-skills.ps1"
|
|
}
|
|
catch {
|
|
Write-Host "[mosaic-install] WARNING: skills sync failed (framework install still complete)" -ForegroundColor Yellow
|
|
}
|
|
}
|
|
|
|
Write-Host "[mosaic-install] Migrating runtime-local skills to Mosaic junctions"
|
|
try {
|
|
& "$binDir\mosaic-migrate-local-skills.ps1" -Apply
|
|
}
|
|
catch {
|
|
Write-Host "[mosaic-install] WARNING: local skill migration failed (framework install still complete)" -ForegroundColor Yellow
|
|
}
|
|
|
|
Write-Host "[mosaic-install] Running health audit"
|
|
try {
|
|
& "$binDir\mosaic-doctor.ps1"
|
|
}
|
|
catch {
|
|
Write-Host "[mosaic-install] WARNING: doctor reported issues (run mosaic-doctor.ps1 -FailOnWarn)" -ForegroundColor Yellow
|
|
}
|
|
|
|
# Ensure mosaic bin is in User PATH persistently
|
|
$mosaicBin = Join-Path $TargetDir "bin"
|
|
$userPath = [Environment]::GetEnvironmentVariable("Path", "User")
|
|
if ($userPath -and $userPath.Split(";") -contains $mosaicBin) {
|
|
Write-Host "[mosaic-install] PATH: $mosaicBin already in User PATH ✓"
|
|
}
|
|
else {
|
|
$newPath = if ($userPath) { "$mosaicBin;$userPath" } else { $mosaicBin }
|
|
[Environment]::SetEnvironmentVariable("Path", $newPath, "User")
|
|
$env:Path = "$mosaicBin;$env:Path"
|
|
Write-Host "[mosaic-install] PATH: Added $mosaicBin to User PATH ✓"
|
|
Write-Host "[mosaic-install] Open a new terminal for PATH changes to take effect."
|
|
}
|
|
|
|
Write-Host "[mosaic-install] Done."
|
|
|
|
$soulPath = Join-Path $TargetDir "SOUL.md"
|
|
if (-not (Test-Path $soulPath)) {
|
|
Write-Host ""
|
|
Write-Host "[mosaic-install] Set up your agent identity by running: mosaic init"
|
|
Write-Host "[mosaic-install] This generates SOUL.md - the universal behavioral contract for all agent sessions."
|
|
}
|