Skip to content

feat(webid): HTTP API server — releases, resolver, and installer script renderer#1094

Open
coolaj86 wants to merge 5 commits into
mainfrom
feat/webi-go-webid
Open

feat(webid): HTTP API server — releases, resolver, and installer script renderer#1094
coolaj86 wants to merge 5 commits into
mainfrom
feat/webi-go-webid

Conversation

@coolaj86
Copy link
Copy Markdown
Member

Summary

Adds cmd/webid, the Go HTTP API server, stacked on #1092 (webicached dynamic discovery).

Core:

  • /api/releases/{pkg}.json — filtered, sorted release list for a package
  • /api/releases/{pkg}.tab — TSV variant for tabular consumers
  • /{pkg} and /api/installers/{pkg}.sh — rendered POSIX installer scripts
  • UA detection: reads User-Agent (uname -srm format) to set WEBI_OS, WEBI_ARCH, WEBI_LIBC
  • Resolver: picks best asset using OS/arch/libc waterfall fallbacks
  • Renderer: injects resolved asset vars into _webi/package-install.tpl.sh/.ps1

Fixes included (squashed):

  • Wire WEBI_GIT_COMMIT_HASH through render context
  • Match legacy Node.js API output format (git_tag, git_commit_hash, * for universal entries)
  • Wildcard OS/arch filter and libc sort order
  • Arch waterfall + posix_2017 OS matching
  • Prefer exact OS/arch matches over fallbacks in sort order
  • Apply limit after sort, not during filter

Deploy: scripts/deploy-webid.sh beta.webi.sh

Test plan

  • go build ./cmd/webid — clean
  • go test ./cmd/webid/... — passes
  • Deploy: ./scripts/deploy-webid.sh beta.webi.sh
  • curl -sSf https://beta.webi.sh/api/releases/bat.json | head -c 200
  • curl -fsSA "$(uname -srm)" https://beta.webi.sh/bat | grep WEBI_PKG_URL
  • CYGWIN UA: curl -fsSA "CYGWIN_NT-10.0 x86_64" https://beta.webi.sh/api/debug"os":"windows"

@coolaj86 coolaj86 force-pushed the ref-webi-go branch 8 times, most recently from 50ca47c to d6fd8ae Compare May 17, 2026 03:24
@coolaj86 coolaj86 force-pushed the feat/webi-go-webid branch from fd82a68 to af93ac2 Compare May 17, 2026 03:37
@coolaj86 coolaj86 force-pushed the feat/webi-go-webid branch from af93ac2 to c229d2e Compare May 17, 2026 03:39
@coolaj86 coolaj86 force-pushed the ref-webi-go branch 2 times, most recently from ffe4ea8 to bf5cafa Compare May 17, 2026 03:45
Base automatically changed from ref-webi-go to main May 17, 2026 03:46
coolaj86 added 5 commits May 16, 2026 21:53
Packages that produce no classifiable assets (e.g. mariadb-galera with
the galera asset_filter) were being refetched every batch because
!hasAssets marked them stale regardless of timestamp. The hasAssets
condition was intended for the startup case (classified from empty
rawcache), but those packages are already caught by t.IsZero() on first
run. Respect the timestamp for 0-asset results as for any other package.
Serves the HTTP API for webinstall.dev:
- GET /api/releases/{pkg}.json — classified release list from fsstore
- GET /v1/resolve/{pkg} — resolve OS/arch/version to a specific asset
- GET /api/installers/{pkg}.sh — render installer shell script
- GET /api/installers/{pkg}.ps1 — render installer PowerShell script

Git-clone packages include git_tag and git_commit_hash in responses.
UA detection infers OS/arch from User-Agent when not query-specified.
@coolaj86 coolaj86 force-pushed the feat/webi-go-webid branch from c229d2e to ac59e47 Compare May 17, 2026 04:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant