mochiapi-statusline 0.1.0 โ 0.1.1
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/LICENSE +20 -20
- package/README.md +385 -386
- package/dist/ccstatusline.js +40 -26
- package/package.json +74 -74
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Matthew Breedlove (https://github.com/sirmalloc)
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Matthew Breedlove (https://github.com/sirmalloc)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,386 +1,385 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
|
|
3
|
-
<pre>
|
|
4
|
-
_ _ _ _
|
|
5
|
-
___ ___ ___| |_ __ _| |_ _ _ ___| (_)_ __ ___
|
|
6
|
-
/ __/ __/ __| __/ _` | __| | | / __| | | '_ \ / _ \
|
|
7
|
-
| (_| (__\__ \ || (_| | |_| |_| \__ \ | | | | | __/
|
|
8
|
-
\___\___|___/\__\__,_|\__|\__,_|___/_|_|_| |_|\___|
|
|
9
|
-
|
|
10
|
-
</pre>
|
|
11
|
-
|
|
12
|
-
# ccstatusline
|
|
13
|
-
|
|
14
|
-
**๐จ A highly customizable status line formatter for Claude Code CLI**
|
|
15
|
-
*Display model info, git branch, token usage, and other metrics in your terminal*
|
|
16
|
-
|
|
17
|
-
[](https://www.npmjs.com/package/ccstatusline)
|
|
18
|
-
[](https://www.npmjs.com/package/ccstatusline)
|
|
19
|
-
[](https://github.com/sirmalloc/ccstatusline/blob/main/LICENSE)
|
|
20
|
-
[](https://nodejs.org)
|
|
21
|
-
[](https://packagephobia.com/result?p=ccstatusline)
|
|
22
|
-
[](https://github.com/sirmalloc/ccstatusline/graphs/commit-activity)
|
|
23
|
-
|
|
24
|
-
[](https://github.com/hesreallyhim/awesome-claude-code)
|
|
25
|
-
[](https://claudelog.com/)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-

|
|
29
|
-
|
|
30
|
-
</div>
|
|
31
|
-
<br />
|
|
32
|
-
|
|
33
|
-
> [!IMPORTANT]
|
|
34
|
-
> **This is the `mochiapi-statusline` fork** โ a customized build of upstream [sirmalloc/ccstatusline](https://github.com/sirmalloc/ccstatusline) with a built-in **MochiAPI balance widget** plus a one-shot setup that wires Claude Code and the recommended Mochi three-line layout for you.
|
|
35
|
-
>
|
|
36
|
-
> **If you came here to use this fork, follow [MOCHIAPI.md](MOCHIAPI.md) โ not the upstream instructions below.** The
|
|
37
|
-
>
|
|
38
|
-
> ```bash
|
|
39
|
-
> npm install -g
|
|
40
|
-
>
|
|
41
|
-
>
|
|
42
|
-
>
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
- [
|
|
50
|
-
- [
|
|
51
|
-
- [
|
|
52
|
-
- [
|
|
53
|
-
- [
|
|
54
|
-
- [
|
|
55
|
-
- [
|
|
56
|
-
- [
|
|
57
|
-
- [
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
-
|
|
67
|
-
-
|
|
68
|
-
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
-
|
|
74
|
-
-
|
|
75
|
-
-
|
|
76
|
-
-
|
|
77
|
-
-
|
|
78
|
-
-
|
|
79
|
-
-
|
|
80
|
-
-
|
|
81
|
-
-
|
|
82
|
-
-
|
|
83
|
-
-
|
|
84
|
-
-
|
|
85
|
-
-
|
|
86
|
-
-
|
|
87
|
-
-
|
|
88
|
-
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
-
|
|
94
|
-
-
|
|
95
|
-
-
|
|
96
|
-
-
|
|
97
|
-
-
|
|
98
|
-
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
-
|
|
104
|
-
-
|
|
105
|
-
- `
|
|
106
|
-
|
|
107
|
-
-
|
|
108
|
-
-
|
|
109
|
-
-
|
|
110
|
-
-
|
|
111
|
-
-
|
|
112
|
-
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
<
|
|
116
|
-
<
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
-
|
|
122
|
-
-
|
|
123
|
-
-
|
|
124
|
-
-
|
|
125
|
-
-
|
|
126
|
-
-
|
|
127
|
-
-
|
|
128
|
-
-
|
|
129
|
-
-
|
|
130
|
-
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
-
|
|
136
|
-
-
|
|
137
|
-
-
|
|
138
|
-
-
|
|
139
|
-
-
|
|
140
|
-
-
|
|
141
|
-
-
|
|
142
|
-
-
|
|
143
|
-
-
|
|
144
|
-
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
-
|
|
183
|
-
-
|
|
184
|
-
-
|
|
185
|
-
|
|
186
|
-
-
|
|
187
|
-
-
|
|
188
|
-
-
|
|
189
|
-
-
|
|
190
|
-
|
|
191
|
-
-
|
|
192
|
-
-
|
|
193
|
-
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
-
|
|
201
|
-
-
|
|
202
|
-
-
|
|
203
|
-
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
-
|
|
208
|
-
-
|
|
209
|
-
-
|
|
210
|
-
-
|
|
211
|
-
-
|
|
212
|
-
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
-
|
|
222
|
-
-
|
|
223
|
-
-
|
|
224
|
-
-
|
|
225
|
-
-
|
|
226
|
-
-
|
|
227
|
-
-
|
|
228
|
-
-
|
|
229
|
-
-
|
|
230
|
-
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
<
|
|
256
|
-
<
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
-
|
|
261
|
-
-
|
|
262
|
-
-
|
|
263
|
-
- Configure
|
|
264
|
-
-
|
|
265
|
-
-
|
|
266
|
-
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
>
|
|
272
|
-
>
|
|
273
|
-
>
|
|
274
|
-
>
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
<
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
{
|
|
290
|
-
|
|
291
|
-
"
|
|
292
|
-
"
|
|
293
|
-
"
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
- `
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
- [
|
|
340
|
-
- [
|
|
341
|
-
- [
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
-
|
|
348
|
-
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
<
|
|
356
|
-
|
|
357
|
-
<source media="(prefers-color-scheme:
|
|
358
|
-
<
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
[](https://www.npmjs.com/package/ccstatusline)
|
|
18
|
+
[](https://www.npmjs.com/package/ccstatusline)
|
|
19
|
+
[](https://github.com/sirmalloc/ccstatusline/blob/main/LICENSE)
|
|
20
|
+
[](https://nodejs.org)
|
|
21
|
+
[](https://packagephobia.com/result?p=ccstatusline)
|
|
22
|
+
[](https://github.com/sirmalloc/ccstatusline/graphs/commit-activity)
|
|
23
|
+
|
|
24
|
+
[](https://github.com/hesreallyhim/awesome-claude-code)
|
|
25
|
+
[](https://claudelog.com/)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+

|
|
29
|
+
|
|
30
|
+
</div>
|
|
31
|
+
<br />
|
|
32
|
+
|
|
33
|
+
> [!IMPORTANT]
|
|
34
|
+
> **This is the `mochiapi-statusline` fork** โ a customized build of upstream [sirmalloc/ccstatusline](https://github.com/sirmalloc/ccstatusline) with a built-in **MochiAPI balance widget** plus a one-shot setup that wires Claude Code and the recommended Mochi three-line layout for you.
|
|
35
|
+
>
|
|
36
|
+
> **If you came here to use this fork, follow [MOCHIAPI.md](MOCHIAPI.md) โ not the upstream instructions below.** The one command you need (macOS / Linux / Windows):
|
|
37
|
+
>
|
|
38
|
+
> ```bash
|
|
39
|
+
> npm install -g mochiapi-statusline && mochiapi-statusline --mochiapi-setup
|
|
40
|
+
> ```
|
|
41
|
+
>
|
|
42
|
+
> The rest of this README is upstream documentation and applies as-is to the underlying ccstatusline engine (widgets, TUI, themes, etc.) โ keep reading if you want to customize beyond the defaults.
|
|
43
|
+
|
|
44
|
+
<br />
|
|
45
|
+
|
|
46
|
+
## ๐ Table of Contents
|
|
47
|
+
|
|
48
|
+
- [Recent Updates](#-recent-updates)
|
|
49
|
+
- [Features](#-features)
|
|
50
|
+
- [Localizations](#-localizations)
|
|
51
|
+
- [Quick Start](#-quick-start)
|
|
52
|
+
- [Windows Support](docs/WINDOWS.md)
|
|
53
|
+
- [Usage](docs/USAGE.md)
|
|
54
|
+
- [Development](docs/DEVELOPMENT.md)
|
|
55
|
+
- [Contributing](#-contributing)
|
|
56
|
+
- [License](#-license)
|
|
57
|
+
- [Related Projects](#-related-projects)
|
|
58
|
+
|
|
59
|
+
<br />
|
|
60
|
+
|
|
61
|
+
## ๐ Recent Updates
|
|
62
|
+
|
|
63
|
+
### v2.2.13 - Weekly model usage, voice status, hooks, and docs
|
|
64
|
+
|
|
65
|
+
- **๐ Weekly Sonnet/Opus usage widgets** - Added separate weekly usage widgets for Sonnet and Opus API buckets, matching Claude Code's `/usage` model split.
|
|
66
|
+
- **๐ค Voice Status widget** - Added a widget that shows whether Claude Code voice input is enabled, with icon, text, word, and optional Nerd Font display modes.
|
|
67
|
+
- **๐ Timer short bars** - Block Timer, Block Reset Timer, and Weekly Reset Timer now support compact short-bar progress displays.
|
|
68
|
+
- **๐ Quieter hook output** - Hook handling now suppresses no-op JSON output so non-status updates stay silent.
|
|
69
|
+
|
|
70
|
+
### v2.2.9 - v2.2.12 - GitLab support, reset timers, context, compaction, and git widgets
|
|
71
|
+
|
|
72
|
+
- **๐ฆ GitLab PR/MR support** - `Git Branch` and `Git PR/MR` now support GitHub, GitLab, and compatible self-hosted remotes, using `gh` or `glab` as appropriate.
|
|
73
|
+
- **๐ Status line refresh interval** - Installed configs can set Claude Code's `statusLine.refreshInterval` from the TUI when Claude Code >=2.1.97 supports it.
|
|
74
|
+
- **๐งญ Wrap-around TUI navigation** - Menu/list navigation and move/reorder modes now wrap at the first and last items.
|
|
75
|
+
- **๐ Clone widget shortcut** - Press `k` in the item editor to duplicate the selected widget, with fresh Powerline background color for cloned Powerline items.
|
|
76
|
+
- **๐ Short bar display modes** - Context percentage, Context Bar, Session Usage, Weekly Usage, Block Timer, and reset timer widgets can use compact bar variants.
|
|
77
|
+
- **โฑ๏ธ Usage time cursor** - Session Usage and Weekly Usage progress bars can show the elapsed time position within the current usage window.
|
|
78
|
+
- **๐ Reset timer timestamps** - Block and Weekly Reset Timer widgets can show exact reset timestamps with compact formatting, 12/24-hour display, IANA time zones, and locale selection.
|
|
79
|
+
- **๐ช Context Window widget** - Added a `Context Window` widget for total model window size, keeping `Context Length` focused on current context usage.
|
|
80
|
+
- **๐ Compaction Counter widget** - Added a `Compaction Counter` widget that tracks session context compactions, with icon/text/number formats, optional Nerd Font icon, and hide-when-zero behavior.
|
|
81
|
+
- **๐งฎ Git file status widgets** - Added `Git Staged Files`, `Git Unstaged Files`, `Git Untracked Files`, and `Git Clean Status` for file counts and clean/dirty state.
|
|
82
|
+
- **๐ท๏ธ Clear context percentage labels** - `Context %` and `Context % (usable)` now label rendered values as used or left when toggling used/remaining mode.
|
|
83
|
+
- **โก More Powerline caps** - The Powerline separator editor now supports more than three start/end caps.
|
|
84
|
+
- **๐ง Thinking Effort updates** - Added `xhigh`, show `default` when no effort is set, mark unknown future effort levels with `?`, and track live status JSON plus `/effort` command changes.
|
|
85
|
+
- **๐งฎ More accurate token counts** - Streaming duplicate JSONL entries are deduped so token widgets do not overcount live Claude Code output.
|
|
86
|
+
- **๐ท๏ธ Cleaner model display** - The Model widget strips trailing context suffixes like `(1M context)`; use `Context Window` when you want the total window size shown.
|
|
87
|
+
- **๐งน Cleaner empty-widget separators** - Manual separators now collapse around widgets that render empty, avoiding dangling separators when hide-when-empty widgets disappear.
|
|
88
|
+
- **๐งฑ More resilient Git helpers** - Git widgets handle missing or unusual git command output more defensively.
|
|
89
|
+
|
|
90
|
+
### v2.2.8 - Git widgets, smarter picker search, and minimalist mode
|
|
91
|
+
|
|
92
|
+
- **๐ New Git PR widget** - Added a `Git PR` widget with clickable PR links plus optional status and title display for the current branch.
|
|
93
|
+
- **๐งฐ Major Git widget expansion** - Added `Git Status`, `Git Staged`, `Git Unstaged`, `Git Untracked`, `Git Ahead/Behind`, `Git Conflicts`, `Git SHA`, `Git Origin Owner`, `Git Origin Repo`, `Git Origin Owner/Repo`, `Git Upstream Owner`, `Git Upstream Repo`, `Git Upstream Owner/Repo`, `Git Is Fork`, `Git Worktree Mode`, `Git Worktree Name`, `Git Worktree Branch`, `Git Worktree Original Branch`, and `Custom Symbol`.
|
|
94
|
+
- **๐ค Claude Account Email widget** - Added a session widget that reads the signed-in Claude account email from `~/.claude.json` while respecting `CLAUDE_CONFIG_DIR`.
|
|
95
|
+
- **๐งผ Global Minimalist Mode** - Added a global toggle in `Global Overrides` that forces widgets into raw-value mode for a cleaner, label-free status line.
|
|
96
|
+
- **๐ Smarter widget picker search** - The add/change widget picker now supports substring, initialism, and fuzzy matching, with ranked results and live match highlighting.
|
|
97
|
+
- **๐ Better terminal width detection** - Flex separators and right-alignment now work more reliably when ccstatusline is launched through wrapper processes or nested PTYs.
|
|
98
|
+
- **๐จ Powerline theme continuity** - Built-in Powerline themes can now continue colors cleanly across multiple status lines instead of restarting each line.
|
|
99
|
+
|
|
100
|
+
### v2.2.0 - v2.2.6 - Speed, widgets, links, and reliability updates
|
|
101
|
+
|
|
102
|
+
- **๐ New Token Speed widgets** - Added three widgets: **Input Speed**, **Output Speed**, and **Total Speed**.
|
|
103
|
+
- Each speed widget supports a configurable window of `0-120` seconds in the widget editor (`w` key).
|
|
104
|
+
- `0` disables window mode and uses a full-session average speed.
|
|
105
|
+
- `1-120` calculates recent speed over the selected rolling window.
|
|
106
|
+
- **๐งฉ New Skills widget controls (v2.2.1)** - Added configurable Skills modes (last/count/list), optional hide-when-empty behavior, and list-size limiting with most-recent-first ordering.
|
|
107
|
+
- **๐ Usage API proxy support (v2.2.2)** - Usage widgets honor the uppercase `HTTPS_PROXY` environment variable for their direct API call to Anthropic.
|
|
108
|
+
- **๐ง New Thinking Effort widget (v2.2.4)** - Added a widget that shows the current Claude Code thinking effort level.
|
|
109
|
+
- **๐ Better macOS usage lookup reliability (v2.2.5)** - Improved reliability when loading usage API tokens on macOS.
|
|
110
|
+
- **โจ๏ธ New Vim Mode widget (v2.2.5)** - Added a widget that shows the current vim mode, with ASCII and optional Nerd Font icon display.
|
|
111
|
+
- **๐ Git widget link modes (v2.2.6)** - `Git Branch` can render clickable GitHub branch links, and `Git Root Dir` can render clickable IDE links for VS Code and Cursor.
|
|
112
|
+
- **๐ค Better subagent-aware speed reporting** - Token speed calculations continue to include referenced subagent activity so displayed speeds better reflect actual concurrent work.
|
|
113
|
+
|
|
114
|
+
<br />
|
|
115
|
+
<details>
|
|
116
|
+
<summary><b>Older updates (v2.1.10 and earlier)</b></summary>
|
|
117
|
+
|
|
118
|
+
### v2.1.0 - v2.1.10 - Usage widgets, links, new git insertions / deletions widgets, and reliability fixes
|
|
119
|
+
|
|
120
|
+
- **๐งฉ New Usage widgets (v2.1.0)** - Added **Session Usage**, **Weekly Usage**, **Block Reset Timer**, and **Context Bar** widgets.
|
|
121
|
+
- **๐ More accurate counts (v2.1.0)** - Usage/context widgets now use new statusline JSON metrics when available for more accurate token and context counts.
|
|
122
|
+
- **๐ช Windows empty file bug fix (v2.1.1)** - Fixed a Windows issue that could create an empty `c:\dev\null` file.
|
|
123
|
+
- **๐ New Link widget (v2.1.3)** - Added a new **Link** widget with clickable OSC8 rendering, preview parity, and raw mode support.
|
|
124
|
+
- **โ New Git Insertions widget (v2.1.4)** - Added a dedicated Git widget that shows only uncommitted insertions (e.g., `+42`).
|
|
125
|
+
- **โ New Git Deletions widget (v2.1.4)** - Added a dedicated Git widget that shows only uncommitted deletions (e.g., `-10`).
|
|
126
|
+
- **๐ง Context format fallback fix (v2.1.6)** - When `context_window_size` is missing, context widgets now infer 1M models from long-context labels such as `[1m]` and `1M context` in model identifiers.
|
|
127
|
+
- **โณ Weekly reset timer split (v2.1.7)** - Added a separate `Weekly Reset Timer` widget.
|
|
128
|
+
- **โ๏ธ Custom config file flag (v2.1.8)** - Added `--config <path>` support so ccstatusline can load/save settings from a custom file location.
|
|
129
|
+
- **๐ฃ Unicode separator hex input upgrade (v2.1.9)** - Powerline separator hex input now supports 4-6 digits (full Unicode code points up to `U+10FFFF`).
|
|
130
|
+
- **๐ณ Bare repo worktree detection fix (v2.1.10)** - `Git Worktree` now correctly detects linked worktrees created from bare repositories.
|
|
131
|
+
|
|
132
|
+
### v2.0.26 - v2.0.29 - Performance, git internals, and workflow improvements
|
|
133
|
+
|
|
134
|
+
- **๐ง Memory Usage widget (v2.0.29)** - Added a new widget that shows current system memory usage (`Mem: used/total`).
|
|
135
|
+
- **โก Block timer cache (v2.0.28)** - Cache block timer metrics to reduce JSONL parsing on every render, with per-config hashed cache files and automatic 5-hour block invalidation.
|
|
136
|
+
- **๐งฑ Git widget command refactor (v2.0.28)** - Refactored git widgets to use shared git command helpers and expanded coverage for failure and edge-case tests.
|
|
137
|
+
- **๐ช Windows UTF-8 piped output fix (v2.0.28)** - Sets the Windows UTF-8 code page for piped status line rendering.
|
|
138
|
+
- **๐ Git Root Dir widget (v2.0.27)** - Added a new Git widget that shows the repository root directory name.
|
|
139
|
+
- **๐ท๏ธ Session Name widget (v2.0.26)** - Added a new widget that shows the current Claude Code session name from `/rename`.
|
|
140
|
+
- **๐ Current Working Directory home abbreviation (v2.0.26)** - Added a `~` abbreviation option for CWD display in both preview and live rendering.
|
|
141
|
+
- **๐ง Context model suffix fix (v2.0.26)** - Context widgets now recognize the `[1m]` suffix across models, not just a single model path.
|
|
142
|
+
- **๐งญ Widget picker UX updates (v2.0.26)** - Improved widget discovery/navigation and added clearer, safer clear-line behavior.
|
|
143
|
+
- **โจ๏ธ TUI editor input fix (v2.0.26)** - Prevented shortcut/input leakage into widget editor flows.
|
|
144
|
+
- **๐ Repo docs update (v2.0.26)** - Migrated guidance from `CLAUDE.md` to `AGENTS.md` (with symlink compatibility).
|
|
145
|
+
|
|
146
|
+
### v2.0.16 - Add fish style path abbreviation toggle to Current Working Directory widget
|
|
147
|
+
|
|
148
|
+
### v2.0.15 - Block Timer calculation fixes
|
|
149
|
+
|
|
150
|
+
- Fix miscalculation in the block timer
|
|
151
|
+
|
|
152
|
+
### v2.0.14 - Add remaining mode toggle to Context Percentage widgets
|
|
153
|
+
|
|
154
|
+
- **Remaining Mode** - You can now toggle the Context Percentage widgets between usage percentage and remaining percentage when configuring them in the TUI by pressing the 'u' key.
|
|
155
|
+
|
|
156
|
+
### v2.0.12 - Custom Text widget now supports emojis
|
|
157
|
+
|
|
158
|
+
- **๐พ Emoji Support** - You can now paste emoji into the custom text widget. You can also turn on the merge option to get emoji labels for your widgets like this:
|
|
159
|
+
|
|
160
|
+

|
|
161
|
+
|
|
162
|
+
### v2.0.11 - Unlimited Status Lines
|
|
163
|
+
|
|
164
|
+
- **๐ No Line Limit** - Configure as many status lines as you need - the 3-line limitation has been removed
|
|
165
|
+
|
|
166
|
+
### v2.0.10 - Git Updates
|
|
167
|
+
|
|
168
|
+
- **๐ณ Git Worktree widget** - Shows the active worktree name when working with git worktrees
|
|
169
|
+
- **๐ป Hide 'no git' message toggle** - Git widgets now support hiding the 'no git' message when not in a repository (toggle with 'h' key while editing the widget)
|
|
170
|
+
|
|
171
|
+
### v2.0.8 - Powerline Auto-Alignment
|
|
172
|
+
|
|
173
|
+

|
|
174
|
+
|
|
175
|
+
- **๐ฏ Widget Alignment** - Auto-align widgets across multiple status lines in Powerline mode for a clean, columnar layout (toggle with 'a' in Powerline Setup)
|
|
176
|
+
|
|
177
|
+
### v2.0.7 - Current Working Directory & Session Cost
|
|
178
|
+
|
|
179
|
+

|
|
180
|
+
|
|
181
|
+
- **๐ Current Working Directory** - Display the current working directory with configurable segment display
|
|
182
|
+
- Set the number of path segments to show (e.g., show only last 2 segments: `.../Personal/ccstatusline`)
|
|
183
|
+
- Supports raw value mode for compact display
|
|
184
|
+
- Automatically truncates long paths with ellipsis
|
|
185
|
+
- **๐ฐ Session Cost Widget** - Track your Claude Code session costs (requires Claude Code 1.0.85+)
|
|
186
|
+
- Displays total session cost in USD
|
|
187
|
+
- Supports raw value mode (shows just `$X.YZ` vs `Cost: $X.YZ`)
|
|
188
|
+
- Real-time cost tracking from Claude Code session data
|
|
189
|
+
- Note: Cost may not update properly when using `/resume` (Claude Code limitation)
|
|
190
|
+
- **๐ Bug Fixes**
|
|
191
|
+
- Fixed Block Timer calculations for accurate time tracking across block boundaries
|
|
192
|
+
- Improved widget editor stability with proper Ctrl+S handling
|
|
193
|
+
- Enhanced cursor display in numeric input fields
|
|
194
|
+
|
|
195
|
+
### v2.0.2 - Block Timer Widget
|
|
196
|
+
|
|
197
|
+

|
|
198
|
+
|
|
199
|
+
- **โฑ๏ธ Block Timer** - Track your progress through 5-hour Claude Code blocks
|
|
200
|
+
- Displays time elapsed in current block as hours/minutes (e.g., "3hr 45m")
|
|
201
|
+
- Progress bar mode shows visual completion percentage
|
|
202
|
+
- Two progress bar styles: full width (32 chars) or compact (16 chars)
|
|
203
|
+
- Automatically detects block boundaries from transcript timestamps
|
|
204
|
+
|
|
205
|
+
### v2.0.0 - Powerline Support & Enhanced Themes
|
|
206
|
+
- **โก Powerline Mode** - Beautiful Powerline-style status lines with arrow separators and customizable caps
|
|
207
|
+
- **๐จ Built-in Themes** - Multiple pre-configured themes that you can copy and customize
|
|
208
|
+
- **๐ Advanced Color Support** - Basic (16), 256-color (with custom ANSI codes), and truecolor (with hex codes) modes
|
|
209
|
+
- **๐ Widget Merging** - Merge multiple widgets together with or without padding for seamless designs
|
|
210
|
+
- **๐ฆ Easy Installation** - Install directly with `npx` or `bunx` - no global package needed
|
|
211
|
+
- **๐ค Custom Separators** - Add multiple Powerline separators with custom hex codes for font support
|
|
212
|
+
- **๐ Auto Font Install** - Automatic Powerline font installation with user consent
|
|
213
|
+
|
|
214
|
+
</details>
|
|
215
|
+
|
|
216
|
+
<br />
|
|
217
|
+
|
|
218
|
+
## โจ Features
|
|
219
|
+
|
|
220
|
+
- **๐ Real-time Metrics** - Display model name, git branch, token usage, per-model weekly usage, voice input state, session duration, compaction count, block timer, and more
|
|
221
|
+
- **๐จ Fully Customizable** - Choose what to display and customize colors for each element
|
|
222
|
+
- **โก Powerline Support** - Beautiful Powerline-style rendering with arrow separators, caps, and custom fonts
|
|
223
|
+
- **๐ Multi-line Support** - Configure multiple independent status lines
|
|
224
|
+
- **๐ฅ๏ธ Interactive TUI** - Built-in configuration interface using React/Ink
|
|
225
|
+
- **๐ Fast Widget Picker** - Add/change widgets by category with search and ranked matching
|
|
226
|
+
- **โ๏ธ Global Options** - Apply consistent formatting across all widgets (padding, separators, bold, minimalist mode, and color overrides)
|
|
227
|
+
- **๐ Cross-platform** - Works seamlessly with both Bun and Node.js
|
|
228
|
+
- **๐ง Flexible Configuration** - Supports custom Claude Code config directory via `CLAUDE_CONFIG_DIR` environment variable
|
|
229
|
+
- **๐ Smart Width Detection** - Automatically adapts to terminal width with flex separators
|
|
230
|
+
- **โก Zero Config** - Sensible defaults that work out of the box
|
|
231
|
+
|
|
232
|
+
<br />
|
|
233
|
+
|
|
234
|
+
## ๐ Localizations
|
|
235
|
+
|
|
236
|
+
The localizations in this section are third-party forks maintained outside this repository. They are not maintained, reviewed, or endorsed by this repository, so review their code and releases before using them.
|
|
237
|
+
|
|
238
|
+
- ๐ **ไธญๆ็ (Chinese):** [ccstatusline-zh](https://github.com/huangguang1999/ccstatusline-zh)
|
|
239
|
+
|
|
240
|
+
<br />
|
|
241
|
+
|
|
242
|
+
## ๐ Quick Start
|
|
243
|
+
|
|
244
|
+
### No installation needed! Use directly with npx or bunx:
|
|
245
|
+
|
|
246
|
+
```bash
|
|
247
|
+
# Run the configuration TUI with npm
|
|
248
|
+
npx -y ccstatusline@latest
|
|
249
|
+
|
|
250
|
+
# Or with Bun (faster)
|
|
251
|
+
bunx -y ccstatusline@latest
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
<br />
|
|
255
|
+
<details>
|
|
256
|
+
<summary><b>Configure ccstatusline</b></summary>
|
|
257
|
+
|
|
258
|
+
The interactive configuration tool provides a terminal UI where you can:
|
|
259
|
+
- Configure multiple separate status lines
|
|
260
|
+
- Add/remove/reorder status line widgets
|
|
261
|
+
- Customize colors for each widget
|
|
262
|
+
- Configure flex separator behavior
|
|
263
|
+
- Configure Claude Code status line refresh interval when supported
|
|
264
|
+
- Edit custom text widgets
|
|
265
|
+
- Install/uninstall to Claude Code settings
|
|
266
|
+
- Preview your status line in real-time
|
|
267
|
+
|
|
268
|
+
> ๐ก **Tip:** Your settings are automatically saved to `~/.config/ccstatusline/settings.json`
|
|
269
|
+
|
|
270
|
+
> ๐ง **Custom Claude Config:** If your Claude Code configuration is in a non-standard location, set the `CLAUDE_CONFIG_DIR` environment variable:
|
|
271
|
+
> ```bash
|
|
272
|
+
> # Linux/macOS
|
|
273
|
+
> export CLAUDE_CONFIG_DIR=/custom/path/to/.claude
|
|
274
|
+
> ```
|
|
275
|
+
|
|
276
|
+
> ๐ **Usage API proxy:** Usage widgets honor the uppercase `HTTPS_PROXY` environment variable for their direct API call to Anthropic.
|
|
277
|
+
|
|
278
|
+
> ๐ช **Windows Support:** PowerShell examples, installation notes, fonts, troubleshooting, WSL, and Windows Terminal configuration are in [docs/WINDOWS.md](docs/WINDOWS.md).
|
|
279
|
+
|
|
280
|
+
</details>
|
|
281
|
+
|
|
282
|
+
<details>
|
|
283
|
+
<summary><b>Claude Code settings.json format</b></summary>
|
|
284
|
+
|
|
285
|
+
When you install from the TUI, ccstatusline writes a `statusLine` command object to your Claude Code settings:
|
|
286
|
+
|
|
287
|
+
```json
|
|
288
|
+
{
|
|
289
|
+
"statusLine": {
|
|
290
|
+
"type": "command",
|
|
291
|
+
"command": "npx -y ccstatusline@latest",
|
|
292
|
+
"padding": 0,
|
|
293
|
+
"refreshInterval": 10
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
`refreshInterval` is written only when your Claude Code version supports it (>=2.1.97). The TUI can set it to `1-60` seconds, or remove it by leaving the input empty.
|
|
299
|
+
|
|
300
|
+
Other supported command values are:
|
|
301
|
+
- `bunx -y ccstatusline@latest`
|
|
302
|
+
- `ccstatusline` (for self-managed/global installs)
|
|
303
|
+
|
|
304
|
+
</details>
|
|
305
|
+
|
|
306
|
+
## ๐ค Contributing
|
|
307
|
+
|
|
308
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
309
|
+
|
|
310
|
+
1. Fork the repository
|
|
311
|
+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
312
|
+
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
|
313
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
314
|
+
5. Open a Pull Request
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
## Support
|
|
318
|
+
|
|
319
|
+
If ccstatusline is useful to you, consider buying me a coffee:
|
|
320
|
+
|
|
321
|
+
<a href="https://www.buymeacoffee.com/sirmalloc" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
## ๐ License
|
|
325
|
+
|
|
326
|
+
[MIT](LICENSE) ยฉ Matthew Breedlove
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
## ๐ค Author
|
|
330
|
+
|
|
331
|
+
**Matthew Breedlove**
|
|
332
|
+
|
|
333
|
+
- GitHub: [@sirmalloc](https://github.com/sirmalloc)
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
## ๐ Related Projects
|
|
337
|
+
|
|
338
|
+
- [tweakcc](https://github.com/Piebald-AI/tweakcc) - Customize Claude Code themes, thinking verbs, and more.
|
|
339
|
+
- [ccusage](https://github.com/ryoppippi/ccusage) - Track and display Claude Code usage metrics.
|
|
340
|
+
- [codachi](https://github.com/vincent-k2026/codachi) - A tamagotchi-style statusline pet that grows with your context window.
|
|
341
|
+
- [AIWatch](https://ai-watch.dev) - Live status monitor for 30+ AI APIs and apps; pairs with a Custom Command widget to surface provider outages in your status line.
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
## ๐ Acknowledgments
|
|
345
|
+
|
|
346
|
+
- Built for use with [Claude Code CLI](https://claude.ai/code) by Anthropic
|
|
347
|
+
- Powered by [Ink](https://github.com/vadimdemedes/ink) for the terminal UI
|
|
348
|
+
- Made with โค๏ธ for the Claude Code community
|
|
349
|
+
|
|
350
|
+
<br />
|
|
351
|
+
|
|
352
|
+
## Star History
|
|
353
|
+
|
|
354
|
+
<a href="https://www.star-history.com/#sirmalloc/ccstatusline&Timeline">
|
|
355
|
+
<picture>
|
|
356
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=sirmalloc/ccstatusline&type=Timeline&theme=dark" />
|
|
357
|
+
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=sirmalloc/ccstatusline&type=Timeline" />
|
|
358
|
+
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=sirmalloc/ccstatusline&type=Timeline" />
|
|
359
|
+
</picture>
|
|
360
|
+
</a>
|
|
361
|
+
|
|
362
|
+
<div align="center">
|
|
363
|
+
|
|
364
|
+
### ๐ Show Your Support
|
|
365
|
+
|
|
366
|
+
Give a โญ if this project helped you!
|
|
367
|
+
|
|
368
|
+
[](https://github.com/sirmalloc/ccstatusline/stargazers)
|
|
369
|
+
[](https://github.com/sirmalloc/ccstatusline/network/members)
|
|
370
|
+
[](https://github.com/sirmalloc/ccstatusline/watchers)
|
|
371
|
+
|
|
372
|
+
[](https://www.npmjs.com/package/ccstatusline)
|
|
373
|
+
[](https://www.npmjs.com/package/ccstatusline)
|
|
374
|
+
[](https://github.com/sirmalloc/ccstatusline/blob/main/LICENSE)
|
|
375
|
+
[](https://bun.sh)
|
|
376
|
+
|
|
377
|
+
[](https://github.com/sirmalloc/ccstatusline/issues)
|
|
378
|
+
[](https://github.com/sirmalloc/ccstatusline/pulls)
|
|
379
|
+
[](https://github.com/sirmalloc/ccstatusline/graphs/contributors)
|
|
380
|
+
|
|
381
|
+
### ๐ฌ Connect
|
|
382
|
+
|
|
383
|
+
[Report Bug](https://github.com/sirmalloc/ccstatusline/issues) ยท [Request Feature](https://github.com/sirmalloc/ccstatusline/issues) ยท [Discussions](https://github.com/sirmalloc/ccstatusline/discussions)
|
|
384
|
+
|
|
385
|
+
</div>
|
package/dist/ccstatusline.js
CHANGED
|
@@ -56044,7 +56044,7 @@ function getTerminalWidth() {
|
|
|
56044
56044
|
function canDetectTerminalWidth() {
|
|
56045
56045
|
return probeTerminalWidth() !== null;
|
|
56046
56046
|
}
|
|
56047
|
-
var __dirname = "C:\\Users\\slh\\mochiapi-
|
|
56047
|
+
var __dirname = "C:\\Users\\slh\\mochiapi-statusline\\src\\utils", PACKAGE_VERSION = "0.1.1";
|
|
56048
56048
|
var init_terminal = () => {};
|
|
56049
56049
|
|
|
56050
56050
|
// src/utils/renderer.ts
|
|
@@ -67110,16 +67110,17 @@ function localDateKey(now2 = Date.now()) {
|
|
|
67110
67110
|
const day = `${d.getDate()}`.padStart(2, "0");
|
|
67111
67111
|
return `${y}-${m}-${day}`;
|
|
67112
67112
|
}
|
|
67113
|
-
function estimateTodayUsedUsd(
|
|
67114
|
-
if (
|
|
67115
|
-
return null;
|
|
67116
|
-
const prevTotal = typeof prev.tokenTotalUsedUsd === "number" ? prev.tokenTotalUsedUsd : null;
|
|
67117
|
-
if (prevTotal === null)
|
|
67113
|
+
function estimateTodayUsedUsd(currentTokenUsd, prev, todayKey, currentAccountUsedUsd = null) {
|
|
67114
|
+
if (!prev)
|
|
67118
67115
|
return null;
|
|
67119
67116
|
const prevDate = prev.tokenTotalUsedLocalDate ?? localDateKey(prev.fetchedAt);
|
|
67120
67117
|
if (prevDate !== todayKey)
|
|
67121
67118
|
return null;
|
|
67122
|
-
|
|
67119
|
+
if (currentTokenUsd !== null && typeof prev.tokenTotalUsedUsd === "number")
|
|
67120
|
+
return Math.max(0, currentTokenUsd - prev.tokenTotalUsedUsd);
|
|
67121
|
+
if (currentAccountUsedUsd !== null && typeof prev.accountUsedUsd === "number")
|
|
67122
|
+
return Math.max(0, currentAccountUsedUsd - prev.accountUsedUsd);
|
|
67123
|
+
return null;
|
|
67123
67124
|
}
|
|
67124
67125
|
function emptyCache(now2, ok) {
|
|
67125
67126
|
return {
|
|
@@ -67135,27 +67136,30 @@ function emptyCache(now2, ok) {
|
|
|
67135
67136
|
tokenTotalUsedLocalDate: null
|
|
67136
67137
|
};
|
|
67137
67138
|
}
|
|
67138
|
-
|
|
67139
|
+
function quotaToUsd(quota) {
|
|
67140
|
+
return quota === null ? null : quota / NEWAPI_QUOTA_PER_USD;
|
|
67141
|
+
}
|
|
67142
|
+
function cacheFromTokenUsage(resp, now2, prev) {
|
|
67139
67143
|
const d = dataObject(resp);
|
|
67140
|
-
const
|
|
67144
|
+
const tokenUnlimited = toBool(d.unlimited_quota) ?? toBool(d.token_unlimited);
|
|
67145
|
+
const totalUsedQuotaUsd = quotaToUsd(toNum(d.total_used));
|
|
67146
|
+
const totalGrantedQuotaUsd = quotaToUsd(toNum(d.total_granted));
|
|
67147
|
+
const totalAvailableQuotaUsd = quotaToUsd(toNum(d.total_available));
|
|
67148
|
+
const totalUsedUsd = firstNum(d.total_usd_used, d.token_total_usd_used, d.total_used_usd) ?? totalUsedQuotaUsd;
|
|
67149
|
+
const accountUsedUsdForEstimate = firstNum(d.user_used_quota_usd, d.user_usd_used);
|
|
67141
67150
|
const todayKey = localDateKey(now2);
|
|
67142
|
-
const todayUsedUsd = firstNum(d.today_used_quota_usd, d.today_usd_used, d.today_used_usd) ?? estimateTodayUsedUsd(totalUsedUsd, prev, todayKey);
|
|
67143
|
-
|
|
67144
|
-
|
|
67145
|
-
try {
|
|
67146
|
-
const dashResp = await httpGet(`${cfg.baseUrl}/api/user/dashboard/balance`, cfg.token);
|
|
67147
|
-
return await cacheFromDashboard(cfg, dashResp, now2);
|
|
67148
|
-
} catch {}
|
|
67149
|
-
}
|
|
67151
|
+
const todayUsedUsd = firstNum(d.today_used_quota_usd, d.today_usd_used, d.today_used_usd) ?? estimateTodayUsedUsd(totalUsedUsd, prev, todayKey, accountUsedUsdForEstimate);
|
|
67152
|
+
const limitedTokenQuotaFallback = tokenUnlimited === true ? null : totalGrantedQuotaUsd;
|
|
67153
|
+
const limitedTokenRemainFallback = tokenUnlimited === true ? null : totalAvailableQuotaUsd;
|
|
67150
67154
|
return {
|
|
67151
67155
|
fetchedAt: now2,
|
|
67152
67156
|
ok: true,
|
|
67153
|
-
directBalanceUsd,
|
|
67154
|
-
accountQuotaUsd: firstNum(d.user_quota_usd, d.user_total_quota_usd),
|
|
67157
|
+
directBalanceUsd: firstNum(d.user_usd_available, d.user_available_usd, d.user_balance_usd, d.user_remain_quota_usd, d.user_remaining_quota_usd, d.remain_balance, d.remaining_balance, d.balance_usd, d.balance),
|
|
67158
|
+
accountQuotaUsd: firstNum(d.user_quota_usd, d.user_total_quota_usd) ?? limitedTokenQuotaFallback,
|
|
67155
67159
|
accountUsedUsd: firstNum(d.user_used_quota_usd, d.user_usd_used),
|
|
67156
67160
|
todayUsedUsd,
|
|
67157
|
-
tokenRemainUsd: firstNum(d.total_usd_available, d.token_remain_quota_usd, d.token_remaining_quota_usd, d.token_available_usd),
|
|
67158
|
-
tokenUnlimited
|
|
67161
|
+
tokenRemainUsd: firstNum(d.total_usd_available, d.token_remain_quota_usd, d.token_remaining_quota_usd, d.token_available_usd) ?? limitedTokenRemainFallback,
|
|
67162
|
+
tokenUnlimited,
|
|
67159
67163
|
tokenTotalUsedUsd: totalUsedUsd,
|
|
67160
67164
|
tokenTotalUsedLocalDate: totalUsedUsd === null ? null : todayKey
|
|
67161
67165
|
};
|
|
@@ -67199,7 +67203,7 @@ async function fetchBalance(cfg, previousCache) {
|
|
|
67199
67203
|
const errors3 = [];
|
|
67200
67204
|
try {
|
|
67201
67205
|
const resp = await httpGet(`${cfg.baseUrl}/api/usage/token/`, cfg.token);
|
|
67202
|
-
return
|
|
67206
|
+
return cacheFromTokenUsage(resp, now2, prev);
|
|
67203
67207
|
} catch (e) {
|
|
67204
67208
|
errors3.push(`/api/usage/token/: ${e instanceof Error ? e.message : String(e)}`);
|
|
67205
67209
|
}
|
|
@@ -67253,7 +67257,10 @@ function viewFromCache(cache3, cfg) {
|
|
|
67253
67257
|
const quota = cache3.accountQuotaUsd;
|
|
67254
67258
|
const used = cache3.accountUsedUsd;
|
|
67255
67259
|
const tokenRemain = cache3.tokenRemainUsd;
|
|
67256
|
-
const
|
|
67260
|
+
const accountSentinelUnlimited = typeof quota === "number" && quota >= UNLIMITED_THRESHOLD;
|
|
67261
|
+
const hasAccountSignal = typeof quota === "number" || typeof used === "number" || typeof cache3.directBalanceUsd === "number";
|
|
67262
|
+
const tokenFallbackUnlimited = !hasAccountSignal && cache3.tokenUnlimited === true;
|
|
67263
|
+
const unlimited = accountSentinelUnlimited || tokenFallbackUnlimited;
|
|
67257
67264
|
let balanceUsd = null;
|
|
67258
67265
|
if (typeof cache3.directBalanceUsd === "number") {
|
|
67259
67266
|
balanceUsd = cache3.directBalanceUsd;
|
|
@@ -67284,7 +67291,7 @@ async function refreshCli() {
|
|
|
67284
67291
|
const cache3 = await fetchBalance(cfg);
|
|
67285
67292
|
writeCache2(cache3);
|
|
67286
67293
|
}
|
|
67287
|
-
var DEFAULT_BASE_URL = "https://mochiapi.com", DEFAULT_INTERVAL = 30, UNLIMITED_THRESHOLD = 1e7, MOCHI_CONFIG_PATH, MOCHI_CACHE_PATH;
|
|
67294
|
+
var DEFAULT_BASE_URL = "https://mochiapi.com", DEFAULT_INTERVAL = 30, UNLIMITED_THRESHOLD = 1e7, NEWAPI_QUOTA_PER_USD = 500000, MOCHI_CONFIG_PATH, MOCHI_CACHE_PATH;
|
|
67288
67295
|
var init_mochiapi = __esm(() => {
|
|
67289
67296
|
MOCHI_CONFIG_PATH = join4(getMochiConfigDir(), "config.json");
|
|
67290
67297
|
MOCHI_CACHE_PATH = join4(getMochiCacheDir(), "balance.json");
|
|
@@ -67329,7 +67336,14 @@ class MochiApiBalanceWidget {
|
|
|
67329
67336
|
const view = viewFromCache(cache3, cfg);
|
|
67330
67337
|
if (!view)
|
|
67331
67338
|
return labeled ? "Mochi: ..." : "...";
|
|
67332
|
-
|
|
67339
|
+
let body;
|
|
67340
|
+
if (view.balanceUsd !== null) {
|
|
67341
|
+
body = fmtUsd(view.balanceUsd);
|
|
67342
|
+
} else if (view.unlimited) {
|
|
67343
|
+
body = "โ";
|
|
67344
|
+
} else {
|
|
67345
|
+
body = "?";
|
|
67346
|
+
}
|
|
67333
67347
|
const decorated = view.stale ? `${body}*` : body;
|
|
67334
67348
|
return labeled ? `Mochi: ${decorated}` : decorated;
|
|
67335
67349
|
}
|
|
@@ -67438,7 +67452,7 @@ class MochiApiSubscriptionWidget {
|
|
|
67438
67452
|
const view = viewFromCache(cache3, cfg);
|
|
67439
67453
|
if (!view)
|
|
67440
67454
|
return labeled ? "Mochi: ..." : "...";
|
|
67441
|
-
const balance = view.balanceUsd
|
|
67455
|
+
const balance = view.balanceUsd !== null ? fmtUsd3(view.balanceUsd) : view.unlimited ? "โ" : "?";
|
|
67442
67456
|
const today = view.todayUsedUsd === null ? "?" : fmtUsd3(view.todayUsedUsd);
|
|
67443
67457
|
const subscription = view.tokenUnlimited === true ? "โ" : view.tokenRemainUsd === null ? "?" : fmtUsd3(view.tokenRemainUsd);
|
|
67444
67458
|
const body = `ไฝ้ข ${balance} ยท ไปๆฅ ${today} ยท ่ฎข้
${subscription}`;
|
package/package.json
CHANGED
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "mochiapi-statusline",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "ccstatusline fork with a MochiAPI balance widget (Claude Code status line for MochiAPI users)",
|
|
5
|
-
"module": "src/ccstatusline.ts",
|
|
6
|
-
"type": "module",
|
|
7
|
-
"bin": {
|
|
8
|
-
"mochiapi-statusline": "dist/ccstatusline.js"
|
|
9
|
-
},
|
|
10
|
-
"files": [
|
|
11
|
-
"dist/"
|
|
12
|
-
],
|
|
13
|
-
"scripts": {
|
|
14
|
-
"start": "bun run src/ccstatusline.ts",
|
|
15
|
-
"build": "rm -rf dist/* ; bun build src/ccstatusline.ts --target=node --outfile=dist/ccstatusline.js --target-version=14",
|
|
16
|
-
"postbuild": "bun run scripts/replace-version.ts",
|
|
17
|
-
"example": "cat scripts/payload.example.json | bun start",
|
|
18
|
-
"lint": "bun tsc --noEmit && eslint . --config eslint.config.js --max-warnings=0",
|
|
19
|
-
"lint:fix": "bun tsc --noEmit && eslint . --config eslint.config.js --max-warnings=0 --fix",
|
|
20
|
-
"docs": "typedoc",
|
|
21
|
-
"docs:clean": "rm -rf typedoc"
|
|
22
|
-
},
|
|
23
|
-
"devDependencies": {
|
|
24
|
-
"@eslint/js": "^10.0.1",
|
|
25
|
-
"@stylistic/eslint-plugin": "^5.2.3",
|
|
26
|
-
"@types/bun": "latest",
|
|
27
|
-
"@types/pluralize": "^0.0.33",
|
|
28
|
-
"@types/react": "^19.1.10",
|
|
29
|
-
"chalk": "^5.5.0",
|
|
30
|
-
"eslint": "^10.0.0",
|
|
31
|
-
"eslint-import-resolver-typescript": "^4.4.4",
|
|
32
|
-
"eslint-plugin-import-newlines": "^2.0.0",
|
|
33
|
-
"eslint-plugin-import-x": "^4.16.2",
|
|
34
|
-
"eslint-plugin-react": "^7.37.5",
|
|
35
|
-
"eslint-plugin-react-hooks": "^7.0.1",
|
|
36
|
-
"globals": "^17.3.0",
|
|
37
|
-
"https-proxy-agent": "^8.0.0",
|
|
38
|
-
"ink": "6.2.0",
|
|
39
|
-
"ink-gradient": "^4.0.0",
|
|
40
|
-
"ink-select-input": "^6.2.0",
|
|
41
|
-
"pluralize": "^8.0.0",
|
|
42
|
-
"react": "^19.1.1",
|
|
43
|
-
"react-devtools-core": "^7.0.1",
|
|
44
|
-
"strip-ansi": "^7.1.0",
|
|
45
|
-
"tinyglobby": "^0.2.14",
|
|
46
|
-
"typedoc": "^0.28.12",
|
|
47
|
-
"typescript": "^6.0.2",
|
|
48
|
-
"typescript-eslint": "^8.39.1",
|
|
49
|
-
"vitest": "^4.0.18",
|
|
50
|
-
"zod": "^4.0.17"
|
|
51
|
-
},
|
|
52
|
-
"keywords": [
|
|
53
|
-
"claude",
|
|
54
|
-
"claude-code",
|
|
55
|
-
"cli",
|
|
56
|
-
"status-line",
|
|
57
|
-
"terminal"
|
|
58
|
-
],
|
|
59
|
-
"author": "",
|
|
60
|
-
"license": "MIT",
|
|
61
|
-
"repository": {
|
|
62
|
-
"type": "git",
|
|
63
|
-
"url": "git+https://github.com/Subaru486desuwa/mochiapi-statusline.git"
|
|
64
|
-
},
|
|
65
|
-
"engines": {
|
|
66
|
-
"node": ">=14.0.0"
|
|
67
|
-
},
|
|
68
|
-
"trustedDependencies": [
|
|
69
|
-
"unrs-resolver"
|
|
70
|
-
],
|
|
71
|
-
"patchedDependencies": {
|
|
72
|
-
"ink@6.2.0": "patches/ink@6.2.0.patch"
|
|
73
|
-
}
|
|
74
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "mochiapi-statusline",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "ccstatusline fork with a MochiAPI balance widget (Claude Code status line for MochiAPI users)",
|
|
5
|
+
"module": "src/ccstatusline.ts",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"mochiapi-statusline": "dist/ccstatusline.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist/"
|
|
12
|
+
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"start": "bun run src/ccstatusline.ts",
|
|
15
|
+
"build": "rm -rf dist/* ; bun build src/ccstatusline.ts --target=node --outfile=dist/ccstatusline.js --target-version=14",
|
|
16
|
+
"postbuild": "bun run scripts/replace-version.ts",
|
|
17
|
+
"example": "cat scripts/payload.example.json | bun start",
|
|
18
|
+
"lint": "bun tsc --noEmit && eslint . --config eslint.config.js --max-warnings=0",
|
|
19
|
+
"lint:fix": "bun tsc --noEmit && eslint . --config eslint.config.js --max-warnings=0 --fix",
|
|
20
|
+
"docs": "typedoc",
|
|
21
|
+
"docs:clean": "rm -rf typedoc"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@eslint/js": "^10.0.1",
|
|
25
|
+
"@stylistic/eslint-plugin": "^5.2.3",
|
|
26
|
+
"@types/bun": "latest",
|
|
27
|
+
"@types/pluralize": "^0.0.33",
|
|
28
|
+
"@types/react": "^19.1.10",
|
|
29
|
+
"chalk": "^5.5.0",
|
|
30
|
+
"eslint": "^10.0.0",
|
|
31
|
+
"eslint-import-resolver-typescript": "^4.4.4",
|
|
32
|
+
"eslint-plugin-import-newlines": "^2.0.0",
|
|
33
|
+
"eslint-plugin-import-x": "^4.16.2",
|
|
34
|
+
"eslint-plugin-react": "^7.37.5",
|
|
35
|
+
"eslint-plugin-react-hooks": "^7.0.1",
|
|
36
|
+
"globals": "^17.3.0",
|
|
37
|
+
"https-proxy-agent": "^8.0.0",
|
|
38
|
+
"ink": "6.2.0",
|
|
39
|
+
"ink-gradient": "^4.0.0",
|
|
40
|
+
"ink-select-input": "^6.2.0",
|
|
41
|
+
"pluralize": "^8.0.0",
|
|
42
|
+
"react": "^19.1.1",
|
|
43
|
+
"react-devtools-core": "^7.0.1",
|
|
44
|
+
"strip-ansi": "^7.1.0",
|
|
45
|
+
"tinyglobby": "^0.2.14",
|
|
46
|
+
"typedoc": "^0.28.12",
|
|
47
|
+
"typescript": "^6.0.2",
|
|
48
|
+
"typescript-eslint": "^8.39.1",
|
|
49
|
+
"vitest": "^4.0.18",
|
|
50
|
+
"zod": "^4.0.17"
|
|
51
|
+
},
|
|
52
|
+
"keywords": [
|
|
53
|
+
"claude",
|
|
54
|
+
"claude-code",
|
|
55
|
+
"cli",
|
|
56
|
+
"status-line",
|
|
57
|
+
"terminal"
|
|
58
|
+
],
|
|
59
|
+
"author": "",
|
|
60
|
+
"license": "MIT",
|
|
61
|
+
"repository": {
|
|
62
|
+
"type": "git",
|
|
63
|
+
"url": "git+https://github.com/Subaru486desuwa/mochiapi-statusline.git"
|
|
64
|
+
},
|
|
65
|
+
"engines": {
|
|
66
|
+
"node": ">=14.0.0"
|
|
67
|
+
},
|
|
68
|
+
"trustedDependencies": [
|
|
69
|
+
"unrs-resolver"
|
|
70
|
+
],
|
|
71
|
+
"patchedDependencies": {
|
|
72
|
+
"ink@6.2.0": "patches/ink@6.2.0.patch"
|
|
73
|
+
}
|
|
74
|
+
}
|