Metadata-Version: 2.5
Name: findfmt
Version: 1.4.0
Summary: A .gitignore-aware file discovery and classification suite that locates files by content format, shebang, and MIME tag for automated linting, formatting, and CI pipelines.
Project-URL: Changelog, https://github.com/bdperkin/findfmt/blob/main/CHANGELOG.md
Project-URL: Documentation, https://bdperkin.github.io/findfmt
Project-URL: Homepage, https://github.com/bdperkin/findfmt
Project-URL: Issues, https://github.com/bdperkin/findfmt/issues
Project-URL: Repository, https://github.com/bdperkin/findfmt
Author-email: Brandon Perkins <bdperkin@gmail.com>
License-Expression: MIT
License-File: LICENSE
License-File: THIRD_PARTY_LICENSES.md
Keywords: classification,discovery,find,format,gitignore,identify,linting,mime,shebang
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Software Development :: Quality Assurance
Classifier: Topic :: Utilities
Requires-Python: >=3.11
Requires-Dist: identify>=2.6
Requires-Dist: pathspec>=1.0.1
Requires-Dist: pyyaml>=6.0.1
Requires-Dist: rich>=13.8
Requires-Dist: typer>=0.16
Requires-Dist: typing-extensions>=4.4; python_version < '3.12'
Description-Content-Type: text/markdown

