Documentation
¶
Overview ¶
@facet: delivery/distribution/registry-snapshot @facet-role: related
@facet: registry/layout/source-views @facet-role: related
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterSection ¶
func RegisterSection(name string, build SectionBuilder)
RegisterSection adds a product section under name. Builds register from init. It panics on an empty name, a name Core's own fields already use, or a name registered twice: two writers of one key would make the value a consumer reads depend on which ran last.
Types ¶
type Anchor ¶
type Anchor struct {
Path string `json:"path"`
Line int `json:"line"`
Role string `json:"role"`
// Excerpt is the first line of code below the tag — what the anchor points
// at, quoted rather than summarised.
Excerpt string `json:"excerpt,omitempty"`
}
Anchor is one @facet: tag, as the consumer draws it.
type Corpus ¶
type Corpus struct {
SourceView *SourceViewSnapshot `json:"sourceView,omitempty"`
Facetrc string `json:"facetrc"`
Index string `json:"index"`
Records map[string]string `json:"records"`
Scan Scan `json:"scan"`
// Taxonomy contains verbatim project taxonomy YAML. Empty means no
// taxonomy was declared, not a declared taxonomy with no domains.
Taxonomy string `json:"taxonomy,omitempty"`
// Glossary contains verbatim terminology YAML. Empty means no glossary
// was declared; consumers leave prose untouched in that case.
Glossary string `json:"glossary,omitempty"`
// GlossaryGroups shares facet.Grouped() with the linter to keep ordering
// consistent: declared categories in file order
// (including empty ones), then sorted undeclared IDs, then uncategorised
// terms without a heading. Nil omits the key when no grouping is declared;
// an absent key does not assert that a grouping produced an empty list.
GlossaryGroups []GlossaryGroup `json:"glossaryGroups,omitempty"`
// Calibration is a computed host report using the normative bands from
// FACET §11.4, shared with consumers to keep those measurements consistent.
Calibration *facet.Calibration `json:"calibration,omitempty"`
// registry shares with other claims. Incomplete names any record or source
// the measurement could not read; an empty Incomplete means the lists are
// complete.
SharedClaims *facet.SharedClaims `json:"sharedClaims,omitempty"`
// contains filtered or unexported fields
}
Corpus carries configuration, record paths, verbatim record YAML and computed host data. Records remain unparsed for the consumer to interpret with its own parser and model.
func (Corpus) MarshalJSON ¶
MarshalJSON writes Core's fields as they are declared, then each product section in name order.
type GlossaryGroup ¶
type GlossaryGroup struct {
// ID is the category id, or "" for the terms that name none. The empty id
// is the state, not a missing value: those terms are uncategorised, and
// naming them here would put a category the project never declared into
// every surface.
ID string `json:"id"`
// Title and Purpose are the declared wording, empty when Declared is false
// — there is none to show for a category the file does not declare, and
// inventing one here invents it for every surface at once.
Title string `json:"title,omitempty"`
Purpose string `json:"purpose,omitempty"`
// Declared reports whether the file declares this category. It is what
// separates the two states that both carry no title: an undeclared id
// (Declared false, ID set) is a term whose category was deleted or
// mistyped, and the linter reports it as an error; the uncategorised group
// (Declared false, ID empty) is a decision nobody made.
Declared bool `json:"declared"`
// Terms are the names under this heading, in the order the file lists them.
// Empty under a declared category is the fourth drawn state: declared, and
// no term names it.
Terms []string `json:"terms"`
}
GlossaryGroup is one heading of the grouped glossary, as the consumer receives it: the category's own wording, whether the file declares it, and the names of the terms under it.
type Report ¶
type Report func(Status)
Report receives progress synchronously from the worker goroutine. A blocking callback delays the run and provides backpressure.
type Scan ¶
type Scan struct {
ScannedAt string `json:"scannedAt"`
Root string `json:"root"`
Registry string `json:"registry,omitempty"`
TotalLoc int `json:"totalLoc"`
Files int `json:"files"`
// AnchoredFiles and UnanchoredFiles partition this registry's scanned
// source files by presence of a belonging anchor, with per-file line counts.
// The split is a map, not a finding or gate (spec §9.3).
AnchoredFiles []ScannedFile `json:"anchoredFiles"`
UnanchoredFiles []ScannedFile `json:"unanchoredFiles"`
Anchors map[string][]Anchor `json:"anchors"`
OrphanAnchors []Orphan `json:"orphanAnchors"`
// Drift is anchored source that changed while its record did not — the
// signal FACET spec 12.1 describes, and the same one the Stop hook reports.
Drift []facet.Drift `json:"drift"`
// DriftBaseline is what Drift and ReferenceChanges were measured against.
// It travels with them so the consumer can say "no review recorded" or
// "could not be determined" instead of presenting an empty list as
// confirmed freshness.
DriftBaseline facet.Baseline `json:"driftBaseline"`
DriftRepositories []facet.RepositoryBaseline `json:"driftRepositories,omitempty"`
// ReferenceChanges are the implementation associations a deletion, a
// rename or a removed anchor moved or lost — including records whose
// source file is gone, which no current anchor can name any more.
ReferenceChanges []facet.ReferenceChange `json:"referenceChanges"`
// LastChanged is the day of the newest commit that touched each record
// file and each anchored file, relative to the registry root. The consumer
// sorts what records say by it. Absent (nil, omitted) when there is no
// usable history — no git, a failing git or a shallow clone — which is
// different from an empty map: the dates were not measured.
LastChanged map[string]string `json:"lastChanged,omitempty"`
}
Scan is host material: everything the consumer shows that no record declares. The consumer marks these values as coming from the scan, so the split matters.
type ScannedFile ¶
ScannedFile is one source file the scan read, named relative to the registry root, with the line count the scan already had to compute to produce TotalLoc.
type SectionBuilder ¶
SectionBuilder builds one product section for a registry. The second value is false when the project has nothing for this section, which leaves the key out rather than shipping an empty value.
type SourceViewRepository ¶
type SourceViewSnapshot ¶
type SourceViewSnapshot struct {
Name string `json:"name"`
RegistryRepository string `json:"registryRepository,omitempty"`
RegistryRevision string `json:"registryRevision,omitempty"`
RecordContentHash string `json:"recordContentHash"`
Sources []SourceViewRepository `json:"sources"`
}
func DescribeSourceView ¶
func DescribeSourceView(reg facet.Registry) (*SourceViewSnapshot, error)
DescribeSourceView exposes the same portable identity as corpus.Build without scanning implementation anchors. Unknown identity stays unknown.
type Status ¶
type Status struct {
Phase string `json:"phase"`
File string `json:"file,omitempty"`
Done int `json:"done,omitempty"`
Total int `json:"total,omitempty"`
Records int `json:"records,omitempty"`
Files int `json:"files,omitempty"`
Anchors int `json:"anchors,omitempty"`
Root string `json:"root,omitempty"`
Registry string `json:"registry,omitempty"`
}
Status is one report from a run in progress.