mirror of
https://github.com/jarrodwatts/claude-hud.git
synced 2026-05-13 02:20:20 +00:00
The previous installation command didn't work because Claude Code plugins require a marketplace manifest. This adds the marketplace.json and updates install instructions to the correct two-step flow: 1. /plugin marketplace add jarrodwatts/claude-hud 2. /plugin install claude-hud@claude-hud Also commits dist/ for plugin distribution since users can't run npm build when installing via marketplace. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
35 lines
1009 B
JavaScript
35 lines
1009 B
JavaScript
export async function readStdin() {
|
|
if (process.stdin.isTTY) {
|
|
return null;
|
|
}
|
|
const chunks = [];
|
|
try {
|
|
process.stdin.setEncoding('utf8');
|
|
for await (const chunk of process.stdin) {
|
|
chunks.push(chunk);
|
|
}
|
|
const raw = chunks.join('');
|
|
if (!raw.trim()) {
|
|
return null;
|
|
}
|
|
return JSON.parse(raw);
|
|
}
|
|
catch {
|
|
return null;
|
|
}
|
|
}
|
|
export function getContextPercent(stdin) {
|
|
const usage = stdin.context_window?.current_usage;
|
|
const size = stdin.context_window?.context_window_size;
|
|
if (!usage || !size || size === 0) {
|
|
return 0;
|
|
}
|
|
const totalTokens = (usage.input_tokens ?? 0) +
|
|
(usage.cache_creation_input_tokens ?? 0) +
|
|
(usage.cache_read_input_tokens ?? 0);
|
|
return Math.round((totalTokens / size) * 100);
|
|
}
|
|
export function getModelName(stdin) {
|
|
return stdin.model?.display_name ?? stdin.model?.id ?? 'Unknown';
|
|
}
|
|
//# sourceMappingURL=stdin.js.map
|