Add PhpStorm as a Windows FMA - #46217
Conversation
Add Winget input for PhpStorm and corresponding installer/uninstaller scripts. Adds ee/maintained-apps/inputs/winget/phpstorm.json and PowerShell scripts to run the NSIS installer (/S) and to locate/run the registry-listed uninstaller silently. Update outputs/apps.json to include the windows entry and add outputs/phpstorm/windows.json containing version 2026.1.2 metadata, installer URL, sha256, and embedded script refs.
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
There was a problem hiding this comment.
Pull request overview
This PR adds Fleet-maintained app support for managing PhpStorm on Windows (including silent install/uninstall scripts and generated manifest outputs) and updates the Windows validator ingestion path to propagate publisher into fleet.Software.Vendor so version/name normalization matches production behavior.
Changes:
- Add a new Winget input + PowerShell install/uninstall scripts for PhpStorm on Windows.
- Generate and commit PhpStorm Windows maintained-app output manifest and register it in the maintained apps catalog (
outputs/apps.json). - Update
cmd/maintained-apps/validate/windows.goto selectpublisherfromprogramsand populateSoftware.Vendorbefore callingMutateSoftwareOnIngestion.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| ee/maintained-apps/outputs/phpstorm/windows.json | Adds the generated Windows maintained-app manifest for PhpStorm (queries, installer URL, and script refs). |
| ee/maintained-apps/outputs/apps.json | Registers the new phpstorm/windows entry in the maintained apps catalog. |
| ee/maintained-apps/inputs/winget/scripts/phpstorm_uninstall.ps1 | Adds a registry-based NSIS uninstaller runner for PhpStorm. |
| ee/maintained-apps/inputs/winget/scripts/phpstorm_install.ps1 | Adds a silent install script for the PhpStorm NSIS installer. |
| ee/maintained-apps/inputs/winget/phpstorm.json | Adds the Winget input definition for generating the Windows PhpStorm maintained-app output. |
| cmd/maintained-apps/validate/windows.go | Improves validator ingestion by selecting publisher and using it to populate Software.Vendor for normalization. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| Write-Host "Uninstall entry not found for $softwareNameLike" | ||
| Exit 1 |
WalkthroughThis PR enhances Windows application validation to capture publisher information from osquery results and uses it in the mutation pipeline, then adds complete PhpStorm support on Windows. The validation enhancement retrieves the publisher field and passes it as the 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@ee/maintained-apps/inputs/winget/scripts/phpstorm_uninstall.ps1`:
- Around line 43-53: The unquoted regex branch truncates executable paths at the
first space; update the pattern used when matching $uninstallCommand so $exePath
captures the full path including spaces (e.g. match the entire path up to the
executable extension). Replace the unquoted branch regex /^\s*(\S+)\s*(.*)$/
with a pattern that captures everything up to the executable token such as
/^\s*(.+?\.exe)\s*(.*)$/i so $exePath gets the full executable path and
$existingArgs gets the remaining args; keep the quoted branch as-is and reuse
the same $exePath/$existingArgs variables ($uninstallCommand, $exePath,
$existingArgs).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: c44f92a2-032f-412c-aaab-68d63ca4972c
📒 Files selected for processing (6)
cmd/maintained-apps/validate/windows.goee/maintained-apps/inputs/winget/phpstorm.jsonee/maintained-apps/inputs/winget/scripts/phpstorm_install.ps1ee/maintained-apps/inputs/winget/scripts/phpstorm_uninstall.ps1ee/maintained-apps/outputs/apps.jsonee/maintained-apps/outputs/phpstorm/windows.json
| # Split the uninstall string into exe + args. Handle both quoted and unquoted | ||
| # exe paths. | ||
| $exePath = "" | ||
| $existingArgs = "" | ||
| if ($uninstallCommand -match '^\s*"([^"]+)"\s*(.*)$') { | ||
| $exePath = $matches[1] | ||
| $existingArgs = $matches[2].Trim() | ||
| } elseif ($uninstallCommand -match '^\s*(\S+)\s*(.*)$') { | ||
| $exePath = $matches[1] | ||
| $existingArgs = $matches[2].Trim() | ||
| } else { |
There was a problem hiding this comment.
🧩 Analysis chain
🌐 Web query:
In PowerShell regex matching, what does ^\s*(\S+)\s*(.*)$capture for:C:\Program Files\JetBrains\PhpStorm\bin\Uninstall.exe /S?
💡 Result:
When the regular expression ^\s*(\S+)\s*(.*)$ is applied to the input string C:\Program Files\JetBrains\PhpStorm\bin\Uninstall.exe /S, it captures two specific groups [1][2]. PowerShell regex matching stores the full match in index 0 and the captured groups in subsequent numeric indices [1][3][2]. The captures are as follows: - $Matches: The entire input string, C:\Program Files\JetBrains\PhpStorm\bin\Uninstall.exe /S [1][3][2]. - $Matches[1]: The first capturing group, (\S+). This matches the first non-whitespace sequence. In this case, it captures C:\Program, stopping at the first space [1][2]. - $Matches[3]: The second capturing group, (.*). This matches the remainder of the string after the following whitespace. It captures Files\JetBrains\PhpStorm\bin\Uninstall.exe /S [1][2]. Explanation of the pattern: - ^\s*: Matches optional leading whitespace at the beginning of the string [1][4]. - (\S+): The first capture group; \S+ matches one or more non-whitespace characters. Because the file path contains spaces, the regex treats the first block of non-whitespace text as the entire first group [2]. - \s*: Matches the whitespace character immediately following the first block [1][2]. - (.*)$: The second capture group; .* greedily captures all remaining characters until the end of the line ($) [1][2]. If your intent was to separate the executable path from its arguments, this regex will not produce the desired result because the path contains spaces [2]. To correctly parse a path with spaces, you would typically need to account for quotes or use specialized parsing logic [5].
Citations:
- 1: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_regular_expressions?view=powershell-7.4
- 2: https://adamtheautomator.com/powershell-regex/
- 3: https://www.regular-expressions.info/powershell.html
- 4: https://powershelladmin.com/wiki/Powershell_regular_expressions.php
- 5: https://stackoverflow.com/questions/75582781/getting-uninstall-string-for-application-from-regedit-via-powershell
Fix unquoted uninstall-command parsing for executable paths with spaces
The unquoted branch’s regex ^\s*(\S+)\s*(.*)$ truncates paths at the first space (e.g., C:\Program Files\...\Uninstall.exe /S yields $exePath = 'C:\Program'), which can break uninstall execution.
💡 Proposed fix
-} elseif ($uninstallCommand -match '^\s*(\S+)\s*(.*)$') {
+} elseif ($uninstallCommand -match '^\s*(.+?\.exe)\s*(.*)$') {
$exePath = $matches[1]
$existingArgs = $matches[2].Trim()
} else {🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@ee/maintained-apps/inputs/winget/scripts/phpstorm_uninstall.ps1` around lines
43 - 53, The unquoted regex branch truncates executable paths at the first
space; update the pattern used when matching $uninstallCommand so $exePath
captures the full path including spaces (e.g. match the entire path up to the
executable extension). Replace the unquoted branch regex /^\s*(\S+)\s*(.*)$/
with a pattern that captures everything up to the executable token such as
/^\s*(.+?\.exe)\s*(.*)$/i so $exePath gets the full executable path and
$existingArgs gets the remaining args; keep the quoted branch as-is and reuse
the same $exePath/$existingArgs variables ($uninstallCommand, $exePath,
$existingArgs).
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #46217 +/- ##
==========================================
+ Coverage 66.83% 66.84% +0.01%
==========================================
Files 2756 2757 +1
Lines 220200 220726 +526
Branches 10879 10879
==========================================
+ Hits 147171 147545 +374
- Misses 59736 59840 +104
- Partials 13293 13341 +48
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This pull request adds Windows support for managing PhpStorm as a maintained app, including installation and uninstallation automation, and improves the ingestion logic to handle publisher information for better normalization. The most important changes are:
Windows support for PhpStorm:
phpstorm.json).phpstorm_install.ps1).phpstorm_uninstall.ps1).apps.jsonoutput and created a versioned output file with install/uninstall logic and metadata (apps.json,phpstorm/windows.json). [1] [2]Improvements to ingestion logic:
windows.goto select and propagate thepublisherfield, and set theVendoron ingested software, ensuring publisher-based normalization (important for JetBrains build-number handling). [1] [2] [3]Summary by CodeRabbit