@thiagos1lva/opencode-token-usage-chart 0.2.0 → 0.2.2
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 +26 -47
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,68 +1,47 @@
|
|
|
1
|
-
# opencode-token-usage-chart
|
|
1
|
+
# @thiagos1lva/opencode-token-usage-chart
|
|
2
2
|
|
|
3
|
-
OpenCode TUI plugin that adds a token usage chart
|
|
3
|
+
An OpenCode TUI plugin that adds a token usage chart view for your sessions.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Installation
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @thiagos1lva/opencode-token-usage-chart
|
|
9
|
+
# or
|
|
10
|
+
bun add -g @thiagos1lva/opencode-token-usage-chart
|
|
11
|
+
```
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
## Usage
|
|
12
14
|
|
|
13
|
-
Add to
|
|
15
|
+
Add the plugin to your `opencode.json`:
|
|
14
16
|
|
|
15
17
|
```json
|
|
16
18
|
{
|
|
17
19
|
"$schema": "https://opencode.ai/config.json",
|
|
18
|
-
"plugin": [
|
|
19
|
-
"@thiagos1lva/opencode-token-usage-chart"
|
|
20
|
-
]
|
|
20
|
+
"plugin": ["@thiagos1lva/opencode-token-usage-chart"]
|
|
21
21
|
}
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
> Note: in some OpenCode setups, the same config may be stored in `config.json` instead of `opencode.json`.
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
That's it. OpenCode will load the plugin at startup.
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
{
|
|
30
|
-
"$schema": "https://opencode.ai/config.json",
|
|
31
|
-
"plugin": [
|
|
32
|
-
"@thiagos1lva/opencode-token-usage-chart"
|
|
33
|
-
]
|
|
34
|
-
}
|
|
35
|
-
```
|
|
28
|
+
Then open the chart with:
|
|
36
29
|
|
|
37
|
-
|
|
30
|
+
- Slash command: `/token-chart`
|
|
31
|
+
- Command palette value: `token.usage.chart`
|
|
38
32
|
|
|
39
|
-
##
|
|
33
|
+
## How It Works
|
|
40
34
|
|
|
41
|
-
-
|
|
42
|
-
-
|
|
35
|
+
- Registers a TUI route named `token-usage` and a command `/token-chart`.
|
|
36
|
+
- Aggregates usage from assistant messages into chart buckets (`15min`, `30min`, `hour`, `day`, `week`, `month`).
|
|
37
|
+
- Supports dynamic scopes: `all`, optional `workspace`, and optional `session`.
|
|
38
|
+
- Total tokens are calculated as `input + output + reasoning + cache.read + cache.write`.
|
|
39
|
+
- Includes refresh and diagnostics helpers directly in the chart view.
|
|
43
40
|
|
|
44
|
-
##
|
|
41
|
+
## Requirements
|
|
45
42
|
|
|
46
|
-
|
|
43
|
+
- OpenCode with TUI plugin support
|
|
47
44
|
|
|
48
|
-
|
|
49
|
-
{
|
|
50
|
-
"$schema": "https://opencode.ai/tui.json",
|
|
51
|
-
"plugin": [
|
|
52
|
-
[
|
|
53
|
-
"./plugins/tui-token-usage.tsx",
|
|
54
|
-
{
|
|
55
|
-
"enabled": true
|
|
56
|
-
}
|
|
57
|
-
]
|
|
58
|
-
]
|
|
59
|
-
}
|
|
60
|
-
```
|
|
45
|
+
## License
|
|
61
46
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
```bash
|
|
65
|
-
npm login
|
|
66
|
-
npm pack --dry-run
|
|
67
|
-
npm publish --access public
|
|
68
|
-
```
|
|
47
|
+
MIT
|