Add GitHub stars to the index - #3
Conversation
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
🟡 Changes recommended
The build currently treats failures fetching stars as fatal and can unnecessarily drop otherwise-valid plugins from the published index, and the contract documentation needs updating.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
This PR extends the plugin registry’s published JSON schema to include GitHub stargazer counts (stars) so downstream consumers (goblog directory and Admin → Plugins UI) can sort plugins by popularity.
Changes:
- Add
starstoindex.jsonentries and to per-plugin detail docs (via embeddedIndexEntry). - Extend the
Sourceabstraction with a GitHub-backed repo metadata call to fetchstargazers_count. - Update unit tests and fakes to cover the new
RepoInfo/stars behavior.
File summaries
| File | Description |
|---|---|
| README.md | Documents that the published index now includes stars. |
| internal/registry/validate_test.go | Extends the in-memory Source test fake with stargazer data. |
| internal/registry/source.go | Adds RepoInfo to Source and implements it for GitHubSource via Repositories.Get. |
| internal/registry/source_test.go | Extends the HTTP fake and tests to validate RepoInfo behavior. |
| internal/registry/build.go | Adds Stars to IndexEntry and populates it during detail/index build. |
| internal/registry/build_test.go | Asserts stars is written into both index and detail docs. |
| cmd/registry/main_test.go | Updates CLI test fake Source to satisfy the new interface method. |
Review details
- Files reviewed: 7/7 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| stars, err := src.RepoInfo(ctx, v.Owner, v.Name) | ||
| if err != nil { | ||
| return DetailDoc{}, err | ||
| } | ||
| entry.Stars = stars |
There was a problem hiding this comment.
Agreed — fixed in ffc0bca: buildDetail now logs a failed star lookup and publishes the entry with stars: 0 instead of skipping it; TestBuild_StarsAreBestEffort covers it.
|
|
||
| - `registry.yaml` — the list. Add your repository in a PR; see [docs/CONTRACT.md](docs/CONTRACT.md). | ||
| - `https://goblogplatform.github.io/plugins/index.json` — the machine-readable index (latest release of each plugin, with `download_url` and `sha256`); `plugins/<name>.json` adds the rendered README, changelog and release history. | ||
| - `https://goblogplatform.github.io/plugins/index.json` — the machine-readable index (latest release of each plugin, with `download_url` and `sha256`) and `stars` (GitHub stargazers, the directory's default ordering); `plugins/<name>.json` adds the rendered README, changelog and release history. |
There was a problem hiding this comment.
Added a "What the directory publishes" section to docs/CONTRACT.md (ffc0bca) explaining that stars comes from the repo's GitHub star count and is best-effort. The full index field list stays in the README, which is the consumer-facing doc.
| // RepoInfo returns the repository's GitHub stargazer count (the | ||
| // directory's "top plugins" ordering). | ||
| RepoInfo(ctx context.Context, owner, repo string) (stars int, err error) |
There was a problem hiding this comment.
Renamed to RepoStars in ffc0bca (new API in this PR, so no compatibility concern).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Adds
stars(stargazers_count) to every index entry and detail doc; goblog's directory page and Admin → Plugins sort by it (goblogplatform/goblog#570).🤖 Generated with Claude Code