Skip to content

feat: Git Bash can install and complete uloop on Windows#1055

Merged
hatayama merged 2 commits into
v3-betafrom
codex/windows-git-bash-support
May 5, 2026
Merged

feat: Git Bash can install and complete uloop on Windows#1055
hatayama merged 2 commits into
v3-betafrom
codex/windows-git-bash-support

Conversation

@hatayama
Copy link
Copy Markdown
Owner

@hatayama hatayama commented May 5, 2026

Summary

  • Windows users can install the native uloop launcher from Git Bash/MSYS using the POSIX installer.
  • Shell completion now selects bash completion in Git Bash while preserving PowerShell defaults in regular Windows terminals.

User Impact

  • Previously, running scripts/install.sh from Git Bash failed with Unsupported OS: MINGW64_NT....
  • After this change, Git Bash users can install uloop.exe, install completion into .bashrc, and use the documented completion helper commands from the same shell.

Changes

  • Teach scripts/install.sh to resolve the published uloop-windows-amd64.zip asset, page through GitHub releases for matching assets, verify checksums, extract zip files, and smoke-test uloop.exe before installation.
  • Detect Git Bash/MSYS for completion installation and keep PowerShell/pwsh behavior unchanged for normal Windows shells.
  • Align help and error guidance with the top-level uloop --list-commands and uloop --list-options <command> helpers.
  • Refresh checked-in native CLI dist binaries.

Verification

  • GOROOT=/c/Users/booql/sdk/go1.26.1 PATH=/c/Users/booql/sdk/go1.26.1/bin:/c/Users/booql/go/bin:$PATH scripts/check-go-cli-source.sh
  • GOROOT=/c/Users/booql/sdk/go1.26.1 PATH=/c/Users/booql/sdk/go1.26.1/bin:/c/Users/booql/go/bin:$PATH scripts/check-go-cli.sh
  • Git Bash smoke: ULOOP_INSTALL_DIR=$(mktemp -d) sh scripts/install.sh
  • Git Bash smoke: uloop completion --install with a temporary HOME
  • Git Bash smoke: uloop --list-commands and uloop --list-options compile

Git Bash Support for uloop Installation and Completion on Windows

This PR enables Windows users running Git Bash/MSYS to install and complete uloop, resolving a previous limitation where the POSIX installer would fail with "Unsupported OS: MINGW64_NT...".

Key Changes

Shell Detection Enhancement

  • Added detectShellFromEnvironment() helper in completion.go and completion_shell.go that intelligently routes shell detection based on the platform and environment variables
    • On Windows: Returns bash/zsh only when both a POSIX shell is detected from SHELL and MSYSTEM environment variable is set (indicating Git Bash/MSYS); otherwise defaults to PowerShell
    • On non-Windows platforms: Returns the detected POSIX shell from SHELL
  • Updated detectPosixShell() to no longer short-circuit to PowerShell on Windows, allowing proper POSIX shell detection when appropriate

Installation Script Refactoring (scripts/install.sh)

  • Introduced detect_installed_command_name() helper to derive the target command name (e.g., uloop.exe on Windows) from the asset type (ZIP vs tarball)
  • Refactored into set_download_urls() that searches GitHub releases for the latest matching asset via find_latest_asset_url(), replacing hardcoded "latest/download" URL patterns
  • Created generalized extract_asset() function to handle both ZIP archives (via unzip) and tarballs
  • Added explicit version verification post-installation using the installed command name
  • Updated report_path_shadowing() to use the computed installed command name rather than hardcoding uloop

Help and Error Guidance Updates

  • Updated help text across run_help.go and help.go to document uloop --list-commands and uloop --list-options <command> as the primary methods for listing commands/options
  • Removed references to deprecated uloop completion --list-commands and uloop completion --list-options <command> patterns
  • Updated error guidance in tools.go to direct users to uloop --list-options <tool>

