{
  "slug": "yq-adds-jq-style-conditional-operator-b85a2f179130",
  "title": "yq adds jq-style conditional operator",
  "tools": [
    "yq"
  ],
  "tags": [
    "agent"
  ],
  "introduced_at": "2026-09-29T04:22:30.000Z",
  "announced_at": "2026-09-29T04:22:30.000Z",
  "effective_at": null,
  "date_basis": "source-publication",
  "status": "unknown",
  "how": {
    "incantation": "When transforming YAML or another supported input with yq v4.54.1, use the jq-style `if … then … elif … else … end` expression to choose a result by condition.",
    "examples": [
      "yq 'if <condition> then <result> elif <condition> then <result> else <result> end' <input-file>"
    ],
    "gotchas": [
      "Version: v4.54.1",
      "if <condition> (required): Begins the conditional and supplies the first condition. The v4.54.1 release note documents the operator; detailed condition semantics were not found.",
      "then <result> (required): Supplies the result for the preceding condition. Detailed result semantics were not found.",
      "elif <condition> then <result>: Adds a further condition and its result; the release note names `elif` as part of the operator. Detailed behavior was not found.",
      "else <result> (required): Supplies the alternative result; the release note names `else` as part of the operator. Detailed behavior was not found.",
      "end (required): Closes the conditional expression.",
      "<input-file> (required): Input file to process; yq also supports reading input from standard input.",
      "Prerequisite: Use yq v4.54.1 or later for the conditional operator; the release note announces it in v4.54.1.",
      "Prerequisite: Install or otherwise have the yq command available; the README describes it as a standalone command-line processor.",
      "Docs conflict: The tips page says yq had not yet added if expressions, but it predates v4.54.1 and conflicts with the v4.54.1 release note. Use the release note for the new operator's availability."
    ]
  },
  "why_it_matters": "Evaluate a jq-style conditional expression while transforming YAML or other supported data.",
  "before": "The official tips page says to combine `with` and `select` to approximate if/elif/else logic; it notes that the approach has no `else` concept and may require extra logic.",
  "sources": [
    "https://github.com/mikefarah/yq/releases/tag/v4.54.1",
    "https://github.com/mikefarah/yq/blob/v4.54.1/README.md",
    "https://mikefarah.gitbook.io/yq/usage/tips-and-tricks"
  ],
  "rank": 0.97033,
  "judge": {
    "publish": true,
    "judge_model": "codex-cli/gpt-6-luna+typesafe/jev-1.13.0",
    "prompt_version": "extract-v7+enrich-v2+judge-v2x3+jev-publish-v1"
  },
  "review_state": "approved",
  "provenance": {
    "run_id": "wave2a-20261017",
    "verdict_id": "wave2a-20261017:wave2a-20261017-f76fb6c53f359252-0:gate",
    "evidence_hash": "621a7166951051148655b8b6ceff570a4763dac8cc1cc8d2998a1d387b882ac8"
  },
  "review": {
    "draft_hash": "53686b2471cc70a77efeae42dda3e4cb7955fa53ed0f6df8235faa6b80d51892",
    "reviewer": "publication-gate",
    "reviewed_at": "2026-10-07T00:00:00.000Z",
    "decision": "wave2a-20261017:gate",
    "reason": "3 of 3 judge runs approved with p_yes >= 0.9 (mean 0.97 >= 0.9; 2 needed) and Jev gave 0.70 (>= 0.6 needed)."
  }
}
