Files
André BezekandClaude Opus 4.8 ec1d3c4d04 docs: document PowerShell-host fallback and self-test in install steps
Update the README to match the installer's new behavior: it detects the
available PowerShell host (prefers pwsh 7, falls back to Windows PowerShell
5.1) instead of writing a broken pwsh path when PS7 is absent, and runs a
self-test to confirm the statusline renders. Removes the now-inaccurate claim
that PowerShell 7 must be installed first.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C4QKwZ7bC7oCMVtnuJdDKm
2026-07-19 12:21:22 +02:00

241 lines
11 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
[English](#english) | [Deutsch](#deutsch)
---
## English
# Claude Code Statusline Kit
A portable, self-contained kit that installs a custom Claude Code statusline
(built on the [`cship`](https://cship.dev) Starship fork) onto any Windows PC
with a single command.
![Statusline screenshot](docs/statusline_screenshot.png)
### What it installs
| Asset | Target location | Purpose |
| ----------------------------- | -------------------------- | ----------------------------------------- |
| `assets/cship.exe` | `~/.local/bin/` | Renders the statusline |
| `assets/cship.toml` | `~/.config/` | Module config (colors, icons, bars) |
| `assets/cship-statusline.ps1` | `~/.claude/` | Wrapper (progress bars, token formatting) |
| `statusLine` block | `~/.claude/settings.json` | Wires everything into Claude Code |
### Requirements
- **PowerShell 7** (`pwsh`). Install: `winget install --id Microsoft.PowerShell -e`
- An **emoji-capable terminal font** so `🤖 ⚡ 🧠 █░` render. **No Nerd Font
required** — the statusline deliberately uses only standard Unicode (emoji +
block-drawing chars), never Nerd-Font private-use glyphs. Windows Terminal
renders them via `Segoe UI Emoji` out of the box. As a safety net the
installer nevertheless installs a Nerd Font (Hack, ~17 MB) **per-user, no
admin rights** if none is present — see below.
### Progress bars & color thresholds
The statusline has three progress bars. Each fills from 0–100 % and switches
color at fixed thresholds:
| Bar | Measures | 🔵 blue | 🟡 yellow | 🔴 bold red |
| ------------ | --------------------------- | -------- | --------- | ----------- |
| 🧠 Context | context window filled | `< 20 %` | `≥ 20 %` | `≥ 40 %` |
| ⏳ 5h | 5-hour usage limit used | `< 40 %` | `≥ 40 %` | `≥ 70 %` |
| 📅 7d | 7-day usage limit used | `< 40 %` | `≥ 40 %` | `≥ 70 %` |
Thresholds are **percentages**, so they stay model-independent. On a 1M-token
context window the 🧠 bar therefore turns yellow at **200k** tokens and red at
**400k**. Colors: blue `#7dcfff`, yellow, bold red.
Where to change them:
- **🧠 Context** — `warn_threshold` / `critical_threshold` in
`[cship.context_bar]` (`assets/cship.toml`).
- **⏳ 5h / 📅 7d** — the color block in `assets/cship-statusline.ps1`; both
bars share it, so keep the two thresholds in sync.
### Install on a new PC
```powershell
git clone https://github.com/Andre-Bzk/claude-statusline-kit claude-statusline-kit
cd claude-statusline-kit
powershell -ExecutionPolicy Bypass -File .\install.ps1
```
Then restart Claude Code (or start a new session).
> **Why `powershell` and not `pwsh`?** The installer runs under the built-in
> **Windows PowerShell 5.1** (`powershell.exe`), which ships with every Windows
> — so bootstrapping works even before PowerShell 7 is installed. (`pwsh` would
> fail with *"pwsh is not recognized"* on a fresh PC.) To wire the statusline
> runtime into `settings.json` the installer detects the available host: it
> prefers `pwsh` (PowerShell 7, sharper glyphs) and falls back to Windows
> PowerShell 5.1 when PS7 isn't present — so the statusline works out of the box
> either way. Installing PowerShell 7 (see **Requirements**) is recommended but
> optional. A built-in self-test then confirms the statusline actually renders.
>
> **Why `-ExecutionPolicy Bypass`?** On a fresh Windows PC the per-user
> execution policy is `Restricted`, so a bare `.\install.ps1` fails with
> *"... cannot be loaded because running scripts is disabled on this system."*
> Passing `-ExecutionPolicy Bypass -File` runs the installer for this one
> invocation only — it changes **no** persistent machine or user setting.
> Extra options work the same way, e.g.
> `powershell -ExecutionPolicy Bypass -File .\install.ps1 -Force`.
>
> Prefer to unblock scripts once and for all? Run
> `Set-ExecutionPolicy -Scope CurrentUser RemoteSigned` (no admin needed), then
> `.\install.ps1` works directly.
The installer is **idempotent** — run it again anytime. It auto-detects the
PowerShell host on the target machine (pwsh 7, else Windows PowerShell 5.1) and
merges the `statusLine` block into an existing `settings.json` **without**
overwriting your other settings (a `.bak` backup is written first).
### Nerd Font (automatic, no admin)
If no Nerd Font is detected, the installer downloads one from
[ryanoasis/nerd-fonts](https://github.com/ryanoasis/nerd-fonts) and installs it
into the **per-user** font store (`%LOCALAPPDATA%\Microsoft\Windows\Fonts` +
`HKCU`), so **no administrator rights** are needed. If a download fails (e.g. no
internet), the step is skipped and the statusline still works via the emoji
fallback. To actually *use* the font, set it as your terminal font and restart
the terminal — the statusline renders correctly either way.
### Options
- `.\install.ps1 -Force` — also overwrite an existing `~/.config/cship.toml`
(by default an existing config is kept, so local tweaks survive).
- `.\install.ps1 -SkipFont` — skip the Nerd-Font check/install entirely.
- `.\install.ps1 -FontName FiraCode` — install a different Nerd Font
(default `Hack`; e.g. `FiraCode`, `CascadiaCode`, `JetBrainsMono`).
### Updating the kit
Edit the files under `assets/`, commit, `git push`. On another PC:
```powershell
git pull
.\install.ps1 -Force
```
---
## Deutsch
# Claude Code Statusline Kit
Ein portables, in sich geschlossenes Kit, das eine individuelle Claude-Code-
Statusline (basierend auf dem Starship-Fork [`cship`](https://cship.dev)) mit
einem einzigen Befehl auf jeden Windows-PC installiert.
![Screenshot der Statusline](docs/statusline_screenshot.png)
### Was installiert wird
| Asset | Zielort | Zweck |
| ----------------------------- | -------------------------- | ---------------------------------------- |
| `assets/cship.exe` | `~/.local/bin/` | Rendert die Statusline |
| `assets/cship.toml` | `~/.config/` | Modul-Konfiguration (Farben, Icons, Bars)|
| `assets/cship-statusline.ps1` | `~/.claude/` | Wrapper (Progress-Bars, Token-Format) |
| `statusLine`-Block | `~/.claude/settings.json` | Verdrahtet alles in Claude Code |
### Voraussetzungen
- **PowerShell 7** (`pwsh`). Installation: `winget install --id Microsoft.PowerShell -e`
- Ein **emoji-fähiger Terminal-Font**, damit `🤖 ⚡ 🧠 █░` dargestellt werden.
**Kein Nerd-Font nötig** — die Statusline nutzt bewusst nur Standard-Unicode
(Emoji + Block-Zeichen), keine Nerd-Font-Privatzeichen. Windows Terminal
rendert sie standardmäßig über `Segoe UI Emoji`. Als Sicherheitsnetz
installiert der Installer dennoch einen Nerd-Font (Hack, ~17 MB) **per-user,
ohne Admin-Rechte**, falls keiner vorhanden ist — siehe unten.
### Progress-Bars & Farbschwellen
Die Statusline hat drei Progress-Bars. Jeder füllt sich von 0–100 % und wechselt
an festen Schwellen die Farbe:
| Bar | Misst | 🔵 blau | 🟡 gelb | 🔴 fett rot |
| ------------ | ------------------------------ | -------- | -------- | ----------- |
| 🧠 Kontext | Kontextfenster gefüllt | `< 20 %` | `≥ 20 %` | `≥ 40 %` |
| ⏳ 5h | 5-Stunden-Limit ausgelastet | `< 40 %` | `≥ 40 %` | `≥ 70 %` |
| 📅 7d | 7-Tage-Limit ausgelastet | `< 40 %` | `≥ 40 %` | `≥ 70 %` |
Die Schwellen sind **Prozentwerte** und damit model-unabhängig. Bei einem
Kontextfenster von 1M Tokens wird der 🧠-Bar deshalb bei **200k** Tokens gelb
und bei **400k** rot. Farben: blau `#7dcfff`, gelb, fett rot.
Wo man sie ändert:
- **🧠 Kontext** — `warn_threshold` / `critical_threshold` in
`[cship.context_bar]` (`assets/cship.toml`).
- **⏳ 5h / 📅 7d** — der Farbblock in `assets/cship-statusline.ps1`; beide Bars
teilen ihn sich, also beide Schwellen synchron halten.
### Installation auf einem neuen PC
```powershell
git clone https://github.com/Andre-Bzk/claude-statusline-kit claude-statusline-kit
cd claude-statusline-kit
powershell -ExecutionPolicy Bypass -File .\install.ps1
```
Danach Claude Code neu starten (oder eine neue Session öffnen).
> **Warum `powershell` und nicht `pwsh`?** Der Installer läuft unter dem
> mitgelieferten **Windows PowerShell 5.1** (`powershell.exe`), das auf jedem
> Windows vorhanden ist — so klappt das Bootstrapping schon, bevor PowerShell 7
> installiert ist. (`pwsh` würde auf einem frischen PC mit *„pwsh wurde nicht
> erkannt"* fehlschlagen.) Um den Statusline-Runtime in die `settings.json`
> einzutragen, erkennt der Installer den vorhandenen Host: Er bevorzugt `pwsh`
> (PowerShell 7, schärfere Glyphen) und fällt auf Windows PowerShell 5.1 zurück,
> falls PS7 fehlt — die Statusline funktioniert also so oder so out of the box.
> PowerShell 7 zu installieren (siehe **Voraussetzungen**) ist empfohlen, aber
> optional. Ein integrierter Selbsttest bestätigt anschließend, dass die
> Statusline tatsächlich gerendert wird.
>
> **Warum `-ExecutionPolicy Bypass`?** Auf einem frischen Windows-PC steht die
> Execution Policy für den Benutzer auf `Restricted`, deshalb bricht ein bloßes
> `.\install.ps1` mit *„... cannot be loaded because running scripts is disabled
> on this system."* ab. `-ExecutionPolicy Bypass -File` führt den Installer nur
> für diesen einen Aufruf aus — es ändert **keine** dauerhafte System- oder
> Benutzereinstellung. Zusätzliche Optionen funktionieren genauso, z. B.
> `powershell -ExecutionPolicy Bypass -File .\install.ps1 -Force`.
>
> Skripte lieber dauerhaft freischalten? Einmalig
> `Set-ExecutionPolicy -Scope CurrentUser RemoteSigned` ausführen (keine
> Admin-Rechte nötig), danach klappt `.\install.ps1` direkt.
Der Installer ist **idempotent** — jederzeit erneut ausführbar. Er erkennt den
PowerShell-Host auf dem Zielrechner automatisch (pwsh 7, sonst Windows
PowerShell 5.1) und fügt den `statusLine`-Block in eine vorhandene
`settings.json` ein, **ohne** deine anderen Einstellungen zu überschreiben
(vorher wird ein `.bak`-Backup geschrieben).
### Nerd-Font (automatisch, ohne Admin)
Wird kein Nerd-Font erkannt, lädt der Installer einen von
[ryanoasis/nerd-fonts](https://github.com/ryanoasis/nerd-fonts) und installiert
ihn in den **benutzereigenen** Font-Speicher (`%LOCALAPPDATA%\Microsoft\Windows\Fonts`
+ `HKCU`) — **ohne Administrator-Rechte**. Schlägt der Download fehl (z. B. kein
Internet), wird der Schritt übersprungen und die Statusline funktioniert dank
Emoji-Fallback trotzdem. Um den Font tatsächlich zu *nutzen*, ihn als
Terminal-Font einstellen und das Terminal neu starten — die Statusline wird so
oder so korrekt dargestellt.
### Optionen
- `.\install.ps1 -Force` — überschreibt zusätzlich eine vorhandene
`~/.config/cship.toml` (standardmäßig wird eine bestehende Config behalten,
damit lokale Anpassungen erhalten bleiben).
- `.\install.ps1 -SkipFont` — überspringt die Nerd-Font-Prüfung/-Installation.
- `.\install.ps1 -FontName FiraCode` — installiert einen anderen Nerd-Font
(Standard `Hack`; z. B. `FiraCode`, `CascadiaCode`, `JetBrainsMono`).
### Kit aktualisieren
Dateien unter `assets/` bearbeiten, committen, `git push`. Auf einem anderen PC:
```powershell
git pull
.\install.ps1 -Force
```