cc-statusline-tui 2.0.8
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 +21 -0
- package/README.es.md +138 -0
- package/README.ja.md +138 -0
- package/README.ko.md +138 -0
- package/README.md +136 -0
- package/README.pt.md +138 -0
- package/README.ru.md +138 -0
- package/README.zh.md +140 -0
- package/cli.js +20 -0
- package/package.json +45 -0
- package/postinstall.js +141 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 LokiQ0713
|
|
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
|
+
SOFTWARE.
|
package/README.es.md
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# cc-statusline
|
|
2
|
+
|
|
3
|
+
[](https://github.com/LokiQ0713/cc-statusline-tui/actions/workflows/ci.yml)
|
|
4
|
+
[](https://github.com/LokiQ0713/cc-statusline-tui/actions/workflows/release.yml)
|
|
5
|
+
[](https://www.npmjs.com/package/cc-statusline-tui)
|
|
6
|
+
[](https://crates.io/crates/cc-statusline-tui)
|
|
7
|
+
|
|
8
|
+
> Tu barra de estado de Claude Code es aburrida. Vamos a arreglar eso.
|
|
9
|
+
|
|
10
|
+
[English](README.md) | [中文](README.zh.md) | [日本語](README.ja.md) | [한국어](README.ko.md) | [Português](README.pt.md) | [Русский](README.ru.md)
|
|
11
|
+
|
|
12
|
+

|
|
13
|
+
|
|
14
|
+
Un comando. Siete idiomas. Cero arrepentimientos.
|
|
15
|
+
|
|
16
|
+
## Instalación
|
|
17
|
+
|
|
18
|
+
Elige tu veneno:
|
|
19
|
+
|
|
20
|
+
### npm
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npx cc-statusline-tui
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Cargo
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
cargo install cc-statusline-tui
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Homebrew
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
brew tap LokiQ0713/cc-statusline-tui
|
|
36
|
+
brew install cc-statusline
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## ¿Qué pasa?
|
|
40
|
+
|
|
41
|
+
Aparece un asistente TUI. Eliges cosas. Queda bonito. Fin.
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
1/4 Segmentos → Qué mostrar
|
|
45
|
+
2/4 Configurar → Cómo se ve (vista previa en vivo, feedback instantáneo)
|
|
46
|
+
3/4 Reordenar → Dónde va cada cosa
|
|
47
|
+
4/4 Confirmar → ¡A producción!
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
¿Te da pereza personalizar? Elige "Usar valores por defecto" y pulsa Enter dos veces. Aquí no juzgamos a nadie.
|
|
51
|
+
|
|
52
|
+
## Segmentos
|
|
53
|
+
|
|
54
|
+
| Segmento | Se ve así | Qué hace | Puedes ajustar |
|
|
55
|
+
|----------|----------|----------|----------------|
|
|
56
|
+
| Model | `🔥 Opus4.6` | Muestra qué cerebro estás quemando | Icono (🔥🦊🐢🐰), color |
|
|
57
|
+
| Cost | `$0.42` | El nivel de dolor de tu cartera | Color |
|
|
58
|
+
| Usage | `██░░ 25% 1h43m` | Límite de 5h: barra + % + cuenta atrás | Estilo/carácter/longitud de barra, color, actualización |
|
|
59
|
+
| Path | `~/project` | Dónde estás | Color, longitud máxima |
|
|
60
|
+
| Git | `main* ↑2↓1` | Rama + cambios sin commit + ahead/behind | Componentes, color |
|
|
61
|
+
| Context | `▓▓▓▓░░░ 60% 600K/1M` | Cuánta ventana de contexto te has comido | Estilo/carácter/longitud de barra, color |
|
|
62
|
+
| Crypto | `BTC:$73748` | Porque ¿por qué no mirar precios mientras programas? | Monedas (BTC/ETH/BNB/SOL), color, actualización |
|
|
63
|
+
|
|
64
|
+
## Estilos de color
|
|
65
|
+
|
|
66
|
+
| Estilo | La onda |
|
|
67
|
+
|--------|---------|
|
|
68
|
+
| **Ultrathink Rainbow** | Cada carácter es de un color diferente. Sí, brilla. |
|
|
69
|
+
| **Ultrathink Gradient** | Arcoíris suave a lo largo de la barra. Obra de arte. |
|
|
70
|
+
| **Traffic Light** | Verde (≤30%) → Amarillo (≤60%) → Rojo (>60%). Tu ventana de contexto es un atasco. |
|
|
71
|
+
| Cyan / Green / Blue / Yellow | Las opciones sensatas |
|
|
72
|
+
| Magenta / Red / Orange / Pink / Purple / White | Las opciones expresivas |
|
|
73
|
+
|
|
74
|
+
## Idiomas
|
|
75
|
+
|
|
76
|
+
English, 中文, 日本語, 한국어, Español, Português, Русский.
|
|
77
|
+
|
|
78
|
+
Se selecciona en la primera ejecución. Tu barra de estado habla tu idioma.
|
|
79
|
+
|
|
80
|
+
## Cómo funciona
|
|
81
|
+
|
|
82
|
+
1. El asistente guarda la configuración en `~/.claude/statusline/config.json`
|
|
83
|
+
2. El binario va a `~/.claude/statusline/bin/`
|
|
84
|
+
3. `~/.claude/settings.json` se actualiza automáticamente
|
|
85
|
+
4. Reinicia Claude Code. Admira tu nueva barra de estado. Cuéntaselo a tus compañeros.
|
|
86
|
+
|
|
87
|
+
Si lo ejecutas de nuevo, carga tu configuración existente como valores por defecto. No destruye nada. Prometido.
|
|
88
|
+
|
|
89
|
+
## Requisitos
|
|
90
|
+
|
|
91
|
+
- Claude Code instalado (que exista `~/.claude/`)
|
|
92
|
+
- Node.js ≥ 18 (solo para instalar con `npx` — no se necesita en tiempo de ejecución)
|
|
93
|
+
|
|
94
|
+
## Seguridad y Privacidad
|
|
95
|
+
|
|
96
|
+
Tus datos no los tocamos. Tranquilo:
|
|
97
|
+
|
|
98
|
+
- El **segmento de crypto** hace peticiones a la API pública de Binance (`api.binance.com`) — sin autenticación, sin datos personales enviados
|
|
99
|
+
- El **segmento de usage** lee un token OAuth del llavero de macOS (`Claude Code-credentials`) para consultar la API de uso de Anthropic
|
|
100
|
+
- El **npm postinstall** descarga un binario específico para tu plataforma desde GitHub Releases — nada más se descarga
|
|
101
|
+
- Todos los datos se cachean localmente en archivos `/tmp/claude-statusline-*`
|
|
102
|
+
- Sin telemetría, sin analytics, sin envío de datos a ningún otro lugar
|
|
103
|
+
- Para más detalles, consulta [SECURITY.md](SECURITY.md)
|
|
104
|
+
|
|
105
|
+
## Desinstalar
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
# Eliminar configuración y binario
|
|
109
|
+
rm -rf ~/.claude/statusline/
|
|
110
|
+
|
|
111
|
+
# Eliminar la línea de estado de la configuración de Claude Code
|
|
112
|
+
# Edita ~/.claude/settings.json y borra la clave "statusLine"
|
|
113
|
+
|
|
114
|
+
# Eliminar caché
|
|
115
|
+
rm -f /tmp/claude-statusline-*
|
|
116
|
+
|
|
117
|
+
# Desinstalar del gestor de paquetes
|
|
118
|
+
npm uninstall -g cc-statusline-tui
|
|
119
|
+
# o: cargo uninstall cc-statusline-tui
|
|
120
|
+
# o: brew uninstall cc-statusline
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Solución de problemas
|
|
124
|
+
|
|
125
|
+
| Problema | Solución |
|
|
126
|
+
|----------|----------|
|
|
127
|
+
| "Binary not found" | Ejecuta `npx cc-statusline-tui` de nuevo para volver a descargar |
|
|
128
|
+
| Error "Is a directory" | Verifica que `~/.claude/statusline/bin/cc-statusline` sea un archivo, no un directorio |
|
|
129
|
+
| Crypto no se muestra | Elimina el directorio `/tmp/claude-statusline-crypto-lock` si existe (bloqueo obsoleto) |
|
|
130
|
+
| Los cambios no se ven | Reinicia Claude Code después de guardar la configuración |
|
|
131
|
+
|
|
132
|
+
## Contribuir
|
|
133
|
+
|
|
134
|
+
¿Encontraste un bug? ¿Quieres una feature? [Abre un issue](https://github.com/LokiQ0713/cc-statusline-tui/issues). Los PRs son bienvenidos.
|
|
135
|
+
|
|
136
|
+
## License
|
|
137
|
+
|
|
138
|
+
MIT
|
package/README.ja.md
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# cc-statusline
|
|
2
|
+
|
|
3
|
+
[](https://github.com/LokiQ0713/cc-statusline-tui/actions/workflows/ci.yml)
|
|
4
|
+
[](https://github.com/LokiQ0713/cc-statusline-tui/actions/workflows/release.yml)
|
|
5
|
+
[](https://www.npmjs.com/package/cc-statusline-tui)
|
|
6
|
+
[](https://crates.io/crates/cc-statusline-tui)
|
|
7
|
+
|
|
8
|
+
> Claude Codeのステータスバー、地味すぎない?華やかにしよう。
|
|
9
|
+
|
|
10
|
+
[English](README.md) | [中文](README.zh.md) | [한국어](README.ko.md) | [Español](README.es.md) | [Português](README.pt.md) | [Русский](README.ru.md)
|
|
11
|
+
|
|
12
|
+

|
|
13
|
+
|
|
14
|
+
コマンドひとつ。7言語対応。後悔ゼロ。
|
|
15
|
+
|
|
16
|
+
## インストール
|
|
17
|
+
|
|
18
|
+
お好きな方法でどうぞ:
|
|
19
|
+
|
|
20
|
+
### npm
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npx cc-statusline-tui
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Cargo
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
cargo install cc-statusline-tui
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Homebrew
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
brew tap LokiQ0713/cc-statusline-tui
|
|
36
|
+
brew install cc-statusline
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## 何が起きるの?
|
|
40
|
+
|
|
41
|
+
TUIウィザードが立ち上がります。ポチポチ選ぶだけ。カッコよくなる。以上。
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
1/4 セグメント選択 → 何を表示するか
|
|
45
|
+
2/4 設定 → 見た目の調整(ライブプレビュー付き)
|
|
46
|
+
3/4 並び替え → 表示順を決める
|
|
47
|
+
4/4 確認 → 完了!
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
カスタマイズ?面倒くさい?「デフォルトを使用」を選んでEnter2回。それでOK。誰も責めません。
|
|
51
|
+
|
|
52
|
+
## セグメント
|
|
53
|
+
|
|
54
|
+
| セグメント | 表示例 | 機能 | カスタマイズ |
|
|
55
|
+
|-----------|--------|------|-------------|
|
|
56
|
+
| Model | `🔥 Opus4.6` | 今使ってるモデルを表示 | アイコン (🔥🦊🐢🐰)、色 |
|
|
57
|
+
| Cost | `$0.42` | お財布へのダメージを可視化 | 色 |
|
|
58
|
+
| Usage | `██░░ 25% 1h43m` | 5時間レート制限:バー + % + リセットまでの時間 | バースタイル/文字/長さ、色、更新間隔 |
|
|
59
|
+
| Path | `~/project` | 今いるディレクトリ | 色、最大長 |
|
|
60
|
+
| Git | `main* ↑2↓1` | ブランチ + 未コミット + ahead/behind | 表示項目、色 |
|
|
61
|
+
| Context | `▓▓▓▓░░░ 60% 600K/1M` | コンテキストウィンドウの消費量 | バースタイル/文字/長さ、色 |
|
|
62
|
+
| Crypto | `BTC:$73748` | コーディング中に仮想通貨チェック。なぜって?そこに価格があるから。 | 通貨 (BTC/ETH/BNB/SOL)、色、更新間隔 |
|
|
63
|
+
|
|
64
|
+
## カラースタイル
|
|
65
|
+
|
|
66
|
+
| スタイル | 雰囲気 |
|
|
67
|
+
|---------|--------|
|
|
68
|
+
| **Ultrathink Rainbow** | 一文字ずつ色が変わる。そう、キラキラします。 |
|
|
69
|
+
| **Ultrathink Gradient** | バー全体にスムーズな虹のグラデーション。芸術的。 |
|
|
70
|
+
| **Traffic Light** | 緑 (≤30%) → 黄 (≤60%) → 赤 (>60%)。コンテキストウィンドウが渋滞中。 |
|
|
71
|
+
| Cyan / Green / Blue / Yellow | 堅実な選択 |
|
|
72
|
+
| Magenta / Red / Orange / Pink / Purple / White | 個性を出したいあなたに |
|
|
73
|
+
|
|
74
|
+
## 対応言語
|
|
75
|
+
|
|
76
|
+
English, 中文, 日本語, 한국어, Español, Português, Русский。
|
|
77
|
+
|
|
78
|
+
初回起動時に選択。ステータスバーがあなたの言葉を話します。
|
|
79
|
+
|
|
80
|
+
## 仕組み
|
|
81
|
+
|
|
82
|
+
1. ウィザードが設定を `~/.claude/statusline/config.json` に保存
|
|
83
|
+
2. バイナリが `~/.claude/statusline/bin/` に配置される
|
|
84
|
+
3. `~/.claude/settings.json` が自動更新される
|
|
85
|
+
4. Claude Codeを再起動。新しいステータスバーを堪能。同僚に自慢。
|
|
86
|
+
|
|
87
|
+
再実行すると既存の設定がデフォルトとして読み込まれます。非破壊的。約束します。
|
|
88
|
+
|
|
89
|
+
## 必要なもの
|
|
90
|
+
|
|
91
|
+
- Claude Codeがインストール済み(`~/.claude/` が存在すること)
|
|
92
|
+
- Node.js ≥ 18(`npx` インストール時のみ — 実行時は不要)
|
|
93
|
+
|
|
94
|
+
## セキュリティとプライバシー
|
|
95
|
+
|
|
96
|
+
あなたのデータ、勝手に触りません。安心してください:
|
|
97
|
+
|
|
98
|
+
- **Cryptoセグメント**はBinanceの公開API(`api.binance.com`)にリクエストします — 認証不要、個人データの送信なし
|
|
99
|
+
- **Usageセグメント**はmacOSキーチェーンからOAuthトークン(`Claude Code-credentials`)を読み取り、AnthropicのUsage APIに問い合わせます
|
|
100
|
+
- **npm postinstall**はGitHub Releasesからプラットフォーム対応のバイナリをダウンロードします — それ以外の外部ダウンロードなし
|
|
101
|
+
- すべてのデータは`/tmp/claude-statusline-*`ファイルにローカルキャッシュされます
|
|
102
|
+
- テレメトリなし、アナリティクスなし、他のどこにもデータを送信しません
|
|
103
|
+
- 詳細は[SECURITY.md](SECURITY.md)をご覧ください
|
|
104
|
+
|
|
105
|
+
## アンインストール
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
# 設定とバイナリを削除
|
|
109
|
+
rm -rf ~/.claude/statusline/
|
|
110
|
+
|
|
111
|
+
# Claude Code設定からステータスラインを削除
|
|
112
|
+
# ~/.claude/settings.json を編集して "statusLine" キーを削除
|
|
113
|
+
|
|
114
|
+
# キャッシュを削除
|
|
115
|
+
rm -f /tmp/claude-statusline-*
|
|
116
|
+
|
|
117
|
+
# パッケージマネージャーからアンインストール
|
|
118
|
+
npm uninstall -g cc-statusline-tui
|
|
119
|
+
# または: cargo uninstall cc-statusline-tui
|
|
120
|
+
# または: brew uninstall cc-statusline
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## トラブルシューティング
|
|
124
|
+
|
|
125
|
+
| 問題 | 解決策 |
|
|
126
|
+
|------|--------|
|
|
127
|
+
| "Binary not found" | `npx cc-statusline-tui` を再実行して再ダウンロード |
|
|
128
|
+
| "Is a directory" エラー | `~/.claude/statusline/bin/cc-statusline` がファイルであり、ディレクトリでないことを確認 |
|
|
129
|
+
| 暗号通貨が表示されない | `/tmp/claude-statusline-crypto-lock` ディレクトリがあれば削除(古いロック) |
|
|
130
|
+
| 変更が反映されない | 設定保存後にClaude Codeを再起動 |
|
|
131
|
+
|
|
132
|
+
## コントリビューション
|
|
133
|
+
|
|
134
|
+
バグ発見?新機能のアイデア?[Issueを作成](https://github.com/LokiQ0713/cc-statusline-tui/issues)してください。PRも大歓迎。
|
|
135
|
+
|
|
136
|
+
## License
|
|
137
|
+
|
|
138
|
+
MIT
|
package/README.ko.md
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# cc-statusline
|
|
2
|
+
|
|
3
|
+
[](https://github.com/LokiQ0713/cc-statusline-tui/actions/workflows/ci.yml)
|
|
4
|
+
[](https://github.com/LokiQ0713/cc-statusline-tui/actions/workflows/release.yml)
|
|
5
|
+
[](https://www.npmjs.com/package/cc-statusline-tui)
|
|
6
|
+
[](https://crates.io/crates/cc-statusline-tui)
|
|
7
|
+
|
|
8
|
+
> Claude Code 상태표시줄, 너무 밋밋하지 않나요? 한번 꾸며봅시다.
|
|
9
|
+
|
|
10
|
+
[English](README.md) | [中文](README.zh.md) | [日本語](README.ja.md) | [Español](README.es.md) | [Português](README.pt.md) | [Русский](README.ru.md)
|
|
11
|
+
|
|
12
|
+

|
|
13
|
+
|
|
14
|
+
명령어 하나. 7개 언어. 후회 제로.
|
|
15
|
+
|
|
16
|
+
## 설치
|
|
17
|
+
|
|
18
|
+
취향대로 골라주세요:
|
|
19
|
+
|
|
20
|
+
### npm
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npx cc-statusline-tui
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Cargo
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
cargo install cc-statusline-tui
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Homebrew
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
brew tap LokiQ0713/cc-statusline-tui
|
|
36
|
+
brew install cc-statusline
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## 뭐가 되는 건데?
|
|
40
|
+
|
|
41
|
+
TUI 마법사가 뜹니다. 이것저것 고르면 됩니다. 멋져집니다. 끝.
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
1/4 세그먼트 → 뭘 보여줄지
|
|
45
|
+
2/4 설정 → 어떻게 보일지 (실시간 미리보기, 즉각 반영)
|
|
46
|
+
3/4 순서 정하기 → 어디에 배치할지
|
|
47
|
+
4/4 확인 → 적용!
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
커스터마이즈 귀찮으시다고요? "기본값 사용" 선택하고 Enter 두 번이면 끝. 아무도 뭐라 안 합니다.
|
|
51
|
+
|
|
52
|
+
## 세그먼트
|
|
53
|
+
|
|
54
|
+
| 세그먼트 | 이렇게 보여요 | 하는 일 | 바꿀 수 있는 것 |
|
|
55
|
+
|---------|-------------|--------|---------------|
|
|
56
|
+
| Model | `🔥 Opus4.6` | 지금 쓰고 있는 모델 표시 | 아이콘 (🔥🦊🐢🐰), 색상 |
|
|
57
|
+
| Cost | `$0.42` | 지갑이 얼마나 아픈지 실시간 확인 | 색상 |
|
|
58
|
+
| Usage | `██░░ 25% 1h43m` | 5시간 사용량 제한: 바 + % + 리셋 카운트다운 | 바 스타일/문자/길이, 색상, 갱신주기 |
|
|
59
|
+
| Path | `~/project` | 현재 위치 | 색상, 최대 길이 |
|
|
60
|
+
| Git | `main* ↑2↓1` | 브랜치 + 변경사항 + ahead/behind | 표시 항목, 색상 |
|
|
61
|
+
| Context | `▓▓▓▓░░░ 60% 600K/1M` | 컨텍스트 윈도우 얼마나 먹었는지 | 바 스타일/문자/길이, 색상 |
|
|
62
|
+
| Crypto | `BTC:$73748` | 코딩하다가 코인 시세도 확인. 왜냐고요? 그냥요. | 코인 (BTC/ETH/BNB/SOL), 색상, 갱신주기 |
|
|
63
|
+
|
|
64
|
+
## 색상 스타일
|
|
65
|
+
|
|
66
|
+
| 스타일 | 느낌 |
|
|
67
|
+
|-------|------|
|
|
68
|
+
| **Ultrathink Rainbow** | 글자마다 색이 다름. 네, 반짝반짝합니다. |
|
|
69
|
+
| **Ultrathink Gradient** | 바 전체에 부드러운 무지개 그라데이션. 감동 그 자체. |
|
|
70
|
+
| **Traffic Light** | 초록 (≤30%) → 노랑 (≤60%) → 빨강 (>60%). 컨텍스트 윈도우가 막히고 있어요. |
|
|
71
|
+
| Cyan / Green / Blue / Yellow | 무난한 선택 |
|
|
72
|
+
| Magenta / Red / Orange / Pink / Purple / White | 개성 넘치는 선택 |
|
|
73
|
+
|
|
74
|
+
## 지원 언어
|
|
75
|
+
|
|
76
|
+
English, 中文, 日本語, 한국어, Español, Português, Русский.
|
|
77
|
+
|
|
78
|
+
첫 실행 시 선택. 상태표시줄이 당신의 언어로 말합니다.
|
|
79
|
+
|
|
80
|
+
## 작동 원리
|
|
81
|
+
|
|
82
|
+
1. 마법사가 설정을 `~/.claude/statusline/config.json`에 저장
|
|
83
|
+
2. 바이너리가 `~/.claude/statusline/bin/`에 복사됨
|
|
84
|
+
3. `~/.claude/settings.json`이 자동으로 업데이트됨
|
|
85
|
+
4. Claude Code 재시작. 새 상태표시줄 감상. 동료한테 자랑.
|
|
86
|
+
|
|
87
|
+
다시 실행하면 기존 설정이 기본값으로 불러와집니다. 기존 설정 안 날아갑니다. 약속.
|
|
88
|
+
|
|
89
|
+
## 요구사항
|
|
90
|
+
|
|
91
|
+
- Claude Code 설치됨 (`~/.claude/`가 존재해야 함)
|
|
92
|
+
- Node.js ≥ 18 (`npx` 설치 시에만 필요 — 실행 시에는 불필요)
|
|
93
|
+
|
|
94
|
+
## 보안 및 개인정보
|
|
95
|
+
|
|
96
|
+
여러분의 데이터, 건드리지 않습니다. 안심하세요:
|
|
97
|
+
|
|
98
|
+
- **Crypto 세그먼트**는 Binance 공개 API(`api.binance.com`)에 요청합니다 — 인증 불필요, 개인 데이터 전송 없음
|
|
99
|
+
- **Usage 세그먼트**는 macOS 키체인에서 OAuth 토큰(`Claude Code-credentials`)을 읽어 Anthropic의 Usage API를 조회합니다
|
|
100
|
+
- **npm postinstall**은 GitHub Releases에서 플랫폼별 바이너리를 다운로드합니다 — 그 외 외부 다운로드 없음
|
|
101
|
+
- 모든 데이터는 `/tmp/claude-statusline-*` 파일에 로컬 캐시됩니다
|
|
102
|
+
- 텔레메트리 없음, 분석 없음, 다른 곳으로 데이터 전송 없음
|
|
103
|
+
- 자세한 내용은 [SECURITY.md](SECURITY.md)를 참고하세요
|
|
104
|
+
|
|
105
|
+
## 제거
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
# 설정과 바이너리 삭제
|
|
109
|
+
rm -rf ~/.claude/statusline/
|
|
110
|
+
|
|
111
|
+
# Claude Code 설정에서 상태표시줄 제거
|
|
112
|
+
# ~/.claude/settings.json 을 편집하고 "statusLine" 키를 삭제
|
|
113
|
+
|
|
114
|
+
# 캐시 삭제
|
|
115
|
+
rm -f /tmp/claude-statusline-*
|
|
116
|
+
|
|
117
|
+
# 패키지 매니저에서 제거
|
|
118
|
+
npm uninstall -g cc-statusline-tui
|
|
119
|
+
# 또는: cargo uninstall cc-statusline-tui
|
|
120
|
+
# 또는: brew uninstall cc-statusline
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## 문제 해결
|
|
124
|
+
|
|
125
|
+
| 문제 | 해결 방법 |
|
|
126
|
+
|------|----------|
|
|
127
|
+
| "Binary not found" | `npx cc-statusline-tui`를 다시 실행해서 재다운로드 |
|
|
128
|
+
| "Is a directory" 오류 | `~/.claude/statusline/bin/cc-statusline`가 디렉토리가 아닌 파일인지 확인 |
|
|
129
|
+
| 암호화폐가 안 보임 | `/tmp/claude-statusline-crypto-lock` 디렉토리가 있으면 삭제 (오래된 잠금) |
|
|
130
|
+
| 변경사항이 안 보임 | 설정 저장 후 Claude Code 재시작 |
|
|
131
|
+
|
|
132
|
+
## 기여하기
|
|
133
|
+
|
|
134
|
+
버그 발견? 기능 제안? [이슈를 열어주세요](https://github.com/LokiQ0713/cc-statusline-tui/issues). PR 환영합니다.
|
|
135
|
+
|
|
136
|
+
## License
|
|
137
|
+
|
|
138
|
+
MIT
|
package/README.md
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# cc-statusline
|
|
2
|
+
|
|
3
|
+
[](https://github.com/LokiQ0713/cc-statusline-tui/actions/workflows/ci.yml)
|
|
4
|
+
[](https://github.com/LokiQ0713/cc-statusline-tui/actions/workflows/release.yml)
|
|
5
|
+
[](https://www.npmjs.com/package/cc-statusline-tui)
|
|
6
|
+
[](https://crates.io/crates/cc-statusline-tui)
|
|
7
|
+
|
|
8
|
+
> Your Claude Code statusline is boring. Let's fix that.
|
|
9
|
+
|
|
10
|
+
[中文](README.zh.md) | [日本語](README.ja.md) | [한국어](README.ko.md) | [Español](README.es.md) | [Português](README.pt.md) | [Русский](README.ru.md)
|
|
11
|
+
|
|
12
|
+

|
|
13
|
+
|
|
14
|
+
One command. Seven languages. Zero regrets.
|
|
15
|
+
|
|
16
|
+
## Install
|
|
17
|
+
|
|
18
|
+
Pick your poison:
|
|
19
|
+
|
|
20
|
+
### npm
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npx cc-statusline-tui
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Cargo
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
cargo install cc-statusline-tui
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Homebrew
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
brew tap LokiQ0713/cc-statusline-tui
|
|
36
|
+
brew install cc-statusline
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## What Happens
|
|
40
|
+
|
|
41
|
+
A TUI wizard pops up. You pick stuff. It looks cool. That's it.
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
1/4 Segments → What to show
|
|
45
|
+
2/4 Configure → How it looks (live preview, instant feedback)
|
|
46
|
+
3/4 Reorder → Where things go
|
|
47
|
+
4/4 Confirm → Ship it
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Too lazy to customize? Pick "Use defaults" and press Enter twice. We don't judge.
|
|
51
|
+
|
|
52
|
+
## Segments
|
|
53
|
+
|
|
54
|
+
| Segment | Looks Like | What It Does | You Can Tweak |
|
|
55
|
+
|---------|-----------|--------------|---------------|
|
|
56
|
+
| Model | `🔥 Opus4.6` | Shows which brain you're burning through | Icon (🔥🦊🐢🐰), color |
|
|
57
|
+
| Cost | `$0.42` | Your wallet's pain level | Color |
|
|
58
|
+
| Usage | `██░░ 25% 1h43m` | 5h rate limit: bar + % + reset countdown | Bar style/char/length, color, refresh |
|
|
59
|
+
| Path | `~/project` | Where you are | Color, max length |
|
|
60
|
+
| Git | `main* ↑2↓1` | Branch + dirty flag + ahead/behind | Components, color |
|
|
61
|
+
| Context | `▓▓▓▓░░░ 60% 600K/1M` | How much context window you've eaten | Bar style/char/length, color |
|
|
62
|
+
| Crypto | `BTC:$73748` | Because why not check prices while coding | Coins (BTC/ETH/BNB/SOL), color, refresh |
|
|
63
|
+
|
|
64
|
+
## Color Styles
|
|
65
|
+
|
|
66
|
+
| Style | Vibe |
|
|
67
|
+
|-------|------|
|
|
68
|
+
| **Ultrathink Rainbow** | Every character is a different color. Yes, it shimmers. |
|
|
69
|
+
| **Ultrathink Gradient** | Smooth rainbow across the bar. Chef's kiss. |
|
|
70
|
+
| **Traffic Light** | Green (≤30%) → Yellow (≤60%) → Red (>60%). Your context window is a traffic jam. |
|
|
71
|
+
| Cyan / Green / Blue / Yellow | The sensible choices |
|
|
72
|
+
| Magenta / Red / Orange / Pink / Purple / White | The expressive choices |
|
|
73
|
+
|
|
74
|
+
## Languages
|
|
75
|
+
|
|
76
|
+
English, 中文, 日本語, 한국어, Español, Português, Русский.
|
|
77
|
+
|
|
78
|
+
Selected on first run. Your statusline speaks your language.
|
|
79
|
+
|
|
80
|
+
## How It Works
|
|
81
|
+
|
|
82
|
+
1. Wizard saves config to `~/.claude/statusline/config.json`
|
|
83
|
+
2. Binary goes to `~/.claude/statusline/bin/`
|
|
84
|
+
3. `~/.claude/settings.json` gets updated automatically
|
|
85
|
+
4. Restart Claude Code. Admire your new statusline. Tell your coworkers.
|
|
86
|
+
|
|
87
|
+
Re-running the wizard loads your existing config as defaults. Non-destructive. Promise.
|
|
88
|
+
|
|
89
|
+
## Requirements
|
|
90
|
+
|
|
91
|
+
- Claude Code installed (`~/.claude/` exists)
|
|
92
|
+
- Node.js ≥ 18 (only for `npx` install — not needed at runtime or for `cargo install`)
|
|
93
|
+
|
|
94
|
+
## Security and Privacy
|
|
95
|
+
|
|
96
|
+
- The **crypto segment** makes requests to Binance public API (`api.binance.com`) — no authentication required, no personal data sent
|
|
97
|
+
- The **usage segment** reads an OAuth token from the macOS keychain (`Claude Code-credentials`) to query Anthropic's usage API
|
|
98
|
+
- The **npm postinstall** downloads a platform-specific binary from GitHub Releases — no other external downloads
|
|
99
|
+
- All data is cached locally in `/tmp/claude-statusline-*` files
|
|
100
|
+
- No telemetry, no analytics, no data sent anywhere else
|
|
101
|
+
- For full details see [SECURITY.md](SECURITY.md)
|
|
102
|
+
|
|
103
|
+
## Uninstall
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
# Remove config and binary
|
|
107
|
+
rm -rf ~/.claude/statusline/
|
|
108
|
+
|
|
109
|
+
# Remove statusline from Claude Code settings
|
|
110
|
+
# Edit ~/.claude/settings.json and delete the "statusLine" key
|
|
111
|
+
|
|
112
|
+
# Remove cache
|
|
113
|
+
rm -f /tmp/claude-statusline-*
|
|
114
|
+
|
|
115
|
+
# Uninstall from package manager
|
|
116
|
+
npm uninstall -g cc-statusline-tui
|
|
117
|
+
# or: cargo uninstall cc-statusline-tui
|
|
118
|
+
# or: brew uninstall cc-statusline
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Troubleshooting
|
|
122
|
+
|
|
123
|
+
| Problem | Fix |
|
|
124
|
+
|---------|-----|
|
|
125
|
+
| "Binary not found" | Run `npx cc-statusline-tui` again to re-download |
|
|
126
|
+
| "Is a directory" error | Check that `~/.claude/statusline/bin/cc-statusline` is a file, not a directory |
|
|
127
|
+
| Crypto not showing | Delete `/tmp/claude-statusline-crypto-lock` directory if it exists (stale lock) |
|
|
128
|
+
| Changes not visible | Restart Claude Code after saving configuration |
|
|
129
|
+
|
|
130
|
+
## Contributing
|
|
131
|
+
|
|
132
|
+
Found a bug? Want a feature? [Open an issue](https://github.com/LokiQ0713/cc-statusline-tui/issues). PRs welcome.
|
|
133
|
+
|
|
134
|
+
## License
|
|
135
|
+
|
|
136
|
+
MIT
|
package/README.pt.md
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# cc-statusline
|
|
2
|
+
|
|
3
|
+
[](https://github.com/LokiQ0713/cc-statusline-tui/actions/workflows/ci.yml)
|
|
4
|
+
[](https://github.com/LokiQ0713/cc-statusline-tui/actions/workflows/release.yml)
|
|
5
|
+
[](https://www.npmjs.com/package/cc-statusline-tui)
|
|
6
|
+
[](https://crates.io/crates/cc-statusline-tui)
|
|
7
|
+
|
|
8
|
+
> A barra de status do seu Claude Code tá sem graça. Bora dar um trato nela.
|
|
9
|
+
|
|
10
|
+
[English](README.md) | [中文](README.zh.md) | [日本語](README.ja.md) | [한국어](README.ko.md) | [Español](README.es.md) | [Русский](README.ru.md)
|
|
11
|
+
|
|
12
|
+

|
|
13
|
+
|
|
14
|
+
Um comando. Sete idiomas. Zero arrependimentos.
|
|
15
|
+
|
|
16
|
+
## Instalação
|
|
17
|
+
|
|
18
|
+
Escolhe teu método:
|
|
19
|
+
|
|
20
|
+
### npm
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npx cc-statusline-tui
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Cargo
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
cargo install cc-statusline-tui
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Homebrew
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
brew tap LokiQ0713/cc-statusline-tui
|
|
36
|
+
brew install cc-statusline
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## O que acontece?
|
|
40
|
+
|
|
41
|
+
Um wizard TUI aparece. Você escolhe umas coisas. Fica bonito. É isso.
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
1/4 Segmentos → O que mostrar
|
|
45
|
+
2/4 Configurar → Como vai ficar (preview ao vivo, feedback instantâneo)
|
|
46
|
+
3/4 Reordenar → Onde cada coisa fica
|
|
47
|
+
4/4 Confirmar → Manda ver!
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Tá com preguiça de customizar? Escolhe "Usar padrões" e aperta Enter duas vezes. A gente não julga.
|
|
51
|
+
|
|
52
|
+
## Segmentos
|
|
53
|
+
|
|
54
|
+
| Segmento | Aparência | O que faz | Dá pra ajustar |
|
|
55
|
+
|----------|----------|-----------|----------------|
|
|
56
|
+
| Model | `🔥 Opus4.6` | Mostra qual cérebro você tá usando | Ícone (🔥🦊🐢🐰), cor |
|
|
57
|
+
| Cost | `$0.42` | O nível de sofrimento da sua carteira | Cor |
|
|
58
|
+
| Usage | `██░░ 25% 1h43m` | Limite de 5h: barra + % + contagem regressiva | Estilo/caractere/tamanho da barra, cor, atualização |
|
|
59
|
+
| Path | `~/project` | Onde você tá | Cor, tamanho máximo |
|
|
60
|
+
| Git | `main* ↑2↓1` | Branch + alterações + ahead/behind | Componentes, cor |
|
|
61
|
+
| Context | `▓▓▓▓░░░ 60% 600K/1M` | Quanto da janela de contexto você já comeu | Estilo/caractere/tamanho da barra, cor |
|
|
62
|
+
| Crypto | `BTC:$73748` | Porque por que não checar preços enquanto programa? | Moedas (BTC/ETH/BNB/SOL), cor, atualização |
|
|
63
|
+
|
|
64
|
+
## Estilos de cor
|
|
65
|
+
|
|
66
|
+
| Estilo | A vibe |
|
|
67
|
+
|--------|--------|
|
|
68
|
+
| **Ultrathink Rainbow** | Cada caractere é de uma cor diferente. Sim, ele brilha. |
|
|
69
|
+
| **Ultrathink Gradient** | Arco-íris suave ao longo da barra. De cair o queixo. |
|
|
70
|
+
| **Traffic Light** | Verde (≤30%) → Amarelo (≤60%) → Vermelho (>60%). Sua janela de contexto virou um congestionamento. |
|
|
71
|
+
| Cyan / Green / Blue / Yellow | As escolhas sensatas |
|
|
72
|
+
| Magenta / Red / Orange / Pink / Purple / White | As escolhas expressivas |
|
|
73
|
+
|
|
74
|
+
## Idiomas
|
|
75
|
+
|
|
76
|
+
English, 中文, 日本語, 한국어, Español, Português, Русский.
|
|
77
|
+
|
|
78
|
+
Selecionado na primeira execução. Sua barra de status fala a sua língua.
|
|
79
|
+
|
|
80
|
+
## Como funciona
|
|
81
|
+
|
|
82
|
+
1. O wizard salva a configuração em `~/.claude/statusline/config.json`
|
|
83
|
+
2. O binário vai pra `~/.claude/statusline/bin/`
|
|
84
|
+
3. `~/.claude/settings.json` é atualizado automaticamente
|
|
85
|
+
4. Reinicie o Claude Code. Admire sua nova barra de status. Conte pros colegas.
|
|
86
|
+
|
|
87
|
+
Rodar de novo carrega sua configuração existente como padrão. Não destrói nada. Promessa.
|
|
88
|
+
|
|
89
|
+
## Requisitos
|
|
90
|
+
|
|
91
|
+
- Claude Code instalado (`~/.claude/` precisa existir)
|
|
92
|
+
- Node.js ≥ 18 (só pra instalar via `npx` — não precisa no runtime)
|
|
93
|
+
|
|
94
|
+
## Segurança e Privacidade
|
|
95
|
+
|
|
96
|
+
Seus dados a gente não mexe. Pode ficar tranquilo:
|
|
97
|
+
|
|
98
|
+
- O **segmento de crypto** faz requisições para a API pública da Binance (`api.binance.com`) — sem autenticação, sem dados pessoais enviados
|
|
99
|
+
- O **segmento de usage** lê um token OAuth do chaveiro do macOS (`Claude Code-credentials`) para consultar a API de uso da Anthropic
|
|
100
|
+
- O **npm postinstall** baixa um binário específico para sua plataforma do GitHub Releases — nenhum outro download externo
|
|
101
|
+
- Todos os dados são cacheados localmente em arquivos `/tmp/claude-statusline-*`
|
|
102
|
+
- Sem telemetria, sem analytics, sem envio de dados pra nenhum outro lugar
|
|
103
|
+
- Para mais detalhes veja [SECURITY.md](SECURITY.md)
|
|
104
|
+
|
|
105
|
+
## Desinstalar
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
# Remover configuração e binário
|
|
109
|
+
rm -rf ~/.claude/statusline/
|
|
110
|
+
|
|
111
|
+
# Remover a statusline das configurações do Claude Code
|
|
112
|
+
# Edite ~/.claude/settings.json e delete a chave "statusLine"
|
|
113
|
+
|
|
114
|
+
# Remover cache
|
|
115
|
+
rm -f /tmp/claude-statusline-*
|
|
116
|
+
|
|
117
|
+
# Desinstalar do gerenciador de pacotes
|
|
118
|
+
npm uninstall -g cc-statusline-tui
|
|
119
|
+
# ou: cargo uninstall cc-statusline-tui
|
|
120
|
+
# ou: brew uninstall cc-statusline
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Solução de problemas
|
|
124
|
+
|
|
125
|
+
| Problema | Solução |
|
|
126
|
+
|----------|---------|
|
|
127
|
+
| "Binary not found" | Rode `npx cc-statusline-tui` de novo pra baixar novamente |
|
|
128
|
+
| Erro "Is a directory" | Verifique que `~/.claude/statusline/bin/cc-statusline` é um arquivo, não um diretório |
|
|
129
|
+
| Crypto não aparece | Delete o diretório `/tmp/claude-statusline-crypto-lock` se existir (lock travado) |
|
|
130
|
+
| Mudanças não aparecem | Reinicie o Claude Code depois de salvar a configuração |
|
|
131
|
+
|
|
132
|
+
## Contribuindo
|
|
133
|
+
|
|
134
|
+
Achou um bug? Quer uma feature? [Abra uma issue](https://github.com/LokiQ0713/cc-statusline-tui/issues). PRs são bem-vindos.
|
|
135
|
+
|
|
136
|
+
## License
|
|
137
|
+
|
|
138
|
+
MIT
|
package/README.ru.md
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# cc-statusline
|
|
2
|
+
|
|
3
|
+
[](https://github.com/LokiQ0713/cc-statusline-tui/actions/workflows/ci.yml)
|
|
4
|
+
[](https://github.com/LokiQ0713/cc-statusline-tui/actions/workflows/release.yml)
|
|
5
|
+
[](https://www.npmjs.com/package/cc-statusline-tui)
|
|
6
|
+
[](https://crates.io/crates/cc-statusline-tui)
|
|
7
|
+
|
|
8
|
+
> Статусная строка Claude Code скучная. Давайте это исправим.
|
|
9
|
+
|
|
10
|
+
[English](README.md) | [中文](README.zh.md) | [日本語](README.ja.md) | [한국어](README.ko.md) | [Español](README.es.md) | [Português](README.pt.md)
|
|
11
|
+
|
|
12
|
+

|
|
13
|
+
|
|
14
|
+
Одна команда. Семь языков. Ноль сожалений.
|
|
15
|
+
|
|
16
|
+
## Установка
|
|
17
|
+
|
|
18
|
+
Выбирай на вкус:
|
|
19
|
+
|
|
20
|
+
### npm
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npx cc-statusline-tui
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Cargo
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
cargo install cc-statusline-tui
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Homebrew
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
brew tap LokiQ0713/cc-statusline-tui
|
|
36
|
+
brew install cc-statusline
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Что происходит?
|
|
40
|
+
|
|
41
|
+
Появляется TUI-мастер. Выбираешь штуки. Получается красиво. Всё.
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
1/4 Сегменты → Что показывать
|
|
45
|
+
2/4 Настройка → Как это выглядит (живой предпросмотр, мгновенный отклик)
|
|
46
|
+
3/4 Порядок → Что куда поставить
|
|
47
|
+
4/4 Подтверждение → Поехали!
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Лень настраивать? Выбери «По умолчанию» и нажми Enter дважды. Мы не осуждаем.
|
|
51
|
+
|
|
52
|
+
## Сегменты
|
|
53
|
+
|
|
54
|
+
| Сегмент | Выглядит так | Что делает | Можно настроить |
|
|
55
|
+
|---------|-------------|------------|----------------|
|
|
56
|
+
| Model | `🔥 Opus4.6` | Показывает, какой мозг ты сейчас жжёшь | Иконка (🔥🦊🐢🐰), цвет |
|
|
57
|
+
| Cost | `$0.42` | Уровень боли твоего кошелька | Цвет |
|
|
58
|
+
| Usage | `██░░ 25% 1h43m` | Лимит 5ч: полоска + % + обратный отсчёт | Стиль/символ/длина полоски, цвет, обновление |
|
|
59
|
+
| Path | `~/project` | Где ты находишься | Цвет, макс. длина |
|
|
60
|
+
| Git | `main* ↑2↓1` | Ветка + незакоммиченное + ahead/behind | Компоненты, цвет |
|
|
61
|
+
| Context | `▓▓▓▓░░░ 60% 600K/1M` | Сколько контекстного окна ты уже съел | Стиль/символ/длина полоски, цвет |
|
|
62
|
+
| Crypto | `BTC:$73748` | А почему бы не глянуть курс, пока кодишь? | Монеты (BTC/ETH/BNB/SOL), цвет, обновление |
|
|
63
|
+
|
|
64
|
+
## Цветовые стили
|
|
65
|
+
|
|
66
|
+
| Стиль | Атмосфера |
|
|
67
|
+
|-------|-----------|
|
|
68
|
+
| **Ultrathink Rainbow** | Каждый символ — свой цвет. Да, оно переливается. |
|
|
69
|
+
| **Ultrathink Gradient** | Плавная радуга по всей полоске. Шедевр. |
|
|
70
|
+
| **Traffic Light** | Зелёный (≤30%) → Жёлтый (≤60%) → Красный (>60%). Твоё контекстное окно — это пробка. |
|
|
71
|
+
| Cyan / Green / Blue / Yellow | Разумный выбор |
|
|
72
|
+
| Magenta / Red / Orange / Pink / Purple / White | Для тех, кто хочет самовыражения |
|
|
73
|
+
|
|
74
|
+
## Языки
|
|
75
|
+
|
|
76
|
+
English, 中文, 日本語, 한국어, Español, Português, Русский.
|
|
77
|
+
|
|
78
|
+
Выбирается при первом запуске. Статусная строка говорит на твоём языке.
|
|
79
|
+
|
|
80
|
+
## Как это работает
|
|
81
|
+
|
|
82
|
+
1. Мастер сохраняет конфиг в `~/.claude/statusline/config.json`
|
|
83
|
+
2. Бинарник копируется в `~/.claude/statusline/bin/`
|
|
84
|
+
3. `~/.claude/settings.json` обновляется автоматически
|
|
85
|
+
4. Перезапусти Claude Code. Полюбуйся новой строкой. Похвастайся коллегам.
|
|
86
|
+
|
|
87
|
+
При повторном запуске загружается существующий конфиг как значения по умолчанию. Ничего не ломает. Обещаем.
|
|
88
|
+
|
|
89
|
+
## Требования
|
|
90
|
+
|
|
91
|
+
- Установлен Claude Code (существует `~/.claude/`)
|
|
92
|
+
- Node.js ≥ 18 (только для установки через `npx` — в рантайме не нужен)
|
|
93
|
+
|
|
94
|
+
## Безопасность и конфиденциальность
|
|
95
|
+
|
|
96
|
+
Твои данные мы не трогаем. Честно:
|
|
97
|
+
|
|
98
|
+
- **Crypto-сегмент** обращается к публичному API Binance (`api.binance.com`) — без аутентификации, без отправки личных данных
|
|
99
|
+
- **Usage-сегмент** читает OAuth-токен из связки ключей macOS (`Claude Code-credentials`) для запроса к API использования Anthropic
|
|
100
|
+
- **npm postinstall** скачивает бинарник для твоей платформы из GitHub Releases — больше ничего не скачивает
|
|
101
|
+
- Все данные кэшируются локально в файлах `/tmp/claude-statusline-*`
|
|
102
|
+
- Никакой телеметрии, никакой аналитики, данные никуда больше не отправляются
|
|
103
|
+
- Подробности в [SECURITY.md](SECURITY.md)
|
|
104
|
+
|
|
105
|
+
## Удаление
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
# Удалить конфиг и бинарник
|
|
109
|
+
rm -rf ~/.claude/statusline/
|
|
110
|
+
|
|
111
|
+
# Удалить статусную строку из настроек Claude Code
|
|
112
|
+
# Отредактируй ~/.claude/settings.json и удали ключ "statusLine"
|
|
113
|
+
|
|
114
|
+
# Удалить кэш
|
|
115
|
+
rm -f /tmp/claude-statusline-*
|
|
116
|
+
|
|
117
|
+
# Удалить через пакетный менеджер
|
|
118
|
+
npm uninstall -g cc-statusline-tui
|
|
119
|
+
# или: cargo uninstall cc-statusline-tui
|
|
120
|
+
# или: brew uninstall cc-statusline
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Решение проблем
|
|
124
|
+
|
|
125
|
+
| Проблема | Решение |
|
|
126
|
+
|----------|---------|
|
|
127
|
+
| "Binary not found" | Запусти `npx cc-statusline-tui` ещё раз для повторной загрузки |
|
|
128
|
+
| Ошибка "Is a directory" | Проверь, что `~/.claude/statusline/bin/cc-statusline` — это файл, а не директория |
|
|
129
|
+
| Crypto не отображается | Удали директорию `/tmp/claude-statusline-crypto-lock`, если она существует (устаревшая блокировка) |
|
|
130
|
+
| Изменения не видны | Перезапусти Claude Code после сохранения настроек |
|
|
131
|
+
|
|
132
|
+
## Участие в проекте
|
|
133
|
+
|
|
134
|
+
Нашёл баг? Хочешь фичу? [Создай issue](https://github.com/LokiQ0713/cc-statusline-tui/issues). PR приветствуются.
|
|
135
|
+
|
|
136
|
+
## License
|
|
137
|
+
|
|
138
|
+
MIT
|
package/README.zh.md
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# cc-statusline
|
|
2
|
+
|
|
3
|
+
[](https://github.com/LokiQ0713/cc-statusline-tui/actions/workflows/ci.yml)
|
|
4
|
+
[](https://github.com/LokiQ0713/cc-statusline-tui/actions/workflows/release.yml)
|
|
5
|
+
[](https://www.npmjs.com/package/cc-statusline-tui)
|
|
6
|
+
[](https://crates.io/crates/cc-statusline-tui)
|
|
7
|
+
|
|
8
|
+
> Claude Code 的状态栏太素了?给它整点花活。
|
|
9
|
+
|
|
10
|
+
[English](README.md) | [日本語](README.ja.md) | [한국어](README.ko.md) | [Español](README.es.md) | [Português](README.pt.md) | [Русский](README.ru.md)
|
|
11
|
+
|
|
12
|
+

|
|
13
|
+
|
|
14
|
+
一行命令,七种语言,零后悔。
|
|
15
|
+
|
|
16
|
+
## 安装
|
|
17
|
+
|
|
18
|
+
选一个你喜欢的:
|
|
19
|
+
|
|
20
|
+
### npm
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npx cc-statusline-tui
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Cargo
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
cargo install cc-statusline-tui
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Homebrew
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
brew tap LokiQ0713/cc-statusline-tui
|
|
36
|
+
brew install cc-statusline
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## 它干了啥
|
|
40
|
+
|
|
41
|
+
弹出一个 TUI 向导,你选一选,状态栏就好看了。就这么简单。
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
1/4 选择段落 → 想看啥
|
|
45
|
+
2/4 配置段落 → 想咋看(实时预览,所见即所得)
|
|
46
|
+
3/4 排列顺序 → 放哪里
|
|
47
|
+
4/4 确认 → 搞定收工
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
懒得折腾?选「使用默认配置」然后按两下回车。我们不评判。
|
|
51
|
+
|
|
52
|
+
## 能配什么
|
|
53
|
+
|
|
54
|
+
| 段落 | 长啥样 | 干啥的 | 可以调 |
|
|
55
|
+
|------|--------|--------|--------|
|
|
56
|
+
| 模型 | `🔥 Opus4.6` | 你正在烧哪个大脑 | 图标(🔥🦊🐢🐰)、颜色 |
|
|
57
|
+
| 费用 | `$0.42` | 你钱包的痛苦指数 | 颜色 |
|
|
58
|
+
| 5h限额 | `██░░ 25% 1h43m` | 限额进度条 + 百分比 + 重置倒计时 | 进度条样式/字符/长度、颜色、刷新间隔 |
|
|
59
|
+
| 目录 | `~/project` | 你在哪 | 颜色、最大长度 |
|
|
60
|
+
| Git | `main* ↑2↓1` | 分支 + 脏状态 + 远程差异 | 子组件、颜色 |
|
|
61
|
+
| 上下文 | `▓▓▓▓░░░ 60% 600K/1M` | 上下文窗口吃了多少 | 进度条样式/字符/长度、颜色 |
|
|
62
|
+
| 加密货币 | `BTC:$73748` | 写代码的时候顺便看看币价,懂的都懂 | 币种(BTC/ETH/BNB/SOL)、颜色、刷新 |
|
|
63
|
+
|
|
64
|
+
## 颜色风格
|
|
65
|
+
|
|
66
|
+
| 风格 | 氛围 |
|
|
67
|
+
|------|------|
|
|
68
|
+
| **Ultrathink 彩虹** | 每个字符颜色都不一样,还会闪。是的,就是这么骚。 |
|
|
69
|
+
| **Ultrathink 渐变** | 进度条上的平滑彩虹渐变。厨师之吻。 |
|
|
70
|
+
| **红绿灯** | 绿(≤30%)→ 黄(≤60%)→ 红(>60%)。你的上下文窗口变成了交通灯。 |
|
|
71
|
+
| Cyan / Green / Blue / Yellow | 稳重之选 |
|
|
72
|
+
| Magenta / Red / Orange / Pink / Purple / White | 张扬之选 |
|
|
73
|
+
|
|
74
|
+
## 多语言
|
|
75
|
+
|
|
76
|
+
English、中文、日本語、한국어、Español、Português、Русский。
|
|
77
|
+
|
|
78
|
+
首次运行时选择,状态栏说你的语言。
|
|
79
|
+
|
|
80
|
+
## 工作原理
|
|
81
|
+
|
|
82
|
+
1. 向导保存配置到 `~/.claude/statusline/config.json`
|
|
83
|
+
2. 二进制文件放到 `~/.claude/statusline/bin/`
|
|
84
|
+
3. 自动更新 `~/.claude/settings.json`
|
|
85
|
+
4. 重启 Claude Code,欣赏你的新状态栏,跟同事炫耀一下
|
|
86
|
+
|
|
87
|
+
再次运行会读取已有配置作为默认值。不会覆盖你的心血。放心。
|
|
88
|
+
|
|
89
|
+
## 前提
|
|
90
|
+
|
|
91
|
+
- Claude Code 已安装(`~/.claude/` 存在)
|
|
92
|
+
- Node.js ≥ 18(仅 `npx` 安装时需要,运行时不需要)
|
|
93
|
+
|
|
94
|
+
## 安全与隐私
|
|
95
|
+
|
|
96
|
+
你的数据我们不碰,放一百个心:
|
|
97
|
+
|
|
98
|
+
- **加密货币段落**请求的是 Binance 公开 API(`api.binance.com`)——不需要登录,不发送任何个人数据
|
|
99
|
+
- **5h限额段落**从 macOS 钥匙串读取 OAuth 令牌(`Claude Code-credentials`)来查询 Anthropic 的使用量 API
|
|
100
|
+
- **npm postinstall** 从 GitHub Releases 下载平台对应的二进制文件——除此之外不会下载任何东西
|
|
101
|
+
- 所有数据缓存在本地 `/tmp/claude-statusline-*` 文件里
|
|
102
|
+
- 没有遥测,没有分析,不往任何地方发数据
|
|
103
|
+
- 详情请看 [SECURITY.md](SECURITY.md)
|
|
104
|
+
|
|
105
|
+
## 卸载
|
|
106
|
+
|
|
107
|
+
不想用了?干干净净帮你删:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
# 删除配置和二进制文件
|
|
111
|
+
rm -rf ~/.claude/statusline/
|
|
112
|
+
|
|
113
|
+
# 从 Claude Code 设置中移除状态栏
|
|
114
|
+
# 编辑 ~/.claude/settings.json,删掉 "statusLine" 那一行
|
|
115
|
+
|
|
116
|
+
# 清理缓存
|
|
117
|
+
rm -f /tmp/claude-statusline-*
|
|
118
|
+
|
|
119
|
+
# 从包管理器卸载
|
|
120
|
+
npm uninstall -g cc-statusline-tui
|
|
121
|
+
# 或者:cargo uninstall cc-statusline-tui
|
|
122
|
+
# 或者:brew uninstall cc-statusline
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## 常见问题
|
|
126
|
+
|
|
127
|
+
| 问题 | 解决办法 |
|
|
128
|
+
|------|---------|
|
|
129
|
+
| "Binary not found" | 重新跑一遍 `npx cc-statusline-tui` 重新下载 |
|
|
130
|
+
| "Is a directory" 错误 | 检查 `~/.claude/statusline/bin/cc-statusline` 是文件不是目录 |
|
|
131
|
+
| 加密货币不显示 | 删掉 `/tmp/claude-statusline-crypto-lock` 目录(可能是过期的锁) |
|
|
132
|
+
| 改了配置没生效 | 保存后重启 Claude Code |
|
|
133
|
+
|
|
134
|
+
## 贡献
|
|
135
|
+
|
|
136
|
+
发现 bug?想要新功能?[提 Issue](https://github.com/LokiQ0713/cc-statusline-tui/issues)。PR 欢迎。
|
|
137
|
+
|
|
138
|
+
## 许可
|
|
139
|
+
|
|
140
|
+
MIT
|
package/cli.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const { execFileSync } = require('child_process');
|
|
3
|
+
const { join } = require('path');
|
|
4
|
+
const { homedir } = require('os');
|
|
5
|
+
const { existsSync } = require('fs');
|
|
6
|
+
|
|
7
|
+
const bin = join(homedir(), '.claude', 'statusline', 'bin', 'cc-statusline');
|
|
8
|
+
|
|
9
|
+
if (!existsSync(bin)) {
|
|
10
|
+
console.error('cc-statusline binary not found at', bin);
|
|
11
|
+
console.error('Try reinstalling: npm install -g cc-statusline-tui');
|
|
12
|
+
process.exit(1);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
try {
|
|
16
|
+
execFileSync(bin, process.argv.slice(2), { stdio: 'inherit' });
|
|
17
|
+
} catch (e) {
|
|
18
|
+
if (e.status) process.exit(e.status);
|
|
19
|
+
process.exit(1);
|
|
20
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "cc-statusline-tui",
|
|
3
|
+
"version": "2.0.8",
|
|
4
|
+
"description": "Interactive CLI tool to configure Claude Code statusline",
|
|
5
|
+
"bin": {
|
|
6
|
+
"cc-statusline": "./cli.js"
|
|
7
|
+
},
|
|
8
|
+
"scripts": {
|
|
9
|
+
"postinstall": "node postinstall.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"cli.js",
|
|
13
|
+
"postinstall.js"
|
|
14
|
+
],
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "https://github.com/LokiQ0713/cc-statusline-tui.git"
|
|
18
|
+
},
|
|
19
|
+
"homepage": "https://github.com/LokiQ0713/cc-statusline-tui",
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/LokiQ0713/cc-statusline-tui/issues"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"cli",
|
|
25
|
+
"statusline",
|
|
26
|
+
"claude-code",
|
|
27
|
+
"terminal",
|
|
28
|
+
"configuration",
|
|
29
|
+
"tui",
|
|
30
|
+
"rust"
|
|
31
|
+
],
|
|
32
|
+
"author": "LokiQ0713",
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"os": [
|
|
35
|
+
"darwin",
|
|
36
|
+
"linux"
|
|
37
|
+
],
|
|
38
|
+
"cpu": [
|
|
39
|
+
"arm64",
|
|
40
|
+
"x64"
|
|
41
|
+
],
|
|
42
|
+
"engines": {
|
|
43
|
+
"node": ">=18"
|
|
44
|
+
}
|
|
45
|
+
}
|
package/postinstall.js
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const https = require('https');
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const os = require('os');
|
|
6
|
+
const { execSync } = require('child_process');
|
|
7
|
+
|
|
8
|
+
const REPO = 'LokiQ0713/cc-statusline-tui';
|
|
9
|
+
const BIN_NAME = 'cc-statusline';
|
|
10
|
+
const VERSION = require('./package.json').version;
|
|
11
|
+
|
|
12
|
+
const TARGETS = {
|
|
13
|
+
'darwin-arm64': 'aarch64-apple-darwin',
|
|
14
|
+
'darwin-x64': 'x86_64-apple-darwin',
|
|
15
|
+
'linux-x64': 'x86_64-unknown-linux-musl',
|
|
16
|
+
'linux-arm64': 'aarch64-unknown-linux-musl',
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
function main() {
|
|
20
|
+
const platform = process.platform;
|
|
21
|
+
const arch = process.arch;
|
|
22
|
+
const key = `${platform}-${arch}`;
|
|
23
|
+
const target = TARGETS[key];
|
|
24
|
+
|
|
25
|
+
if (!target) {
|
|
26
|
+
console.log(`[cc-statusline] Unsupported platform: ${platform}-${arch}`);
|
|
27
|
+
console.log('Supported platforms: darwin-arm64, darwin-x64, linux-arm64, linux-x64');
|
|
28
|
+
console.log('You can build from source: https://github.com/' + REPO);
|
|
29
|
+
process.exit(0); // exit gracefully, don't fail install
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const asset = `cc-statusline-${target}.tar.gz`;
|
|
33
|
+
const url = `https://github.com/${REPO}/releases/download/v${VERSION}/${asset}`;
|
|
34
|
+
|
|
35
|
+
const binDir = path.join(os.homedir(), '.claude', 'statusline', 'bin');
|
|
36
|
+
const binPath = path.join(binDir, BIN_NAME);
|
|
37
|
+
const tmpDir = path.join(os.tmpdir(), `cc-statusline-${Date.now()}`);
|
|
38
|
+
const tarPath = path.join(tmpDir, asset);
|
|
39
|
+
|
|
40
|
+
console.log(`[cc-statusline] Downloading binary for ${platform}-${arch}...`);
|
|
41
|
+
console.log(`[cc-statusline] URL: ${url}`);
|
|
42
|
+
|
|
43
|
+
// Create directories
|
|
44
|
+
fs.mkdirSync(tmpDir, { recursive: true });
|
|
45
|
+
fs.mkdirSync(binDir, { recursive: true });
|
|
46
|
+
|
|
47
|
+
download(url, tarPath, 0)
|
|
48
|
+
.then(() => {
|
|
49
|
+
// Extract tar.gz
|
|
50
|
+
console.log('[cc-statusline] Extracting...');
|
|
51
|
+
execSync(`tar xzf "${tarPath}" -C "${tmpDir}"`);
|
|
52
|
+
|
|
53
|
+
// Find the binary in extracted files
|
|
54
|
+
const extractedBin = findBinary(tmpDir);
|
|
55
|
+
if (!extractedBin) {
|
|
56
|
+
throw new Error('Binary not found in archive');
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Copy binary to destination
|
|
60
|
+
fs.copyFileSync(extractedBin, binPath);
|
|
61
|
+
fs.chmodSync(binPath, 0o755);
|
|
62
|
+
|
|
63
|
+
console.log(`[cc-statusline] Installed to ${binPath}`);
|
|
64
|
+
|
|
65
|
+
// Cleanup
|
|
66
|
+
fs.rmSync(tmpDir, { recursive: true, force: true });
|
|
67
|
+
})
|
|
68
|
+
.catch((err) => {
|
|
69
|
+
console.error('[cc-statusline] Failed to install binary:', err.message);
|
|
70
|
+
console.error('[cc-statusline] Tip: Copy this error to AI for analysis');
|
|
71
|
+
console.error('[cc-statusline] See https://github.com/' + REPO + '#troubleshooting');
|
|
72
|
+
// Cleanup on error
|
|
73
|
+
try {
|
|
74
|
+
fs.rmSync(tmpDir, { recursive: true, force: true });
|
|
75
|
+
} catch (_) {
|
|
76
|
+
// ignore cleanup errors
|
|
77
|
+
}
|
|
78
|
+
process.exit(1);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Find the binary in the extracted directory.
|
|
84
|
+
* The binary may be at the top level or inside a subdirectory.
|
|
85
|
+
*/
|
|
86
|
+
function findBinary(dir) {
|
|
87
|
+
// Check top level first
|
|
88
|
+
const direct = path.join(dir, BIN_NAME);
|
|
89
|
+
if (fs.existsSync(direct)) return direct;
|
|
90
|
+
|
|
91
|
+
// Check subdirectories (e.g., tar may extract into a folder)
|
|
92
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
93
|
+
for (const entry of entries) {
|
|
94
|
+
if (entry.isDirectory()) {
|
|
95
|
+
const nested = path.join(dir, entry.name, BIN_NAME);
|
|
96
|
+
if (fs.existsSync(nested)) return nested;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Download a file from a URL, following redirects (up to 5).
|
|
105
|
+
* Uses Node.js built-in https module.
|
|
106
|
+
*/
|
|
107
|
+
function download(url, dest, redirectCount) {
|
|
108
|
+
if (redirectCount > 5) {
|
|
109
|
+
return Promise.reject(new Error('Too many redirects'));
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return new Promise((resolve, reject) => {
|
|
113
|
+
const proto = url.startsWith('https') ? https : require('http');
|
|
114
|
+
proto
|
|
115
|
+
.get(url, { headers: { 'User-Agent': 'cc-statusline-npm' } }, (res) => {
|
|
116
|
+
// Handle redirects (301, 302, 303, 307, 308)
|
|
117
|
+
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
118
|
+
res.resume(); // consume response to free memory
|
|
119
|
+
return download(res.headers.location, dest, redirectCount + 1).then(resolve, reject);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (res.statusCode !== 200) {
|
|
123
|
+
res.resume();
|
|
124
|
+
return reject(new Error(`Download failed: HTTP ${res.statusCode}`));
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const file = fs.createWriteStream(dest);
|
|
128
|
+
res.pipe(file);
|
|
129
|
+
file.on('finish', () => {
|
|
130
|
+
file.close(resolve);
|
|
131
|
+
});
|
|
132
|
+
file.on('error', (err) => {
|
|
133
|
+
fs.unlink(dest, () => {}); // cleanup partial file
|
|
134
|
+
reject(err);
|
|
135
|
+
});
|
|
136
|
+
})
|
|
137
|
+
.on('error', reject);
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
main();
|