Expand description
utf8-forge orchestration: per-file pipelines, report assembly, and the
run() entry point with exit-code mapping.
Exit codes (docs/USAGE.md §7):
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 errors3verifyfound non-UTF-8 whitelisted files
Modules§
- cli
- clap definitions for the CLI surface (
DESIGN.md §9). - detector
- Encoding detection (frozen rule-based algorithm,
DESIGN.md §3). - error
- Error types shared across the transcoding pipeline.
- fetcher
- Optional remote download (
DESIGN.md §8). - filter
- File selection: extension whitelist + directory blacklist double gate
(
DESIGN.md §5). - reporter
- Console output + JSON reports (
DESIGN.md §9,EXECUTION.md §12). - transcoder
- Strict decode / encode / transcode (
DESIGN.md §4). - walker
- Recursive candidate collection on top of
walkdir(DESIGN.md §6). - writer
- Crash-safe persistence (
DESIGN.md §7).
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).