Skip to content

feat: stream worktree output in list command#25

Merged
captainsafia merged 3 commits intomainfrom
copilot/update-list-command-output
Dec 21, 2025
Merged

feat: stream worktree output in list command#25
captainsafia merged 3 commits intomainfrom
copilot/update-list-command-output

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 21, 2025

The list command was buffering all worktrees before printing. Changed to stream output as worktrees are processed.

Changes

  • Non-JSON output: Print legend immediately, then stream each worktree as received from streamWorktrees() generator
  • JSON output: Still buffers (required for valid JSON array structure)
  • Filter logic: Extracted to shouldIncludeWorktree() helper to eliminate duplication
  • Empty state tracking: Split foundAny (any worktrees exist) from matchedAny (any pass filters) for accurate messaging
// Before: collected all, then printed
const worktrees: Worktree[] = [];
for await (const wt of manager.streamWorktrees()) {
  worktrees.push(wt);
}
for (const wt of worktrees) {
  printWorktreeItem(wt, options);
}

// After: print as they stream
for await (const wt of manager.streamWorktrees()) {
  printWorktreeItem(wt, options);
}

Improves perceived performance for repos with many worktrees.

Original prompt

The list command currently aggregates everything from the streamWorktrees async generator to a list instead of printing as it goes. Update the implementation to print as it processes values from the generator.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI self-assigned this Dec 21, 2025
Copilot AI and others added 2 commits December 21, 2025 17:22
Co-authored-by: captainsafia <1857993+captainsafia@users.noreply.github.com>
Co-authored-by: captainsafia <1857993+captainsafia@users.noreply.github.com>
Copilot AI changed the title [WIP] Update list command to print values from streamWorktrees feat: stream worktree output in list command Dec 21, 2025
Copilot AI requested a review from captainsafia December 21, 2025 17:27
@github-actions
Copy link
Copy Markdown

🌳 Grove PR Build Ready!

Version: 0.0.0-pr.25.f929327

Install with:

curl -fsSL https://safia.rocks/grove/install.sh | sh -s -- --pr 25

Or if you already have grove installed:

grove self-update --pr 25

Or download directly from Actions Artifacts

Available binaries:

  • grove-linux-x64
  • grove-linux-arm64
  • grove-darwin-x64
  • grove-darwin-arm64

@captainsafia captainsafia marked this pull request as ready for review December 21, 2025 19:43
@captainsafia captainsafia merged commit 2356519 into main Dec 21, 2025
5 checks passed
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.

2 participants