Test Coverage

  • Added TestDetectShellOnWindowsGitBashUsesBash() to verify Git Bash environments are detected as bash shells
  • Added TestDetectShellOnWindowsPowerShellDefaultsToPowerShell() to ensure non-Git Bash Windows terminals still default to PowerShell
  • Updated existing Windows shell-detection tests in dispatcher_test.go to pass the new msystem parameter

User Impact

  • Git Bash/MSYS users can now run scripts/install.sh to install uloop.exe
  • Bash completion is automatically installed to .bashrc when running in Git Bash
  • PowerShell/pwsh behavior remains unchanged for regular Windows terminals
  • Installation process now handles Windows-specific asset types with proper verification

Allow the POSIX installer to resolve and install the Windows amd64 release asset from Git Bash/MSYS, including paged latest-release lookup and zip extraction.

Detect Git Bash for completion installation while preserving the PowerShell defaults for regular Windows terminals, and align user-facing completion helper guidance with the top-level --list-* commands.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 5, 2026

Warning

Rate limit exceeded

@hatayama has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 42 minutes and 31 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 97824259-3cdd-4bb1-a599-a22d1ebee1f9

📥 Commits

Reviewing files that changed from the base of the PR and between 060d261 and 5adff4b.

📒 Files selected for processing (1)
  • scripts/install.sh
📝 Walkthrough

Walkthrough

This PR refactors shell detection to support MSYSTEM environment variable (for Git Bash on Windows), updates CLI help text to promote global --list-commands and --list-options flags instead of the completion subcommand, and rearchitectures the installation script to generically handle multiple asset types (ZIP and tarball) with dynamic command name detection.

Changes

Shell Detection with MSYSTEM Support & Completion UX

Layer / File(s) Summary
Shell Detection Logic
Packages/src/Cli~/Core~/internal/presentation/cli/completion.go, Packages/src/Cli~/Dispatcher~/internal/dispatcher/completion_shell.go
New detectShellFromEnvironment(goos, shellPath, msystem) helper detects POSIX shells from SHELL and returns them on Windows only when MSYSTEM is non-empty; otherwise defaults to powershell. detectPosixShell no longer contains Windows-specific fallback behavior.
Shell Detection Tests
Packages/src/Cli~/Core~/internal/presentation/cli/completion_test.go, Packages/src/Cli~/Dispatcher~/internal/dispatcher/dispatcher_test.go
Added test cases for Git Bash with MINGW64 detection and PowerShell fallback on Windows. Updated existing test calls to pass msystem parameter.
Help Text Updates
Packages/src/Cli~/Core~/internal/presentation/cli/run_help.go, Packages/src/Cli~/Dispatcher~/internal/dispatcher/help.go, Packages/src/Cli~/Core~/internal/presentation/cli/tools.go
Replaced references to uloop completion --list-commands and uloop completion --list-options with global flags uloop --list-commands and uloop --list-options <command> in help output and error messages.
Help Text Tests & Verification
Packages/src/Cli~/Core~/internal/presentation/cli/help_test.go
Updated help output test assertion to match new global-flag guidance strings.

Installation Script Refactoring for Multi-Asset Support

Layer / File(s) Summary
Asset & Command Name Detection
scripts/install.sh
New detect_asset_name() returns uloop-windows-amd64.zip for Windows (amd64 only) or uloop-$os_name-$arch_name.tar.gz for others. New detect_installed_command_name() maps ZIP assets to uloop.exe and others to uloop.
Download URL Resolution
scripts/install.sh
New find_latest_asset_url() searches GitHub releases for the latest matching asset. New set_download_urls() uses this for VERSION=latest instead of hardcoded "latest/download" pattern.
Extraction & Installation
scripts/install.sh
New extract_asset() generalizes extraction for both ZIP and tarball formats. Installation flow now uses installed_command_name consistently for staging, extraction, and placement.
Verification & Path Shadowing
scripts/install.sh
Version check and report_path_shadowing() now use "$INSTALL_DIR/$installed_command_name" (e.g., uloop.exe on Windows) instead of hardcoded uloop.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 11.11% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: enabling Git Bash support for installing and completing uloop on Windows, which is the primary objective of this PR.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/windows-git-bash-support

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
scripts/install.sh (1)

