Skip to main content

Crate utf8_forge

Crate utf8_forge 

Source
Expand description

utf8-forge orchestration: per-file pipelines, report assembly, and the run() entry point with exit-code mapping.

Exit codes:

  • 0 success
  • 1 non-fatal per-file issues (unknown, decode_error, io_error, fetch_error)
  • 2 fatal (bad args, missing root, I/O setup failure) — also emitted by clap on parse errors
  • 3 verify/fix gate 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 diff subcommand.
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§

ConvertCtx
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).