topic

package
v0.18.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package topic parses and validates current-state topic inputs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseMetadata

func ParseMetadata(metadataRoot, path string, data []byte) (TopicID, Metadata, error)

func ParseSelector

func ParseSelector(selector string) (topicID, claimID string, err error)

func RenderIndex

func RenderIndex(model IndexRenderModel) (string, error)

func RenderTopic

func RenderTopic(model TopicRenderModel) (string, error)

Types

type ADRHistory

type ADRHistory struct {
	Number string `json:"number"`
	Title  string `json:"title"`
	Status string `json:"status"`
}

type Backing

type Backing string
const (
	NoBacking         Backing = ""
	ExplicitNoBacking Backing = "none"
	TestBacking       Backing = "test"
	Unbacked          Backing = "unbacked"
)

type Claim

type Claim struct {
	ID, Slug              string
	Type                  ClaimType
	Prose                 string
	Origin                string
	RevisedBy, References []string
	Backing               Backing
	Verify                string
}

type ClaimHistory

type ClaimHistory struct {
	ClaimID   string       `json:"claimId"`
	Origin    ADRHistory   `json:"origin"`
	RevisedBy []ADRHistory `json:"revisedBy"`
}

type ClaimReferences

type ClaimReferences struct {
	ClaimID  string   `json:"claimId"`
	Incoming []string `json:"incoming"`
	Outgoing []string `json:"outgoing"`
}

type ClaimType

type ClaimType string
const (
	Rule      ClaimType = "rule"
	Invariant ClaimType = "invariant"
)

type Corpus

type Corpus struct {
	DomainPaths map[string][]string
	Markers     MarkerIndex
	// contains filtered or unexported fields
}

func LoadCorpus

func LoadCorpus(root string, cfg *config.Config, adrs adr.Corpus) (Corpus, error)

func (Corpus) All

func (c Corpus) All() []Topic

func (Corpus) ByClaimID

func (c Corpus) ByClaimID(id string) (Claim, bool)

func (Corpus) ByTopicID

func (c Corpus) ByTopicID(id string) (Topic, bool)

func (Corpus) ForDomain

func (c Corpus) ForDomain(domain string) []Topic

func (Corpus) Incoming

func (c Corpus) Incoming(id string) []string

func (Corpus) Outgoing

func (c Corpus) Outgoing(id string) []string

type EffectiveSelector

type EffectiveSelector struct {
	DomainPath string `json:"domainPath"`
	TopicPath  string `json:"topicPath"`
}

type IndexRenderModel

type IndexRenderModel struct {
	Domain string
	Topics []TopicListItem
}

func BuildIndexModel

func BuildIndexModel(domain string, topics []Topic) IndexRenderModel

type MarkerIndex

type MarkerIndex struct {
	// contains filtered or unexported fields
}

func BuildMarkerIndex

func BuildMarkerIndex(root string, corpus Corpus, cfg *config.CurrentStateConfig) (MarkerIndex, error)

func (MarkerIndex) All

func (m MarkerIndex) All() []MarkerSite

func (MarkerIndex) ForClaim

func (m MarkerIndex) ForClaim(id string) []MarkerSite

type MarkerKind

type MarkerKind string
const (
	StateMarker   MarkerKind = "state"
	ProofMarker   MarkerKind = "invariant"
	TouchesMarker MarkerKind = "touches-state"
)

type MarkerSite

type MarkerSite struct {
	Path    string     `json:"path"`
	Line    int        `json:"line"`
	Kind    MarkerKind `json:"kind"`
	ClaimID string     `json:"claimId"`
	Note    string     `json:"note,omitempty"`
}

type Metadata

type Metadata struct {
	Title, Summary string
	Paths          []string
	Applies        string
}
type NavigationModel struct {
	IndexLink string
	Topics    []TopicListItem
}

func BuildNavigationModel

func BuildNavigationModel(domain string, topics []Topic) NavigationModel

type QueryClaim

type QueryClaim struct {
	ID      string    `json:"id"`
	Type    ClaimType `json:"type"`
	Prose   string    `json:"prose"`
	Backing Backing   `json:"backing"`
	Verify  string    `json:"verify,omitempty"`
}

type QueryCoverage

type QueryCoverage struct {
	DeclaredGlobal     bool                `json:"declaredGlobal"`
	DeclaredPaths      []string            `json:"declaredPaths"`
	EffectiveSelectors []EffectiveSelector `json:"effectiveSelectors"`
	MarkerSites        []MarkerSite        `json:"markerSites"`
}

type QueryOptions

type QueryOptions struct {
	History, References, Coverage bool
}

QueryOptions selects independent detail projections for a current-state query.

type QueryResult

type QueryResult struct {
	Kind       string            `json:"kind"`
	ID         string            `json:"id"`
	Title      string            `json:"title,omitempty"`
	Summary    string            `json:"summary,omitempty"`
	Claims     []QueryClaim      `json:"claims"`
	History    []ClaimHistory    `json:"history,omitempty"`
	References []ClaimReferences `json:"references,omitempty"`
	Coverage   *QueryCoverage    `json:"coverage,omitempty"`
}

QueryResult is the single deterministic semantic model used by human and JSON presentation. Optional detail blocks are nil unless their corresponding flag was requested.

func Query

func Query(c Corpus, adrs adr.Corpus, selector string, opts QueryOptions) (QueryResult, error)

Query resolves one active topic or claim and assembles only the requested direct detail. It never traverses references or constructs removed identities.

type ScaffoldFile

type ScaffoldFile struct {
	Path    string
	Content []byte
}

ScaffoldFile is one repository-relative authored input produced for a topic.

func ScaffoldFiles

func ScaffoldFiles(root string, cfg *config.Config, domain, title string) ([]ScaffoldFile, error)

ScaffoldFiles validates and allocates the paired authored inputs for a topic. It inspects both trees but performs no writes.

type Topic

type Topic struct {
	ID                     TopicID
	Metadata               Metadata
	Intro, Part            string
	Claims                 []Claim
	MetadataPath, PartPath string
}

func ParsePart

func ParsePart(id TopicID, path string, data []byte) (Topic, error)

type TopicCoverage

type TopicCoverage struct {
	DeclaredGlobal          bool
	DeclaredPaths           []string
	EffectiveSelectors      []EffectiveSelector
	HasClaims               bool
	SatisfiesScopedCoverage bool
	MarkerSites             []MarkerSite
}

func CoverageForTopic

func CoverageForTopic(t Topic, domainPaths []string, markers MarkerIndex) TopicCoverage

type TopicID

type TopicID struct{ Domain, Slug string }

func (TopicID) String

func (id TopicID) String() string

type TopicListItem

type TopicListItem struct{ Slug, Title, Summary, Link string }

type TopicRenderModel

type TopicRenderModel struct{ Title, Summary, Applicability, Part string }

func BuildTopicModel

func BuildTopicModel(t Topic, domainPaths []string, markers MarkerIndex) TopicRenderModel

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL