claude-contextline 2.0.1 → 2.2.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 -2
- package/dist/index.js +51 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -23,8 +23,12 @@ Add to your Claude Code settings (`~/.claude/settings.json`):
|
|
|
23
23
|
(main) myproject
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
Colors reflect [lasso](https://github.com/)'s Onyx design system — lasso's
|
|
27
|
+
single, fixed (dark) palette — so the statusline stays in step with lasso's
|
|
28
|
+
indigo-forward look. The tokens mirror lasso's canonical Onyx colors.
|
|
29
|
+
|
|
30
|
+
- **Line 1**: Context window battery bar (Onyx accent) with usage percentage, model name (Onyx danger)
|
|
31
|
+
- **Line 2**: Git branch (Onyx secondary indigo), working directory (Onyx accent) aligned below the model
|
|
28
32
|
|
|
29
33
|
## Requirements
|
|
30
34
|
|
package/dist/index.js
CHANGED
|
@@ -85,16 +85,61 @@ function getUsedPercentage(hookData) {
|
|
|
85
85
|
return null;
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
+
// src/theme.ts
|
|
89
|
+
import { readFileSync } from "fs";
|
|
90
|
+
import { homedir } from "os";
|
|
91
|
+
import { join } from "path";
|
|
92
|
+
function fg(hex) {
|
|
93
|
+
const r = parseInt(hex.slice(1, 3), 16);
|
|
94
|
+
const g = parseInt(hex.slice(3, 5), 16);
|
|
95
|
+
const b = parseInt(hex.slice(5, 7), 16);
|
|
96
|
+
return `\x1B[38;2;${r};${g};${b}m`;
|
|
97
|
+
}
|
|
98
|
+
var ONYX = {
|
|
99
|
+
dark: {
|
|
100
|
+
blue: fg("#7b7fff"),
|
|
101
|
+
// --color-onyx-accent (filled bar + directory)
|
|
102
|
+
red: fg("#f2545b"),
|
|
103
|
+
// --color-onyx-danger (model name)
|
|
104
|
+
mauve: fg("#9498ff"),
|
|
105
|
+
// --color-onyx-accent-1 (git branch)
|
|
106
|
+
overlay0: fg("#3b3f4e")
|
|
107
|
+
// --color-onyx-fg-3 (empty bar cells, muted)
|
|
108
|
+
},
|
|
109
|
+
light: {
|
|
110
|
+
blue: fg("#5c61e6"),
|
|
111
|
+
// --h-accent (light primary, deeper indigo)
|
|
112
|
+
red: fg("#d63d44"),
|
|
113
|
+
// --h-bad (darkened danger for light bg)
|
|
114
|
+
mauve: fg("#7b7fff"),
|
|
115
|
+
// Onyx's lighter indigo, kept distinct from the directory
|
|
116
|
+
overlay0: fg("#6b7080")
|
|
117
|
+
// --h-muted (--fg-2)
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
function settingsPath() {
|
|
121
|
+
const dir = process.env.LASSO_DIR || join(homedir(), ".lasso");
|
|
122
|
+
return join(dir, "settings.json");
|
|
123
|
+
}
|
|
124
|
+
function resolvedAppearance() {
|
|
125
|
+
try {
|
|
126
|
+
const parsed = JSON.parse(readFileSync(settingsPath(), "utf8"));
|
|
127
|
+
return parsed?.theme?.resolved === "light" ? "light" : "dark";
|
|
128
|
+
} catch {
|
|
129
|
+
return "dark";
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
function loadLassoTheme() {
|
|
133
|
+
return ONYX[resolvedAppearance()];
|
|
134
|
+
}
|
|
135
|
+
|
|
88
136
|
// src/renderer.ts
|
|
89
|
-
var
|
|
90
|
-
var RESET = `${ESC}[0m`;
|
|
91
|
-
var BLUE = `${ESC}[38;5;69m`;
|
|
92
|
-
var RED = `${ESC}[38;5;196m`;
|
|
93
|
-
var GRAY = `${ESC}[38;5;243m`;
|
|
137
|
+
var RESET = "\x1B[0m";
|
|
94
138
|
var BAR_WIDTH = 10;
|
|
95
139
|
var FILLED_CHAR = "\u2588";
|
|
96
140
|
var EMPTY_CHAR = "\u2591";
|
|
97
141
|
function render(envInfo) {
|
|
142
|
+
const { blue: BLUE, red: RED, mauve: MAUVE, overlay0: GRAY } = loadLassoTheme();
|
|
98
143
|
let out = "";
|
|
99
144
|
let modelCol = 0;
|
|
100
145
|
if (envInfo.usedPercentage != null) {
|
|
@@ -117,7 +162,7 @@ function render(envInfo) {
|
|
|
117
162
|
out += "\n";
|
|
118
163
|
if (envInfo.gitBranch) {
|
|
119
164
|
const branchText = `(${envInfo.gitBranch})`;
|
|
120
|
-
out += `${
|
|
165
|
+
out += `${MAUVE}${branchText}`;
|
|
121
166
|
const gap = Math.max(2, modelCol - branchText.length);
|
|
122
167
|
out += " ".repeat(gap);
|
|
123
168
|
} else {
|