@overweo/weoline-darwin-x64 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 (3) hide show
  1. package/README.md +153 -0
  2. package/package.json +1 -1
  3. package/weoline +0 -0
package/README.md ADDED
@@ -0,0 +1,153 @@
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@overweo/weoline-darwin-x64",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "weoline binary for macOS x64 (Intel)",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
package/weoline CHANGED
Binary file