feat(statusline): add CAVEMAN_BADGE_COMPACT env var for compact badge#320
feat(statusline): add CAVEMAN_BADGE_COMPACT env var for compact badge#320drPod wants to merge 3 commits intoJuliusBrussee:mainfrom
Conversation
When CAVEMAN_BADGE_COMPACT=1 is set, the statusline badge renders as [C] / [C:L] / [C:U] etc. instead of [CAVEMAN] / [CAVEMAN:LITE]. Useful for users running ccstatusline or similar dense statuslines where the full word is too long alongside other widgets. Default behavior unchanged: env unset → existing verbose output.
There was a problem hiding this comment.
Pull request overview
Add opt-in CAVEMAN_BADGE_COMPACT=1 compact statusline badge variant to keep statusline short, with test coverage and README mention.
Changes:
- Add compact badge rendering path in
caveman-statusline.shandcaveman-statusline.ps1, skipping savings suffix in compact mode. - Add JS tests covering compact badge mapping, opt-in semantics (only literal
"1"), and savings suffix suppression. - Document new env var in README statusline badge paragraph.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| hooks/caveman-statusline.sh | Add compact badge render/exit branch gated by CAVEMAN_BADGE_COMPACT=1. |
| hooks/caveman-statusline.ps1 | PowerShell parity for compact badge gating and mapping. |
| tests/test_caveman_stats.js | Add table-driven compact badge tests + opt-in and suffix-suppression assertions. |
| README.md | Document compact badge env var + examples. |
Whitelist validation rejects empty MODE before the compact branch runs, so the empty-string handling in the case/switch was unreachable. Remove it (option 1 from Copilot review on PR JuliusBrussee#320). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Hi, New tests validate compact behavior only for Severity: informational | Category: reliability How to fix: Add PS1 behavior test Agent prompt to fix - you can give this to your LLM of choice:
Found by Qodo code review |
Address Qodo bot regression-risk concern on PR JuliusBrussee#320 — extend the existing PS static-check suite (verify_repo.py) with assertions that caveman-statusline.ps1 contains the CAVEMAN_BADGE_COMPACT gate and the [C] / [C:WU] compact badge mappings. Matches repo convention: PS coverage is regex-based static analysis, not Pester runtime tests.
|
Addressed in 48f5030 — extended |
Summary
Adds an opt-in
CAVEMAN_BADGE_COMPACT=1env var that switches the statusline badge from[CAVEMAN]/[CAVEMAN:WENYAN-ULTRA]to a compact form ([C]/[C:WU]/ etc.). Helpful for users running ccstatusline or similar dense statuslines where the full word crowds out other widgets.1) → existing verbose output, byte-for-byte unchanged.[a-z0-9-]charset filter, mode whitelist. The compact branch sits after validation, so attacker-controlled flag bytes can never reach the compactcaseblock either.⛏ 12.4k) for the same reason users opted into compact: keep the badge short. Matches the user-prompt spec (exit 0after compact render).Mode → badge mapping
CAVEMAN_BADGE_COMPACT=1)full/ empty[CAVEMAN][C]lite[CAVEMAN:LITE][C:L]ultra[CAVEMAN:ULTRA][C:U]wenyan-lite[CAVEMAN:WENYAN-LITE][C:WL]wenyan/wenyan-full[CAVEMAN:WENYAN]/[CAVEMAN:WENYAN-FULL][C:W]wenyan-ultra[CAVEMAN:WENYAN-ULTRA][C:WU]commit[CAVEMAN:COMMIT][C:CM]review[CAVEMAN:REVIEW][C:RV]compress[CAVEMAN:COMPRESS][C:CP]Files changed (~117 lines)
hooks/caveman-statusline.sh— +19 LOC. Compact branch added before existing verbose printf; existing logic untouched.hooks/caveman-statusline.ps1— +21 LOC. PowerShell parity (perCLAUDE.md"both scripts hand-kept in sync").tests/test_caveman_stats.js— +76 LOC. Three new test cases:[CAVEMAN…]leak).CAVEMAN_BADGE_COMPACT=0/CAVEMAN_BADGE_COMPACT=trueall keep verbose output (only literal1opts in).CAVEMAN_STATUSLINE_SAVINGS=1.README.md— +1 sentence appended to the existing Statusline savings badge paragraph (no new section).Test status
Manual smoke test confirmed each of the 9 modes renders the expected compact badge and that env unset /
0/trueall preserve the verbose path.Notes / surfaced uncertainties
CLAUDE.mdcalls it out as a hand-synced sibling. Happy to drop the PS1 change if maintainer prefers a sh-only first cut.verify_repo.pyassertion for compact mode — the existing one only spot-checks one verbose mode. Felt like overreach to expand it; the JS test suite is already the dense statusline-coverage venue.🤖 Generated with Claude Code