Repository navigation
Expand file tree
/
Copy pathinstall.ps1
More file actions
79 lines (67 loc) · 3.3 KB
/
Copy pathinstall.ps1
File metadata and controls
79 lines (67 loc) · 3.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# RoyceCode Installer for Windows
# Usage: irm https://raw.githubusercontent.com/vojtechroyce/roycecode/main/install.ps1 | iex
$ErrorActionPreference = "Stop"
$VERSION = if ($env:ROYCECODE_VERSION) { $env:ROYCECODE_VERSION } else { "0.1.0" }
$REPO = "vojtechroyce/roycecode"
$BIN_NAME = "roycecode"
function Write-Info { param($msg) Write-Host " > " -ForegroundColor Blue -NoNewline; Write-Host $msg }
function Write-Ok { param($msg) Write-Host " ✓ " -ForegroundColor Green -NoNewline; Write-Host $msg }
function Write-Warn { param($msg) Write-Host " ! " -ForegroundColor Yellow -NoNewline; Write-Host $msg }
function Write-Err { param($msg) Write-Host " ✗ " -ForegroundColor Red -NoNewline; Write-Host $msg }
function Show-Banner {
Write-Host ""
Write-Host " ╔═══════════════════════════════════════╗" -ForegroundColor Magenta
Write-Host " ║ RoyceCode Installer v$VERSION ║" -ForegroundColor Magenta
Write-Host " ║ Native Rust CLI ║" -ForegroundColor Magenta
Write-Host " ╚═══════════════════════════════════════╝" -ForegroundColor Magenta
Write-Host ""
}
function Find-Cargo {
$cargo = Get-Command cargo -ErrorAction SilentlyContinue
if ($cargo) {
return $cargo.Source
}
$cargoPath = "$env:USERPROFILE\.cargo\bin\cargo.exe"
if (Test-Path $cargoPath) {
return $cargoPath
}
return $null
}
function Install-WithCargo {
param($CargoCmd)
Write-Info "Installing native Rust CLI with cargo..."
& $CargoCmd install --git "https://github.com/$REPO.git" --locked roycecode --bin $BIN_NAME 2>$null
if ($LASTEXITCODE -ne 0) {
& $CargoCmd install --git "https://github.com/$REPO.git" roycecode --bin $BIN_NAME
if ($LASTEXITCODE -ne 0) { throw "cargo install failed" }
}
}
Show-Banner
Write-Info "Detected: Windows/$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)"
$cargoCmd = Find-Cargo
if (-not $cargoCmd) {
Write-Err "Cargo is required but was not found."
Write-Host ""
Write-Host " Install Rust first:" -ForegroundColor Yellow
Write-Host " winget install Rustlang.Rustup" -ForegroundColor Green
Write-Host " Then restart your terminal and rerun this installer." -ForegroundColor Yellow
Write-Host ""
exit 1
}
Write-Ok "Found $(& $cargoCmd --version 2>&1)"
Install-WithCargo -CargoCmd $cargoCmd
try {
$ver = & $BIN_NAME --version 2>$null
Write-Ok "RoyceCode installed successfully! ($ver)"
} catch {
Write-Ok "RoyceCode installed. Restart your terminal to use it."
}
Write-Host ""
Write-Host " Get started:" -ForegroundColor White
Write-Host " roycecode analyze . " -ForegroundColor Green -NoNewline; Write-Host "# Analyze current directory and write native artifacts"
Write-Host " roycecode surface . " -ForegroundColor Green -NoNewline; Write-Host "# Generate architecture-surface.json"
Write-Host " roycecode --help " -ForegroundColor Green -NoNewline; Write-Host "# See all commands"
Write-Host ""
Write-Host " Docs: https://roycecode.com/docs" -ForegroundColor Blue
Write-Host " GitHub: https://github.com/$REPO" -ForegroundColor Blue
Write-Host ""