Improve tool update output and version display

Fixed two UX issues in tool update management:

1. Version Check Output:
   - Extract version numbers using regex (v1.2.3 pattern)
   - Show clean version instead of full banner output
   - Fallback to "installed" if version can't be parsed
   - Fixes noise from tool ASCII art banners

2. Update All Go Tools:
   - List all tools before confirmation prompt
   - Show which tools are installed vs will be skipped
   - Skip uninstalled tools during update loop
   - Report skipped count in final summary
   - Users can see exactly what will be updated

Changes:
- Added regex version extraction in check_tool_versions()
- Added tool list display in update_all_go_tools()
- Added skip logic for uninstalled tools
- Updated summary to show: Updated | Failed | Skipped

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
rpriven 2025-11-01 00:11:49 -06:00
parent bb18a5c070
commit c4f40e79c8
Signed by: djedi
GPG key ID: D04DED574622EF45

View file

@ -527,15 +527,29 @@ def check_tool_versions(logger):
text=True, text=True,
timeout=5 timeout=5
) )
installed_version = result.stdout.strip() or result.stderr.strip()
# For now, mark as "installed" - actual version comparison would require # Try to extract just the version number, not the full banner
# querying go.dev or GitHub API version_output = result.stdout.strip() or result.stderr.strip()
# Many tools print version on first line - extract it
if version_output:
first_line = version_output.split('\n')[0]
# Look for version patterns like "v1.2.3" or "1.2.3"
import re
version_match = re.search(r'v?\d+\.\d+\.\d+', first_line)
if version_match:
installed_version = version_match.group(0)
else:
# Fallback to first line if no version pattern found
installed_version = first_line[:50]
else:
installed_version = "installed"
up_to_date.append((tool_name, installed_version)) up_to_date.append((tool_name, installed_version))
except Exception as e: except Exception as e:
logger.debug(f"Could not get version for {tool_name}: {e}") logger.debug(f"Could not get version for {tool_name}: {e}")
up_to_date.append((tool_name, "unknown version")) up_to_date.append((tool_name, "installed"))
# Display results # Display results
if up_to_date: if up_to_date:
@ -610,6 +624,16 @@ def update_all_go_tools(logger):
print_info(f"Total tools: {len(config.GO_TOOLS)}") print_info(f"Total tools: {len(config.GO_TOOLS)}")
print() print()
# List all tools that will be updated
print(colorize("Tools to update:", 'cyan'))
for tool_name in config.GO_TOOLS.keys():
# Check if installed
if check_command_exists(tool_name):
print(colorize(f"{tool_name}", 'green'))
else:
print(colorize(f"{tool_name} (not installed, will skip)", 'yellow'))
print()
response = input(colorize("Continue? [y/N]: ", 'yellow')).strip().lower() response = input(colorize("Continue? [y/N]: ", 'yellow')).strip().lower()
if response != 'y': if response != 'y':
print_warning("Update cancelled") print_warning("Update cancelled")
@ -619,8 +643,14 @@ def update_all_go_tools(logger):
print() print()
success_count = 0 success_count = 0
fail_count = 0 fail_count = 0
skipped_count = 0
for tool_name, module_path in config.GO_TOOLS.items(): for tool_name, module_path in config.GO_TOOLS.items():
# Skip if not installed
if not check_command_exists(tool_name):
skipped_count += 1
continue
print(f"Updating {tool_name}...", end=' ') print(f"Updating {tool_name}...", end=' ')
try: try:
result = subprocess.run( result = subprocess.run(
@ -645,7 +675,7 @@ def update_all_go_tools(logger):
logger.error(f"Error updating {tool_name}: {e}") logger.error(f"Error updating {tool_name}: {e}")
print() print()
print_info(f"Updated: {success_count} | Failed: {fail_count}") print_info(f"Updated: {success_count} | Failed: {fail_count} | Skipped: {skipped_count}")
print() print()
input("Press Enter to continue...") input("Press Enter to continue...")