claude-code-pulsify 1.2.0 → 1.2.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 +13 -0
- package/hooks/statusline.js +2 -26
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -34,6 +34,14 @@ npx claude-code-pulsify@latest --uninstall
|
|
|
34
34
|
- **Context monitor** -- Warns at 65% and 75% context usage via PostToolUse hook
|
|
35
35
|
- **Update checker** -- Background version check on session start, non-blocking
|
|
36
36
|
|
|
37
|
+
## Context bar
|
|
38
|
+
|
|
39
|
+
The context bar shows **usable** context, not raw token count — it accounts for Claude's autocompact buffer (~16.5% of the window), which is reserved and unavailable to you.
|
|
40
|
+
|
|
41
|
+
- **0%** = fresh session
|
|
42
|
+
- **100%** = autocompact imminent (context will be compressed)
|
|
43
|
+
- Color thresholds: **green** (<50%) → **yellow** (50-65%) → **orange** (65-80%) → **red** (>80%)
|
|
44
|
+
|
|
37
45
|
## Checking your installed version
|
|
38
46
|
|
|
39
47
|
```bash
|
|
@@ -49,3 +57,8 @@ You can also check manually:
|
|
|
49
57
|
## Configuration
|
|
50
58
|
|
|
51
59
|
Respects the `CLAUDE_CONFIG_DIR` environment variable. Defaults to `~/.claude`.
|
|
60
|
+
|
|
61
|
+
## Future Enhancements
|
|
62
|
+
|
|
63
|
+
- Lines changed display (+added / -removed)
|
|
64
|
+
- Token usage counter
|
package/hooks/statusline.js
CHANGED
|
@@ -121,22 +121,6 @@ function formatCost(costUsd) {
|
|
|
121
121
|
return `${WHITE}$${str}${RESET}`
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
function formatLinesChanged(added, removed) {
|
|
125
|
-
const parts = []
|
|
126
|
-
if (added) parts.push(`${GREEN}+${added}${RESET}`)
|
|
127
|
-
if (removed) parts.push(`${RED}-${removed}${RESET}`)
|
|
128
|
-
return parts.join(' ')
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
function formatTokenCount(input, output) {
|
|
132
|
-
const total = (input || 0) + (output || 0)
|
|
133
|
-
if (!total) return ''
|
|
134
|
-
let compact
|
|
135
|
-
if (total >= 1e6) compact = `${(total / 1e6).toFixed(1)}M`
|
|
136
|
-
else if (total >= 1e3) compact = `${(total / 1e3).toFixed(1)}k`
|
|
137
|
-
else compact = `${total}`
|
|
138
|
-
return `${DIM}${compact} tok${RESET}`
|
|
139
|
-
}
|
|
140
124
|
|
|
141
125
|
async function main() {
|
|
142
126
|
let input = ''
|
|
@@ -179,10 +163,6 @@ async function main() {
|
|
|
179
163
|
const remainingPct = data.context_window?.remaining_percentage ?? 100
|
|
180
164
|
const sessionId = data.session?.id || data.session_id || null
|
|
181
165
|
const costUsd = data.cost?.total_cost_usd ?? 0
|
|
182
|
-
const linesAdded = data.cost?.total_lines_added ?? 0
|
|
183
|
-
const linesRemoved = data.cost?.total_lines_removed ?? 0
|
|
184
|
-
const totalInputTokens = data.context_window?.total_input_tokens ?? 0
|
|
185
|
-
const totalOutputTokens = data.context_window?.total_output_tokens ?? 0
|
|
186
166
|
|
|
187
167
|
// Normalize and build bar
|
|
188
168
|
const usedPct = normalizeUsage(remainingPct)
|
|
@@ -207,10 +187,8 @@ async function main() {
|
|
|
207
187
|
model,
|
|
208
188
|
})
|
|
209
189
|
|
|
210
|
-
// Format
|
|
190
|
+
// Format cost
|
|
211
191
|
const cost = formatCost(costUsd)
|
|
212
|
-
const lines = formatLinesChanged(linesAdded, linesRemoved)
|
|
213
|
-
const tokenCount = formatTokenCount(totalInputTokens, totalOutputTokens)
|
|
214
192
|
|
|
215
193
|
// Build segments array (only include non-empty optional segments)
|
|
216
194
|
const segments = [
|
|
@@ -218,9 +196,7 @@ async function main() {
|
|
|
218
196
|
dirLabel,
|
|
219
197
|
]
|
|
220
198
|
if (cost) segments.push(cost)
|
|
221
|
-
|
|
222
|
-
const barWithTokens = tokenCount ? `${bar} ${tokenCount}` : bar
|
|
223
|
-
segments.push(barWithTokens)
|
|
199
|
+
segments.push(bar)
|
|
224
200
|
|
|
225
201
|
// Output statusline
|
|
226
202
|
const line = segments.join(` ${SEPARATOR} `) + taskSegment + updateIndicator
|