search

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package search implements unified full-text search across all cloop project artifacts. It can search tasks, KB entries, journal entries, step logs, task artifacts, changelog, retro reports, and plan snapshots.

Index

Constants

This section is empty.

Variables

AllSources is the full set of source types.

Functions

func SemanticRankPrompt

func SemanticRankPrompt(query string, results []Result) string

SemanticRankPrompt builds the AI prompt used to re-rank results.

Types

type Options

type Options struct {
	// Types filters which source types to search. Empty = all.
	Types []SourceType
	// Semantic uses the AI provider to re-rank results by relevance.
	Semantic bool
	// Provider and Model for semantic re-ranking.
	Provider provider.Provider
	Model    string
	// Timeout for AI calls.
	Timeout time.Duration
}

Options controls the search behaviour.

type Result

type Result struct {
	Source    SourceType `json:"source"`
	ID        string     `json:"id,omitempty"`        // task ID, KB entry ID, etc.
	Title     string     `json:"title,omitempty"`     // human-readable label
	Excerpt   string     `json:"excerpt"`             // matched text snippet (≤200 chars)
	FilePath  string     `json:"file_path,omitempty"` // relative path to file
	Timestamp time.Time  `json:"timestamp,omitempty"` // when the artifact was created/updated
	Score     int        `json:"score"`               // relevance score (higher = more relevant)
}

Result is one match returned by a search.

func Run

func Run(ctx context.Context, workDir, query string, opts Options) ([]Result, error)

Run executes the search and returns matching results sorted by score descending.

type SourceType

type SourceType string

SourceType identifies the artifact type a result came from.

const (
	SourceTask      SourceType = "task"
	SourceKB        SourceType = "kb"
	SourceJournal   SourceType = "journal"
	SourceStepLog   SourceType = "steplog"
	SourceArtifact  SourceType = "artifact"
	SourceChangelog SourceType = "changelog"
	SourceRetro     SourceType = "retro"
	SourceSnapshot  SourceType = "snapshot"
	SourceArchive   SourceType = "archive"
)

func ParseTypes

func ParseTypes(s string) ([]SourceType, error)

ParseTypes parses a comma-separated type filter string into SourceType slice. "all" or empty returns nil (= all types).

Jump to

Keyboard shortcuts

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