feat: config system + usage API + bug fixes (supersedes #32) (#35)
* feat: display last 3 path segments first in session line
Shows the last 3 segments of the working directory path at the
beginning of the session line for quick project identification.
Before: [Opus 4.5] ████░░░░░░ 19% | my-project git:(main) | ...
After: dev/apps/my-project git:(main) | [Opus 4.5] ████░░░░░░ 19% | ...
This helps distinguish between projects with similar names in
different locations and puts the most relevant info first.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: configurable path levels (1-3) and git status toggle
- Add config system at ~/.claude/plugins/claude-hud/config.json
- Default path display to 1 level (was hardcoded at 3)
- Add pathLevels option: 1, 2, or 3 directory segments
- Add gitStatus.enabled toggle to show/hide git branch
- Add interactive CLI: npx claude-hud-configure
- Add comprehensive tests for config and path levels
- Update README with configuration documentation
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: handle cross-platform path separators
- Split paths by both / and \ for Windows compatibility
- Always output forward slashes for consistent display
- Add tests for Windows paths, UNC paths, and mixed separators
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: show existing config when reconfiguring
- Display current values when config file exists
- Prompt user that Enter keeps current values
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: interactive CLI with arrow-key selection
- Add @inquirer/prompts for better UX
- Arrow keys to select path levels
- Visual feedback with checkmarks
- Cleaner, more compact output
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: add dirty indicator and ahead/behind git status
- Add gitStatus.showDirty option (default: true)
- Add gitStatus.showAheadBehind option (default: false)
- Update getGitStatus to return isDirty, ahead, behind
- Update CLI to configure new options with preview
- Add tests for dirty and ahead/behind display
- Update README with new options
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: add configurable display options for all HUD elements
- Add display configuration object with 8 boolean options:
- showModel: Toggle model name display [Opus]
- showContextBar: Toggle visual context bar ████░░░░░░
- showConfigCounts: Toggle CLAUDE.md, rules, MCPs, hooks counts
- showDuration: Toggle session duration display
- showTokenBreakdown: Toggle token details at high context (85%+)
- showTools: Toggle tools activity line
- showAgents: Toggle agents activity line
- showTodos: Toggle todos progress line
- All options default to true for backward compatibility
- Enhanced CLI preview with colors matching actual HUD output
- Added 5 new tests for display configuration (87 total)
- Updated README with complete configuration reference
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: add configurable layout options (default, condensed, separators)
- Add layout config option with three styles:
- default: All info on first line (original behavior)
- condensed: Model/context top, project bottom
- separators: Condensed with visual separator lines
- Create project-line.ts for rendering project path in split layouts
- Add renderSessionLineMinimal for condensed/separators layouts
- Interactive CLI preview shows selected layout style
- All 87 tests pass
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: add interactive HUD preview and folder icon
- Add live preview that updates as config options are selected
- Show initial preview on startup based on existing/default config
- Add folder icon (📁) in front of project path
- Extract preview generation to separate module for reuse
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* docs: update README with folder icon and live preview
- Add folder icon (📁) to all path examples
- Document live preview feature in interactive CLI section
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: add menu-based navigation to configure CLI
- Replace linear flow with main menu loop
- Show current values in menu (layout, path levels, git status, etc.)
- Users can edit any section and return to menu
- Preview updates after each section change
- Save & Exit or Exit without saving options
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: update tests for folder icon and config structure
- Update integration test expected output with folder icon
- Make config test environment-independent (validates structure, not specific values)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* test: add comprehensive config loading tests
Add 23 new tests for config system validation:
- DEFAULT_CONFIG structure (layout, gitStatus, 8 display options)
- Layout validation (default, condensed, separators)
- PathLevels validation (1, 2, or 3)
- Git status configuration defaults
- Display configuration (booleans, defaults to true, count)
- loadConfig behavior (complete fields, valid values)
- getConfigPath structure tests
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: add usage API, config enhancements, and bug fixes
This PR combines and enhances the config system from PR #32 with new features
and bug fixes addressing the owner's review feedback.
## New Features
- Usage API integration showing 5h/7d limits for Pro/Max/Team users
- Interactive `/claude-hud:configure` skill for in-Claude-Code configuration
- Hybrid showUsage toggle (env var + config for privacy control)
## Bug Fixes (addressing #32 review feedback)
- Fix git status spacing: `main*↑2↓1` → `main* ↑2 ↓1`
- Fix root path rendering: show `/` instead of empty folder icon
- Fix Windows path normalization in truncatePath
- Fix duplicate dependencies key in package.json
- Fix multiSelect for mutually exclusive options in configure skill
## Credits
- Config system, layouts, path levels, git toggle, CLI by @Tsopic (PR #32)
- Usage API, configure skill, bug fixes by @melon-hub
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Tsopic <Tsopic@users.noreply.github.com>
* fix: move configure command to correct location
- Move configure.md from .claude-plugin/skills/ to commands/
- Remove skills array from plugin.json (commands are auto-discovered)
Commands must be in the commands/ directory at plugin root,
not inside .claude-plugin/. This matches the existing setup.md pattern.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: layout order, remove condensed, redesign configure flow
Render fixes (per PR feedback):
- Fix element order: model first, project second
- Remove condensed layout (only default/separators remain)
- Separators: single line below header only when activity exists
- Delete project-line.ts (no longer needed)
- Remove renderSessionLineMinimal() function
Configure skill redesign:
- Context-aware tab order (returning users start on Turn Off)
- Explicit Turn Off/Turn On questions (no toggle ambiguity)
- Git Style question for dirty/ahead-behind options
- Combined Layout/Reset tab for returning users
- Duration now toggleable
- Guards against empty submissions
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* docs: rename 'Returning User' to 'Update Config' in configure flow
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* test: fix tests for new element order and removed function
- Update render-basic.txt expected output (model first, project second)
- Remove renderSessionLineMinimal import and test (function was deleted)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* docs: update documentation for usage API, config flow, and troubleshooting
- Remove stale CLAUDE_HUD_SHOW_USAGE env var references (now config-based)
- Add usage API data sources to CLAUDE.md
- Add new source files to file structure (config.ts, git.ts, usage-api.ts)
- Update README with usage limits section and requirements
- Add troubleshooting sections for config, git, and usage issues
- Standardize output examples across all documentation files
- Remove condensed layout references (only default/separators now)
- Update configure skill reference (npx CLI → /claude-hud:configure)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: remove dist/ from PR and update outdated comment
- Reset dist/ to main branch (dist will be built by CI after merge)
- Update comment: "requires env var opt-in AND config" → "shown when enabled in config"
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* chore: remove internal design doc from release
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* chore: remove CLI and runtime dependency
- Remove src/bin/configure.ts and src/bin/preview.ts
- Remove @inquirer/prompts dependency (plugins don't run npm install)
- Remove bin field from package.json
- Users configure via /claude-hud:configure skill instead
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* chore: bump version to 0.0.4
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: use file-based cache for usage API
HUD runs as a new process every ~300ms, so in-memory cache was useless.
Now caches to ~/.claude/plugins/claude-hud/.usage-cache.json.
This reduces API calls from ~10,800/hour to max 60/hour.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: use consistent homeDir/now in getUsage
Avoids potential divergence if deps functions are non-deterministic.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* test: add real tests for usage API file cache
- Test credential parsing with mock HOME directory
- Test cache TTL behavior (success and failure)
- Test apiUnavailable flag handling
- Replace placeholder assert.ok(true) with actual assertions
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Martin Kask <martin@industrial.ninja>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: melon-hub <melon-hub@users.noreply.github.com>
Co-authored-by: Tsopic <Tsopic@users.noreply.github.com>
Co-authored-by: Jarrod Watts <jarrod@cubelabs.xyz>
2026-01-07 16:00:32 +11:00
|
|
|
import { test, describe, beforeEach, afterEach } from 'node:test';
|
|
|
|
|
import assert from 'node:assert/strict';
|
|
|
|
|
import { loadConfig, DEFAULT_CONFIG, getConfigPath } from '../dist/config.js';
|
|
|
|
|
import * as path from 'node:path';
|
|
|
|
|
import * as os from 'node:os';
|
|
|
|
|
import * as fs from 'node:fs';
|
|
|
|
|
|
|
|
|
|
// Helper to create a temporary config for testing
|
|
|
|
|
function createTempConfig(configData) {
|
|
|
|
|
const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'claude-hud-test-'));
|
|
|
|
|
const configDir = path.join(tempDir, '.claude', 'plugins', 'claude-hud');
|
|
|
|
|
fs.mkdirSync(configDir, { recursive: true });
|
|
|
|
|
const configPath = path.join(configDir, 'config.json');
|
|
|
|
|
fs.writeFileSync(configPath, JSON.stringify(configData));
|
|
|
|
|
return { tempDir, configPath, cleanup: () => fs.rmSync(tempDir, { recursive: true, force: true }) };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
test('loadConfig returns valid config structure', async () => {
|
|
|
|
|
const config = await loadConfig();
|
|
|
|
|
// Should return valid pathLevels (1, 2, or 3)
|
|
|
|
|
assert.ok([1, 2, 3].includes(config.pathLevels), 'pathLevels should be 1, 2, or 3');
|
|
|
|
|
// Should have gitStatus object with expected properties
|
|
|
|
|
assert.equal(typeof config.gitStatus, 'object');
|
|
|
|
|
assert.equal(typeof config.gitStatus.enabled, 'boolean');
|
|
|
|
|
assert.equal(typeof config.gitStatus.showDirty, 'boolean');
|
|
|
|
|
assert.equal(typeof config.gitStatus.showAheadBehind, 'boolean');
|
|
|
|
|
// Should have display object with expected properties
|
|
|
|
|
assert.equal(typeof config.display, 'object');
|
|
|
|
|
assert.equal(typeof config.display.showModel, 'boolean');
|
|
|
|
|
assert.equal(typeof config.display.showContextBar, 'boolean');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('getConfigPath returns correct path', () => {
|
|
|
|
|
const configPath = getConfigPath();
|
|
|
|
|
const homeDir = os.homedir();
|
|
|
|
|
assert.equal(configPath, path.join(homeDir, '.claude', 'plugins', 'claude-hud', 'config.json'));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('DEFAULT_CONFIG has correct structure', () => {
|
|
|
|
|
assert.equal(DEFAULT_CONFIG.pathLevels, 1);
|
|
|
|
|
assert.equal(typeof DEFAULT_CONFIG.gitStatus, 'object');
|
|
|
|
|
assert.equal(DEFAULT_CONFIG.gitStatus.enabled, true);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('pathLevels can be 1, 2, or 3', () => {
|
|
|
|
|
assert.ok([1, 2, 3].includes(DEFAULT_CONFIG.pathLevels));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// DEFAULT_CONFIG comprehensive tests
|
|
|
|
|
describe('DEFAULT_CONFIG', () => {
|
|
|
|
|
test('has layout set to default', () => {
|
|
|
|
|
assert.equal(DEFAULT_CONFIG.layout, 'default');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('has all gitStatus properties', () => {
|
|
|
|
|
assert.equal(DEFAULT_CONFIG.gitStatus.enabled, true);
|
|
|
|
|
assert.equal(DEFAULT_CONFIG.gitStatus.showDirty, true);
|
|
|
|
|
assert.equal(DEFAULT_CONFIG.gitStatus.showAheadBehind, false);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('has all display properties', () => {
|
|
|
|
|
assert.equal(DEFAULT_CONFIG.display.showModel, true);
|
|
|
|
|
assert.equal(DEFAULT_CONFIG.display.showContextBar, true);
|
|
|
|
|
assert.equal(DEFAULT_CONFIG.display.showConfigCounts, true);
|
|
|
|
|
assert.equal(DEFAULT_CONFIG.display.showDuration, true);
|
|
|
|
|
assert.equal(DEFAULT_CONFIG.display.showTokenBreakdown, true);
|
|
|
|
|
assert.equal(DEFAULT_CONFIG.display.showTools, true);
|
|
|
|
|
assert.equal(DEFAULT_CONFIG.display.showAgents, true);
|
|
|
|
|
assert.equal(DEFAULT_CONFIG.display.showTodos, true);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Layout validation tests
|
|
|
|
|
describe('layout validation', () => {
|
|
|
|
|
test('accepts default layout', () => {
|
|
|
|
|
assert.equal(DEFAULT_CONFIG.layout, 'default');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('layout must be one of valid values', () => {
|
|
|
|
|
const validLayouts = ['default', 'condensed', 'separators'];
|
|
|
|
|
assert.ok(validLayouts.includes(DEFAULT_CONFIG.layout));
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// PathLevels validation tests
|
|
|
|
|
describe('pathLevels validation', () => {
|
|
|
|
|
test('pathLevels is 1 by default', () => {
|
|
|
|
|
assert.equal(DEFAULT_CONFIG.pathLevels, 1);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('pathLevels must be 1, 2, or 3', () => {
|
|
|
|
|
const validLevels = [1, 2, 3];
|
|
|
|
|
assert.ok(validLevels.includes(DEFAULT_CONFIG.pathLevels));
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Git status configuration tests
|
|
|
|
|
describe('gitStatus configuration', () => {
|
|
|
|
|
test('enabled is true by default', () => {
|
|
|
|
|
assert.equal(DEFAULT_CONFIG.gitStatus.enabled, true);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('showDirty is true by default', () => {
|
|
|
|
|
assert.equal(DEFAULT_CONFIG.gitStatus.showDirty, true);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('showAheadBehind is false by default', () => {
|
|
|
|
|
assert.equal(DEFAULT_CONFIG.gitStatus.showAheadBehind, false);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Display configuration tests
|
|
|
|
|
describe('display configuration', () => {
|
2026-01-09 11:58:46 +11:00
|
|
|
test('all boolean display options are booleans', () => {
|
|
|
|
|
const { autocompactBuffer, ...booleanOptions } = DEFAULT_CONFIG.display;
|
|
|
|
|
Object.values(booleanOptions).forEach(value => {
|
feat: config system + usage API + bug fixes (supersedes #32) (#35)
* feat: display last 3 path segments first in session line
Shows the last 3 segments of the working directory path at the
beginning of the session line for quick project identification.
Before: [Opus 4.5] ████░░░░░░ 19% | my-project git:(main) | ...
After: dev/apps/my-project git:(main) | [Opus 4.5] ████░░░░░░ 19% | ...
This helps distinguish between projects with similar names in
different locations and puts the most relevant info first.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: configurable path levels (1-3) and git status toggle
- Add config system at ~/.claude/plugins/claude-hud/config.json
- Default path display to 1 level (was hardcoded at 3)
- Add pathLevels option: 1, 2, or 3 directory segments
- Add gitStatus.enabled toggle to show/hide git branch
- Add interactive CLI: npx claude-hud-configure
- Add comprehensive tests for config and path levels
- Update README with configuration documentation
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: handle cross-platform path separators
- Split paths by both / and \ for Windows compatibility
- Always output forward slashes for consistent display
- Add tests for Windows paths, UNC paths, and mixed separators
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: show existing config when reconfiguring
- Display current values when config file exists
- Prompt user that Enter keeps current values
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: interactive CLI with arrow-key selection
- Add @inquirer/prompts for better UX
- Arrow keys to select path levels
- Visual feedback with checkmarks
- Cleaner, more compact output
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: add dirty indicator and ahead/behind git status
- Add gitStatus.showDirty option (default: true)
- Add gitStatus.showAheadBehind option (default: false)
- Update getGitStatus to return isDirty, ahead, behind
- Update CLI to configure new options with preview
- Add tests for dirty and ahead/behind display
- Update README with new options
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: add configurable display options for all HUD elements
- Add display configuration object with 8 boolean options:
- showModel: Toggle model name display [Opus]
- showContextBar: Toggle visual context bar ████░░░░░░
- showConfigCounts: Toggle CLAUDE.md, rules, MCPs, hooks counts
- showDuration: Toggle session duration display
- showTokenBreakdown: Toggle token details at high context (85%+)
- showTools: Toggle tools activity line
- showAgents: Toggle agents activity line
- showTodos: Toggle todos progress line
- All options default to true for backward compatibility
- Enhanced CLI preview with colors matching actual HUD output
- Added 5 new tests for display configuration (87 total)
- Updated README with complete configuration reference
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: add configurable layout options (default, condensed, separators)
- Add layout config option with three styles:
- default: All info on first line (original behavior)
- condensed: Model/context top, project bottom
- separators: Condensed with visual separator lines
- Create project-line.ts for rendering project path in split layouts
- Add renderSessionLineMinimal for condensed/separators layouts
- Interactive CLI preview shows selected layout style
- All 87 tests pass
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: add interactive HUD preview and folder icon
- Add live preview that updates as config options are selected
- Show initial preview on startup based on existing/default config
- Add folder icon (📁) in front of project path
- Extract preview generation to separate module for reuse
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* docs: update README with folder icon and live preview
- Add folder icon (📁) to all path examples
- Document live preview feature in interactive CLI section
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: add menu-based navigation to configure CLI
- Replace linear flow with main menu loop
- Show current values in menu (layout, path levels, git status, etc.)
- Users can edit any section and return to menu
- Preview updates after each section change
- Save & Exit or Exit without saving options
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: update tests for folder icon and config structure
- Update integration test expected output with folder icon
- Make config test environment-independent (validates structure, not specific values)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* test: add comprehensive config loading tests
Add 23 new tests for config system validation:
- DEFAULT_CONFIG structure (layout, gitStatus, 8 display options)
- Layout validation (default, condensed, separators)
- PathLevels validation (1, 2, or 3)
- Git status configuration defaults
- Display configuration (booleans, defaults to true, count)
- loadConfig behavior (complete fields, valid values)
- getConfigPath structure tests
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: add usage API, config enhancements, and bug fixes
This PR combines and enhances the config system from PR #32 with new features
and bug fixes addressing the owner's review feedback.
## New Features
- Usage API integration showing 5h/7d limits for Pro/Max/Team users
- Interactive `/claude-hud:configure` skill for in-Claude-Code configuration
- Hybrid showUsage toggle (env var + config for privacy control)
## Bug Fixes (addressing #32 review feedback)
- Fix git status spacing: `main*↑2↓1` → `main* ↑2 ↓1`
- Fix root path rendering: show `/` instead of empty folder icon
- Fix Windows path normalization in truncatePath
- Fix duplicate dependencies key in package.json
- Fix multiSelect for mutually exclusive options in configure skill
## Credits
- Config system, layouts, path levels, git toggle, CLI by @Tsopic (PR #32)
- Usage API, configure skill, bug fixes by @melon-hub
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Tsopic <Tsopic@users.noreply.github.com>
* fix: move configure command to correct location
- Move configure.md from .claude-plugin/skills/ to commands/
- Remove skills array from plugin.json (commands are auto-discovered)
Commands must be in the commands/ directory at plugin root,
not inside .claude-plugin/. This matches the existing setup.md pattern.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: layout order, remove condensed, redesign configure flow
Render fixes (per PR feedback):
- Fix element order: model first, project second
- Remove condensed layout (only default/separators remain)
- Separators: single line below header only when activity exists
- Delete project-line.ts (no longer needed)
- Remove renderSessionLineMinimal() function
Configure skill redesign:
- Context-aware tab order (returning users start on Turn Off)
- Explicit Turn Off/Turn On questions (no toggle ambiguity)
- Git Style question for dirty/ahead-behind options
- Combined Layout/Reset tab for returning users
- Duration now toggleable
- Guards against empty submissions
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* docs: rename 'Returning User' to 'Update Config' in configure flow
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* test: fix tests for new element order and removed function
- Update render-basic.txt expected output (model first, project second)
- Remove renderSessionLineMinimal import and test (function was deleted)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* docs: update documentation for usage API, config flow, and troubleshooting
- Remove stale CLAUDE_HUD_SHOW_USAGE env var references (now config-based)
- Add usage API data sources to CLAUDE.md
- Add new source files to file structure (config.ts, git.ts, usage-api.ts)
- Update README with usage limits section and requirements
- Add troubleshooting sections for config, git, and usage issues
- Standardize output examples across all documentation files
- Remove condensed layout references (only default/separators now)
- Update configure skill reference (npx CLI → /claude-hud:configure)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: remove dist/ from PR and update outdated comment
- Reset dist/ to main branch (dist will be built by CI after merge)
- Update comment: "requires env var opt-in AND config" → "shown when enabled in config"
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* chore: remove internal design doc from release
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* chore: remove CLI and runtime dependency
- Remove src/bin/configure.ts and src/bin/preview.ts
- Remove @inquirer/prompts dependency (plugins don't run npm install)
- Remove bin field from package.json
- Users configure via /claude-hud:configure skill instead
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* chore: bump version to 0.0.4
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: use file-based cache for usage API
HUD runs as a new process every ~300ms, so in-memory cache was useless.
Now caches to ~/.claude/plugins/claude-hud/.usage-cache.json.
This reduces API calls from ~10,800/hour to max 60/hour.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: use consistent homeDir/now in getUsage
Avoids potential divergence if deps functions are non-deterministic.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* test: add real tests for usage API file cache
- Test credential parsing with mock HOME directory
- Test cache TTL behavior (success and failure)
- Test apiUnavailable flag handling
- Replace placeholder assert.ok(true) with actual assertions
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Martin Kask <martin@industrial.ninja>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: melon-hub <melon-hub@users.noreply.github.com>
Co-authored-by: Tsopic <Tsopic@users.noreply.github.com>
Co-authored-by: Jarrod Watts <jarrod@cubelabs.xyz>
2026-01-07 16:00:32 +11:00
|
|
|
assert.equal(typeof value, 'boolean');
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2026-01-09 11:58:46 +11:00
|
|
|
test('all boolean display options default to true', () => {
|
|
|
|
|
const { autocompactBuffer, ...booleanOptions } = DEFAULT_CONFIG.display;
|
|
|
|
|
Object.values(booleanOptions).forEach(value => {
|
feat: config system + usage API + bug fixes (supersedes #32) (#35)
* feat: display last 3 path segments first in session line
Shows the last 3 segments of the working directory path at the
beginning of the session line for quick project identification.
Before: [Opus 4.5] ████░░░░░░ 19% | my-project git:(main) | ...
After: dev/apps/my-project git:(main) | [Opus 4.5] ████░░░░░░ 19% | ...
This helps distinguish between projects with similar names in
different locations and puts the most relevant info first.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: configurable path levels (1-3) and git status toggle
- Add config system at ~/.claude/plugins/claude-hud/config.json
- Default path display to 1 level (was hardcoded at 3)
- Add pathLevels option: 1, 2, or 3 directory segments
- Add gitStatus.enabled toggle to show/hide git branch
- Add interactive CLI: npx claude-hud-configure
- Add comprehensive tests for config and path levels
- Update README with configuration documentation
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: handle cross-platform path separators
- Split paths by both / and \ for Windows compatibility
- Always output forward slashes for consistent display
- Add tests for Windows paths, UNC paths, and mixed separators
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: show existing config when reconfiguring
- Display current values when config file exists
- Prompt user that Enter keeps current values
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: interactive CLI with arrow-key selection
- Add @inquirer/prompts for better UX
- Arrow keys to select path levels
- Visual feedback with checkmarks
- Cleaner, more compact output
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: add dirty indicator and ahead/behind git status
- Add gitStatus.showDirty option (default: true)
- Add gitStatus.showAheadBehind option (default: false)
- Update getGitStatus to return isDirty, ahead, behind
- Update CLI to configure new options with preview
- Add tests for dirty and ahead/behind display
- Update README with new options
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: add configurable display options for all HUD elements
- Add display configuration object with 8 boolean options:
- showModel: Toggle model name display [Opus]
- showContextBar: Toggle visual context bar ████░░░░░░
- showConfigCounts: Toggle CLAUDE.md, rules, MCPs, hooks counts
- showDuration: Toggle session duration display
- showTokenBreakdown: Toggle token details at high context (85%+)
- showTools: Toggle tools activity line
- showAgents: Toggle agents activity line
- showTodos: Toggle todos progress line
- All options default to true for backward compatibility
- Enhanced CLI preview with colors matching actual HUD output
- Added 5 new tests for display configuration (87 total)
- Updated README with complete configuration reference
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: add configurable layout options (default, condensed, separators)
- Add layout config option with three styles:
- default: All info on first line (original behavior)
- condensed: Model/context top, project bottom
- separators: Condensed with visual separator lines
- Create project-line.ts for rendering project path in split layouts
- Add renderSessionLineMinimal for condensed/separators layouts
- Interactive CLI preview shows selected layout style
- All 87 tests pass
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: add interactive HUD preview and folder icon
- Add live preview that updates as config options are selected
- Show initial preview on startup based on existing/default config
- Add folder icon (📁) in front of project path
- Extract preview generation to separate module for reuse
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* docs: update README with folder icon and live preview
- Add folder icon (📁) to all path examples
- Document live preview feature in interactive CLI section
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: add menu-based navigation to configure CLI
- Replace linear flow with main menu loop
- Show current values in menu (layout, path levels, git status, etc.)
- Users can edit any section and return to menu
- Preview updates after each section change
- Save & Exit or Exit without saving options
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: update tests for folder icon and config structure
- Update integration test expected output with folder icon
- Make config test environment-independent (validates structure, not specific values)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* test: add comprehensive config loading tests
Add 23 new tests for config system validation:
- DEFAULT_CONFIG structure (layout, gitStatus, 8 display options)
- Layout validation (default, condensed, separators)
- PathLevels validation (1, 2, or 3)
- Git status configuration defaults
- Display configuration (booleans, defaults to true, count)
- loadConfig behavior (complete fields, valid values)
- getConfigPath structure tests
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: add usage API, config enhancements, and bug fixes
This PR combines and enhances the config system from PR #32 with new features
and bug fixes addressing the owner's review feedback.
## New Features
- Usage API integration showing 5h/7d limits for Pro/Max/Team users
- Interactive `/claude-hud:configure` skill for in-Claude-Code configuration
- Hybrid showUsage toggle (env var + config for privacy control)
## Bug Fixes (addressing #32 review feedback)
- Fix git status spacing: `main*↑2↓1` → `main* ↑2 ↓1`
- Fix root path rendering: show `/` instead of empty folder icon
- Fix Windows path normalization in truncatePath
- Fix duplicate dependencies key in package.json
- Fix multiSelect for mutually exclusive options in configure skill
## Credits
- Config system, layouts, path levels, git toggle, CLI by @Tsopic (PR #32)
- Usage API, configure skill, bug fixes by @melon-hub
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Tsopic <Tsopic@users.noreply.github.com>
* fix: move configure command to correct location
- Move configure.md from .claude-plugin/skills/ to commands/
- Remove skills array from plugin.json (commands are auto-discovered)
Commands must be in the commands/ directory at plugin root,
not inside .claude-plugin/. This matches the existing setup.md pattern.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: layout order, remove condensed, redesign configure flow
Render fixes (per PR feedback):
- Fix element order: model first, project second
- Remove condensed layout (only default/separators remain)
- Separators: single line below header only when activity exists
- Delete project-line.ts (no longer needed)
- Remove renderSessionLineMinimal() function
Configure skill redesign:
- Context-aware tab order (returning users start on Turn Off)
- Explicit Turn Off/Turn On questions (no toggle ambiguity)
- Git Style question for dirty/ahead-behind options
- Combined Layout/Reset tab for returning users
- Duration now toggleable
- Guards against empty submissions
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* docs: rename 'Returning User' to 'Update Config' in configure flow
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* test: fix tests for new element order and removed function
- Update render-basic.txt expected output (model first, project second)
- Remove renderSessionLineMinimal import and test (function was deleted)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* docs: update documentation for usage API, config flow, and troubleshooting
- Remove stale CLAUDE_HUD_SHOW_USAGE env var references (now config-based)
- Add usage API data sources to CLAUDE.md
- Add new source files to file structure (config.ts, git.ts, usage-api.ts)
- Update README with usage limits section and requirements
- Add troubleshooting sections for config, git, and usage issues
- Standardize output examples across all documentation files
- Remove condensed layout references (only default/separators now)
- Update configure skill reference (npx CLI → /claude-hud:configure)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: remove dist/ from PR and update outdated comment
- Reset dist/ to main branch (dist will be built by CI after merge)
- Update comment: "requires env var opt-in AND config" → "shown when enabled in config"
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* chore: remove internal design doc from release
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* chore: remove CLI and runtime dependency
- Remove src/bin/configure.ts and src/bin/preview.ts
- Remove @inquirer/prompts dependency (plugins don't run npm install)
- Remove bin field from package.json
- Users configure via /claude-hud:configure skill instead
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* chore: bump version to 0.0.4
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: use file-based cache for usage API
HUD runs as a new process every ~300ms, so in-memory cache was useless.
Now caches to ~/.claude/plugins/claude-hud/.usage-cache.json.
This reduces API calls from ~10,800/hour to max 60/hour.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: use consistent homeDir/now in getUsage
Avoids potential divergence if deps functions are non-deterministic.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* test: add real tests for usage API file cache
- Test credential parsing with mock HOME directory
- Test cache TTL behavior (success and failure)
- Test apiUnavailable flag handling
- Replace placeholder assert.ok(true) with actual assertions
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Martin Kask <martin@industrial.ninja>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: melon-hub <melon-hub@users.noreply.github.com>
Co-authored-by: Tsopic <Tsopic@users.noreply.github.com>
Co-authored-by: Jarrod Watts <jarrod@cubelabs.xyz>
2026-01-07 16:00:32 +11:00
|
|
|
assert.equal(value, true);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2026-01-09 11:58:46 +11:00
|
|
|
test('autocompactBuffer defaults to enabled', () => {
|
|
|
|
|
assert.equal(DEFAULT_CONFIG.display.autocompactBuffer, 'enabled');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('has exactly 10 display options', () => {
|
feat: config system + usage API + bug fixes (supersedes #32) (#35)
* feat: display last 3 path segments first in session line
Shows the last 3 segments of the working directory path at the
beginning of the session line for quick project identification.
Before: [Opus 4.5] ████░░░░░░ 19% | my-project git:(main) | ...
After: dev/apps/my-project git:(main) | [Opus 4.5] ████░░░░░░ 19% | ...
This helps distinguish between projects with similar names in
different locations and puts the most relevant info first.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: configurable path levels (1-3) and git status toggle
- Add config system at ~/.claude/plugins/claude-hud/config.json
- Default path display to 1 level (was hardcoded at 3)
- Add pathLevels option: 1, 2, or 3 directory segments
- Add gitStatus.enabled toggle to show/hide git branch
- Add interactive CLI: npx claude-hud-configure
- Add comprehensive tests for config and path levels
- Update README with configuration documentation
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: handle cross-platform path separators
- Split paths by both / and \ for Windows compatibility
- Always output forward slashes for consistent display
- Add tests for Windows paths, UNC paths, and mixed separators
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: show existing config when reconfiguring
- Display current values when config file exists
- Prompt user that Enter keeps current values
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: interactive CLI with arrow-key selection
- Add @inquirer/prompts for better UX
- Arrow keys to select path levels
- Visual feedback with checkmarks
- Cleaner, more compact output
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: add dirty indicator and ahead/behind git status
- Add gitStatus.showDirty option (default: true)
- Add gitStatus.showAheadBehind option (default: false)
- Update getGitStatus to return isDirty, ahead, behind
- Update CLI to configure new options with preview
- Add tests for dirty and ahead/behind display
- Update README with new options
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: add configurable display options for all HUD elements
- Add display configuration object with 8 boolean options:
- showModel: Toggle model name display [Opus]
- showContextBar: Toggle visual context bar ████░░░░░░
- showConfigCounts: Toggle CLAUDE.md, rules, MCPs, hooks counts
- showDuration: Toggle session duration display
- showTokenBreakdown: Toggle token details at high context (85%+)
- showTools: Toggle tools activity line
- showAgents: Toggle agents activity line
- showTodos: Toggle todos progress line
- All options default to true for backward compatibility
- Enhanced CLI preview with colors matching actual HUD output
- Added 5 new tests for display configuration (87 total)
- Updated README with complete configuration reference
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: add configurable layout options (default, condensed, separators)
- Add layout config option with three styles:
- default: All info on first line (original behavior)
- condensed: Model/context top, project bottom
- separators: Condensed with visual separator lines
- Create project-line.ts for rendering project path in split layouts
- Add renderSessionLineMinimal for condensed/separators layouts
- Interactive CLI preview shows selected layout style
- All 87 tests pass
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: add interactive HUD preview and folder icon
- Add live preview that updates as config options are selected
- Show initial preview on startup based on existing/default config
- Add folder icon (📁) in front of project path
- Extract preview generation to separate module for reuse
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* docs: update README with folder icon and live preview
- Add folder icon (📁) to all path examples
- Document live preview feature in interactive CLI section
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: add menu-based navigation to configure CLI
- Replace linear flow with main menu loop
- Show current values in menu (layout, path levels, git status, etc.)
- Users can edit any section and return to menu
- Preview updates after each section change
- Save & Exit or Exit without saving options
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: update tests for folder icon and config structure
- Update integration test expected output with folder icon
- Make config test environment-independent (validates structure, not specific values)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* test: add comprehensive config loading tests
Add 23 new tests for config system validation:
- DEFAULT_CONFIG structure (layout, gitStatus, 8 display options)
- Layout validation (default, condensed, separators)
- PathLevels validation (1, 2, or 3)
- Git status configuration defaults
- Display configuration (booleans, defaults to true, count)
- loadConfig behavior (complete fields, valid values)
- getConfigPath structure tests
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: add usage API, config enhancements, and bug fixes
This PR combines and enhances the config system from PR #32 with new features
and bug fixes addressing the owner's review feedback.
## New Features
- Usage API integration showing 5h/7d limits for Pro/Max/Team users
- Interactive `/claude-hud:configure` skill for in-Claude-Code configuration
- Hybrid showUsage toggle (env var + config for privacy control)
## Bug Fixes (addressing #32 review feedback)
- Fix git status spacing: `main*↑2↓1` → `main* ↑2 ↓1`
- Fix root path rendering: show `/` instead of empty folder icon
- Fix Windows path normalization in truncatePath
- Fix duplicate dependencies key in package.json
- Fix multiSelect for mutually exclusive options in configure skill
## Credits
- Config system, layouts, path levels, git toggle, CLI by @Tsopic (PR #32)
- Usage API, configure skill, bug fixes by @melon-hub
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Tsopic <Tsopic@users.noreply.github.com>
* fix: move configure command to correct location
- Move configure.md from .claude-plugin/skills/ to commands/
- Remove skills array from plugin.json (commands are auto-discovered)
Commands must be in the commands/ directory at plugin root,
not inside .claude-plugin/. This matches the existing setup.md pattern.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: layout order, remove condensed, redesign configure flow
Render fixes (per PR feedback):
- Fix element order: model first, project second
- Remove condensed layout (only default/separators remain)
- Separators: single line below header only when activity exists
- Delete project-line.ts (no longer needed)
- Remove renderSessionLineMinimal() function
Configure skill redesign:
- Context-aware tab order (returning users start on Turn Off)
- Explicit Turn Off/Turn On questions (no toggle ambiguity)
- Git Style question for dirty/ahead-behind options
- Combined Layout/Reset tab for returning users
- Duration now toggleable
- Guards against empty submissions
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* docs: rename 'Returning User' to 'Update Config' in configure flow
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* test: fix tests for new element order and removed function
- Update render-basic.txt expected output (model first, project second)
- Remove renderSessionLineMinimal import and test (function was deleted)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* docs: update documentation for usage API, config flow, and troubleshooting
- Remove stale CLAUDE_HUD_SHOW_USAGE env var references (now config-based)
- Add usage API data sources to CLAUDE.md
- Add new source files to file structure (config.ts, git.ts, usage-api.ts)
- Update README with usage limits section and requirements
- Add troubleshooting sections for config, git, and usage issues
- Standardize output examples across all documentation files
- Remove condensed layout references (only default/separators now)
- Update configure skill reference (npx CLI → /claude-hud:configure)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: remove dist/ from PR and update outdated comment
- Reset dist/ to main branch (dist will be built by CI after merge)
- Update comment: "requires env var opt-in AND config" → "shown when enabled in config"
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* chore: remove internal design doc from release
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* chore: remove CLI and runtime dependency
- Remove src/bin/configure.ts and src/bin/preview.ts
- Remove @inquirer/prompts dependency (plugins don't run npm install)
- Remove bin field from package.json
- Users configure via /claude-hud:configure skill instead
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* chore: bump version to 0.0.4
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: use file-based cache for usage API
HUD runs as a new process every ~300ms, so in-memory cache was useless.
Now caches to ~/.claude/plugins/claude-hud/.usage-cache.json.
This reduces API calls from ~10,800/hour to max 60/hour.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: use consistent homeDir/now in getUsage
Avoids potential divergence if deps functions are non-deterministic.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* test: add real tests for usage API file cache
- Test credential parsing with mock HOME directory
- Test cache TTL behavior (success and failure)
- Test apiUnavailable flag handling
- Replace placeholder assert.ok(true) with actual assertions
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Martin Kask <martin@industrial.ninja>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: melon-hub <melon-hub@users.noreply.github.com>
Co-authored-by: Tsopic <Tsopic@users.noreply.github.com>
Co-authored-by: Jarrod Watts <jarrod@cubelabs.xyz>
2026-01-07 16:00:32 +11:00
|
|
|
const optionCount = Object.keys(DEFAULT_CONFIG.display).length;
|
2026-01-09 11:58:46 +11:00
|
|
|
assert.equal(optionCount, 10);
|
feat: config system + usage API + bug fixes (supersedes #32) (#35)
* feat: display last 3 path segments first in session line
Shows the last 3 segments of the working directory path at the
beginning of the session line for quick project identification.
Before: [Opus 4.5] ████░░░░░░ 19% | my-project git:(main) | ...
After: dev/apps/my-project git:(main) | [Opus 4.5] ████░░░░░░ 19% | ...
This helps distinguish between projects with similar names in
different locations and puts the most relevant info first.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: configurable path levels (1-3) and git status toggle
- Add config system at ~/.claude/plugins/claude-hud/config.json
- Default path display to 1 level (was hardcoded at 3)
- Add pathLevels option: 1, 2, or 3 directory segments
- Add gitStatus.enabled toggle to show/hide git branch
- Add interactive CLI: npx claude-hud-configure
- Add comprehensive tests for config and path levels
- Update README with configuration documentation
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: handle cross-platform path separators
- Split paths by both / and \ for Windows compatibility
- Always output forward slashes for consistent display
- Add tests for Windows paths, UNC paths, and mixed separators
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: show existing config when reconfiguring
- Display current values when config file exists
- Prompt user that Enter keeps current values
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: interactive CLI with arrow-key selection
- Add @inquirer/prompts for better UX
- Arrow keys to select path levels
- Visual feedback with checkmarks
- Cleaner, more compact output
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: add dirty indicator and ahead/behind git status
- Add gitStatus.showDirty option (default: true)
- Add gitStatus.showAheadBehind option (default: false)
- Update getGitStatus to return isDirty, ahead, behind
- Update CLI to configure new options with preview
- Add tests for dirty and ahead/behind display
- Update README with new options
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: add configurable display options for all HUD elements
- Add display configuration object with 8 boolean options:
- showModel: Toggle model name display [Opus]
- showContextBar: Toggle visual context bar ████░░░░░░
- showConfigCounts: Toggle CLAUDE.md, rules, MCPs, hooks counts
- showDuration: Toggle session duration display
- showTokenBreakdown: Toggle token details at high context (85%+)
- showTools: Toggle tools activity line
- showAgents: Toggle agents activity line
- showTodos: Toggle todos progress line
- All options default to true for backward compatibility
- Enhanced CLI preview with colors matching actual HUD output
- Added 5 new tests for display configuration (87 total)
- Updated README with complete configuration reference
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: add configurable layout options (default, condensed, separators)
- Add layout config option with three styles:
- default: All info on first line (original behavior)
- condensed: Model/context top, project bottom
- separators: Condensed with visual separator lines
- Create project-line.ts for rendering project path in split layouts
- Add renderSessionLineMinimal for condensed/separators layouts
- Interactive CLI preview shows selected layout style
- All 87 tests pass
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: add interactive HUD preview and folder icon
- Add live preview that updates as config options are selected
- Show initial preview on startup based on existing/default config
- Add folder icon (📁) in front of project path
- Extract preview generation to separate module for reuse
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* docs: update README with folder icon and live preview
- Add folder icon (📁) to all path examples
- Document live preview feature in interactive CLI section
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: add menu-based navigation to configure CLI
- Replace linear flow with main menu loop
- Show current values in menu (layout, path levels, git status, etc.)
- Users can edit any section and return to menu
- Preview updates after each section change
- Save & Exit or Exit without saving options
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: update tests for folder icon and config structure
- Update integration test expected output with folder icon
- Make config test environment-independent (validates structure, not specific values)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* test: add comprehensive config loading tests
Add 23 new tests for config system validation:
- DEFAULT_CONFIG structure (layout, gitStatus, 8 display options)
- Layout validation (default, condensed, separators)
- PathLevels validation (1, 2, or 3)
- Git status configuration defaults
- Display configuration (booleans, defaults to true, count)
- loadConfig behavior (complete fields, valid values)
- getConfigPath structure tests
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: add usage API, config enhancements, and bug fixes
This PR combines and enhances the config system from PR #32 with new features
and bug fixes addressing the owner's review feedback.
## New Features
- Usage API integration showing 5h/7d limits for Pro/Max/Team users
- Interactive `/claude-hud:configure` skill for in-Claude-Code configuration
- Hybrid showUsage toggle (env var + config for privacy control)
## Bug Fixes (addressing #32 review feedback)
- Fix git status spacing: `main*↑2↓1` → `main* ↑2 ↓1`
- Fix root path rendering: show `/` instead of empty folder icon
- Fix Windows path normalization in truncatePath
- Fix duplicate dependencies key in package.json
- Fix multiSelect for mutually exclusive options in configure skill
## Credits
- Config system, layouts, path levels, git toggle, CLI by @Tsopic (PR #32)
- Usage API, configure skill, bug fixes by @melon-hub
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Tsopic <Tsopic@users.noreply.github.com>
* fix: move configure command to correct location
- Move configure.md from .claude-plugin/skills/ to commands/
- Remove skills array from plugin.json (commands are auto-discovered)
Commands must be in the commands/ directory at plugin root,
not inside .claude-plugin/. This matches the existing setup.md pattern.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: layout order, remove condensed, redesign configure flow
Render fixes (per PR feedback):
- Fix element order: model first, project second
- Remove condensed layout (only default/separators remain)
- Separators: single line below header only when activity exists
- Delete project-line.ts (no longer needed)
- Remove renderSessionLineMinimal() function
Configure skill redesign:
- Context-aware tab order (returning users start on Turn Off)
- Explicit Turn Off/Turn On questions (no toggle ambiguity)
- Git Style question for dirty/ahead-behind options
- Combined Layout/Reset tab for returning users
- Duration now toggleable
- Guards against empty submissions
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* docs: rename 'Returning User' to 'Update Config' in configure flow
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* test: fix tests for new element order and removed function
- Update render-basic.txt expected output (model first, project second)
- Remove renderSessionLineMinimal import and test (function was deleted)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* docs: update documentation for usage API, config flow, and troubleshooting
- Remove stale CLAUDE_HUD_SHOW_USAGE env var references (now config-based)
- Add usage API data sources to CLAUDE.md
- Add new source files to file structure (config.ts, git.ts, usage-api.ts)
- Update README with usage limits section and requirements
- Add troubleshooting sections for config, git, and usage issues
- Standardize output examples across all documentation files
- Remove condensed layout references (only default/separators now)
- Update configure skill reference (npx CLI → /claude-hud:configure)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: remove dist/ from PR and update outdated comment
- Reset dist/ to main branch (dist will be built by CI after merge)
- Update comment: "requires env var opt-in AND config" → "shown when enabled in config"
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* chore: remove internal design doc from release
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* chore: remove CLI and runtime dependency
- Remove src/bin/configure.ts and src/bin/preview.ts
- Remove @inquirer/prompts dependency (plugins don't run npm install)
- Remove bin field from package.json
- Users configure via /claude-hud:configure skill instead
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* chore: bump version to 0.0.4
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: use file-based cache for usage API
HUD runs as a new process every ~300ms, so in-memory cache was useless.
Now caches to ~/.claude/plugins/claude-hud/.usage-cache.json.
This reduces API calls from ~10,800/hour to max 60/hour.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: use consistent homeDir/now in getUsage
Avoids potential divergence if deps functions are non-deterministic.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* test: add real tests for usage API file cache
- Test credential parsing with mock HOME directory
- Test cache TTL behavior (success and failure)
- Test apiUnavailable flag handling
- Replace placeholder assert.ok(true) with actual assertions
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Martin Kask <martin@industrial.ninja>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: melon-hub <melon-hub@users.noreply.github.com>
Co-authored-by: Tsopic <Tsopic@users.noreply.github.com>
Co-authored-by: Jarrod Watts <jarrod@cubelabs.xyz>
2026-01-07 16:00:32 +11:00
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Config loading behavior tests
|
|
|
|
|
describe('loadConfig behavior', () => {
|
|
|
|
|
test('returns complete config with all required fields', async () => {
|
|
|
|
|
const config = await loadConfig();
|
|
|
|
|
|
|
|
|
|
// Check top-level fields exist
|
|
|
|
|
assert.ok('layout' in config);
|
|
|
|
|
assert.ok('pathLevels' in config);
|
|
|
|
|
assert.ok('gitStatus' in config);
|
|
|
|
|
assert.ok('display' in config);
|
|
|
|
|
|
|
|
|
|
// Check gitStatus fields
|
|
|
|
|
assert.ok('enabled' in config.gitStatus);
|
|
|
|
|
assert.ok('showDirty' in config.gitStatus);
|
|
|
|
|
assert.ok('showAheadBehind' in config.gitStatus);
|
|
|
|
|
|
|
|
|
|
// Check display fields
|
|
|
|
|
assert.ok('showModel' in config.display);
|
|
|
|
|
assert.ok('showContextBar' in config.display);
|
|
|
|
|
assert.ok('showConfigCounts' in config.display);
|
|
|
|
|
assert.ok('showDuration' in config.display);
|
|
|
|
|
assert.ok('showTokenBreakdown' in config.display);
|
|
|
|
|
assert.ok('showUsage' in config.display);
|
2026-01-09 11:58:46 +11:00
|
|
|
assert.ok('autocompactBuffer' in config.display);
|
feat: config system + usage API + bug fixes (supersedes #32) (#35)
* feat: display last 3 path segments first in session line
Shows the last 3 segments of the working directory path at the
beginning of the session line for quick project identification.
Before: [Opus 4.5] ████░░░░░░ 19% | my-project git:(main) | ...
After: dev/apps/my-project git:(main) | [Opus 4.5] ████░░░░░░ 19% | ...
This helps distinguish between projects with similar names in
different locations and puts the most relevant info first.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: configurable path levels (1-3) and git status toggle
- Add config system at ~/.claude/plugins/claude-hud/config.json
- Default path display to 1 level (was hardcoded at 3)
- Add pathLevels option: 1, 2, or 3 directory segments
- Add gitStatus.enabled toggle to show/hide git branch
- Add interactive CLI: npx claude-hud-configure
- Add comprehensive tests for config and path levels
- Update README with configuration documentation
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: handle cross-platform path separators
- Split paths by both / and \ for Windows compatibility
- Always output forward slashes for consistent display
- Add tests for Windows paths, UNC paths, and mixed separators
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: show existing config when reconfiguring
- Display current values when config file exists
- Prompt user that Enter keeps current values
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: interactive CLI with arrow-key selection
- Add @inquirer/prompts for better UX
- Arrow keys to select path levels
- Visual feedback with checkmarks
- Cleaner, more compact output
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: add dirty indicator and ahead/behind git status
- Add gitStatus.showDirty option (default: true)
- Add gitStatus.showAheadBehind option (default: false)
- Update getGitStatus to return isDirty, ahead, behind
- Update CLI to configure new options with preview
- Add tests for dirty and ahead/behind display
- Update README with new options
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: add configurable display options for all HUD elements
- Add display configuration object with 8 boolean options:
- showModel: Toggle model name display [Opus]
- showContextBar: Toggle visual context bar ████░░░░░░
- showConfigCounts: Toggle CLAUDE.md, rules, MCPs, hooks counts
- showDuration: Toggle session duration display
- showTokenBreakdown: Toggle token details at high context (85%+)
- showTools: Toggle tools activity line
- showAgents: Toggle agents activity line
- showTodos: Toggle todos progress line
- All options default to true for backward compatibility
- Enhanced CLI preview with colors matching actual HUD output
- Added 5 new tests for display configuration (87 total)
- Updated README with complete configuration reference
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: add configurable layout options (default, condensed, separators)
- Add layout config option with three styles:
- default: All info on first line (original behavior)
- condensed: Model/context top, project bottom
- separators: Condensed with visual separator lines
- Create project-line.ts for rendering project path in split layouts
- Add renderSessionLineMinimal for condensed/separators layouts
- Interactive CLI preview shows selected layout style
- All 87 tests pass
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: add interactive HUD preview and folder icon
- Add live preview that updates as config options are selected
- Show initial preview on startup based on existing/default config
- Add folder icon (📁) in front of project path
- Extract preview generation to separate module for reuse
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* docs: update README with folder icon and live preview
- Add folder icon (📁) to all path examples
- Document live preview feature in interactive CLI section
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: add menu-based navigation to configure CLI
- Replace linear flow with main menu loop
- Show current values in menu (layout, path levels, git status, etc.)
- Users can edit any section and return to menu
- Preview updates after each section change
- Save & Exit or Exit without saving options
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: update tests for folder icon and config structure
- Update integration test expected output with folder icon
- Make config test environment-independent (validates structure, not specific values)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* test: add comprehensive config loading tests
Add 23 new tests for config system validation:
- DEFAULT_CONFIG structure (layout, gitStatus, 8 display options)
- Layout validation (default, condensed, separators)
- PathLevels validation (1, 2, or 3)
- Git status configuration defaults
- Display configuration (booleans, defaults to true, count)
- loadConfig behavior (complete fields, valid values)
- getConfigPath structure tests
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: add usage API, config enhancements, and bug fixes
This PR combines and enhances the config system from PR #32 with new features
and bug fixes addressing the owner's review feedback.
## New Features
- Usage API integration showing 5h/7d limits for Pro/Max/Team users
- Interactive `/claude-hud:configure` skill for in-Claude-Code configuration
- Hybrid showUsage toggle (env var + config for privacy control)
## Bug Fixes (addressing #32 review feedback)
- Fix git status spacing: `main*↑2↓1` → `main* ↑2 ↓1`
- Fix root path rendering: show `/` instead of empty folder icon
- Fix Windows path normalization in truncatePath
- Fix duplicate dependencies key in package.json
- Fix multiSelect for mutually exclusive options in configure skill
## Credits
- Config system, layouts, path levels, git toggle, CLI by @Tsopic (PR #32)
- Usage API, configure skill, bug fixes by @melon-hub
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Tsopic <Tsopic@users.noreply.github.com>
* fix: move configure command to correct location
- Move configure.md from .claude-plugin/skills/ to commands/
- Remove skills array from plugin.json (commands are auto-discovered)
Commands must be in the commands/ directory at plugin root,
not inside .claude-plugin/. This matches the existing setup.md pattern.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: layout order, remove condensed, redesign configure flow
Render fixes (per PR feedback):
- Fix element order: model first, project second
- Remove condensed layout (only default/separators remain)
- Separators: single line below header only when activity exists
- Delete project-line.ts (no longer needed)
- Remove renderSessionLineMinimal() function
Configure skill redesign:
- Context-aware tab order (returning users start on Turn Off)
- Explicit Turn Off/Turn On questions (no toggle ambiguity)
- Git Style question for dirty/ahead-behind options
- Combined Layout/Reset tab for returning users
- Duration now toggleable
- Guards against empty submissions
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* docs: rename 'Returning User' to 'Update Config' in configure flow
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* test: fix tests for new element order and removed function
- Update render-basic.txt expected output (model first, project second)
- Remove renderSessionLineMinimal import and test (function was deleted)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* docs: update documentation for usage API, config flow, and troubleshooting
- Remove stale CLAUDE_HUD_SHOW_USAGE env var references (now config-based)
- Add usage API data sources to CLAUDE.md
- Add new source files to file structure (config.ts, git.ts, usage-api.ts)
- Update README with usage limits section and requirements
- Add troubleshooting sections for config, git, and usage issues
- Standardize output examples across all documentation files
- Remove condensed layout references (only default/separators now)
- Update configure skill reference (npx CLI → /claude-hud:configure)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: remove dist/ from PR and update outdated comment
- Reset dist/ to main branch (dist will be built by CI after merge)
- Update comment: "requires env var opt-in AND config" → "shown when enabled in config"
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* chore: remove internal design doc from release
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* chore: remove CLI and runtime dependency
- Remove src/bin/configure.ts and src/bin/preview.ts
- Remove @inquirer/prompts dependency (plugins don't run npm install)
- Remove bin field from package.json
- Users configure via /claude-hud:configure skill instead
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* chore: bump version to 0.0.4
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: use file-based cache for usage API
HUD runs as a new process every ~300ms, so in-memory cache was useless.
Now caches to ~/.claude/plugins/claude-hud/.usage-cache.json.
This reduces API calls from ~10,800/hour to max 60/hour.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: use consistent homeDir/now in getUsage
Avoids potential divergence if deps functions are non-deterministic.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* test: add real tests for usage API file cache
- Test credential parsing with mock HOME directory
- Test cache TTL behavior (success and failure)
- Test apiUnavailable flag handling
- Replace placeholder assert.ok(true) with actual assertions
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Martin Kask <martin@industrial.ninja>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: melon-hub <melon-hub@users.noreply.github.com>
Co-authored-by: Tsopic <Tsopic@users.noreply.github.com>
Co-authored-by: Jarrod Watts <jarrod@cubelabs.xyz>
2026-01-07 16:00:32 +11:00
|
|
|
assert.ok('showTools' in config.display);
|
|
|
|
|
assert.ok('showAgents' in config.display);
|
|
|
|
|
assert.ok('showTodos' in config.display);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('returns valid layout value', async () => {
|
|
|
|
|
const config = await loadConfig();
|
|
|
|
|
const validLayouts = ['default', 'condensed', 'separators'];
|
|
|
|
|
assert.ok(validLayouts.includes(config.layout));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('returns valid pathLevels value', async () => {
|
|
|
|
|
const config = await loadConfig();
|
|
|
|
|
assert.ok([1, 2, 3].includes(config.pathLevels));
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Config path tests
|
|
|
|
|
describe('getConfigPath', () => {
|
|
|
|
|
test('returns path under home directory', () => {
|
|
|
|
|
const configPath = getConfigPath();
|
|
|
|
|
const homeDir = os.homedir();
|
|
|
|
|
assert.ok(configPath.startsWith(homeDir));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('returns path with .claude directory', () => {
|
|
|
|
|
const configPath = getConfigPath();
|
|
|
|
|
assert.ok(configPath.includes('.claude'));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('returns path with plugins/claude-hud', () => {
|
|
|
|
|
const configPath = getConfigPath();
|
|
|
|
|
assert.ok(configPath.includes(path.join('plugins', 'claude-hud')));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test('returns path ending with config.json', () => {
|
|
|
|
|
const configPath = getConfigPath();
|
|
|
|
|
assert.ok(configPath.endsWith('config.json'));
|
|
|
|
|
});
|
|
|
|
|
});
|