-
Notifications
You must be signed in to change notification settings - Fork 128
feat: add git-indicators widget #135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dreamiurg
wants to merge
8
commits into
sirmalloc:main
Choose a base branch
from
dreamiurg:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+7,044
−4
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shows git status indicators: - + for staged changes - * for unstaged changes Configurable via widget color property. Supports hiding when not in a git repo. Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Widget outputs ANSI color codes (green +, red *) when preserveColors is enabled - Extended renderer to support preserveColors for all widget types, not just custom-command Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add comprehensive test suite (22 tests) - Fix modifier text to match sibling widgets: "hide 'no git'" - Fix keybind label to match sibling widgets - Mark unused settings parameter with underscore Co-Authored-By: Claude Opus 4.5 <[email protected]>
Reduced from 22 tests to 4 focused tests that cover: - Core indicator logic (+, *, +*, empty) - Non-git-repo handling - ANSI color output - Preview mode Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add colorMode toggle (raw/custom) via 'm' keybind - Add stagedColor cycling via 's' keybind (green, brightGreen, cyan, etc.) - Add unstagedColor cycling via 'u' keybind (red, brightRed, yellow, etc.) - Raw mode uses hardcoded green/red ANSI codes - Custom mode uses getColorAnsiCode() for configurable colors - Update tests to cover new color configuration Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add (p) keybind to toggle preserveColors in TUI - When preserveColors ON: widget outputs ANSI colors (green +, red *) - When preserveColors OFF: user can override via Edit Colors - Update getEditorDisplay to show color configuration state - Add test for toggle-preserve-colors action Co-Authored-By: Claude Opus 4.5 <[email protected]>
When installing from GitHub via npx, the prepare script runs after npm install, building the TypeScript to dist/. Co-Authored-By: Claude Opus 4.5 <[email protected]>
Remove custom color cycling (m/s/u keybinds) - color configuration belongs in Edit Colors, not widget-specific keybinds. Widget now has two modes: - preserveColors OFF: plain +* output, user sets color via Edit Colors - preserveColors ON: widget outputs green + and red * Co-Authored-By: Claude Opus 4.5 <[email protected]>
zoonderkins
added a commit
to zoonderkins/ccstatusline
that referenced
this pull request
Jan 21, 2026
Merged PRs: - sirmalloc#138: fix: support bare repo worktrees in GitWorktree widget - sirmalloc#135: feat: add git-indicators widget - sirmalloc#132: fix: Windows terminal width detection - sirmalloc#131: feat: Task Timer widget - sirmalloc#123: feat: Add backups for settings.json - sirmalloc#121: feat: Add configurable context warning alerts - sirmalloc#120: feat: Add Mercurial support - sirmalloc#119: feat: Add Git Root Dir widget - sirmalloc#58: feat: Add support for local/project settings Fixes Issues: - sirmalloc#117: Windows tput cols creates null file - sirmalloc#122: claude's settings.json deleted/lost - sirmalloc#112: Add mercurial support Additional fixes: - Resolved circular dependency in renderer.ts/widgets.ts - Fixed lint errors in multiple files
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
I wanted a way to see at a glance whether I have staged or unstaged changes in my git repo, but without the line counts that
git-changesdisplays. My screen real estate is limited and I just need a quick visual indicator - not the full details.Solution
This PR adds a new
git-indicatorswidget that shows minimal git status indicators:+for staged changes (green whenpreserveColorsis enabled)*for unstaged changes (red whenpreserveColorsis enabled)When there are no changes, the widget displays nothing, keeping the status line clean.
Configurability
preserveColors(pkeybind): When enabled, widget outputs hardcoded ANSI colors (green+, red*). When disabled, outputs plain text and user can set color via Edit Colors.hideNoGit(hkeybind): When enabled, hides the widget entirely when not in a git repo (instead of showing empty space).Example Configuration
{ "id": "git-indicators", "type": "git-indicators", "preserveColors": true, "metadata": { "hideNoGit": "true" } }Changes
New Widget
GitIndicatorsWidgetinsrc/widgets/GitIndicators.tssrc/widgets/index.tsandsrc/utils/widgets.tsRenderer Enhancement
The
preserveColorsproperty was already defined in theWidgetItemschema, but the renderer only honored it forcustom-commandwidgets. I extended this to work with all widget types by removing thewidget.type === 'custom-command'check. This allows any built-in widget to output ANSI color codes and have them preserved, rather than being stripped and replaced with the widget'scolorproperty.Build Enhancement
Added
preparescript topackage.jsonso the TypeScript gets built when installing from GitHub vianpx github:owner/repo.Tests
Testing
All 45 tests pass. Tested extensively on my machine - works great!