copilot-statusline 0.1.8 → 0.1.9

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/README.md CHANGED
@@ -87,23 +87,24 @@ The interactive configuration tool provides a terminal UI where you can:
87
87
 
88
88
  > 💡 **Tip:** Your settings are automatically saved to `~/.config/copilot-statusline/settings.json`
89
89
 
90
- ### Copilot CLI config.json format
90
+ ### Copilot CLI Integration
91
91
 
92
- When you install from the TUI, copilot-statusline writes a `statusLine` command object to your Copilot CLI config:
92
+ When you install from the TUI, copilot-statusline creates a launcher script at `~/.copilot/statusline.sh` that uses `bunx`/`npx` to always run the latest version — **no manual upgrades needed**.
93
+
94
+ It also writes to your Copilot CLI config:
93
95
 
94
96
  ```json
97
+ // ~/.copilot/config.json
95
98
  {
96
99
  "statusLine": {
97
100
  "type": "command",
98
- "command": "npx -y copilot-statusline@latest",
101
+ "command": "/Users/you/.copilot/statusline.sh",
99
102
  "padding": 0
100
103
  }
101
104
  }
102
105
  ```
103
106
 
104
- Other supported command values:
105
- - `bunx -y copilot-statusline@latest`
106
- - `copilot-statusline` (for global installs)
107
+ > 💡 **Auto-upgrade:** The launcher script runs `bunx -y copilot-statusline@latest` (or `npx` if you used npm to run the TUI) under the hood, so you always get the latest version automatically.
107
108
 
108
109
  **Settings location:** `~/.copilot/config.json` (or use `--config-dir` with Copilot CLI to change)
109
110
 
@@ -513,7 +514,7 @@ opus-4.6 | 3x | Ctx: 18.0% | Reqs: 3 | Session: <1m ⎇ main
513
514
  ### Setup
514
515
 
515
516
  ```bash
516
- git clone https://github.com/user/copilot-statusline.git
517
+ git clone https://github.com/EncodeTS/copilot-statusline.git
517
518
  cd copilot-statusline
518
519
  bun install
519
520
  ```
@@ -52913,7 +52913,7 @@ import { execSync as execSync3 } from "child_process";
52913
52913
  import * as fs5 from "fs";
52914
52914
  import * as path4 from "path";
52915
52915
  var __dirname = "/Users/ts/workspace/active/statusline/copilot_statusline/src/utils";
