claude-code-hud 0.3.10 → 0.3.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/tui/hud.tsx +17 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-code-hud",
3
- "version": "0.3.10",
3
+ "version": "0.3.11",
4
4
  "description": "Terminal HUD for Claude Code — real-time token usage, git status, project monitor",
5
5
  "type": "module",
6
6
  "bin": {
package/tui/hud.tsx CHANGED
@@ -3,7 +3,7 @@
3
3
  * HUD Live — Ink TUI
4
4
  * Run: npm run hud (from hud-plugin root)
5
5
  */
6
- import React, { useState, useEffect, useCallback } from 'react';
6
+ import React, { useState, useEffect, useCallback, useRef } from 'react';
7
7
  import { render, Box, Text, useStdout, useInput } from 'ink';
8
8
  import { fileURLToPath } from 'url';
9
9
  import { dirname, join, basename } from 'path';
@@ -601,6 +601,13 @@ function ProjectTab({ info, treeCursor, treeExpanded, selectedFile, fileLines, f
601
601
 
602
602
  // ── Tab 3: GIT ─────────────────────────────────────────────────────────────
603
603
  function GitTab({ git, C, termWidth, branchMode, branchList, branchCursor }: any) {
604
+ if (!git.isRepo) return (
605
+ <Box flexDirection="column" borderStyle="single" borderColor={C.border} paddingX={1}>
606
+ <Text color={C.dimmer}>⚠ git repository not found in this directory</Text>
607
+ <Text color={C.dimmer}> cd into a git repo to see branch, diff, and commit info</Text>
608
+ </Box>
609
+ );
610
+
604
611
  const gitFiles = [
605
612
  ...(git.modified ?? []).map((f: string) => ({ status: 'MOD', path: f })),
606
613
  ...(git.added ?? []).map((f: string) => ({ status: 'ADD', path: f })),
@@ -770,6 +777,9 @@ function App() {
770
777
  const [spinFrame, setSpinFrame] = useState(0);
771
778
  const SPIN = ['⠋','⠙','⠹','⠸','⠼','⠴','⠦','⠧','⠇','⠏'];
772
779
 
780
+ // q key debounce ref (require 2 presses within 600ms to quit)
781
+ const lastQRef = useRef(0);
782
+
773
783
  // Branch switcher state
774
784
  const [branchMode, setBranchMode] = useState(false);
775
785
  const [branchList, setBranchList] = useState<string[]>([]);
@@ -897,7 +907,12 @@ function App() {
897
907
  return;
898
908
  }
899
909
 
900
- if (input === 'q' || input === 'ㅂ') process.exit(0);
910
+ if (input === 'q' || input === 'ㅂ') {
911
+ const now = Date.now();
912
+ if (now - lastQRef.current < 600) { process.exit(0); }
913
+ lastQRef.current = now;
914
+ return;
915
+ }
901
916
 
902
917
  // Escape: close file viewer first, then quit
903
918
  if (key.escape) {