spec-kit
spec-kit copied to clipboard
fix: resolve GitHub release asset API URL for private repo preset and workflow downloads
Summary
- Extends the private-repo GitHub release asset fix from #2792 (extensions) to cover presets and workflows
- For private/SSO repos, browser release URLs (
https://github.com/<owner>/<repo>/releases/download/<tag>/<asset>) redirect to an HTML/SSO page instead of the asset, causingBadZipFile/ download failures - Extracts the shared resolution logic into a reusable
resolve_github_release_asset_api_urlutility in_github_http.py
Fix — four download paths are now covered
PresetCatalog.download_pack (catalog-based preset install):
- Resolves browser release URLs to REST API asset URLs before downloading the ZIP
preset add --from <url> (direct URL preset install):
- Same resolution applied before downloading the ZIP
workflow add <url> (direct URL workflow install):
- Same resolution applied before downloading the workflow YAML
workflow add <id> (catalog-based workflow install):
- Same resolution applied before downloading the workflow YAML from the catalog
url
Other URLs: existing behavior unchanged.
Implementation
A new shared resolve_github_release_asset_api_url(download_url, open_url_fn, timeout) function in _github_http.py contains the resolution logic. PresetCatalog delegates to it via a _resolve_github_release_asset_api_url method (same pattern as ExtensionCatalog). The __init__.py download paths import and call it directly.
Test plan
- [ ] Run focused test suite:
Expected: 2 passedUV_NATIVE_TLS=true SSL_CERT_FILE=/opt/homebrew/etc/openssl@3/cert.pem UV_DEFAULT_INDEX=https://pypi.org/simple PYTHONPATH=src uv run --extra test pytest tests/test_presets.py -k 'download_pack' - [ ] Run full preset and workflow test suite:
Expected: all passingUV_NATIVE_TLS=true SSL_CERT_FILE=/opt/homebrew/etc/openssl@3/cert.pem UV_DEFAULT_INDEX=https://pypi.org/simple PYTHONPATH=src uv run --extra test pytest tests/test_presets.py tests/test_workflows.py tests/test_github_http.py - [ ] Verify
specify preset addworks for presets hosted on a private GitHub repo using browser release URLs - [ ] Verify
specify preset add --from <url>works with a GitHub release asset URL from a private repo - [ ] Verify
specify workflow add <id>works for catalog workflows hosted on a private GitHub repo - [ ] Verify
specify workflow add <url>works with a GitHub release asset URL from a private repo
AI disclosure: This PR was developed with Claude Code assistance.
🤖 Generated with Claude Code