Documentation
¶
Overview ¶
Package parser bridges Grove's storage-aware projection to the shared astkit tree-sitter extraction layer. The actual per-language extraction logic lives in astkit/strategies; this file only:
- Maps Grove's language strings (e.g. "javascript") → astkit.LanguageKey.
- Drives the shared parser/registry.
- Projects each astkit.Symbol → core.SymbolRecord, attaching Grove-only fields (ID, FilePath, BlobSHA, Language, Imports, TokenEstimate) and renaming Body→RawText, Exported→Exports, ParentName→ParentSymbol.
Index ¶
Constants ¶
const ( // PlaintextFTSLimit is the maximum bytes stored in the docstring column, // which is FTS5-indexed. 64 KB covers nearly all real-world docs and // configs while preventing unbounded FTS5 table growth. PlaintextFTSLimit = 64 * 1024 // PlaintextRawLimit is the maximum bytes stored in raw_text. // Prism uses raw_text for progressive disclosure; 1 MB is sufficient // for the largest policy/swagger/OpenAPI files teams encounter in practice. PlaintextRawLimit = 1024 * 1024 )
const MaxFileSizeBytes int64 = 10 * 1024 * 1024
const PlaintextLanguage = "plaintext"
PlaintextLanguage is the language tag assigned to non-code documents (markdown, YAML, JSON, XML, shell scripts, etc.) that Grove indexes as whole-file FTS5 records rather than extracted symbol trees.
Variables ¶
This section is empty.
Functions ¶
func DetectLanguage ¶
DetectLanguage returns the Grove language tag for a file path. Returns "" for unsupported or security-excluded files.
func ExtractPlaintext ¶
func ExtractPlaintext(relPath, blobSHA string, content []byte) []core.SymbolRecord
ExtractPlaintext produces a single whole-file SymbolRecord for non-code documents. The record kind is KindDocument and the language is "plaintext".
Content layout:
- docstring — full text, capped at PlaintextFTSLimit (FTS5 searchable)
- raw_text — full text, capped at PlaintextRawLimit (Prism disclosure)
- signature — first meaningful line (title / heading / top-level key)
- name — base filename
- qualified_name — repo-relative path (used for path-based queries)
func FileBlobSHA ¶
func IsPlaintext ¶
IsPlaintext reports whether the language tag belongs to the plaintext family.