-
Notifications
You must be signed in to change notification settings - Fork 46
feat: add Flutter/FVM setup script #811
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Add a shell script that automates Flutter development environment setup: - Installs FVM (Flutter Version Manager) - Downloads the Flutter SDK version specified in .fvmrc - Installs and runs melos bootstrap for monorepo support - Handles PATH persistence for Claude and shell profiles - Supports various configuration via environment variables
- Remove AI citation artifacts from comments - Simplify verbose comments and log messages - Flatten nested conditionals for melos/pub-get - Remove redundant PATH export
|
To view this pull requests documentation preview, visit the following URL: Documentation is deployed and generated using docs.page. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this 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 adds a comprehensive shell script to automate Flutter development environment setup by installing FVM (Flutter Version Manager), configuring the Flutter SDK, and preparing monorepo dependencies.
Key Changes:
- Implements automated FVM installation with configurable version and installation directory
- Adds intelligent PATH persistence supporting both Claude AI environment and standard shell profiles
- Includes monorepo support with automatic melos bootstrap and fallback to pub get for regular projects
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
setup.sh
Outdated
| if has_fvm_project_config; then | ||
| log "Running: fvm install ${FVM_INSTALL_ARGS}" | ||
| # shellcheck disable=SC2086 | ||
| fvm install $FVM_INSTALL_ARGS |
Copilot
AI
Dec 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The FVM_INSTALL_ARGS variable is used unquoted in the command substitution. While shellcheck is disabled for this line, if FVM_INSTALL_ARGS contains special characters or multiple arguments, they should be properly word-split. However, if the variable is meant to be empty or contain multiple space-separated arguments, this is intentional. Consider documenting in a comment what format FVM_INSTALL_ARGS should take (e.g., "space-separated arguments") to clarify the intended behavior.
| # Melos bootstrap for monorepos | ||
| if [ "$SKIP_MELOS" != "1" ] && [ -f "melos.yaml" ]; then | ||
| log "Installing melos and bootstrapping..." | ||
| fvm dart pub global activate melos >/dev/null |
Copilot
AI
Dec 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The melos bootstrap output is not redirected but the melos activation output is silenced with >/dev/null. For consistency and cleaner output, consider redirecting the activation command to >/dev/null 2>&1 to suppress both stdout and stderr, or removing the redirect entirely to show progress for both commands.
| fvm dart pub global activate melos >/dev/null | |
| fvm dart pub global activate melos >/dev/null 2>&1 |
setup.sh
Outdated
| # shellcheck disable=SC2086 | ||
| fvm install $FVM_INSTALL_ARGS | ||
| else | ||
| log "No .fvmrc found; skipping 'fvm install'" |
Copilot
AI
Dec 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The conditional logic checks for .fvmrc OR .fvm/fvm_config.json to determine if there's a project config, but the log message on line 109 only mentions ".fvmrc". This could be confusing if a project uses .fvm/fvm_config.json instead. Consider updating the message to "No FVM project config found" or "No .fvmrc or .fvm/fvm_config.json found" for clarity.
| log "No .fvmrc found; skipping 'fvm install'" | |
| log "No FVM project config (.fvmrc or .fvm/fvm_config.json) found; skipping 'fvm install'" |
setup.sh
Outdated
| line="$(persist_path_line)" | ||
| if ! grep -Fqs "$line" "$CLAUDE_ENV_FILE"; then | ||
| log "Persisting PATH via CLAUDE_ENV_FILE" | ||
| printf '%s' "$line" >> "$CLAUDE_ENV_FILE" |
Copilot
AI
Dec 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing newline at the end of the appended content. This will cause the next line in CLAUDE_ENV_FILE (if any exists) to be concatenated to the PATH export statement. Consider using printf '%s\n' "$line" instead of printf '%s' "$line" to ensure proper line termination.
| printf '%s' "$line" >> "$CLAUDE_ENV_FILE" | |
| printf '%s\n' "$line" >> "$CLAUDE_ENV_FILE" |
setup.sh
Outdated
| FVM_INSTALL_DIR="$FVM_INSTALL_DIR" curl -fsSL https://fvm.app/install.sh | bash -s -- "$FVM_VERSION" | ||
| else | ||
| FVM_INSTALL_DIR="$FVM_INSTALL_DIR" curl -fsSL https://fvm.app/install.sh | bash |
Copilot
AI
Dec 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This script downloads and executes a remote install script via curl -fsSL https://fvm.app/install.sh | bash, which creates a supply-chain risk: if fvm.app (or the network path to it) is compromised, attackers can execute arbitrary code with the privileges of whoever runs setup.sh. To reduce this risk, avoid piping remote scripts directly into bash and instead vendor the installer into this repo or perform integrity verification (e.g., pinned checksum or signature) on the downloaded script before executing it.
Remove extra features: - PATH persistence to shell profiles - CLAUDE_ENV_FILE support - Various skip/force flags Keep only essential functionality: - Install FVM - Install Flutter via .fvmrc - Run melos bootstrap
Add a shell script that automates Flutter development environment setup: