feat: enrich worktrees status section with wt list data#124
Open
actionshrimp wants to merge 2 commits intomainfrom
Open
feat: enrich worktrees status section with wt list data#124actionshrimp wants to merge 2 commits intomainfrom
actionshrimp wants to merge 2 commits intomainfrom
Conversation
Run wt list --format=json in parallel with git worktree list during status refresh (when worktrunk is active). Merge results by branch name, attaching WorktreeInfo as a .wt field on WorktreeEntry. Render ahead/behind main, dirty indicator (●), and conflict state ([C]) in the worktrees section. Also calls mark_operation_time before wt.list so the watcher cooldown covers the external wt process, preventing spurious stale indicators.
Two-pass render: build status strings first (using wt.symbols when available, falling back to structured main_state/ahead/behind data), compute max width, then render with fixed-width status column so paths align. Extracts status_str() into worktrunk/parse.lua for testability.
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
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.
Summary
Builds on PR #123 (worktrunk core). Runs
wt list --format=jsonin parallel withgit worktree listduring status refresh and renders richer worktree rows.wt listfetch instate/init.lua(step 8) — only when worktrunk is activeworktrunk/parse.lua: newM.merge(worktrees, infos)helper — matches by branch name, attachesWorktreeInfoas.wtonWorktreeEntrygit/parse.lua: addswt?: WorktreeInfofield toWorktreeEntrytypestatus_sections.lua: renders↑N ↓N ● [C]enrichment between branch name and path when.wtdata is presentmark_operation_timebefore launchingwt listso the watcher cooldown covers it (prevents spurious stale indicators)Enriched display:
```
Worktrees (3)
feature/auth ↑2 ↓0 ● ../worktrees/feature-auth/
fix/bug-123 ↑1 ↓2 [C] ../worktrees/bugfix-login/
```
Where:
↑/↓= ahead/behind main,●= dirty working tree,[C]= conflictsTest plan
make test— all 655 tests passmake lint— cleanmake test-file FILE=tests/unit/test_worktrunk_enrich.lua(8 tests)wt):make test-file FILE=tests/e2e/test_worktree_status_enriched.luawtinstalled, pressgr— worktree rows should show ahead/behind/dirty info