Documentation
¶
Overview ¶
Package sources provides content acquisition from local files, git repositories, and web pages. Each source type returns []RawDoc; chunking and indexing are applied by the sources orchestrator.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultRegistry = &Registry{}
DefaultRegistry is the package-level registry populated by init() functions in each source file (local.go, git.go, etc.).
Functions ¶
This section is empty.
Types ¶
type CredentialConsumer ¶ added in v0.2.0
CredentialConsumer is implemented by sources that authenticate outbound requests. The orchestrator calls SetCredentials after construction when a source implements it, which keeps Factory free of a parameter that only network-backed source kinds need.
type Factory ¶
type Factory func(name string, raw any, projectRoot, baseDir string, global config.PullPolicy) (Source, SourceMeta, error)
Factory creates a Source and its metadata from kind-specific configuration. name is the user-chosen label for the source entry. raw is the kind-specific config struct (e.g. config.LocalSource for "local"). projectRoot is the workspace root; baseDir is the cache directory for fetched remote sources. global is the project-wide PullPolicy fallback.
type GitSource ¶
type GitSource struct {
// contains filtered or unexported fields
}
GitSource clones a remote git repository to disk.
type HTTPSource ¶
type HTTPSource struct {
// contains filtered or unexported fields
}
HTTPSource downloads a URL archive (or single file) to disk.
func (*HTTPSource) Fetch ¶
func (s *HTTPSource) Fetch(ctx context.Context) error
Fetch downloads the URL to disk. When extract is nil, archive detection is automatic (Content-Type or .tar.gz/.tgz URL suffix). When extract is non-nil its value is used directly. Optional headers are added to the request alongside .netrc credentials.
func (*HTTPSource) Read ¶
func (s *HTTPSource) Read(globs []string, prefix string) ([]RawDoc, error)
func (*HTTPSource) SetCredentials ¶ added in v0.2.0
func (s *HTTPSource) SetCredentials(store *auth.Store)
SetCredentials implements CredentialConsumer.
type LocalSource ¶
type LocalSource struct {
// contains filtered or unexported fields
}
LocalSource serves files directly from an existing filesystem; Fetch is a no-op.
type RawDoc ¶
type RawDoc struct {
// Source identifies the origin (relative path, URL, or repo:path).
Source string
// Content is the raw content of the document.
Content string
}
RawDoc is a fetched document before chunking/indexing. Sources return RawDocs; the orchestrator applies chunking later.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry holds source factories keyed by kind (e.g. "local", "git").
type ScrapeOptions ¶
type ScrapeOptions struct {
MaxPageSize int64 // max bytes per page
MaxPages int // max URLs to fetch (seeds + discovered)
MaxDepth int // max link-following depth; 0 = seed URLs only
}
ScrapeOptions configures limits for URL scraping.
type ScrapeSource ¶
type ScrapeSource struct {
// contains filtered or unexported fields
}
ScrapeSource crawls web pages and saves them as markdown to disk.
func (*ScrapeSource) Fetch ¶
func (s *ScrapeSource) Fetch(ctx context.Context) error
Fetch scrapes the configured URLs, converts HTML to text, and saves each page as a .md file under destDir. When opts.MaxDepth > 0, discovered links that share the same origin and path prefix as their seed URL are followed. Existing destDir content is cleared first for a clean fetch.
type Source ¶
type Source interface {
Fetch(ctx context.Context) error
Read(globs []string, prefix string) ([]RawDoc, error)
}
Source is the interface satisfied by every content source. Fetch acquires remote content to disk (no-op for local sources); Read returns matched documents from the source content.
type SourceMeta ¶
type SourceMeta struct {
NoIndex bool // when true, skip indexing for this source
ReadGlobs []string // glob patterns for content files within the source FS
ReadPrefix string // prefix prepended to file paths for attribution
}
SourceMeta carries per-source metadata used by the orchestrator to read and index content after Fetch.