Documentation
¶
Overview ¶
Package htmlreport renders the index as one self-contained HTML page. Agents read compact text reports over MCP; this page supports a broader audit of pending decisions, duplicate pins, fix concentrations, and the raw lessons behind them. It is a file-based snapshot with no server or external assets.
Everything it displays is untrusted text — review comments, commit subjects, and model-written proposals — so the page is built through html/template with auto-escaping, including the SVG map: geometry is computed here, markup is emitted there. Nothing in this package produces template.HTML.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LessonInScope ¶
LessonInScope reports whether a lesson mined for lessonRegion belongs to the area named by scope: the region itself, anything beneath it, and the ancestors that govern it — the same "area" the lesson ledger and `expand lessons:<dir>` use. An empty region is repo-wide and so belongs to every scope.
It exists because the page filters client-side, and a filter that matched substrings would put a `web` lesson mentioning "API" under scope `api` while hiding the repo-wide lesson that really governs it. Deciding membership here keeps one implementation of the rule; the page only reads the answer back off each row.
Types ¶
type Box ¶
Box is a laid-out rectangle in the map's coordinate space. Its fields are exported because the template draws directly from them — the SVG is emitted by html/template, not assembled as markup here, so every value it carries stays escaped.
type Card ¶
type Card struct {
ID int64
Rule string
Region string
Note string
Agent string
Status string
Pending bool
// Cited is how many findings the agent cited when the pattern was
// distilled — a fact of the proposal record, true forever.
// Retrieved is how many of those the index can still show: mining
// windows move on, and a pin applied months ago may cite comments
// that have since aged out. When they differ the page says so
// rather than presenting the shortfall as the evidence.
Cited int
Retrieved int
Events int
// Evidence health (RFC-002 §7), recomputed at report time: the
// confidence tier with its facts, the prompt era when the proposal
// predates the current recurrence rules, and the regions today's
// inference would assign when they differ from the stored ones.
Tier string
Facts string
Era string
RegionsNow string
// Scope is the trigger-scope advisory sentence (RFC-004): the note
// and co-change history point outside the pin's regions, so
// delivery may miss the trigger site. Same Line() the ledger prints.
Scope string
// Blocked reports confirmed triggers that cannot become delivery scopes —
// no drift and no advisory would otherwise mention them.
Blocked string
Evidence []Evidence
// Outcome is the passive loop's verdict sentence,
// present only for measured applied pins.
Outcome string
// NotLanding styles the outcome as the class that needs action.
NotLanding bool
}
Card is a distilled proposal awaiting — or having received — a decision, with the evidence it cited.
type Cell ¶
type Cell struct {
Box
File string
Scope string // what clicking it filters the lessons table by
Label string // truncated to what the cell can show; "" when it cannot
Metric string // the fix count line; "" when the cell is too short
Fill string
Ink string
Tooltip string
}
Cell is one file on the hotspot map.
type Duplicate ¶
type Duplicate struct {
Pins []DuplicatePin
}
Duplicate is a set of applied pins that restate one theme.
type DuplicatePin ¶
DuplicatePin is one member of such a set.
type Evidence ¶
type Evidence struct {
Source string // review | fix:conventional | ...
Kind string // the source's provider, for the badge colour
Path string
Body string
URL string // "" unless it is a plain http(s) link
}
Evidence is one finding behind a proposal, as displayed.
type Group ¶
Group is a directory box on the hotspot map. Files is how many the directory holds, not how many are drawn — the label carries the difference so a four-cell box does not read as a four-file directory.
type LessonRow ¶
type LessonRow struct {
Occurrences int
Region string
Reviewer string
Symptom string
Search string // lowercased region + symptom, for the text filter
// Scopes are the map scopes this lesson belongs to, space-separated.
// Region membership is decided here rather than in the page, so
// clicking a cell cannot disagree with the count in its tooltip.
Scopes string
}
LessonRow is one mined lesson in the explorer table.
type Report ¶
type Report struct {
Repo string
IndexState string
Generated string
Stale bool
Stats []Stat
Sources string // the evidence mix behind every proposal
Cards []Card
CardsTotal int
Pending int
Duplicates []Duplicate
AppliedPins int
Redundant int
Groups []Group
Cells []Cell
MapWidth float64
MapHeight float64
// FilesWithHistory is every file the index has commits for. The map
// draws a fraction of them, and says which fraction: a picture that
// silently omits most of the repo reads as the whole repo.
FilesWithHistory int
Lessons []LessonRow
LessonsTotal int
}
Report is one rendered page: the view model, fully resolved, so the template only ranges and prints.