npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

gemini-hud

v0.3.0

Published

HUD status bar embedded in Gemini CLI footer via ESM loader hook

Downloads

306

Readme

gemini-hud

将 HUD 状态栏直接嵌入 Gemini CLI 的 footer 区域 — 无需额外面板,无需 tmux。

通过 Node.js ESM Loader Hook 在运行时拦截并增强 Gemini CLI 的 Footer 组件。

gemini-hud 截图

特性

  • 上下文预警:当 Context 占用超过 90% 时,文字颜色会红色闪烁提醒(自动识别 Pro/Flash 限制)。
  • 子代理监控:当 codebase-investigator 等后台任务运行时,显示动态旋转图标和任务计数。
  • 精准会话绑定:利用 sessionId 锁定会话文件,完美支持多个 CLI 窗口同时运行而不干扰。
  • 实时费用估算:根据不同模型费率和已消耗 Token,实时计算本次会话的估算花费(美元)。
  • Git 状态增强:显示分支名、工作区脏状态标记(*)以及领先/落后远程分支的数量(↑/↓)。
  • 性能优化:基于 mtime 的 session 文件缓存机制 — 即使对话历史达到 2M+ Token 也不会造成打字卡顿。
  • 快捷键轮播提示:在 HUD 右侧自动轮转显示高频生产力命令提示。

前置要求

  • Node.js >= 20
  • Gemini CLI >= 0.34.0(npm install -g @google/gemini-cli

安装

npm install -g gemini-hud

使用法

gemini-hud          # 启动带 HUD 的 gemini
gemini-hud --help   # 参数直接传递给 gemini

或手动运行(路径按实际安装位置替换):

node --import ./register.mjs $(which gemini)

配置

创建 ~/.gemini-hudrc(JSON 格式):

{
  "colors": {
    "label": "gray",
    "value": "white",
    "separator": "gray",
    "warning": "yellow",
    "danger": "red"
  },
  "contextMaxTokens": 1000000,
  "showGitBranch": true,
  "showSessionDuration": true,
  "showTokenBreakdown": true,
  "showToolCalls": true,
  "showEstimatedCost": true
}

所有字段均为可选,未指定的使用默认值。

工作原理

  1. register.mjs — 通过 node:module.register() 注册 ESM loader hook。
  2. loader.mjs — 拦截 resolve 阶段;当检测到 @google/gemini-cliFooter.js 被加载时,重定向到我们的 hud-footer.mjs
  3. hud-footer.mjs — 渲染原始 Footer(保留所有原有功能),并在下方追加 HUD 信息行。
  4. bin/gemini-hud — 跨平台启动脚本:node --import register.mjs $(which gemini) "$@"

数据来源

| 信息 | 来源 | |------|------| | 模型名称 | uiState.currentModel (来自 Footer props) | | 上下文用量 | max(uiState.lastPrompt, session.input) / modelLimit | | Token 详情 | ~/.gemini/tmp/<project>/chats/session-<id>.json (缓存解析) | | 活跃任务 | uiState.activeTasks (Sub-agents 状态) | | Git 状态 | git status --porcelaingit rev-list --count |

兼容性

  • Node.js: >= 20(需要 ESM loader hooks 支持)。
  • Gemini CLI: >= 0.34.0(使用 column 布局的 Footer)。
  • 平台: macOS、Linux、Windows。

许可证

MIT