Skip to content

kruzyk/zsh-copilot-statusline

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zsh-copilot-statusline

A ZSH plugin that adds a live statusline to GitHub Copilot CLI — no Oh-My-Posh, no extra renderers, no dependencies beyond Python 3 (always available on macOS/Linux).

Based on the approach described in Scott Hanselman's gist, adapted for pure ZSH / ANSI terminals.

What it looks like

  my-repo   ctx 123.5k/200.0k  ██████░░░░   ⏱ 00:12:34   +42/-8

Each segment uses a distinct ANSI background colour:

Segment Colour Content
Folder 🟠 orange Working directory name Copilot is operating in
Context 🟢 green current tokens / limit
Gauge green→orange→red Visual fill bar (shifts colour as context fills)
Duration 🔵 blue Elapsed session time HH:MM:SS
Changes 🟣 purple +lines added / -lines removed (hidden when zero)

Requirements

  • ZSH
  • Python 3 (standard on macOS / most Linux distros)
  • GitHub Copilot CLI with the experimental STATUS_LINE feature

Installation

With Znap (recommended)

Add to your ~/.zshrc:

znap source kruzyk/zsh-copilot-statusline

Then reload your shell and run the one-time setup:

source ~/.zshrc
copilot_statusline_setup

With any other plugin manager

Source the main plugin file from wherever your manager clones it:

source /path/to/zsh-copilot-statusline/zsh-copilot-statusline.plugin.zsh
copilot_statusline_setup

One-time setup

copilot_statusline_setup writes two keys into ~/.copilot/settings.json:

{
  "statusLine": {
    "type": "command",
    "command": "/path/to/plugin/scripts/statusline.sh",
    "padding": 1
  },
  "feature_flags": {
    "enabled": ["STATUS_LINE"]
  },
  "experimental": true
}

Existing settings are preserved — the function only merges/adds, never replaces.

After running setup, restart Copilot CLI:

/restart

Testing without Copilot CLI

copilot_statusline_test            # uses current $PWD
copilot_statusline_test ~/my-repo  # use a specific path

This pipes a sample JSON payload through the renderer so you can verify colours and layout before opening Copilot.

How it works

Copilot CLI  ──JSON──►  statusline.sh  ──exec──►  _renderer.py  ──ANSI text──►  Copilot CLI
                stdin                                                               stdout

Copilot CLI sends a JSON payload on stdin each time it wants to refresh the statusline.
statusline.sh is a thin bash entry point that exec-replaces itself with python3 _renderer.py, inheriting stdin.
The Python renderer parses the JSON and writes a single ANSI-coloured line to stdout.

Privacy

The statusline can appear in screenshots, screen recordings, and pair-programming sessions.
It intentionally shows only: folder name, token counts, elapsed time, and line-change counts.
No secrets, tokens, URLs, or personal data are rendered.

License

MIT

About

ZSH extension/plugin adding status bar for Copilot CLI

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors