-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.ps1
More file actions
117 lines (99 loc) · 4.54 KB
/
Copy pathinstall.ps1
File metadata and controls
117 lines (99 loc) · 4.54 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# Fused CLI Installation Script for Windows
# Run with: irm https://raw.githubusercontent.com/Usefused/cli/main/install.ps1 | iex
# Or to install a specific version:
# $env:VERSION="v1.0.0"; irm https://raw.githubusercontent.com/Usefused/cli/main/install.ps1 | iex
$ErrorActionPreference = "Stop"
$Repo = "Usefused/cli"
$Binary = "fused-cli"
$InstallDir = if ($env:FUSED_CLI_INSTALL_DIR) { $env:FUSED_CLI_INSTALL_DIR } else { "$env:LOCALAPPDATA\Programs\fused-cli" }
# Detect architecture
$Arch = if ([System.Environment]::Is64BitOperatingSystem) { "x86_64" } else {
Write-Error "Unsupported architecture. Only x86_64 is supported on Windows."
exit 1
}
Write-Host "=> Detected Windows $Arch"
# Determine version
$TargetVersion = $env:VERSION
if (-not $TargetVersion) {
Write-Host "=> Fetching latest release version..."
$Release = Invoke-RestMethod "https://api.github.com/repos/$Repo/releases/latest"
$TargetVersion = $Release.tag_name
}
if (-not $TargetVersion) {
Write-Error "Could not determine release version."
exit 1
}
Write-Host "=> Installing version $TargetVersion"
# Construct download URL (GoReleaser naming: fused-cli_Windows_x86_64.zip)
$ZipName = "${Binary}_Windows_${Arch}.zip"
$DownloadUrl = "https://github.com/$Repo/releases/download/$TargetVersion/$ZipName"
# Create a temporary directory
$TmpDir = New-TemporaryFile | ForEach-Object { Remove-Item $_; New-Item -ItemType Directory -Path $_ }
try {
$ZipPath = Join-Path $TmpDir $ZipName
Write-Host "=> Downloading $DownloadUrl..."
Invoke-WebRequest -Uri $DownloadUrl -OutFile $ZipPath -UseBasicParsing
Write-Host "=> Extracting archive..."
Expand-Archive -Path $ZipPath -DestinationPath $TmpDir -Force
$SkillVersion = $TargetVersion.TrimStart("v")
$SkillsSource = Join-Path $TmpDir "skills\$SkillVersion"
$HasBundledSkills = Test-Path (Join-Path $SkillsSource "fused-cli\SKILL.md")
if (-not $HasBundledSkills) {
Write-Host "=> This older release has no bundled skills; the CLI will use its fallback source."
}
# Create install directory and move binary
if (-not (Test-Path $InstallDir)) {
New-Item -ItemType Directory -Path $InstallDir | Out-Null
}
$BinaryPath = Join-Path $TmpDir "${Binary}.exe"
Write-Host "=> Installing to $InstallDir..."
Move-Item -Path $BinaryPath -Destination (Join-Path $InstallDir "${Binary}.exe") -Force
# Keep the immutable skill snapshot beside the executable so skill
# installation remains offline and tied to this CLI release.
if ($HasBundledSkills) {
$SkillsDest = Join-Path $InstallDir "skills\$SkillVersion"
if (-not (Test-Path $SkillsDest)) {
New-Item -ItemType Directory -Path $SkillsDest -Force | Out-Null
}
Copy-Item -Path (Join-Path $SkillsSource "*") -Destination $SkillsDest -Recurse -Force
Write-Host "=> Installed bundled skills to $SkillsDest"
}
} finally {
Remove-Item -Recurse -Force $TmpDir -ErrorAction SilentlyContinue
}
# Add to user PATH if not already present
$UserPath = [System.Environment]::GetEnvironmentVariable("PATH", "User")
if ($UserPath -notlike "*$InstallDir*") {
Write-Host "=> Adding $InstallDir to your user PATH..."
[System.Environment]::SetEnvironmentVariable(
"PATH",
"$UserPath;$InstallDir",
"User"
)
$env:PATH = "$env:PATH;$InstallDir"
Write-Host "=> PATH updated. You may need to restart your terminal for the change to take effect."
} else {
Write-Host "=> $InstallDir is already on your PATH."
}
Write-Host ""
Write-Host "=> Installation complete!"
Write-Host "=> Run 'fused-cli --help' to get started."
# Best-effort hint only -- never write into another tool's config on the
# user's behalf. We don't know which agent/app (if any) they use, so just
# point at the explicit, opt-in command for whichever ones look present.
$AgentHints = @{
"claude" = @{ For = "claude"; Name = "Claude Code" }
"codex" = @{ For = "codex"; Name = "Codex" }
"cursor" = @{ For = "cursor"; Name = "Cursor" }
"windsurf" = @{ For = "windsurf"; Name = "Windsurf" }
"agy" = @{ For = "antigravity"; Name = "Antigravity" }
}
foreach ($bin in $AgentHints.Keys) {
if (Get-Command $bin -ErrorAction SilentlyContinue) {
$info = $AgentHints[$bin]
Write-Host ""
Write-Host "=> Detected $($info.Name). Run 'fused-cli skill install --for $($info.For)' to add"
Write-Host " a skill that teaches it to configure Fused workspaces, connection/"
Write-Host " execution policies, and SDK/MCP configs."
}
}