Skip to content

scalecode-solutions/globber

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

globber

AI-native glob for the SIF ecosystem.

A ground-up Rust rewrite of Unix glob, rooted in the POSIX glob(3) and fnmatch(3) specifications, built for AI agent workloads.

What's different

Feature glob (rust-lang) globber
Matching engine Recursive backtracking O(2^n) Thompson NFA O(n*m)
Output PathBuf Entry (path + size + kind + tokens_est)
Format Rust iterator SIF v1 document or plain paths
Patterns Single Single, multi-pattern Ruleset, or brace expansion
Negation None --exclude, --gitignore, Ruleset::exclude()
Budget None --token-budget, --byte-budget, --limit
Classification None FileKind (source, test, config, generated, ...)
Parallelism None rayon — parallel readdir + stat
Preview None --preview code:15 — skip preamble, show code
Git None --git-changed main — only modified files

Install

cargo install globber

Quick start

# Scope a project — files, sizes, token estimates, code previews, summary
globber '**/*.rs' -g -k source -P code:15 -S

# Budget-aware context packing for LLMs
globber '**/*.{rs,go,py}' -g -t 80K -S

# Files changed since main branch
globber '**/*.rs' -G main -P code:10

# Plain paths, gitignore-aware
globber '**' -g -k source -p

Library usage

use globber::{Pattern, glob, Ruleset, MatchOptions};

// Pure pattern matching (POSIX fnmatch equivalent)
let pat = Pattern::new("*.rs").unwrap();
assert!(pat.matches("main.rs"));

// Filesystem walk (POSIX glob equivalent)
for entry in glob("src/**/*.rs").unwrap() {
    if let Ok(e) = entry {
        println!("{} ({} tokens)", e.path.display(), e.tokens_est);
    }
}

// Multi-pattern ruleset with priorities
let rules = Ruleset::new()
    .include("src/**/*.rs")
    .exclude("**/generated/**")
    .build()
    .unwrap();
assert!(rules.is_match("src/main.rs"));

SIF output

Default output is a SIF v1 document:

#!sif v1
#context File listing produced by globber
#schema path:str:path	size:uint	kind:str:311	tokens_est:uint	is_dir:bool
src/main.rs	1024	source	293	false
src/lib.rs	856	source	245	false

Part of the SIF ecosystem: sif-parser, sif-scratch, STP, SWT, SIL.

License

MIT OR Apache-2.0

About

AI-native glob — POSIX-rooted pattern matching with SIF output, budget-aware walking, multi-pattern rulesets, and linear-time matching

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors