projectingestion

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2026 License: MIT Imports: 44 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WatchStatusLive     = "live"
	WatchStatusDegraded = "live_degraded"
	WatchStatusDisabled = "disabled"
)
View Source
const (
	DefaultPageSize        = 50
	MaxPageSize            = 100
	DefaultMaxChunkBytes   = 8192
	DefaultMaxSourceBytes  = 8192
	DefaultMaxSnippetBytes = 240
	MaxSnippetBytes        = 1024
	MaxSearchQueryBytes    = 256
	MaxASTQueryBytes       = 64
	MaxCallGraphDepth      = 5
	MaxCallGraphNodes      = 100
)
View Source
const SensitiveMarkerPolicySkipFile = "skip_file"

Variables

View Source
var (
	ErrProjectNotFound     = projectregistry.ErrProjectNotFound
	ErrInvalidInput        = projectregistry.ErrInvalidInput
	ErrProjectDisabled     = errors.New("ingestion project disabled")
	ErrUnsupportedIngest   = errors.New("ingestion unsupported")
	ErrIngestionNotFound   = errors.New("ingestion resource not found")
	ErrPathEscapesRoot     = errors.New("path escapes project root")
	ErrPathNotProjectLocal = errors.New("path must be project-relative")
)
View Source
var ErrExtractorCacheLegacyFingerprint = errors.New("extractor cache legacy empty fingerprint")
View Source
var ErrExtractorCacheMiss = errors.New("extractor cache miss")
View Source
var ErrRunNotFound = errors.New("ingestion run not found")

Functions

func BuildChunks

func BuildChunks(relativePath string, content []byte, options SafetyOptions) (ChunkSet, SafetyResult, error)

func BuildChunksFromReader added in v0.1.10

func BuildChunksFromReader(relativePath string, reader io.Reader, sizeBytes int64, options SafetyOptions) (ChunkSet, SafetyResult, error)

func EligibleContentSHA256

func EligibleContentSHA256(result SafetyResult, content []byte) (string, error)

func NormalizeFileExtension

func NormalizeFileExtension(raw string) (string, error)

func NormalizePathPrefix

func NormalizePathPrefix(raw string) (string, error)

func ValidateDefaultExtractorRegistry

func ValidateDefaultExtractorRegistry() error

Types

type API

type API interface {
	IngestProject(context.Context, string, Trigger) (Run, error)
	IngestPath(context.Context, string, string, Trigger) (Run, error)
	SubmitIngestProject(context.Context, string, Trigger) (Run, error)
	SubmitRebuildSearchIndex(context.Context, string) (Run, error)
	RebuildSearchIndex(context.Context, string) (Run, error)
	RunMetadata(context.Context, string, string) (RunMetadata, error)
	LatestRunMetadata(context.Context, string) (RunMetadata, error)
	EligibleFileCount(context.Context, string) (int, error)
	IndexedSymbolCount(context.Context, string) (int, error)
	IndexedChunkCount(context.Context, string) (int, error)
	ListFiles(context.Context, string, FileStateFilter, Pagination) (FileList, error)
	GetFile(context.Context, string, string) (FileMetadata, error)
	ListChunks(context.Context, string, string, Pagination, int) (ChunkList, error)
	GetChunk(context.Context, string, string, string, int) (ChunkMetadata, error)
	ListSymbols(context.Context, string, SymbolFilter, Pagination) (SymbolList, error)
	SearchText(context.Context, string, TextSearchOptions) (TextSearchResultList, error)
	SearchFiles(context.Context, string, FileSearchOptions) (FileList, error)
	SearchIndexHealth(context.Context, string) (SearchIndexHealth, error)
	SearchSymbols(context.Context, string, SymbolFilter, Pagination) (SymbolList, error)
	SearchReferences(context.Context, string, ReferenceSearchOptions) (SymbolReferenceList, error)
	SearchCalls(context.Context, string, ReferenceSearchOptions) (SymbolCallEdgeList, error)
	ListASTQueries(context.Context, string) (ASTQueryCatalog, error)
	SearchAST(context.Context, string, ASTSearchOptions) (ASTSearchResultList, error)
	GetSymbol(context.Context, string, string) (SymbolMetadata, error)
	GetSymbolSource(context.Context, string, string, SymbolSourceOptions) (SymbolSource, error)
	ListSymbolReferences(context.Context, string, string, Pagination) (SymbolReferenceList, error)
	ListSymbolCallers(context.Context, string, string, Pagination) (SymbolCallEdgeList, error)
	ListSymbolCallees(context.Context, string, string, Pagination) (SymbolCallEdgeList, error)
	ListSymbolImplementers(context.Context, string, string, Pagination) (SymbolImplementationList, error)
	GetSymbolCallGraph(context.Context, string, string, CallGraphOptions) (SymbolCallGraph, error)
	ListHeadings(context.Context, string, string, Pagination) (HeadingList, error)
	GetFileOutline(context.Context, string, string, FileOutlineOptions) (FileOutline, error)
}

type ASTCoverageMetadata

type ASTCoverageMetadata struct {
	Language             string   `json:"language"`
	Extensions           []string `json:"extensions"`
	CoverageScope        string   `json:"coverage_scope"`
	EligibleFiles        int      `json:"eligible_files"`
	SkippedFileTooLarge  int      `json:"skipped_file_too_large"`
	CoverageStatus       string   `json:"coverage_status"`
	CoveragePartialCause string   `json:"coverage_partial_cause,omitempty"`
}

type ASTQueryCatalog

type ASTQueryCatalog struct {
	Queries  []ASTQueryMetadata    `json:"queries"`
	Coverage []ASTCoverageMetadata `json:"coverage,omitempty"`
	Index    *SearchIndexMetadata  `json:"index,omitempty"`
}

type ASTQueryMetadata

type ASTQueryMetadata struct {
	ID         string   `json:"id"`
	Language   string   `json:"language"`
	Version    string   `json:"version"`
	Captures   []string `json:"captures"`
	Extensions []string `json:"extensions"`
}

type ASTSearchOptions

type ASTSearchOptions struct {
	Language        string
	Query           string
	Captures        []string
	Extension       string
	PathPrefix      string
	PageSize        int
	PageToken       string
	MaxMatches      int
	MaxSnippetBytes int
}

func NormalizeASTSearchOptions

func NormalizeASTSearchOptions(options ASTSearchOptions) (ASTSearchOptions, error)

type ASTSearchResult

type ASTSearchResult struct {
	File                 FileMetadata  `json:"file"`
	Chunk                ChunkMetadata `json:"chunk"`
	CaptureName          string        `json:"capture_name"`
	CaptureText          string        `json:"capture_text,omitempty"`
	CaptureTextTruncated bool          `json:"capture_text_truncated,omitempty"`
	LineStart            int           `json:"line_start"`
	LineEnd              int           `json:"line_end"`
	ByteStart            int           `json:"byte_start"`
	ByteEnd              int           `json:"byte_end"`
	StartColumn          int           `json:"start_column,omitempty"`
	EndColumn            int           `json:"end_column,omitempty"`
	Snippet              string        `json:"snippet,omitempty"`
	SnippetTruncated     bool          `json:"snippet_truncated,omitempty"`
}

type ASTSearchResultList

type ASTSearchResultList struct {
	Results         []ASTSearchResult    `json:"results"`
	NextPageToken   string               `json:"next_page_token,omitempty"`
	QueryLanguage   string               `json:"query_language"`
	QueryVersion    string               `json:"query_version"`
	ResultTruncated bool                 `json:"result_truncated"`
	MaxSnippetBytes int                  `json:"max_snippet_bytes"`
	Coverage        *ASTCoverageMetadata `json:"coverage,omitempty"`
	Index           *SearchIndexMetadata `json:"index,omitempty"`
}

type Call

type Call struct {
	CallerName       string
	CalleeName       string
	Receiver         string
	ImportPath       string
	StartLine        int
	EndLine          int
	StartByte        int
	EndByte          int
	StartColumn      int
	EndColumn        int
	ResolutionStatus string
	Confidence       string
}

type CallGraphOptions

type CallGraphOptions struct {
	Direction string
	MaxDepth  int
	MaxNodes  int
}

type Chunk

type Chunk struct {
	ID            string
	FileID        string
	Index         int
	RelativePath  string
	StartLine     int
	EndLine       int
	ByteStart     int
	ByteEnd       int
	Text          string
	ContentSHA256 string
}

type ChunkList

type ChunkList struct {
	Chunks        []ChunkMetadata `json:"chunks"`
	NextPageToken string          `json:"next_page_token,omitempty"`
}

type ChunkMetadata

