@babarot/c-c-statusline 0.2.2 → 0.2.3

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 +101 -27
  2. package/bin/install.js +30 -6
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,78 +1,123 @@
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
+ A Deno-powered status line for Claude Code CLI.
4
4
 
5
5
  Shows model info, context usage, rate limits, git status, session duration, and more — right in your terminal.
6
6
 
7
- ## Install
7
+ ![screenshot](ss.png)
8
8
 
9
- ### Binary (recommended)
9
+ ## Install
10
10
 
11
11
  Downloads a precompiled binary from GitHub Releases. No runtime dependencies needed.
12
12
 
13
13
  ```bash
14
- # Deno
15
- deno run -A https://raw.githubusercontent.com/babarot/c-c-statusline/main/bin/install.ts
14
+ # curl
15
+ curl -fsSL https://raw.githubusercontent.com/babarot/c-c-statusline/main/bin/install.sh | bash
16
16
 
17
17
  # npx
18
18
  npx @babarot/c-c-statusline
19
+
20
+ # Deno
21
+ deno run -A https://raw.githubusercontent.com/babarot/c-c-statusline/main/bin/install.ts
22
+ ```
23
+
24
+ ## Configure
25
+
26
+ ### Config file (recommended)
27
+
28
+ Generate `~/.claude/statusline.yaml` with defaults:
29
+
30
+ ```bash
31
+ # After install
32
+ ~/.claude/c-c-statusline --init-config
33
+
34
+ # Or during install
35
+ curl -fsSL https://raw.githubusercontent.com/babarot/c-c-statusline/main/bin/install.sh \
36
+ | bash -s -- --init-config
37
+ ```
38
+
39
+ Then edit to your liking:
40
+
41
+ ```yaml
42
+ options:
43
+ bar-style: block
44
+ path-style: short
45
+ theme: tokyo-night-storm
46
+ time-style: relative
47
+ ctx-format: 'ctx {used}/{total} ({pct}%)'
48
+ git-symbols:
49
+ stash: "-"
50
+ untracked: "?"
19
51
  ```
20
52
 
21
- ### Options
53
+ ### CLI flags
22
54
 
23
- Pass options during install to customize the statusline:
55
+ CLI flags override config file values. Useful for quick testing or one-off overrides.
24
56
 
25
57
  ```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
58
+ # Pass flags during install to set defaults in settings.json
59
+ curl -fsSL https://raw.githubusercontent.com/babarot/c-c-statusline/main/bin/install.sh \
60
+ | bash -s -- --bar-style block --path-style short --theme tokyo-night
28
61
  ```
29
62
 
63
+ ## Options
64
+
30
65
  | Option | Values | Default | Description |
