Documentation
¶
Overview ¶
Package qmd provides a shell-backed client for the QMD CLI.
Index ¶
Constants ¶
const ( // DefaultBinaryPath is the default executable name used to locate QMD. DefaultBinaryPath = "qmd" // InstallCommand is the recommended install command for the QMD CLI. InstallCommand = "npm install -g @tobilu/qmd" )
Variables ¶
var ( ErrQMDUnavailable = errors.New("qmd is not available") )
Functions ¶
This section is empty.
Types ¶
type ClientOption ¶
type ClientOption func(*QMDClient)
ClientOption mutates a QMDClient configuration.
func WithBinaryPath ¶
func WithBinaryPath(path string) ClientOption
WithBinaryPath overrides the executable used for QMD invocations.
func WithIndexName ¶
func WithIndexName(name string) ClientOption
WithIndexName routes QMD commands to a named SQLite index.
type CollectionInfo ¶
type CollectionInfo struct {
Name string `json:"name"`
Path string `json:"path"`
Pattern string `json:"pattern"`
Documents int `json:"documents"`
LastUpdated string `json:"lastUpdated"`
}
CollectionInfo summarizes one indexed QMD collection.
type EmbedResult ¶
type EmbedResult struct {
DocsProcessed int `json:"docsProcessed"`
ChunksEmbedded int `json:"chunksEmbedded"`
Errors int `json:"errors"`
DurationMs int `json:"durationMs"`
}
EmbedResult mirrors QMD's embedding summary.
type EmbedStatus ¶ added in v0.0.4
type EmbedStatus string
EmbedStatus summarizes the outcome of the optional embedding phase.
const ( // EmbedStatusNotRequested means the caller disabled embeddings. EmbedStatusNotRequested EmbedStatus = "not_requested" // EmbedStatusCompleted means embeddings ran successfully. EmbedStatusCompleted EmbedStatus = "completed" // runtime lacks sqlite-vec support. EmbedStatusSkippedUnavailable EmbedStatus = "skipped_unavailable" )
type IndexOperation ¶
type IndexOperation string
IndexOperation selects whether Index creates a collection or updates one.
const ( // IndexOperationAdd creates a collection and performs the initial sync. IndexOperationAdd IndexOperation = "add" // IndexOperationUpdate refreshes an existing collection. IndexOperationUpdate IndexOperation = "update" )
type IndexOptions ¶
type IndexOptions struct {
Operation IndexOperation
VaultPath string
CollectionName string
Context string
Embed bool
ForceEmbed bool
}
IndexOptions configures a collection sync invocation.
type IndexResult ¶
type IndexResult struct {
CollectionName string `json:"collectionName"`
UpdateResult UpdateResult `json:"updateResult"`
EmbedResult *EmbedResult `json:"embedResult,omitempty"`
EmbedStatus EmbedStatus `json:"embedStatus"`
EmbedWarning string `json:"embedWarning,omitempty"`
Status IndexStatus `json:"status"`
}
IndexResult groups the collection sync summary, optional embedding summary, and the final index status snapshot.
type IndexStatus ¶
type IndexStatus struct {
TotalDocuments int `json:"totalDocuments"`
NeedsEmbedding int `json:"needsEmbedding"`
HasVectorIndex bool `json:"hasVectorIndex"`
Collections []CollectionInfo `json:"collections"`
}
IndexStatus mirrors QMD's status view for collection health.
type QMDClient ¶
type QMDClient struct {
// contains filtered or unexported fields
}
QMDClient executes QMD shell commands with context-aware process management.
func NewClient ¶
func NewClient(options ...ClientOption) *QMDClient
NewClient constructs a QMDClient with sensible defaults.
func (*QMDClient) Index ¶
func (client *QMDClient) Index(ctx context.Context, options IndexOptions) (IndexResult, error)
Index creates or updates a QMD collection and returns the structured summary.
func (*QMDClient) Search ¶
func (client *QMDClient) Search(ctx context.Context, options SearchOptions) ([]SearchResult, error)
Search executes a QMD search command and returns normalized results.
type SearchMode ¶
type SearchMode string
SearchMode selects the QMD retrieval mode for Search.
const ( // SearchModeHybrid runs QMD's hybrid `query` command. SearchModeHybrid SearchMode = "hybrid" // SearchModeLexical runs QMD's lexical `search` command. SearchModeLexical SearchMode = "lexical" // SearchModeVector runs QMD's semantic `vsearch` command. SearchModeVector SearchMode = "vector" )
type SearchOptions ¶
type SearchOptions struct {
Query string
Mode SearchMode
Limit int
All bool
MinScore *float64
Full bool
Collection string
}
SearchOptions configures a QMD search invocation.