Documentation
¶
Overview ¶
Package codeindex indexes a bounded snapshot of tracked UTF-8 text files from a clean Git checkout using the native git executable and the standard library. File bytes come from immutable Git blobs at the captured commit, not from mutable worktree paths.
Index ¶
Constants ¶
const (
FormatVersion = "codeindex-v1"
)
Variables ¶
var ( // ErrDirtyWorktree means the checkout has uncommitted or untracked changes. ErrDirtyWorktree = errors.New("worktree is not clean") // ErrNoCommit means the repository has no HEAD commit. ErrNoCommit = errors.New("no commit found") // ErrNotARepository means repoPath is not inside a non-bare git worktree. ErrNotARepository = errors.New("not a git repository") )
Functions ¶
Types ¶
type Manifest ¶ added in v0.10.0
type Manifest struct {
FormatVersion string `json:"format_version,omitempty"`
CoverageKnown bool `json:"coverage_known"`
TrackedEntries int `json:"tracked_entries"`
IndexedFiles int `json:"indexed_files"`
SkippedInvalidPath int `json:"skipped_invalid_path"`
SkippedExcluded int `json:"skipped_excluded"`
SkippedNonRegular int `json:"skipped_non_regular"`
SkippedOversize int `json:"skipped_oversize"`
SkippedTotalBudget int `json:"skipped_total_budget"`
SkippedNonText int `json:"skipped_non_text"`
SkippedFileLimit int `json:"skipped_file_limit"`
Truncated bool `json:"truncated"`
}
Manifest makes indexing coverage and every skip category explicit.
type Snapshot ¶
type Snapshot struct {
RepoPath string
Commit string
CreatedAt time.Time
Documents []Document
TotalBytes int
Manifest Manifest
}
Snapshot identifies a repository checkout and the documents indexed from it.
func Index ¶
Index enumerates tracked files in repoPath and returns a bounded Snapshot. It requires a clean, non-bare checkout and rejects paths that escape the repository root. Only regular tracked files are read; symlinks, binaries, non-UTF-8 content, and files exceeding the configured limits are skipped.