* fix(winget): require PortableCommandAlias for GasTownHall.Beads GasTownHall.Beads 1.1.0 on winget-pkgs only sets Commands: (search metadata) and never creates WinGet\Links\bd.exe, so already-running shells never see bd after install (GH#4908). - Add canonical GasTownHall.Beads.installer.yaml with PortableCommandAlias - update-winget.sh regenerates that package id for new releases - Document both package ids and the Links requirement in winget/README - Add check-winget-portable-alias.sh guard Fixes #4908 * fix(winget): address maphew's PR #5134 review (grep bug, guard, CI wiring) Maintainer commits requested by the PR author on the reviewer's behalf, addressing maphew's 2026-07-29 review of PR #5134: - scripts/update-winget.sh: `grep windows` matched both amd64 and arm64 checksum lines, corrupting InstallerSha256 into an unparseable two-line value. Narrow to `grep windows_amd64` (mirrors the existing arm64 grep on the next block). - scripts/update-winget.sh: quote the arm64 InstallerSha256 placeholder so 64 bare zero digits don't parse as a YAML integer, matching the quoting already used in the checked-in SteveYegge.beads.installer.yaml. - scripts/check-winget-portable-alias.sh: replace the bare `grep -q PortableCommandAlias:` substring check with a yq-based parse, so a corrupted manifest (like the one above) fails the guard instead of reporting OK; also fail closed on an empty winget/ glob instead of silently exiting 0. - .github/workflows/pr.yml, main.yml: run the guard in the existing check-build-tags job so it executes on every PR instead of only when someone remembers to invoke it by hand. Locally verified: guard passes against the current checked-in manifests, fails against a reproduction of the exact grep-bug corruption, fails on an empty winget/ dir, and the generator produces a yq-parseable manifest against a synthetic checksums.txt. shellcheck clean; both workflow files parse as valid YAML. * fix(winget): harden the PortableCommandAlias guard and its release docs Maintainer review fixups for the adopt-pr review of PR #5134 (iteration 1, synthesis approve / 0 blockers and 0 majors; all seven items were non-gating). Scorecard 961/1000, Required Changes: None. Every edit site below is a line this PR itself added. Finding 1 (minor, Error Handling) — `yq -e ... >/dev/null 2>&1` collapsed three distinct failures (yq absent at exit 127, unparseable manifest, alias genuinely missing) into "missing valid PortableCommandAlias", defeating the script's own stated rationale and pointing a debugger at manifests that are already correct. The guard now names a missing yq up front and no longer discards stderr, so yq's own diagnostic reaches the log of a required-gate job. yq is CI's first and only yq consumer, running in a bare actions/checkout job, and sits outside the host-tools inventory declared in scripts/BUILD.bazel; that is now stated where the dependency lives. Finding 4 (minor, Change Impact) — the glob is winget/*.installer.yaml but the assertion was unconditional on installer type, so a future msi/exe/msix manifest (no NestedInstallerFiles at all) would hard-fail a gate-feeding job with no opt-out. Non-portable manifests are now classified out with a SKIP line. The parse check deliberately precedes the class check: without that ordering an unparseable manifest fails the NestedInstallerType test and is silently skipped as "not portable", which is strictly worse than the behaviour being fixed. Finding 2 (minor, Error Handling) — amd64 and arm64 had opposite failure policies in one script: a missing amd64 checksum hard-fails, while a missing arm64 checksum substituted 64 zeros and continued to success, disclosed only in a source comment. The echoed "Next steps" block now ends in a loud "DO NOT PUBLISH" warning naming the placeholder, emitted only when the fallback actually fires. The finding's second arm — "teach the guard to reject an all-zero InstallerSha256" — is implemented as a WARNING rather than a failure, and that is a deliberate downgrade. winget/SteveYegge.beads.installer.yaml:15 already carries exactly that placeholder for its arm64 entry; that file is base-owned and is not in this PR's six-file diff, so a fatal tripwire would turn a required check red over pre-existing content the PR never touched. The legacy heredoc in update-winget.sh emits no arm64 entry at all, so the placeholder is stale hand-authored state that the next generator run removes. Verified: the guard still exits 0 on the real tree and reports the warning. Finding 3 (minor, Contract & Interface Fidelity) — a winget-pkgs version directory needs a version + defaultLocale + installer set, but the repo carries only GasTownHall.Beads.installer.yaml, so README step 2 as written produced a set winget-pkgs validation rejects. Took the documentation arm: GasTownHall is now steered to `wingetcreate update` (which supplies the other two manifests from the published set) and the hand-copy path is marked as applying only to the legacy id, which does have a complete three-file set. Generating two more manifests would have changed the contribution's deliverable scope. Finding 5 (nit, Architectural Consistency) — the first update-winget.sh run overwrote the checked-in manifest with a three-line header, deleting this PR's own GH#4908 rationale from the artifact whose purpose is to carry it. The heredoc now emits the same header, plus a fresh ReleaseDate. Verified by generating into a temp tree: the generated header is byte-identical to the checked-in file's first ten lines. Finding 6 (nit, Documentation Accuracy) — the README froze SteveYegge.beads at the "0.30.x era" while the script rewrites all three of its manifests to the new version. Note that the section already disclosed that both ids are refreshed, so the residual gap was narrower than the finding stated: what was missing is that the legacy id's version is bumped out of the era the table advertises. That clause is now explicit. Finding 7 (nit, Test Evidence Quality) — the guard's fail-closed behaviour was pinned by nothing in-repo. Adds scripts/check_winget_portable_alias_test.go with ten cases: alias present, alias missing, wrong alias, empty winget dir, unparseable manifest (asserting it is neither skipped nor misreported and that yq's stderr survives), missing yq, a skipped non-portable manifest, a violating portable sibling of a skipped manifest, and the advisory placeholder warning. Deviates from the prescribed `requireHostTool(t, "yq")` on purpose. requireHostTool fails rather than skips under Bazel because //scripts:scripts_test is tagged host-tools, and that tag's declared inventory is "git, python3, awk, sed, find, grep and timeout" — yq is not in it, so the prescription would red the shared target on hosts that keep the promise the tag actually makes. A skip-only gate is used and the reason is recorded at the helper. Fixtures are synthetic so the target needs no new data dependency; the real manifests are covered by the check-build-tags job, which runs this script against the actual checkout. Also fixed, found while editing and not raised by either lane: winget/README.md told readers to run `grep windows` over checksums.txt, which is the exact two-line ambiguity this PR fixed in the script (`grep windows` -> `grep windows_amd64`). Before this PR the script and doc agreed; after it they diverged, so the PR created the inconsistency. The doc now uses `grep windows_` and says which line feeds which architecture. Validation. `git diff --check` clean. The guard runs green on the real tree (both manifests OK, rc=0) and on a freshly generated tree. go test ./scripts/ ok 21.7s (the package whose tests pin workflow content). Each new pin was proven non-vacuous by reverting the corresponding fix and confirming the test reds: dropping the class check reds the non-portable case; dropping the placeholder tripwire reds the warning case; dropping the parse-before-classify check reds the unparseable case; dropping the yq preflight reds the missing-yq case; restoring `2>&1` reds the stderr assertion. All five arms red, and the guard was restored byte-identical (md5 verified) after each. The arm64 warning was exercised both ways against a stubbed curl: present arm64 checksum emits no warning, absent one emits DO NOT PUBLISH. New yq expressions stay inside the vocabulary shared by mikefarah yq v4 (what ubuntu-latest ships) and python-yq/jq — identity, `==`, `[]`, `select` and `-e`'s exit status — because only the pre-existing expression had been proven green on mikefarah in CI, and this host has python-yq. Builtins the two flavours spell differently (jq's `any(cond)` vs mikefarah's `any_c`) are avoided, and the placeholder tripwire uses grep precisely because it looks for a known-bad literal and so can only miss a bad value, never report OK on a manifest it failed to parse. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> --------- Co-authored-by: Bee <bee@ghosttrack.com> Co-authored-by: Gas City Adopt-PR <adopt-pr@gascity.local> Co-authored-by: Claude Opus 5 <noreply@anthropic.com> Co-authored-by: Eddie the Engineer <adopt-pr@gascity.com>
170 lines
6.2 KiB
Bash
Executable file
170 lines
6.2 KiB
Bash
Executable file
#!/bin/bash
|
|
#
|
|
# Update winget manifest files for a new release
|
|
#
|
|
# Usage: ./scripts/update-winget.sh <version>
|
|
# Example: ./scripts/update-winget.sh 0.31.0
|
|
#
|
|
|
|
set -e
|
|
|
|
VERSION="${1:-}"
|
|
if [ -z "$VERSION" ]; then
|
|
echo "Usage: $0 <version>"
|
|
echo "Example: $0 0.31.0"
|
|
exit 1
|
|
fi
|
|
|
|
# Remove 'v' prefix if present
|
|
VERSION="${VERSION#v}"
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
WINGET_DIR="$SCRIPT_DIR/../winget"
|
|
|
|
# Get SHA256 from release checksums
|
|
echo "Fetching SHA256 for v$VERSION..."
|
|
SHA256=$(curl -sL "https://github.com/gastownhall/beads/releases/download/v$VERSION/checksums.txt" | grep windows_amd64 | awk '{print $1}')
|
|
|
|
if [ -z "$SHA256" ]; then
|
|
echo "Error: Could not find Windows checksum for v$VERSION"
|
|
echo "Make sure the release exists: https://github.com/gastownhall/beads/releases/tag/v$VERSION"
|
|
exit 1
|
|
fi
|
|
|
|
# Convert to uppercase for winget
|
|
SHA256=$(echo "$SHA256" | tr '[:lower:]' '[:upper:]')
|
|
|
|
echo "SHA256: $SHA256"
|
|
echo ""
|
|
echo "Updating manifest files..."
|
|
|
|
# Update version manifest
|
|
cat > "$WINGET_DIR/SteveYegge.beads.yaml" << EOF
|
|
# yaml-language-server: \$schema=https://aka.ms/winget-manifest.version.1.6.0.schema.json
|
|
PackageIdentifier: SteveYegge.beads
|
|
PackageVersion: $VERSION
|
|
DefaultLocale: en-US
|
|
ManifestType: version
|
|
ManifestVersion: 1.6.0
|
|
EOF
|
|
|
|
# Update installer manifest (PortableCommandAlias required — GH#4908)
|
|
cat > "$WINGET_DIR/SteveYegge.beads.installer.yaml" << EOF
|
|
# yaml-language-server: \$schema=https://aka.ms/winget-manifest.installer.1.6.0.schema.json
|
|
PackageIdentifier: SteveYegge.beads
|
|
PackageVersion: $VERSION
|
|
InstallerType: zip
|
|
NestedInstallerType: portable
|
|
NestedInstallerFiles:
|
|
- RelativeFilePath: bd.exe
|
|
PortableCommandAlias: bd
|
|
Installers:
|
|
- Architecture: x64
|
|
InstallerUrl: https://github.com/gastownhall/beads/releases/download/v$VERSION/beads_${VERSION}_windows_amd64.zip
|
|
InstallerSha256: $SHA256
|
|
ManifestType: installer
|
|
ManifestVersion: 1.6.0
|
|
EOF
|
|
|
|
# Update locale manifest
|
|
cat > "$WINGET_DIR/SteveYegge.beads.locale.en-US.yaml" << EOF
|
|
# yaml-language-server: \$schema=https://aka.ms/winget-manifest.defaultLocale.1.6.0.schema.json
|
|
PackageIdentifier: SteveYegge.beads
|
|
PackageVersion: $VERSION
|
|
PackageLocale: en-US
|
|
Publisher: Steve Yegge
|
|
PublisherUrl: https://github.com/steveyegge
|
|
PublisherSupportUrl: https://github.com/gastownhall/beads/issues
|
|
Author: Steve Yegge
|
|
PackageName: beads
|
|
PackageUrl: https://github.com/gastownhall/beads
|
|
License: MIT
|
|
LicenseUrl: https://github.com/gastownhall/beads/blob/main/LICENSE
|
|
Copyright: Copyright (c) 2024 Steve Yegge
|
|
ShortDescription: Distributed, Dolt-powered graph issue tracker for AI agents
|
|
Description: |
|
|
beads (bd) is a distributed, Dolt-powered graph issue tracker designed for AI-supervised coding workflows.
|
|
It provides a persistent, structured memory for coding agents, replacing messy markdown plans with a
|
|
dependency-aware graph that allows agents to handle long-horizon tasks without losing context.
|
|
Moniker: bd
|
|
Tags:
|
|
- issue-tracker
|
|
- ai
|
|
- coding-assistant
|
|
- git
|
|
- cli
|
|
- developer-tools
|
|
ReleaseNotesUrl: https://github.com/gastownhall/beads/releases/tag/v$VERSION
|
|
ManifestType: defaultLocale
|
|
ManifestVersion: 1.6.0
|
|
EOF
|
|
|
|
# GasTownHall.Beads is the package id users install today (v1.x on winget-pkgs).
|
|
# Always set PortableCommandAlias so WinGet\\Links\\bd.exe is created (GH#4908).
|
|
# SHA256 for arm64 is left for the releaser to fill from checksums.txt when present.
|
|
ARM_SHA=$(curl -sL "https://github.com/gastownhall/beads/releases/download/v$VERSION/checksums.txt" | grep 'windows_arm64' | awk '{print $1}' | tr '[:lower:]' '[:upper:]')
|
|
ARM_SHA_IS_PLACEHOLDER=0
|
|
if [ -z "$ARM_SHA" ]; then
|
|
ARM_SHA="0000000000000000000000000000000000000000000000000000000000000000"
|
|
ARM_SHA_IS_PLACEHOLDER=1
|
|
fi
|
|
|
|
# Keep this header in step with the checked-in winget/GasTownHall.Beads.installer.yaml:
|
|
# the first run of this script overwrites that file, so anything documented only
|
|
# there (the GH#4908 rationale) would be silently dropped.
|
|
cat > "$WINGET_DIR/GasTownHall.Beads.installer.yaml" << EOF
|
|
# yaml-language-server: \$schema=https://aka.ms/winget-manifest.installer.1.12.0.schema.json
|
|
# Canonical installer for PackageIdentifier GasTownHall.Beads (published under
|
|
# manifests/g/GasTownHall/Beads/<version>/ in microsoft/winget-pkgs).
|
|
#
|
|
# PortableCommandAlias is REQUIRED so winget creates
|
|
# %LOCALAPPDATA%\\Microsoft\\WinGet\\Links\\bd.exe. Without it, only the package
|
|
# folder is on PATH (visible only to processes started after install) and
|
|
# already-running shells never see \`bd\` (GH#4908).
|
|
#
|
|
# Commands: is search metadata only — it does NOT create the Links symlink.
|
|
PackageIdentifier: GasTownHall.Beads
|
|
PackageVersion: $VERSION
|
|
InstallerType: zip
|
|
NestedInstallerType: portable
|
|
NestedInstallerFiles:
|
|
- RelativeFilePath: bd.exe
|
|
PortableCommandAlias: bd
|
|
Commands:
|
|
- bd
|
|
ReleaseDate: $(date -u +%F)
|
|
Installers:
|
|
- Architecture: x64
|
|
InstallerUrl: https://github.com/gastownhall/beads/releases/download/v$VERSION/beads_${VERSION}_windows_amd64.zip
|
|
InstallerSha256: $SHA256
|
|
- Architecture: arm64
|
|
InstallerUrl: https://github.com/gastownhall/beads/releases/download/v$VERSION/beads_${VERSION}_windows_arm64.zip
|
|
InstallerSha256: "$ARM_SHA"
|
|
ManifestType: installer
|
|
ManifestVersion: 1.12.0
|
|
EOF
|
|
|
|
echo ""
|
|
echo "✓ Updated winget manifests for v$VERSION"
|
|
echo ""
|
|
echo "Next steps:"
|
|
echo "1. Commit these changes"
|
|
echo "2. Fork https://github.com/microsoft/winget-pkgs"
|
|
echo "3. Prefer GasTownHall.Beads:"
|
|
echo " copy winget/GasTownHall.Beads.installer.yaml"
|
|
echo " → manifests/g/GasTownHall/Beads/$VERSION/"
|
|
echo " (legacy SteveYegge.beads → manifests/s/SteveYegge/beads/$VERSION/)"
|
|
echo "4. Submit PR to microsoft/winget-pkgs"
|
|
echo ""
|
|
echo "Reminder: PortableCommandAlias: bd is required (GH#4908)."
|
|
|
|
# The arm64 fallback above is otherwise disclosed only in a source comment, and
|
|
# the manifest it writes is schema-valid, so a releaser following the steps
|
|
# above would publish an installer entry that fails hash validation at install
|
|
# time.
|
|
if [ "$ARM_SHA_IS_PLACEHOLDER" -eq 1 ]; then
|
|
echo ""
|
|
echo "WARNING: no windows_arm64 checksum found for v$VERSION;"
|
|
echo " the arm64 InstallerSha256 is a zero placeholder — DO NOT PUBLISH"
|
|
echo " until it is replaced with the real hash from checksums.txt."
|
|
fi
|