@overweo/weoline-win32-x64 0.2.2 → 0.4.0

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 (3) hide show
  1. package/README.md +228 -153
  2. package/package.json +2 -1
  3. package/weoline.exe +0 -0
package/README.md CHANGED
@@ -1,153 +1,228 @@
1
- # weoline
2
-
3
- Fast, cross-platform Claude Code statusline written in Rust. Displays context window usage, token counts, cache statistics, session totals, and API rate limits as ANSI-colored output.
4
-
5
- ## Features
6
-
7
- - Context window usage with colored progress bar
8
- - Current token counts (input/output)
9
- - Cache statistics (read/write)
10
- - Session totals
11
- - API rate limits (5-hour, 7-day, Sonnet) with countdown timers
12
- - Background refresh with file-locked coordination
13
- - Three display modes: full, compact, minimal
14
- - Cross-platform: macOS, Linux, Windows
15
- - Platform-optimized TLS: native-tls on macOS/Windows, rustls on Linux
16
-
17
- ## Installation
18
-
19
- ### NPM (Zero-Overhead Hoisted Binary)
20
-
21
- For users in JS/TS ecosystems. Executes the native binary directly — no Node runtime overhead.
22
-
23
- ```bash
24
- npx weoline
25
- # OR
26
- pnpm add -D weoline
27
- ```
28
-
29
- ### Homebrew (macOS / Linux)
30
-
31
- ```bash
32
- brew install overweo/tap/weoline
33
- ```
34
-
35
- ### Direct Download (Shell Script)
36
-
37
- For CI environments or users without package managers.
38
-
39
- ```bash
40
- curl -fsSL https://raw.githubusercontent.com/OverWeo/weoline/main/install.sh | bash
41
- ```
42
-
43
- ### Build from Source
44
-
45
- ```bash
46
- git clone https://github.com/OverWeo/weoline.git
47
- cd weoline
48
- cargo build --release
49
- cp target/release/weoline ~/.local/bin/
50
- ```
51
-
52
- ## Quick Start
53
-
54
- Add to your Claude Code settings (`~/.claude/settings.json`):
55
-
56
- ```json
57
- {
58
- "env": {
59
- "SL_MODE": "full"
60
- },
61
- "statusLine": {
62
- "type": "command",
63
- "command": "weoline"
64
- }
65
- }
66
- ```
67
-
68
- ## Build Variants
69
-
70
- | Variant | Command | Includes | Binary Size |
71
- |---------|---------|----------|-------------|
72
- | **Full** (default) | `cargo build --release` | Context + tokens + cache + session + API rate limits + background fetch | ~773 KB (macOS) / ~1.3 MB (Linux) |
73
- | **Minimal** | `cargo build --release --no-default-features` | Context + tokens + cache + session only (from stdin) | ~500 KB |
74
-
75
- **Full** uses native-tls on macOS/Windows (OS TLS stack) and rustls on Linux (no OpenSSL dependency).
76
-
77
- **Minimal** disables all network dependencies. Reads stdin JSON from Claude Code and renders context/token/session info only.
78
-
79
- ## Configuration
80
-
81
- All settings are via `SL_*` environment variables, configurable in Claude Code's `settings.json` under `"env"`:
82
-
83
- | Variable | Default | Description |
84
- |----------|---------|-------------|
85
- | `SL_MODE` | `full` | Display mode: `full`, `compact`, `minimal` |
86
- | `SL_SHOW_TOKENS` | `0` | Show current token counts (`1` to enable) |
87
- | `SL_SHOW_CACHE` | `1` | Show cache read/write stats (`0` to disable) |
88
- | `SL_SHOW_SESSION` | `1` | Show session totals (`0` to disable) |
89
- | `SL_SHOW_LIMITS` | `1` | Show API rate limits (`0` to disable) |
90
- | `SL_SHOW_WEEKLY` | `1` | Show 7-day limit (`0` to disable) |
91
- | `SL_SHOW_SONNET` | `1` | Show Sonnet limit (`0` to disable) |
92
- | `SL_REFRESH_INTERVAL` | `300` | Cache refresh interval in seconds |
93
- | `SL_BAR_WIDTH` | `14` | Progress bar width in characters |
94
- | `SL_CREDENTIALS_FILE` | `~/.claude/.credentials.json` | Path to OAuth credentials file |
95
- | `SL_CACHE_FILE` | `~/.claude/usage-cache.json` | Path to rate limit cache file |
96
-
97
- ## Display Modes
98
-
99
- **Full** context | tokens + cache | session | limits:
100
- ```
101
- 🧠 ██████░░░░░░░░ 45% (90k/200k) | 💾 cache read: 10k write: 3k | 🔄 session: 📥 in: 50k 📤 out: 20k | ⏱ 5h: 24% ↻3h52m 📅 7d: 8% 🎵 sonnet: 5%
102
- ```
103
-
104
- **Compact** — context | limits:
105
- ```
106
- 🧠 ██████░░░░░░░░ 45% (90k/200k) | ⏱ 5h: 24% ↻3h52m 📅 7d: 8% 🎵 sonnet: 5%
107
- ```
108
-
109
- **Minimal** — context only:
110
- ```
111
- 🧠 ██████░░░░░░░░ 45% (90k/200k)
112
- ```
113
-
114
- ## How It Works
115
-
116
- ```
117
- Claude Code stdin (JSON) → weoline → stdout (ANSI)
118
-
119
- Background: --fetch → API → cache file
120
- ```
121
-
122
- 1. Claude Code pipes context window JSON to stdin
123
- 2. `weoline` parses JSON, reads cached rate limits, renders ANSI output to stdout
124
- 3. If the cache is stale, spawns a detached `weoline --fetch` subprocess
125
- 4. The fetch subprocess acquires a file lock (OS-native via `fd-lock`), calls the Anthropic usage API, writes the cache atomically, and exits
126
- 5. File lock is auto-released by the OS on process exit or crash
127
-
128
- ## Cross-Platform Notes
129
-
130
- - **macOS**: Uses native-tls (Security.framework). OAuth token read from Keychain first, then credentials file. Keychain access may prompt for password/Touch ID.
131
- - **Linux**: Uses rustls (no OpenSSL dependency). OAuth token from credentials file only.
132
- - **Windows**: Uses native-tls (SChannel). ANSI escape codes enabled via `SetConsoleMode`. `CREATE_NO_WINDOW` flag prevents console flash on background fetch spawn.
133
-
134
- ## Testing
135
-
136
- ```bash
137
- # Run tests
138
- cargo test
139
-
140
- # Pipe test
141
- echo '{"context_window":{"used_percentage":45,"context_window_size":200000}}' | ./target/release/weoline
142
-
143
- # Empty input (graceful)
144
- echo '{}' | ./target/release/weoline
145
-
146
- # Mode tests
147
- echo '{"context_window":{"used_percentage":45,"context_window_size":200000}}' | SL_MODE=compact ./target/release/weoline
148
- echo '{"context_window":{"used_percentage":45,"context_window_size":200000}}' | SL_MODE=minimal ./target/release/weoline
149
- ```
150
-
151
- ## License
152
-
153
- Apache-2.0
1
+ # weoline
2
+
3
+ Fast, cross-platform Claude Code statusline written in Rust. Displays context window usage, token counts, cache statistics, session totals, and API rate limits as ANSI-colored output.
4
+
5
+ ## Features
6
+
7
+ - Context window usage with colored progress bar
8
+ - Current token counts (input/output)
9
+ - Cache statistics (read/write)
10
+ - Session totals
11
+ - API rate limits (5-hour, 7-day, Sonnet) with countdown timers
12
+ - Background refresh with file-locked coordination
13
+ - Three display modes: full, compact, minimal
14
+ - Cross-platform: macOS, Linux, Windows
15
+ - Platform-optimized TLS: native-tls on macOS/Windows, rustls on Linux
16
+
17
+ ## Installation
18
+
19
+ ### NPM (Zero-Overhead Hoisted Binary)
20
+
21
+ For users in JS/TS ecosystems. Executes the native binary directly — no Node runtime overhead.
22
+
23
+ ```bash
24
+ npx weoline
25
+ # OR
26
+ pnpm add -D weoline
27
+ ```
28
+
29
+ ### Cargo
30
+
31
+ ```bash
32
+ cargo install weoline
33
+ ```
34
+
35
+ ### Homebrew (macOS / Linux)
36
+
37
+ ```bash
38
+ brew install overweo/tap/weoline
39
+ ```
40
+
41
+ ### Direct Download (Shell Script)
42
+
43
+ For CI environments or users without package managers.
44
+
45
+ ```bash
46
+ curl -fsSL https://raw.githubusercontent.com/OverWeo/weoline/main/install.sh | bash
47
+ ```
48
+
49
+ ### Build from Source
50
+
51
+ ```bash
52
+ git clone https://github.com/OverWeo/weoline.git
53
+ cd weoline
54
+ cargo build --release
55
+ cp target/release/weoline ~/.local/bin/
56
+ ```
57
+
58
+ ## Quick Start
59
+
60
+ Add to your Claude Code settings (`~/.claude/settings.json`):
61
+
62
+ ```json
63
+ {
64
+ "env": {
65
+ "SL_MODE": "full"
66
+ },
67
+ "statusLine": {
68
+ "type": "command",
69
+ "command": "weoline"
70
+ }
71
+ }
72
+ ```
73
+
74
+ ## Build Variants
75
+
76
+ | Variant | Command | Includes | Binary Size |
77
+ |---------|---------|----------|-------------|
78
+ | **Full** (default) | `cargo build --release` | Context + tokens + cache + session + API rate limits + background fetch + query mode | ~789 KB (macOS) / ~1.3 MB (Linux) |
79
+ | **Minimal** | `cargo build --release --no-default-features` | Context + tokens + cache + session only (from stdin) | ~345 KB |
80
+
81
+ **Full** uses native-tls on macOS/Windows (OS TLS stack) and rustls on Linux (no OpenSSL dependency).
82
+
83
+ **Minimal** disables all network dependencies. Reads stdin JSON from Claude Code and renders context/token/session info only.
84
+
85
+ ## Configuration
86
+
87
+ All settings are via `SL_*` environment variables, configurable in Claude Code's `settings.json` under `"env"`:
88
+
89
+ | Variable | Default | Description |
90
+ |----------|---------|-------------|
91
+ | `SL_MODE` | `full` | Display mode: `full`, `compact`, `minimal` |
92
+ | `SL_SHOW_TOKENS` | `0` | Show current token counts (`1` to enable) |
93
+ | `SL_SHOW_CACHE` | `1` | Show cache read/write stats (`0` to disable) |
94
+ | `SL_SHOW_SESSION` | `1` | Show session totals (`0` to disable) |
95
+ | `SL_SHOW_LIMITS` | `1` | Show API rate limits (`0` to disable) |
96
+ | `SL_SHOW_WEEKLY` | `1` | Show 7-day limit (`0` to disable) |
97
+ | `SL_SHOW_SONNET` | `1` | Show Sonnet limit (`0` to disable) |
98
+ | `SL_REFRESH_INTERVAL` | `300` | Cache refresh interval in seconds |
99
+ | `SL_BAR_WIDTH` | `14` | Progress bar width in characters |
100
+ | `SL_CREDENTIALS_FILE` | `~/.claude/.credentials.json` | Path to OAuth credentials file |
101
+ | `SL_CACHE_FILE` | `~/.claude/usage-cache.json` | Path to rate limit cache file |
102
+
103
+ ## Display Modes
104
+
105
+ **Full** — context | tokens + cache | session | limits:
106
+ ```
107
+ 🧠 ██████░░░░░░░░ 45% (90k/200k) | 💾 cache read: 10k write: 3k | 🔄 session: 📥 in: 50k 📤 out: 20k | ⏱ 5h: 24% ↻3h52m 📅 7d: 8% 🎵 sonnet: 5%
108
+ ```
109
+
110
+ **Compact** — context | limits:
111
+ ```
112
+ 🧠 ██████░░░░░░░░ 45% (90k/200k) | ⏱ 5h: 24% ↻3h52m 📅 7d: 8% 🎵 sonnet: 5%
113
+ ```
114
+
115
+ **Minimal** — context only:
116
+ ```
117
+ 🧠 ██████░░░░░░░░ 45% (90k/200k)
118
+ ```
119
+
120
+ ## Query Mode
121
+
122
+ Query cached rate limit data programmatically no stdin required.
123
+
124
+ ```bash
125
+ weoline --query # toon, full detail, all buckets
126
+ weoline --query --format json # JSON, full detail, all buckets
127
+ weoline --query -f json -d minimal # JSON, just percentages
128
+ weoline --query -f json --filter sonnet # JSON, sonnet bucket only
129
+ weoline --query --refresh --format json # force fresh API fetch, then JSON
130
+ ```
131
+
132
+ ### Query Flags
133
+
134
+ | Flag | Short | Values | Default | Description |
135
+ |------|-------|--------|---------|-------------|
136
+ | `--query` | `-q` | (presence) | off | Activate query mode |
137
+ | `--format` | `-f` | `json`, `toon` | `toon` | Output format |
138
+ | `--detail` | `-d` | `minimal`, `full` | `full` | Detail level |
139
+ | `--filter` | | `all`, `sonnet`, `five-hour`, `seven-day` | `all` | Filter to specific bucket |
140
+ | `--refresh` | `-r` | (presence) | off | Force fresh API fetch before query (blocking) |
141
+
142
+ ### JSON Output
143
+
144
+ **Full detail** (`--format json`):
145
+ ```json
146
+ {
147
+ "five_hour": {
148
+ "utilization": 24.0,
149
+ "resets_at": "2026-04-06T18:00:00+00:00",
150
+ "resets_in": "3h52m"
151
+ },
152
+ "seven_day": {
153
+ "utilization": 8.0,
154
+ "resets_at": "2026-04-10T00:00:00+00:00",
155
+ "resets_in": "3d0h"
156
+ },
157
+ "seven_day_sonnet": {
158
+ "utilization": 5.0,
159
+ "resets_at": "2026-04-10T00:00:00+00:00",
160
+ "resets_in": "3d0h"
161
+ },
162
+ "meta": {
163
+ "fetched_at": 1743955200,
164
+ "is_stale": false
165
+ }
166
+ }
167
+ ```
168
+
169
+ **Minimal detail** (`-f json -d minimal`):
170
+ ```json
171
+ {
172
+ "five_hour_pct": 24.0,
173
+ "seven_day_pct": 8.0,
174
+ "seven_day_sonnet_pct": 5.0,
175
+ "is_stale": false
176
+ }
177
+ ```
178
+
179
+ > **Note:** `--refresh` performs a blocking HTTP request. Use it for explicit user invocations, not automated statusline hooks.
180
+
181
+ ## How It Works
182
+
183
+ ```
184
+ Claude Code → stdin (JSON) → weoline → stdout (ANSI)
185
+
186
+ Background: --fetch → API → cache file
187
+
188
+ weoline --query → read cache → stdout (JSON/toon)
189
+ ↓ (--refresh)
190
+ API → cache file → read → stdout
191
+ ```
192
+
193
+ 1. Claude Code pipes context window JSON to stdin
194
+ 2. `weoline` parses JSON, reads cached rate limits, renders ANSI output to stdout
195
+ 3. If the cache is stale, spawns a detached `weoline --fetch` subprocess
196
+ 4. The fetch subprocess acquires a file lock (OS-native via `fd-lock`), calls the Anthropic usage API, writes the cache atomically, and exits
197
+ 5. File lock is auto-released by the OS on process exit or crash
198
+ 6. Query mode (`--query`) reads the cache directly and outputs structured data (no stdin needed)
199
+
200
+ ## Cross-Platform Notes
201
+
202
+ - **macOS**: Uses native-tls (Security.framework). OAuth token read from Keychain first, then credentials file. Keychain access may prompt for password/Touch ID.
203
+ - **Linux**: Uses rustls (no OpenSSL dependency). OAuth token from credentials file only.
204
+ - **Windows**: Uses native-tls (SChannel). ANSI escape codes enabled via `SetConsoleMode`. `CREATE_NO_WINDOW` flag prevents console flash on background fetch spawn.
205
+
206
+ ## Testing
207
+
208
+ ```bash
209
+ # Unit tests
210
+ cargo test
211
+
212
+ # Smoke tests (builds release, tests pipe/query/help/error modes)
213
+ ./tests/smoke-test.sh
214
+
215
+ # Manual pipe tests
216
+ echo '{"context_window":{"used_percentage":45,"context_window_size":200000}}' | ./target/release/weoline
217
+
218
+ # Empty input (graceful)
219
+ echo '{}' | ./target/release/weoline
220
+
221
+ # Mode tests
222
+ echo '{"context_window":{"used_percentage":45,"context_window_size":200000}}' | SL_MODE=compact ./target/release/weoline
223
+ echo '{"context_window":{"used_percentage":45,"context_window_size":200000}}' | SL_MODE=minimal ./target/release/weoline
224
+ ```
225
+
226
+ ## License
227
+
228
+ Apache-2.0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@overweo/weoline-win32-x64",
3
- "version": "0.2.2",
3
+ "version": "0.4.0",
4
4
  "description": "weoline binary for Windows x64",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -9,6 +9,7 @@
9
9
  },
10
10
  "os": ["win32"],
11
11
  "cpu": ["x64"],
12
+ "preferUnplugged": true,
12
13
  "bin": {
13
14
  "weoline": "weoline.exe"
14
15
  }
package/weoline.exe CHANGED
Binary file