Documentation
¶
Overview ¶
Package docs provides a documentation system with two subsystems: a generation engine that parses Cobra command trees into Markdown files with hierarchy-aware index management, and a TUI browser built on Bubbles with split-pane navigation, async search, and AI-powered Q&A via retrieval-augmented generation (RAG).
Documentation is typically embedded in the binary via props.Assets under an assets/docs path, and the feature can be toggled via the DocsCmd feature flag.
Index ¶
- func AskAI(ctx context.Context, p *props.Props, fsys fs.FS, question string, ...) (string, error)
- func GetAllMarkdownContent(fsys fs.FS) (string, error)
- func ResolveProvider(p *props.Props, providerOverride ...string) chat.Provider
- func Serve(ctx context.Context, fsys fs.FS, port int) error
- type AskDeltaMsg
- type AskFunc
- type AskLogMsg
- type AskResponse
- type AskResultMsg
- type ListItem
- type LogFinishedMsg
- type MkDocsConfig
- type Model
- type NavNode
- type Option
- type SearchResult
- type SearchResultMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AskAI ¶
func AskAI(ctx context.Context, p *props.Props, fsys fs.FS, question string, logFn func(string, logger.Level), deltaFn func(string), providerOverride ...string) (string, error)
AskAI queries the AI about the embedded documentation. If the provider supports streaming, deltas are delivered via deltaFn as they arrive. logFn receives status messages. Either callback may be nil.
func GetAllMarkdownContent ¶
GetAllMarkdownContent walks the FS and concatenates all .md files.
func ResolveProvider ¶
ResolveProvider determines the AI provider to use based on override, config, and defaults.
Types ¶
type AskDeltaMsg ¶ added in v1.8.0
AskDeltaMsg is a Bubble Tea message carrying a streamed text fragment from the AI.
type AskFunc ¶
type AskFunc func(question string, logFn func(string, logger.Level), deltaFn func(string)) (string, error)
AskFunc is the callback signature for AI Q&A. logFn receives status messages; deltaFn receives streamed text fragments as they arrive (may be nil).
type AskResponse ¶
type AskResponse struct {
Answer string `json:"answer" jsonschema:"description=The comprehensive answer to the user's question based on the documentation provided."`
}
AskResponse is the structured response from an AI Q&A query.
type AskResultMsg ¶
AskResultMsg is a Bubble Tea message carrying the AI Q&A response.
type LogFinishedMsg ¶
type LogFinishedMsg struct{}
LogFinishedMsg is a Bubble Tea message signalling that AI log streaming is complete.
type MkDocsConfig ¶
type MkDocsConfig struct {
}
MkDocsConfig is the parsed structure of mkdocs.yml for navigation extraction.
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the Bubble Tea model for the interactive documentation browser. It manages navigation, content rendering, search, and AI Q&A.
type NavNode ¶
type NavNode struct {
}
NavNode represents a node in the documentation navigation tree.
type Option ¶
type Option func(*Model)
Option is a functional option for configuring the documentation Model.
func WithAskFunc ¶
WithAskFunc configures the AI Q&A callback for the documentation browser.
type SearchResult ¶
SearchResult holds a single search match with context excerpt.
type SearchResultMessage ¶
type SearchResultMessage struct {
Results []SearchResult
Query string
}
SearchResultMessage is a Bubble Tea message carrying search results.