![findfmt Logo](https://raw.githubusercontent.com/bdperkin/findfmt/main/assets/logo.svg)

[![PyPI Version](https://img.shields.io/pypi/v/findfmt?logo=pypi&logoColor=white)](https://pypi.org/project/findfmt/)
[![Python Versions](https://img.shields.io/pypi/pyversions/findfmt?logo=python&logoColor=white)](https://pypi.org/project/findfmt/)
[![PyPI Wheel](https://img.shields.io/pypi/wheel/findfmt?logo=pypi&logoColor=white)](https://pypi.org/project/findfmt/#files)
[![PyPI Status](https://img.shields.io/pypi/status/findfmt?logo=pypi&logoColor=white)](https://pypi.org/project/findfmt/)
[![PyPI Downloads](https://img.shields.io/pypi/dm/findfmt?logo=pypi&logoColor=white)](https://pypistats.org/packages/findfmt)
[![GitHub Release](https://img.shields.io/github/v/release/bdperkin/findfmt?logo=github)](https://github.com/bdperkin/findfmt/releases/latest)
[![GHCR Container](https://img.shields.io/badge/GHCR-ghcr.io%2Fbdperkin%2Ffindfmt-2496ED?logo=docker&logoColor=white)](https://github.com/bdperkin/findfmt/pkgs/container/findfmt)
[![Platforms](https://img.shields.io/badge/platform-Linux%20%7C%20macOS%20%7C%20Windows-informational?logo=linux&logoColor=white)](https://github.com/bdperkin/findfmt/actions/workflows/ci.yml)
[![Hatch](https://img.shields.io/badge/build%20system-hatch-orange?logo=python&logoColor=white)](https://hatch.pypa.io/)

[![CI Status](https://img.shields.io/github/actions/workflow/status/bdperkin/findfmt/ci.yml?branch=main&label=CI&logo=github)](https://github.com/bdperkin/findfmt/actions/workflows/ci.yml)
[![Dependency Matrix](https://img.shields.io/github/actions/workflow/status/bdperkin/findfmt/dependency-matrix.yml?branch=main&label=deps%20matrix&logo=github)](https://github.com/bdperkin/findfmt/actions/workflows/dependency-matrix.yml)
[![Docs Build](https://img.shields.io/github/actions/workflow/status/bdperkin/findfmt/docs.yml?branch=main&label=docs&logo=readthedocs&logoColor=white)](https://github.com/bdperkin/findfmt/actions/workflows/docs.yml)
[![Vale Prose Lint](https://img.shields.io/github/actions/workflow/status/bdperkin/findfmt/vale.yml?branch=main&label=vale&logo=markdown&logoColor=white)](https://github.com/bdperkin/findfmt/actions/workflows/vale.yml)
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/bdperkin/findfmt/main.svg)](https://results.pre-commit.ci/latest/github/bdperkin/findfmt/main)
[![Last Commit](https://img.shields.io/github/last-commit/bdperkin/findfmt/main?logo=git&logoColor=white)](https://github.com/bdperkin/findfmt/commits/main)

[![Coverage](https://codecov.io/gh/bdperkin/findfmt/branch/main/graph/badge.svg)](https://codecov.io/gh/bdperkin/findfmt)
[![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/astral-sh/uv)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![ty](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ty/main/assets/badge/v0.json)](https://github.com/astral-sh/ty)
[![Docstring Coverage: 100%](https://img.shields.io/badge/interrogate-100%25-brightgreen?logo=readthedocs&logoColor=white)](https://interrogate.readthedocs.io/)
[![Tested with Hypothesis](https://img.shields.io/badge/hypothesis-tested-brightgreen?logo=python&logoColor=white)](https://hypothesis.readthedocs.io/)
[![PEP 561 Typed](https://img.shields.io/badge/typing-PEP%20561%20py.typed-3776AB?logo=python&logoColor=white)](https://peps.python.org/pep-0561/)
[![Deptry](https://img.shields.io/badge/deptry-checked-informational)](https://deptry.com/)
[![Vulture](https://img.shields.io/badge/vulture-checked-informational)](https://github.com/jendrikseipp/vulture)
[![Xenon](https://img.shields.io/badge/xenon-monitored-informational)](https://xenon.readthedocs.io/)
[![Codespell](https://img.shields.io/badge/codespell-checked-informational)](https://github.com/codespell-project/codespell)
[![PyMarkdown](https://img.shields.io/badge/pymarkdown-linted-informational?logo=markdown&logoColor=white)](https://pymarkdown.readthedocs.io/)

[![CodeQL](https://img.shields.io/github/actions/workflow/status/bdperkin/findfmt/codeql.yml?branch=main&label=CodeQL&logo=github)](https://github.com/bdperkin/findfmt/actions/workflows/codeql.yml)
[![zizmor](https://img.shields.io/github/actions/workflow/status/bdperkin/findfmt/zizmor.yml?branch=main&label=zizmor&logo=githubactions&logoColor=white)](https://github.com/bdperkin/findfmt/actions/workflows/zizmor.yml)
[![ClusterFuzzLite](https://img.shields.io/github/actions/workflow/status/bdperkin/findfmt/cflite.yml?branch=main&label=ClusterFuzzLite&logo=google&logoColor=white)](https://github.com/bdperkin/findfmt/actions/workflows/cflite.yml)
[![GitGuardian](https://img.shields.io/badge/GitGuardian-monitored-0052CC?logo=gitguardian&logoColor=white)](https://github.com/bdperkin/findfmt/blob/main/.gitguardian.yaml)
[![Dependabot](https://img.shields.io/badge/dependabot-enabled-025E8C?logo=dependabot&logoColor=white)](https://github.com/bdperkin/findfmt/blob/main/.github/dependabot.yml)
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/bdperkin/findfmt/badge)](https://securityscorecards.dev/viewer/?uri=github.com/bdperkin/findfmt)
[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/15282/badge)](https://www.bestpractices.dev/projects/15282)
[![SLSA Provenance](https://img.shields.io/badge/SLSA-build%20provenance-2088FF?logo=githubactions&logoColor=white)](https://github.com/bdperkin/findfmt/attestations)
[![Security Policy](https://img.shields.io/badge/security-policy-blue?logo=securityscorecard&logoColor=white)](https://github.com/bdperkin/findfmt/blob/main/SECURITY.md)

[![Documentation](https://img.shields.io/badge/docs-GitHub%20Pages-blue?logo=sphinx&logoColor=white)](https://bdperkin.github.io/findfmt/)
[![i18n Languages](https://img.shields.io/badge/i18n-en%20%C2%B7%20es%20%C2%B7%20fr%20%C2%B7%20de%20%C2%B7%20ja-blue)](https://bdperkin.github.io/findfmt/)
[![License: MIT](https://img.shields.io/github/license/bdperkin/findfmt?color=blue&logo=opensourceinitiative&logoColor=white)](https://github.com/bdperkin/findfmt/blob/main/LICENSE)
[![Semantic Versioning](https://img.shields.io/badge/semver-2.0.0-blue?logo=semver&logoColor=white)](https://semver.org/spec/v2.0.0.html)
[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-FE5196?logo=conventionalcommits&logoColor=white)](https://www.conventionalcommits.org/)
[![Keep a Changelog](https://img.shields.io/badge/changelog-Keep%20a%20Changelog-E05735?logo=keepachangelog&logoColor=white)](https://github.com/bdperkin/findfmt/blob/main/CHANGELOG.md)
[![Accessibility WCAG 2.1 AA](https://img.shields.io/badge/WCAG-2.1%20AA-005A9C?logo=w3c&logoColor=white)](https://github.com/bdperkin/findfmt/blob/main/ACCESSIBILITY.md)
[![Pull Requests Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen?logo=github)](https://github.com/bdperkin/findfmt/blob/main/CONTRIBUTING.md)
[![GitHub Issues](https://img.shields.io/github/issues/bdperkin/findfmt?logo=github)](https://github.com/bdperkin/findfmt/issues)
[![GitHub Stars](https://img.shields.io/github/stars/bdperkin/findfmt?style=flat&logo=github)](https://github.com/bdperkin/findfmt/stargazers)

______________________________________________________________________

> **A `.gitignore`-aware file discovery and classification suite that locates files by content format,
> shebang, and MIME tag for automated linting, formatting, and CI pipelines.**

## 1. Why findfmt?

Unlike traditional `find` or globbing tools that rely strictly on file extensions, `findfmt`:

- **Understands file content**: Identifies format by content, shebang (`#!/usr/bin/env python3`), and MIME
  types using the `identify` engine.
- **Respects Git**: Traverses trees hierarchically while pruning `.gitignore` and `.git/info/exclude` paths
  early before descending into large directories (e.g. `node_modules/`, `.venv/`).
- **Deterministic**: Always returns clean, relative, deterministically sorted paths optimized for subshells,
  xargs, and automation.

______________________________________________________________________

## 2. Installation

`findfmt` requires Python 3.11 or newer and is tested on Python 3.11 through 3.15 on Linux, macOS, and
Windows. On Python 3.10, pin the 1.0 series with `findfmt<1.1`; see
[Upgrading to 1.1](https://bdperkin.github.io/findfmt/guides/upgrading.html).

### 2.1. With `uv` (Recommended)

Run directly with `uvx`:

```bash
uvx findfmt --help
```

Install globally:

```bash
uv tool install findfmt
```

Or add to your project:

```bash
uv add findfmt
```

### 2.2. With `pip`

```bash
pip install findfmt
```

### 2.3. With Docker / Container

```bash
docker pull ghcr.io/bdperkin/findfmt:latest
docker run --rm -v "$(pwd)":/workspace -w /workspace ghcr.io/bdperkin/findfmt:latest -t python
```

______________________________________________________________________

## 3. Usage

### 3.1. Locate Files by Tag / Format

```bash
# Locate all Python files
findfmt -t python

# Locate all YAML and JSON files
findfmt -t yaml,json

# Locate shell scripts
findfmt -t shell
```

### 3.2. Shebang Filtering

```bash
# Locate files with bash shebang
findfmt --shebang bash

# Locate scripts executing with python
findfmt --shebang python
```

### 3.3. Pipe Safely to Linters and Tools

Use `-0` for NUL-delimited output with `xargs -0`:

```bash
# Format discovered Python files
findfmt -t python -0 | xargs -0 ruff format

# Lint shell scripts with shellcheck
findfmt -t shell -0 | xargs -r -0 shellcheck
```

### 3.4. Inspect Tags & Summaries

```bash
# Print matched files and their classification tags
findfmt --list-tags -t python

# Print summary statistics to stderr
findfmt -s
```

### 3.5. Structured Data Serialization

Export discovery results to machine-readable formats for pipelines, analysis, and notebooks:

```bash
# Export JSON array of file metadata and filter with jq
findfmt -t python --format json | jq '.[] | .path'

# Stream NDJSON (one JSON record per line)
findfmt -f jsonl

# Generate clean YAML document
findfmt -t yaml -f yaml

# Generate Jupyter Notebook with pandas DataFrame ingestion
findfmt -f ipynb > discovery.ipynb

# Export CSV with header row and process with csvkit
findfmt -f csv | csvcut -c path,tags,size_bytes

# Render aligned CSV table in terminal
findfmt -f csv-table --table-style rounded

# Generate Markdown table
findfmt -t python -f markdown
```

### 3.6. File Metadata & Presentation Options

Inspect extended Unix-style attributes and customize file presentation:

```bash
# Print permissions, ownership, and human-readable sizes
findfmt -p -u -g -h

# Print modification timestamps, sizes, and file type classification indicators
findfmt -D -h -F

# View accumulated recursive directory disk usage in a hierarchical tree
findfmt --tree --du -h

# Print filenames in double quotes, escaping embedded quotes and non-printables
findfmt -Q -q
```

### 3.7. Command Aliases & Entry Points

`findfmt` installs dedicated executable wrappers for frequent operations:

| Command                                | Equivalent To                              | Description                               |
| -------------------------------------- | ------------------------------------------ | ----------------------------------------- |
| `findfiles [PATHS...]`                 | `findfmt --hidden`                         | Traverse all files including hidden files |
| `findfilemime [PATHS...]`              | `findfmt --hidden --list-tags`             | List files with MIME & format tags        |
| `findfilefmt [TAG] [PATHS...]`         | `findfmt --hidden --tag [TAG]`             | Filter files by format tag                |
| `findshebang [INTERPRETER] [PATHS...]` | `findfmt --hidden --shebang [INTERPRETER]` | Filter scripts by shebang pattern         |
| `findfmt0 [PATHS...]`                  | `findfmt --hidden --print0`                | NUL-delimited output for `xargs -0`       |
| `findsummary [PATHS...]`               | `findfmt --hidden --summary`               | Output summary statistics to `stderr`     |

### 3.8. Programmatic Python Library Usage

Integrate `findfmt` directly into Python scripts and automated pipelines:

```python
from findfmt import FileInfo, TraversalConfig, find_files, get_formatter

# Configure traversal scope and format filtering
config = TraversalConfig(include_tags={"python"}, root_paths=["src"])

# Discover matching files as FileInfo objects
for file_info in find_files(config):
    print(f"{file_info.path}: {file_info.tags} ({file_info.size_bytes} bytes)")

# Format results using any built-in serializer (e.g. table, json, tree, yaml)
formatter = get_formatter("table")
print(formatter.format(find_files(config)))
```

______________________________________________________________________

## 4. CLI Options

| Flag                                                   | Description                                                                                                                            |
| ------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------- |
| `-t, --tag, --type TAG`                                | Match files containing specified tag(s)                                                                                                |
| `-e, --exclude, --exclude-tag TAG`                     | Exclude files containing specified tag(s)                                                                                              |
| `--all-tags` / `--no-all-tags`                         | Require match against all include tags (AND logic)                                                                                     |
| `--shebang INTERPRETER`                                | Match shebang interpreter name or pattern                                                                                              |
| `--no-ignore` / `--ignore`                             | Toggle respecting `.gitignore` files                                                                                                   |
| `--gitignore-file PATH`                                | Apply a specific external ignore file across the traversal scope                                                                       |
| `--from-file, --fromfile PATH`                         | Read newline- or NUL-delimited (`-0`, `--print0`) paths or directory listings from a file, or standard input with `-`                  |
| `--offline`                                            | Classify paths from `--from-file` input without inspecting the local filesystem                                                        |
| `--allow-outside-root` / `--no-allow-outside-root`     | Allow `--from-file` paths that resolve outside the traversal root directory                                                            |
| `--hidden` / `--no-hidden`                             | Toggle inspecting hidden files and directories                                                                                         |
| `-d, --dirs-only`                                      | List directories only, suppressing regular file entries                                                                                |
| `-l, --follow-links` / `--no-follow-links`             | Follow directory symlinks with loop detection                                                                                          |
| `-x, --one-file-system`                                | Confine traversal to starting directory's filesystem device                                                                            |
| `-L, --max-depth LEVEL`                                | Restrict directory traversal descent to maximum depth level                                                                            |
| `--filelimit LIMIT`                                    | Skip directories exceeding child entry count threshold                                                                                 |
| `--prune`                                              | Omit empty directories and directories with zero matching files                                                                        |
| `-P, --pattern PATTERN`                                | Match files against wildcard or glob pattern (supports multiple `-P` and `\|`)                                                         |
| `-I, --exclude-pattern PATTERN`                        | Exclude files against wildcard or glob pattern (supports multiple `-I` and `\|`)                                                       |
| `--ignore-case` / `--no-ignore-case`                   | Apply case-insensitive pattern matching across `-P` and `-I`                                                                           |
| `--match-dirs` / `--no-match-dirs`                     | Match directories against patterns; matched directories inherit to child files                                                         |
| `--sort CRITERIA`                                      | Sort entries by `name`, `version`, `time`/`mtime`, `ctime`, `size`, or `none`                                                          |
| `-U, --unsorted`                                       | Yield entries in raw filesystem order (equivalent to `--sort=none`)                                                                    |
| `--dirsfirst, --group-directories-first`               | Group directories before files within each directory level                                                                             |
| `--filesfirst`                                         | Group regular files before directories within each directory level                                                                     |
| `-r, --reverse`                                        | Reverse the sort order (for example, oldest or smallest first)                                                                         |
| `-p, --permissions` / `--no-permissions`               | Print file type and permissions in standard `ls -l` format                                                                             |
| `-u, --user` / `--no-user`                             | Print file owner username (or numeric UID)                                                                                             |
| `-g, --group` / `--no-group`                           | Print file owner group name (or numeric GID)                                                                                           |
| `--inodes` / `--no-inodes`                             | Print filesystem inode number (`st_ino`)                                                                                               |
| `--device` / `--no-device`                             | Print filesystem device number (`st_dev`)                                                                                              |
| `--size` / `--no-size`                                 | Print file size in bytes (`st_size`)                                                                                                   |
| `-h, --human-readable` / `--no-human-readable`         | Print sizes in human-readable format with binary IEC units (`KiB`, `MiB`, `GiB`, `TiB`)                                                |
| `--si` / `--no-si`                                     | Print sizes in human-readable format with SI metric units (`kB`, `MB`, `GB`, `TB`)                                                     |
| `--du, --accumulate-size` / `--no-du`                  | Recursively calculate and accumulate directory disk usage sizes                                                                        |
| `-D, --mtime` / `--no-mtime`                           | Print date and time of last modification (`st_mtime`)                                                                                  |
| `--ctime` / `--no-ctime`                               | Print date and time of last metadata status change (`st_ctime`)                                                                        |
| `--time-format, --timefmt FORMAT`                      | Custom `strftime` timestamp format (implies `-D`)                                                                                      |
| `-F, --classify` / `--no-classify`                     | Append classification indicator (`*` executable, `/` dir, `@` link, `=` socket, `\|` FIFO, `>` door)                                   |
| `-q, --hide-control-chars` / `--no-hide-control-chars` | Replace non-printable control characters in filenames with `?`                                                                         |
| `-N, --literal` / `--no-literal`                       | Print non-printable characters literally without masking                                                                               |
| `-Q, --quote-name` / `--no-quote-name`                 | Enclose filenames in double quotes (`"..."`) with backslash escaping                                                                   |
| `-f, --format FORMAT`                                  | Output format (`text`, `json`, `jsonl`, `yaml`, `ipynb`, `csv`, `csv-table`, `tsv`, `markdown`, `rst`, `table`, `tree`, `xml`, `html`) |
| `-J, --json` / `--no-json`                             | Render output as structured JSON records (equivalent to `--format json`)                                                               |
| `-X, --xml` / `--no-xml`                               | Render output as a hierarchical XML document (equivalent to `--format xml`)                                                            |
| `-H, --html BASEHREF`                                  | Render output as an HTML5 document with hyperlinks prefixed by `BASEHREF`                                                              |
| `--intro PATH`                                         | Prepend a custom HTML fragment file before the listing in HTML mode                                                                    |
| `--outro PATH`                                         | Append a custom HTML fragment file after the listing in HTML mode                                                                      |
| `-T, --title TITLE`                                    | Set the document `<title>` and `<h1>` heading for HTML output                                                                          |
| `--nolinks` / `--no-nolinks`                           | Render paths as plain text instead of hyperlinks in HTML output                                                                        |
| `-o, --output PATH`                                    | Write output to a file (atomically) instead of standard output                                                                         |
| `--csv-safe` / `--no-csv-safe`                         | Neutralize spreadsheet formula injection in CSV and TSV cells                                                                          |
| `--tree` / `--no-tree`                                 | Toggle hierarchical directory tree view (equivalent to `--format tree`)                                                                |
| `--table-style STYLE`                                  | Border style (`rounded`, `simple`, `minimal`, `double`, `heavy`, `markdown`, `ascii`, `cp437`, `square`, `grid`)                       |
| `--pager` / `--no-pager`                               | Toggle interactive paging (auto-pages on TTY when lines exceed terminal height)                                                        |
| `-i, --no-indent` / `--indent`                         | Omit branch indentation in tree view and strip extraneous whitespace in structured formats                                             |
| `-A, --ansi-lines` / `--no-ansi-lines`                 | Use ANSI/VT100 line drawing escapes for tree indentation lines                                                                         |
| `-S, --cp437` / `--no-cp437`                           | Use CP437 console graphics line drawing characters for tree indentation lines                                                          |
| `-C, --color` / `-n, --no-color`                       | Force enable or disable ANSI color output across all output channels                                                                   |
| `--absolute`, `--full-path` / `--no-absolute`          | Toggle absolute vs relative output paths                                                                                               |
| `--relative`, `--relative-path` / `--no-relative`      | Prepend input search path prefix to relative output paths                                                                              |
| `--hyperlink` / `--no-hyperlink`                       | Wrap paths in OSC 8 terminal hyperlink escape sequences                                                                                |
| `--hyperlink-schema SCHEMA`                            | URI schema prefix for terminal hyperlinks (default `file://`)                                                                          |
| `--hyperlink-authority AUTHORITY`                      | Authority or hostname component for terminal hyperlinks                                                                                |
| `--list-tags` / `--no-list-tags`                       | Display identified classification and MIME tags alongside paths                                                                        |
| `-s, --summary` / `--no-summary`                       | Output summary frequency statistics to `stderr`                                                                                        |
| `-0, --print0` / `--no-print0`                         | Delimit paths with a NUL (`\0`) byte for `xargs -0`                                                                                    |
| `--exit-status` / `--no-exit-status`                   | Exit with status 1 when no files match (default: exit 0)                                                                               |
| `--config PATH`                                        | Path to a custom user configuration file overriding default settings                                                                   |
| `--no-config`                                          | Suppress discovery and loading of any configuration file                                                                               |
| `--show-config`                                        | Display active configuration file and resolved configuration settings                                                                  |
| `--generate-config`                                    | Output an annotated reference TOML configuration to stdout and exit                                                                    |
| `--known-tags`                                         | List all supported classification tags and exit                                                                                        |
| `--locale, --lang <locale>`                            | Set display locale for localized messages and format strings (e.g. `es`, `de`, `zh_CN`)                                                |
| `-v, -V, --version`                                    | Display version (`--verbose` adds runtime diagnostics)                                                                                 |
| `--diagnostics`                                        | Display runtime environment diagnostics and exit                                                                                       |
| `--help-all`                                           | Display comprehensive manual, env vars, and exit codes                                                                                 |
| `--help`                                               | Display the categorized help summary and exit                                                                                          |
| `-- [PATHS...]`                                        | POSIX terminator: treat following tokens strictly as paths                                                                             |

See [Exit Status in the CLI Reference](https://bdperkin.github.io/findfmt/cli/index.html#exit-status) for the
formal exit-code contract (`0` success or early pipe close, `1` runtime error or no matches with
`--exit-status`, `2` invalid CLI usage or configuration error, `130` interrupted by `SIGINT`).

______________________________________________________________________

## 5. Hybrid Python-Rust Architecture & Fallback FAQ

`findfmt` combines an ergonomic, strictly typed Python CLI and formatting layer with a native Rust PyO3
extension crate (`findfmt_rs`, compiled to `findfmt._rust_ext` as a Python `3.11+` `abi3` wheel) coordinated
by a unified runtime dispatch gateway (`src/findfmt/core.py`) and pure-Python fallback engine
(`src/findfmt/_fallback.py`). See the full
[Hybrid Python-Rust Architecture & Fallback FAQ](https://bdperkin.github.io/findfmt/quality/hybrid_architecture.html)
in the documentation for architectural details.

- **Why use a hybrid Python-Rust architecture?** Directory traversal, `.gitignore` pruning, shebang parsing,
  and magic-byte header inspection execute once per candidate filesystem entry, making I/O and syscall latency
  the dominant cost on large repositories, while CLI UX (`Typer`/`Rich`), 14 output serializers, layered TOML
  configuration, and `gettext` localization benefit from Python's ecosystem.
- **What if no prebuilt binary wheel exists for a target platform or Rust is unavailable?** `findfmt` remains
  100% functional without Rust. If `findfmt._rust_ext` is absent (`ImportError`), `src/findfmt/core.py`
  transparently routes `find_files()` and `classify_file()` to `src/findfmt/_fallback.py`. Packagers can also
  build a Cargo-free pure-Python `py3-none-any` wheel by setting `HATCH_MATURIN_DISABLE=1`.
- **How to force the pure-Python backend or check which backend is active?** Set `FINDFMT_NO_EXTENSIONS=1`
  (`1`, `true`, `yes`, or `on`) to disable native extensions at runtime without reinstalling. Inspect runtime
  status via `findfmt --diagnostics` (`Backend: rust` or `Backend: python`) or programmatically via
  `findfmt.is_rust_extension_loaded()`, `findfmt.is_rust_backend_active()`, and
  `findfmt.get_active_backend()`.
- **What happens if the Rust extension panics at runtime?** PyO3 converts Rust panics into
  `pyo3_runtime.PanicException` (inheriting from `BaseException`). `src/findfmt/core.py` catches
  `PanicException` at both call and iterator boundaries—deduplicating any entries already yielded across
  single or overlapping roots—and completes execution via `src/findfmt/_fallback.py` without crashing the CLI.

______________________________________________________________________

## 6. Development & Testing

This project uses `uv` alongside a stable Rust toolchain (`rustup`, `rustfmt`, `clippy`, `maturin`) and
enforces 100% test coverage and strict type checking:

```bash
# Clone the repository
git clone https://github.com/bdperkin/findfmt.git
cd findfmt

# Install Python dependencies and build the editable findfmt._rust_ext extension
uv sync --all-groups

# Incrementally rebuild findfmt._rust_ext during Rust development
uv run maturin develop --manifest-path findfmt_rs/Cargo.toml

# Run tests (native + pure-Python fallback) and verify 100% coverage
uv run pytest
FINDFMT_NO_EXTENSIONS=1 uv run pytest

# Run Python and Rust linting and type checking
uv run ruff check
uv run ty check
cargo fmt --manifest-path findfmt_rs/Cargo.toml --check
cargo clippy --manifest-path findfmt_rs/Cargo.toml --all-targets -- -D warnings

# Run full verification suite
uv run python tools/verify_quality.py
```

______________________________________________________________________

## 7. Governance & Community

- [Contributing Guidelines](https://github.com/bdperkin/findfmt/blob/main/CONTRIBUTING.md)
- [Developer & AI Agent Guidelines](https://github.com/bdperkin/findfmt/blob/main/AGENTS.md)
- [Code of Conduct](https://github.com/bdperkin/findfmt/blob/main/CODE_OF_CONDUCT.md)
- [Security Policy](https://github.com/bdperkin/findfmt/blob/main/SECURITY.md)
- [Support Guide](https://github.com/bdperkin/findfmt/blob/main/SUPPORT.md)
- [Accessibility Statement](https://github.com/bdperkin/findfmt/blob/main/ACCESSIBILITY.md)
- [Changelog](https://github.com/bdperkin/findfmt/blob/main/CHANGELOG.md)
- [Documentation & User Guides](https://bdperkin.github.io/findfmt)
- [Upgrading to 1.1](https://bdperkin.github.io/findfmt/guides/upgrading.html)

## 8. License

[MIT License](https://github.com/bdperkin/findfmt/blob/main/LICENSE) © 2026 Brandon Perkins.
