xff v0.8.0

xff - eXtended File Find MBO Works

Release website

xff is a find(1)-compatible file finder with modern extensions. It walks each starting path and acts on entries through find's expression grammar, then adds content and language search, structured output, per-run summaries and histograms, safe deletes, native hashing, and a shared {field} vocabulary that threads through -printf, -exec, and every renderer.

The find style restricts the expression to find-compatible primaries, operators,
and values. Whole-run xff globals remain available when explicitly supplied, while
the default xff style intentionally selects modern presentation and traversal
defaults.

This README.md is a short overview. The complete, always-current reference lives in XFF.md (generated from the binary; see Documentation).


Quick Start

Download the executable for your platform from the latest release.
Choose xff for the lean core, or xff_full for all extras, including PCRE2 and archive support.
The release includes checksums, verification instructions, and separate archives with debug symbols.
You do not need Bazel to use a published executable.

For example, after downloading xff-macos-arm64:

chmod +x xff-macos-arm64
./xff-macos-arm64 . -type f -name '*.md'

Place the chosen executable on your PATH as xff to use these commands:

# Find source files.
xff . -type f -name '*.cc'

# Search file contents.
xff . -type f -grep 'TODO'

# Compare two trees without listing every result.
xff --compare=summary LEFT RIGHT

# Report matched file counts and apparent bytes by extension.
xff . -type f --summary=ext

Summary sizes are apparent entry sizes, not allocated disk blocks or recursive directory sizes.
For building from source, see Building & Dependencies.


Core Highlights & Architectural Advantages


Tool Feature Comparison Matrix

The matrix compares native, built-in capabilities: ● means supported, ◐ means partial support,
and an empty cell means no native support (another utility or a shell pipeline is normally needed).
Partial support covers a narrower form of the feature. The point is not that every specialist is
interchangeable, but that xff composes these operations in one expression and one traversal.

Feature / Capability find fd rg fzf tree du diff hash tools archive tools xff
Filesystem expression language ● ◐ ● GNU/BSD find vocabulary
Multi-threaded filesystem traversal ● ● ● Native worker pool (-j)
Ignore-file and VCS awareness ● ● ● Layered and configurable
Path glob and regex filtering ● ● ● ◐ ◐ ◐ ● Multiple selectable grammars
Ranked fuzzy path matching ● ● -fuzzy, --sort=score
Regex content search with context ● ● -grep, -rxc, --context
Language and MIME filtering ◐ ● -lang, -mime
Overrideable MIME metadata ● JSON layers + mime-db extra
Overrideable language metadata ● JSON layers + Linguist extra
Text, binary, and EOL tests ◐ ● -text, -binary, -eof*
Structured JSON/CSV/table output ● ◐ ◐ ● Eight output formats
Tree rendering ● ◐ ● --format=tree
Field templates and rewrites GNU ◐ ◐ ◐ ● Shared {field} vocabulary
Grouped size/count summaries ◐ ◐ ● --summary
Native histograms and statistics ● --histogram
Cryptographic hashing ● ◐ ● -hash, {hash}, -hasheq
Single-pass hash verification tally ◐ ● --summary=hash-verification
Duplicate-content grouping ● --summary=hash
Reference-file near-duplicate match ● Exact word-shingle Jaccard
Per-file content comparison/diff ● ◐ ● -cmp, -diff
Gitignore-aware tree comparison ◐ ◐ ● status selection or unified patch
Virtual archive traversal ◐ ◐ ● Members use the full expression
Nested archive content search ◐ ◐ ● Depth-controlled transparent reads
SquashFS/Snap/AppImage search ◐ ● Indexed virtual filesystem extra
Archive creation from matches ● ● --pack sink
Standards-framed Brotli archives ◐ ● RFC 9841 default; raw optional
Safe delete preview ◐ ◐ ● --dry-run, --safe
Parallel/batched per-match exec ◐ ● ◐ ● -exec ... +, -j
Capture command output as a field ● -capture, {capture.NAME}
Sharded-dataset validation ● collapse + status matching

find's "Field templates and rewrites" entry is marked GNU because it is GNU find's -printf, a
GNU extension; POSIX and BSD/macOS find have no format primary (only -print / -exec).


Flavor & Behavioral Shift Matrix

xff runs one unified grammar under three operational flavors. The flavor is selected automatically by the program binary name and can be explicitly overridden or layered using the --config flag (where the last specified style wins).

The table below illustrates how traditional shell workflows shift into optimized xff unified expressions.

Target Intent / Use Case Legacy Command / Pipeline The xff Unified Expression Architectural Advantage / Behavioral Shift
Find Expression Compatibility find . -type f -name "*.cpp" find . -type f -name "*.cpp"
or xff --config=find ...
Find vocabulary: Rejects xff-only primaries, operators, and values while retaining explicit whole-run xff controls.*
Modern Structural Search fd -e cc xff -regex '.*\.cc$'
or xff --config=xff ...
Evolved mode (Default): Expands find's grammar with modern extensions, enabling sorted output and human sizes (--human=si).
Clean Developer Grep fd -H -E ".git" | xargs rg "TODO" xff --config=rg -grep "TODO" Opinionated Developer Mode: Implicitly respects nested .gitignore files, skips hidden files, and uses smart-case matching logic.
High-Performance Verification find . -type f -exec sha256sum {} \; xff -type f -hash:sha256 Zero-Fork Speed: Eliminates system process-spawning overhead. Reads files directly into the native read loop buffer to hash inline.
Missing Newline Code Linting Complex multi-line awk scripts or loops. xff -text ! -eofnl -print Native Classification: Instantly flags text files violating POSIX trailing newline rules without streaming lines to the shell.
Cross-OS Time Constraints find . -mmin -60 xff -mtime "-3 weeks 3 hours" Advanced Parsing: Uses human-readable compound duration strings interpreted cleanly via explicit IANA --timezone modifiers.
Compressed Asset Auditing tar -ztf src.tar.gz | grep "cfg" xff --archive -path "*src.tar.gz*cfg*" Virtual File-tree Mapping: Treats archives as virtual read-only directories, matching inner structures without manual disk extraction.
Isolated Variable Outputting find . -printf "%p,%s\n" xff --format=csv --columns=path,size Structured Records: RFC 4180 quoting keeps commas, quotes, CR, and LF inside their CSV cells without shell parsing.

