feat(dev): add Claude Code statusline config via activation hook
This commit is contained in:
@@ -110,6 +110,12 @@ let
|
|||||||
ref = "main";
|
ref = "main";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Claude Code statusline: shows model, cwd, git branch, and context usage %
|
||||||
|
claudeCodeStatusLineConfig = pkgs.writeText "claude-statusline.json" (builtins.toJSON {
|
||||||
|
type = "command";
|
||||||
|
command = ''input=$(cat); model=$(echo "$input" | jq -r '.model.display_name'); cwd=$(echo "$input" | jq -r '.workspace.current_dir'); if git -C "$cwd" rev-parse --git-dir > /dev/null 2>&1; then branch=$(git -C "$cwd" --no-optional-locks rev-parse --abbrev-ref HEAD 2>/dev/null || echo ""); if [ -n "$branch" ]; then git_info=" on $branch"; else git_info=""; fi; else git_info=""; fi; usage=$(echo "$input" | jq '.context_window.current_usage'); if [ "$usage" != "null" ]; then current=$(echo "$usage" | jq '.input_tokens + .cache_creation_input_tokens + .cache_read_input_tokens'); size=$(echo "$input" | jq '.context_window.context_window_size'); pct=$((current * 100 / size)); context_info=" | ''${pct}% context"; else context_info=""; fi; printf "%s in %s%s%s" "$model" "$cwd" "$git_info" "$context_info"'';
|
||||||
|
});
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.home.roles.development = {
|
options.home.roles.development = {
|
||||||
@@ -251,6 +257,18 @@ in
|
|||||||
$DRY_RUN_CMD echo "Claude Code beads integration configured (hooks installed)"
|
$DRY_RUN_CMD echo "Claude Code beads integration configured (hooks installed)"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
# Configure Claude Code statusline (merge into existing settings.json)
|
||||||
|
home.activation.claudeCodeStatusLine = lib.hm.dag.entryAfter ["writeBoundary" "claudeCodeBeadsSetup"] ''
|
||||||
|
SETTINGS="$HOME/.claude/settings.json"
|
||||||
|
mkdir -p "$HOME/.claude"
|
||||||
|
if [ -f "$SETTINGS" ]; then
|
||||||
|
${pkgs.jq}/bin/jq --slurpfile sl ${claudeCodeStatusLineConfig} '.statusLine = $sl[0]' "$SETTINGS" > "''${SETTINGS}.tmp" && mv "''${SETTINGS}.tmp" "$SETTINGS"
|
||||||
|
else
|
||||||
|
${pkgs.jq}/bin/jq -n --slurpfile sl ${claudeCodeStatusLineConfig} '{statusLine: $sl[0]}' > "$SETTINGS"
|
||||||
|
fi
|
||||||
|
$DRY_RUN_CMD echo "Claude Code statusline configured"
|
||||||
|
'';
|
||||||
|
|
||||||
# Beads timer gate checker (Linux only - uses systemd)
|
# Beads timer gate checker (Linux only - uses systemd)
|
||||||
# Runs every 5 minutes to auto-resolve expired timer gates across all beads projects
|
# Runs every 5 minutes to auto-resolve expired timer gates across all beads projects
|
||||||
# This enables self-scheduling molecules (watchers, patrols, etc.)
|
# This enables self-scheduling molecules (watchers, patrols, etc.)
|
||||||
|
|||||||
Reference in New Issue
Block a user