Skip to content

Conversation

@cabljac
Copy link
Contributor

@cabljac cabljac commented Aug 13, 2025

Firebase Studio integration was reportedly getting the following:

Screenshot 2025-08-13 at 11 00 11

This PR:

  • euid/sudo aware installs: if not root and install dir isn’t writable, use sudo when available; otherwise fall back to ~/.local/bin. Uninstall path uses the same logic.
  • Correct install detection: separated desired target from existing binary; only treat as installed if an executable exists, preventing false “corrupted/installed” when GENKIT_BINARY is set.
  • Repro + validation: added .github/workflows/repro-install-cli.yml to reproduce the sudo-less failure and confirm the fixed script installs locally; verified locally with act.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes an installation issue where the Genkit CLI install script fails on machines without sudo privileges. The fix implements fallback installation logic that uses ~/.local/bin when sudo is not available or when the user cannot write to the global installation directory.

  • Adds smart installation logic that checks for sudo availability and directory write permissions
  • Fixes installation detection to properly identify existing executables vs environment variables
  • Adds GitHub Actions workflow to reproduce and validate the sudo-less installation scenario

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@cabljac cabljac marked this pull request as ready for review August 13, 2025 12:28
@pavelgj
Copy link
Collaborator

pavelgj commented Aug 20, 2025

@cabljac were you able to repro this in Firebase Studio? You can just create a workspace in https://idx.google.com

IDX is nix. I think in their setup the problem might be that you don't get root access at all (can't sudo nor su). /usr/local/bin also doesn't exist and you can't create it.

I wonder if we need a "local=true" install option that writes the binary to $HOME/.local/bin instead of /usr/local/bin?

- Add explicit local install option (GENKIT_INSTALL=local, local=true)
- Improve sudo detection with has_usable_sudo() helper
- Better uninstall logic with proper target detection
- Enhanced PATH guidance for user-local installs
- Add error suppression for graceful failure handling
- Support cloud environments without sudo access
- Add --debug/-d flag for verbose diagnostics (shows stderr from version probes)
- Namespace local install env var as GENKIT_CLI_LOCAL for consistency
- Improve --local help text to mention ~/.local/bin and sudo use case
- Add DEBUG=1 environment variable support
@pavelgj pavelgj merged commit 513f33e into main Aug 28, 2025
5 checks passed
@pavelgj pavelgj deleted the @invertase/fix-fs-cli-script branch August 28, 2025 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

3 participants