mirror of
https://github.com/Andre-Bzk/claude-statusline-kit.git
synced 2026-11-15 09:33:04 +01:00
The install note and README claimed a Nerd Font was required. A codepoint audit of the glyphs confirms none fall in the Private Use Area — they are standard emoji and block-drawing characters that render via the OS emoji fallback. Overstating the requirement would push users to install fonts they do not need and imply the statusline breaks without one, which it does not.
91 lines
3.9 KiB
PowerShell
91 lines
3.9 KiB
PowerShell
#requires -Version 5.1
|
|
<#
|
|
install.ps1 — Deploys the Claude Code "cship" statusline onto this machine.
|
|
|
|
Idempotent: safe to run repeatedly. Copies the three assets to their target
|
|
locations, auto-detects the local pwsh path, and merges the statusLine block
|
|
into an existing ~/.claude/settings.json without touching other settings.
|
|
#>
|
|
[CmdletBinding()]
|
|
param(
|
|
# Overwrite an existing cship.toml even if one is already present.
|
|
[switch]$Force
|
|
)
|
|
|
|
$ErrorActionPreference = 'Stop'
|
|
$assets = Join-Path $PSScriptRoot 'assets'
|
|
|
|
function Write-Step { param($m) Write-Host " $m" -ForegroundColor Cyan }
|
|
function Write-Ok { param($m) Write-Host " OK $m" -ForegroundColor Green }
|
|
function Write-Warn { param($m) Write-Host " !! $m" -ForegroundColor Yellow }
|
|
|
|
Write-Host "`nClaude Code statusline installer" -ForegroundColor White
|
|
|
|
# --- Target locations -------------------------------------------------------
|
|
$localBin = Join-Path $env:USERPROFILE '.local\bin'
|
|
$config = Join-Path $env:USERPROFILE '.config'
|
|
$claude = Join-Path $env:USERPROFILE '.claude'
|
|
foreach ($d in @($localBin, $config, $claude)) {
|
|
New-Item -ItemType Directory -Force -Path $d | Out-Null
|
|
}
|
|
|
|
# --- 1. cship.exe -----------------------------------------------------------
|
|
Copy-Item (Join-Path $assets 'cship.exe') (Join-Path $localBin 'cship.exe') -Force
|
|
Write-Ok "cship.exe -> $localBin"
|
|
|
|
# --- 2. cship.toml (do not clobber a customised config unless -Force) --------
|
|
$tomlTarget = Join-Path $config 'cship.toml'
|
|
if ((Test-Path $tomlTarget) -and -not $Force) {
|
|
Write-Warn "cship.toml already exists, kept as-is (use -Force to overwrite)"
|
|
} else {
|
|
Copy-Item (Join-Path $assets 'cship.toml') $tomlTarget -Force
|
|
Write-Ok "cship.toml -> $config"
|
|
}
|
|
|
|
# --- 3. Wrapper script ------------------------------------------------------
|
|
$wrapperTarget = Join-Path $claude 'cship-statusline.ps1'
|
|
Copy-Item (Join-Path $assets 'cship-statusline.ps1') $wrapperTarget -Force
|
|
Write-Ok "cship-statusline.ps1 -> $claude"
|
|
|
|
# --- 4. Locate pwsh ---------------------------------------------------------
|
|
$pwsh = (Get-Command pwsh -ErrorAction SilentlyContinue).Source
|
|
if (-not $pwsh) {
|
|
$fallback = 'C:\Program Files\PowerShell\7\pwsh.exe'
|
|
if (Test-Path $fallback) {
|
|
$pwsh = $fallback
|
|
} else {
|
|
Write-Warn "PowerShell 7 (pwsh) not found. Install it, then re-run this script."
|
|
Write-Warn " winget install --id Microsoft.PowerShell -e"
|
|
$pwsh = $fallback # write the conventional path so it works once pwsh is installed
|
|
}
|
|
}
|
|
$pwshFwd = $pwsh.Replace('\', '/')
|
|
$wrapperFwd = $wrapperTarget.Replace('\', '/')
|
|
$command = '"{0}" -NoProfile -ExecutionPolicy Bypass -File "{1}"' -f $pwshFwd, $wrapperFwd
|
|
|
|
# --- 5. Merge statusLine into settings.json ---------------------------------
|
|
$settingsPath = Join-Path $claude 'settings.json'
|
|
if (Test-Path $settingsPath) {
|
|
Copy-Item $settingsPath "$settingsPath.bak" -Force
|
|
$settings = Get-Content $settingsPath -Raw | ConvertFrom-Json
|
|
} else {
|
|
$settings = [PSCustomObject]@{}
|
|
}
|
|
|
|
$statusLine = [PSCustomObject]@{ type = 'command'; command = $command }
|
|
if ($settings.PSObject.Properties.Name -contains 'statusLine') {
|
|
$settings.statusLine = $statusLine
|
|
} else {
|
|
$settings | Add-Member -MemberType NoteProperty -Name 'statusLine' -Value $statusLine
|
|
}
|
|
|
|
$settings | ConvertTo-Json -Depth 20 | Set-Content $settingsPath -Encoding UTF8
|
|
Write-Ok "settings.json statusLine wired to detected pwsh"
|
|
|
|
# --- Post-install notes -----------------------------------------------------
|
|
Write-Host "`nDone." -ForegroundColor Green
|
|
Write-Host "Notes:" -ForegroundColor White
|
|
Write-Host " -> Icons use standard Unicode (emoji + block chars), so no Nerd Font is needed."
|
|
Write-Host " Any emoji-capable terminal font works (Windows Terminal renders them via Segoe UI Emoji by default)."
|
|
Write-Host " Restart Claude Code (or start a new session) to see the statusline.`n"
|