okf

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SchemaVersion = 1
	OKFVersion    = "0.1"
)

Variables

This section is empty.

Functions

func LoadSourceRoot

func LoadSourceRoot(sourceRoot string) (string, []byte, error)

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"`
	OKFVersion    string    `json:"okf_version"`
	RootIndex     RootIndex `json:"root_index"`
	Concepts      []Concept `json:"concepts"`
	SourceSHA256  string    `json:"source_sha256"`
}

func LoadEmbeddedBundle

func LoadEmbeddedBundle() (Bundle, error)

func LoadSourceBundle

func LoadSourceBundle(sourceRoot string) (Bundle, []byte, error)

type BundleManifest

type BundleManifest struct {
	SchemaVersion int    `json:"schema_version"`
	OKFVersion    string `json:"okf_version"`
	ConceptCount  int    `json:"concept_count"`
	BundleSHA256  string `json:"bundle_sha256"`
	SourceSHA256  string `json:"source_sha256"`
}

type Concept

type Concept struct {
	Path        string         `json:"path"`
	ConceptID   string         `json:"concept_id"`
	Type        string         `json:"type"`
	Title       string         `json:"title"`
	Description string         `json:"description,omitempty"`
	Resource    string         `json:"resource,omitempty"`
	Tags        []string       `json:"tags,omitempty"`
	Timestamp   string         `json:"timestamp,omitempty"`
	Frontmatter map[string]any `json:"frontmatter,omitempty"`
	Body        string         `json:"body"`
	Snippet     string         `json:"snippet,omitempty"`
}

type RootIndex

type RootIndex struct {
	Path        string         `json:"path"`
	OKFVersion  string         `json:"okf_version"`
	Frontmatter map[string]any `json:"frontmatter,omitempty"`
	Body        string         `json:"body"`
}

type SearchMatch

type SearchMatch struct {
	ConceptID   string   `json:"concept_id"`
	Path        string   `json:"path"`
	Type        string   `json:"type"`
	Title       string   `json:"title"`
	Description string   `json:"description,omitempty"`
	Resource    string   `json:"resource,omitempty"`
	Tags        []string `json:"tags,omitempty"`
	Snippet     string   `json:"snippet,omitempty"`
	Score       int      `json:"score"`
}

type SearchRequest

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

type SearchResult

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

Jump to

Keyboard shortcuts

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