Skip to content

Conversation

@leoafarias
Copy link
Collaborator

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

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
@docs-page
Copy link

docs-page bot commented Dec 27, 2025

To view this pull requests documentation preview, visit the following URL:

docs.page/btwld/mix~811

Documentation is deployed and generated using docs.page.

@vercel
Copy link
Contributor

vercel bot commented Dec 27, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
mix-docs Ready Ready Preview, Comment Dec 28, 2025 0:16am

Copy link
Contributor

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 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
Copy link

Copilot AI Dec 27, 2025

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.

Copilot uses AI. Check for mistakes.
# 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
Copy link

Copilot AI Dec 27, 2025

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.

Suggested change
fvm dart pub global activate melos >/dev/null
fvm dart pub global activate melos >/dev/null 2>&1

Copilot uses AI. Check for mistakes.
setup.sh Outdated
# shellcheck disable=SC2086
fvm install $FVM_INSTALL_ARGS
else
log "No .fvmrc found; skipping 'fvm install'"
Copy link

Copilot AI Dec 27, 2025

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.

Suggested change
log "No .fvmrc found; skipping 'fvm install'"
log "No FVM project config (.fvmrc or .fvm/fvm_config.json) found; skipping 'fvm install'"

Copilot uses AI. Check for mistakes.
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"
Copy link

Copilot AI Dec 27, 2025

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.

Suggested change
printf '%s' "$line" >> "$CLAUDE_ENV_FILE"
printf '%s\n' "$line" >> "$CLAUDE_ENV_FILE"

Copilot uses AI. Check for mistakes.
setup.sh Outdated
Comment on lines 40 to 42
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
Copy link

Copilot AI Dec 27, 2025

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.

Copilot uses AI. Check for mistakes.
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
@leoafarias leoafarias closed this Dec 28, 2025
@leoafarias leoafarias deleted the claude/flutter-setup-script-Yy30A branch January 15, 2026 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants