@overweo/weoline-win32-x64 0.3.1 → 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 +79 -4
  2. package/package.json +1 -1
  3. package/weoline.exe +0 -0
package/README.md CHANGED
@@ -26,6 +26,12 @@ npx weoline
26
26
  pnpm add -D weoline
27
27
  ```
28
28
 
29
+ ### Cargo
30
+
31
+ ```bash
32
+ cargo install weoline
33
+ ```
34
+
29
35
  ### Homebrew (macOS / Linux)
30
36
 
31
37
  ```bash
@@ -69,8 +75,8 @@ Add to your Claude Code settings (`~/.claude/settings.json`):
69
75
 
70
76
  | Variant | Command | Includes | Binary Size |
71
77
  |---------|---------|----------|-------------|
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 |
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 |
74
80
 
75
81
  **Full** uses native-tls on macOS/Windows (OS TLS stack) and rustls on Linux (no OpenSSL dependency).
76
82
 
@@ -111,12 +117,77 @@ All settings are via `SL_*` environment variables, configurable in Claude Code's
111
117
  🧠 ██████░░░░░░░░ 45% (90k/200k)
112
118
  ```
113
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
+
114
181
  ## How It Works
115
182
 
116
183
  ```
117
184
  Claude Code → stdin (JSON) → weoline → stdout (ANSI)
118
185
 
119
186
  Background: --fetch → API → cache file
187
+
188
+ weoline --query → read cache → stdout (JSON/toon)
189
+ ↓ (--refresh)
190
+ API → cache file → read → stdout
120
191
  ```
121
192
 
122
193
  1. Claude Code pipes context window JSON to stdin
@@ -124,6 +195,7 @@ Claude Code → stdin (JSON) → weoline → stdout (ANSI)
124
195
  3. If the cache is stale, spawns a detached `weoline --fetch` subprocess
125
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
126
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)
127
199
 
128
200
  ## Cross-Platform Notes
129
201
 
@@ -134,10 +206,13 @@ Claude Code → stdin (JSON) → weoline → stdout (ANSI)
134
206
  ## Testing
135
207
 
136
208
  ```bash
137
- # Run tests
209
+ # Unit tests
138
210
  cargo test
139
211
 
140
- # Pipe test
212
+ # Smoke tests (builds release, tests pipe/query/help/error modes)
213
+ ./tests/smoke-test.sh
214
+
215
+ # Manual pipe tests
141
216
  echo '{"context_window":{"used_percentage":45,"context_window_size":200000}}' | ./target/release/weoline
142
217
 
143
218
  # Empty input (graceful)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@overweo/weoline-win32-x64",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "description": "weoline binary for Windows x64",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
package/weoline.exe CHANGED
Binary file