Skip to content

Conversation

@ZafeerMahmood
Copy link

Summary

Add Windows (win32/x64) support to scripts/lint.js to fix the "Unsupported platform/architecture" error when running npm run preflight on Windows.

Details

  • Added win32/x64 case to getPlatformArch() returning windows_amd64 for actionlint and shellcheck
  • Added platform-specific variables following existing codebase conventions:
    • isWindows flag for platform detection
    • actionlintCheck/Installer - uses where and PowerShell on Windows
    • shellcheckCheck/Installer - uses where and PowerShell on Windows
    • yamllintInstaller - uses python instead of python3 on Windows
  • Fixed runCommand() PATH handling: uses ; separator and Scripts/ directory on Windows
  • All Unix code paths remain unchanged via ternary operators

Related Issues

Fixes #15074

How to Validate

  1. On Windows x64, run:
    node scripts/lint.js --setup
  2. Expected: Linters install successfully without "Unsupported platform/architecture" error
  3. Run ESLint check:
    node scripts/lint.js --eslint
  4. Expected: ESLint runs successfully
  5. Verify Unix systems still work (no regression):
    - On macOS/Linux, run node scripts/lint.js --setup - should work as before

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run
      • npx
      • Docker
      • Podman
      • Seatbelt
    • Windows
      • npm run
      • npx
      • Docker
    • Linux
      • npm run
      • npx
      • Docker

@ZafeerMahmood ZafeerMahmood requested a review from a team as a code owner January 8, 2026 20:11
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @ZafeerMahmood, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the scripts/lint.js utility to provide full compatibility with Windows operating systems. The primary goal is to eliminate the 'Unsupported platform/architecture' error that previously prevented linting processes from running on Windows. By introducing platform-aware logic for linter detection, installation, and command execution, the changes ensure a consistent and functional linting experience across both Windows and Unix-like environments, thereby improving developer workflow and code quality checks for all users.

Highlights

  • Windows Platform Support: Added specific support for Windows (win32/x64) to the scripts/lint.js file, resolving the 'Unsupported platform/architecture' error when running preflight checks on Windows.
  • Linter Configuration for Windows: Implemented platform-specific checks and installers for actionlint, shellcheck, and yamllint to correctly function on Windows, utilizing where and PowerShell for command execution and installation.
  • PATH Handling Improvement: Updated the runCommand() function to correctly handle Windows PATH conventions, using the semicolon (;) as a separator and pointing to the Scripts/ directory for Python virtual environments on Windows.
  • Python Version for yamllint: Adjusted the yamllintInstaller to use python instead of python3 on Windows, aligning with common Python installation practices on that OS.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request aims to add Windows support to the lint.js script. While previously identified command injection vulnerabilities related to environment variables are acceptable for developer-facing build scripts in trusted environments, there are still critical functional issues with the shellcheck installer for Windows. These include an incorrect platform architecture identifier, a wrong download URL, and faulty extraction logic that doesn't correctly handle the zip archive's directory structure. Additionally, consider refactoring the use of execSync with shell: true for improved robustness, even if the immediate security risk from environment variables is mitigated.

@ZafeerMahmood
Copy link
Author

/gemini review

@gemini-cli gemini-cli bot added priority/p2 Important but can be addressed in a future release. area/platform Issues related to Build infra, Release mgmt, Testing, Eval infra, Capacity, Quota mgmt labels Jan 8, 2026
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds Windows support to the lint.js script, which is a great improvement for cross-platform development. However, a critical issue was found in the Windows installer logic for shellcheck that would prevent it from working, specifically regarding an incorrect download URL and executable renaming after extraction. Detailed comments and a code suggestion are provided for this fix.

Comment on lines +90 to +93
? `powershell -Command "` +
`Invoke-WebRequest -Uri 'https://github.com/koalaman/shellcheck/releases/download/v${SHELLCHECK_VERSION}/shellcheck-v${SHELLCHECK_VERSION}.zip' -OutFile '${TEMP_DIR}/.shellcheck.zip'; ` +
`Add-Type -AssemblyName System.IO.Compression.FileSystem; ` +
`[System.IO.Compression.ZipFile]::ExtractToDirectory('${TEMP_DIR}/.shellcheck.zip', '${TEMP_DIR}/shellcheck')"`
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

The Windows installer for shellcheck has a couple of issues that will prevent it from working correctly:

  1. Incorrect URL: The download URL is hardcoded to .../shellcheck-v${SHELLCHECK_VERSION}.zip, which will result in a 404 error. The URL needs to include the platform and architecture, similar to the other installers. The correct asset for Windows is named like shellcheck-vX.Y.Z.win.x86_64.zip.
  2. Incorrect Executable Name: The zip file contains a versioned executable (e.g., shellcheck-v0.11.0.exe). After extraction, the script will look for shellcheck.exe in the PATH and fail to find it. The installer needs to rename the executable to shellcheck.exe after extraction.

I've included a suggestion that also adds a New-Item command for consistency with the actionlint installer and fixes both issues.

  ? `powershell -Command "` +
    `New-Item -ItemType Directory -Force -Path '${TEMP_DIR}/shellcheck' | Out-Null; ` +
    `Invoke-WebRequest -Uri 'https://github.com/koalaman/shellcheck/releases/download/v${SHELLCHECK_VERSION}/shellcheck-v${SHELLCHECK_VERSION}.${platformArch.shellcheck}.zip' -OutFile '${TEMP_DIR}/.shellcheck.zip'; ` +
    `Add-Type -AssemblyName System.IO.Compression.FileSystem; ` +
    `[System.IO.Compression.ZipFile]::ExtractToDirectory('${TEMP_DIR}/.shellcheck.zip', '${TEMP_DIR}/shellcheck'); ` +
    `Move-Item -Path '${TEMP_DIR}/shellcheck/shellcheck-v${SHELLCHECK_VERSION}.exe' -Destination '${TEMP_DIR}/shellcheck/shellcheck.exe'"

Copy link
Author

Choose a reason for hiding this comment

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

curl -sI "https://github.com/koalaman/shellcheck/releases/download/v0.11.0/shellcheck-v0.11.0.zip"
returns HTTP/1.1 302 Found

curl -sI "https://github.com/koalaman/shellcheck/releases/download/v0.11.0/shellcheck-v0.11.0.win.x86_64.zip"
HTTP/1.1 404 Not Found

image image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/platform Issues related to Build infra, Release mgmt, Testing, Eval infra, Capacity, Quota mgmt priority/p2 Important but can be addressed in a future release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unsupported platform/architecture: win32/x64 in lint:ci on Windows

1 participant