Documentation
¶
Overview ¶
Package starlists owns the M4 "starlists" plugin. It uses GitHub's `user.lists` GraphQL field (verified live, May 2026) to fetch starlists + their items in one round trip. No headless browser required.
Same Navigator-based test seam as the topics plugin: production code uses graphqlNavigator from graphql_navigator.go; non-network tests substitute a fake.
Index ¶
Constants ¶
const Name = "starlists"
Name is the canonical plugin slug.
NavigatorKey is the inputs map slot tests use to inject a fake Navigator. Production code never sets this — the plugin falls back to pc.Render.
Variables ¶
var Plugin plugins.Plugin = &starlistsPlugin{}
Plugin is the singleton registered with the global plugin registry.
Functions ¶
func Partial ¶
Partial renders the classic SVG fragment for the starlists plugin. Mirrors upstream org_repo/source/templates/classic/partials/starlists.ejs.
Output structure (top-level):
<section data-section="starlists">
<h2 class="field"><svg/>N Star list(s)</h2>
<div class="row"><section>
[for each starlist]:
<div class="starlist">
<h2 class="field"><svg/>${name}</h2>
<div class="count">${count} repositor(y|ies)</div>
<div class="description">${description}</div>
[if languages]:
<div class="languages">
<div class="row">
<svg class="bar"><mask>...</mask><rect.../></svg>
</div>
<div class="row">
<section>...details column 1 (even idx)...</section>
<section>...details column 2 (odd idx)...</section>
</div>
</div>
</div>
</section></div>
</section>
Repos rendering (the per-repo card block in upstream lines 56-85) is omitted because the M4 data model only carries repo names (Starlist.Repos) — no stargazers/forks/language details. Restoring that needs a follow-up in starlists.go (per-repo enrichment via repository GraphQL fragment).
Types ¶
type Navigator ¶
type Navigator interface {
}
Navigator abstracts the upstream-data fetch so non-network tests can inject a fake. FetchLists returns the list overview; FetchRepos enumerates a single list's repos for language analysis. The production implementation is graphqlNavigator (single GraphQL query answers both — see graphql_navigator.go).
func NewGraphQLNavigator ¶ added in v1.1.0
NewGraphQLNavigator returns a Navigator backed by the project's GraphQL client. login must match the user the plugin is rendering for. listsFirst caps the number of lists fetched; itemsFirst caps the items per list (GitHub's GraphQL `first` limit is 100).
type Result ¶
type Result struct {
Skipped bool `json:"skipped,omitempty"`
SkippedReason string `json:"-"`
List []Starlist `json:"list"`
Languages bool `json:"languages,omitempty"`
}
Result is the JSON payload published under data.Plugins["starlists"]. Field set mirrors data-model E-024.
type Starlist ¶
type Starlist struct {
Name string `json:"name"`
Description string `json:"description"`
Count int `json:"count"`
Languages []plugins.LanguageStat `json:"languages,omitempty"`
URL string `json:"-"` // internal: used by language analysis
Repos []string `json:"-"` // internal: repos extracted from detail page
}
Starlist is one starlist entry. When the user requested per-list language analysis (_languages=true), Languages holds the aggregated breakdown across the list's repositories.