type ChunkMetadata struct {
	ID            string `json:"id"`
	FileID        string `json:"file_id"`
	ProjectID     string `json:"project_id"`
	Index         int    `json:"index"`
	StartLine     int    `json:"start_line"`
	EndLine       int    `json:"end_line"`
	ByteStart     int    `json:"byte_start"`
	ByteEnd       int    `json:"byte_end"`
	Text          string `json:"text"`
	TextTruncated bool   `json:"text_truncated"`
}

type ChunkSet

type ChunkSet struct {
	RelativePath  string
	ContentSHA256 string
	Chunks        []Chunk
}

type DiagnosticsSnapshot

type DiagnosticsSnapshot struct {
	Scheduler     SchedulerDiagnostics                     `json:"scheduler"`
	Watchers      []WatchState                             `json:"watchers"`
	Stages        map[string]StageDiagnostic               `json:"stages"`
	GraphStorage  []projectregistry.GraphStorageDiagnostic `json:"graph_storage,omitempty"`
	SearchStorage []SearchStorageDiagnostic                `json:"search_storage,omitempty"`
}

type DiagnosticsSource

type DiagnosticsSource struct {
	Scheduler    *Scheduler
	Orchestrator *Orchestrator
	Service      *Service
	GraphStorage interface {
		GraphStorageDiagnostics() []projectregistry.GraphStorageDiagnostic
	}
	SearchStorage interface {
		SearchStorageDiagnostics() []SearchStorageDiagnostic
	}
}

func (DiagnosticsSource) IngestionDiagnostics

func (source DiagnosticsSource) IngestionDiagnostics() DiagnosticsSnapshot

type Extractor

type Extractor interface {
	Name() string
	Version() string
	Supports(relative string) bool
	Validate() error
	Parse(ctx context.Context, relative string, content []byte) (ExtractorResult, error)
}

type ExtractorCacheEntry

type ExtractorCacheEntry struct {
	ProjectID            string
	RelativePathHash     string
	ContentSHA256        string
	ExtractorName        string
	ExtractorVersion     string
	ExtractorFingerprint string
	Symbols              []Symbol
	Headings             []Heading
	References           []Reference
	Calls                []Call
	Implementations      []Implementation
	CreatedAt            time.Time
	UpdatedAt            time.Time
}

type ExtractorFingerprintProvider added in v0.1.10

type ExtractorFingerprintProvider interface {
	Fingerprint() string
}

type ExtractorName

type ExtractorName string
const (
	ExtractorGoStdlibAST      ExtractorName = "go-stdlib-ast"
	ExtractorMarkdownHeading  ExtractorName = "markdown-heading"
	ExtractorInfraLightweight ExtractorName = "infra-lightweight"
)
const (
	ExtractorTreeSitterJavaScript ExtractorName = "treesitter-javascript"
	ExtractorTreeSitterTypeScript ExtractorName = "treesitter-typescript"
	ExtractorTreeSitterTSX        ExtractorName = "treesitter-tsx"
	ExtractorTreeSitterCSharp     ExtractorName = "treesitter-csharp"
	ExtractorTreeSitterPython     ExtractorName = "treesitter-python"
	ExtractorTreeSitterDart       ExtractorName = "treesitter-dart"
)

type ExtractorRegistry

type ExtractorRegistry struct {
	// contains filtered or unexported fields
}

func NewDefaultExtractorRegistry

func NewDefaultExtractorRegistry() *ExtractorRegistry

func NewExtractorRegistry

func NewExtractorRegistry(extractors ...Extractor) *ExtractorRegistry

func (*ExtractorRegistry) Extract

func (registry *ExtractorRegistry) Extract(ctx context.Context, relative string, content []byte) (ExtractorResult, error)

func (*ExtractorRegistry) ExtractorFor

func (registry *ExtractorRegistry) ExtractorFor(relative string) Extractor

func (*ExtractorRegistry) Validate

func (registry *ExtractorRegistry) Validate() error

type ExtractorResult

type ExtractorResult struct {
	ExtractorName    string
	ExtractorVersion string
	Symbols          []Symbol
	Headings         []Heading
	References       []Reference
	Calls            []Call
	Implementations  []Implementation
}

func ParseGoFileSemantic

func ParseGoFileSemantic(relativePath string, source []byte) (ExtractorResult, error)

type FileList

type FileList struct {
	Files         []FileMetadata       `json:"files"`
	NextPageToken string               `json:"next_page_token,omitempty"`
	Index         *SearchIndexMetadata `json:"index,omitempty"`
}

type FileMetadata

type FileMetadata struct {
	ID             string    `json:"id"`
	ProjectID      string    `json:"project_id"`
	RelativePath   string    `json:"relative_path,omitempty"`
	Extension      string    `json:"extension,omitempty"`
	Status         string    `json:"status"`
	Present        bool      `json:"present"`
	SizeBytes      int64     `json:"size_bytes"`
	ModifiedAt     time.Time `json:"modified_at"`
	SkippedReason  string    `json:"skipped_reason,omitempty"`
	RelativePathOK bool      `json:"relative_path_safe"`
}

func MetadataForFileState

func MetadataForFileState(project projectregistry.Project, state FileState) FileMetadata

type FileOutline

type FileOutline struct {
	File                 FileMetadata           `json:"file"`
	Headings             []HeadingMetadata      `json:"headings,omitempty"`
	Symbols              []SymbolMetadata       `json:"symbols,omitempty"`
	SymbolsNextPageToken string                 `json:"symbols_next_page_token,omitempty"`
	Chunks               []OutlineChunkMetadata `json:"chunks,omitempty"`
}

type FileOutlineOptions

type FileOutlineOptions struct {
	SymbolFilter     SymbolFilter
	SymbolPagination Pagination
	IncludeChunkText bool
	MaxChunkBytes    int
}

type FileSearchOptions

type FileSearchOptions struct {
	Extension     string
	PathPrefix    string
	PathContains  string
	CaseSensitive bool
	PageSize      int
	PageToken     string
}

func NormalizeFileSearchOptions

func NormalizeFileSearchOptions(options FileSearchOptions) (FileSearchOptions, error)

type FileState

type FileState struct {
	ProjectID        string
	RelativePathHash string
	RelativePath     string
	RelativePathSafe bool
	Status           FileStatus
	Present          bool
	ContentSHA256    string
	SizeBytes        int64
	ModifiedAt       time.Time
	LastEventAt      time.Time
	LastIngestedAt   time.Time
	SkippedReason    SkipReason
}

type FileStateFilter

type FileStateFilter struct {
	Status        FileStatus
	Extension     string
	PathPrefix    string
	SkippedReason SkipReason
	Present       *bool
	ModifiedSince time.Time
}

type FileStatus

type FileStatus string
const (
	FileStatusEligible FileStatus = "eligible"
	FileStatusSkipped  FileStatus = "skipped"
	FileStatusAbsent   FileStatus = "absent"
)

type FileWatcher

type FileWatcher interface {
	Add(path string) error
	Close() error
	Events() <-chan WatchEvent
	Errors() <-chan error
}

func NewFSNotifyWatcher

func NewFSNotifyWatcher() (FileWatcher, error)

type Finding

type Finding struct {
	Code     SkipReason
	Category string
}

type GraphStore

type GraphStore struct {
	// contains filtered or unexported fields
}

func NewGraphStore

func NewGraphStore(graph graphBackend) *GraphStore

func (*GraphStore) CountGraphChunks added in v0.1.6

func (store *GraphStore) CountGraphChunks(ctx context.Context, project projectregistry.Project) (int, error)

func (*GraphStore) CountGraphSymbols added in v0.1.6

func (store *GraphStore) CountGraphSymbols(ctx context.Context, project projectregistry.Project) (int, error)

func (*GraphStore) GetChunk

func (store *GraphStore) GetChunk(ctx context.Context, project projectregistry.Project, fileID string, chunkID string, maxChunkBytes int) (ChunkMetadata, error)

func (*GraphStore) GetFile

func (store *GraphStore) GetFile(ctx context.Context, project projectregistry.Project, fileID string) (FileMetadata, error)

func (*GraphStore) GetFileOutline

func (store *GraphStore) GetFileOutline(ctx context.Context, project projectregistry.Project, fileID string, options FileOutlineOptions) (FileOutline, error)

func (*GraphStore) GetSymbol

func (store *GraphStore) GetSymbol(ctx context.Context, project projectregistry.Project, symbolID string) (SymbolMetadata, error)

func (*GraphStore) GetSymbolCallGraph

func (store *GraphStore) GetSymbolCallGraph(ctx context.Context, project projectregistry.Project, symbolID string, options CallGraphOptions) (SymbolCallGraph, error)

func (*GraphStore) GetSymbolSource

func (store *GraphStore) GetSymbolSource(ctx context.Context, project projectregistry.Project, symbolID string, maxSourceBytes int) (SymbolSource, error)

func (*GraphStore) HasFileVersion

func (store *GraphStore) HasFileVersion(ctx context.Context, project projectregistry.Project, state FileState) (bool, error)

func (*GraphStore) ListChunks

func (store *GraphStore) ListChunks(ctx context.Context, project projectregistry.Project, fileID string, pagination Pagination, maxChunkBytes int) (ChunkList, error)

func (*GraphStore) ListHeadings

func (store *GraphStore) ListHeadings(ctx context.Context, project projectregistry.Project, fileID string, pagination Pagination) (HeadingList, error)

func (*GraphStore) ListSymbolCallees

func (store *GraphStore) ListSymbolCallees(ctx context.Context, project projectregistry.Project, symbolID string, pagination Pagination) (SymbolCallEdgeList, error)

func (*GraphStore) ListSymbolCallers

func (store *GraphStore) ListSymbolCallers(ctx context.Context, project projectregistry.Project, symbolID string, pagination Pagination) (SymbolCallEdgeList, error)

func (*GraphStore) ListSymbolImplementers added in v0.1.1

func (store *GraphStore) ListSymbolImplementers(ctx context.Context, project projectregistry.Project, symbolID string, pagination Pagination) (SymbolImplementationList, error)

func (*GraphStore) ListSymbolReferences

func (store *GraphStore) ListSymbolReferences(ctx context.Context, project projectregistry.Project, symbolID string, pagination Pagination) (SymbolReferenceList, error)

func (*GraphStore) ListSymbols

func (store *GraphStore) ListSymbols(ctx context.Context, project projectregistry.Project, filter SymbolFilter, pagination Pagination) (SymbolList, error)

func (*GraphStore) PutEligibleFile

func (store *GraphStore) PutEligibleFile(ctx context.Context, project projectregistry.Project, run Run, state FileState, chunks []Chunk, symbols []Symbol, references []Reference, calls []Call, implementations []Implementation, headings []Heading) error

func (*GraphStore) PutFileState

func (store *GraphStore) PutFileState(ctx context.Context, project projectregistry.Project, run Run, state FileState) error

func (*GraphStore) PutPreparedFilesBatch

func (store *GraphStore) PutPreparedFilesBatch(ctx context.Context, project projectregistry.Project, run Run, files any) error

func (*GraphStore) PutRun

func (store *GraphStore) PutRun(ctx context.Context, project projectregistry.Project, run Run) error

func (*GraphStore) PutSkippedFile

func (store *GraphStore) PutSkippedFile(ctx context.Context, project projectregistry.Project, run Run, state FileState) error

func (*GraphStore) PutUnchangedFile

func (store *GraphStore) PutUnchangedFile(ctx context.Context, project projectregistry.Project, run Run, state FileState) error

func (*GraphStore) SearchCalls

func (store *GraphStore) SearchCalls(ctx context.Context, project projectregistry.Project, options ReferenceSearchOptions) (SymbolCallEdgeList, error)

func (*GraphStore) SearchReferences

func (store *GraphStore) SearchReferences(ctx context.Context, project projectregistry.Project, options ReferenceSearchOptions) (SymbolReferenceList, error)

func (*GraphStore) SearchText

func (store *GraphStore) SearchText(ctx context.Context, project projectregistry.Project, options TextSearchOptions) (TextSearchResultList, error)

func (*GraphStore) WithBatch

func (store *GraphStore) WithBatch(ctx context.Context, fn func(*GraphStore) error) error

type Heading

type Heading struct {
	Level       int
	Text        string
	ParentIndex int
	StartLine   int
	EndLine     int
}

func ParseMarkdownHeadings

func ParseMarkdownHeadings(source []byte) ([]Heading, error)

type HeadingList

type HeadingList struct {
	Headings      []HeadingMetadata `json:"headings"`
	NextPageToken string            `json:"next_page_token,omitempty"`
}

type HeadingMetadata

type HeadingMetadata struct {
	ID          string `json:"id"`
	FileID      string `json:"file_id"`
	ProjectID   string `json:"project_id"`
	Level       int    `json:"level"`
	Text        string `json:"text"`
	ParentIndex int    `json:"parent_index"`
	StartLine   int    `json:"start_line"`
	EndLine     int    `json:"end_line"`
}

type Implementation added in v0.1.1

type Implementation struct {
	Kind             string
	ImplementerName  string
	ImplementedName  string
	PackageName      string
	Receiver         string
	ImportPath       string
	StartLine        int
	EndLine          int
	StartByte        int
	EndByte          int
	StartColumn      int
	EndColumn        int
	ResolutionStatus string
	Confidence       string
}

type Orchestrator

type Orchestrator struct {
	// contains filtered or unexported fields
}

func NewOrchestrator

func NewOrchestrator(registry *projectregistry.Registry, ingestion ingestionRunner, options OrchestratorOptions) *Orchestrator

func (*Orchestrator) SetWatcherFactory

func (orchestrator *Orchestrator) SetWatcherFactory(factory WatcherFactory)

func (*Orchestrator) Start

func (orchestrator *Orchestrator) Start(ctx context.Context) error

func (*Orchestrator) Stop

func (orchestrator *Orchestrator) Stop(ctx context.Context) error

func (*Orchestrator) WatchStates

func (orchestrator *Orchestrator) WatchStates() []WatchState

type OrchestratorOptions

type OrchestratorOptions struct {
	LiveUpdatesEnabled       bool
	DebounceInterval         time.Duration
	QueueDepth               int
	WorkerCount              int
	GlobalWorkerCount        int
	PerProjectWorkerLimit    int
	LivePathPriority         bool
	InitialScanOnStart       bool
	MaxWatchedDirectoryCount int
	TaskWarnAfter            time.Duration
	Logger                   *slog.Logger
}

type OutlineChunkMetadata

type OutlineChunkMetadata struct {
	ID            string `json:"id"`
	FileID        string `json:"file_id"`
	ProjectID     string `json:"project_id"`
	Index         int    `json:"index"`
	StartLine     int    `json:"start_line"`
	EndLine       int    `json:"end_line"`
	ByteStart     int    `json:"byte_start"`
	ByteEnd       int    `json:"byte_end"`
	Text          string `json:"text,omitempty"`
	TextTruncated bool   `json:"text_truncated,omitempty"`
}

type Pagination

type Pagination struct {
	PageSize  int
	PageToken string
}

type PreparedGraphFile

type PreparedGraphFile struct {
	State           FileState
	Unchanged       bool
	Chunks          []Chunk
	Symbols         []Symbol
	References      []Reference
	Calls           []Call
	Implementations []Implementation
	Headings        []Heading
}

type PreparedSearchFile

type PreparedSearchFile struct {
	State      FileState
	Chunks     []Chunk
	Symbols    []Symbol
	References []Reference
	Calls      []Call
}

type Reference

type Reference struct {
	Kind                string
	Name                string
	TargetName          string
	PackageName         string
	Receiver            string
	ImportPath          string
	EnclosingSymbolName string
	StartLine           int
	EndLine             int
	StartByte           int
	EndByte             int
	StartColumn         int
	EndColumn           int
	ResolutionStatus    string
	Confidence          string
}

type ReferenceSearchOptions

type ReferenceSearchOptions struct {
	NameContains       string
	TargetNameContains string
	CallerNameContains string
	CalleeNameContains string
	EnclosingContains  string
	Extension          string
	PathPrefix         string
	ResolutionStatus   string
	Confidence         string
	CaseSensitive      bool
	PageSize           int
	PageToken          string
}

func NormalizeReferenceSearchOptions

func NormalizeReferenceSearchOptions(options ReferenceSearchOptions) (ReferenceSearchOptions, error)

type Run

type Run struct {
	ID             string
	ProjectID      string
	Trigger        Trigger
	RunKind        RunKind
	Mode           string
	Status         RunStatus
	FilesSeen      int
	FilesIngested  int
	FilesSkipped   int
	FilesUnchanged int
	ChunksStored   int
	SymbolsStored  int
	ErrorCategory  string
	ReasonCounts   map[string]int
	CurrentPhase   string
	StartedAt      time.Time
	FinishedAt     time.Time
	HeartbeatAt    time.Time
	LastProgressAt time.Time
}

type RunKind added in v0.1.1

type RunKind string
const (
	RunKindFullScan           RunKind = "full_scan"
	RunKindDelta              RunKind = "delta"
	RunKindSearchIndexRebuild RunKind = "search_index_rebuild"
)

type RunMetadata