31
66
  |---|---|---|---|
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 |
67
+ | `bar-style` | `dot`, `block`, `fill` | `dot` | Progress bar style |
68
+ | `path-style` | `parent`, `full`, `short`, `basename` | `parent` | Directory display style |
69
+ | `theme` | See [Themes](#themes) | `default` | Color theme |
70
+ | `time-style` | `absolute`, `relative` | `absolute` | Reset time format |
71
+ | `ctx-format` | Format string | `ctx {used}/{total} ({pct}%)` | Context display format |
72
+ | `git-symbols` | Map or `key=val,...` | See [below](#git-symbols) | Override git status symbols |
37
73
 
38
- **Bar styles:**
74
+ ### bar-style
39
75
 
40
- | Style | Example |
76
+ | Value | Output |
41
77
  |---|---|
42
78
  | `dot` | `●●●●○○○○○○` |
43
79
  | `block` | `▰▰▰▰▱▱▱▱▱▱` |
44
80
  | `fill` | `████░░░░░░` |
45
81
 
46
- **Path styles** (for `/Users/you/src/github.com/you/project`):
82
+ ### path-style
47
83
 
48
- | Style | Example |
84
+ For `/Users/you/src/github.com/you/project`:
85
+
86
+ | Value | Output |
49
87
  |---|---|
50
88
  | `parent` | `you/project` |
51
89
  | `full` | `~/src/github.com/you/project` |
52
90
  | `short` | `~/s/g/you/project` |
53
91
  | `basename` | `project` |
54
92
 
55
- **Time styles:**
93
+ ### time-style
56
94
 
57
- | Style | Example |
95
+ | Value | Output |
58
96
  |---|---|
59
97
  | `absolute` | `8:00pm`, `Mar 12, 2:00pm` |
60
98
  | `relative` | `1h 30m left`, `2d 5h left` |
61
99
 
62
- **Context format** (`--ctx-format`):
100
+ ### ctx-format
101
+
102
+ Use `{used}`, `{total}`, `{pct}`, `{compact}` placeholders.
63
103
 
64
- Use `{used}`, `{total}`, `{pct}` placeholders to build any format.
104
+ | Placeholder | Description |
105
+ |---|---|
106
+ | `{used}` | Tokens used (e.g. `28k`) |
107
+ | `{total}` | Context window size (e.g. `200k`) |
108
+ | `{pct}` | Usage percentage (e.g. `14`) |
109
+ | `{compact}` | Remaining % until auto-compact (based on 80% usable threshold) |
65
110
 
66
- | Format string | Example |
111
+ | Value | Output |
67
112
  |---|---|
68
113
  | `ctx {used}/{total} ({pct}%)` | `ctx 28k/200k (14%)` |
69
114
  | `{pct}% ({used}/{total})` | `14% (28k/200k)` |
70
- | `{pct}%` | `14%` |
115
+ | `{pct}% compact:{compact}%` | `14% compact:83%` |
71
116
  | `{used} of {total}` | `28k of 200k` |
72
117
 
73
118
  ### Themes
74
119
 
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.
120
+ 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
121
 
77
122
  | Theme | Description |
78
123
  |---|---|
@@ -90,6 +135,32 @@ Built-in color themes using 24-bit True Color (RGB). Each theme defines 8 semant
90
135
  | `kanagawa` | [Kanagawa](https://github.com/rebelot/kanagawa.nvim) |
91
136
  | `rose-pine` | [Rosé Pine](https://rosepinetheme.com/) |
92
137
 
138
+ ### Git symbols
139
+
140
+ Override any git status symbol. In the config file, use a map; with CLI flags, use `key=val,...` format.
141
+
142
+ | Key | Default | Description |
143
+ |---|---|---|
144
+ | `unstaged` | `*` | Unstaged changes |
145
+ | `staged` | `+` | Staged changes |
146
+ | `stash` | `$` | Stash entries exist |
147
+ | `untracked` | `%` | Untracked files |
148
+ | `ahead` | `↑` | Ahead of upstream |
149
+ | `behind` | `↓` | Behind upstream |
150
+
151
+ Config file:
152
+ ```yaml
153
+ options:
154
+ git-symbols:
155
+ stash: "-"
156
+ untracked: "?"
157
+ ```
158
+
159
+ CLI flag:
160
+ ```bash
161
+ --git-symbols "stash=-,untracked=?"
162
+ ```
163
+
93
164
  ## What it shows
94
165
 
95
166
  **Line 1:** Model name, context usage (tokens + %), directory, git status, session duration, effort level
@@ -124,11 +195,14 @@ Detached HEAD is shown in red with a tag or short SHA.
124
195
  ## Uninstall
125
196
 
126
197
  ```bash
127
- # Deno
128
- deno run -A https://raw.githubusercontent.com/babarot/c-c-statusline/main/bin/install.ts --uninstall
198
+ # curl
199
+ curl -fsSL https://raw.githubusercontent.com/babarot/c-c-statusline/main/bin/install.sh | bash -s -- --uninstall
129
200
 
130
201
  # npx
131
202
  npx @babarot/c-c-statusline --uninstall
203
+
204
+ # Deno
205
+ deno run -A https://raw.githubusercontent.com/babarot/c-c-statusline/main/bin/install.ts --uninstall
132
206
  ```
133
207
 
134
208
  ## 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,11 @@ 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
+ --git-symbols <key=val,...> Override git symbols
264
+ --init-config Generate ~/.claude/statusline.yaml
245
265
  --uninstall Remove statusline
246
266
  --help Show this help
247
267
  `);
@@ -252,12 +272,16 @@ if (argv.includes("--uninstall")) {
252
272
  uninstall();
253
273
  } else {
254
274
  const extraArgs = [];
275
+ const initConfig = argv.includes("--init-config");
276
+ const valueFlags = ["--bar-style", "--path-style", "--theme", "--time-style", "--ctx-format", "--git-symbols"];
255
277
  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]);
278
+ if (argv[i] === "--init-config") continue;
279
+ if (valueFlags.includes(argv[i]) && argv[i + 1]) {
280
+ extraArgs.push(argv[i], argv[++i]);
281
+ } else {
282
+ fail(`Unknown option: ${argv[i]}`);
283
+ process.exit(1);
260
284
  }
261
285
  }
262
- install(extraArgs);
286
+ install(extraArgs, initConfig);
263
287
  }
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.3",
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"