-
Notifications
You must be signed in to change notification settings - Fork 0
P2: winget/choco/scoop distribution #44
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
Reviewer's GuideAdds optional Windows package-manager distribution support (Scoop bucket, Chocolatey skeleton, Winget manifest template) plus a PowerShell helper to sync manifest versions and hashes from GitHub Releases, and updates docs to describe the new distribution options. Sequence diagram for updating distribution manifests via update-distribution.ps1sequenceDiagram
actor Maintainer
participant Script_update_distribution_ps1 as update_distribution_ps1
participant Git as git
participant GitHub_CLI as gh
participant FileSystem as fs
Maintainer->>Script_update_distribution_ps1: Run with optional Version and Repo
Script_update_distribution_ps1->>Git: remote get-url origin
Git-->>Script_update_distribution_ps1: origin URL
Script_update_distribution_ps1->>Script_update_distribution_ps1: Resolve ownerRepo from URL
alt Version parameter not provided
Script_update_distribution_ps1->>FileSystem: Read package.json
FileSystem-->>Script_update_distribution_ps1: package.json content
Script_update_distribution_ps1->>Script_update_distribution_ps1: Extract version
else Version parameter provided
Script_update_distribution_ps1->>Script_update_distribution_ps1: Use provided version
end
Script_update_distribution_ps1->>GitHub_CLI: gh release download v{version} SHA256SUMS.txt
GitHub_CLI-->>Script_update_distribution_ps1: SHA256SUMS.txt
Script_update_distribution_ps1->>Script_update_distribution_ps1: Build map of asset name -> sha256
Script_update_distribution_ps1->>Script_update_distribution_ps1: Get sha256 for cloudsqlctl-setup.exe
Script_update_distribution_ps1->>Script_update_distribution_ps1: Get sha256 for cloudsqlctl-windows-x64.zip
note over Script_update_distribution_ps1: For zip hash, use SHA256SUMS.txt or download asset and compute hash
Script_update_distribution_ps1->>FileSystem: Check scoop/cloudsqlctl.json
alt Scoop manifest exists
Script_update_distribution_ps1->>FileSystem: Read scoop/cloudsqlctl.json
Script_update_distribution_ps1->>FileSystem: Write updated version, url, hash
end
Script_update_distribution_ps1->>FileSystem: Check chocolatey/cloudsqlctl/cloudsqlctl.nuspec
alt Chocolatey nuspec exists
Script_update_distribution_ps1->>FileSystem: Read nuspec
Script_update_distribution_ps1->>FileSystem: Replace <version> value
end
Script_update_distribution_ps1->>FileSystem: Check chocolateyInstall.ps1
alt Chocolatey install script exists
Script_update_distribution_ps1->>FileSystem: Read chocolateyInstall.ps1
Script_update_distribution_ps1->>FileSystem: Replace $packageVersion and $zipSha256
end
Script_update_distribution_ps1->>FileSystem: Check distribution/winget/cloudsqlctl.yaml
alt Winget manifest exists
Script_update_distribution_ps1->>FileSystem: Read cloudsqlctl.yaml
Script_update_distribution_ps1->>FileSystem: Replace PackageVersion, InstallerUrl, InstallerSha256
end
Script_update_distribution_ps1-->>Maintainer: Console summary of updated manifests
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey - I've found 1 issue, and left some high level feedback:
- The
tools/update-distribution.ps1script assumesghis available but never checks for it; consider adding an early guard (e.g.,Get-Command ghwith a clear error message) so failures are easier to diagnose on machines without GitHub CLI installed. - In
tools/update-distribution.ps1, the SHA256SUMS parsing and file-name matching logic assumes fixed asset names (cloudsqlctl-windows-x64.zip,cloudsqlctl-setup.exe); consider pulling these out as parameters or constants at the top of the file so they’re easier to update if the release naming scheme changes.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `tools/update-distribution.ps1` script assumes `gh` is available but never checks for it; consider adding an early guard (e.g., `Get-Command gh` with a clear error message) so failures are easier to diagnose on machines without GitHub CLI installed.
- In `tools/update-distribution.ps1`, the SHA256SUMS parsing and file-name matching logic assumes fixed asset names (`cloudsqlctl-windows-x64.zip`, `cloudsqlctl-setup.exe`); consider pulling these out as parameters or constants at the top of the file so they’re easier to update if the release naming scheme changes.
## Individual Comments
### Comment 1
<location> `tools/update-distribution.ps1:55` </location>
<code_context>
+ if (-not (Test-Path $sumsPath)) { throw "SHA256SUMS.txt not found in release v$ver" }
+
+ $map = @{}
+ foreach ($line in Get-Content $sumsPath) {
+ $t = $line.Trim()
+ if (-not $t) { continue }
+ $parts = $t -split '\s+'
+ if ($parts.Length -lt 2) { continue }
+ $hash = $parts[0].ToLowerInvariant()
+ $file = $parts[1]
+ $map[$file] = $hash
+ }
</code_context>
<issue_to_address>
**suggestion:** Handle SHA256SUMS entries that include the common leading `*` before filenames.
When `sha256sum` outputs lines as `HASH *filename`, `$parts[1]` will include the leading `*`, so the map key won’t match the actual asset name (e.g., `*cloudsqlctl-windows-x64.zip` vs `cloudsqlctl-windows-x64.zip`). Consider normalizing with something like `$file = $parts[1].TrimStart('*')` before using it as the key.
```suggestion
$file = $parts[1].TrimStart('*')
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| $parts = $t -split '\s+' | ||
| if ($parts.Length -lt 2) { continue } | ||
| $hash = $parts[0].ToLowerInvariant() | ||
| $file = $parts[1] |
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.
suggestion: Handle SHA256SUMS entries that include the common leading * before filenames.
When sha256sum outputs lines as HASH *filename, $parts[1] will include the leading *, so the map key won’t match the actual asset name (e.g., *cloudsqlctl-windows-x64.zip vs cloudsqlctl-windows-x64.zip). Consider normalizing with something like $file = $parts[1].TrimStart('*') before using it as the key.
| $file = $parts[1] | |
| $file = $parts[1].TrimStart('*') |
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 optional Windows package manager distribution support for cloudsqlctl, including Scoop, Chocolatey, and Winget templates. It introduces an automated PowerShell script to update version numbers and SHA256 hashes across all distribution manifests from GitHub release artifacts.
Key changes:
- Added
tools/update-distribution.ps1to automate version/hash updates across distribution files - Created Scoop bucket manifest in-repo for direct installation
- Added Chocolatey package skeleton with install/uninstall scripts
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 17 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/update-distribution.ps1 | PowerShell automation script to sync versions and hashes from GitHub releases |
| scoop/cloudsqlctl.json | Scoop bucket manifest for in-repo distribution |
| scoop/README.md | Installation instructions for Scoop users |
| docs/Distribution.md | Comprehensive distribution documentation for all package managers |
| distribution/winget/cloudsqlctl.yaml | Winget manifest template for submission to microsoft/winget-pkgs |
| distribution/winget/README.md | Winget submission guidance |
| chocolatey/cloudsqlctl/cloudsqlctl.nuspec | Chocolatey package metadata specification |
| chocolatey/cloudsqlctl/tools/chocolateyInstall.ps1 | Chocolatey installation script with SHA256 verification |
| chocolatey/cloudsqlctl/tools/chocolateyUninstall.ps1 | Chocolatey uninstallation script |
| chocolatey/cloudsqlctl/tools/VERIFICATION.txt | Verification instructions for Chocolatey package |
| README.md | Updated installation section to reference new distribution options |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| PackageIdentifier: KininCodeOffical.CloudSQLCTL | ||
| PackageVersion: 0.4.15 | ||
| PackageName: CloudSQLCTL | ||
| Publisher: Kinin-Code-Offical | ||
| License: MIT | ||
| ShortDescription: Windows-native CLI to install, update, and manage Google Cloud SQL Auth Proxy via gcloud. | ||
| PackageUrl: https://github.com/Kinin-Code-Offical/cloudsqlctl | ||
| InstallerType: inno | ||
| Installers: | ||
| - Architecture: x64 | ||
| InstallerUrl: https://github.com/Kinin-Code-Offical/cloudsqlctl/releases/download/v0.4.15/cloudsqlctl-setup.exe |
Copilot
AI
Dec 22, 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.
Spelling error: "Offical" should be "Official". The Publisher should be "Kinin-Code-Official".
| PackageIdentifier: KininCodeOffical.CloudSQLCTL | |
| PackageVersion: 0.4.15 | |
| PackageName: CloudSQLCTL | |
| Publisher: Kinin-Code-Offical | |
| License: MIT | |
| ShortDescription: Windows-native CLI to install, update, and manage Google Cloud SQL Auth Proxy via gcloud. | |
| PackageUrl: https://github.com/Kinin-Code-Offical/cloudsqlctl | |
| InstallerType: inno | |
| Installers: | |
| - Architecture: x64 | |
| InstallerUrl: https://github.com/Kinin-Code-Offical/cloudsqlctl/releases/download/v0.4.15/cloudsqlctl-setup.exe | |
| PackageIdentifier: KininCodeOfficial.CloudSQLCTL | |
| PackageVersion: 0.4.15 | |
| PackageName: CloudSQLCTL | |
| Publisher: Kinin-Code-Official | |
| License: MIT | |
| ShortDescription: Windows-native CLI to install, update, and manage Google Cloud SQL Auth Proxy via gcloud. | |
| PackageUrl: https://github.com/Kinin-Code-Official/cloudsqlctl | |
| InstallerType: inno | |
| Installers: | |
| - Architecture: x64 | |
| InstallerUrl: https://github.com/Kinin-Code-Official/cloudsqlctl/releases/download/v0.4.15/cloudsqlctl-setup.exe |
| PackageIdentifier: KininCodeOffical.CloudSQLCTL | ||
| PackageVersion: 0.4.15 | ||
| PackageName: CloudSQLCTL | ||
| Publisher: Kinin-Code-Offical | ||
| License: MIT | ||
| ShortDescription: Windows-native CLI to install, update, and manage Google Cloud SQL Auth Proxy via gcloud. | ||
| PackageUrl: https://github.com/Kinin-Code-Offical/cloudsqlctl | ||
| InstallerType: inno | ||
| Installers: | ||
| - Architecture: x64 | ||
| InstallerUrl: https://github.com/Kinin-Code-Offical/cloudsqlctl/releases/download/v0.4.15/cloudsqlctl-setup.exe |
Copilot
AI
Dec 22, 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.
Spelling error: "Offical" should be "Official". The repository name should be "Kinin-Code-Official".
| PackageIdentifier: KininCodeOffical.CloudSQLCTL | |
| PackageVersion: 0.4.15 | |
| PackageName: CloudSQLCTL | |
| Publisher: Kinin-Code-Offical | |
| License: MIT | |
| ShortDescription: Windows-native CLI to install, update, and manage Google Cloud SQL Auth Proxy via gcloud. | |
| PackageUrl: https://github.com/Kinin-Code-Offical/cloudsqlctl | |
| InstallerType: inno | |
| Installers: | |
| - Architecture: x64 | |
| InstallerUrl: https://github.com/Kinin-Code-Offical/cloudsqlctl/releases/download/v0.4.15/cloudsqlctl-setup.exe | |
| PackageIdentifier: KininCodeOfficial.CloudSQLCTL | |
| PackageVersion: 0.4.15 | |
| PackageName: CloudSQLCTL | |
| Publisher: Kinin-Code-Official | |
| License: MIT | |
| ShortDescription: Windows-native CLI to install, update, and manage Google Cloud SQL Auth Proxy via gcloud. | |
| PackageUrl: https://github.com/Kinin-Code-Official/cloudsqlctl | |
| InstallerType: inno | |
| Installers: | |
| - Architecture: x64 | |
| InstallerUrl: https://github.com/Kinin-Code-Official/cloudsqlctl/releases/download/v0.4.15/cloudsqlctl-setup.exe |
| <authors>Kinin-Code-Offical</authors> | ||
| <owners>Kinin-Code-Offical</owners> | ||
| <license type="expression">MIT</license> | ||
| <projectUrl>https://github.com/Kinin-Code-Offical/cloudsqlctl</projectUrl> |
Copilot
AI
Dec 22, 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.
Spelling error: "Offical" should be "Official". The repository name should be "Kinin-Code-Official".
| <authors>Kinin-Code-Offical</authors> | |
| <owners>Kinin-Code-Offical</owners> | |
| <license type="expression">MIT</license> | |
| <projectUrl>https://github.com/Kinin-Code-Offical/cloudsqlctl</projectUrl> | |
| <authors>Kinin-Code-Official</authors> | |
| <owners>Kinin-Code-Official</owners> | |
| <license type="expression">MIT</license> | |
| <projectUrl>https://github.com/Kinin-Code-Official/cloudsqlctl</projectUrl> |
| $packageName = 'cloudsqlctl' | ||
| $packageVersion = '0.4.15' | ||
|
|
||
| $zipUrl = "https://github.com/Kinin-Code-Offical/cloudsqlctl/releases/download/v$packageVersion/cloudsqlctl-windows-x64.zip" |
Copilot
AI
Dec 22, 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.
Spelling error: "Offical" should be "Official". The repository name should be "Kinin-Code-Official".
| $zipUrl = "https://github.com/Kinin-Code-Offical/cloudsqlctl/releases/download/v$packageVersion/cloudsqlctl-windows-x64.zip" | |
| $zipUrl = "https://github.com/Kinin-Code-Official/cloudsqlctl/releases/download/v$packageVersion/cloudsqlctl-windows-x64.zip" |
| $ps1 = $ps1 -replace "(?m)^(\\$packageVersion\\s*=\\s*)'.*'$", "`$1'$ver'" | ||
| $ps1 = $ps1 -replace "(?m)^(\\$zipSha256\\s*=\\s*)'.*'$", "`$1'$zipSha'" |
Copilot
AI
Dec 22, 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.
Incorrect regex escaping: The dollar signs in the regex capture group references are being escaped unnecessarily with backslashes. In PowerShell, within double quotes, \$ should just be $ to reference variables. The pattern should be "(?m)^(\$packageVersion\s*=\s*)'.*'$" with a literal dollar sign for the regex pattern, not "(?m)^(\\$packageVersion\\s*=\\s*)'.*'$" with escaped backslashes.
| $ps1 = $ps1 -replace "(?m)^(\\$packageVersion\\s*=\\s*)'.*'$", "`$1'$ver'" | |
| $ps1 = $ps1 -replace "(?m)^(\\$zipSha256\\s*=\\s*)'.*'$", "`$1'$zipSha'" | |
| $ps1 = $ps1 -replace '(?m)^(\$packageVersion\s*=\s*)''.*''$', "`$1'$ver'" | |
| $ps1 = $ps1 -replace '(?m)^(\$zipSha256\s*=\s*)''.*''$', "`$1'$zipSha'" |
| $yaml = $yaml -replace "(?m)^PackageVersion:\\s*.*$", "PackageVersion: $ver" | ||
| $yaml = $yaml -replace "(?m)^\\s*InstallerUrl:\\s*.*$", " InstallerUrl: https://github.com/$ownerRepo/releases/download/v$ver/$installerName" | ||
| $yaml = $yaml -replace "(?m)^\\s*InstallerSha256:\\s*.*$", " InstallerSha256: $installerSha" |
Copilot
AI
Dec 22, 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.
Incorrect regex escaping: The backslashes before spaces in the regex patterns are unnecessary. In PowerShell regex patterns within double-quoted strings, \s represents whitespace characters. The pattern should be "(?m)^PackageVersion:\s*.*$" not "(?m)^PackageVersion:\\s*.*$", and similarly for the other YAML patterns on lines 120-121.
| $yaml = $yaml -replace "(?m)^PackageVersion:\\s*.*$", "PackageVersion: $ver" | |
| $yaml = $yaml -replace "(?m)^\\s*InstallerUrl:\\s*.*$", " InstallerUrl: https://github.com/$ownerRepo/releases/download/v$ver/$installerName" | |
| $yaml = $yaml -replace "(?m)^\\s*InstallerSha256:\\s*.*$", " InstallerSha256: $installerSha" | |
| $yaml = $yaml -replace "(?m)^PackageVersion:\s*.*$", "PackageVersion: $ver" | |
| $yaml = $yaml -replace "(?m)^\s*InstallerUrl:\s*.*$", " InstallerUrl: https://github.com/$ownerRepo/releases/download/v$ver/$installerName" | |
| $yaml = $yaml -replace "(?m)^\s*InstallerSha256:\s*.*$", " InstallerSha256: $installerSha" |
| Install: | ||
|
|
||
| ```powershell | ||
| scoop bucket add cloudsqlctl https://github.com/Kinin-Code-Offical/cloudsqlctl |
Copilot
AI
Dec 22, 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.
Spelling error: "Offical" should be "Official". The repository name should be "Kinin-Code-Official".
| scoop bucket add cloudsqlctl https://github.com/Kinin-Code-Offical/cloudsqlctl | |
| scoop bucket add cloudsqlctl https://github.com/Kinin-Code-Official/cloudsqlctl |
| @@ -0,0 +1,16 @@ | |||
| PackageIdentifier: KininCodeOffical.CloudSQLCTL | |||
Copilot
AI
Dec 22, 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.
Spelling error: "Offical" should be "Official". The PackageIdentifier should be "KininCodeOfficial.CloudSQLCTL".
| PackageIdentifier: KininCodeOffical.CloudSQLCTL | |
| PackageIdentifier: KininCodeOfficial.CloudSQLCTL |
| <authors>Kinin-Code-Offical</authors> | ||
| <owners>Kinin-Code-Offical</owners> | ||
| <license type="expression">MIT</license> | ||
| <projectUrl>https://github.com/Kinin-Code-Offical/cloudsqlctl</projectUrl> |
Copilot
AI
Dec 22, 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.
Spelling error: "Offical" should be "Official". The author and owner names should be "Kinin-Code-Official".
| <authors>Kinin-Code-Offical</authors> | |
| <owners>Kinin-Code-Offical</owners> | |
| <license type="expression">MIT</license> | |
| <projectUrl>https://github.com/Kinin-Code-Offical/cloudsqlctl</projectUrl> | |
| <authors>Kinin-Code-Official</authors> | |
| <owners>Kinin-Code-Official</owners> | |
| <license type="expression">MIT</license> | |
| <projectUrl>https://github.com/Kinin-Code-Official/cloudsqlctl</projectUrl> |
| $packageVersion = '0.4.15' | ||
|
|
||
| $zipUrl = "https://github.com/Kinin-Code-Offical/cloudsqlctl/releases/download/v$packageVersion/cloudsqlctl-windows-x64.zip" | ||
| $zipSha256 = 'ec77bf329e2ff67d25d33877ac0a13a1f4c8fccf39bb00cc2fde139a9ea9ad11' |
Copilot
AI
Dec 22, 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.
Hash mismatch: The Scoop manifest and Chocolatey install script contain different SHA256 hashes for what should be the same asset (cloudsqlctl-windows-x64.zip). Scoop has 'e6a65a7cec3a858bc3affb002e07ee04c09fd6ac42beac5811458deedd62ef84' while Chocolatey has 'ec77bf329e2ff67d25d33877ac0a13a1f4c8fccf39bb00cc2fde139a9ea9ad11'. These should match or indicate that different assets are being referenced.
| $zipSha256 = 'ec77bf329e2ff67d25d33877ac0a13a1f4c8fccf39bb00cc2fde139a9ea9ad11' | |
| $zipSha256 = 'e6a65a7cec3a858bc3affb002e07ee04c09fd6ac42beac5811458deedd62ef84' |
Closes #25
Summary
Local tests
Rollback
Summary by Sourcery
Add optional Windows package-manager distribution support and automation for keeping distribution manifests in sync with GitHub releases.
New Features:
Enhancements:
Documentation: