claude-contextline 1.3.1 → 2.0.0
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/README.md +6 -37
- package/dist/index.js +9 -31
- package/package.json +2 -3
package/README.md
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
# claude-contextline
|
|
2
2
|
|
|
3
|
-
A
|
|
4
|
-
|
|
5
|
-
<img width="677" height="38" alt="image" src="https://github.com/user-attachments/assets/070d99fe-290d-4897-88b0-04247bf27866" />
|
|
6
|
-
|
|
3
|
+
A two-line statusline for Claude Code showing context window usage, model, git
|
|
4
|
+
branch, and working directory.
|
|
7
5
|
|
|
8
6
|
## Usage
|
|
9
7
|
|
|
@@ -18,49 +16,20 @@ Add to your Claude Code settings (`~/.claude/settings.json`):
|
|
|
18
16
|
}
|
|
19
17
|
```
|
|
20
18
|
|
|
21
|
-
## Features
|
|
22
|
-
|
|
23
|
-
- **Directory** - Shows current project/directory name
|
|
24
|
-
- **Git** - Shows branch name with dirty indicator (●)
|
|
25
|
-
- **Model** - Shows active Claude model
|
|
26
|
-
- **Context** - Shows context window usage percentage
|
|
27
|
-
|
|
28
19
|
## Display
|
|
29
20
|
|
|
30
21
|
```
|
|
31
|
-
|
|
22
|
+
[█████░░░░░] 42% Opus 4.6
|
|
23
|
+
(main) myproject
|
|
32
24
|
```
|
|
33
25
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
- **Normal** (<80%): Sky blue text on dark background
|
|
37
|
-
- **Warning** (≥80%): White text on orange background
|
|
38
|
-
- **Critical** (≥100%): White text on red background
|
|
39
|
-
|
|
40
|
-
## Options
|
|
41
|
-
|
|
42
|
-
- `--theme <name>` - Use a named color theme (e.g. `--theme fulcrum` for purple-accented Fulcrum branding)
|
|
43
|
-
- `--no-arrows` - Disable powerline arrow separators
|
|
44
|
-
|
|
45
|
-
```json
|
|
46
|
-
{
|
|
47
|
-
"statusLine": {
|
|
48
|
-
"type": "command",
|
|
49
|
-
"command": "npx claude-contextline --theme fulcrum"
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
```
|
|
26
|
+
- **Line 1**: Context window battery bar (blue) with usage percentage, model name (red)
|
|
27
|
+
- **Line 2**: Git branch (red), working directory (blue) aligned below the model
|
|
53
28
|
|
|
54
29
|
## Requirements
|
|
55
30
|
|
|
56
31
|
- Node.js 18+
|
|
57
|
-
- A terminal with powerline font support (for arrow glyphs)
|
|
58
|
-
|
|
59
|
-
## Credits
|
|
60
|
-
|
|
61
|
-
Styling based on [claude-limitline](https://github.com/tylergraydev/claude-limitline).
|
|
62
32
|
|
|
63
33
|
## License
|
|
64
34
|
|
|
65
35
|
MIT
|
|
66
|
-
|
package/dist/index.js
CHANGED
|
@@ -133,24 +133,6 @@ var darkTheme = {
|
|
|
133
133
|
critical: { bg: "#af0000", fg: "#ffffff" }
|
|
134
134
|
// Red, white (100%+)
|
|
135
135
|
};
|
|
136
|
-
var fulcrumTheme = {
|
|
137
|
-
directory: { bg: "#f90013", fg: "#ffffff" },
|
|
138
|
-
// Destructive red, white
|
|
139
|
-
git: { bg: "#121212", fg: "#81aefa" },
|
|
140
|
-
// Secondary, light blue
|
|
141
|
-
model: { bg: "#090909", fg: "#659dfb" },
|
|
142
|
-
// Card, medium blue
|
|
143
|
-
context: { bg: "#161616", fg: "#81aefa" },
|
|
144
|
-
// Muted, light blue
|
|
145
|
-
warning: { bg: "#f84331", fg: "#ffffff" },
|
|
146
|
-
// Warning red-orange, white (80%+)
|
|
147
|
-
critical: { bg: "#0064f4", fg: "#ffffff" }
|
|
148
|
-
// Accent blue, white (100%+)
|
|
149
|
-
};
|
|
150
|
-
function getTheme(name) {
|
|
151
|
-
if (name === "fulcrum") return fulcrumTheme;
|
|
152
|
-
return darkTheme;
|
|
153
|
-
}
|
|
154
136
|
function hexToAnsi256(hex) {
|
|
155
137
|
const r = parseInt(hex.slice(1, 3), 16);
|
|
156
138
|
const g = parseInt(hex.slice(3, 5), 16);
|
|
@@ -170,13 +152,13 @@ var ansi = {
|
|
|
170
152
|
bg: (hex) => `\x1B[48;5;${hexToAnsi256(hex)}m`,
|
|
171
153
|
reset: "\x1B[0m"
|
|
172
154
|
};
|
|
173
|
-
function getContextColors(percent
|
|
155
|
+
function getContextColors(percent) {
|
|
174
156
|
if (percent >= 100) {
|
|
175
|
-
return
|
|
157
|
+
return darkTheme.critical;
|
|
176
158
|
} else if (percent >= 80) {
|
|
177
|
-
return
|
|
159
|
+
return darkTheme.warning;
|
|
178
160
|
}
|
|
179
|
-
return
|
|
161
|
+
return darkTheme.context;
|
|
180
162
|
}
|
|
181
163
|
|
|
182
164
|
// src/renderer.ts
|
|
@@ -197,10 +179,8 @@ function detectNerdFontSupport() {
|
|
|
197
179
|
var Renderer = class {
|
|
198
180
|
symbols = detectNerdFontSupport() ? SYMBOLS : TEXT_SYMBOLS;
|
|
199
181
|
noArrows;
|
|
200
|
-
theme;
|
|
201
182
|
constructor(options = {}) {
|
|
202
183
|
this.noArrows = options.noArrows ?? false;
|
|
203
|
-
this.theme = getTheme(options.themeName);
|
|
204
184
|
}
|
|
205
185
|
/**
|
|
206
186
|
* Render the complete statusline
|
|
@@ -219,20 +199,20 @@ var Renderer = class {
|
|
|
219
199
|
const segments = [];
|
|
220
200
|
segments.push({
|
|
221
201
|
text: ` ${envInfo.directory} `,
|
|
222
|
-
colors:
|
|
202
|
+
colors: darkTheme.directory
|
|
223
203
|
});
|
|
224
204
|
if (envInfo.gitBranch) {
|
|
225
205
|
const dirty = envInfo.gitDirty ? ` ${this.symbols.dirty}` : "";
|
|
226
206
|
segments.push({
|
|
227
207
|
text: ` ${this.symbols.branch} ${envInfo.gitBranch}${dirty} `,
|
|
228
|
-
colors:
|
|
208
|
+
colors: darkTheme.git
|
|
229
209
|
});
|
|
230
210
|
}
|
|
231
211
|
segments.push({
|
|
232
212
|
text: ` ${this.symbols.model} ${envInfo.model} `,
|
|
233
|
-
colors:
|
|
213
|
+
colors: darkTheme.model
|
|
234
214
|
});
|
|
235
|
-
const contextColors = getContextColors(envInfo.contextPercent
|
|
215
|
+
const contextColors = getContextColors(envInfo.contextPercent);
|
|
236
216
|
segments.push({
|
|
237
217
|
text: ` ${this.symbols.context} ${envInfo.contextPercent}% `,
|
|
238
218
|
colors: contextColors
|
|
@@ -265,11 +245,9 @@ var Renderer = class {
|
|
|
265
245
|
async function main() {
|
|
266
246
|
try {
|
|
267
247
|
const noArrows = process.argv.includes("--no-arrows");
|
|
268
|
-
const themeIndex = process.argv.indexOf("--theme");
|
|
269
|
-
const themeName = themeIndex !== -1 ? process.argv[themeIndex + 1] : void 0;
|
|
270
248
|
const hookData = await readHookData();
|
|
271
249
|
const envInfo = getEnvironmentInfo(hookData);
|
|
272
|
-
const renderer = new Renderer({ noArrows
|
|
250
|
+
const renderer = new Renderer({ noArrows });
|
|
273
251
|
const output = renderer.render(envInfo);
|
|
274
252
|
process.stdout.write(output);
|
|
275
253
|
} catch {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-contextline",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "Two-line statusline for Claude Code showing context window usage",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"bin": {
|
|
@@ -25,7 +25,6 @@
|
|
|
25
25
|
"claude",
|
|
26
26
|
"claude-code",
|
|
27
27
|
"statusline",
|
|
28
|
-
"powerline",
|
|
29
28
|
"context-window",
|
|
30
29
|
"cli"
|
|
31
30
|
],
|