files

package
v0.44.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 29, 2026 License: MIT Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package files provides reusable file scanning and filtering logic. It backs the HTTP /api/sessions/{id}/files endpoint.

Index

Constants

View Source
const MaxScanEntries = 5000

MaxScanEntries is the cap on total entries returned by a single scan.

Variables

View Source
var SkipDirs = map[string]bool{
	".git":         true,
	"node_modules": true,
	"vendor":       true,
	".next":        true,
	"dist":         true,
	"build":        true,
	"__pycache__":  true,
	".venv":        true,
	".cache":       true,
	".idea":        true,
	".vscode":      true,
}

SkipDirs are directory names that are always skipped during scanning.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Path  string `json:"path"`
	IsDir bool   `json:"is_dir"`
}

Entry represents a file or directory relative to a workspace root.

func Filter

func Filter(entries []Entry, query string, limit int) []Entry

Filter returns entries matching query, ranked: exact > prefix > contains. Both the full path and the basename are checked. Results are capped to limit. All entries are scanned to guarantee correct ranking; truncation is applied only to the final composed result.

type Scanner

type Scanner struct {
	// contains filtered or unexported fields
}

Scanner caches file entries per workDir. Thread-safe. Callers create their own instance; there is no package-level global.

func NewScanner

func NewScanner() *Scanner

NewScanner returns a Scanner with a 30-second TTL.

func (*Scanner) Invalidate

func (s *Scanner) Invalidate(workDir string)

Invalidate forces a re-scan for the given workDir on the next call to Scan.

func (*Scanner) Scan

func (s *Scanner) Scan(workDir string) []Entry

Scan returns file entries for workDir, using a cached result if fresh.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL