Documentation
¶
Index ¶
- Constants
- func AllowedNoteExtensions() []string
- func ClassifySource(path string) string
- func FormatSize(bytes int) string
- func IsAllowedTextNotePath(relPath string) (ok bool, ext string, reason string)
- func IsMemoryPath(relPath string) bool
- func IsVirtualDir(relDir string) bool
- func NormalizeDir(raw string) (string, error)
- func NormalizePath(raw string) (string, error)
- func NoteMaxBytesDefault() int
- func VirtualRootEntries() []string
- type ApplyPatchResult
- type ApplyPatchSummary
- type FileEntry
- type StatEntry
- type Store
- func (s *Store) Delete(ctx context.Context, relPath string) error
- func (s *Store) DirEntries(entries []FileEntry, dir string) ([]string, bool)
- func (s *Store) List(ctx context.Context) ([]FileEntry, error)
- func (s *Store) ListWithPrefix(ctx context.Context, dir string) ([]FileEntry, error)
- func (s *Store) Read(ctx context.Context, relPath string) (*FileEntry, bool, error)
- func (s *Store) Stat(ctx context.Context, relPath string) (*StatEntry, error)
- func (s *Store) Write(ctx context.Context, relPath, content string) (*FileEntry, error)
- func (s *Store) WriteIfMissing(ctx context.Context, relPath, content string) (bool, error)
- type Truncation
Constants ¶
const ( StatTypeFile = "file" StatTypeDir = "dir" )
const ( DefaultMaxLines = 2000 DefaultMaxBytes = 50 * 1024 GrepMaxLineLength = 500 )
Variables ¶
This section is empty.
Functions ¶
func AllowedNoteExtensions ¶
func AllowedNoteExtensions() []string
AllowedNoteExtensions returns the hardcoded list of indexable "note" file extensions. Extensions are lowercase and include a leading dot.
func ClassifySource ¶
ClassifySource returns the default source label for a path.
func FormatSize ¶
func IsAllowedTextNotePath ¶
IsAllowedTextNotePath checks whether a virtual path is allowed for note indexing/reading. It requires an explicit file extension in the allowlist.
func IsMemoryPath ¶
IsMemoryPath returns true for MEMORY.md or memory/*.md.
func IsVirtualDir ¶
IsVirtualDir returns true for virtual directories that should exist even when empty.
func NormalizeDir ¶
NormalizeDir normalizes a directory path; empty means root.
func NormalizePath ¶
NormalizePath normalizes a virtual file path and prevents escaping the root.
func NoteMaxBytesDefault ¶
func NoteMaxBytesDefault() int
NoteMaxBytesDefault is the default per-file size cap for note indexing and reads.
func VirtualRootEntries ¶
func VirtualRootEntries() []string
VirtualRootEntries returns the virtual root directories.
Types ¶
type ApplyPatchResult ¶
type ApplyPatchResult struct {
Summary ApplyPatchSummary
Text string
}
func ApplyPatch ¶
type ApplyPatchSummary ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) DirEntries ¶
func (*Store) ListWithPrefix ¶
type Truncation ¶
type Truncation struct {
Content string
Truncated bool
TruncatedBy string
TotalLines int
TotalBytes int
OutputLines int
OutputBytes int
FirstLineExceedsLimit bool
MaxLines int
MaxBytes int
}
func TruncateHead ¶
func TruncateHead(content string, maxLines, maxBytes int) Truncation
TruncateHead keeps the first maxLines/maxBytes of content.