@willh/copilotstatusline 0.2.2 → 0.2.4

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.
@@ -23,6 +23,8 @@ bun run example
23
23
 
24
24
  The external Copilot payload is parsed into `NormalizedCopilotStatus` before rendering. This boundary prevents payload aliases and nullable fields from spreading through widget logic.
25
25
 
26
+ Piped mode also passes the normalized payload to the local usage recorder before rendering. The recorder keeps bounded per-session state, appends TokenUsageInsights-compatible JSONL under `COPILOT_HOME`, and treats recording failures as non-fatal so filesystem problems cannot hide the status line.
27
+
26
28
  Formatter settings and Copilot CLI settings are separate:
27
29
 
28
30
  - formatter settings control lines, widgets, colors, Powerline, and local command behavior;
package/docs/USAGE.md CHANGED
@@ -6,6 +6,29 @@ GitHub Copilot CLI executes the configured shell command and sends a JSON object
6
6
 
7
7
  Unknown payload fields are accepted for forward compatibility. Missing optional fields hide the corresponding widgets. Invalid known field types fail the invocation with a concise stderr message and a nonzero exit code.
8
8
 
9
+ ## Automatic token usage recording
10
+
11
+ After a payload is validated, `copilotstatusline` automatically records cumulative and per-turn token usage locally. This requires no formatter option and uses the JSONL layout consumed by TokenUsageInsights.
12
+
13
+ Default files:
14
+
15
+ ```text
16
+ ~/.copilot/usage/usage-YYYY-MM-DD.jsonl
17
+ ~/.copilot/copilotstatusline-usage-state.json
18
+ ```
19
+
20
+ `COPILOT_HOME` changes both paths. The daily filename and entry timestamp use the local date and time-zone offset. Each entry can contain the Copilot session name, transcript path, working directory, version, model, token counters, context usage, durations, premium requests, and changed-line counts. These files remain local; recording and rendering make no network requests.
21
+
22
+ Only a positive increase in cumulative total tokens creates a JSONL entry. Per-session state prevents interleaved Copilot sessions from affecting one another. Missing session IDs are not fabricated and therefore are not recorded. File or lock errors are reported on stderr without suppressing status-line output.
23
+
24
+ Disable recording explicitly with:
25
+
26
+ ```sh
27
+ COPILOTSTATUSLINE_DISABLE_USAGE_RECORDING=1 copilotstatusline
28
+ ```
29
+
30
+ When Copilot invokes the command, set the same environment variable in its environment. Removing the integration does not delete recorded history. If TokenUsageInsights is configured with `COPILOT_DIR`, point it to the same directory as `COPILOT_HOME`.
31
+
9
32
  ## Installation
10
33
 
11
34
  Interactive installation:
@@ -44,6 +67,8 @@ Uninstallation removes `statusLine` only when its command is recognized as belon
44
67
 
45
68
  ## Formatter settings
46
69
 
70
+ The interactive editor accepts Up/Down arrows or Vim-style `k`/`j` for vertical navigation. The same shortcuts move lines and widgets while move mode is active. Widget search and text-editing fields keep `j` and `k` as normal text input. In the widget editor, `y` clones the selected widget.
71
+
47
72
  Default path:
48
73
 
49
74
  ```text
@@ -118,6 +143,21 @@ The normalized widgets currently use:
118
143
  - cost: API duration, total duration, premium requests, and added/removed lines;
119
144
  - permission state: `allow_all`.
120
145
 
146
+ Widget availability is divided by source:
147
+
148
+ | Source | Widgets | Availability |
149
+ | --- | --- | --- |
150
+ | Copilot payload | Model, Model ID, Copilot Version, Session ID, Current Directory | Shown when Copilot supplies the corresponding field or supported alias. |
151
+ | Optional Copilot payload | Reasoning, Session Name | Hidden when the active model has no reasoning effort or the session has no name. |
152
+ | Copilot token payload | Input Tokens, Output Tokens, Cache Read, Cache Write, Reasoning Tokens, Total Tokens, Last Call Input, Last Call Output | Zero is shown as a real value; a missing field is hidden instead of being converted to zero. |
153
+ | Copilot context payload | Current Context, Context Limit, Context Used, Context Remaining | Used percentage comes from the payload, or is derived when both the current value and limit are available. |
154
+ | Copilot cost payload | Premium Requests, API Duration, Session Duration, Lines Added, Lines Removed | Shown when the corresponding cumulative counter is available. |
155
+ | Copilot permission payload | Allow All | `Allow All: ON` and `Allow All: OFF` are rendered distinctly; a missing field is hidden. |
156
+ | Repository probes | Git Branch, Git Changes, Jujutsu Change | Requires the matching executable and repository. Failed or timed-out probes are hidden. |
157
+ | Local runtime | Terminal Width, Free Memory | Read from the current terminal and operating system. |
158
+ | User configuration | Custom Text, Custom Command | Requires configured text or a command that produces output. |
159
+ | Layout | Separator, Flex | Always available as formatting controls and does not represent Copilot payload data. |
160
+
121
161
  ## Diagnostics
122
162
 
123
163
  Inspect integration status:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willh/copilotstatusline",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "bugs": {
5
5
  "url": "https://github.com/doggy8088/copilotstatusline/issues"
6
6
  },