knowledge

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 30, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SchemaVersion = 2
)

Variables

This section is empty.

Functions

func VerifyDistFiles

func VerifyDistFiles(distRoot string, result BuildResult) error

func WriteDistFiles

func WriteDistFiles(distRoot string, result BuildResult) error

Types

type BuildResult

type BuildResult struct {
	Bundle       Bundle
	BundleJSON   []byte
	Manifest     BundleManifest
	ManifestJSON []byte
	SHA256File   []byte
}

func BuildFromSource

func BuildFromSource(sourceRoot string) (BuildResult, error)

type Bundle

type Bundle struct {
	SchemaVersion int               `json:"schema_version"`
	BuiltAt       string            `json:"built_at"`
	KnowledgeID   string            `json:"knowledge_id"`
	KnowledgeName string            `json:"knowledge_name"`
	AllowedRepos  []string          `json:"allowed_repos"`
	SourceRefs    map[string]string `json:"source_refs,omitempty"`
	SourceSHA256  string            `json:"source_sha256"`
	Cards         []Card            `json:"cards"`
	Indices       Indices           `json:"indices"`
}

func LoadEmbeddedBundle

func LoadEmbeddedBundle() (Bundle, error)

type BundleManifest

type BundleManifest struct {
	SchemaVersion    int      `json:"schema_version"`
	BuiltAt          string   `json:"built_at"`
	KnowledgeID      string   `json:"knowledge_id"`
	AllowedRepos     []string `json:"allowed_repos"`
	CardCount        int      `json:"card_count"`
	BundleSHA256     string   `json:"bundle_sha256"`
	CardsSHA256      string   `json:"cards_sha256"`
	TopicIndexSHA256 string   `json:"topic_index_sha256"`
	CodeIndexSHA256  string   `json:"code_index_sha256"`
	SourceSHA256     string   `json:"source_sha256"`
}

type Card

type Card struct {
	ID                string        `json:"id"`
	Version           int           `json:"version"`
	Title             string        `json:"title"`
	Status            string        `json:"status"`
	Owners            []string      `json:"owners,omitempty"`
	Tags              []string      `json:"tags,omitempty"`
	Summary           string        `json:"summary"`
	Mechanism         string        `json:"mechanism"`
	Boundaries        string        `json:"boundaries"`
	InvalidConditions string        `json:"invalid_conditions"`
	Evidence          []EvidenceRef `json:"evidence"`
	SourceCardID      string        `json:"source_card_id,omitempty"`
}

func LoadSourceCards

func LoadSourceCards(sourceRoot string, allowedRepos map[string]struct{}) ([]Card, error)

func ParseSourceCardMarkdown

func ParseSourceCardMarkdown(path string, allowedRepos map[string]struct{}) (Card, error)

type EvidenceRef

type EvidenceRef struct {
	Repo string `json:"repo"`
	Path string `json:"path"`
	Line int    `json:"line"`
	Note string `json:"note,omitempty"`
}

type Indices

type Indices struct {
	Topics    map[string][]string `json:"topics"`
	CodePaths map[string][]string `json:"code_paths"`
}

func LoadSourceIndices

func LoadSourceIndices(sourceRoot string, allowedRepos map[string]struct{}) (Indices, error)

type SearchMatch

type SearchMatch struct {
	CardID      string   `json:"card_id"`
	Title       string   `json:"title"`
	Summary     string   `json:"summary"`
	Score       int      `json:"score"`
	Tags        []string `json:"tags,omitempty"`
	SourceRepos []string `json:"source_repos,omitempty"`
}

type SearchRequest

type SearchRequest struct {
	Query      string
	MaxResults int
	Tags       []string
}

type SearchResult

type SearchResult struct {
	Query      string        `json:"query"`
	TotalCards int           `json:"total_cards"`
	Matches    []SearchMatch `json:"matches"`
}
func Search(req SearchRequest) (SearchResult, error)

type SourceManifest

type SourceManifest struct {
	SchemaVersion int               `json:"schema_version" yaml:"schema_version"`
	KnowledgeID   string            `json:"knowledge_id" yaml:"knowledge_id"`
	KnowledgeName string            `json:"knowledge_name" yaml:"knowledge_name"`
	UpdatedAt     string            `json:"updated_at" yaml:"updated_at"`
	AllowedRepos  []string          `json:"allowed_repos" yaml:"allowed_repos"`
	SourceRefs    map[string]string `json:"source_refs,omitempty" yaml:"source_refs"`
}

func LoadSourceManifest

func LoadSourceManifest(sourceRoot string) (SourceManifest, []byte, error)

Jump to

Keyboard shortcuts

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