Documentation
¶
Index ¶
- Constants
- Variables
- func DocTypeNames() []string
- func DocsPath(workDir string) string
- func Slugify(s string) string
- func ValidDocType(t string) bool
- type AIProvider
- type AIStatsAggregate
- type AIUsage
- type AIUsageRecord
- type AIUsageStore
- type CallOptions
- type CodeSignature
- type CommitInfo
- type CommitPattern
- type CommitRecord
- type CommitStore
- type CorpusReader
- type DailyAIStats
- type Decision
- type DocFilter
- type DocIndexEntry
- type DocIndexStore
- type DocMeta
- type DocStatus
- type DocType
- type GitAdapter
- type IOStreams
- type InstallResult
- type LoreStore
- type Option
- type PatternStore
- type ReviewCacheEntry
- type ReviewCacheStore
- type ScopeStatsResult
- type SignatureStore
- type StoreMaintenanceOps
- type UsageTracker
Constants ¶
const ( // LoreDir is the root directory name for Lore data. LoreDir = ".lore" // DocsDir is the subdirectory name for documentation files. DocsDir = "docs" // TemplatesDir is the subdirectory name for project-local templates. TemplatesDir = "templates" )
Directory components within the .lore structure. These are path *segments*, not full paths. Use filepath.Join with a workDir or loreDir to construct full paths.
Variables ¶
var ( ErrNotFound = errors.New("not found") ErrCorrupted = errors.New("corrupted") ErrAlreadyExists = errors.New("already exists") ErrNotInitialized = errors.New("lore not initialized") ErrNotGitRepo = errors.New("not a git repository") ErrNotInteractive = errors.New("not interactive") ErrNotImplemented = errors.New("not implemented") )
Functions ¶
func DocTypeNames ¶ added in v1.1.0
func DocTypeNames() []string
DocTypeNames returns sorted list of valid document type names.
func DocsPath ¶ added in v1.0.0
DocsPath returns the path to the docs directory relative to workDir.
func Slugify ¶
Slugify converts a string to a URL-friendly slug (display purposes). For filename generation, use storage.slugify which also handles accents and length limits.
func ValidDocType ¶
ValidDocType reports whether t is a recognized document type. This is the single source of truth for accepted types.
Types ¶
type AIProvider ¶
type AIStatsAggregate ¶ added in v1.0.0
type AIUsageRecord ¶ added in v1.0.0
type AIUsageStore ¶ added in v1.0.0
type AIUsageStore interface {
RecordAIUsage(usage AIUsageRecord) error
AIStatsSince(since time.Time) (*AIStatsAggregate, error)
AIStatsByDay(days int) ([]DailyAIStats, error)
}
AIUsageStore handles AI usage recording (Phase 1 — stub).
type CallOptions ¶
type CodeSignature ¶ added in v1.0.0
type CommitInfo ¶
type CommitInfo struct {
Hash string
Author string
Date time.Time
Message string
Type string
Scope string
Subject string
Branch string // current branch at commit time; "" if detached HEAD
IsMerge bool // true when the commit has more than one parent
ParentCount int // number of parent commits (0 for root, 1 for normal, 2+ for merge)
}
type CommitPattern ¶ added in v1.0.0
type CommitRecord ¶ added in v1.0.0
type CommitRecord struct {
Hash string
Date time.Time
Branch string
Scope string
ConvType string
Subject string
Message string
FilesChanged int
LinesAdded int
LinesDeleted int
DocID string // nullable — filename of generated doc
Decision string // documented|skipped|pending|auto-skipped|merge-skipped|unknown
DecisionScore int // nullable — score 0-100
DecisionConfidence float64 // nullable
SkipReason string // nullable
QuestionMode string // full|reduced|confirm|none
}
CommitRecord is the store-layer view of a commit (what we persist). Not a replacement for CommitInfo which is the git-layer view.
type CommitStore ¶ added in v1.0.0
type CommitStore interface {
RecordCommit(rec CommitRecord) error
GetCommit(hash string) (*CommitRecord, error)
CommitsByScope(scope string, days int) ([]CommitRecord, error)
CommitsByBranch(branch string) ([]CommitRecord, error)
CommitsSince(since time.Time) ([]CommitRecord, error)
UndocumentedCommits() ([]CommitRecord, error)
CommitCountByDecision() (map[string]int, error)
ScopeStats(scope string, days int) (ScopeStatsResult, error)
}
CommitStore handles commit recording and querying.
type CorpusReader ¶
type DailyAIStats ¶ added in v1.0.0
type Decision ¶ added in v1.0.0
type Decision = string
Decision represents the outcome of the documentation decision engine.
type DocIndexEntry ¶ added in v1.0.0
type DocIndexEntry struct {
Filename string
Type string
Date string
CommitHash string
Branch string
Scope string
Status string
Tags []string // stored as comma-separated in DB
Related []string // stored as comma-separated in DB
GeneratedBy string
AngelaMode string
ConsolidatedInto string
ContentHash string // SHA-256 of body
SummaryWhy string
SummaryWhat string
TitleExtracted string
WordCount int
UpdatedAt time.Time
}
DocIndexEntry is the store-layer view of a document's metadata.
type DocIndexStore ¶ added in v1.0.0
type DocIndexStore interface {
IndexDoc(entry DocIndexEntry) error
RemoveDoc(filename string) error
GetDoc(filename string) (*DocIndexEntry, error)
DocsByScope(scope string) ([]DocIndexEntry, error)
DocsByBranch(branch string) ([]DocIndexEntry, error)
DocsByType(docType string) ([]DocIndexEntry, error)
UnconsolidatedDocs(scope string) ([]DocIndexEntry, error)
AllDocSummaries(limit int) ([]DocIndexEntry, error)
DocsByCommitHash(hash string) ([]DocIndexEntry, error)
SearchDocs(ctx context.Context, query string) ([]DocIndexEntry, error)
DocCount() (int, error)
}
DocIndexStore handles document index operations.
type DocMeta ¶
type DocMeta struct {
Type string `yaml:"type"`
Date string `yaml:"date"`
Commit string `yaml:"commit,omitempty"`
Branch string `yaml:"branch,omitempty"`
Scope string `yaml:"scope,omitempty"`
Status string `yaml:"status"`
Tags []string `yaml:"tags,omitempty"`
Related []string `yaml:"related,omitempty"`
GeneratedBy string `yaml:"generated_by,omitempty"`
AngelaMode string `yaml:"angela_mode,omitempty"`
// Synthesized records the signatures of every Example Synthesizer
// that has produced output for this doc. The map key is
// the synthesizer Name (e.g. "api-postman"), and the value carries the
// fields defined by synthesizer.Signature (hash, at, version, sections,
// evidence_count, warnings).
//
// Stored as map[string]map[string]any to keep the domain package free
// of dependencies on internal/angela. Converted to/from typed
// synthesizer.Signature inside the synthesizer package.
Synthesized map[string]map[string]any `yaml:"synthesized,omitempty"`
Filename string `yaml:"-"` // populated at runtime by ListDocs, not serialized
}
type DocStatus ¶ added in v1.0.0
type DocStatus = string
DocStatus represents the lifecycle state of a document.
type GitAdapter ¶
type GitAdapter interface {
Diff(ref string) (string, error)
Log(ref string) (*CommitInfo, error)
CommitExists(ref string) (bool, error)
IsMergeCommit(ref string) (bool, error)
IsInsideWorkTree() bool
HeadRef() (string, error)
// HeadCommit returns the full commit info for HEAD in a single git
// invocation, replacing separate HeadRef() + Log(ref) calls.
HeadCommit() (*CommitInfo, error)
IsRebaseInProgress() (bool, error)
CommitMessageContains(ref, marker string) (bool, error)
GitDir() (string, error)
InstallHook(hookType string) (InstallResult, error)
UninstallHook(hookType string) error
HookExists(hookType string) (bool, error)
CommitRange(from, to string) ([]string, error)
LatestTag() (string, error)
LogAll() ([]CommitInfo, error)
CurrentBranch() (string, error)
}
type InstallResult ¶
type InstallResult struct {
Installed bool // true if the hook was installed
HooksPathWarn string // non-empty if core.hooksPath is configured
}
InstallResult describes the outcome of a hook install operation.
type LoreStore ¶ added in v1.0.0
type LoreStore interface {
CommitStore
DocIndexStore
SignatureStore
AIUsageStore
ReviewCacheStore
PatternStore
StoreMaintenanceOps
}
LoreStore is the composed interface for the full store. Consumers that only need a subset should accept the focused interface (CommitStore, DocIndexStore, etc.) instead of LoreStore.
type Option ¶
type Option func(*CallOptions)
func WithMaxTokens ¶ added in v1.0.0
func WithSystem ¶ added in v1.0.0
func WithTemperature ¶ added in v1.0.0
func WithTimeout ¶ added in v1.0.0
type PatternStore ¶ added in v1.0.0
type PatternStore interface {
UpdatePattern(convType, scope string, decision string, diffLines, score int) error
GetPattern(convType, scope string) (*CommitPattern, error)
AllPatterns() ([]CommitPattern, error)
}
PatternStore handles commit pattern tracking (Phase 2 — stub).
type ReviewCacheEntry ¶ added in v1.0.0
type ReviewCacheStore ¶ added in v1.0.0
type ReviewCacheStore interface {
CacheReview(report ReviewCacheEntry) error
GetCachedReview(corpusHash string) (*ReviewCacheEntry, error)
ReviewHistory(limit int) ([]ReviewCacheEntry, error)
}
ReviewCacheStore handles review caching (Phase 1 — stub).
type ScopeStatsResult ¶ added in v1.0.0
type ScopeStatsResult struct {
TotalCommits int
DocumentedCount int
SkippedCount int
LastDocDate int64
LastCommitDate int64
}
ScopeStatsResult holds aggregated statistics for a scope, computed via SQL instead of loading all records into memory.
type SignatureStore ¶ added in v1.0.0
type SignatureStore interface {
StoreSignatures(commitHash string, sigs []CodeSignature) error
FindBySignatureHash(sigHash string) ([]CodeSignature, error)
SignaturesForCommit(commitHash string) ([]CodeSignature, error)
EntityHistory(entityName, lang string) ([]CodeSignature, error)
}
SignatureStore handles code signature tracking (Phase 1 — stub).
type StoreMaintenanceOps ¶ added in v1.0.0
type StoreMaintenanceOps interface {
Rebuild(ctx context.Context, docsDir string, git GitAdapter) error
Vacuum() error
Close() error
}
StoreMaintenanceOps handles store lifecycle operations.
type UsageTracker ¶ added in v1.1.0
type UsageTracker interface {
LastUsage() *AIUsage
}
UsageTracker is optionally implemented by AIProviders that can report token usage.