copilot-statusline 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +25 -0
- package/README.md +620 -0
- package/dist/copilot-statusline.js +63469 -0
- package/dist/launcher.cmd +7 -0
- package/dist/launcher.sh +14 -0
- package/package.json +73 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 copilot-statusline contributors
|
|
4
|
+
|
|
5
|
+
Portions of this software are derived from ccstatusline
|
|
6
|
+
(https://github.com/sirmalloc/ccstatusline), which is:
|
|
7
|
+
Copyright (c) 2025 Matthew Breedlove (https://github.com/sirmalloc)
|
|
8
|
+
|
|
9
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
in the Software without restriction, including without limitation the rights
|
|
12
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
furnished to do so, subject to the following conditions:
|
|
15
|
+
|
|
16
|
+
The above copyright notice and this permission notice shall be included in all
|
|
17
|
+
copies or substantial portions of the Software.
|
|
18
|
+
|
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,620 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<pre>
|
|
4
|
+
_ _ _ _ _ _ _
|
|
5
|
+
___ ___ _ __ (_) | ___ | |_ ___| |_ __ _| |_ _ _ ___| (_)_ __ ___
|
|
6
|
+
/ __/ _ \| '_ \| | |/ _ \| __| / __| __/ _` | __| | | / __| | | '_ \ / _ \
|
|
7
|
+
| (_| (_) | |_) | | | (_) | |_ \__ \ || (_| | |_| |_| \__ \ | | | | | __/
|
|
8
|
+
\___\___/| .__/|_|_|\___/ \__| |___/\__\__,_|\__|\__,_|___/_|_|_| |_|\___|
|
|
9
|
+
|_|
|
|
10
|
+
</pre>
|
|
11
|
+
|
|
12
|
+
# copilot-statusline
|
|
13
|
+
|
|
14
|
+
**🎨 A highly customizable status line formatter for GitHub Copilot CLI**
|
|
15
|
+
*Display model info, git branch, token usage, premium requests, and other metrics in your terminal*
|
|
16
|
+
|
|
17
|
+
[](https://www.npmjs.com/package/copilot-statusline)
|
|
18
|
+
[](https://www.npmjs.com/package/copilot-statusline)
|
|
19
|
+
[](LICENSE)
|
|
20
|
+
[](https://nodejs.org)
|
|
21
|
+
[](https://bun.sh)
|
|
22
|
+
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
> **Based on [ccstatusline](https://github.com/sirmalloc/ccstatusline)** by [@sirmalloc](https://github.com/sirmalloc) — the excellent customizable statusline for Claude Code CLI. This project adapts its architecture, TUI, and rendering engine for the GitHub Copilot CLI payload format. Huge thanks to Matthew Breedlove for the original work.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## 📚 Table of Contents
|
|
30
|
+
|
|
31
|
+
- [Features](#-features)
|
|
32
|
+
- [Quick Start](#-quick-start)
|
|
33
|
+
- [Windows Support](#-windows-support)
|
|
34
|
+
- [Usage](#-usage)
|
|
35
|
+
- [Available Widgets](#-available-widgets)
|
|
36
|
+
- [Copilot-Unique Widgets](#-copilot-unique-widgets)
|
|
37
|
+
- [Widget Editor Keybinds](#-widget-editor-keybinds)
|
|
38
|
+
- [Custom Widgets](#-custom-widgets)
|
|
39
|
+
- [Global Options](#-global-options)
|
|
40
|
+
- [Terminal Width Options](#-terminal-width-options)
|
|
41
|
+
- [Configuration](#-configuration)
|
|
42
|
+
- [Development](#️-development)
|
|
43
|
+
- [Differences from ccstatusline](#-differences-from-ccstatusline)
|
|
44
|
+
- [Acknowledgments](#-acknowledgments)
|
|
45
|
+
- [License](#-license)
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## ✨ Features
|
|
50
|
+
|
|
51
|
+
- **📊 Real-time Metrics** — Model name, git branch, token usage, premium requests, session duration, and more
|
|
52
|
+
- **🎨 Fully Customizable** — Choose what to display and customize colors for each widget
|
|
53
|
+
- **⚡ Powerline Support** — Beautiful Powerline-style rendering with arrow separators, caps, and custom themes
|
|
54
|
+
- **📐 Multi-line Support** — Configure any number of independent status lines
|
|
55
|
+
- **🖥️ Interactive TUI** — Built-in configuration interface using React/Ink
|
|
56
|
+
- **🔎 Fast Widget Picker** — Add/change widgets by category with search and ranked matching
|
|
57
|
+
- **⚙️ Global Options** — Apply consistent formatting across all widgets (padding, separators, bold, background)
|
|
58
|
+
- **🚀 Cross-platform** — Works seamlessly on macOS, Linux, and Windows with both Bun and Node.js
|
|
59
|
+
- **📏 Smart Width Detection** — Automatically adapts to terminal width with flex separators
|
|
60
|
+
- **⚡ Zero Config** — Sensible defaults that work out of the box
|
|
61
|
+
- **🔒 Fully Independent** — Completely separate from ccstatusline (different config paths, different npm package)
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## 🚀 Quick Start
|
|
66
|
+
|
|
67
|
+
### No installation needed! Use directly with npx or bunx:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# Run the configuration TUI with npm
|
|
71
|
+
npx -y copilot-statusline@latest
|
|
72
|
+
|
|
73
|
+
# Or with Bun (faster)
|
|
74
|
+
bunx -y copilot-statusline@latest
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Configure copilot-statusline
|
|
78
|
+
|
|
79
|
+
The interactive configuration tool provides a terminal UI where you can:
|
|
80
|
+
- Configure multiple separate status lines
|
|
81
|
+
- Add/remove/reorder status line widgets
|
|
82
|
+
- Customize colors for each widget (foreground, background, bold)
|
|
83
|
+
- Configure Powerline mode with themes
|
|
84
|
+
- Set global overrides (padding, separators, color overrides)
|
|
85
|
+
- Install/uninstall to Copilot CLI settings
|
|
86
|
+
- Preview your status line in real-time
|
|
87
|
+
|
|
88
|
+
> 💡 **Tip:** Your settings are automatically saved to `~/.config/copilot-statusline/settings.json`
|
|
89
|
+
|
|
90
|
+
### Copilot CLI config.json format
|
|
91
|
+
|
|
92
|
+
When you install from the TUI, copilot-statusline writes a `statusLine` command object to your Copilot CLI config:
|
|
93
|
+
|
|
94
|
+
```json
|
|
95
|
+
{
|
|
96
|
+
"statusLine": {
|
|
97
|
+
"type": "command",
|
|
98
|
+
"command": "npx -y copilot-statusline@latest",
|
|
99
|
+
"padding": 0
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Other supported command values:
|
|
105
|
+
- `bunx -y copilot-statusline@latest`
|
|
106
|
+
- `copilot-statusline` (for global installs)
|
|
107
|
+
|
|
108
|
+
**Settings location:** `~/.copilot/config.json` (or use `--config-dir` with Copilot CLI to change)
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## 🪟 Windows Support
|
|
113
|
+
|
|
114
|
+
copilot-statusline works on Windows with full feature compatibility across PowerShell (5.1+ and 7+), Command Prompt, and WSL.
|
|
115
|
+
|
|
116
|
+
### Installation on Windows
|
|
117
|
+
|
|
118
|
+
#### Option 1: Using Bun (Recommended)
|
|
119
|
+
```powershell
|
|
120
|
+
# Install Bun for Windows
|
|
121
|
+
irm bun.sh/install.ps1 | iex
|
|
122
|
+
|
|
123
|
+
# Run copilot-statusline
|
|
124
|
+
bunx -y copilot-statusline@latest
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
#### Option 2: Using Node.js
|
|
128
|
+
```powershell
|
|
129
|
+
# Using npm
|
|
130
|
+
npx -y copilot-statusline@latest
|
|
131
|
+
|
|
132
|
+
# Using Yarn
|
|
133
|
+
yarn dlx copilot-statusline@latest
|
|
134
|
+
|
|
135
|
+
# Using pnpm
|
|
136
|
+
pnpm dlx copilot-statusline@latest
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Powerline Font Support on Windows
|
|
140
|
+
|
|
141
|
+
For optimal Powerline rendering on Windows:
|
|
142
|
+
|
|
143
|
+
**Windows Terminal** (Recommended):
|
|
144
|
+
- Supports Powerline fonts natively
|
|
145
|
+
- Download from [Microsoft Store](https://aka.ms/terminal)
|
|
146
|
+
|
|
147
|
+
**PowerShell/Command Prompt:**
|
|
148
|
+
```powershell
|
|
149
|
+
# Install JetBrains Mono Nerd Font via winget
|
|
150
|
+
winget install DEVCOM.JetBrainsMonoNerdFont
|
|
151
|
+
|
|
152
|
+
# Or download manually from: https://www.nerdfonts.com/font-downloads
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Windows Terminal Configuration
|
|
156
|
+
|
|
157
|
+
For the best experience:
|
|
158
|
+
|
|
159
|
+
```json
|
|
160
|
+
{
|
|
161
|
+
"profiles": {
|
|
162
|
+
"defaults": {
|
|
163
|
+
"font": {
|
|
164
|
+
"face": "JetBrainsMono Nerd Font",
|
|
165
|
+
"size": 12
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Windows Copilot CLI Integration
|
|
173
|
+
|
|
174
|
+
**Config location:** `%USERPROFILE%\.copilot\config.json`
|
|
175
|
+
|
|
176
|
+
```json
|
|
177
|
+
{
|
|
178
|
+
"statusLine": {
|
|
179
|
+
"type": "command",
|
|
180
|
+
"command": "npx -y copilot-statusline@latest",
|
|
181
|
+
"padding": 0
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### WSL (Windows Subsystem for Linux)
|
|
187
|
+
|
|
188
|
+
copilot-statusline works natively in WSL:
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
curl -fsSL https://bun.sh/install | bash
|
|
192
|
+
source ~/.bashrc
|
|
193
|
+
bunx -y copilot-statusline@latest
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Windows Troubleshooting
|
|
197
|
+
|
|
198
|
+
**Powerline symbols showing as boxes:**
|
|
199
|
+
```powershell
|
|
200
|
+
winget install DEVCOM.JetBrainsMonoNerdFont
|
|
201
|
+
# Then set the font in your terminal settings
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
**Git commands not recognized:**
|
|
205
|
+
```powershell
|
|
206
|
+
winget install Git.Git
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
**Execution Policy errors:**
|
|
210
|
+
```powershell
|
|
211
|
+
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## 📖 Usage
|
|
217
|
+
|
|
218
|
+
Once configured, copilot-statusline automatically formats your Copilot CLI status line. The status line appears below the input during Copilot CLI sessions.
|
|
219
|
+
|
|
220
|
+
### Runtime Modes
|
|
221
|
+
|
|
222
|
+
- **Interactive mode (TUI)** — Launches when there is no stdin input
|
|
223
|
+
- **Piped mode (renderer)** — Parses Copilot CLI JSON from stdin and prints formatted lines
|
|
224
|
+
|
|
225
|
+
```bash
|
|
226
|
+
# Interactive TUI
|
|
227
|
+
copilot-statusline
|
|
228
|
+
|
|
229
|
+
# Piped mode with example payload
|
|
230
|
+
bun run example
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### How It Works
|
|
234
|
+
|
|
235
|
+
Copilot CLI spawns your status line command on every state change, passing session JSON via stdin. copilot-statusline parses the payload, renders the configured widgets, and outputs ANSI-colored text to stdout.
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
## 📊 Available Widgets
|
|
240
|
+
|
|
241
|
+
### Core
|
|
242
|
+
| Widget | Type | Description |
|
|
243
|
+
|--------|------|-------------|
|
|
244
|
+
| Model | `model` | Copilot model name (e.g., `claude-opus-4.6`) |
|
|
245
|
+
| Version | `version` | Copilot CLI version number |
|
|
246
|
+
| Thinking Effort | `thinking-effort` | Thinking effort level parsed from `display_name` (`low`/`medium`/`high`) |
|
|
247
|
+
| Model Multiplier | `model-multiplier` | Per-request premium multiplier (e.g., `3x`) |
|
|
248
|
+
|
|
249
|
+
### Session
|
|
250
|
+
| Widget | Type | Description |
|
|
251
|
+
|--------|------|-------------|
|
|
252
|
+
| Session Name | `session-name` | Copilot conversation title |
|
|
253
|
+
| Session ID | `session-id` | Short session identifier |
|
|
254
|
+
| Session Clock | `session-clock` | Elapsed session time (from `total_duration_ms`) |
|
|
255
|
+
| Premium Requests | `premium-requests` | Total premium requests consumed |
|
|
256
|
+
| API Calls | `api-calls` | Estimated API calls (`premium_requests / multiplier`) |
|
|
257
|
+
| Premium Rate | `premium-rate` | Premium request burn rate (requests/minute) |
|
|
258
|
+
|
|
259
|
+
### Tokens
|
|
260
|
+
| Widget | Type | Description |
|
|
261
|
+
|--------|------|-------------|
|
|
262
|
+
| Tokens Input | `tokens-input` | Total input tokens |
|
|
263
|
+
| Tokens Output | `tokens-output` | Total output tokens |
|
|
264
|
+
| Tokens Cached | `tokens-cached` | Total cached tokens (read + write) |
|
|
265
|
+
| Tokens Total | `tokens-total` | Total tokens |
|
|
266
|
+
| Last Call Input | `last-call-input` | Input tokens from most recent API call |
|
|
267
|
+
| Last Call Output | `last-call-output` | Output tokens from most recent API call |
|
|
268
|
+
| Cache Read Tokens | `cache-read-tokens` | Total cache read tokens |
|
|
269
|
+
| Cache Write Tokens | `cache-write-tokens` | Total cache write tokens |
|
|
270
|
+
|
|
271
|
+
### Context
|
|
272
|
+
| Widget | Type | Description |
|
|
273
|
+
|--------|------|-------------|
|
|
274
|
+
| Context Length | `context-length` | Context window size |
|
|
275
|
+
| Context % | `context-percentage` | Percentage of context window used or remaining |
|
|
276
|
+
| Context % (Usable) | `context-percentage-usable` | Percentage of usable context (80% of max) |
|
|
277
|
+
| Context Bar | `context-bar` | Visual progress bar for context usage |
|
|
278
|
+
| Remaining Tokens | `remaining-tokens` | Absolute remaining context tokens |
|
|
279
|
+
|
|
280
|
+
### Git
|
|
281
|
+
| Widget | Type | Description |
|
|
282
|
+
|--------|------|-------------|
|
|
283
|
+
| Git Branch | `git-branch` | Current branch name (with optional GitHub link) |
|
|
284
|
+
| Git Changes | `git-changes` | Insertions and deletions count (`+42,-10`) |
|
|
285
|
+
| Git Insertions | `git-insertions` | Uncommitted insertions only |
|
|
286
|
+
| Git Deletions | `git-deletions` | Uncommitted deletions only |
|
|
287
|
+
| Git Status | `git-status` | Staged/unstaged/untracked/conflicts indicators |
|
|
288
|
+
| Git Staged | `git-staged` | Staged changes indicator |
|
|
289
|
+
| Git Unstaged | `git-unstaged` | Unstaged changes indicator |
|
|
290
|
+
| Git Untracked | `git-untracked` | Untracked files indicator |
|
|
291
|
+
| Git Conflicts | `git-conflicts` | Merge conflict count |
|
|
292
|
+
| Git Ahead/Behind | `git-ahead-behind` | Commits ahead/behind upstream |
|
|
293
|
+
| Git SHA | `git-sha` | Short commit hash |
|
|
294
|
+
| Git PR | `git-pr` | Current pull request number |
|
|
295
|
+
| Git Root Dir | `git-root-dir` | Repository root directory name |
|
|
296
|
+
| Git Origin Owner | `git-origin-owner` | Remote origin owner |
|
|
297
|
+
| Git Origin Repo | `git-origin-repo` | Remote origin repo name |
|
|
298
|
+
| Git Origin Owner/Repo | `git-origin-owner-repo` | Remote origin `owner/repo` |
|
|
299
|
+
| Git Upstream Owner | `git-upstream-owner` | Upstream remote owner |
|
|
300
|
+
| Git Upstream Repo | `git-upstream-repo` | Upstream remote repo name |
|
|
301
|
+
| Git Upstream Owner/Repo | `git-upstream-owner-repo` | Upstream `owner/repo` |
|
|
302
|
+
| Git Is Fork | `git-is-fork` | Fork detection indicator |
|
|
303
|
+
|
|
304
|
+
### System
|
|
305
|
+
| Widget | Type | Description |
|
|
306
|
+
|--------|------|-------------|
|
|
307
|
+
| Current Working Dir | `current-working-dir` | Current directory with configurable segment display and `~` abbreviation |
|
|
308
|
+
| Terminal Width | `terminal-width` | Terminal width in columns |
|
|
309
|
+
| Free Memory | `free-memory` | System free memory |
|
|
310
|
+
|
|
311
|
+
### Custom
|
|
312
|
+
| Widget | Type | Description |
|
|
313
|
+
|--------|------|-------------|
|
|
314
|
+
| Custom Text | `custom-text` | User-defined static text (supports emoji) |
|
|
315
|
+
| Custom Command | `custom-command` | Shell command output (refreshes on each state change) |
|
|
316
|
+
| Custom Symbol | `custom-symbol` | Custom Unicode symbol |
|
|
317
|
+
| Link | `link` | Clickable terminal hyperlink (OSC 8) |
|
|
318
|
+
|
|
319
|
+
### Layout
|
|
320
|
+
| Widget | Type | Description |
|
|
321
|
+
|--------|------|-------------|
|
|
322
|
+
| Separator | `separator` | Visual divider between widgets |
|
|
323
|
+
| Flex Separator | `flex-separator` | Expands to fill available terminal width |
|
|
324
|
+
|
|
325
|
+
---
|
|
326
|
+
|
|
327
|
+
## 🆕 Copilot-Unique Widgets
|
|
328
|
+
|
|
329
|
+
These widgets are exclusive to copilot-statusline and not available in ccstatusline:
|
|
330
|
+
|
|
331
|
+
| Widget | Type | Description |
|
|
332
|
+
|--------|------|-------------|
|
|
333
|
+
| Model Multiplier | `model-multiplier` | Premium cost multiplier parsed from `display_name` (e.g., `3x`, `6x`) |
|
|
334
|
+
| Premium Requests | `premium-requests` | Total premium requests consumed this session |
|
|
335
|
+
| API Calls | `api-calls` | Estimated actual API calls: `total_premium_requests / multiplier` |
|
|
336
|
+
| Premium Rate | `premium-rate` | Burn rate in requests/minute |
|
|
337
|
+
| Last Call Input | `last-call-input` | Input tokens from the most recent API call |
|
|
338
|
+
| Last Call Output | `last-call-output` | Output tokens from the most recent API call |
|
|
339
|
+
| Remaining Tokens | `remaining-tokens` | Absolute remaining context window tokens |
|
|
340
|
+
| Cache Read Tokens | `cache-read-tokens` | Total cache read tokens |
|
|
341
|
+
| Cache Write Tokens | `cache-write-tokens` | Total cache write tokens |
|
|
342
|
+
|
|
343
|
+
---
|
|
344
|
+
|
|
345
|
+
## ⌨️ Widget Editor Keybinds
|
|
346
|
+
|
|
347
|
+
Common controls in the line editor:
|
|
348
|
+
|
|
349
|
+
| Key | Action |
|
|
350
|
+
|-----|--------|
|
|
351
|
+
| `↑` `↓` | Select widget |
|
|
352
|
+
| `←` `→` | Open widget picker to change type |
|
|
353
|
+
| `a` | Add widget via picker |
|
|
354
|
+
| `i` | Insert widget before current |
|
|
355
|
+
| `d` | Delete selected widget |
|
|
356
|
+
| `m` | Toggle move mode (reorder with `↑` `↓`) |
|
|
357
|
+
| `r` | Toggle raw value mode (supported widgets) |
|
|
358
|
+
| `c` | Clear all widgets (with confirmation) |
|
|
359
|
+
| `Space` | Edit separator character |
|
|
360
|
+
|
|
361
|
+
Widget-specific shortcuts:
|
|
362
|
+
|
|
363
|
+
| Widget | Key | Action |
|
|
364
|
+
|--------|-----|--------|
|
|
365
|
+
| Git widgets | `h` | Toggle hide `no git` output |
|
|
366
|
+
| Git Branch | `l` | Toggle GitHub link |
|
|
367
|
+
| Context % widgets | `u` | Toggle used/remaining display |
|
|
368
|
+
| Context Bar | `p` | Cycle bar style (short/full) |
|
|
369
|
+
| Current Working Dir | `h` | Toggle `~` home abbreviation |
|
|
370
|
+
| Current Working Dir | `s` | Edit segment limit |
|
|
371
|
+
| Current Working Dir | `f` | Toggle fish-style path |
|
|
372
|
+
| Custom Command | `e` | Edit command |
|
|
373
|
+
| Custom Command | `w` | Set max width |
|
|
374
|
+
| Custom Command | `t` | Set timeout |
|
|
375
|
+
| Custom Command | `p` | Toggle preserve ANSI colors |
|
|
376
|
+
| Link | `u` | Edit URL |
|
|
377
|
+
| Link | `e` | Edit link text |
|
|
378
|
+
|
|
379
|
+
### 🔤 Raw Value Mode
|
|
380
|
+
|
|
381
|
+
Some widgets support raw mode which displays just the value without a label:
|
|
382
|
+
- Normal: `Model: claude-opus-4.6` → Raw: `claude-opus-4.6`
|
|
383
|
+
- Normal: `Reqs: 15` → Raw: `15`
|
|
384
|
+
- Normal: `Session: 2hr 15m` → Raw: `2hr 15m`
|
|
385
|
+
- Normal: `Ctx: 18.0%` → Raw: `18.0%`
|
|
386
|
+
|
|
387
|
+
---
|
|
388
|
+
|
|
389
|
+
## 🔧 Custom Widgets
|
|
390
|
+
|
|
391
|
+
### Custom Text Widget
|
|
392
|
+
Add static text to your status line. Supports emoji. Perfect for:
|
|
393
|
+
- Project identifiers
|
|
394
|
+
- Environment indicators (dev/prod)
|
|
395
|
+
- Personal labels
|
|
396
|
+
|
|
397
|
+
### Custom Command Widget
|
|
398
|
+
Execute shell commands and display their output dynamically:
|
|
399
|
+
- Refreshes whenever the Copilot CLI updates the status line
|
|
400
|
+
- Receives the full Copilot JSON payload via stdin
|
|
401
|
+
- Configurable timeout (default: 1000ms)
|
|
402
|
+
- Optional max-width truncation
|
|
403
|
+
- Optional ANSI color preservation
|
|
404
|
+
|
|
405
|
+
Examples:
|
|
406
|
+
- `pwd | xargs basename` — Show current directory name
|
|
407
|
+
- `node -v` — Display Node.js version
|
|
408
|
+
- `git rev-parse --short HEAD` — Show current commit hash
|
|
409
|
+
- `date +%H:%M` — Display current time
|
|
410
|
+
|
|
411
|
+
> ⚠️ Commands should complete quickly to avoid delays. Long-running commands will be killed after the configured timeout.
|
|
412
|
+
|
|
413
|
+
### Link Widget
|
|
414
|
+
Create clickable links in terminals that support OSC 8 hyperlinks:
|
|
415
|
+
- Configure URL and display text in the editor
|
|
416
|
+
- Falls back to plain text when URL is missing
|
|
417
|
+
|
|
418
|
+
---
|
|
419
|
+
|
|
420
|
+
## ⚙️ Global Options
|
|
421
|
+
|
|
422
|
+
Configure global formatting preferences that apply to all widgets:
|
|
423
|
+
|
|
424
|
+
| Key | Option | Description |
|
|
425
|
+
|-----|--------|-------------|
|
|
426
|
+
| `p` | Default Padding | Add consistent padding around each widget |
|
|
427
|
+
| `s` | Default Separator | Auto-insert separator between all widgets |
|
|
428
|
+
| `i` | Inherit Colors | Separators inherit colors from preceding widget |
|
|
429
|
+
| `o` | Global Bold | Apply bold to all text |
|
|
430
|
+
| `f` | Override Foreground | Force all widgets to use the same text color |
|
|
431
|
+
| `b` | Override Background | Force all widgets to use the same background color |
|
|
432
|
+
| `m` | Minimalist Mode | Show raw values only (no labels) |
|
|
433
|
+
|
|
434
|
+
> ⚠️ **VSCode Users:** If colors appear incorrect in the integrated terminal, adjust `terminal.integrated.minimumContrastRatio` to `1` in settings to disable contrast enforcement.
|
|
435
|
+
|
|
436
|
+
---
|
|
437
|
+
|
|
438
|
+
## 📏 Terminal Width Options
|
|
439
|
+
|
|
440
|
+
These settings control line truncation and flex separator behavior:
|
|
441
|
+
|
|
442
|
+
| Mode | Description |
|
|
443
|
+
|------|-------------|
|
|
444
|
+
| **Full width** | Uses full terminal width (may wrap with long content) |
|
|
445
|
+
| **Full width minus 40** (default) | Reserves 40 characters on the right to prevent wrapping |
|
|
446
|
+
| **Full width until compact** | Dynamic — switches based on context usage threshold (configurable, default 60%) |
|
|
447
|
+
|
|
448
|
+
### ✂️ Smart Truncation
|
|
449
|
+
|
|
450
|
+
When terminal width is detected, status lines automatically truncate with ellipsis (`...`) if they exceed the available width. Truncation is ANSI-aware, so color codes and OSC 8 hyperlinks remain well-formed.
|
|
451
|
+
|
|
452
|
+
---
|
|
453
|
+
|
|
454
|
+
## ⚙️ Configuration
|
|
455
|
+
|
|
456
|
+
### Configuration Files
|
|
457
|
+
|
|
458
|
+
| File | Purpose |
|
|
459
|
+
|------|---------|
|
|
460
|
+
| `~/.config/copilot-statusline/settings.json` | copilot-statusline widget/render settings |
|
|
461
|
+
| `~/.copilot/config.json` | Copilot CLI config (`statusLine` command object) |
|
|
462
|
+
|
|
463
|
+
### Example Configuration
|
|
464
|
+
|
|
465
|
+
```json
|
|
466
|
+
{
|
|
467
|
+
"version": 1,
|
|
468
|
+
"lines": [
|
|
469
|
+
[
|
|
470
|
+
{ "id": "1", "type": "model", "color": "cyan" },
|
|
471
|
+
{ "id": "2", "type": "separator" },
|
|
472
|
+
{ "id": "3", "type": "model-multiplier", "color": "yellow" },
|
|
473
|
+
{ "id": "4", "type": "separator" },
|
|
474
|
+
{ "id": "5", "type": "context-percentage", "color": "blue" },
|
|
475
|
+
{ "id": "6", "type": "separator" },
|
|
476
|
+
{ "id": "7", "type": "premium-requests", "color": "green" },
|
|
477
|
+
{ "id": "8", "type": "separator" },
|
|
478
|
+
{ "id": "9", "type": "session-clock", "color": "yellow" },
|
|
479
|
+
{ "id": "10", "type": "flex-separator" },
|
|
480
|
+
{ "id": "11", "type": "git-branch", "color": "magenta" }
|
|
481
|
+
],
|
|
482
|
+
[],
|
|
483
|
+
[]
|
|
484
|
+
],
|
|
485
|
+
"colorLevel": 2
|
|
486
|
+
}
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
Renders as:
|
|
490
|
+
```
|
|
491
|
+
opus-4.6 | 3x | Ctx: 18.0% | Reqs: 3 | Session: <1m ⎇ main
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
### Color Levels
|
|
495
|
+
|
|
496
|
+
| Level | Mode | Description |
|
|
497
|
+
|-------|------|-------------|
|
|
498
|
+
| 0 | No Color | Plain text only |
|
|
499
|
+
| 1 | Basic | 16 ANSI colors |
|
|
500
|
+
| 2 | 256 Color | 256 ANSI colors with custom codes (default) |
|
|
501
|
+
| 3 | Truecolor | 16 million colors with hex codes |
|
|
502
|
+
|
|
503
|
+
---
|
|
504
|
+
|
|
505
|
+
## 🛠️ Development
|
|
506
|
+
|
|
507
|
+
### Prerequisites
|
|
508
|
+
|
|
509
|
+
- [Bun](https://bun.sh) (v1.0+)
|
|
510
|
+
- Git
|
|
511
|
+
- Node.js 14+ (optional, for running built binary)
|
|
512
|
+
|
|
513
|
+
### Setup
|
|
514
|
+
|
|
515
|
+
```bash
|
|
516
|
+
git clone https://github.com/user/copilot-statusline.git
|
|
517
|
+
cd copilot-statusline
|
|
518
|
+
bun install
|
|
519
|
+
```
|
|
520
|
+
|
|
521
|
+
### Development Commands
|
|
522
|
+
|
|
523
|
+
```bash
|
|
524
|
+
bun run start # Run TUI mode
|
|
525
|
+
bun run example # Test with example payload
|
|
526
|
+
bun test # Run tests (71 tests)
|
|
527
|
+
bun run lint # Type check + ESLint
|
|
528
|
+
bun run lint:fix # Auto-fix lint issues
|
|
529
|
+
bun run build # Build for npm distribution
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
### Build Notes
|
|
533
|
+
|
|
534
|
+
- Build target is Node.js 14+ (`dist/copilot-statusline.js`)
|
|
535
|
+
- During install, `ink@6.2.0` is patched to fix backspace handling on macOS terminals
|
|
536
|
+
- A bash launcher (`dist/launcher.sh`) buffers stdin before passing to Node.js — this is needed because Copilot CLI closes the stdin pipe very quickly after writing
|
|
537
|
+
|
|
538
|
+
### Project Structure
|
|
539
|
+
|
|
540
|
+
```
|
|
541
|
+
copilot-statusline/
|
|
542
|
+
├── src/
|
|
543
|
+
│ ├── copilot-statusline.ts # Main entry point (piped + TUI dual mode)
|
|
544
|
+
│ ├── types/ # TypeScript type definitions
|
|
545
|
+
│ │ ├── CopilotPayload.ts # Zod schema for Copilot stdin JSON
|
|
546
|
+
│ │ ├── Settings.ts # Configuration schema
|
|
547
|
+
│ │ ├── Widget.ts # Widget interface
|
|
548
|
+
│ │ └── RenderContext.ts # Render context type
|
|
549
|
+
│ ├── widgets/ # 50 widget implementations
|
|
550
|
+
│ │ ├── Model.ts
|
|
551
|
+
│ │ ├── PremiumRequests.ts
|
|
552
|
+
│ │ ├── GitBranch.ts
|
|
553
|
+
│ │ └── ...
|
|
554
|
+
│ ├── tui/ # React/Ink configuration UI
|
|
555
|
+
│ │ ├── App.tsx # Root TUI component
|
|
556
|
+
│ │ └── components/ # UI components
|
|
557
|
+
│ └── utils/ # Utility functions
|
|
558
|
+
│ ├── config.ts # Settings management
|
|
559
|
+
│ ├── renderer.ts # Core rendering logic
|
|
560
|
+
│ ├── copilot-settings.ts # Copilot CLI integration
|
|
561
|
+
│ └── ...
|
|
562
|
+
├── scripts/ # Build scripts and example payloads
|
|
563
|
+
├── dist/ # Built output (generated)
|
|
564
|
+
├── package.json
|
|
565
|
+
├── tsconfig.json
|
|
566
|
+
└── vitest.config.ts
|
|
567
|
+
```
|
|
568
|
+
|
|
569
|
+
---
|
|
570
|
+
|
|
571
|
+
## 🔄 Differences from ccstatusline
|
|
572
|
+
|
|
573
|
+
copilot-statusline and ccstatusline are **fully independent** — they use separate config directories, separate npm packages, and can be installed side-by-side without interference.
|
|
574
|
+
|
|
575
|
+
| Aspect | ccstatusline | copilot-statusline |
|
|
576
|
+
|--------|--------------|-------------------|
|
|
577
|
+
| **Target** | Claude Code CLI | GitHub Copilot CLI |
|
|
578
|
+
| **Input format** | Claude Code StatusJSON | Copilot JSON payload |
|
|
579
|
+
| **Config path** | `~/.config/ccstatusline/` | `~/.config/copilot-statusline/` |
|
|
580
|
+
| **CLI integration** | `~/.claude/settings.json` | `~/.copilot/config.json` |
|
|
581
|
+
| **npm package** | `ccstatusline` | `copilot-statusline` |
|
|
582
|
+
| **Cost tracking** | USD session cost | Premium requests counter |
|
|
583
|
+
| **Speed metrics** | Input/output/total token speed | Not available (no per-request timing data) |
|
|
584
|
+
| **Session duration** | Parsed from transcript JSONL | Direct from `cost.total_duration_ms` |
|
|
585
|
+
| **Rate limits** | 5-hour blocks, weekly resets | Premium request tracking |
|
|
586
|
+
| **Copilot-exclusive** | — | Model multiplier, premium rate, API calls, cache tokens, last-call tokens |
|
|
587
|
+
| **ccstatusline-exclusive** | Vim mode, output style, skills, worktree, block timer, speed widgets | — |
|
|
588
|
+
|
|
589
|
+
---
|
|
590
|
+
|
|
591
|
+
## 🙏 Acknowledgments
|
|
592
|
+
|
|
593
|
+
This project is built on the foundation of [**ccstatusline**](https://github.com/sirmalloc/ccstatusline) by [Matthew Breedlove (@sirmalloc)](https://github.com/sirmalloc). The widget system, rendering engine, TUI configuration interface, Powerline support, and overall architecture are derived from ccstatusline's excellent codebase.
|
|
594
|
+
|
|
595
|
+
If you use Claude Code, check out the original — it's a fantastic tool:
|
|
596
|
+
|
|
597
|
+
[](https://github.com/sirmalloc/ccstatusline)
|
|
598
|
+
|
|
599
|
+
Additional thanks to:
|
|
600
|
+
- [Ink](https://github.com/vadimdemedes/ink) for the terminal UI framework
|
|
601
|
+
- [Zod](https://github.com/colinhacks/zod) for runtime schema validation
|
|
602
|
+
- The GitHub Copilot CLI team for the statusline API
|
|
603
|
+
|
|
604
|
+
---
|
|
605
|
+
|
|
606
|
+
## 📄 License
|
|
607
|
+
|
|
608
|
+
[MIT](LICENSE)
|
|
609
|
+
|
|
610
|
+
This project includes substantial portions of code from [ccstatusline](https://github.com/sirmalloc/ccstatusline) (MIT licensed, Copyright 2025 Matthew Breedlove). See the [LICENSE](LICENSE) file for full details.
|
|
611
|
+
|
|
612
|
+
---
|
|
613
|
+
|
|
614
|
+
<div align="center">
|
|
615
|
+
|
|
616
|
+
[](https://www.npmjs.com/package/copilot-statusline)
|
|
617
|
+
[](https://www.npmjs.com/package/copilot-statusline)
|
|
618
|
+
[](LICENSE)
|
|
619
|
+
|
|
620
|
+
</div>
|