Rewrite in Go: static binaries, zero runtime dependencies
Some checks failed
Release / build (push) Failing after 21s

Replace Node.js + Python codebase with three Go binaries:
- claude-statusline: CLI status bar for Claude Code
- claude-fetcher: standalone cron job for API usage
- claude-widget: system tray icon (fyne-io/systray + fogleman/gg)

All CGO-free for trivial cross-compilation. Add nfpm .deb packaging
with autostart and cron. CI pipeline produces Linux + Windows binaries,
.deb, .tar.gz, and .zip release assets.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Axel Meyer
2026-02-26 15:27:10 +00:00
parent 59afabd65a
commit 7f17a40b7c
33 changed files with 1275 additions and 1512 deletions

View File

@@ -0,0 +1,3 @@
# Fetch Claude API usage every 5 minutes (all users with a session key)
# Installed by claude-statusline package
*/5 * * * * root /usr/bin/claude-fetcher 2>/dev/null

View File

@@ -0,0 +1,9 @@
[Desktop Entry]
Type=Application
Name=Claude Usage Widget
Comment=System tray widget showing Claude API token usage
Exec=/usr/bin/claude-widget
Terminal=false
Categories=Utility;
StartupNotify=false
X-GNOME-Autostart-enabled=true

21
packaging/linux/postinstall.sh Executable file
View File

@@ -0,0 +1,21 @@
#!/bin/sh
set -e
CONFIG_DIR="${HOME}/.config/claude-statusline"
mkdir -p "$CONFIG_DIR"
if [ ! -f "$CONFIG_DIR/session-key" ]; then
touch "$CONFIG_DIR/session-key"
chmod 600 "$CONFIG_DIR/session-key"
echo ""
echo "=== Claude Statusline ==="
echo "Paste your claude.ai session key into:"
echo " $CONFIG_DIR/session-key"
echo ""
echo "To get your session key:"
echo " 1. Open claude.ai in your browser"
echo " 2. Open DevTools (F12) → Application → Cookies"
echo " 3. Copy the 'sessionKey' cookie value"
echo "========================="
echo ""
fi

3
packaging/linux/preremove.sh Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/sh
# Kill running widget if any
pkill -f claude-widget 2>/dev/null || true

43
packaging/nfpm.yaml Normal file
View File

@@ -0,0 +1,43 @@
name: claude-statusline
arch: amd64
platform: linux
version: "${VERSION}"
section: utils
priority: optional
maintainer: Axel Meyer <axel.meyer@durania.net>
description: |
Claude API usage monitor — CLI statusline, cron fetcher, and desktop tray widget.
Shows 5-hour and 7-day token usage from claude.ai in your terminal or system tray.
vendor: davoryn.de
homepage: https://git.davoryn.de/calic/claude-statusline
license: MIT
contents:
- src: ./claude-statusline
dst: /usr/bin/claude-statusline
file_info:
mode: 0755
- src: ./claude-fetcher
dst: /usr/bin/claude-fetcher
file_info:
mode: 0755
- src: ./claude-widget
dst: /usr/bin/claude-widget
file_info:
mode: 0755
- src: ./packaging/linux/claude-widget.desktop
dst: /etc/xdg/autostart/claude-widget.desktop
file_info:
mode: 0644
- src: ./packaging/linux/claude-statusline-fetch
dst: /etc/cron.d/claude-statusline-fetch
file_info:
mode: 0644
scripts:
postinstall: ./packaging/linux/postinstall.sh
preremove: ./packaging/linux/preremove.sh