package modules import ( "time" "gsg/internal/core" ) type Meta struct { core.RepoInfo DefaultRef string LastCommit time.Time Commits int } func init() { core.Register("meta", metaMod) } // meta: repository identity plus freshness. Used by the repo view, the // index view, and the JSON endpoint -- computed once per page thanks to // the Ctx cache. func metaMod(c *core.Ctx, args ...string) (any, error) { m := Meta{RepoInfo: c.Info, DefaultRef: c.Repo.HeadRef()} if log, err := c.Repo.Log(c.Ref, 1, 0, false); err == nil && len(log) > 0 { m.LastCommit = log[0].When } return m, nil }