Install straight from the repo with one piped command
Piped in via irm | iex there is no checkout next to the script, so the installer now notices that and fetches the repository archive to %TEMP% itself. README documents the one-liner, the download-and-run variant for switches, and the clone path. Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
+27
-1
@@ -18,7 +18,33 @@ param(
|
||||
Set-StrictMode -Version 1.0
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
$src = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
$repoUrl = 'https://git.nebulm.com/smoido/claude-mode'
|
||||
|
||||
# Running from a checkout, the source is the files next to this script. Piped
|
||||
# in (irm ... | iex) there is no script file and no checkout, so fetch the
|
||||
# repository archive and install from that instead.
|
||||
$src = $null
|
||||
if ($PSScriptRoot -and (Test-Path -LiteralPath (Join-Path $PSScriptRoot 'claude-mode.ps1'))) {
|
||||
$src = $PSScriptRoot
|
||||
}
|
||||
else {
|
||||
[Net.ServicePointManager]::SecurityProtocol =
|
||||
[Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
|
||||
$tmp = Join-Path $env:TEMP ('claude-mode-src-' + [IO.Path]::GetRandomFileName().Replace('.', ''))
|
||||
New-Item -ItemType Directory -Path $tmp -Force | Out-Null
|
||||
$zip = Join-Path $tmp 'repo.zip'
|
||||
Write-Host "no local checkout found - fetching source from $repoUrl" -ForegroundColor Cyan
|
||||
Invoke-WebRequest -Uri "$repoUrl/archive/master.zip" -OutFile $zip -UseBasicParsing
|
||||
Expand-Archive -LiteralPath $zip -DestinationPath $tmp
|
||||
# Forgejo nests everything under a repo-named folder; find it wherever it is.
|
||||
$extracted = Get-ChildItem -LiteralPath $tmp -Directory |
|
||||
Where-Object { Test-Path -LiteralPath (Join-Path $_.FullName 'claude-mode.ps1') } |
|
||||
Select-Object -First 1
|
||||
if ($extracted) { $src = $extracted.FullName }
|
||||
elseif (Test-Path -LiteralPath (Join-Path $tmp 'claude-mode.ps1')) { $src = $tmp }
|
||||
else { throw 'archive did not contain claude-mode.ps1 - repo layout changed?' }
|
||||
}
|
||||
|
||||
$root = Join-Path $env:USERPROFILE '.claude-mode'
|
||||
|
||||
Write-Host "installing claude-mode -> $root" -ForegroundColor Cyan
|
||||
|
||||
Reference in New Issue
Block a user