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:
@@ -288,17 +288,39 @@ this tool writes is referenced by it:
|
|||||||
|
|
||||||
## Setup
|
## Setup
|
||||||
|
|
||||||
|
One line, on any machine that can reach the repo (PowerShell 5.1 is fine):
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
cd c:\Users\smoido\Projects\cli\claude-code-switcher
|
irm https://git.nebulm.com/smoido/claude-mode/raw/branch/master/install.ps1 | iex
|
||||||
|
```
|
||||||
|
|
||||||
|
Piped in like that there is no checkout, so the installer fetches the
|
||||||
|
repository archive to `%TEMP%` and installs from it. To pass switches
|
||||||
|
(`-Force`, `-SkipKeyPrompt`), download first and run the file:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
irm https://git.nebulm.com/smoido/claude-mode/raw/branch/master/install.ps1 -OutFile install.ps1
|
||||||
|
.\install.ps1 -Force
|
||||||
|
```
|
||||||
|
|
||||||
|
Or clone it — the normal path if you want to read the code and pull updates:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
git clone https://git.nebulm.com/smoido/claude-mode.git
|
||||||
|
cd claude-mode
|
||||||
.\install.ps1
|
.\install.ps1
|
||||||
```
|
```
|
||||||
|
|
||||||
Installs to `~/.claude-mode/` (ACL: you only), drops `claude-mode.cmd` into
|
All three install the same way: to `~/.claude-mode/` (ACL: you only), dropping
|
||||||
`~/.local/bin` (already on your User PATH, next to `claude.exe`), and adds a
|
`claude-mode.cmd` into `~/.local/bin` (already on your User PATH, next to
|
||||||
marked block to `~/Documents/WindowsPowerShell/profile.ps1`.
|
`claude.exe`), and adding a marked block to
|
||||||
|
`~/Documents/WindowsPowerShell/profile.ps1`.
|
||||||
`~/.claude/settings.json` is **not** touched by the installer — only by an actual
|
`~/.claude/settings.json` is **not** touched by the installer — only by an actual
|
||||||
mode switch, which backs it up to `~/.claude-mode/backups/` first (last 20 kept).
|
mode switch, which backs it up to `~/.claude-mode/backups/` first (last 20 kept).
|
||||||
|
|
||||||
|
Re-running any of them is a safe upgrade: scripts are overwritten, existing
|
||||||
|
presets are kept unless `-Force` is passed.
|
||||||
|
|
||||||
If the profile doesn't load: `Set-ExecutionPolicy -Scope CurrentUser RemoteSigned`.
|
If the profile doesn't load: `Set-ExecutionPolicy -Scope CurrentUser RemoteSigned`.
|
||||||
|
|
||||||
## Restarting sessions
|
## Restarting sessions
|
||||||
|
|||||||
+27
-1
@@ -18,7 +18,33 @@ param(
|
|||||||
Set-StrictMode -Version 1.0
|
Set-StrictMode -Version 1.0
|
||||||
$ErrorActionPreference = 'Stop'
|
$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'
|
$root = Join-Path $env:USERPROFILE '.claude-mode'
|
||||||
|
|
||||||
Write-Host "installing claude-mode -> $root" -ForegroundColor Cyan
|
Write-Host "installing claude-mode -> $root" -ForegroundColor Cyan
|
||||||
|
|||||||
Reference in New Issue
Block a user