@willh/copilotstatusline 0.2.1 → 0.2.3

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:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willh/copilotstatusline",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "bugs": {
5
5
  "url": "https://github.com/doggy8088/copilotstatusline/issues"
6
6
  },