Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var CutLanguageHints = map[string]string{
".kt": "kotlin", ".kts": "kotlin",
".swift": "swift", ".rb": "ruby", ".php": "php",
".scala": "scala", ".cs": "csharp", ".fs": "fsharp",
".ml": "ocaml", ".mli": "ocaml", ".hs": "haskell",
".ex": "elixir", ".exs": "elixir", ".jl": "julia", ".dart": "dart",
".r": "r", ".pl": "perl", ".pm": "perl",
".mm": "objc", ".zig": "zig",
".groovy": "groovy", ".gradle": "groovy",
".el": "elisp", ".vim": "vimscript",
".f90": "fortran", ".f95": "fortran",
".lean": "lean", ".sv": "verilog", ".svh": "verilog",
}
CutLanguageHints maps extensions of languages removed in the 2026-06-10 grammar cut to a restore hint (see CLAUDE.md "Parsing" for the restore procedure). index_health uses this to split unsupported-extension tallies into a cut-language tier (always reported when non-empty, any count — the language-adoption-lag canary the cut created) and an unknown-extension tier (informational).
".m" is ambiguous (MATLAB / Objective-C) and is deliberately omitted; ".mm" is unambiguously Objective-C++. If a cut language is ever restored, remove its entries here — TestCutLanguageHints_NoneSupported enforces that every listed extension is actually unsupported.
var IGNORE_PATTERNS = map[string]bool{ ".git": true, ".hg": true, ".svn": true, ".worktrees": true, ".idea": true, ".vs": true, ".vscode": true, ".eclipse": true, ".claude": true, ".cache": true, ".eggs": true, ".env": true, ".mypy_cache": true, ".nox": true, ".pytest_cache": true, ".ruff_cache": true, ".tox": true, ".venv": true, "__pycache__": true, "env": true, "htmlcov": true, "site-packages": true, "venv": true, ".npm": true, ".nyc_output": true, ".pnpm-store": true, ".yarn": true, "bower_components": true, "coverage": true, "node_modules": true, ".next": true, ".nuxt": true, ".svelte-kit": true, ".angular": true, ".turbo": true, ".parcel-cache": true, ".docusaurus": true, ".expo": true, "dist": true, "obj": true, "Pods": true, "target": true, "temp": true, "tmp": true, ".terraform": true, ".serverless": true, "bazel-bin": true, "bazel-out": true, "bazel-testlogs": true, ".cargo": true, ".stack-work": true, ".dart_tool": true, "zig-cache": true, "zig-out": true, ".metals": true, ".bloop": true, ".bsp": true, ".ccls-cache": true, ".clangd": true, "elm-stuff": true, "_opam": true, ".cpcache": true, ".shadow-cljs": true, ".vercel": true, ".netlify": true, ".qdrant_code_embeddings": true, ".tmp": true, "vendor": true, }
IGNORE_PATTERNS are directory names to skip during discovery.
var IGNORE_SUFFIXES = map[string]bool{ ".tmp": true, "~": true, ".pyc": true, ".pyo": true, ".o": true, ".a": true, ".so": true, ".dll": true, ".class": true, ".png": true, ".jpg": true, ".jpeg": true, ".gif": true, ".ico": true, ".bmp": true, ".tiff": true, ".webp": true, ".svg": true, ".wasm": true, ".node": true, ".exe": true, ".bin": true, ".dat": true, ".db": true, ".sqlite": true, ".sqlite3": true, ".woff": true, ".woff2": true, ".ttf": true, ".eot": true, ".otf": true, }
IGNORE_SUFFIXES are file suffixes that are never source files.
Functions ¶
func FullModeMaxFileSize ¶
func FullModeMaxFileSize() int64
FullModeMaxFileSize returns the per-file size cutoff for full-mode discovery. Source files above ~1MB are essentially always GENERATED (tree-sitter parser tables, bundled assets, generated bindings) and are deliberately skipped by the indexing pipeline. This helper is the single source of truth for that cutoff so every consumer that must agree with what the indexer indexed — the pipeline itself, index_health's disk-vs- index comparison, and the watcher's change snapshot — applies the SAME threshold. When they disagree (health/watcher discovering with no limit while the pipeline skips >1MB files), health reports deliberately-skipped giant files as "missing", and the watcher thrashes a reindex on every touch of a file the indexer will never index.
Override with CBM_MAX_FILE_BYTES: a positive integer sets the cutoff in bytes; "0" disables the limit entirely; unset or unparsable uses the 1MB default. Discover treats a MaxFileSize of 0 as "no limit".
Types ¶
type FileInfo ¶
type FileInfo struct {
Path string // absolute path
RelPath string // relative to repo root
Language lang.Language // detected language
Size int64 // file size in bytes
}
FileInfo represents a discovered source file.
type IndexMode ¶
type IndexMode string
IndexMode controls how aggressively files are filtered during discovery.
type Options ¶
type Options struct {
IgnoreFile string // path to .cgrignore file (optional)
Mode IndexMode // indexing mode (full or fast)
MaxFileSize int64 // max file size in bytes (0 = no limit)
// UnsupportedTally, when non-nil, counts files that pass every ignore
// filter but have no supported language — exactly the population that
// would have been indexed if a grammar existed. Keyed by lowercased
// extension (or lowercased bare filename when there is no extension).
// Discover's walk is single-goroutine (filepath.Walk), so a plain map
// is safe.
UnsupportedTally map[string]int
}
Options configures file discovery.