@babarot/c-c-statusline 0.2.2 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +159 -39
  2. package/bin/install.js +31 -6
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,78 +1,169 @@
1
1
  # c-c-statusline
2
2
 
3
- A Deno-powered status line for [Claude Code](https://docs.anthropic.com/en/docs/claude-code) CLI.
3
+
4
+ [![Test](https://github.com/babarot/c-c-statusline/actions/workflows/test.yml/badge.svg)](https://github.com/babarot/c-c-statusline/actions/workflows/test.yml)
5
+
6
+ A Deno-powered status line for Claude Code CLI.
4
7
 
5
8
  Shows model info, context usage, rate limits, git status, session duration, and more — right in your terminal.
6
9
 
7
- ## Install
10
+ ![screenshot](docs/demo-r.png)
8
11
 
9
- ### Binary (recommended)
12
+ ## Install
10
13
 
11
14
  Downloads a precompiled binary from GitHub Releases. No runtime dependencies needed.
12
15
 
13
16
  ```bash
14
- # Deno
15
- deno run -A https://raw.githubusercontent.com/babarot/c-c-statusline/main/bin/install.ts
17
+ # curl
18
+ curl -fsSL https://raw.githubusercontent.com/babarot/c-c-statusline/main/bin/install.sh | bash
16
19
 
17
20
  # npx
18
21
  npx @babarot/c-c-statusline
22
+
23
+ # Deno
24
+ deno run -A https://raw.githubusercontent.com/babarot/c-c-statusline/main/bin/install.ts
19
25
  ```
20
26
 
21
- ### Options
27
+ ## Configure
22
28
 
23
- Pass options during install to customize the statusline:
29
+ ### Config file (recommended)
30
+
31
+ Generate `~/.claude/statusline.yaml` with defaults:
24
32
 
25
33
  ```bash
26
- deno run -A https://raw.githubusercontent.com/babarot/c-c-statusline/main/bin/install.ts \
27
- --bar-style block --path-style short --theme tokyo-night
34
+ # After install
35
+ ~/.claude/c-c-statusline --init-config
36
+
37
+ # Or during install
38
+ curl -fsSL https://raw.githubusercontent.com/babarot/c-c-statusline/main/bin/install.sh \
39
+ | bash -s -- --init-config
40
+ ```
41
+
42
+ Then edit to your liking:
43
+
44
+ ```yaml
45
+ # ~/.claude/statusline.yaml
46
+ options:
47
+ bar-style: block
48
+ path-style: short
49
+ theme: tokyo-night-storm
50
+ time-style: relative
51
+ ctx-format: 'ctx {used}/{total} ({pct}%)'
52
+ git-symbols:
53
+ stash: "-"
54
+ untracked: "?"
55
+ ```
56
+
57
+ `settings.json` stays clean — no flags in the command:
58
+
59
+ ```jsonc
60
+ // ~/.claude/settings.json
61
+ {
62
+ "statusLine": {
63
+ "type": "command",
64
+ "command": "\"$HOME/.claude/c-c-statusline\""
65
+ }
66
+ }
67
+ ```
68
+
69
+ ### CLI flags
70
+
71
+ CLI flags override config file values. Pass flags during install to bake them into `settings.json`:
72
+
73
+ ```bash
74
+ curl -fsSL https://raw.githubusercontent.com/babarot/c-c-statusline/main/bin/install.sh \
75
+ | bash -s -- --bar-style block --path-style short --theme tokyo-night
76
+ ```
77
+
78
+ This writes the flags directly into the command:
79
+
80
+ ```jsonc
81
+ // ~/.claude/settings.json
82
+ {
83
+ "statusLine": {
84
+ "type": "command",
85
+ "command": "\"$HOME/.claude/c-c-statusline\" --bar-style block --path-style short --theme tokyo-night"
86
+ }
87
+ }
28
88
  ```
29
89
 
90
+ ## Options
91
+
30
92
  | Option | Values | Default | Description |
31
93
  |---|---|---|---|
32
- | `--bar-style` | `dot`, `block`, `fill` | `dot` | Progress bar style |
33
- | `--path-style` | `parent`, `full`, `short`, `basename` | `parent` | Directory display style |
34
- | `--theme` | See [Themes](#themes) | `default` | Color theme |
35
- | `--time-style` | `absolute`, `relative` | `absolute` | Reset time format |
36
- | `--ctx-format` | Format string | `ctx {used}/{total} ({pct}%)` | Context display format |
94
+ | `bar-style` | `dot`, `block`, `fill` | `dot` | Progress bar style |
95
+ | `path-style` | `parent`, `full`, `short`, `basename` | `parent` | Directory display style |
96
+ | `theme` | See [Themes](#themes) | `default` | Color theme |
97
+ | `time-style` | `absolute`, `relative` | `absolute` | Reset time format |
98
+ | `ctx-format` | Format string | `ctx {used}/{total} ({pct}%)` | Context display format |
99
+ | `vim-mode` | `auto`, `always`, `off` | `auto` | Vim mode indicator display |
100
+ | `git-symbols` | Map or `key=val,...` | See [below](#git-symbols) | Override git status symbols |
101
+
102
+ ### bar-style
103
+
104
+ | Input | Output |
105
+ |---|---|
106
+ | `--bar-style dot` | `●●●●○○○○○○` |
107
+ | `--bar-style block` | `▰▰▰▰▱▱▱▱▱▱` |
108
+ | `--bar-style fill` | `████░░░░░░` |
109
+
110
+ ### path-style
37
111
 
38
- **Bar styles:**
112
+ For `/Users/you/src/github.com/you/project`:
39
113
 
40
- | Style | Example |
114
+ | Input | Output |
41
115
  |---|---|
42
- | `dot` | `●●●●○○○○○○` |
43
- | `block` | `▰▰▰▰▱▱▱▱▱▱` |
44
- | `fill` | `████░░░░░░` |
116
+ | `--path-style parent` | `you/project` |
117
+ | `--path-style full` | `~/src/github.com/you/project` |
118
+ | `--path-style short` | `~/s/g/you/project` |
119
+ | `--path-style basename` | `project` |
45
120
 
46
- **Path styles** (for `/Users/you/src/github.com/you/project`):
121
+ ### time-style
47
122
 
48
- | Style | Example |
123
+ | Input | Output |
49
124
  |---|---|
50
- | `parent` | `you/project` |
51
- | `full` | `~/src/github.com/you/project` |
52
- | `short` | `~/s/g/you/project` |
53
- | `basename` | `project` |
125
+ | `--time-style absolute` | `8:00pm`, `Mar 12, 2:00pm` |
126
+ | `--time-style relative` | `1h 30m left`, `2d 5h left` |
54
127
 
55
- **Time styles:**
128
+ ### ctx-format
56
129
 
57
- | Style | Example |
130
+ Use `{used}`, `{total}`, `{pct}`, `{compact}` placeholders.
131
+
132
+ | Placeholder | Description |
133
+ |---|---|
134
+ | `{used}` | Tokens used (e.g. `28k`) |
135
+ | `{total}` | Context window size (e.g. `200k`) |
136
+ | `{pct}` | Usage percentage (e.g. `14`) |
137
+ | `{compact}` | Remaining % until auto-compact (based on 80% usable threshold) |
138
+
139
+ | Input | Output |
58
140
  |---|---|
59
- | `absolute` | `8:00pm`, `Mar 12, 2:00pm` |
60
- | `relative` | `1h 30m left`, `2d 5h left` |
141
+ | `--ctx-format 'ctx {used}/{total} ({pct}%)'` | `ctx 28k/200k (14%)` |
142
+ | `--ctx-format '{pct}% ({used}/{total})'` | `14% (28k/200k)` |
143
+ | `--ctx-format '{pct}% compact:{compact}%'` | `14% compact:83%` |
144
+ | `--ctx-format '{used} of {total}'` | `28k of 200k` |
61
145
 
62
- **Context format** (`--ctx-format`):
146
+ ### vim-mode
63
147
 
64
- Use `{used}`, `{total}`, `{pct}` placeholders to build any format.
148
+ Shows the current Vim mode when Claude Code's Vim keybinding is enabled. The indicator is appended to the end of line 1.
65
149
 
66
- | Format string | Example |
150
+ | Value | Behavior |
67
151
  |---|---|
68
- | `ctx {used}/{total} ({pct}%)` | `ctx 28k/200k (14%)` |
69
- | `{pct}% ({used}/{total})` | `14% (28k/200k)` |
70
- | `{pct}%` | `14%` |
71
- | `{used} of {total}` | `28k of 200k` |
152
+ | `auto` | Show only in `NORMAL` mode (hides in `INSERT` to reduce noise) |
153
+ | `always` | Show in all modes (`NORMAL`, `INSERT`, etc.) |
154
+ | `off` | Never show |
155
+
156
+ Mode colors: `NORMAL` uses the theme's primary color, `INSERT` uses success (green).
157
+
158
+ ```yaml
159
+ # ~/.claude/statusline.yaml
160
+ options:
161
+ vim-mode: auto
162
+ ```
72
163
 
73
164
  ### Themes
74
165
 
75
- Built-in color themes using 24-bit True Color (RGB). Each theme defines 8 semantic color roles (`primary`, `secondary`, `success`, `warning`, `caution`, `danger`, `muted`, `accent`), so every theme can map any color to any role.
166
+ Built-in color themes using 24-bit True Color (RGB). Each theme defines 8 semantic color roles (`primary`, `secondary`, `success`, `warning`, `caution`, `danger`, `muted`, `accent`).
76
167
 
77
168
  | Theme | Description |
78
169
  |---|---|
@@ -90,6 +181,32 @@ Built-in color themes using 24-bit True Color (RGB). Each theme defines 8 semant
90
181
  | `kanagawa` | [Kanagawa](https://github.com/rebelot/kanagawa.nvim) |
91
182
  | `rose-pine` | [Rosé Pine](https://rosepinetheme.com/) |
92
183
 
184
+ ### Git symbols
185
+
186
+ Override any git status symbol. In the config file, use a map; with CLI flags, use `key=val,...` format.
187
+
188
+ | Key | Default | Description |
189
+ |---|---|---|
190
+ | `unstaged` | `*` | Unstaged changes |
191
+ | `staged` | `+` | Staged changes |
192
+ | `stash` | `$` | Stash entries exist |
193
+ | `untracked` | `%` | Untracked files |
194
+ | `ahead` | `↑` | Ahead of upstream |
195
+ | `behind` | `↓` | Behind upstream |
196
+
197
+ | Input | Output |
198
+ |---|---|
199
+ | `--git-symbols "stash=-,untracked=?"` | `(main *+ -?)` |
200
+ | `--git-symbols "unstaged=~,staged=+,stash=-,untracked=?,ahead=+,behind=-"` | `(main ~+ -? +1-2)` |
201
+
202
+ Config file:
203
+ ```yaml
204
+ options:
205
+ git-symbols:
206
+ stash: "-"
207
+ untracked: "?"
208
+ ```
209
+
93
210
  ## What it shows
94
211
 
95
212
  **Line 1:** Model name, context usage (tokens + %), directory, git status, session duration, effort level
@@ -124,11 +241,14 @@ Detached HEAD is shown in red with a tag or short SHA.
124
241
  ## Uninstall
125
242
 
126
243
  ```bash
127
- # Deno
128
- deno run -A https://raw.githubusercontent.com/babarot/c-c-statusline/main/bin/install.ts --uninstall
244
+ # curl
245
+ curl -fsSL https://raw.githubusercontent.com/babarot/c-c-statusline/main/bin/install.sh | bash -s -- --uninstall
129
246
 
130
247
  # npx
131
248
  npx @babarot/c-c-statusline --uninstall
249
+
250
+ # Deno
251
+ deno run -A https://raw.githubusercontent.com/babarot/c-c-statusline/main/bin/install.ts --uninstall
132
252
  ```
133
253
 
134
254
  ## License
package/bin/install.js CHANGED
@@ -147,7 +147,7 @@ async function uninstall() {
147
147
  console.log();
148
148
  }
149
149
 
150
- async function install(extraArgs) {
150
+ async function install(extraArgs, initConfig) {
151
151
  console.log();
152
152
  console.log(` ${blue}Claude Code Statusline Installer${reset}`);
153
153
  console.log(` ${dim}────────────────────────────────${reset}`);
@@ -219,6 +219,21 @@ async function install(extraArgs) {
219
219
  success(`Updated ${dim}settings.json${reset}`);
220
220
  }
221
221
 
222
+ if (initConfig) {
223
+ const configPath = path.join(CLAUDE_DIR, "statusline.yaml");
224
+ if (fs.existsSync(configPath)) {
225
+ warn(`Config already exists: ${dim}${configPath}${reset}`);
226
+ } else {
227
+ const { execFileSync } = require("child_process");
228
+ try {
229
+ execFileSync(BINARY_DEST, ["--init-config"], { stdio: "inherit" });
230
+ success(`Generated ${dim}${configPath}${reset}`);
231
+ } catch {
232
+ warn("Failed to generate config file");
233
+ }
234
+ }
235
+ }
236
+
222
237
  console.log();
223
238
  log(`${green}Done!${reset} Restart Claude Code to see your new status line.`);
224
239
  if (extraArgs.length > 0) {
@@ -242,6 +257,12 @@ if (argv.includes("--help") || argv.includes("-h")) {
242
257
  ${dim}Options:${reset}
243
258
  --bar-style <dot|block|fill> Bar style (default: dot)
244
259
  --path-style <parent|full|short|basename> Path style (default: parent)
260
+ --theme <name> Color theme (default: default)
261
+ --time-style <absolute|relative> Time format (default: absolute)
262
+ --ctx-format <format> Context display format
263
+ --vim-mode <auto|always|off> Vim mode display (default: auto)
264
+ --git-symbols <key=val,...> Override git symbols
265
+ --init-config Generate ~/.claude/statusline.yaml
245
266
  --uninstall Remove statusline
246
267
  --help Show this help
247
268
  `);
@@ -252,12 +273,16 @@ if (argv.includes("--uninstall")) {
252
273
  uninstall();
253
274
  } else {
254
275
  const extraArgs = [];
276
+ const initConfig = argv.includes("--init-config");
277
+ const valueFlags = ["--bar-style", "--path-style", "--theme", "--time-style", "--ctx-format", "--vim-mode", "--git-symbols"];
255
278
  for (let i = 0; i < argv.length; i++) {
256
- if (argv[i] === "--bar-style" && argv[i + 1]) {
257
- extraArgs.push("--bar-style", argv[++i]);
258
- } else if (argv[i] === "--path-style" && argv[i + 1]) {
259
- extraArgs.push("--path-style", argv[++i]);
279
+ if (argv[i] === "--init-config") continue;
280
+ if (valueFlags.includes(argv[i]) && argv[i + 1]) {
281
+ extraArgs.push(argv[i], argv[++i]);
282
+ } else {
283
+ fail(`Unknown option: ${argv[i]}`);
284
+ process.exit(1);
260
285
  }
261
286
  }
262
- install(extraArgs);
287
+ install(extraArgs, initConfig);
263
288
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babarot/c-c-statusline",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "A Deno-powered status line for Claude Code CLI showing model, context usage, rate limits, and more",
5
5
  "bin": {
6
6
  "c-c-statusline": "./bin/install.js"