type RunMetadata struct {
	ID             string         `json:"id"`
	ProjectID      string         `json:"project_id"`
	Trigger        string         `json:"trigger"`
	RunKind        string         `json:"run_kind,omitempty"`
	Mode           string         `json:"mode"`
	Status         string         `json:"status"`
	FilesSeen      int            `json:"files_seen"`
	FilesIngested  int            `json:"files_ingested"`
	FilesSkipped   int            `json:"files_skipped"`
	FilesUnchanged int            `json:"files_unchanged"`
	ChunksStored   int            `json:"chunks_stored"`
	SymbolsStored  int            `json:"symbols_stored"`
	ErrorCategory  string         `json:"error_category,omitempty"`
	ReasonCounts   map[string]int `json:"reason_counts,omitempty"`
	CurrentPhase   string         `json:"current_phase,omitempty"`
	StartedAt      time.Time      `json:"started_at"`
	FinishedAt     time.Time      `json:"finished_at"`
	HeartbeatAt    time.Time      `json:"heartbeat_at,omitempty"`
	LastProgressAt time.Time      `json:"last_progress_at,omitempty"`
}

func MetadataForRun

func MetadataForRun(run Run) RunMetadata

type RunStatus

type RunStatus string
const (
	RunStatusPending   RunStatus = "pending"
	RunStatusRunning   RunStatus = "running"
	RunStatusCompleted RunStatus = "completed"
	RunStatusFailed    RunStatus = "failed"
)

type SQLiteStore

type SQLiteStore struct {
	// contains filtered or unexported fields
}

func NewSQLiteStore

func NewSQLiteStore(db *sql.DB) *SQLiteStore

func (*SQLiteStore) ApplySearchFileBatch

func (store *SQLiteStore) ApplySearchFileBatch(ctx context.Context, project projectregistry.Project, results []fullScanFileResult) error

func (*SQLiteStore) ClearSearchIndexDegraded

func (store *SQLiteStore) ClearSearchIndexDegraded(ctx context.Context, projectID string) error

func (*SQLiteStore) ContextSearchIndexHealth added in v0.1.1

func (store *SQLiteStore) ContextSearchIndexHealth(ctx context.Context, project projectregistry.Project) (SearchIndexHealth, error)

func (*SQLiteStore) CountFileStates added in v0.1.1

func (store *SQLiteStore) CountFileStates(ctx context.Context, projectID string, filter FileStateFilter) (int, error)

func (*SQLiteStore) CountSearchChunks added in v0.1.1

func (store *SQLiteStore) CountSearchChunks(ctx context.Context, project projectregistry.Project) (int, error)

func (*SQLiteStore) CountSearchSymbols added in v0.1.1

func (store *SQLiteStore) CountSearchSymbols(ctx context.Context, project projectregistry.Project) (int, error)

func (*SQLiteStore) DeleteExtractorCacheForFile

func (store *SQLiteStore) DeleteExtractorCacheForFile(ctx context.Context, projectID string, relativePathHash string) error

func (*SQLiteStore) DeleteSearchFile

func (store *SQLiteStore) DeleteSearchFile(ctx context.Context, projectID string, fileID string) error

func (*SQLiteStore) DeleteSearchProject

func (store *SQLiteStore) DeleteSearchProject(ctx context.Context, projectID string) error

func (*SQLiteStore) FailActiveRuns

func (store *SQLiteStore) FailActiveRuns(ctx context.Context, projectID string, errorCategory string, finishedAt time.Time) (int, error)

func (*SQLiteStore) GetExtractorCache

func (store *SQLiteStore) GetExtractorCache(ctx context.Context, projectID string, relativePathHash string, contentSHA256 string, extractorName string, extractorVersion string) (ExtractorCacheEntry, error)

func (*SQLiteStore) GetExtractorCacheWithFingerprint added in v0.1.10

func (store *SQLiteStore) GetExtractorCacheWithFingerprint(ctx context.Context, projectID string, relativePathHash string, contentSHA256 string, extractorName string, extractorVersion string, extractorFingerprint string) (ExtractorCacheEntry, error)

func (*SQLiteStore) GetFileStateByHash

func (store *SQLiteStore) GetFileStateByHash(ctx context.Context, projectID string, relativePathHash string) (FileState, error)

func (*SQLiteStore) GetRun

func (store *SQLiteStore) GetRun(ctx context.Context, projectID string, runID string) (Run, error)

func (*SQLiteStore) HasSearchFileVersion

func (store *SQLiteStore) HasSearchFileVersion(ctx context.Context, project projectregistry.Project, state FileState) (bool, error)

func (*SQLiteStore) ListActiveRuns

func (store *SQLiteStore) ListActiveRuns(ctx context.Context, projectID string) ([]Run, error)

func (*SQLiteStore) ListFileStates

func (store *SQLiteStore) ListFileStates(ctx context.Context, projectID string, filter FileStateFilter) ([]FileState, error)

func (*SQLiteStore) ListFileStatesPage

func (store *SQLiteStore) ListFileStatesPage(ctx context.Context, projectID string, filter FileStateFilter, pagination Pagination) ([]FileState, string, error)

func (*SQLiteStore) ListLatestRuns

func (store *SQLiteStore) ListLatestRuns(ctx context.Context, projectID string, limit int) ([]Run, error)

func (*SQLiteStore) MarkSearchIndexDegraded

func (store *SQLiteStore) MarkSearchIndexDegraded(ctx context.Context, projectID string, reason string) error

func (*SQLiteStore) ReconcileSearchIndex

func (store *SQLiteStore) ReconcileSearchIndex(ctx context.Context, project projectregistry.Project) ([]FileState, error)

func (*SQLiteStore) SaveExtractorCache

func (store *SQLiteStore) SaveExtractorCache(ctx context.Context, entry ExtractorCacheEntry) error

func (*SQLiteStore) SaveFileState

func (store *SQLiteStore) SaveFileState(ctx context.Context, state FileState) error

func (*SQLiteStore) SaveFileStatesBatch

func (store *SQLiteStore) SaveFileStatesBatch(ctx context.Context, states []FileState) error

func (*SQLiteStore) SaveRun

func (store *SQLiteStore) SaveRun(ctx context.Context, run Run) error

func (*SQLiteStore) SearchCalls

func (*SQLiteStore) SearchFiles

func (store *SQLiteStore) SearchFiles(ctx context.Context, project projectregistry.Project, options FileSearchOptions) (FileList, error)

func (*SQLiteStore) SearchIndexHealth

func (store *SQLiteStore) SearchIndexHealth(ctx context.Context, project projectregistry.Project) (SearchIndexHealth, error)

func (*SQLiteStore) SearchReferences

func (store *SQLiteStore) SearchReferences(ctx context.Context, project projectregistry.Project, options ReferenceSearchOptions) (SymbolReferenceList, error)

func (*SQLiteStore) SearchSymbols

func (store *SQLiteStore) SearchSymbols(ctx context.Context, project projectregistry.Project, filter SymbolFilter, pagination Pagination) (SymbolList, error)

func (*SQLiteStore) SearchText

func (store *SQLiteStore) SearchText(ctx context.Context, project projectregistry.Project, options TextSearchOptions) (TextSearchResultList, error)

func (*SQLiteStore) SearchWriteDiagnostics added in v0.1.5

func (store *SQLiteStore) SearchWriteDiagnostics(projectID string) SearchWriteDiagnostic

func (*SQLiteStore) SetSearchStateStore added in v0.1.3

func (store *SQLiteStore) SetSearchStateStore(state searchStateStore)

func (*SQLiteStore) UpdateSearchFileMetadata

func (store *SQLiteStore) UpdateSearchFileMetadata(ctx context.Context, project projectregistry.Project, state FileState) error

func (*SQLiteStore) UpdateSearchFileMetadataBatch

func (store *SQLiteStore) UpdateSearchFileMetadataBatch(ctx context.Context, project projectregistry.Project, states []FileState) error

func (*SQLiteStore) UpsertSearchFile

func (store *SQLiteStore) UpsertSearchFile(ctx context.Context, project projectregistry.Project, state FileState, chunks []Chunk, symbols []Symbol, references []Reference, calls []Call) error

func (*SQLiteStore) UpsertSearchFilesBatch

func (store *SQLiteStore) UpsertSearchFilesBatch(ctx context.Context, project projectregistry.Project, files []PreparedSearchFile) error

type SafetyOptions

type SafetyOptions struct {
	MaxFileBytes          int64
	MaxChunkBytes         int
	SensitiveMarkerPolicy string
}

func DefaultSafetyOptions

func DefaultSafetyOptions() SafetyOptions

type SafetyResult

type SafetyResult struct {
	Eligible         bool
	RelativePath     string
	RelativePathSafe bool
	Reason           SkipReason
	SizeBytes        int64
}

