Expand description
utf8-forge orchestration: per-file pipelines, report assembly, and the
run() entry point with exit-code mapping.
Exit codes:
0success1non-fatal per-file issues (unknown,decode_error,io_error,fetch_error)2fatal (bad args, missing root, I/O setup failure) — also emitted by clap on parse errors3verify/fixgate failure (non-UTF-8 whitelisted files; fix’s verify gate wins over convert-side issues)
Modules§
- cli
- clap definitions for the CLI surface.
- config
- TOML config file support (
--config <PATH>). - detector
- Encoding detection: a frozen rule-based algorithm, deliberately without statistical guessing so results are auditable and reproducible.
- differ
- Report-to-report comparison for the
diffsubcommand. - error
- Error types shared across the transcoding pipeline.
- fetcher
- Optional remote download.
- filter
- File selection: extension whitelist + directory blacklist double gate.
- ignorefile
- Gitignore-style exclusion files (
--ignore-file/ auto-discovered<root>/.utf8forgeignore). - reporter
- Console output + JSON reports.
- transcoder
- Strict decode / encode / transcode.
- walker
- Recursive candidate collection on top of
walkdir. - writer
- Crash-safe persistence.
Structs§
- Convert
Ctx - Shared context for tree-mode conversion.
Functions§
- convert_
file - Detect + transcode + (unless dry-run) backup + atomic write.
- run
- Dispatch a parsed CLI and map the outcome to a process exit code. Fatal setup errors print to stderr and yield exit code 2.
- scan_
file - Detect only. Oversized files are never read.
- verify_
file - Verify a file is UTF-8 without BOM. Unreadable / oversized files fail closed (a gate must not wave through what it cannot inspect).