Thanks for contributing to Claude HUD. This repo is small and fast-moving, so we optimize for clarity and quick review.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/jarrodwatts/claude-hud/llms.txt
Use this file to discover all available pages before exploring further.
Setup
Build commands
| Command | Description |
|---|---|
npm ci | Install dependencies |
npm run build | Compile TypeScript to dist/ |
npm test | Build and run all tests |
npm run test:coverage | Run tests with coverage report (text + lcov) |
npm run test:update-snapshots | Rebuild golden-output snapshots |
Testing your changes manually
After building, pipe a sample stdin JSON payload to the compiled binary to see live HUD output:transcript_path field:
The HUD is invoked every ~300ms by Claude Code. Each run receives a fresh JSON blob on stdin, parses the transcript JSONL, renders lines to stdout, and exits. Manual piping like this replicates that cycle.
Testing approach
Tests live intests/ and are organized in three layers:
Unit tests — pure helpers, rendering utilities, and transcript parsing logic. Deterministic and fast.
Integration tests — run the CLI with a sample stdin JSON and a fixture transcript; assert the rendered output contains expected markers (model name, percent, tool names).
Golden-output (snapshot) tests — compare full output against a stored snapshot. Update only when intentional output changes are made:
tests/fixtures/ as small JSONL files, each capturing one behavior (basic tool flow, agent lifecycle, todo updates, etc.).
Contributing expectations
- Add or update tests for behavior changes.
- Prefer unit tests for new helpers and integration tests for user-visible output changes.
- Keep tests deterministic — avoid time-dependent assertions unless controlled.
Project architecture
Data flow
- Receives JSON via stdin (
model, context window, token counts,transcript_path) - Parses the transcript JSONL file for tool use, agents, and todos
- Renders multi-line output to stdout
- Claude Code displays all lines
Data sources
| Source | Data |
|---|---|
| stdin JSON (native, accurate) | model.display_name, token counts, context_window_size, transcript_path |
| Transcript JSONL | Tool names, completion status, durations, todo list, agent info |
~/.claude/settings.json | MCP server count, hooks count |
| CLAUDE.md files | Rules count |
~/.claude/.credentials.json | OAuth token and subscription type (when display.showUsage enabled) |
| Anthropic Usage API | 5h / 7d usage percentages, reset timestamps (cached 60s / 15s) |
File structure
Dependencies
- Runtime: Node.js 18+ or Bun
- Build: TypeScript 5, ES2022 target, NodeNext modules
- Dev:
@types/node,c8(coverage),typescript
Code style
- Keep changes focused and small.
- Prefer tests for behavior changes.
- Avoid introducing dependencies unless necessary.
Build process
CI automatically builds and commitsdist/ after your PR is merged. This keeps PRs focused on source code and makes review easier.
Submitting a pull request
- Describe the problem and the fix.
- Include tests or explain why they are not needed.
- Link issues when relevant.
- Only modify
src/files — CI handlesdist/automatically.