Documentation
¶
Overview ¶
Package topics owns the M4 "topics" plugin. It scrapes the user's starred-topics page via chromedp because the GitHub API does not expose the dataset directly.
Contracts: specs/004-m4-github-plugins/contracts/plugin-p3-heavy.md §3 Data model: specs/004-m4-github-plugins/data-model.md E-023
The runtime keeps the chromedp surface behind a small Navigator interface so non-chromedp tests can exercise the skipped/short-circuit paths without launching chromium. The chromedp-tagged tests substitute the production Navigator backed by *render.Browser.
Index ¶
Constants ¶
const Name = "topics"
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 = &topicsPlugin{}
Plugin is the singleton registered with the global plugin registry.
Functions ¶
Types ¶
type Navigator ¶
type Navigator interface {
}
Navigator abstracts the chromedp-backed page scrape so non-chromedp tests can inject a fake. Production code uses browserNavigator backed by *render.Browser.
func NewBrowserNavigator ¶
NewBrowserNavigator returns a production Navigator. Exposed for chromedp-tagged tests that want to drive the real scrape path against a local fixture server.
type Result ¶
type Result struct {
Skipped bool `json:"skipped,omitempty"`
SkippedReason string `json:"-"`
List []Topic `json:"list"`
Mode string `json:"mode"`
Limit int `json:"limit"`
Sort string `json:"sort"`
}
Result is the JSON payload published under data.Plugins["topics"]. Field set mirrors data-model E-023.
type Topic ¶
type Topic struct {
Name string `json:"name"`
Description string `json:"description"`
Icon string `json:"icon"`
URL string `json:"url"`
// StarredAt is opaque metadata used only for sorting when the user
// requested sort="starred-at". Not part of the public JSON shape;
// upstream does not expose it.
StarredAt string `json:"-"`
}
Topic mirrors one entry in the starred-topics list.