diff --git a/examples/statusline/README.md b/examples/statusline/README.md index 923d66d2d..789bc1301 100644 --- a/examples/statusline/README.md +++ b/examples/statusline/README.md @@ -8,7 +8,7 @@ For more details on how to use and configure the statusline script, please refer ## How it works The `statusline.sh` script reads a JSON payload from standard input, containing various state information from the CLI. It then: -1. Extracts multiple fields like `agent_state`, `vcs` info, context usage, and terminal dimensions using `jq`. +1. Extracts multiple fields like `agent_state`, `conversation_name`, `vcs` info, context usage, and terminal dimensions using `jq`. 2. Computes visual indicators, such as a Unicode progress bar for context window usage. 3. Formats the data with standard ANSI 16-color codes for visual distinction. 4. Dynamically adjusts the layout to be 1 or 2 lines based on the available terminal width. diff --git a/examples/statusline/statusline.sh b/examples/statusline/statusline.sh index 390fea1ee..a7311a4ed 100755 --- a/examples/statusline/statusline.sh +++ b/examples/statusline/statusline.sh @@ -33,6 +33,7 @@ NUM_COLOR="${FG_BRIGHT_WHITE}${B}" # Extract all fields in one pass to prevent spawning jq 8 times. { read -r STATE + read -r CONV_NAME read -r USED_PCT read -r VCS_BRANCH read -r VCS_DIRTY @@ -45,6 +46,7 @@ NUM_COLOR="${FG_BRIGHT_WHITE}${B}" } <<< "$( jq -r ' (.agent_state // "idle"), + (.conversation_name // ""), (.context_window.used_percentage // 0), (.vcs.branch // ""), (.vcs.dirty // false), @@ -54,7 +56,7 @@ NUM_COLOR="${FG_BRIGHT_WHITE}${B}" (.task_count // 0), (.model.display_name // ""), (.terminal_width // 80) - ' 2>/dev/null || printf "idle\n0\n\nfalse\nfalse\n0\n0\n0\n\n80\n" + ' 2>/dev/null || printf "idle\n\n0\n\nfalse\nfalse\n0\n0\n0\n\n80\n" )" # ─── Computed Values ───────────────────────────────────────────────────────── @@ -71,6 +73,12 @@ case "$STATE" in *) S="${FG_WHITE}${B}⏳ $(echo "$STATE" | tr '[:lower:]' '[:upper:]')${R}" ;; esac +# ─── Conversation Name ─────────────────────────────────────────────────────── +C="" +if [ -n "$CONV_NAME" ]; then + C="${FG_GRAY} ╱ ${FG_BRIGHT_CYAN}${CONV_NAME}${R}" +fi + # ─── VCS Branch ────────────────────────────────────────────────────────────── V="" if [ -n "$VCS_BRANCH" ]; then @@ -138,7 +146,7 @@ BG_FMT="${FG_GRAY}tasks ${NUM_COLOR}${BG_TASKS}${R}" DOT="${FG_GRAY} · ${R}" # ─── Output ────────────────────────────────────────────────────────────────── -LINE1="${S}${M}${V}" +LINE1="${S}${C}${M}${V}" LINE2=" ${CTX}${DOT}${ART_FMT}${DOT}${SUB_FMT}${DOT}${BG_FMT}${DOT}${SB}" if [ "$COLS" -ge 120 ]; then @@ -150,6 +158,6 @@ elif [ "$COLS" -ge 80 ]; then echo -e "${FG_GRAY}╰─${R}${LINE2}" else # Narrow: compact two-line, minimal chrome - echo -e "${S}${M}" + echo -e "${S}${C}${M}" echo -e "${CTX}${DOT}${BG_FMT}" fi