yq CLI
The Go CLI reads and edits YAML, JSON and related formats for targeted agent-assisted configuration transformations.
- 16,229 ★ on the repository
- Last commit
- MIT
Extended access
Why this level
- The CLI can read secret configuration fields and overwrites source files when `-i` is used.
Install
Manual install
Choose an official binary from the first Install section. Verify mikefarah/yq, test the expression on a copy and show output before using `-i`.
Access and checks
How we reviewExtended accessThe tool runs code or makes network calls and only reads external data.
- The CLI can read secret configuration fields and overwrites source files when `-i` is used.
This is third-party code. Review the repository files before installing.
What it does
Mike Farah’s yq selects and transforms structured data from the terminal. An agent can read a YAML value, update one element or merge documents using jq-like expressions across several formats. Input can be a file or stdin, with separate output or in-place editing. Users choose paths and review configuration changes before application. A standalone binary avoids a separate language runtime.
Who it is for. Application-configuration maintainers needing inspectable YAML and JSON changes in agent workflows.
Good fit when
- An agent needs one field from a large YAML without printing the whole file.
- A test configuration needs a targeted value change.
- Several documents need merging under an explicit rule.
- Another tool needs conversion between JSON and YAML.
Not a fit when
- You require full compatibility with every jq expression.
- All comments and whitespace must remain byte-identical.
- The environment invokes a different yq implementation.
Example request
Read the selected test YAML field with yq and show the proposed value without in-place writing.Limitations
This is the Go implementation from mikefarah/yq; first verify which executable the current PATH resolves. It supports many familiar jq operations but not all, so test complex expressions on a representative sample. Comments and whitespace are preserved where possible without universal guarantees. The `-i` flag writes back to the source file; start with a copy or separate output and inspect the resulting configuration.
How to disable. Remove yq from scripts and restore edited configuration from Git or backups if needed. Uninstalling the binary does not undo changes.
FAQ
How do I read a selected field?
The example `yq '.a.b[0].c' file.yaml` selects that path. Adapt it to your document structure.
How do I output JSON from YAML?
Use `yq -o json file.yaml`.
What does `-i` do?
It writes the result in place, modifying the original file.
Why was yes not treated as true?
YAML 1.2 does not treat yes and no as booleans.
Does this implementation need Python?
No. It provides standalone Go binaries.
Discussion
No questions or reviews yet.
Related
CLI toolsThe CLI decodes binary formats with jq-style queries so an agent can inspect file structure and extract selected fields.
The CLI selects and changes JSON, YAML and other structured values so agents can transform data with one query language.
The CLI runs SQL over CSV, JSON and other tabular files so agents can join exports and select output formats.
The CLI imports CSV and JSON into SQLite, runs SQL and reshapes tables for agent-assisted local data preparation.
jc converts command output, files and strings into JSON with dedicated parsers for use in scripts and downstream tools.
migrate CLI applies versioned database changes in order, with a chosen step count or target schema version for each run.
Comparison with similar tools
Cards that share the main search query, and how they differ.
| Tool | Official | Repository stars | Main difference |
|---|---|---|---|
| yq (this card) | no | 16,229 | |
| fq | no | 10,627 | uses jq-style queries to inspect binary formats |
| Dasel | no | 8,054 | The CLI selects and changes JSON, YAML and other structured values so agents can transform data with one query language. |
| jnv | no | 6,131 | The interactive JSON viewer updates filter results while you type, helping users verify a query proposed by an agent. |
README in short
Array selection, loading other files and environment-based values are supported. Output formats can be selected explicitly.