@humanu/orchestra 0.5.36 → 0.5.37
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 +1 -1
- package/resources/prebuilt/linux-x64/orchestra +0 -0
- package/resources/prebuilt/macos-arm64/orchestra +0 -0
- package/resources/prebuilt/macos-intel/orchestra +0 -0
- package/resources/scripts/gw.sh +3 -0
- package/resources/scripts/gwr.sh +15 -0
- package/resources/scripts/shell/AGENTS.md +236 -0
- package/resources/scripts/shell/gwr/check-updates.sh +174 -0
- package/resources/scripts/shell/gwr_binary.sh +30 -0
- package/resources/scripts/shell/gwr_usage.sh +3 -0
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/resources/scripts/gw.sh
CHANGED
|
@@ -136,11 +136,13 @@ usage() {
|
|
|
136
136
|
echo " ch, checkout <branch> Switch to the worktree of <branch>"
|
|
137
137
|
echo " copy-env <worktreename> Copy env files from current worktree to target"
|
|
138
138
|
echo " status [git status args] Show current worktree + git status"
|
|
139
|
+
echo " update, --update Check for available updates"
|
|
139
140
|
echo ""
|
|
140
141
|
echo "Examples:"
|
|
141
142
|
echo " $(basename "$0") # interactive picker (tmux session management)"
|
|
142
143
|
echo " $(basename "$0") ls # list worktrees only"
|
|
143
144
|
echo " $(basename "$0") ch -b feat/x # create and switch to worktree"
|
|
145
|
+
echo " $(basename "$0") update # check for available updates"
|
|
144
146
|
echo ""
|
|
145
147
|
echo "Note: tmux session management is only available via the interactive menu (no args)."
|
|
146
148
|
}
|
|
@@ -190,6 +192,7 @@ case "$COMMAND" in
|
|
|
190
192
|
ch|checkout) cmd_checkout_worktree "$@" ;;
|
|
191
193
|
status) cmd_status "$@" ;;
|
|
192
194
|
copy-env) cmd_copy_env "$@" ;;
|
|
195
|
+
update|--update) "$SCRIPT_DIR/shell/gwr/check-updates.sh" ;;
|
|
193
196
|
help|-h|--help) usage ;;
|
|
194
197
|
*) err "Unknown command '$COMMAND'"; usage ;;
|
|
195
198
|
esac
|
package/resources/scripts/gwr.sh
CHANGED
|
@@ -46,6 +46,12 @@ if [[ "${1:-}" == "-h" || "${1:-}" == "--help" ]]; then
|
|
|
46
46
|
exit 0
|
|
47
47
|
fi
|
|
48
48
|
|
|
49
|
+
# Handle update check flag
|
|
50
|
+
if [[ "${1:-}" == "--check-updates" || "${1:-}" == "--update" ]]; then
|
|
51
|
+
"$SCRIPT_DIR/shell/gwr/check-updates.sh"
|
|
52
|
+
exit $?
|
|
53
|
+
fi
|
|
54
|
+
|
|
49
55
|
# Check prerequisites
|
|
50
56
|
gwr_check_git_repo
|
|
51
57
|
gwr_check_bridge_script
|
|
@@ -74,6 +80,9 @@ BRIDGE_PATH="$SCRIPT_DIR/gw-bridge.sh"
|
|
|
74
80
|
|
|
75
81
|
gwr_set_terminal_title
|
|
76
82
|
|
|
83
|
+
# Check for updates silently (once per day)
|
|
84
|
+
gwr_check_updates_silent
|
|
85
|
+
|
|
77
86
|
exec "$BINARY_PATH" --bridge-path "$BRIDGE_PATH" "$@"
|
|
78
87
|
|
|
79
88
|
# Handle help flag early
|
|
@@ -82,6 +91,12 @@ if [[ "${1:-}" == "-h" || "${1:-}" == "--help" ]]; then
|
|
|
82
91
|
exit 0
|
|
83
92
|
fi
|
|
84
93
|
|
|
94
|
+
# Handle update check flag
|
|
95
|
+
if [[ "${1:-}" == "--check-updates" || "${1:-}" == "--update" ]]; then
|
|
96
|
+
"$SCRIPT_DIR/shell/gwr/check-updates.sh"
|
|
97
|
+
exit $?
|
|
98
|
+
fi
|
|
99
|
+
|
|
85
100
|
# Check prerequisites
|
|
86
101
|
check_git_repo
|
|
87
102
|
check_bridge_script
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
# Shell Directory - AI Context Documentation
|
|
2
|
+
|
|
3
|
+
This document provides comprehensive context for AI agents and LLMs working with the Orchestrator shell system. It describes the purpose, structure, and usage of all files in the `shell/` directory and its subdirectories.
|
|
4
|
+
|
|
5
|
+
## Directory Structure Overview
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
shell/
|
|
9
|
+
├── gwr_load.sh # Main loader for gwr (Rust TUI) components
|
|
10
|
+
├── gwr_colors.sh # Color definitions and terminal styling
|
|
11
|
+
├── gwr_logging.sh # Logging utilities and output formatting
|
|
12
|
+
├── gwr_git.sh # Git repository validation functions
|
|
13
|
+
├── gwr_bridge.sh # Bridge script validation and setup
|
|
14
|
+
├── gwr_binary.sh # Binary discovery and validation
|
|
15
|
+
├── gwr_terminal.sh # Terminal title and environment setup
|
|
16
|
+
├── gwr_usage.sh # Usage/help text for gwr command
|
|
17
|
+
├── gw_load.sh # Main loader for gw (CLI) components
|
|
18
|
+
├── gw_colors.sh # Color definitions for gw CLI
|
|
19
|
+
├── gw_logging.sh # Logging for gw CLI
|
|
20
|
+
├── gw_git.sh # Git operations for gw CLI
|
|
21
|
+
├── gw_worktree.sh # Worktree management for gw CLI
|
|
22
|
+
├── gw_usage.sh # Usage text for gw command
|
|
23
|
+
├── copy_env.sh # Environment variable copying system
|
|
24
|
+
├── commands.sh # Shared command utilities
|
|
25
|
+
├── build/ # Build system components
|
|
26
|
+
│ ├── build_bridge.sh # Bridge building logic
|
|
27
|
+
│ ├── build_dependencies.sh # Dependency checking
|
|
28
|
+
│ ├── build_install.sh # Installation procedures
|
|
29
|
+
│ ├── build_load.sh # Build system loader
|
|
30
|
+
│ ├── build_logging.sh # Build-specific logging
|
|
31
|
+
│ ├── build_rust.sh # Rust compilation logic
|
|
32
|
+
│ └── build_usage.sh # Build command usage
|
|
33
|
+
├── env/ # Environment management
|
|
34
|
+
│ ├── copy_env_command.sh # Command processing for env copying
|
|
35
|
+
│ ├── copy_env_constants.sh # Constants and paths
|
|
36
|
+
│ ├── copy_env_core.sh # Core environment copying logic
|
|
37
|
+
│ ├── copy_env_debug_parse.sh # Debug parsing for env copying
|
|
38
|
+
│ ├── copy_env_load.sh # Environment loader
|
|
39
|
+
│ ├── copy_env_locations.sh # Path and location management
|
|
40
|
+
│ ├── copy_env_logging.sh # Environment copying logging
|
|
41
|
+
│ └── copy_env_state.sh # State management for env copying
|
|
42
|
+
├── git/ # Git-specific utilities
|
|
43
|
+
│ └── gwr_worktree_title.sh # Worktree title generation
|
|
44
|
+
└── gwr/ # gwr-specific components
|
|
45
|
+
└── check-updates.sh # Update checking functionality
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Core System Files
|
|
49
|
+
|
|
50
|
+
### gwr_load.sh
|
|
51
|
+
**Purpose**: Main loader for the gwr (Rust TUI) system
|
|
52
|
+
**Usage**: Sourced by gwr.sh to load all necessary components
|
|
53
|
+
**Key Functions**:
|
|
54
|
+
- Loads all gwr-specific modules in correct order
|
|
55
|
+
- Provides `gwr_load_core()` function
|
|
56
|
+
**Dependencies**: All gwr_*.sh files in shell/
|
|
57
|
+
|
|
58
|
+
### gwr_colors.sh
|
|
59
|
+
**Purpose**: Color definitions and terminal styling for gwr
|
|
60
|
+
**Usage**: Provides consistent color scheme across gwr components
|
|
61
|
+
**Key Variables**:
|
|
62
|
+
- `BLUE`, `GREEN`, `YELLOW`, `RED`, `NC` - ANSI color codes
|
|
63
|
+
- Used for status messages, errors, and UI feedback
|
|
64
|
+
|
|
65
|
+
### gwr_logging.sh
|
|
66
|
+
**Purpose**: Logging and output formatting utilities
|
|
67
|
+
**Usage**: Standardized logging functions for gwr operations
|
|
68
|
+
**Key Functions**:
|
|
69
|
+
- `gwr_info()`, `gwr_success()`, `gwr_warn()`, `gwr_error()` - Colored logging functions
|
|
70
|
+
- Provides consistent output formatting across gwr system
|
|
71
|
+
|
|
72
|
+
### gwr_git.sh
|
|
73
|
+
**Purpose**: Git repository validation and setup
|
|
74
|
+
**Usage**: Ensures gwr runs in valid git repositories
|
|
75
|
+
**Key Functions**:
|
|
76
|
+
- `gwr_check_git_repo()` - Validates git repository presence
|
|
77
|
+
- Provides error messages and guidance for git setup
|
|
78
|
+
|
|
79
|
+
### gwr_bridge.sh
|
|
80
|
+
**Purpose**: Bridge script validation and setup
|
|
81
|
+
**Usage**: Ensures gw-bridge.sh is available and executable
|
|
82
|
+
**Key Functions**:
|
|
83
|
+
- `gwr_check_bridge_script()` - Validates bridge script presence
|
|
84
|
+
- Critical for Rust TUI communication with bash APIs
|
|
85
|
+
|
|
86
|
+
### gwr_binary.sh
|
|
87
|
+
**Purpose**: Binary discovery and validation for Rust TUI
|
|
88
|
+
**Usage**: Finds and validates gw-tui binary location
|
|
89
|
+
**Key Functions**:
|
|
90
|
+
- `gwr_find_binary()` - Searches for gw-tui binary in multiple locations
|
|
91
|
+
- Supports development, release, and installed binary locations
|
|
92
|
+
- Handles GW_TUI_BIN environment variable override
|
|
93
|
+
|
|
94
|
+
### gwr_terminal.sh
|
|
95
|
+
**Purpose**: Terminal environment setup
|
|
96
|
+
**Usage**: Configures terminal for optimal TUI experience
|
|
97
|
+
**Key Functions**:
|
|
98
|
+
- `gwr_set_terminal_title()` - Sets terminal window title
|
|
99
|
+
- Provides terminal compatibility and environment setup
|
|
100
|
+
|
|
101
|
+
### gwr_usage.sh
|
|
102
|
+
**Purpose**: Help and usage information for gwr command
|
|
103
|
+
**Usage**: Displays comprehensive help text
|
|
104
|
+
**Key Functions**:
|
|
105
|
+
- `gwr_show_usage()` - Shows command-line options and navigation help
|
|
106
|
+
- Includes keyboard shortcuts, examples, and requirements
|
|
107
|
+
|
|
108
|
+
## CLI System Files (gw_*)
|
|
109
|
+
|
|
110
|
+
### gw_load.sh
|
|
111
|
+
**Purpose**: Main loader for the gw (CLI) system
|
|
112
|
+
**Usage**: Sourced by gw.sh to load CLI-specific components
|
|
113
|
+
**Key Functions**:
|
|
114
|
+
- Loads all gw-specific modules in correct order
|
|
115
|
+
- Provides `gw_load_core()` function
|
|
116
|
+
**Dependencies**: All gw_*.sh files in shell/
|
|
117
|
+
|
|
118
|
+
### gw_colors.sh, gw_logging.sh, gw_git.sh, gw_worktree.sh, gw_usage.sh
|
|
119
|
+
**Purpose**: CLI equivalents of gwr modules
|
|
120
|
+
**Usage**: Provide CLI-specific implementations of core functionality
|
|
121
|
+
**Key Differences**: Optimized for command-line usage rather than TUI interaction
|
|
122
|
+
|
|
123
|
+
## Shared System Files
|
|
124
|
+
|
|
125
|
+
### copy_env.sh
|
|
126
|
+
**Purpose**: Environment variable copying system
|
|
127
|
+
**Usage**: Copies environment between shell contexts
|
|
128
|
+
**Key Functions**:
|
|
129
|
+
- `copy_env()` - Main function for environment copying
|
|
130
|
+
- Critical for worktree directory changes and session management
|
|
131
|
+
- Used by both gwr and gw systems
|
|
132
|
+
|
|
133
|
+
### commands.sh
|
|
134
|
+
**Purpose**: Shared command utilities
|
|
135
|
+
**Usage**: Common command-line operations used across systems
|
|
136
|
+
**Key Functions**:
|
|
137
|
+
- `have_command()` - Command availability checking
|
|
138
|
+
- Shared utility functions for both gwr and gw systems
|
|
139
|
+
|
|
140
|
+
## Build System (build/)
|
|
141
|
+
|
|
142
|
+
### build_load.sh
|
|
143
|
+
**Purpose**: Loader for build system components
|
|
144
|
+
**Usage**: Loads all build-related modules
|
|
145
|
+
**Key Functions**: `build_load_core()` - Loads build system modules
|
|
146
|
+
|
|
147
|
+
### build_rust.sh
|
|
148
|
+
**Purpose**: Rust compilation and binary management
|
|
149
|
+
**Usage**: Handles Rust TUI compilation and installation
|
|
150
|
+
**Key Functions**:
|
|
151
|
+
- Rust project compilation
|
|
152
|
+
- Binary installation and management
|
|
153
|
+
- Cross-platform binary handling
|
|
154
|
+
|
|
155
|
+
### build_bridge.sh, build_dependencies.sh, build_install.sh, build_logging.sh, build_usage.sh
|
|
156
|
+
**Purpose**: Specialized build system components
|
|
157
|
+
**Usage**: Handle specific aspects of the build process
|
|
158
|
+
**Key Functions**: Each focuses on a specific build operation
|
|
159
|
+
|
|
160
|
+
## Environment System (env/)
|
|
161
|
+
|
|
162
|
+
### copy_env_core.sh
|
|
163
|
+
**Purpose**: Core environment copying logic
|
|
164
|
+
**Usage**: Main implementation of environment variable copying
|
|
165
|
+
**Key Functions**: `copy_env()` - Core function for environment management
|
|
166
|
+
|
|
167
|
+
### copy_env_command.sh, copy_env_constants.sh, copy_env_debug_parse.sh, copy_env_load.sh, copy_env_locations.sh, copy_env_logging.sh, copy_env_state.sh
|
|
168
|
+
**Purpose**: Specialized environment copying components
|
|
169
|
+
**Usage**: Handle specific aspects of environment management
|
|
170
|
+
**Key Functions**: Each module handles a specific aspect of the complex environment copying system
|
|
171
|
+
|
|
172
|
+
## Git Utilities (git/)
|
|
173
|
+
|
|
174
|
+
### gwr_worktree_title.sh
|
|
175
|
+
**Purpose**: Worktree title generation for tmux sessions
|
|
176
|
+
**Usage**: Creates descriptive titles for worktree-based tmux sessions
|
|
177
|
+
**Key Functions**: `gwr_worktree_title()` - Generates formatted worktree titles
|
|
178
|
+
|
|
179
|
+
## Update System (gwr/)
|
|
180
|
+
|
|
181
|
+
### check-updates.sh
|
|
182
|
+
**Purpose**: Update checking functionality
|
|
183
|
+
**Usage**: Checks for newer versions from npm and homebrew
|
|
184
|
+
**Key Functions**:
|
|
185
|
+
- `detect_installation_method()` - Determines how Orchestra was installed
|
|
186
|
+
- `get_npm_latest_version()`, `get_brew_latest_version()` - Fetches latest versions
|
|
187
|
+
- `check_updates()` - Main update checking logic
|
|
188
|
+
- Provides update instructions based on installation method
|
|
189
|
+
|
|
190
|
+
## Integration Points
|
|
191
|
+
|
|
192
|
+
### gwr.sh Integration
|
|
193
|
+
- Sources `gwr_load.sh` to load all gwr components
|
|
194
|
+
- Uses `--check-updates` flag to trigger update checking
|
|
195
|
+
- Passes bridge path to Rust TUI binary
|
|
196
|
+
|
|
197
|
+
### gw.sh Integration
|
|
198
|
+
- Sources `gw_load.sh` to load all gw components
|
|
199
|
+
- Uses shared `copy_env.sh` for environment management
|
|
200
|
+
- Provides CLI interface to same underlying functionality
|
|
201
|
+
|
|
202
|
+
### Bridge System Integration
|
|
203
|
+
- `gwr_bridge.sh` validates bridge script availability
|
|
204
|
+
- Bridge script enables Rust TUI to communicate with bash APIs
|
|
205
|
+
- Critical for the hybrid Rust/bash architecture
|
|
206
|
+
|
|
207
|
+
## Key Architectural Patterns
|
|
208
|
+
|
|
209
|
+
1. **Modular Loading**: Each system (gwr/gw) has its own loader that sources components in dependency order
|
|
210
|
+
2. **Color Consistency**: Separate color files ensure consistent theming across components
|
|
211
|
+
3. **Logging Standardization**: Standardized logging functions provide consistent output
|
|
212
|
+
4. **Environment Isolation**: Complex environment copying system handles shell context changes
|
|
213
|
+
5. **Binary Discovery**: Sophisticated binary finding supports development, build, and installed scenarios
|
|
214
|
+
6. **Update Integration**: Update checking integrated into main launcher with installation method detection
|
|
215
|
+
|
|
216
|
+
## Usage Examples for AI Agents
|
|
217
|
+
|
|
218
|
+
### Adding New gwr Functionality
|
|
219
|
+
1. Create new function in appropriate module (e.g., `gwr_new_feature.sh`)
|
|
220
|
+
2. Add to `gwr_load.sh` loading sequence
|
|
221
|
+
3. Update `gwr_usage.sh` if adding user-facing features
|
|
222
|
+
4. Follow existing patterns for colors, logging, and error handling
|
|
223
|
+
|
|
224
|
+
### Modifying Update Checking
|
|
225
|
+
1. Edit `shell/gwr/check-updates.sh`
|
|
226
|
+
2. Update version constants if needed
|
|
227
|
+
3. Test with different installation methods (npm, brew, local)
|
|
228
|
+
4. Ensure graceful handling of missing package managers
|
|
229
|
+
|
|
230
|
+
### Adding Build System Features
|
|
231
|
+
1. Create new module in `shell/build/`
|
|
232
|
+
2. Add to `build_load.sh` if needed
|
|
233
|
+
3. Follow existing build system patterns
|
|
234
|
+
4. Update `build_usage.sh` for new build options
|
|
235
|
+
|
|
236
|
+
This documentation provides the foundation for AI agents to understand and work effectively with the Orchestrator shell system.
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
###############################################################################
|
|
4
|
+
# check-updates.sh - Check for Orchestra updates from npm and brew
|
|
5
|
+
#
|
|
6
|
+
# Determines installation method and checks for newer versions
|
|
7
|
+
###############################################################################
|
|
8
|
+
|
|
9
|
+
set -euo pipefail
|
|
10
|
+
|
|
11
|
+
# Colors for output
|
|
12
|
+
RED='\033[0;31m'
|
|
13
|
+
GREEN='\033[0;32m'
|
|
14
|
+
YELLOW='\033[1;33m'
|
|
15
|
+
BLUE='\033[0;34m'
|
|
16
|
+
NC='\033[0m' # No Color
|
|
17
|
+
|
|
18
|
+
info() { printf "${BLUE}[UPDATE]${NC} %s\n" "$*"; }
|
|
19
|
+
success() { printf "${GREEN}[UPDATE]${NC} %s\n" "$*"; }
|
|
20
|
+
warn() { printf "${YELLOW}[UPDATE]${NC} %s\n" "$*"; }
|
|
21
|
+
error() { printf "${RED}[UPDATE]${NC} %s\n" "$*"; }
|
|
22
|
+
|
|
23
|
+
# Current version (should match package.json and homebrew formula)
|
|
24
|
+
CURRENT_VERSION="0.5.35"
|
|
25
|
+
NPM_PACKAGE="@humanu/orchestra"
|
|
26
|
+
BREW_FORMULA="orchestra"
|
|
27
|
+
|
|
28
|
+
# Function to get latest npm version
|
|
29
|
+
get_npm_latest_version() {
|
|
30
|
+
if command -v npm >/dev/null 2>&1; then
|
|
31
|
+
npm view "$NPM_PACKAGE" version 2>/dev/null || echo "unknown"
|
|
32
|
+
else
|
|
33
|
+
echo "npm_not_found"
|
|
34
|
+
fi
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
# Function to get latest homebrew version
|
|
38
|
+
get_brew_latest_version() {
|
|
39
|
+
if command -v brew >/dev/null 2>&1; then
|
|
40
|
+
brew info --json "$BREW_FORMULA" 2>/dev/null | \
|
|
41
|
+
python3 -c "import sys, json; data = json.load(sys.stdin); print(data[0]['versions']['stable'])" 2>/dev/null || \
|
|
42
|
+
echo "unknown"
|
|
43
|
+
else
|
|
44
|
+
echo "brew_not_found"
|
|
45
|
+
fi
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
# Function to detect installation method
|
|
49
|
+
detect_installation_method() {
|
|
50
|
+
local method="unknown"
|
|
51
|
+
|
|
52
|
+
# Check if installed via npm
|
|
53
|
+
if command -v npm >/dev/null 2>&1; then
|
|
54
|
+
if npm list -g "$NPM_PACKAGE" >/dev/null 2>&1; then
|
|
55
|
+
method="npm"
|
|
56
|
+
fi
|
|
57
|
+
fi
|
|
58
|
+
|
|
59
|
+
# Check if installed via homebrew (override npm if both)
|
|
60
|
+
if command -v brew >/dev/null 2>&1; then
|
|
61
|
+
if brew list "$BREW_FORMULA" >/dev/null 2>&1; then
|
|
62
|
+
method="brew"
|
|
63
|
+
fi
|
|
64
|
+
fi
|
|
65
|
+
|
|
66
|
+
# Check if running from local development
|
|
67
|
+
if [[ -f "$(dirname "${BASH_SOURCE[0]}")/../../../gw-tui/Cargo.toml" ]]; then
|
|
68
|
+
method="local"
|
|
69
|
+
fi
|
|
70
|
+
|
|
71
|
+
echo "$method"
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
# Function to compare versions (simple string comparison)
|
|
75
|
+
version_compare() {
|
|
76
|
+
local current="$1" latest="$2"
|
|
77
|
+
|
|
78
|
+
if [[ "$current" == "$latest" ]]; then
|
|
79
|
+
echo "equal"
|
|
80
|
+
else
|
|
81
|
+
# Simple version comparison - this works for most semantic versions
|
|
82
|
+
if [[ "$current" < "$latest" ]]; then
|
|
83
|
+
echo "older"
|
|
84
|
+
else
|
|
85
|
+
echo "newer"
|
|
86
|
+
fi
|
|
87
|
+
fi
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
# Main update check function
|
|
91
|
+
check_updates() {
|
|
92
|
+
info "Checking for Orchestra updates..."
|
|
93
|
+
echo
|
|
94
|
+
|
|
95
|
+
# Detect installation method
|
|
96
|
+
local install_method
|
|
97
|
+
install_method=$(detect_installation_method)
|
|
98
|
+
info "Detected installation method: $install_method"
|
|
99
|
+
|
|
100
|
+
# Get current and latest versions based on installation method
|
|
101
|
+
local current_version latest_version comparison
|
|
102
|
+
|
|
103
|
+
case "$install_method" in
|
|
104
|
+
"npm")
|
|
105
|
+
current_version=$(npm list -g "$NPM_PACKAGE" 2>/dev/null | grep "$NPM_PACKAGE@" | sed 's/.*@//' | head -1)
|
|
106
|
+
latest_version=$(get_npm_latest_version)
|
|
107
|
+
;;
|
|
108
|
+
"brew")
|
|
109
|
+
current_version=$(brew info --json "$BREW_FORMULA" 2>/dev/null | \
|
|
110
|
+
python3 -c "import sys, json; data = json.load(sys.stdin); print(data[0]['installed'][0]['version'])" 2>/dev/null || \
|
|
111
|
+
echo "$CURRENT_VERSION")
|
|
112
|
+
latest_version=$(get_brew_latest_version)
|
|
113
|
+
;;
|
|
114
|
+
"local")
|
|
115
|
+
info "Running from local development source"
|
|
116
|
+
info "Current version: $CURRENT_VERSION (development)"
|
|
117
|
+
info "To update, pull latest changes from git repository"
|
|
118
|
+
return 0
|
|
119
|
+
;;
|
|
120
|
+
*)
|
|
121
|
+
warn "Could not detect installation method"
|
|
122
|
+
current_version="$CURRENT_VERSION"
|
|
123
|
+
latest_version=$(get_npm_latest_version)
|
|
124
|
+
;;
|
|
125
|
+
esac
|
|
126
|
+
|
|
127
|
+
echo
|
|
128
|
+
info "Current version: $current_version"
|
|
129
|
+
info "Latest version: $latest_version"
|
|
130
|
+
echo
|
|
131
|
+
|
|
132
|
+
# Compare versions
|
|
133
|
+
comparison=$(version_compare "$current_version" "$latest_version")
|
|
134
|
+
|
|
135
|
+
case "$comparison" in
|
|
136
|
+
"equal")
|
|
137
|
+
success "✅ You are running the latest version!"
|
|
138
|
+
;;
|
|
139
|
+
"older")
|
|
140
|
+
warn "⚠️ A newer version is available!"
|
|
141
|
+
echo
|
|
142
|
+
info "Update instructions:"
|
|
143
|
+
case "$install_method" in
|
|
144
|
+
"npm")
|
|
145
|
+
echo " npm install -g $NPM_PACKAGE"
|
|
146
|
+
;;
|
|
147
|
+
"brew")
|
|
148
|
+
echo " brew upgrade $BREW_FORMULA"
|
|
149
|
+
;;
|
|
150
|
+
*)
|
|
151
|
+
echo " npm install -g $NPM_PACKAGE"
|
|
152
|
+
echo " or"
|
|
153
|
+
echo " brew install $BREW_FORMULA"
|
|
154
|
+
;;
|
|
155
|
+
esac
|
|
156
|
+
echo
|
|
157
|
+
info "Release notes: https://github.com/humanunsupervised/orchestra/releases"
|
|
158
|
+
return 1
|
|
159
|
+
;;
|
|
160
|
+
"newer")
|
|
161
|
+
success "✅ You are running a newer version than latest release!"
|
|
162
|
+
info "This might be a development or pre-release version."
|
|
163
|
+
;;
|
|
164
|
+
*)
|
|
165
|
+
error "Could not determine version comparison"
|
|
166
|
+
return 1
|
|
167
|
+
;;
|
|
168
|
+
esac
|
|
169
|
+
|
|
170
|
+
return 0
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
# Run the update check
|
|
174
|
+
check_updates "$@"
|
|
@@ -23,3 +23,33 @@ gwr_find_binary() {
|
|
|
23
23
|
|
|
24
24
|
return 1
|
|
25
25
|
}
|
|
26
|
+
|
|
27
|
+
gwr_should_check_updates() {
|
|
28
|
+
# Check if we should run update check (once per day)
|
|
29
|
+
local last_check_file="${HOME}/.cache/orchestra/last_update_check"
|
|
30
|
+
local current_time=$(date +%s)
|
|
31
|
+
local last_check=0
|
|
32
|
+
|
|
33
|
+
if [[ -f "$last_check_file" ]]; then
|
|
34
|
+
last_check=$(cat "$last_check_file" 2>/dev/null || echo 0)
|
|
35
|
+
fi
|
|
36
|
+
|
|
37
|
+
# Check if more than 24 hours have passed (86400 seconds)
|
|
38
|
+
local time_diff=$((current_time - last_check))
|
|
39
|
+
if [[ $time_diff -gt 86400 ]]; then
|
|
40
|
+
# Create cache directory if it doesn't exist
|
|
41
|
+
mkdir -p "$(dirname "$last_check_file")"
|
|
42
|
+
echo "$current_time" > "$last_check_file"
|
|
43
|
+
return 0
|
|
44
|
+
fi
|
|
45
|
+
|
|
46
|
+
return 1
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
gwr_check_updates_silent() {
|
|
50
|
+
# Silent update check that doesn't interfere with normal operation
|
|
51
|
+
if gwr_should_check_updates; then
|
|
52
|
+
# Run update check in background, only show if update available
|
|
53
|
+
"$SCRIPT_DIR/shell/gwr/check-updates.sh" 2>/dev/null | grep -E "(⚠️|newer version|Update instructions)" || true
|
|
54
|
+
fi
|
|
55
|
+
}
|
|
@@ -11,6 +11,8 @@ A terminal user interface for managing git worktrees and tmux sessions.
|
|
|
11
11
|
Options:
|
|
12
12
|
-d, --debug Enable debug mode
|
|
13
13
|
-h, --help Show this help
|
|
14
|
+
--check-updates Check for available updates
|
|
15
|
+
--update Check for available updates (alias for --check-updates)
|
|
14
16
|
|
|
15
17
|
Features:
|
|
16
18
|
• Interactive worktree and session management
|
|
@@ -44,6 +46,7 @@ Examples:
|
|
|
44
46
|
gwr # Launch interactive TUI
|
|
45
47
|
gwr --debug # Launch with debug information
|
|
46
48
|
gwr --help # Show this help
|
|
49
|
+
gwr --update # Check for available updates
|
|
47
50
|
|
|
48
51
|
EOF
|
|
49
52
|
}
|