Skip to main content

Crate whycodes_index

Crate whycodes_index 

Source
Expand description

whycodes-index — fast, gitignore-aware workspace file index.

One background scan of the project roots feeds every consumer:

  • TUI file picker — fuzzy path queries (@file, Ctrl+Space) served by a resident nucleo engine; keystroke queries never touch the disk.
  • File tools — glob / list / grep enumerate the in-memory store instead of re-walking the tree on every tool call. Grep also consults a resident content-trigram overlay so regex confirm only opens files that could contain a required literal.

The walk honours .gitignore / .ignore (via the ignore crate, the same engine ripgrep uses) plus the shared pruning policy. After the initial scan a notify watcher streams debounced deltas so the index stays warm as files are created, edited and deleted during a session.

let index = whycodes_index::WorkspaceIndex::start(vec![".".into()]);
let hits = index.query("main.rs", 20);

Re-exports§

pub use walk::WalkEntry;
pub use walk::WalkStats;
pub use walk::walk_root;
pub use walk::walk_root_limited;

Modules§

policy
Unified tree-pruning policy for project scans.
walk
ignore-crate walker: gitignore-aware, policy-pruned, capped, cancellable.

Structs§

ContentIndex
Per-root overlay: relative path → unique sorted trigrams.
Entry
One indexed entry.
FileMatch
One fuzzy match returned to the UI.
IndexOptions
Options for WorkspaceIndex::start_with.
IndexStore
Per-root view of the entry store.
WorkspaceIndex
Resident workspace file index. Clone-handle via Arc.

Enums§

ScanStatus
Scan progress reported by WorkspaceIndex::status.

Constants§

DEFAULT_MAX_ENTRIES
Default cap on indexed entries per root.
MAX_INDEX_BYTES
Files larger than this are skipped (grep also refuses to search them).
TRIGRAM_LEN
Bytes of an overlapping trigram.

Functions§

extract_trigrams
Unique sorted overlapping 3-byte trigrams. Empty when bytes is shorter than TRIGRAM_LEN.
pack_trigram
Pack three bytes into a u32 key.
required_trigrams
Required trigrams for a grep pattern, or None when the overlay must not prune (regex, too short, or Unicode case-fold).