opencode-copilot-statusline 0.2.0 → 1.0.1

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
@@ -7,6 +7,8 @@
7
7
 
8
8
  Display your GitHub Copilot quota in the OpenCode TUI footer statusline.
9
9
 
10
+ ![Animated demo: GitHub Copilot quota in the footer statusline](./assets/demo.svg)
11
+
10
12
  ## ✨ Features
11
13
 
12
14
  - Live used-quota percentage in the prompt footer (`Copilot 87%`)
package/README.zh-CN.md CHANGED
@@ -7,6 +7,8 @@
7
7
 
8
8
  在 OpenCode TUI 底栏显示 GitHub Copilot 配额用量。
9
9
 
10
+ ![动态演示:OpenCode 底栏中的 GitHub Copilot 配额用量](./assets/demo.svg)
11
+
10
12
  ## ✨ 功能
11
13
 
12
14
  - 在输入框底栏实时显示配额已用百分比(`Copilot 87%`)
package/dist/tui.js CHANGED
@@ -11,6 +11,17 @@ import { Plugin, usePlugin } from "@opencode/plugin/tui";
11
11
  import { useTerminalDimensions } from "@opentui/solid";
12
12
  import { createEffect, createSignal, onCleanup, Show } from "solid-js";
13
13
 
14
+ // ../core/src/theme.ts
15
+ function statusColors(theme) {
16
+ const text = theme?.text;
17
+ const feedback = (kind) => text?.feedback?.[kind]?.base ?? text?.feedback?.[kind]?.default;
18
+ return {
19
+ muted: text?.muted ?? text?.subdued,
20
+ error: feedback("error"),
21
+ info: feedback("info")
22
+ };
23
+ }
24
+
14
25
  // src/rpc.ts
15
26
  import { Rpc } from "@opencode/plugin/rpc";
16
27
  var usageSchema = {
@@ -80,17 +91,17 @@ function CopilotUsage(props) {
80
91
  const dims = useTerminalDimensions();
81
92
  const detailed = () => props.showDetails() || dims().width >= DETAILED_WIDTH;
82
93
  const fg = () => {
83
- const t = ctx.theme;
94
+ const colors = statusColors(ctx.theme);
84
95
  const u = props.usage();
85
96
  if (!u)
86
- return props.loaded() ? t.text.feedback.error.default : t.text.subdued;
97
+ return props.loaded() ? colors.error : colors.muted;
87
98
  if (u.unlimited)
88
- return t.text.subdued;
99
+ return colors.muted;
89
100
  if (u.usedPercent >= 90)
90
- return t.text.feedback.error.default;
101
+ return colors.error;
91
102
  if (u.usedPercent >= 70)
92
- return t.text.feedback.info.default;
93
- return t.text.subdued;
103
+ return colors.info;
104
+ return colors.muted;
94
105
  };
95
106
  let generation = 0;
96
107
  async function check(id) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-copilot-statusline",
3
- "version": "0.2.0",
3
+ "version": "1.0.1",
4
4
  "description": "OpenCode TUI plugin: display GitHub Copilot quota (premium requests, with a chat fallback for Copilot Free) in the footer statusline. V2-native, zero-config, no cookies.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -32,6 +32,7 @@
32
32
  },
33
33
  "scripts": {
34
34
  "build": "bun run scripts/build.ts",
35
+ "record:demo": "bun run build && bun scripts/record-demo.ts",
35
36
  "typecheck": "tsc --noEmit",
36
37
  "pretest": "bun run build",
37
38
  "test": "bun test test/usage.test.ts test/e2e",