| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
A status bar that works for both Claude Code and GitHub Copilot CLI — plus a high-contrast/neon output proxy for Copilot CLI specifically.
| Segment | Meaning | Color |
|---|---|---|
| Sonnet 4.6 (h) | Active model, plus reasoning effort in parens (low/md/h/xh/MX — Claude Code only, omitted on Copilot CLI) | Magenta |
| 122K | Tokens used in the current context window | Green (< 250K) → yellow (< 1M) → red (≥ 1M) |
| 61% | Context window used | Green → yellow → orange → red |
| AC!! | Auto-compact imminent (≤ 20% context remaining) | Yellow → orange → red |
| PEAK / 🌙 | API peak hours (5–11 AM Pacific, Mon–Fri) | Yellow (peak) / teal (off-peak) |
| my-project | Working directory, last path segment | Orange |
The peak/off-peak indicator includes a live countdown to the next state change.
Prerequisites: Node.js (18+) and Claude Code.
Keep this folder wherever you like (this README uses C:\projects\claude-statusline; adjust the path below if you put it elsewhere). No install step — statusline.js has no dependencies of its own.
Add the statusLine key to ~/.claude/settings.json (merge into the existing JSON object, don't replace it):
macOS / Linux
{
"statusLine": {
"type": "command",
"command": "node /home/your-username/projects/claude-statusline/statusline.js"
}
}Windows
{
"statusLine": {
"type": "command",
"command": "node C:/projects/claude-statusline/statusline.js"
}
}(Use forward slashes even on Windows.)
Restart Claude Code (or start a new session). The status bar updates on every turn.
Claude Code's stdin JSON schema is stable and documented at code.claude.com/docs/en/statusline: context_window.total_input_tokens, context_window.remaining_percentage, model.display_name, cwd. example-input.json in this repo is a sanitized real payload matching that schema, useful for building/testing against without a live session.
Prerequisites: Node.js (18+) and GitHub Copilot CLI (copilot.exe).
Keep this folder at C:\projects\claude-statusline (or update the path below if you move it).
In C:\Users\<you>\.copilot\settings.json, add/merge:
{
"statusLine": {
"type": "command",
"command": "node C:/projects/claude-statusline/statusline.js"
}
}(Use forward slashes even on Windows.)
Restart Copilot CLI / open a new session.
GitHub Copilot CLI's statusline payload isn't pinned by a stable public schema the way Claude Code's is — field names below were confirmed from copilot help config (statusLine section), EncodeTS/copilot-statusline (a real third-party Copilot CLI statusline implementation requiring current_context_tokens / displayed_context_limit under context_window), and blog.madkoo.net's defensive field-probing statusline script, which enumerates every field-name variant seen across Copilot CLI versions.
Spawns the real copilot.exe inside a pseudo-console (via node-pty) so it still detects a TTY and emits color, then intercepts its output byte-for-byte and rewrites every color-setting SGR sequence (truecolor 38;2;/48;2;, 256-color 38;5;/48;5;, and standard 16-color 30-37/90-97/40-47/100-107) through a transform. This step is specific to Copilot CLI's own output and isn't used with Claude Code.
Copilot CLI's built-in themes (default, github, dim, high-contrast, colorblind) are baked into the copilot.exe binary as hardcoded 24-bit truecolor (and some standard 16/256-color) ANSI codes — no terminal color scheme change can fix low contrast, since Copilot CLI's colors bypass the terminal's palette entirely. copilot-hc.js patches this at the byte-stream level:
All the brightness/saturation constants live near the top of the file (DARK_BACKGROUND_MAX_AVG, TEXT_BLEND_FACTOR, WHITE_SNAP_THRESHOLD, and the neonify() saturation/lightness math) — tune them there if you want a different intensity.
cd C:\projects\claude-statusline && npm install (installs node-pty; already done if node_modules\node-pty exists).
Edit REAL_COPILOT at the top of copilot-hc.js if your copilot.exe isn't at C:\Users\<you>\AppData\Local\Microsoft\WinGet\Links\copilot.exe (find it with (Get-Command copilot).Source in PowerShell, resolving any symlink with Get-Item <path> | Select-Object -Expand Target).
Add a copilot function or alias to your shell profile(s) so plain copilot ... transparently runs through the wrapper.
function copilot {
& "C:\Program Files\nodejs\node.exe" "C:\projects\claude-statusline\copilot-hc.js" @args
}alias copilot='node "C:/projects/claude-statusline/copilot-hc.js" --yolo'Open a brand new terminal tab/window (existing tabs won't pick up profile changes) and run copilot as usual.
statusline.js is a single self-contained Node.js file, no build step, no dependencies.
Change peak hours or timezoneFind the isPeak assignment and edit the hour bounds or the timezone string:
// Change 5 and 11 to your preferred window, or swap the timezone
const isPeak = isWeekday && ptHour >= 5 && ptHour < 11;
// timeZone: 'America/Los_Angeles' ← change thisif (used >= 95) color = FG.red;
else if (used >= 80) color = FG.orange;
else if (used >= 60) color = FG.yellow;
else color = FG.green;Change 95, 80, 60 to whatever breakpoints suit your workflow.
Remove a segmentComment out the matching parts.push(...) call near the bottom of the file.
statusline-debug.js captures the raw JSON payload piped to the status line command and writes it to disk — handy when building or troubleshooting a status line against either tool.
Temporarily point the relevant settings.json at the debug script instead of statusline.js:
{
"statusLine": {
"type": "command",
"command": "node C:/projects/claude-statusline/statusline-debug.js"
}
}Run Claude Code or Copilot CLI for one turn. The status bar shows DEBUG: wrote ....
Open the output file (default: ~/statusline-capture.json). Override the path with the STATUSLINE_DEBUG_PATH environment variable.
example-input.json in this repo shows a sanitized example of the Claude Code payload schema, so you can build against it without running a live session.
Both Claude Code and Copilot CLI pipe a JSON payload to the status line command via stdin on every turn. The script parses context-window metrics and model info defensively — trying Claude Code's documented field names first, falling back to Copilot CLI's field-name variants — builds an ANSI-colored string, and writes it to stdout. The host tool renders that string in its status bar.
Claude Code / Copilot CLI ──stdin──▶ node statusline.js ──stdout──▶ status bar
JSON ANSI string
The 3-second setTimeout exits the process if stdin never closes — without it, Node processes stack up across long sessions.
MIT
| Back | FazBrowse Home | New Git URL |