gemini-cli - ✅(Solved) Fix lint:all fails on Windows despite PR #16193 adding win32 support [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
google-gemini/gemini-cli#25365Fetched 2026-04-15 06:45:23
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Author
Timeline (top)
labeled ×3closed ×1commented ×1cross-referenced ×1

Fix Action

Fixed

PR fix notes

PR #25368: fix(lint): secure and OS-agnostic lint scripts and Windows formatting fixes

Description (problem / solution / changelog)

Summary

This PR addresses the Windows environment linting failures by making the linter execution OS-agnostic, while simultaneously fixing a critical command injection vulnerability identified in PR #22177. It also includes minor workspace formatting fixes to improve the contributor experience on Windows.

Details

Here is the breakdown of each file change and why it was needed:

  • scripts/lint.js: Refactored runCommand and the individual linting functions (runShellcheck, runYamllint, runActionlint, runESLint, runPrettier). Replaced unsafe string concatenation and shell: true with spawnSync using an array of arguments and shell: false. This ensures filenames containing shell metacharacters are treated as literals, completely mitigating the command injection vulnerability. We conditionally allow shell: true only for npm.cmd and npx.cmd on Windows to enable path resolution.
  • .prettierignore: Added CONTRIBUTING.md to the ignore list. Prettier was adding newlines to the file, which caused annoying formatting issues and Git diff noise for Windows contributors.
  • .gitignore: Added packages/core/src/sandbox/windows/*.exe to ignore the Windows sandbox helper binaries generated during the npm run preflight build step. Without this, the generated binary showed up as an untracked file change in Git.

Related Issues

Fixes #22149 Fixes #25365

How to Validate

  1. Check out the branch on a Windows machine.
  2. Run npm run preflight.
  3. Verify that all linters (ESLint, Actionlint, Shellcheck, Yamllint, Prettier) execute successfully.
  4. Verify that no .exe binaries are shown as untracked in git status after the build.
  5. Review scripts/lint.js to confirm spawnSync is used safely with argument arrays.

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
    • Windows
      • npm run
    • Linux

Changed files

  • .gitignore (modified, +3/-0)
  • .prettierignore (modified, +1/-0)
  • scripts/lint.js (modified, +121/-13)

Code Example

> /about
# paste output here

About Gemini CLI
CLI Version                           0.39.0-nightly.20260414.gdaf500623
Git Commit                            5781aa6f0
Model                                 Auto (Gemini 3)
Sandbox                               no sandbox
OS                                    win32
Auth Method                           Signed in with Google
Tier                                  Gemini Code Assist in Google One AI Pro

> Platform
| Windows
| Powershell Terminal / Git Bash
RAW_BUFFERClick to expand / collapse

What happened?

npm run lint:all fails on Windows with "'grep' is not recognized" errors.

PR #16193 (Feb 2026) added Windows support to lint.js for linter installation and PATH handling, but the run commands for shellcheck and yamllint (lines 142–157) still use Unix pipe chains (git ls-files | grep | xargs | awk | sed) that do not work in Windows.

What did you expect to happen?

npm run lint:all should complete successfully on Windows without requiring Unix utilities like grep, xargs, awk, or sed.

Client information

<details> <summary>Client Information</summary>

Run gemini to enter the interactive CLI, then run the /about command.

> /about
# paste output here

│ About Gemini CLI
│ CLI Version                           0.39.0-nightly.20260414.gdaf500623
│ Git Commit                            5781aa6f0
│ Model                                 Auto (Gemini 3)
│ Sandbox                               no sandbox
│ OS                                    win32
│ Auth Method                           Signed in with Google
│ Tier                                  Gemini Code Assist in Google One AI Pro

> Platform
| Windows
| Powershell Terminal / Git Bash
</details>

Login information

Via google account.

Anything else we need to know?

  • Related: Issue #15074 (Dec 2025) → PR #16193 (Feb 2026) closed both
  • What #16193 fixed: platform detection, linter installation, PATH handling
  • What #16193 missed: the LINTERS.run commands still use Unix pipes on lines 142–157
  • Node.js: v25.9.0 | Platform: Windows 11 Pro (win32 x64)
  • Proposed fix: Windows-specific file filtering via Node.js, consistent with the existing Windows code paths

extent analysis

TL;DR

Modify the lint.js file to use Windows-compatible commands or Node.js file filtering for the shellcheck and yamllint run commands.

Guidance

  • Identify the specific lines of code (142-157) in lint.js that use Unix pipe chains and replace them with equivalent Windows commands or Node.js functions.
  • Use Node.js built-in file system functions to filter files instead of relying on Unix utilities like grep and find.
  • Consider using a cross-platform library or module to handle file operations and avoid platform-specific code.
  • Verify the changes by running npm run lint:all on Windows and checking for any errors.

Example

const fs = require('fs');
const path = require('path');

// Replace Unix pipe chain with Node.js file filtering
const files = fs.readdirSync('.').filter(file => file.endsWith('.sh'));
files.forEach(file => {
  // Run shellcheck or yamllint on each file
});

Notes

The proposed fix should be consistent with the existing Windows code paths and platform detection implemented in PR #16193.

Recommendation

Apply a workaround by modifying the lint.js file to use Windows-compatible commands or Node.js file filtering, as the issue is specific to the shellcheck and yamllint run commands on Windows.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING