Documentation
¶
Overview ¶
Package habits owns the M4 "habits" plugin. It derives "when do you commit" stats from the user's recent events feed. The full upstream behavior also analyzes commit diffs (lines / indent / chars per line) — the M4 MVP wires the day/hour histograms from PushEvents only, and exposes the input surface for the diff-based facts as a follow-up (commit-diff fetching lands alongside US3).
Contracts: specs/004-m4-github-plugins/contracts/plugin-p2-graphql.md §2 Data model: specs/004-m4-github-plugins/data-model.md E-021
Index ¶
Constants ¶
const Name = "habits"
Name is the canonical plugin slug.
Variables ¶
var Plugin plugins.Plugin = &habitsPlugin{}
Plugin is the singleton registered with the global plugin registry.
Functions ¶
Types ¶
type HabitCharts ¶
HabitCharts holds the per-hour and per-weekday push event histogram.
type HabitFacts ¶
type HabitFacts struct {
LinesPerCommit float64 `json:"linesPerCommit"`
CharsPerLine float64 `json:"charsPerLine"`
CommitsPerDay float64 `json:"commitsPerDay"`
IndentStyle string `json:"indentStyle"`
}
HabitFacts holds the diff-derived statistics. In M4 MVP these are zero-valued because commit-diff fetching is deferred.
type Result ¶
type Result struct {
Skipped bool `json:"skipped,omitempty"`
SkippedReason string `json:"-"`
Days int `json:"days"`
Facts HabitFacts `json:"facts"`
Charts HabitCharts `json:"charts"`
From int `json:"from"`
Trim bool `json:"trim"`
}
Result is the JSON payload published under data.Plugins["habits"].