claude-contextline 1.2.0 → 1.3.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/README.md +14 -0
- package/dist/index.js +31 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -37,6 +37,20 @@ Add to your Claude Code settings (`~/.claude/settings.json`):
|
|
|
37
37
|
- **Warning** (≥80%): White text on orange background
|
|
38
38
|
- **Critical** (≥100%): White text on red background
|
|
39
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
|
+
```
|
|
53
|
+
|
|
40
54
|
## Requirements
|
|
41
55
|
|
|
42
56
|
- Node.js 18+
|
package/dist/index.js
CHANGED
|
@@ -133,6 +133,24 @@ 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
|
+
}
|
|
136
154
|
function hexToAnsi256(hex) {
|
|
137
155
|
const r = parseInt(hex.slice(1, 3), 16);
|
|
138
156
|
const g = parseInt(hex.slice(3, 5), 16);
|
|
@@ -152,13 +170,13 @@ var ansi = {
|
|
|
152
170
|
bg: (hex) => `\x1B[48;5;${hexToAnsi256(hex)}m`,
|
|
153
171
|
reset: "\x1B[0m"
|
|
154
172
|
};
|
|
155
|
-
function getContextColors(percent) {
|
|
173
|
+
function getContextColors(percent, theme) {
|
|
156
174
|
if (percent >= 100) {
|
|
157
|
-
return
|
|
175
|
+
return theme.critical;
|
|
158
176
|
} else if (percent >= 80) {
|
|
159
|
-
return
|
|
177
|
+
return theme.warning;
|
|
160
178
|
}
|
|
161
|
-
return
|
|
179
|
+
return theme.context;
|
|
162
180
|
}
|
|
163
181
|
|
|
164
182
|
// src/renderer.ts
|
|
@@ -179,8 +197,10 @@ function detectNerdFontSupport() {
|
|
|
179
197
|
var Renderer = class {
|
|
180
198
|
symbols = detectNerdFontSupport() ? SYMBOLS : TEXT_SYMBOLS;
|
|
181
199
|
noArrows;
|
|
200
|
+
theme;
|
|
182
201
|
constructor(options = {}) {
|
|
183
202
|
this.noArrows = options.noArrows ?? false;
|
|
203
|
+
this.theme = getTheme(options.themeName);
|
|
184
204
|
}
|
|
185
205
|
/**
|
|
186
206
|
* Render the complete statusline
|
|
@@ -199,20 +219,20 @@ var Renderer = class {
|
|
|
199
219
|
const segments = [];
|
|
200
220
|
segments.push({
|
|
201
221
|
text: ` ${envInfo.directory} `,
|
|
202
|
-
colors:
|
|
222
|
+
colors: this.theme.directory
|
|
203
223
|
});
|
|
204
224
|
if (envInfo.gitBranch) {
|
|
205
225
|
const dirty = envInfo.gitDirty ? ` ${this.symbols.dirty}` : "";
|
|
206
226
|
segments.push({
|
|
207
227
|
text: ` ${this.symbols.branch} ${envInfo.gitBranch}${dirty} `,
|
|
208
|
-
colors:
|
|
228
|
+
colors: this.theme.git
|
|
209
229
|
});
|
|
210
230
|
}
|
|
211
231
|
segments.push({
|
|
212
232
|
text: ` ${this.symbols.model} ${envInfo.model} `,
|
|
213
|
-
colors:
|
|
233
|
+
colors: this.theme.model
|
|
214
234
|
});
|
|
215
|
-
const contextColors = getContextColors(envInfo.contextPercent);
|
|
235
|
+
const contextColors = getContextColors(envInfo.contextPercent, this.theme);
|
|
216
236
|
segments.push({
|
|
217
237
|
text: ` ${this.symbols.context} ${envInfo.contextPercent}% `,
|
|
218
238
|
colors: contextColors
|
|
@@ -245,9 +265,11 @@ var Renderer = class {
|
|
|
245
265
|
async function main() {
|
|
246
266
|
try {
|
|
247
267
|
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;
|
|
248
270
|
const hookData = await readHookData();
|
|
249
271
|
const envInfo = getEnvironmentInfo(hookData);
|
|
250
|
-
const renderer = new Renderer({ noArrows });
|
|
272
|
+
const renderer = new Renderer({ noArrows, themeName });
|
|
251
273
|
const output = renderer.render(envInfo);
|
|
252
274
|
process.stdout.write(output);
|
|
253
275
|
} catch {
|