| name | fast-yaml-cli |
| description | High-performance YAML processor (`fy` binary) for validation, formatting, linting, and bidirectional YAMLโJSON conversion. Use when agents need to parse/validate YAML, format it with consistent indentation, check for lint violations with diagnostic output, or convert between YAML and JSON formats. Supports batch processing with parallel workers, glob patterns, and structured output (text or JSON). |
| license | MIT OR Apache-2.0 |
| compatibility | macOS (x86_64, aarch64), Linux (x86_64, aarch64), Windows (manual binary download).
`fy` binary available via: `cargo install fast-yaml-cli` (requires Rust toolchain),
prebuilt binary from GitHub Releases (download + checksum verify for Windows),
or install script: `curl -fsSL https://raw.githubusercontent.com/bug-ops/fast-yaml/main/scripts/install.sh | sh` (macOS, Linux only). |
| metadata | {"author":"bug-ops","version":"0.6.6"} |
Installation
Via Cargo (if Rust toolchain available)
cargo install fast-yaml-cli
Installs fy binary to ~/.cargo/bin. Verify with fy --version.
Via Install Script (macOS, Linux)
curl -fsSL https://raw.githubusercontent.com/bug-ops/fast-yaml/main/scripts/install.sh | sh
Downloads prebuilt binary from latest GitHub Release, verifies checksum with sha256, and installs to $FASTYAML_INSTALL_DIR (default: ~/.local/bin). Requires curl, tar, and either sha256sum or shasum.
Pinning to a specific version:
FASTYAML_VERSION=v0.6.6 curl -fsSL https://raw.githubusercontent.com/bug-ops/fast-yaml/main/scripts/install.sh | sh
Custom install directory:
FASTYAML_INSTALL_DIR=/usr/local/bin curl -fsSL https://raw.githubusercontent.com/bug-ops/fast-yaml/main/scripts/install.sh | sh
Manual Download
macOS & Linux (Unix)
- Go to https://github.com/bug-ops/fast-yaml/releases
- Download the prebuilt
.tar.gz archive for your OS/arch:
- macOS x86_64:
fy-v0.6.6-x86_64-apple-darwin.tar.gz
- macOS ARM64:
fy-v0.6.6-aarch64-apple-darwin.tar.gz
- Linux x86_64 (glibc):
fy-v0.6.6-x86_64-unknown-linux-gnu.tar.gz
- Linux x86_64 (musl/Alpine):
fy-v0.6.6-x86_64-unknown-linux-musl.tar.gz
- Linux ARM64:
fy-v0.6.6-aarch64-unknown-linux-gnu.tar.gz
- Download the corresponding
.sha256 checksum file
- Verify:
sha256sum -c fy-v0.6.6-*.tar.gz.sha256 (or shasum -a 256)
- Extract:
tar -xzf fy-v0.6.6-*.tar.gz
- Move binary to PATH:
mv fy-v0.6.6-*/fy /usr/local/bin/
Windows
- Go to https://github.com/bug-ops/fast-yaml/releases
- Download:
fy-v0.6.6-x86_64-pc-windows-msvc.zip
- Download the corresponding
.sha256 checksum file
- Verify the archive (before extracting) โ see "Checksum verification" in Platform Notes โ Windows section below
- Extract:
Expand-Archive -Path fy-v0.6.6-x86_64-pc-windows-msvc.zip -DestinationPath .
- Move
fy.exe to your chosen %PATH% directory
From Source
git clone https://github.com/bug-ops/fast-yaml.git
cd fast-yaml
cargo build -p fast-yaml-cli --release
CLI Reference
Global Options
All subcommands support these flags, usable before or after the subcommand name:
| Flag | Short | Default | Description |
|---|
--output FILE | -o | stdout | Write output to FILE instead of stdout |
--in-place | -i | โ | Edit file in-place (requires file argument; not supported by lint) |
--no-color | โ | โ | Disable colored output (useful in CI) |
--quiet | -q | โ | Quiet mode: errors only (no info messages) |
--verbose | -v | โ | Verbose output (e.g., processing details in batch mode) |
Top-Level Output Format Flag
The top-level output format flag must be placed BEFORE the subcommand name (unlike the above flags):
fy --format json parse file.yaml
fy parse file.yaml --format json
| Flag | Short | Default | Description |
|---|
--format FORMAT | -f | yaml | Output format for subcommand output: yaml, json, or compact |
Note: This is distinct from the lint subcommand's own --format flag (which selects lint output format as text or json and must come AFTER lint). Both flags share the same name but control different things โ the top-level --format affects how all subcommands render their output, while fy lint --format json specifically selects structured lint diagnostics.
parse
Parse and validate YAML.
fy parse [OPTIONS] [FILE]
Arguments:
FILE: Input file. If omitted, reads from stdin.
Options:
--stats: Show parse statistics (key count, max nesting depth).
Output:
- Valid YAML:
โ YAML is valid (exit 0)
- With
--stats: validation message + statistics block
- Invalid YAML: error message with parser diagnostics (exit 1)
Examples:
echo "name: Alice" | fy parse
fy parse config.yaml --stats
fy parse config.yaml -f json
format
Format YAML with consistent style (fixed indentation, line width, key ordering). Comments are NOT preserved by the formatter โ use --strip-comments to suppress the error if comments are present.
fy format [OPTIONS] [PATHS]...
Arguments:
PATHS: Input file(s), directory, or glob pattern. If empty and no --stdin-files, reads from stdin.
- Single file: formats in-place with
-i or to stdout
- Directory or glob: batch mode (see below)
- Multiple paths: batch mode (see below)
Options:
| Flag | Short | Default | Description |
|---|
--indent INDENT | โ | 2 | Indentation width: 2โ8 spaces |
--width WIDTH | โ | 80 | Maximum line width (for formatting decisions) |
-j, --jobs JOBS | โ | 0 | Parallel workers: 0 = auto-detect, >0 = explicit count |
--stdin-files | โ | โ | Read file paths from stdin (one per line) โ forces batch mode |
--include PATTERN | โ | โ | Include files matching glob (can repeat) |
--exclude PATTERN | โ | โ | Exclude files matching glob (can repeat) |
--no-recursive | โ | โ | Don't recurse into subdirectories (batch mode only) |
-n, --dry-run | โ | โ | Show what would be changed without modifying files (batch mode only) |
--strip-comments | โ | โ | Suppress error if comments are detected (comments are stripped) |
Modes:
- Single file:
fy format file.yaml โ stdout; fy format -i file.yaml โ in-place
- Stdin:
cat file.yaml | fy format โ stdout
- Batch (directory/glob/multiple paths/โstdin-files): processes all matched files in parallel:
fy format dir/ โ format all .yaml/.yml in dir recursively, write in-place
fy format '*.yaml' โ format all YAML in current directory
fy format file1.yaml file2.yaml โ format both files
fy format -i --include '*.yaml' --exclude 'vendor/**' . โ include/exclude patterns with recursion disabled: fy format --no-recursive --include '*.yaml' .
Output:
- Formatted YAML (preserves structure, reorders keys alphabetically, applies indentation)
- Quiet mode (
-q) suppresses file-processed messages; only shows errors
- Verbose mode (
-v) shows processing details
Gotchas:
- Comment handling: if YAML contains comments,
fy format exits with error (exit 1) unless --strip-comments is passed. Comments are not preserved by the formatter.
- Key ordering: formatter reorders keys alphabetically in each mapping
Examples:
fy format messy.yaml
fy format -i --indent 4 config.yaml
fy format -i configs/
fy format --dry-run -i configs/
fy format -i --include '*.yaml' --exclude 'test/**' .
cat raw.yaml | fy format
find . -name '*.yaml' | fy format --stdin-files
convert
Convert between YAML and JSON.
fy convert [OPTIONS] <TO> [FILE]
Arguments:
TO: Target format: yaml or json (required)
FILE: Input file. If omitted, reads from stdin.
Options:
--pretty [PRETTY]: Pretty-print JSON output (default: true). Set to false for compact JSON: --pretty false
Output:
- YAMLโJSON: formatted JSON (with
--pretty true) or compact JSON (with --pretty false)
- JSONโYAML: formatted YAML with 2-space indent
- Keys are sorted alphabetically
Examples:
fy convert json config.yaml
fy convert json --pretty false config.yaml
fy convert yaml data.json
fy convert -i json data.yaml
echo '{"name": "Alice"}' | fy convert yaml
lint
Lint YAML with diagnostics and structured reporting. Requires linter feature (enabled by default in binary releases).
fy lint [OPTIONS] [PATHS]...
Arguments:
PATHS: Input file(s), directory, or glob pattern. If empty, reads from stdin.
Options:
| Flag | Short | Default | Description |
|---|
--config FILE | โ | auto-discover | Path to .fast-yaml.yaml config file |
--no-config | โ | โ | Disable config file auto-discovery |
--max-line-length N | โ | โ | Override config file's max line length |
--indent-size N | โ | โ | Override config file's indent size |
--format FORMAT | โ | text | Output format: text (human-readable) or json (structured) |
--allow-duplicate-keys [BOOL] | โ | โ | Allow duplicate keys (opt-in); true/false or flag alone for true |
--include PATTERN | โ | โ | Include files matching glob (can repeat) |
--exclude PATTERN | โ | โ | Exclude files matching glob (can repeat) |
--no-recursive | โ | โ | Don't recurse into subdirectories |
-j, --jobs JOBS | โ | 0 | Parallel workers: 0 = auto-detect |
Config File Discovery:
If no --config is specified, fy lint searches from the input file's directory up the tree for .fast-yaml.yaml.
Output Formats:
Text (default):
info[key-ordering]: key 'age' should be ordered before 'name' (line 2)
--> input:3:1
|
1 | ---
2 | name: Alice
3 | age: 30
|
4 | active: true
JSON (with --format json):
[
{
"code": "key-ordering",
"severity": "info",
"message": "key 'age' should be ordered before 'name' (line 2)",
"span": {
"start": { "line": 3, "column": 1, "offset": 16 },
"end": { "line": 3, "column": 1, "offset": 19 }
},
"context": {
"lines": [
{ "line_number":
Lint Severity Levels:
error โ exits with code 2 if any errors found
warning โ reported but does not affect exit code
info โ style suggestions; does not affect exit code
Built-in Rules (examples):
key-ordering โ keys should be in alphabetical order
line-length โ lines should not exceed max length
indentation โ indentation should be consistent
duplicate-keys โ duplicate keys are not allowed (unless --allow-duplicate-keys)
Examples:
fy lint config.yaml
fy lint --format json config.yaml | jq .
fy lint configs/
fy lint --config my-lint-config.yaml config.yaml
fy lint --max-line-length 120 config.yaml
fy lint --allow-duplicate-keys config.yaml
fy lint --exclude 'test/**' .
Exit Codes
| Code | Meaning |
|---|
0 | Success (parse/format/convert succeed; lint found no errors) |
1 | Any error: YAML parsing failure, I/O error (file not found, permission denied), or general application error |
2 | Lint found errors (diagnostic violations); also used by clap for malformed CLI invocations (flag syntax errors, unexpected arguments) |
Note: Exit codes 3 and 4 are defined in the enum but never constructed โ all non-lint errors surface as exit 1 in the current implementation.
Note on exit code 2: Clap itself returns exit 2 for malformed CLI invocations (e.g., fy parse file.yaml --format json where --format is in the wrong position). This collides with ExitCode::LintErrors (also 2). Both produce exit 2, but the error message differs: clap prints "unexpected argument", while lint produces structured diagnostics.
Platform Notes
macOS Gatekeeper
Binaries downloaded via the install script acquire the com.apple.quarantine extended attribute. On first run, macOS may block execution with: "cannot be opened because the developer cannot be verified" or similar.
To allow the binary, remove the quarantine attribute:
xattr -d com.apple.quarantine ~/.local/bin/fy
Or, if installed via cargo: ~/.cargo/bin/fy may also be quarantined depending on how Rust was installed.
The install script does NOT automatically remove this attribute โ this is by design, allowing you to inspect the binary before use.
Linux libc Coverage
Prebuilt CLI binaries support both glibc and musl on x86_64, but glibc only on aarch64:
x86_64 Linux:
- glibc (standard distros like Ubuntu, Debian, Fedora):
x86_64-unknown-linux-gnu โ available via install script and manual download
- musl (Alpine, Void, etc.):
x86_64-unknown-linux-musl โ available via install script and manual download; same installation flow as glibc
aarch64 (ARM64) Linux:
- glibc (Ubuntu ARM64, Debian ARM64):
aarch64-unknown-linux-gnu โ available via install script and manual download
- musl: NOT YET PUBLISHED. Alpine on ARM64 and other musl aarch64 systems must build from source:
git clone https://github.com/bug-ops/fast-yaml.git
cd fast-yaml
cargo build -p fast-yaml-cli --release --target aarch64-unknown-linux-musl
Alternatively, use a glibc-compatible container (e.g., Docker with Ubuntu/Debian ARM64 base image).
Windows
No install script available (scripts/install.sh is POSIX shell, Linux/macOS only).
Installation method: manual binary download only. See Manual Download section above.
When downloaded, the binary is named fy.exe. Add its directory to %PATH% via:
- Command Prompt (cmd.exe):
setx PATH "%PATH%;C:\path\to\fy"
- PowerShell:
$Env:PATH += ";C:\path\to\fy" (session-only) or use System Properties โ Environment Variables (persistent)
Checksum verification on Windows (required before extracting):
Get-FileHash -Path fy-v0.6.6-x86_64-pc-windows-msvc.zip -Algorithm SHA256
Compare the output hash against the .sha256 file downloaded from the release. Then extract with Expand-Archive -Path fy-v0.6.6-x86_64-pc-windows-msvc.zip -DestinationPath . and move the fy.exe binary to your chosen %PATH% directory.
PATH Setup Across Shells
Adding the binary directory to PATH is shell-specific:
- bash/zsh:
export PATH=$HOME/.local/bin:$PATH (add to ~/.bashrc or ~/.zshrc)
- fish:
fish_add_path $HOME/.local/bin (add to ~/.config/fish/config.fish)
- Windows (PowerShell): Use
setx (persistent) or $Env:PATH assignment (session-only)
After install, verify: fy --version
Behavior Notes
- Comment Stripping: The formatter does NOT preserve comments. If input YAML contains comments,
fy format exits with error (1) unless --strip-comments is passed, which silently removes them.
- Key Ordering: Both formatter and linter enforce alphabetical key ordering by default.
- JSON Parsing: Convert from JSON to YAML works with
fy convert yaml <json-file>. JSON must be valid; the parser uses serde_json.
- Parallel Processing: Batch mode (directory/glob/multi-file) automatically uses available CPUs. Override with
-j N.
- Glob Patterns: Use standard glob syntax (
*, ?, [a-z]). Patterns like src/**/*.yaml work with --include/--exclude.
- Stdin Piping: All subcommands support reading from stdin if FILE is omitted (except lint without PATHS reads from stdin).
- Color Output: Colored output is enabled by default (if terminal is a TTY). Disable with
--no-color (useful in CI/scripts).
Integration with Agents
When to use:
- YAML validation:
fy parse file.yaml โ quick syntax check
- YAML formatting:
fy format -i *.yaml โ batch-process a project's YAML files
- JSONโYAML:
fy convert yaml data.json โ convert API responses or config formats
- Linting:
fy lint --format json config.yaml | jq โ structured lint output for CI pipelines
- Batch processing:
fy format --include '*.yaml' --exclude 'vendor/**' . โ format directories with pattern matching
- Parallel jobs:
fy format -j 8 configs/ โ speed up formatting of large file sets
Compatibility
- Rust version requirement: 1.88.0+ (per
rust-version in Cargo.toml)
- YAML spec: YAML 1.2.2 (via
yaml-rust2 and saphyr-parser)
- Platforms: Linux (x86_64, aarch64), macOS (x86_64, aarch64), Windows (manual binary)