Documentation
¶
Index ¶
- func ProjectDir(originURL, repoRoot string) (string, error)
- type Chunk
- type Manifest
- type SearchResult
- type Store
- func (s *Store) Close() error
- func (s *Store) CountChunks() (int, error)
- func (s *Store) Dir() string
- func (s *Store) HasChunk(contentHash string) (bool, error)
- func (s *Store) ReadManifest() (*Manifest, error)
- func (s *Store) Search(query []float32, k int, languages []string) ([]SearchResult, error)
- func (s *Store) UpdateLastIndexed(sha string) error
- func (s *Store) Upsert(id string, c Chunk, embedding []float32) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ProjectDir ¶
ProjectDir returns where this repo's index lives, creating parents.
Types ¶
type Chunk ¶
type Chunk struct {
RelPath string
Language string
Kind string // "lines" for v0.2 first cut; "function|method|class|module" once tree-sitter ports
LineStart int
LineEnd int
ContentText string
ContentHash string
}
Chunk is what the indexer hands us — minimal enough to be language-agnostic.
type Manifest ¶
type Manifest struct {
SchemaVersion int `json:"schemaVersion"`
Model string `json:"model"`
Dim int `json:"dim"`
LastIndexedSha string `json:"lastIndexedSha,omitempty"`
LastIndexedAt time.Time `json:"lastIndexedAt"`
ProjectKey string `json:"projectKey"`
OriginURL string `json:"originUrl,omitempty"`
RepoRoot string `json:"repoRoot,omitempty"`
}
Manifest sits next to index.db so we can detect model/dim mismatches without opening the DB.
type SearchResult ¶
type SearchResult struct {
ChunkID string
RelPath string
Language string
Kind string
LineStart int
LineEnd int
Score float64 // 1 - cosine_distance; higher is better
Content string
}
SearchResult mirrors the server-side shape so the CLI renderer can be shared.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store wraps the sqlite handle + the manifest path so callers don't track them separately.
func Open ¶
Open opens (or creates) the local index for a repo. model + dim are recorded in the manifest on first open; a subsequent Open with a different model+dim errors so we never mix vectors of different shapes in the same DB.
func (*Store) CountChunks ¶
CountChunks returns how many chunks are in the index — used by `index` status output and by tests.
func (*Store) HasChunk ¶
HasChunk returns true if a chunk with this content_hash already exists (the indexer uses this to skip re-embedding unchanged content).
func (*Store) ReadManifest ¶
ReadManifest re-reads the manifest from disk — used by `getdebug status` or future commands that want index metadata without opening the DB.
func (*Store) Search ¶
Search runs brute-force cosine similarity. Fine at the v0.2 scale (≤30k chunks per repo). When that ceiling is hit, swap to sqlite-vec (or split the index into shards) — the row scan model stays.
func (*Store) UpdateLastIndexed ¶
UpdateLastIndexed bumps the manifest's last-indexed bookkeeping after a successful index run.