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

@hu9osaez/commandcode-hud

v1.0.0

Published

One-shot npx installer + native Command Code mod showing model, reasoning effort, context usage and Git branch in the mods status line.

Downloads

229

Readme

commandcode-hud

Native Command Code mod that shows workspace and session state in the mods status line, right below the native footer.

gpt-5.6-luna 🧠 xhigh · █░░░░░░░░░ 4% · 46.8k/1M · main* · 12m34s
5h 8% (4h26m) · wk 45% (3d2h) · $54.10

What it shows

  • Model selected and reasoning effort (🧠 effort).
  • Context used / limit with a visual bar colored by threshold (green <70%, yellow 70–89%, red ≥90%, plus a warning glyph at 90%+). Computed from usage.inputTokens of the model_request_end event and the model's context window (mirrors Command Code's official registry, all 70 models as of v1.53.0).
  • Current Git branch with a dirty marker (main*) when there are uncommitted changes; no-branch outside a repository.
  • Session duration (12m34s, 1h5m past the hour), hidden below one second.
  • Rate limit windows and credits on a second line: 5-hour and weekly windows (same threshold colors, countdown to each reset) and the remaining monthly credit balance, fetched from Command Code's billing API using the CLI's existing local credentials — no extra setup.

State (model, effort, context, branch, dirty, session start) is persisted and restored when reopening a session or switching sessions.

Usage

Run it once with npx — no global install needed:

npx @hu9osaez/commandcode-hud

This installs (or overwrites) the mod at ~/.commandcode/mods/commandcode-hud.ts and verifies the install. It also patches the Command Code CLI dist (sanitizeStatusText) to allow line breaks in mod status text, which enables the two-line HUD; the patch is idempotent and safely reports when the vendor changed the pattern (the HUD then falls back to a single line).

The CLI self-updates wipe the patch. Re-running npx @hu9osaez/commandcode-hud (or --verify) re-applies it.

Other commands:

npx @hu9osaez/commandcode-hud --verify      # Check the installed mod matches this package + patch state
npx @hu9osaez/commandcode-hud --uninstall   # Remove the installed mod
npx @hu9osaez/commandcode-hud --help        # Show usage

Manual install

mkdir -p ~/.commandcode/mods
cp commandcode-hud.mod.ts ~/.commandcode/mods/commandcode-hud.ts

Verification

cmd mods list

You should see:

commandcode-hud · user · ~/.commandcode/mods/commandcode-hud.ts

Then start a new session:

cmd

The HUD appears as the mod status line, below the Command Code input.

Sessions

  • /reload reloads the mod in the current session.
  • /resume restores an existing session.
  • /new starts a new session.

Context segment

  • Used: usage.inputTokens from the model_request_end event (the same source the TUI uses for current context).
  • Limit: per-model contextWindow map (mirror of Command Code's official registry). IDs match cmd --list-models / config.json.
  • If the model is not in the map, the segment is omitted instead of showing a made-up value.

Rate limit segments

  • Source: GET https://api.commandcode.ai/alpha/billing/credits with the CLI API key from ~/.commandcode/auth.json (HTTPS only; the key is never logged or persisted by the mod).
  • Cache: 60s TTL, in-flight dedup, refreshed on session start and run_end.
  • Failure behavior: missing credentials, network errors or unexpected payloads simply hide the segments; the rest of the HUD is unaffected.

Command Code limitations

  • There is no public event for the /model command: a model change is reflected right before the next model request, not necessarily the instant /model runs. The mod compensates by watching ~/.commandcode/config.json and updating when it detects the change.
  • cmd.ui.widget exists in the API but is a no-op (unwired). cmd.ui.setStatus is the supported surface, and the CLI strips line breaks from status text unless the installer patch is applied.

Development

# Exercise mod helpers (branch, model, context limits, billing parse, render)
node --input-type=module -e "const m = await import('./commandcode-hud.mod.ts'); console.log(m.__test)"

License

MIT.