52916
- var PACKAGE_VERSION = "0.1.8";
52916
+ var PACKAGE_VERSION = "0.1.9";
52917
52917
  function getPackageVersion() {
52918
52918
  if (/^\d+\.\d+\.\d+/.test(PACKAGE_VERSION)) {
52919
52919
  return PACKAGE_VERSION;
@@ -54076,15 +54076,17 @@ function getContextWindowMetrics(data) {
54076
54076
  }
54077
54077
  const rawUsedPercentage = toFiniteNonNegativeNumber(contextWindow.used_percentage);
54078
54078
  const rawRemainingPercentage = toFiniteNonNegativeNumber(contextWindow.remaining_percentage);
54079
+ const usedTokensFromRemaining = windowSize !== null && remainingTokens !== null ? windowSize - remainingTokens : null;
54079
54080
  const usedTokensFromPercentage = rawUsedPercentage !== null && windowSize !== null ? rawUsedPercentage / 100 * windowSize : null;
54080
- const usedTokens = currentUsageTotalTokens ?? usedTokensFromPercentage;
54081
+ const usedTokens = usedTokensFromRemaining ?? usedTokensFromPercentage ?? currentUsageTotalTokens;
54081
54082
  const usedPercentage = rawUsedPercentage !== null ? clampPercentage(rawUsedPercentage) : usedTokens !== null && windowSize !== null && windowSize > 0 ? clampPercentage(usedTokens / windowSize * 100) : null;
54082
54083
  const remainingPercentage = rawRemainingPercentage !== null ? clampPercentage(rawRemainingPercentage) : usedPercentage !== null ? 100 - usedPercentage : null;
54083
54084
  const totalTokens = currentUsageTotalTokens ?? toFiniteNonNegativeNumber(contextWindow.total_tokens) ?? (totalInputTokens !== null && totalOutputTokens !== null ? totalInputTokens + totalOutputTokens : null);
54085
+ const contextLengthFromAuthoritative = usedTokensFromRemaining ?? usedTokensFromPercentage;
54084
54086
  return {
54085
54087
  windowSize,
54086
54088
  usedTokens,
54087
- contextLengthTokens: contextLengthTokens ?? usedTokens,
54089
+ contextLengthTokens: contextLengthFromAuthoritative ?? contextLengthTokens ?? usedTokens,
54088
54090
  usedPercentage,
54089
54091
  remainingPercentage,
54090
54092
  totalInputTokens,
@@ -54498,17 +54500,14 @@ class ContextBarWidget {
54498
54500
  render(item, context, settings) {
54499
54501
  const displayMode = getDisplayMode(item);
54500
54502
  const barWidth = displayMode === "progress" ? 32 : 16;
54501
- const powerlineMode = settings.powerline?.enabled === true;
54503
+ const powerlineMode = settings.powerline.enabled;
54502
54504
  if (context.isPreview) {
54503
54505
  const previewDisplay = `${makeUsageProgressBar(25, barWidth, powerlineMode)} 50k/200k (25%)`;
54504
54506
  return item.rawValue ? previewDisplay : `Context: ${previewDisplay}`;
54505
54507
  }
54506
54508
  const contextWindowMetrics = getContextWindowMetrics(context.data);
54507
- let total = contextWindowMetrics.windowSize;
54509
+ const total = contextWindowMetrics.windowSize;
54508
54510
  const used = contextWindowMetrics.contextLengthTokens;
54509
- if (total === null) {
54510
- total = contextWindowMetrics.windowSize;
54511
- }
54512
54511
  if (used === null || total === null || total <= 0) {
54513
54512
  return null;
54514
54513
  }
@@ -62878,11 +62877,9 @@ var App2 = () => {
62878
62877
  const [powerlineFontStatus, setPowerlineFontStatus] = import_react45.useState({ installed: false });
62879
62878
  const [installingFonts, setInstallingFonts] = import_react45.useState(false);
62880
62879
  const [fontInstallMessage, setFontInstallMessage] = import_react45.useState(null);
62881
- const [existingStatusLine, setExistingStatusLine] = import_react45.useState(null);
62882
62880
  const [flashMessage, setFlashMessage] = import_react45.useState(null);
62883
62881
  const [previewIsTruncated, setPreviewIsTruncated] = import_react45.useState(false);
62884
62882
  import_react45.useEffect(() => {
62885
- setExistingStatusLine(getExistingStatusLine());
62886
62883
  loadSettings().then((loadedSettings) => {
62887
62884
  source_default.level = loadedSettings.colorLevel;
62888
62885
  setSettings(loadedSettings);
@@ -62951,7 +62948,6 @@ A launcher script will be created at ~/.copilot/statusline.sh`;
62951
62948
  try {
62952
62949
  installStatusLine();
62953
62950
  setIsCopilotInstalled(true);
62954
- setExistingStatusLine(getExistingStatusLine());
62955
62951
  setFlashMessage({ text: "✓ Installed to Copilot CLI", color: "green" });
62956
62952
  } catch (e) {
62957
62953
  const errorMsg = e instanceof Error ? e.message : String(e);
@@ -62976,7 +62972,6 @@ A launcher script will be created at ~/.copilot/statusline.sh`;
62976
62972
  action: async () => {
62977
62973
  uninstallStatusLine();
62978
62974
  setIsCopilotInstalled(false);
62979
- setExistingStatusLine(null);
62980
62975
  setScreen("main");
62981
62976
  setConfirmDialog(null);
62982
62977
  return Promise.resolve();
@@ -63230,9 +63225,7 @@ var CopilotPayloadSchema = exports_external.object({
63230
63225
  id: exports_external.string().nullable().optional(),
63231
63226
  display_name: exports_external.string().nullable().optional()
63232
63227
  }).optional(),
63233
- workspace: exports_external.object({
63234
- current_dir: exports_external.string().optional()
63235
- }).optional(),
63228
+ workspace: exports_external.object({ current_dir: exports_external.string().optional() }).optional(),
63236
63229
  version: exports_external.string().optional(),
63237
63230
  cost: exports_external.object({
63238
63231
  total_api_duration_ms: exports_external.number().optional(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "copilot-statusline",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "A customizable status line formatter for GitHub Copilot CLI — based on ccstatusline",
5
5
  "module": "src/copilot-statusline.ts",
6
6
  "type": "module",
@@ -28,8 +28,8 @@
28
28
  "chalk": "^5.5.0",
29
29
  "eslint": "^10.0.0",
30
30
  "eslint-import-resolver-typescript": "^4.4.4",
31
- "eslint-plugin-import": "^2.32.0",
32
31
  "eslint-plugin-import-newlines": "^2.0.0",
32
+ "eslint-plugin-import-x": "^4.16.2",
33
33
  "eslint-plugin-react": "^7.37.5",
34
34
  "eslint-plugin-react-hooks": "^7.0.1",
35
35
  "globals": "^17.3.0",
@@ -55,8 +55,16 @@
55
55
  "powerline",
56
56
  "developer-tools"
57
57
  ],
58
- "author": "",
58
+ "author": "EncodeTS (https://github.com/EncodeTS)",
59
59
  "license": "MIT",
60
+ "repository": {
61
+ "type": "git",
62
+ "url": "https://github.com/EncodeTS/copilot-statusline.git"
63
+ },
64
+ "homepage": "https://github.com/EncodeTS/copilot-statusline",
65
+ "bugs": {
66
+ "url": "https://github.com/EncodeTS/copilot-statusline/issues"
67
+ },
60
68
  "engines": {
61
69
  "node": ">=14.0.0"
62
70
  },