Skip to content

feat(statusline): add --compact mode#1093

Open
derekrprice wants to merge 1 commit intodanielmiessler:mainfrom
derekrprice:feat/statusline-compact-mode
Open

feat(statusline): add --compact mode#1093
derekrprice wants to merge 1 commit intodanielmiessler:mainfrom
derekrprice:feat/statusline-compact-mode

Conversation

@derekrprice
Copy link
Copy Markdown

Summary

Adds an opt-in --compact flag to Releases/v4.0.3/.claude/statusline-command.sh that collapses the three banner sections (header, USE, PWD) into a single dense line — useful for short terminal heights or users who prefer minimal status output.

What it does

  • Parse --compact flag from script arguments (default: off; no behavior change without the flag).
  • When --compact is set, emit a single dense line in place of the header + USE + PWD sections:
    CTX:XX% | 5H:XX%↻HH:MM | 7D:XX%↻HH:MM | S:$X.XX
    
  • Pre-compute reset times and context-% scaling once, so the dense line and the full USE section share the same values (avoids drift / double work).
  • Pipe all output through a new ANSI-aware truncate_output filter that caps each line at 72 visible chars (matching the separator width). This is needed because Claude Code's statusline subprocess receives a stale TTY width, so runtime width detection is unreliable; fixing the truncation width sidesteps that.

Enabling it

"statusLine": {
  "type": "command",
  "command": "~/.claude/statusline-command.sh --compact"
}

🙋 About the destination

I targeted Releases/v4.0.3/.claude/statusline-command.sh because that's the file that's actually being shipped to users in v4.0.3 (matches byte-for-byte what my local installation runs). The top-level .claude/statusline-command.sh at repo root is 833 lines and appears to be pre-v4.0.0 content that survived commit e3ee9ad "Revert PAI v4.0.0 — Lean and Mean" and hasn't been touched since — so patching it would have diverged from the actual shipped statusline.

I guessed on the target file. If you'd prefer this land somewhere else — top-level .claude/, a new Releases/v4.0.4/, a separate patch series, etc. — happy to rework. Just let me know.

Test plan

  • Run with --compact: expect single dense summary line instead of the three banner sections.
  • Run without --compact: expect identical output to current v4.0.3 statusline (no-op path).
  • Verify long lines truncate to 72 visible chars with an ellipsis and preserved ANSI reset.
  • Confirm usage / reset-time values match between dense and full modes.

Adds an opt-in compact display that collapses the three banner sections
(header, USE/usage, PWD) into a single dense line, for users with short
terminal heights or who prefer minimal status output.

Changes:
- Parse --compact flag from script arguments
- Pre-compute reset times and context scaling once so the dense line and
  the full USE section share the same values (avoids drift / double work)
- Emit a dense single line when --compact is set:
    CTX:XX% | 5H:XX%↻HH:MM | 7D:XX%↻HH:MM | S:$X.XX
  …in place of header, USE, and PWD sections
- Pipe all output through a new ANSI-aware truncate_output filter that
  caps each line at 72 visible chars (matching the separator width).
  Needed because Claude Code's statusline subprocess receives a stale
  TTY width, so runtime width detection is unreliable

Enable by configuring in settings.json:
    "statusLine": {
      "type": "command",
      "command": "~/.claude/statusline-command.sh --compact"
    }

No behavior change without the flag.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant