@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.
Files changed (2) hide show
  1. package/README.md +26 -47
  2. 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 screen.
3
+ An OpenCode TUI plugin that adds a token usage chart view for your sessions.
4
4
 
5
- ## Install from npm
5
+ ## Installation
6
6
 
7
- Package name:
8
-
9
- `@thiagos1lva/opencode-token-usage-chart`
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
- ### Global install (all projects)
13
+ ## Usage
12
14
 
13
- Add to `~/.config/opencode/opencode.json`:
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
- ### Local install (single repo)
24
+ > Note: in some OpenCode setups, the same config may be stored in `config.json` instead of `opencode.json`.
25
25
 
26
- Add to `<repo>/opencode.json`:
26
+ That's it. OpenCode will load the plugin at startup.
27
27
 
28
- ```json
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
- OpenCode installs npm plugins automatically at startup.
30
+ - Slash command: `/token-chart`
31
+ - Command palette value: `token.usage.chart`
38
32
 
39
- ## Use
33
+ ## How It Works
40
34
 
41
- - Run slash command `/token-chart`.
42
- - Or open command palette and run `token.usage.chart`.
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
- ## Local development
41
+ ## Requirements
45
42
 
46
- This repo also works as a local plugin via `tui.json`:
43
+ - OpenCode with TUI plugin support
47
44
 
48
- ```json
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
- ## Publish checklist
63
-
64
- ```bash
65
- npm login
66
- npm pack --dry-run
67
- npm publish --access public
68
- ```
47
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thiagos1lva/opencode-token-usage-chart",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "OpenCode TUI plugin for token usage charts",
5
5
  "type": "module",
6
6
  "main": "./index.ts",