docs: add project documentation and improve robustness

- Add ARCHITECTURE.md, FAQ.md, LLM.md documentation
- Add LICENSE (MIT), CODE_OF_CONDUCT.md, PR template
- Add .editorconfig for consistent formatting
- Add check.sh script for validation
- Fix ESLint errors in hud-config.ts and settings-reader.ts
- Various test and component improvements

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Jarrod Watts
2026-01-03 12:17:50 +11:00
parent 4b166e5e94
commit 36b2a09210
36 changed files with 1140 additions and 497 deletions

21
scripts/check.sh Executable file
View File

@@ -0,0 +1,21 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$ROOT_DIR/tui"
echo "==> Installing dependencies"
bun install
echo "==> Lint"
bun run lint
echo "==> Typecheck"
bun run typecheck
echo "==> Test"
bun test
echo "==> Build"
bun run build

View File

@@ -16,9 +16,25 @@ fi
HUD_DIR="$HOME/.claude/hud"
EVENT_FIFO="$HUD_DIR/events/$SESSION_ID.fifo"
PID_FILE="$HUD_DIR/pids/$SESSION_ID.pid"
REFRESH_FILE="$HUD_DIR/refresh.json"
# Only clean up the FIFO, not the HUD process
# HUD persists across sessions for /new and /resume
# Only close the HUD if this session is still the active one.
# This keeps HUD alive for /new while closing on /exit or terminal close.
if [ -f "$REFRESH_FILE" ]; then
CURRENT_SESSION=$(jq -r '.sessionId // empty' "$REFRESH_FILE" 2>/dev/null)
if [ "$CURRENT_SESSION" = "$SESSION_ID" ]; then
if [ -f "$PID_FILE" ]; then
PID=$(cat "$PID_FILE" 2>/dev/null)
if [ -n "$PID" ] && kill -0 "$PID" 2>/dev/null; then
kill "$PID" 2>/dev/null || true
fi
fi
fi
fi
# Clean up FIFO and pid file for this session
rm -f "$EVENT_FIFO"
rm -f "$PID_FILE"
exit 0

View File

@@ -26,22 +26,9 @@ REFRESH_FILE="$HUD_DIR/refresh.json"
rm -f "$EVENT_FIFO"
mkfifo "$EVENT_FIFO"
if [ ! -d "$PLUGIN_ROOT/tui/node_modules" ]; then
cd "$PLUGIN_ROOT/tui"
if command -v bun &> /dev/null; then
bun install --silent 2>/dev/null || true
elif command -v npm &> /dev/null; then
npm install --silent 2>/dev/null || true
fi
fi
if [ ! -f "$PLUGIN_ROOT/tui/dist/index.js" ]; then
cd "$PLUGIN_ROOT/tui"
if command -v bun &> /dev/null; then
bun run build 2>/dev/null || true
elif command -v npm &> /dev/null; then
npm run build 2>/dev/null || true
fi
echo "claude-hud build missing. Run 'bun install' and 'bun run build' in $PLUGIN_ROOT/tui." >&2
exit 1
fi
if command -v bun &> /dev/null; then