Documentation
¶
Overview ¶
Package stargazers owns the M4 "stargazers" plugin. Per the contract this plugin targets the repository-template account kind, which M4 does not support yet. Worldmap (`_worldmap=true`) is explicitly deferred per research note R-012 — the M4 implementation always returns Skipped=true with an explanatory reason.
Index ¶
Constants ¶
const Name = "stargazers"
Name is the canonical plugin slug.
Variables ¶
var Plugin plugins.Plugin = &stargazersPlugin{}
Plugin is the singleton registered with the global plugin registry.
Functions ¶
func Partial ¶
Partial renders the classic SVG fragment for the stargazers plugin. Mirrors upstream org_repo/source/templates/classic/partials/stargazers.ejs.
Returns "" until stargazers.go's Run is wired with chart data (current M4 path stays Skipped). When data arrives, emits the upstream two chart-bars columns ("Total stargazers" + "New stargazers") for the classic chart type, or the single line plot for the graph type.
Output structure (classic):
<section data-section="stargazers">
<h2 class="field"><svg star/>Stargazers</h2>
<div class="row margin-bottom">
<section class="column chart">
<h3>Total stargazers</h3>
<div class="chart-bars">…cumulative…</div>
</section>
<section class="column chart">
<h3>New stargazers per month</h3>
<div class="chart-bars">…per-bucket increments…</div>
</section>
</div>
</section>
func SetNowForTest ¶ added in v1.2.0
SetNowForTest overrides the stargazers clock and returns a restore function.
Types ¶
type ChartPoint ¶
type ChartPoint struct {
Date time.Time `json:"date"`
Count int `json:"count"`
New int `json:"new,omitempty"`
}
ChartPoint is one data point on the stargazers chart.
type Result ¶
type Result struct {
Skipped bool `json:"skipped,omitempty"`
SkippedReason string `json:"-"`
Mode string `json:"mode,omitempty"`
List []Stargazer `json:"list"`
Charts StargazersCharts `json:"charts"`
Worldmap *StargazersWorldmap `json:"worldmap,omitempty"`
}
Result is the JSON payload published under data.Plugins["stargazers"]. Worldmap is always nil in M4 (R-012).
type Stargazer ¶
type Stargazer struct {
Login string `json:"login"`
StarredAt time.Time `json:"starredAt"`
Location string `json:"location"`
}
Stargazer represents one starrer.
type StargazersCharts ¶
type StargazersCharts struct {
Type string `json:"type"`
Series []ChartPoint `json:"series"`
}
StargazersCharts is the chart data slice.
type StargazersWorldmap ¶
type StargazersWorldmap struct{}
StargazersWorldmap is a placeholder that always serializes to null in M4 per R-012.