func EvaluateSafety

func EvaluateSafety(relativePath string, content []byte, options SafetyOptions) SafetyResult

func EvaluateWorkspaceSafety added in v0.1.13

func EvaluateWorkspaceSafety(relativePath string, content []byte, options WorkspaceSafetyOptions) SafetyResult

type Scheduler

type Scheduler struct {
	// contains filtered or unexported fields
}

func NewScheduler

func NewScheduler(runner ingestionRunner, options SchedulerOptions) *Scheduler

func (*Scheduler) ContextSearchIndexHealth added in v0.1.1

func (scheduler *Scheduler) ContextSearchIndexHealth(ctx context.Context, projectID string) (SearchIndexHealth, error)

func (*Scheduler) Diagnostics

func (scheduler *Scheduler) Diagnostics() SchedulerDiagnostics

func (*Scheduler) EligibleFileCount added in v0.1.6

func (scheduler *Scheduler) EligibleFileCount(ctx context.Context, projectID string) (int, error)

func (*Scheduler) GetChunk

func (scheduler *Scheduler) GetChunk(ctx context.Context, projectID string, fileID string, chunkID string, maxChunkBytes int) (ChunkMetadata, error)

func (*Scheduler) GetFile

func (scheduler *Scheduler) GetFile(ctx context.Context, projectID string, fileID string) (FileMetadata, error)

func (*Scheduler) GetFileOutline

func (scheduler *Scheduler) GetFileOutline(ctx context.Context, projectID string, fileID string, options FileOutlineOptions) (FileOutline, error)

func (*Scheduler) GetSymbol

func (scheduler *Scheduler) GetSymbol(ctx context.Context, projectID string, symbolID string) (SymbolMetadata, error)

func (*Scheduler) GetSymbolCallGraph

func (scheduler *Scheduler) GetSymbolCallGraph(ctx context.Context, projectID string, symbolID string, options CallGraphOptions) (SymbolCallGraph, error)

func (*Scheduler) GetSymbolSource

func (scheduler *Scheduler) GetSymbolSource(ctx context.Context, projectID string, symbolID string, options SymbolSourceOptions) (SymbolSource, error)

func (*Scheduler) IndexedChunkCount added in v0.1.6

func (scheduler *Scheduler) IndexedChunkCount(ctx context.Context, projectID string) (int, error)

func (*Scheduler) IndexedSymbolCount added in v0.1.6

func (scheduler *Scheduler) IndexedSymbolCount(ctx context.Context, projectID string) (int, error)

func (*Scheduler) IngestPath

func (scheduler *Scheduler) IngestPath(ctx context.Context, projectID string, relativePath string, trigger Trigger) (Run, error)

func (*Scheduler) IngestProject

func (scheduler *Scheduler) IngestProject(ctx context.Context, projectID string, trigger Trigger) (Run, error)

func (*Scheduler) LatestRunMetadata

func (scheduler *Scheduler) LatestRunMetadata(ctx context.Context, projectID string) (RunMetadata, error)

func (*Scheduler) ListASTQueries

func (scheduler *Scheduler) ListASTQueries(ctx context.Context, projectID string) (ASTQueryCatalog, error)

func (*Scheduler) ListChunks

func (scheduler *Scheduler) ListChunks(ctx context.Context, projectID string, fileID string, pagination Pagination, maxChunkBytes int) (ChunkList, error)

func (*Scheduler) ListFiles

func (scheduler *Scheduler) ListFiles(ctx context.Context, projectID string, filter FileStateFilter, pagination Pagination) (FileList, error)

func (*Scheduler) ListHeadings

func (scheduler *Scheduler) ListHeadings(ctx context.Context, projectID string, fileID string, pagination Pagination) (HeadingList, error)

func (*Scheduler) ListSymbolCallees

func (scheduler *Scheduler) ListSymbolCallees(ctx context.Context, projectID string, symbolID string, pagination Pagination) (SymbolCallEdgeList, error)

func (*Scheduler) ListSymbolCallers

func (scheduler *Scheduler) ListSymbolCallers(ctx context.Context, projectID string, symbolID string, pagination Pagination) (SymbolCallEdgeList, error)

func (*Scheduler) ListSymbolImplementers added in v0.1.1

func (scheduler *Scheduler) ListSymbolImplementers(ctx context.Context, projectID string, symbolID string, pagination Pagination) (SymbolImplementationList, error)

func (*Scheduler) ListSymbolReferences

func (scheduler *Scheduler) ListSymbolReferences(ctx context.Context, projectID string, symbolID string, pagination Pagination) (SymbolReferenceList, error)

func (*Scheduler) ListSymbols

func (scheduler *Scheduler) ListSymbols(ctx context.Context, projectID string, filter SymbolFilter, pagination Pagination) (SymbolList, error)

func (*Scheduler) RebuildSearchIndex

func (scheduler *Scheduler) RebuildSearchIndex(ctx context.Context, projectID string) (Run, error)

func (*Scheduler) RunMetadata

func (scheduler *Scheduler) RunMetadata(ctx context.Context, projectID string, runID string) (RunMetadata, error)

func (*Scheduler) SearchAST

func (scheduler *Scheduler) SearchAST(ctx context.Context, projectID string, options ASTSearchOptions) (ASTSearchResultList, error)

func (*Scheduler) SearchCalls

func (scheduler *Scheduler) SearchCalls(ctx context.Context, projectID string, options ReferenceSearchOptions) (SymbolCallEdgeList, error)

func (*Scheduler) SearchFiles

func (scheduler *Scheduler) SearchFiles(ctx context.Context, projectID string, options FileSearchOptions) (FileList, error)

func (*Scheduler) SearchIndexHealth added in v0.1.1

func (scheduler *Scheduler) SearchIndexHealth(ctx context.Context, projectID string) (SearchIndexHealth, error)

func (*Scheduler) SearchReferences

func (scheduler *Scheduler) SearchReferences(ctx context.Context, projectID string, options ReferenceSearchOptions) (SymbolReferenceList, error)

func (*Scheduler) SearchSymbols

func (scheduler *Scheduler) SearchSymbols(ctx context.Context, projectID string, filter SymbolFilter, pagination Pagination) (SymbolList, error)

func (*Scheduler) SearchText

func (scheduler *Scheduler) SearchText(ctx context.Context, projectID string, options TextSearchOptions) (TextSearchResultList, error)

func (*Scheduler) Start

func (scheduler *Scheduler) Start(ctx context.Context) error

func (*Scheduler) Stop

func (scheduler *Scheduler) Stop(ctx context.Context) error

func (*Scheduler) SubmitFullScan

func (scheduler *Scheduler) SubmitFullScan(ctx context.Context, projectID string, trigger Trigger) (Run, error)

func (*Scheduler) SubmitFullScanAsync

func (scheduler *Scheduler) SubmitFullScanAsync(ctx context.Context, projectID string, trigger Trigger) (Run, error)

func (*Scheduler) SubmitIngestProject

func (scheduler *Scheduler) SubmitIngestProject(ctx context.Context, projectID string, trigger Trigger) (Run, error)

func (*Scheduler) SubmitPath

func (scheduler *Scheduler) SubmitPath(ctx context.Context, projectID string, relativePath string, trigger Trigger) (Run, error)

func (*Scheduler) SubmitRebuildSearchIndex

func (scheduler *Scheduler) SubmitRebuildSearchIndex(ctx context.Context, projectID string) (Run, error)

type SchedulerDiagnostics

type SchedulerDiagnostics struct {
	QueueDepth                  int
	LiveQueueDepth              int
	FullScanQueueDepth          int
	ActiveTaskCount             int
	ActiveProjectTaskCount      map[string]int
	ProjectWideTaskCount        map[string]int
	PendingProjectWideTaskCount map[string]int
}

type SchedulerOptions

type SchedulerOptions struct {
	QueueDepth            int
	GlobalWorkerCount     int
	PerProjectWorkerLimit int
	LivePathPriority      bool
}

type SearchIndexHealth

type SearchIndexHealth struct {
	Degraded bool
	Reason   string
}

type SearchIndexMetadata

type SearchIndexMetadata struct {
	IndexStatus    string `json:"index_status"`
	IngestionRunID string `json:"ingestion_run_id,omitempty"`
	Degraded       bool   `json:"degraded,omitempty"`
	DegradedReason string `json:"degraded_reason,omitempty"`
}

type SearchQueryDiagnostic added in v0.1.10

type SearchQueryDiagnostic struct {
	FTSQueries              int64 `json:"fts_queries,omitempty"`
	ScopedFallbackQueries   int64 `json:"scoped_fallback_queries,omitempty"`
	RejectedFallbackQueries int64 `json:"rejected_fallback_queries,omitempty"`
	RowsScanned             int64 `json:"rows_scanned,omitempty"`
}

