@humanu/orchestra 0.5.37 → 0.5.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@humanu/orchestra",
3
- "version": "0.5.37",
3
+ "version": "0.5.38",
4
4
  "description": "AI-powered Git worktree and tmux session manager with modern TUI",
5
5
  "keywords": [
6
6
  "git",
@@ -681,27 +681,28 @@ tmux_session_preview() {
681
681
  return 0
682
682
  fi
683
683
 
684
- # Capture from the bottom of the pane with ANSI escape sequences preserved
684
+ # Optimized: Capture only visible lines instead of entire buffer
685
685
  # -e flag preserves escape sequences for colors and formatting
686
- # -S - means start from the current position (bottom)
686
+ # -S - means start from the current position (visible area)
687
687
  # -E - means end at the current position
688
- # This captures the visible content from the bottom up
688
+ # This captures only what's visible on screen, making it much faster
689
689
  local txt
690
- txt="$(tmux capture-pane -e -p -S - -E - -t "$pane" 2>/dev/null)"
690
+ txt="$(tmux capture-pane -e -p -t "$pane" 2>/dev/null)"
691
691
 
692
692
  if [[ -z "$txt" ]]; then
693
693
  echo "(no output yet)"
694
694
  return 0
695
695
  fi
696
696
 
697
- # Also get the terminal type for color mode detection
698
- local term_info
697
+ # Optimized: Get terminal info in a single command instead of multiple calls
698
+ local term_info has_rgb
699
699
  term_info="$(tmux show-environment -t "$s" TERM 2>/dev/null | cut -d= -f2 || echo "unknown")"
700
700
 
701
- # Check if true color is supported in this session
702
- local has_rgb="false"
701
+ # Fast check for RGB support without full grep
703
702
  if tmux show-options -t "$s" -s terminal-overrides 2>/dev/null | grep -q "RGB"; then
704
703
  has_rgb="true"
704
+ else
705
+ has_rgb="false"
705
706
  fi
706
707
 
707
708
  # For ANSI-preserved preview with color mode info
@@ -714,14 +715,6 @@ tmux_session_preview() {
714
715
  echo "<<<COLORMODE:16>>>"
715
716
  fi
716
717
  echo "$txt"
717
-
718
- # If no content after processing, show placeholder
719
- if [[ -z "$txt" ]]; then
720
- echo "(session active, no visible output)"
721
- return 0
722
- fi
723
-
724
- echo "$txt"
725
718
  }
726
719
 
727
720
  # --------------------------- Advanced Operations ----------------------------
@@ -29,6 +29,8 @@ source "$SCRIPT_DIR/shell/bridge/copy_env.sh"
29
29
  source "$SCRIPT_DIR/shell/git/bridge_worktree.sh"
30
30
  source "$SCRIPT_DIR/shell/git/bridge_repo.sh"
31
31
  source "$SCRIPT_DIR/shell/git/bridge_merge.sh"
32
+ source "$SCRIPT_DIR/shell/git/bridge_enhanced_git_status.sh"
33
+ source "$SCRIPT_DIR/shell/git/bridge_git_status.sh"
32
34
 
33
35
  # Define utilities we need
34
36
  err() { printf '❌ %s\n' "$*" >&2; }
@@ -29,9 +29,13 @@ bridge_enhanced_git_status() {
29
29
  ahead="$(echo "$ahead_behind" | cut -f1)"
30
30
  behind="$(echo "$ahead_behind" | cut -f2)"
31
31
 
32
+ # Get all diff stats in bulk for performance
33
+ staged_stats="$(git diff --cached --numstat 2>/dev/null)"
34
+ unstaged_stats="$(git diff --numstat 2>/dev/null)"
35
+
32
36
  # Process each file and get diff stats
33
37
  files_payload=""
34
- echo "$status_lines" | while IFS= read -r line; do
38
+ while IFS= read -r line; do
35
39
  if [[ -n "$line" ]]; then
36
40
  index_status="${line:0:1}"
37
41
  workdir_status="${line:1:1}"
@@ -43,8 +47,8 @@ bridge_enhanced_git_status() {
43
47
 
44
48
  # Check for staged changes first
45
49
  if [[ "$index_status" != " " && "$index_status" != "?" ]]; then
46
- # Staged changes - use --cached
47
- stats="$(git diff --cached --numstat "$filepath" 2>/dev/null | head -1)"
50
+ # Look up stats in bulk staged diff
51
+ stats="$(echo "$staged_stats" | grep -F " $filepath" | head -1)"
48
52
  if [[ -n "$stats" && "$stats" != "- -"* ]]; then
49
53
  added="$(echo "$stats" | cut -f1)"
50
54
  deleted="$(echo "$stats" | cut -f2)"
@@ -56,8 +60,8 @@ bridge_enhanced_git_status() {
56
60
 
57
61
  # Check for working directory changes if no staged stats or if workdir is also modified
58
62
  if [[ "$workdir_status" != " " && "$workdir_status" != "?" ]] && [[ $added -eq 0 && $deleted -eq 0 ]]; then
59
- # Working directory changes
60
- stats="$(git diff --numstat "$filepath" 2>/dev/null | head -1)"
63
+ # Look up stats in bulk unstaged diff
64
+ stats="$(echo "$unstaged_stats" | grep -F " $filepath" | head -1)"
61
65
  if [[ -n "$stats" && "$stats" != "- -"* ]]; then
62
66
  added="$(echo "$stats" | cut -f1)"
63
67
  deleted="$(echo "$stats" | cut -f2)"
@@ -86,7 +90,7 @@ bridge_enhanced_git_status() {
86
90
  "lines_deleted:n=$deleted")"
87
91
  files_payload+="$file_json"$'\n'
88
92
  fi
89
- done
93
+ done <<< "$status_lines"
90
94
 
91
95
  if [[ -n "$files_payload" ]]; then
92
96
  files_json="$(json_array_from_json_lines "$files_payload")"