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 +2 -0
- package/README.zh-CN.md +2 -0
- package/dist/tui.js +17 -6
- package/package.json +2 -1
package/README.md
CHANGED
package/README.zh-CN.md
CHANGED
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
|
|
94
|
+
const colors = statusColors(ctx.theme);
|
|
84
95
|
const u = props.usage();
|
|
85
96
|
if (!u)
|
|
86
|
-
return props.loaded() ?
|
|
97
|
+
return props.loaded() ? colors.error : colors.muted;
|
|
87
98
|
if (u.unlimited)
|
|
88
|
-
return
|
|
99
|
+
return colors.muted;
|
|
89
100
|
if (u.usedPercent >= 90)
|
|
90
|
-
return
|
|
101
|
+
return colors.error;
|
|
91
102
|
if (u.usedPercent >= 70)
|
|
92
|
-
return
|
|
93
|
-
return
|
|
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.
|
|
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",
|