25-53: ⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Add Linux support to OS detection or the installer will fail on Linux systems.

The case "$os" block handles Darwin and MINGW*|MSYS*, but on Linux, uname -s returns "Linux", which hits the catch-all and exits with "Unsupported OS: Linux". Add a Linux case:

    Linux) os_name="linux" ;;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/install.sh` around lines 25 - 53, The OS detection case for "$os"
fails to recognize Linux; update the case handling in the installer script to
add a Linux branch by mapping "Linux" to os_name="linux" so uname -s values on
Linux produce the correct os_name; modify the case that currently matches Darwin
and MINGW*|MSYS* to include a Linux) os_name="linux" ;; entry (affecting
variables os and os_name and the final artifact name echo
"uloop-$os_name-$arch_name.tar.gz").
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/install.sh`:
- Around line 114-128: The ZIP extraction can leave files nested and install
expects $tmp_dir/uloop.exe; update extract_asset (referencing asset_name and
tmp_dir) to ensure binaries end up at tmp_dir root: either use unzip with
path-stripping (e.g., the -j/junk-paths option) or after unzip, search for
uloop.exe under $tmp_dir and move it to $tmp_dir/uloop.exe (cleaning any created
subdirs); also preserve the existing tar fallback behavior for non-zip assets.

---

Outside diff comments:
In `@scripts/install.sh`:
- Around line 25-53: The OS detection case for "$os" fails to recognize Linux;
update the case handling in the installer script to add a Linux branch by
mapping "Linux" to os_name="linux" so uname -s values on Linux produce the
correct os_name; modify the case that currently matches Darwin and MINGW*|MSYS*
to include a Linux) os_name="linux" ;; entry (affecting variables os and os_name
and the final artifact name echo "uloop-$os_name-$arch_name.tar.gz").
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a0369e19-7be2-4730-a577-449e6b62c5f6

📥 Commits

Reviewing files that changed from the base of the PR and between 8648984 and 060d261.

⛔ Files ignored due to path filters (6)
  • Packages/src/Cli~/Core~/dist/darwin-amd64/uloop-core is excluded by !**/dist/** and included by none
  • Packages/src/Cli~/Core~/dist/darwin-arm64/uloop-core is excluded by !**/dist/** and included by none
  • Packages/src/Cli~/Core~/dist/windows-amd64/uloop-core.exe is excluded by !**/dist/**, !**/*.exe and included by none
  • Packages/src/Cli~/Dispatcher~/dist/darwin-amd64/uloop-dispatcher is excluded by !**/dist/** and included by none
  • Packages/src/Cli~/Dispatcher~/dist/darwin-arm64/uloop-dispatcher is excluded by !**/dist/** and included by none
  • Packages/src/Cli~/Dispatcher~/dist/windows-amd64/uloop-dispatcher.exe is excluded by !**/dist/**, !**/*.exe and included by none
📒 Files selected for processing (9)
  • Packages/src/Cli~/Core~/internal/presentation/cli/completion.go
  • Packages/src/Cli~/Core~/internal/presentation/cli/completion_test.go
  • Packages/src/Cli~/Core~/internal/presentation/cli/help_test.go
  • Packages/src/Cli~/Core~/internal/presentation/cli/run_help.go
  • Packages/src/Cli~/Core~/internal/presentation/cli/tools.go
  • Packages/src/Cli~/Dispatcher~/internal/dispatcher/completion_shell.go
  • Packages/src/Cli~/Dispatcher~/internal/dispatcher/dispatcher_test.go
  • Packages/src/Cli~/Dispatcher~/internal/dispatcher/help.go
  • scripts/install.sh

Comment thread scripts/install.sh
Fail with a clear installer error when the Windows release archive does not contain the expected uloop.exe at the archive root, so Git Bash installs do not continue to a cryptic missing-path failure.
@hatayama hatayama merged commit 7f7c78d into v3-beta May 5, 2026
11 checks passed
@hatayama hatayama deleted the codex/windows-git-bash-support branch May 5, 2026 15:55
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.

1 participant