* The find style is still xff's engine, not a wrapper around the OS find. It restricts
the expression vocabulary, but xff globals such as --format, --sort, and --jobs remain
available as explicit overrides. The clearest divergence is regex: -regex / -iregex
default to RE2 (linear-time, no catastrophic backtracking) and behave identically on Linux
and macOS - where GNU find instead defaults to its Emacs dialect and BSD/macOS find to BRE.
-regextype selects xff's grammar set (RE2, ERE, EXACT, FNMATCH, GLOB, SHGLOB, plus PCRE2 in
a full build), never GNU's dialect names. ERE deliberately uses the platform POSIX implementation;
the other core grammars are cross-platform. GLOB and SHGLOB are locale-independent, component-aware,
and reject malformed bracket expressions instead of silently changing their meaning. SHGLOB adds
nested alternatives and bounded integer or ASCII-letter sequences such as {01..12} and {a..z}.
Otherwise the find expression vocabulary follows the documented GNU, BSD, and POSIX behavior that xff makes uniform across platforms.


Examples

# Ten largest files (-printf builds any columnar line; the shell sorts).
xff . -type f -printf '%s\t%p\n' | sort -rn | head

# Apparent bytes per extension (--summary may sit at the end).
xff . -type f --summary=ext

# Delete stale temp files, safely (prints what -delete WOULD remove).
xff . -type f -name '*.tmp' -mtime +7 -delete --dry-run

# Search code content, filtered by language (path:lineno:text for every TODO).
xff src -lang 'C*' -grep 'TODO'

# Checksum manifest for a tree (like sha256sum: `DIGEST  PATH` per file).
xff . -type f -hash:sha256

# Recently changed files as machine rows (one JSON object per file, for jq).
xff . -type f -mtime -1 --format=jsonl

See the XFF.md cookbook for more worked examples, including native per-author git blame line counts computed with no shell pipes.


Documentation

The vocabulary and options are defined once inside the C++ binary (the engine registry acts as the single source of truth), ensuring that every documentation surface is automatically generated and cannot drift:


Building & Dependencies

Building from source requires Bazel:

# Build and run the lean binary.
bazel run //xff -- . -type f -name '*.md'

# Or build once; the executable is bazel-bin/xff/cli/xff.
bazel build //xff

The default build provides a lean, dependency-light core. Heavier processing capabilities (such as the advanced PCRE2 regex grammar or recursive archive diving) are decoupled as composable build-time extras that are disabled by default to keep the core binary small. The extended target links them all:

# The full binary, with every extra (PCRE2, archive diving, Brotli, etc.).
bazel build --config=xff_full //xff/cli:xff_full

The //xff target alias follows your active workspace configuration automatically: it resolves to the lean binary by default, and switches to the full binary under --config=xff_full. The underlying targets remain explicit and configuration-stable: //xff/cli:xff is always lean, and //xff/cli:xff_full is always full.

Published binaries use --config=clang_release, which combines the hermetic Clang toolchain with
size optimization and ThinLTO. Releases provide the stripped xff-PLATFORM-ARCH and
xff_full-PLATFORM-ARCH executables directly. Each platform also provides separate level-19
Zstandard-compressed xff-PLATFORM-ARCH.tar.zst and xff_full-PLATFORM-ARCH.tar.zst archives.
Each archive contains its own executable and matching symbol file under debug/; no .tar.gz
duplicate is published. See the latest release
for downloads and installation instructions. The ordinary Linux and
macOS CI jobs run tagged binary-level tests with this same configuration and execute the staged,
stripped binaries before a release can use it; the full unit-test graph stays on the same hermetic
Clang toolchain without paying ThinLTO cost for every test executable. Each release also publishes
an attested SHA256SUMS manifest and installation instructions, including generation of the
matching man page directly from the installed binary with xff --pager=never --man.

Compile-Time Enforcement: The CLI options for extras (e.g., --regextype=PCRE2 or --archive) are always exposed on the interface. Attempting to invoke an extra feature in a lean build that did not compile it will yield an immediate, explicit error rather than a silent failure or fallback.


Contributing

See CONTRIBUTING.md, the LLM agent and contributor guidelines in AGENTS.md, and the coding styles in STYLE_CPP.md and STYLE_SH.md. In-depth design notes live under docs/; current work is tracked in TODO.md, while completed investigations and decisions move to the development history.


License

Copyright M. Boerger, the MBO Works authors. Licensed under the Apache License 2.0; see
LICENSE, Lean build notices, and
Full build notices for details. For custom builds, --help=notice lists
exactly the components included in the running binary.