type SearchStorageDiagnostic added in v0.1.3

type SearchStorageDiagnostic struct {
	ProjectID  string                 `json:"project_id"`
	Backend    string                 `json:"backend"`
	StorageKey string                 `json:"storage_key,omitempty"`
	Write      *SearchWriteDiagnostic `json:"write,omitempty"`
}

type SearchStoreBackend added in v0.1.3

type SearchStoreBackend struct {
	ProjectID  string
	Store      any
	StorageKey string
}

type SearchStoreRouter added in v0.1.3

type SearchStoreRouter struct {
	// contains filtered or unexported fields
}

func NewProjectScopedSearchStoreRouter added in v0.1.3

func NewProjectScopedSearchStoreRouter(registry *projectregistry.Registry, fallback any, backends []SearchStoreBackend) *SearchStoreRouter

func (*SearchStoreRouter) ApplySearchFileBatch added in v0.1.3

func (router *SearchStoreRouter) ApplySearchFileBatch(ctx context.Context, project projectregistry.Project, results []fullScanFileResult) error

func (*SearchStoreRouter) ClearSearchIndexDegraded added in v0.1.3

func (router *SearchStoreRouter) ClearSearchIndexDegraded(ctx context.Context, projectID string) error

func (*SearchStoreRouter) ContextSearchIndexHealth added in v0.1.3

func (router *SearchStoreRouter) ContextSearchIndexHealth(ctx context.Context, project projectregistry.Project) (SearchIndexHealth, error)

func (*SearchStoreRouter) CountSearchChunks added in v0.1.3

func (router *SearchStoreRouter) CountSearchChunks(ctx context.Context, project projectregistry.Project) (int, error)

func (*SearchStoreRouter) CountSearchSymbols added in v0.1.3

func (router *SearchStoreRouter) CountSearchSymbols(ctx context.Context, project projectregistry.Project) (int, error)

func (*SearchStoreRouter) DeleteSearchFile added in v0.1.3

func (router *SearchStoreRouter) DeleteSearchFile(ctx context.Context, projectID string, fileID string) error

func (*SearchStoreRouter) DeleteSearchProject added in v0.1.3

func (router *SearchStoreRouter) DeleteSearchProject(ctx context.Context, projectID string) error

func (*SearchStoreRouter) HasSearchFileVersion added in v0.1.3

func (router *SearchStoreRouter) HasSearchFileVersion(ctx context.Context, project projectregistry.Project, state FileState) (bool, error)

func (*SearchStoreRouter) MarkSearchIndexDegraded added in v0.1.3

func (router *SearchStoreRouter) MarkSearchIndexDegraded(ctx context.Context, projectID string, reason string) error

func (*SearchStoreRouter) ReconcileSearchIndex added in v0.1.3

func (router *SearchStoreRouter) ReconcileSearchIndex(ctx context.Context, project projectregistry.Project) ([]FileState, error)

func (*SearchStoreRouter) SearchCalls added in v0.1.3

func (*SearchStoreRouter) SearchFiles added in v0.1.3

func (router *SearchStoreRouter) SearchFiles(ctx context.Context, project projectregistry.Project, options FileSearchOptions) (FileList, error)

func (*SearchStoreRouter) SearchIndexHealth added in v0.1.3

func (router *SearchStoreRouter) SearchIndexHealth(ctx context.Context, project projectregistry.Project) (SearchIndexHealth, error)

func (*SearchStoreRouter) SearchReferences added in v0.1.3

func (router *SearchStoreRouter) SearchReferences(ctx context.Context, project projectregistry.Project, options ReferenceSearchOptions) (SymbolReferenceList, error)

func (*SearchStoreRouter) SearchStorageDiagnostics added in v0.1.3

func (router *SearchStoreRouter) SearchStorageDiagnostics() []SearchStorageDiagnostic

func (*SearchStoreRouter) SearchSymbols added in v0.1.3

func (router *SearchStoreRouter) SearchSymbols(ctx context.Context, project projectregistry.Project, filter SymbolFilter, pagination Pagination) (SymbolList, error)

func (*SearchStoreRouter) SearchText added in v0.1.3

func (*SearchStoreRouter) UpdateSearchFileMetadata added in v0.1.3

func (router *SearchStoreRouter) UpdateSearchFileMetadata(ctx context.Context, project projectregistry.Project, state FileState) error

func (*SearchStoreRouter) UpdateSearchFileMetadataBatch added in v0.1.3

func (router *SearchStoreRouter) UpdateSearchFileMetadataBatch(ctx context.Context, project projectregistry.Project, states []FileState) error

func (*SearchStoreRouter) UpsertSearchFile added in v0.1.3

func (router *SearchStoreRouter) UpsertSearchFile(ctx context.Context, project projectregistry.Project, state FileState, chunks []Chunk, symbols []Symbol, references []Reference, calls []Call) error

func (*SearchStoreRouter) UpsertSearchFilesBatch added in v0.1.3

func (router *SearchStoreRouter) UpsertSearchFilesBatch(ctx context.Context, project projectregistry.Project, files []PreparedSearchFile) error

type SearchWriteDiagnostic added in v0.1.5

type SearchWriteDiagnostic struct {
	TransactionCount  int64                 `json:"transaction_count"`
	MaxWriteWeight    int                   `json:"max_write_weight,omitempty"`
	RowsInserted      map[string]int64      `json:"rows_inserted,omitempty"`
	DeleteStatements  map[string]int64      `json:"delete_statements,omitempty"`
	FTSRewriteSkipped int64                 `json:"fts_rewrite_skipped,omitempty"`
	Query             SearchQueryDiagnostic `json:"query,omitempty"`
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(registry *projectregistry.Registry, graph *GraphStore, state stateStore) *Service

func (*Service) ActiveRunMetadata added in v0.1.1

func (svc *Service) ActiveRunMetadata(ctx context.Context, projectID string) ([]RunMetadata, error)

func (*Service) ContextSearchIndexHealth added in v0.1.1

func (svc *Service) ContextSearchIndexHealth(ctx context.Context, projectID string) (SearchIndexHealth, error)

func (*Service) Diagnostics

func (svc *Service) Diagnostics() map[string]StageDiagnostic

func (*Service) EligibleFileCount added in v0.1.1

func (svc *Service) EligibleFileCount(ctx context.Context, projectID string) (int, error)

func (*Service) ExecutePreparedProjectRun

func (svc *Service) ExecutePreparedProjectRun(ctx context.Context, run Run) (Run, error)

func (*Service) ExecutePreparedSearchIndexRebuild

func (svc *Service) ExecutePreparedSearchIndexRebuild(ctx context.Context, run Run) (Run, error)

func (*Service) FailInterruptedRuns

func (svc *Service) FailInterruptedRuns(ctx context.Context, errorCategory string) (int, error)

func (*Service) FailPreparedProjectRun

func (svc *Service) FailPreparedProjectRun(ctx context.Context, run Run, errorCategory string) (Run, error)

func (*Service) GetChunk

func (svc *Service) GetChunk(ctx context.Context, projectID string, fileID string, chunkID string, maxChunkBytes int) (ChunkMetadata, error)

func (*Service) GetFile

func (svc *Service) GetFile(ctx context.Context, projectID string, fileID string) (FileMetadata, error)

func (*Service) GetFileOutline

func (svc *Service) GetFileOutline(ctx context.Context, projectID string, fileID string, options FileOutlineOptions) (FileOutline, error)

func (*Service) GetRun

func (svc *Service) GetRun(ctx context.Context, projectID string, runID string) (Run, error)

func (*Service) GetSymbol

func (svc *Service) GetSymbol(ctx context.Context, projectID string, symbolID string) (SymbolMetadata, error)

func (*Service) GetSymbolCallGraph

func (svc *Service) GetSymbolCallGraph(ctx context.Context, projectID string, symbolID string, options CallGraphOptions) (SymbolCallGraph, error)

func (*Service) GetSymbolSource

func (svc *Service) GetSymbolSource(ctx context.Context, projectID string, symbolID string, options SymbolSourceOptions) (SymbolSource, error)

func (*Service) IndexedChunkCount added in v0.1.1

func (svc *Service) IndexedChunkCount(ctx context.Context, projectID string) (int, error)

func (*Service) IndexedSymbolCount added in v0.1.1

func (svc *Service) IndexedSymbolCount(ctx context.Context, projectID string) (int, error)

func (*Service) IngestPath

func (svc *Service) IngestPath(ctx context.Context, projectID string, relativePath string, trigger Trigger) (Run, error)

func (*Service) IngestProject

func (svc *Service) IngestProject(ctx context.Context, projectID string, trigger Trigger) (Run, error)

func (*Service) LatestRunMetadata

func (svc *Service) LatestRunMetadata(ctx context.Context, projectID string) (RunMetadata, error)

func (*Service) ListASTQueries

func (svc *Service) ListASTQueries(ctx context.Context, projectID string) (ASTQueryCatalog, error)

func (*Service) ListChunks

func (svc *Service) ListChunks(ctx context.Context, projectID string, fileID string, pagination Pagination, maxChunkBytes int) (ChunkList, error)

func (*Service) ListFileStates

func (svc *Service) ListFileStates(ctx context.Context, projectID string, filter FileStateFilter) ([]FileState, error)

func (*Service) ListFiles

func (svc *Service) ListFiles(ctx context.Context, projectID string, filter FileStateFilter, pagination Pagination) (FileList, error)

func (*Service) ListHeadings

func (svc *Service) ListHeadings(ctx context.Context, projectID string, fileID string, pagination Pagination) (HeadingList, error)

func (*Service) ListSymbolCallees

func (svc *Service) ListSymbolCallees(ctx context.Context, projectID string, symbolID string, pagination Pagination) (SymbolCallEdgeList, error)

func (*Service) ListSymbolCallers

func (svc *Service) ListSymbolCallers(ctx context.Context, projectID string, symbolID string, pagination Pagination) (SymbolCallEdgeList, error)

func (*Service) ListSymbolImplementers added in v0.1.1

func (svc *Service) ListSymbolImplementers(ctx context.Context, projectID string, symbolID string, pagination Pagination) (SymbolImplementationList, error)

func (*Service) ListSymbolReferences

func (svc *Service) ListSymbolReferences(ctx context.Context, projectID string, symbolID string, pagination Pagination) (SymbolReferenceList, error)

func (*Service) ListSymbols

func (svc *Service) ListSymbols(ctx context.Context, projectID string, filter SymbolFilter, pagination Pagination) (SymbolList, error)

func (*Service) PrepareProjectRun

func (svc *Service) PrepareProjectRun(ctx context.Context, projectID string, trigger Trigger) (Run, error)

func (*Service) RebuildSearchIndex

func (svc *Service) RebuildSearchIndex(ctx context.Context, projectID string) (Run, error)

func (*Service) RunMetadata

func (svc *Service) RunMetadata(ctx context.Context, projectID string, runID string) (RunMetadata, error)

func (*Service) SearchAST

func (svc *Service) SearchAST(ctx context.Context, projectID string, options ASTSearchOptions) (ASTSearchResultList, error)

func (*Service) SearchCalls

func (svc *Service) SearchCalls(ctx context.Context, projectID string, options ReferenceSearchOptions) (SymbolCallEdgeList, error)

func (*Service) SearchFiles

func (svc *Service) SearchFiles(ctx context.Context, projectID string, options FileSearchOptions) (FileList, error)

func (*Service) SearchIndexHealth added in v0.1.1

func (svc *Service) SearchIndexHealth(ctx context.Context, projectID string) (SearchIndexHealth, error)

func (*Service) SearchReferences

func (svc *Service) SearchReferences(ctx context.Context, projectID string, options ReferenceSearchOptions) (SymbolReferenceList, error)

func (*Service) SearchSymbols

func (svc *Service) SearchSymbols(ctx context.Context, projectID string, filter SymbolFilter, pagination Pagination) (SymbolList, error)

func (*Service) SearchText

func (svc *Service) SearchText(ctx context.Context, projectID string, options TextSearchOptions) (TextSearchResultList, error)

func (*Service) SetCheckpointFunc

func (svc *Service) SetCheckpointFunc(checkpoint func(context.Context) error)

func (*Service) SetExtractorCacheEnabled

func (svc *Service) SetExtractorCacheEnabled(enabled bool)

func (*Service) SetFullScanBatchSize

func (svc *Service) SetFullScanBatchSize(size int)

func (*Service) SetFullScanWorkerCount

func (svc *Service) SetFullScanWorkerCount(count int)

func (*Service) SetFullScanWorkerLimits

func (svc *Service) SetFullScanWorkerLimits(globalCount int, perProjectCount int)

func (*Service) SetPolicyRecorder added in v0.1.12

func (svc *Service) SetPolicyRecorder(recorder *agentactivity.Recorder)

func (*Service) SetSearchStore added in v0.1.3

func (svc *Service) SetSearchStore(search any)

func (*Service) SubmitIngestProject

func (svc *Service) SubmitIngestProject(ctx context.Context, projectID string, trigger Trigger) (Run, error)

func (*Service) SubmitRebuildSearchIndex

func (svc *Service) SubmitRebuildSearchIndex(ctx context.Context, projectID string) (Run, error)

type SkipReason

type SkipReason string
const (
	SkipReasonNone              SkipReason = ""
	SkipReasonUnsafePath        SkipReason = "unsafe_path"
	SkipReasonDeniedPath        SkipReason = "denied_path"
	SkipReasonFileTooLarge      SkipReason = "file_too_large"
	SkipReasonSemanticTooLarge  SkipReason = "semantic_too_large"
	SkipReasonBinaryContent     SkipReason = "binary_content"
	SkipReasonNULByte           SkipReason = "nul_byte"
	SkipReasonInvalidUTF8       SkipReason = "invalid_utf8"
	SkipReasonSensitiveContent  SkipReason = "sensitive_content"
	SkipReasonUnsupportedPolicy SkipReason = "unsupported_policy"
	SkipReasonStatError         SkipReason = "stat_error"
	SkipReasonReadError         SkipReason = "read_error"
	SkipReasonChunkError        SkipReason = "chunk_error"
	SkipReasonParseError        SkipReason = "parse_error"
)

type StageDiagnostic

type StageDiagnostic struct {
	Count         int64  `json:"count"`
	TotalMillis   int64  `json:"total_ms"`
	MaxMillis     int64  `json:"max_ms"`
	LastMillis    int64  `json:"last_ms"`
	LastSeenUnix  int64  `json:"last_seen_unix,omitempty"`
	ErrorCount    int64  `json:"error_count,omitempty"`
	LastErrorUnix int64  `json:"last_error_unix,omitempty"`
	LastError     string `json:"last_error,omitempty"`
}

type Symbol

type Symbol struct {
	Kind        SymbolKind
	Name        string
	PackageName string
	ImportPath  string
	Receiver    string
	StartLine   int
	EndLine     int
	StartByte   int
	EndByte     int
	StartColumn int
	EndColumn   int
}

func ParseConfigTopLevelKeys

func ParseConfigTopLevelKeys(source []byte) ([]Symbol, error)

func ParseDockerfileSymbols

func ParseDockerfileSymbols(source []byte) ([]Symbol, error)

func ParseGoFile

func ParseGoFile(relativePath string, source []byte) ([]Symbol, error)

func ParseJSONTopLevelKeys

func ParseJSONTopLevelKeys(source []byte) ([]Symbol, error)

func ParseMakefileSymbols

func ParseMakefileSymbols(source []byte) ([]Symbol, error)

func ParseOpenAPIPathSymbols

func ParseOpenAPIPathSymbols(source []byte) ([]Symbol, error)

func ParseSQLMigrationSymbols

func ParseSQLMigrationSymbols(relative string, source []byte) ([]Symbol, error)

func ParseUnityAsmdefSymbols added in v0.1.10

func ParseUnityAsmdefSymbols(source []byte) ([]Symbol, error)

type SymbolCallEdge

type SymbolCallEdge struct {
	ID               string `json:"id"`
	CallID           string `json:"call_id,omitempty"`
	FileID           string `json:"file_id,omitempty"`
	ProjectID        string `json:"project_id"`
	CallerSymbolID   string `json:"caller_symbol_id"`
	CalleeSymbolID   string `json:"callee_symbol_id"`
	CallerName       string `json:"caller_name,omitempty"`
	CalleeName       string `json:"callee_name,omitempty"`
	Receiver         string `json:"receiver,omitempty"`
	ImportPath       string `json:"import_path,omitempty"`
	StartLine        int    `json:"start_line,omitempty"`
	EndLine          int    `json:"end_line,omitempty"`
	StartByte        int    `json:"start_byte,omitempty"`
	EndByte          int    `json:"end_byte,omitempty"`
	StartColumn      int    `json:"start_column,omitempty"`
	EndColumn        int    `json:"end_column,omitempty"`
	ResolutionStatus string `json:"resolution_status"`
	Confidence       string `json:"confidence,omitempty"`
}

type SymbolCallEdgeList

type SymbolCallEdgeList struct {
	Symbol        SymbolMetadata       `json:"symbol"`
	Edges         []SymbolCallEdge     `json:"edges"`
	NextPageToken string               `json:"next_page_token,omitempty"`
	Index         *SearchIndexMetadata `json:"index,omitempty"`
}

type SymbolCallGraph

type SymbolCallGraph struct {
	Symbol    SymbolMetadata   `json:"symbol"`
	Direction string           `json:"direction"`
	MaxDepth  int              `json:"max_depth"`
	MaxNodes  int              `json:"max_nodes"`
	Nodes     []SymbolMetadata `json:"nodes"`
	Edges     []SymbolCallEdge `json:"edges"`
	Truncated bool             `json:"truncated"`
}

type SymbolFilter

type SymbolFilter struct {
	Kind          SymbolKind
	NamePrefix    string
	NameContains  string
	FileID        string
	Extension     string
	Package       string
	Receiver      string
	CaseSensitive bool
}

func NormalizeSymbolFilter

func NormalizeSymbolFilter(filter SymbolFilter) (SymbolFilter, error)

type SymbolImplementation added in v0.1.1

type SymbolImplementation struct {
	ID                  string `json:"id"`
	FileID              string `json:"file_id,omitempty"`
	ProjectID           string `json:"project_id"`
	Kind                string `json:"kind"`
	ImplementerSymbolID string `json:"implementer_symbol_id,omitempty"`
	ImplementedSymbolID string `json:"implemented_symbol_id,omitempty"`
	ImplementerName     string `json:"implementer_name,omitempty"`
	ImplementedName     string `json:"implemented_name,omitempty"`
	PackageName         string `json:"package,omitempty"`
	Receiver            string `json:"receiver,omitempty"`
	ImportPath          string `json:"import_path,omitempty"`
	StartLine           int    `json:"start_line,omitempty"`
	EndLine             int    `json:"end_line,omitempty"`
	StartByte           int    `json:"start_byte,omitempty"`
	EndByte             int    `json:"end_byte,omitempty"`
	StartColumn         int    `json:"start_column,omitempty"`
	EndColumn           int    `json:"end_column,omitempty"`
	ResolutionStatus    string `json:"resolution_status"`
	Confidence          string `json:"confidence,omitempty"`
}

type SymbolImplementationList added in v0.1.1

type SymbolImplementationList struct {
	Symbol          SymbolMetadata         `json:"symbol"`
	Implementations []SymbolImplementation `json:"implementations"`
	NextPageToken   string                 `json:"next_page_token,omitempty"`
}

type SymbolKind

type SymbolKind string
const (
	SymbolKindPackage            SymbolKind = "package"
	SymbolKindImport             SymbolKind = "import"
	SymbolKindFunction           SymbolKind = "function"
	SymbolKindMethod             SymbolKind = "method"
	SymbolKindType               SymbolKind = "type"
	SymbolKindClass              SymbolKind = "class"
	SymbolKindExport             SymbolKind = "export"
	SymbolKindFlutterWidget      SymbolKind = "flutter_widget"
	SymbolKindFlutterState       SymbolKind = "flutter_state"
	SymbolKindFlutterBuildMethod SymbolKind = "flutter_build_method"
	SymbolKindStage              SymbolKind = "stage"
	SymbolKindTarget             SymbolKind = "target"
	SymbolKindPath               SymbolKind = "path"
	SymbolKindKey                SymbolKind = "key"
	SymbolKindMigration          SymbolKind = "migration"
	SymbolKindAssembly           SymbolKind = "assembly"
)

type SymbolList

type SymbolList struct {
	Symbols       []SymbolMetadata     `json:"symbols"`
	NextPageToken string               `json:"next_page_token,omitempty"`
	Index         *SearchIndexMetadata `json:"index,omitempty"`
}

type SymbolMetadata

type SymbolMetadata struct {
	ID           string `json:"id"`
	FileID       string `json:"file_id"`
	ProjectID    string `json:"project_id"`
	Kind         string `json:"kind"`
	Name         string `json:"name"`
	RelativePath string `json:"relative_path,omitempty"`
	Extension    string `json:"extension,omitempty"`
	PackageName  string `json:"package,omitempty"`
	ImportPath   string `json:"import_path,omitempty"`
	Receiver     string `json:"receiver,omitempty"`
	StartLine    int    `json:"start_line"`
	EndLine      int    `json:"end_line"`
	StartByte    int    `json:"start_byte,omitempty"`
	EndByte      int    `json:"end_byte,omitempty"`
	StartColumn  int    `json:"start_column,omitempty"`
	EndColumn    int    `json:"end_column,omitempty"`
}

type SymbolReferenceList

type SymbolReferenceList struct {
	Symbol        SymbolMetadata            `json:"symbol"`
	References    []SymbolReferenceMetadata `json:"references"`
	NextPageToken string                    `json:"next_page_token,omitempty"`
	Index         *SearchIndexMetadata      `json:"index,omitempty"`
}

type SymbolReferenceMetadata

type SymbolReferenceMetadata struct {
	ID                  string `json:"id"`
	FileID              string `json:"file_id"`
	ProjectID           string `json:"project_id"`
	Kind                string `json:"kind"`
	Name                string `json:"name"`
	TargetName          string `json:"target_name,omitempty"`
	TargetSymbolID      string `json:"target_symbol_id,omitempty"`
	PackageName         string `json:"package,omitempty"`
	Receiver            string `json:"receiver,omitempty"`
	ImportPath          string `json:"import_path,omitempty"`
	EnclosingSymbolID   string `json:"enclosing_symbol_id,omitempty"`
	EnclosingSymbolName string `json:"enclosing_symbol_name,omitempty"`
	StartLine           int    `json:"start_line"`
	EndLine             int    `json:"end_line"`
	StartByte           int    `json:"start_byte,omitempty"`
	EndByte             int    `json:"end_byte,omitempty"`
	StartColumn         int    `json:"start_column,omitempty"`
	EndColumn           int    `json:"end_column,omitempty"`
	ResolutionStatus    string `json:"resolution_status"`
	Confidence          string `json:"confidence,omitempty"`
}

type SymbolSource

type SymbolSource struct {
	Symbol        SymbolMetadata `json:"symbol"`
	Text          string         `json:"text"`
	TextTruncated bool           `json:"text_truncated"`
	MaxBytes      int            `json:"max_bytes"`
}

type SymbolSourceOptions

type SymbolSourceOptions struct {
	MaxSourceBytes int
}

type TextSearchOptions

type TextSearchOptions struct {
	Query           string
	Mode            string
	CaseSensitive   bool
	Extension       string
	PathPrefix      string
	PageSize        int
	PageToken       string
	MaxSnippetBytes int
	MaxMatches      int
}

func NormalizeTextSearchOptions

func NormalizeTextSearchOptions(options TextSearchOptions) (TextSearchOptions, error)

type TextSearchResult

type TextSearchResult struct {
	File             FileMetadata  `json:"file"`
	Chunk            ChunkMetadata `json:"chunk"`
	LineStart        int           `json:"line_start"`
	LineEnd          int           `json:"line_end"`
	ByteStart        int           `json:"byte_start"`
	ByteEnd          int           `json:"byte_end"`
	Snippet          string        `json:"snippet"`
	SnippetTruncated bool          `json:"snippet_truncated"`
}

type TextSearchResultList

type TextSearchResultList struct {
	Results         []TextSearchResult   `json:"results"`
	NextPageToken   string               `json:"next_page_token,omitempty"`
	MaxSnippetBytes int                  `json:"max_snippet_bytes"`
	Index           *SearchIndexMetadata `json:"index,omitempty"`
}

type Trigger

type Trigger string
const (
	TriggerManual Trigger = "manual"
	TriggerLive   Trigger = "live"
)

type WatchEvent

type WatchEvent struct {
	Path string
	Op   WatchOp
}

type WatchOp

type WatchOp uint32
const (
	WatchCreate WatchOp = 1 << iota
	WatchWrite
	WatchRemove
	WatchRename
)

type WatchState

type WatchState struct {
	ProjectID             string
	Status                string
	WatchedDirectoryCount int
	SkippedDirectoryCount int
	FailedDirectoryCount  int
	QueueDepth            int
	EventQueueDepth       int
	TaskQueueDepth        int
	RescanQueueDepth      int
	OldestEventAgeMillis  int64
	CoalescedEventCount   uint64
	DroppedEventCount     uint64
	LastErrorCategory     string
	UpdatedAt             time.Time
}

type WatcherFactory

type WatcherFactory func() (FileWatcher, error)

type WorkspaceSafetyOptions added in v0.1.13

type WorkspaceSafetyOptions struct {
	MaxFileBytes          int64
	SensitiveMarkerPolicy string
}

Jump to

Keyboard shortcuts

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